UFONTHEIGHT: Difference between revisions
Jump to navigation
Jump to search
Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link
(Initial version) |
No edit summary |
||
(7 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:_UFONTHEIGHT}} | {{DISPLAYTITLE:_UFONTHEIGHT}} | ||
The | The '''_UFONTHEIGHT''' function returns the global glyph height (incl. ascender/descender) of a font loaded by [[_LOADFONT]]. | ||
{{PageSyntax}} | {{PageSyntax}} | ||
:{{Parameter|pixelHeight&}} = [[_UFONTHEIGHT]][({{Parameter|fontHandle&}})] | : {{Parameter|pixelHeight&}} = [[_UFONTHEIGHT]][({{Parameter|fontHandle&}})] | ||
{{PageParameters}} | |||
* {{Parameter|fontHandle&}} is an optional font handle. | |||
Line 11: | Line 15: | ||
* If no font is set, it returns the current screen mode's text block height. | * If no font is set, it returns the current screen mode's text block height. | ||
* This is different from [[_FONTHEIGHT]] as it may return larger values when using scalable fonts. | * This is different from [[_FONTHEIGHT]] as it may return larger values when using scalable fonts. | ||
{{PageAvailability}} | |||
<!-- QB64 = a version or none, QBPE = a version or all, Platforms = yes or no --> | |||
<gallery widths="48px" heights="48px" mode="nolines"> | |||
File:Qb64.png|'''none''' | |||
File:Qbpe.png|'''v3.7.0''' | |||
File:Apix.png | |||
File:Win.png|'''yes''' | |||
File:Lnx.png|'''yes''' | |||
File:Osx.png|'''yes''' | |||
</gallery> | |||
<!-- additional availability notes go below here --> | |||
{{PageExamples}} | {{PageExamples}} | ||
;Example:Show the difference of '''_UFONTHEIGHT''' vs. [[_FONTHEIGHT]]. | |||
{{CodeStart}} | {{CodeStart}} | ||
{{Cl|DIM}} fh {{Cl|AS}} {{Cl|LONG}}: fh = {{Cl|_LOADFONT}}({{Text|<nowiki>"LHANDW.TTF"</nowiki>|#FFB100}}, {{Text|23|#F580B1}}) | {{Cl|DIM}} fh {{Cl|AS}} {{Cl|LONG}}: fh = {{Cl|_LOADFONT}}({{Text|<nowiki>"LHANDW.TTF"</nowiki>|#FFB100}}, {{Text|23|#F580B1}}) | ||
Line 21: | Line 38: | ||
{{Cl|PRINT}} {{Text|<nowiki>"_UFONTHEIGHT ="</nowiki>|#FFB100}}; {{Cl|_UFONTHEIGHT}}(fh) | {{Cl|PRINT}} {{Text|<nowiki>"_UFONTHEIGHT ="</nowiki>|#FFB100}}; {{Cl|_UFONTHEIGHT}}(fh) | ||
{{CodeEnd}} | {{CodeEnd}} | ||
{{OutputStartBG0}} | {{OutputStartBG0}} | ||
{{Ot|<nowiki>_FONTHEIGHT = 23</nowiki>|#a9a9a9 | {{Ot|<nowiki>_FONTHEIGHT = 23</nowiki>|#a9a9a9}} | ||
{{Ot|<nowiki>_UFONTHEIGHT = 32</nowiki>|#a9a9a9 | {{Ot|<nowiki>_UFONTHEIGHT = 32</nowiki>|#a9a9a9}} | ||
{{OutputEnd}} | {{OutputEnd}} | ||
{{PageSeeAlso}} | {{PageSeeAlso}} | ||
* [[_UPRINTWIDTH]], [[_ULINESPACING]], [[_UPRINTSTRING]] | * [https://qb64phoenix.com/forum/showthread.php?tid=2810 Featured in our "Keyword of the Day" series] | ||
* [[_UPRINTWIDTH]], [[_ULINESPACING]], [[_UPRINTSTRING]], [[_UCHARPOS]] | |||
* [[_FONTWIDTH]], [[_FONTHEIGHT]], [[_FONT]] | * [[_FONTWIDTH]], [[_FONTHEIGHT]], [[_FONT]] | ||
* [[_PRINTWIDTH]], [[_PRINTSTRING]] | * [[_PRINTWIDTH]], [[_PRINTSTRING]] | ||
* [[SCREEN]], [[_LOADFONT]] | * [[SCREEN]], [[_LOADFONT]] | ||
* [[Text Using Graphics]] | * [[Text Using Graphics]] | ||
{{PageNavigation}} | {{PageNavigation}} |
Latest revision as of 21:18, 18 June 2024
The _UFONTHEIGHT function returns the global glyph height (incl. ascender/descender) of a font loaded by _LOADFONT.
Syntax
- pixelHeight& = _UFONTHEIGHT[(fontHandle&)]
Parameters
- fontHandle& is an optional font handle.
Description
- Returns the height 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 is different from _FONTHEIGHT as it may return larger values when using scalable fonts.
Availability
Examples
- Example
- Show the difference of _UFONTHEIGHT vs. _FONTHEIGHT.
DIM fh AS LONG: fh = _LOADFONT("LHANDW.TTF", 23) PRINT "_FONTHEIGHT ="; _FONTHEIGHT(fh) PRINT "_UFONTHEIGHT ="; _UFONTHEIGHT(fh) |
_FONTHEIGHT = 23 _UFONTHEIGHT = 32 |
See also
- Featured in our "Keyword of the Day" series
- _UPRINTWIDTH, _ULINESPACING, _UPRINTSTRING, _UCHARPOS
- _FONTWIDTH, _FONTHEIGHT, _FONT
- _PRINTWIDTH, _PRINTSTRING
- SCREEN, _LOADFONT
- Text Using Graphics