SND.inc
SND.inc file include the following user oriented procedures:
SND fonts, like BDF fonts, are a type of bitmap font, where each character is represented by a specific set of pixels. However, unlike BDF fonts, SND fonts are limited to monospaced fonts and must use pixel widths that are multiples of 8 (e.g., 8x8, 8x12, 16x16, etc.).
One advantage of monospaced glyphs is that you can easily calculate the starting position of any character on the screen by dividing the screen width and height by the font’s width and height. This allows you to predict the exact location of the nth character. With this approach, characters, strings, and numbers can be printed at specific, relative positions (e.g., the nth row and the mth column). It also enables replacing characters directly on the screen without erasing the surrounding space.
When using absolute coordinates, if your screen is 320x240 pixels, printing at coordinates (5, 10) will position the lower left corner of the first glyph at x=5, y=10.
This library supports both relative and absolute positioning for SND fonts.
Since each glyph in an SND font occupies the same space, these fonts can be scaled up by integer factors (e.g., 2x, 3x, etc.). However, scaling results in a pixelated appearance, as each pixel is simply repeated multiple times in both directions.
The pixelization from resizing can be mitigated somewhat using the FontSmooth option. This feature smooths the font but requires additional memory, RAM resources, and processing time. Font smoothing is only available for square fonts up to 32 pixels in size (e.g., 8x8, 16x16, and 32x32). Additionally, font smoothing changes the appearance of the font, making it appear bolder.
This font also supports transparent printing, where only the active pixels are drawn, preserving the background. However, due to the absence of a full screen graphic memory buffer, the background cannot be restored once overwritten by the glyph pixels. Transparent printing also incurs extra processing.
In terms of processing speed, the print options are ordered from fastest to slowest as follows:
• No font resizing and no transparency
• No font resizing with transparency
• Font resizing with no transparency
• Font resizing with transparency
To use a specific SND font, include the corresponding SND font *.inc file in your project. Then, in your code, select the SND font using the command TftSetSndFont(), which should be issued only once. If multiple SND fonts are used, the selected font remains active until changed by a new TftSetSndFont() command.
I’ve included approximately 60 demo fonts in the folder TftLib\Fonts\SND. Once a font is generated with a specific index, you can change the font index if needed. To do so, open the SND font file and manually modify the index number for each font property. For example, this is font index 1:
$define FontSnd1
Symbol FontSndSpace1 = 8
Symbol FontSndPixels1 = 8
Symbol FontSndOffset1 = 0
Dim TableFont1 As Flash8
Note: You can use SND fonts to print not only glyphs but also icons. I’ve included some icon-based font files as well.
Created with the Personal Edition of HelpNDoc: Free Qt Help documentation generator