Small Basic: Fonts
This article explains fonts for the GraphicsWindow object in Microsoft Small Basic.
What is a Font?
A Font is a designed character set. In Windows, many programs have the ability to change fonts. Many fonts are installed into C:\Windows\Fonts folder. For example, this article uses "Segoe UI" font.
There are some common design patterns for fonts. Serif is a small line attached to the end of a stroke in a letter. Serif fonts have serif. Sans Serif fonts don't have serif.
There are two types of character width used in fonts. One is Fixed Pitch fonts that have a same character width. The other is Proportional fonts that have different width for each character.
You can see the fonts installed in your Windows system at C:\Windows\Fonts folder with File Explorer.
What is a Glyph?
Glyph is a shape of each character.
Font Properties
There are four font properties in GraphicsWindow.
FontBold
If GraphicsWindow.FontBold is "True", font characters become thick. Default GraphicsWindow.FontBold value is "True".
FontItalic
If GraphicsWindow.FontItalic is "True", font characters become slant. Default GraphicsWindow.FontItalic value is "False".
FontName
GraphicsWindow.FontName contains font face name.
"Tahoma" is the default font name in local (in Small Basic IDE). "Segoe UI" is the default font name in remote (in smallbasic.com - Microsoft Small Basic Program Listing web site).
FontSize
GraphicsWindow.FontSize means the height [pixels] of characters. In some fonts such like "Tahoma", FontSize means the height between the top line and baseline. In some fonts such like "Courier New", FontSize means the height between the top line and the bottom line. You can recognize this with a sample program Font Sample 0.1 described below.
Default font size is 12 [pixels].
Recommended Fonts
I recommend you to use following six fonts because both Windows and Mac OS system pre-install these fonts.
Font Name | Serif | Fixed Pitch |
Arial | ||
Courier New | ✔ | ✔ |
Georgia | ✔ | |
Times New Roman | ✔ | |
Trebuchet MS | ||
Verdana |
Sample Programs
Recommended Fonts 0.3
This program shows recommended 6 fonts and 2 default fonts.
http://smallbasic.com/program/?FHL579-0
Fonts Sample 0.1
You can change font properties with this program. Also, you can measure the size of fonts with a ruler. You can move the ruler by dragging, and rotate by click.
http://smallbasic.com/program/?ZNR767
See Also
- Small Basic: Character Set - Unicode
- Small Basic: Centering Text in Graphics Window
- Small Basic Known Issue: 21694 - Font and Pen Width Change Earlier in Remote
- Wiki: Small Basic Portal