FONTWIDTH: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
(Created page with "{{DISPLAYTITLE:_FONTWIDTH}} The _FONTWIDTH function returns the font width of a MONOSPACE font handle created by _LOADFONT. {{PageSyntax}} :{{Parameter|pixelWidth%}} = _FONTWIDTH[({{Parameter|fontHandle&}})] * Returns the character width of the last font used if a handle is not specified. * '''Variable width fonts always return {{Parameter|pixelWidth%}} = 0.''' Even fixed width fonts return 0 unless the "MONOSPACE" style option is used. * QB6...")
 
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 11: Line 11:
* QB64 '''version 1.000 and up''' can load a variable width font as monospaced with the [[LOADFONT|"MONOSPACE"]] style parameter.
* QB64 '''version 1.000 and up''' can load a variable width font as monospaced with the [[LOADFONT|"MONOSPACE"]] style parameter.
* The font width is generally 3/4 of the [[_FONTHEIGHT]] specified when loading the font.
* The font width is generally 3/4 of the [[_FONTHEIGHT]] specified when loading the font.
* In '''graphics''' [[SCREEN (statement)|screen]] modes, [[_PRINTWIDTH]] can return the total '''pixel width''' of a literal or variable [[STRING|string]] of text.
* In '''graphics''' [[SCREEN|screen]] modes, [[_PRINTWIDTH]] can return the total '''pixel width''' of a literal or variable [[STRING|string]] of text.




{{PageSeeAlso}}
{{PageSeeAlso}}
* [https://qb64phoenix.com/forum/showthread.php?tid=1145 Featured in our "Keyword of the Day" series]
*[[_FONTHEIGHT]]
*[[_FONTHEIGHT]]
*[[_FONT]]
*[[_FONT]]

Latest revision as of 19:56, 24 May 2024

The _FONTWIDTH function returns the font width of a MONOSPACE font handle created by _LOADFONT.


Syntax

pixelWidth% = _FONTWIDTH[(fontHandle&)]


  • Returns the character width of the last font used if a handle is not specified.
  • Variable width fonts always return pixelWidth% = 0. Even fixed width fonts return 0 unless the "MONOSPACE" style option is used.
  • QB64 version 1.000 and up can load a variable width font as monospaced with the "MONOSPACE" style parameter.
  • The font width is generally 3/4 of the _FONTHEIGHT specified when loading the font.
  • In graphics screen modes, _PRINTWIDTH can return the total pixel width of a literal or variable string of text.


See also



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