-
Notifications
You must be signed in to change notification settings - Fork 16
Font
FellippeHeitor edited this page Mar 15, 2017
·
17 revisions
The Font property holds the handle of the loaded font associated with a control. It must be set using the SetFont method and must not be directly manipulated with QB64's builtin font commands.
Control(ControlID).Font = SetFont(FontName$, FontSize%, Attributes$)
- FontName$ must reference a font file. Only TTF fonts are accepted.
- If you don't specify a path, the current path is used.
- In Windows, if a path isn't specified the default font location C:\Windows\Font is searched.
- FontSize% is in pixels, not points.
- Attributes$ follow QB64's _LOADFONT parameters, but notice that BOLD and ITALIC parameters mostly have no effect, as there is usually a separate font file rendered with such attributes for different fonts.
- MONOSPACE will work to load a font with all characters having the same _FONTWIDTH.
You can also use QB64's builtin fonts (_FONT 16 or _FONT 8). To do so, specify only the FontSize% parameter:
Examples:
Control(Label1).Font = SetFont("", 8, "")
Control(Label2).Font = SetFont("", 16, "")
To specify a font at design time, use the following syntax in the editor:
fontfile*attributes*size
The default font for new controls is:
segoeui.ttf**12
If you don't set a control's font property, it will inherit its container's font (either the main form or a frame, if any).