ULINESPACING: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
No edit summary
(Fix Description)
Line 1: Line 1:
{{DISPLAYTITLE:_ULINESPACING}}
{{DISPLAYTITLE:_ULINESPACING}}
The '''_ULINESPACING''' function returns the vertical line spacing in pixels (font height + extra pixels if any).
The '''_ULINESPACING''' function returns the vertical line spacing (distance between two consecutive baselines) in pixels (spacing + extra pixels if any).





Revision as of 04:21, 5 May 2023

The _ULINESPACING function returns the vertical line spacing (distance between two consecutive baselines) in pixels (spacing + extra pixels if any).


Syntax

pixels& = _ULINESPACING[(fontHandle&)]


Parameters

  • fontHandle& is an optional font handle.


Description

  • Returns the vertical line spacing of the last font used if a handle is not designated.
  • If no font is set, it returns the current screen mode's text block height.
  • This can be used to leave the correct amount of line gap between lines.


Availability


Examples

Example
How to use _ULINESPACING.
OPTION _EXPLICIT

SCREEN _NEWIMAGE(800, 600, 32)

DIM fh AS LONG: fh = _LOADFONT("LHANDW.TTF", 23)
IF fh <= 0 THEN
    PRINT "Failed to load font file!"
    END
END IF

_FONT fh

CLS , _RGB32(200, 200, 200)
COLOR _RGB32(0, 0, 0)
_PRINTMODE _KEEPBACKGROUND

DIM l AS STRING, i AS LONG
FOR i = 0 TO 4
    READ l
    _UPRINTSTRING (0, _ULINESPACING * i), l
NEXT

END

DATA "We are not now that strength which in old days"
DATA "Moved earth and heaven; that which we are,we are;"
DATA "One equal temper of heroic hearts,"
DATA "Made weak by time and fate,but strong in will"
DATA "To strive,to seek,to find,and not to yield."


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link