TftPrintSndDecimal()

Library Description ›› Fonts ›› SND ››
Parent Previous Next

TftPrintSndDecimal(fDec As Float, bSigDigits As Byte, bDecDigits As Byte, bFontSize As Byte, wX_Pos As Word, wY_Pos As Word, pPosition As Bit, wForeColor As Word, wBackColor As Word, pTransparent As Bit)


fDec = signed decimal value to print

bSigDigits = number of significant digits to print

• If bSigDigits is larger than the number of significant digits, leading zeros will be added.

• If bSigDigits is smaller than the number of significant digits, only bSigDigits digits will be printed.

• If bSigDigits = 0, the number of significant digits will be automatically determined.

bDecDigits = number of decimal digits to print

• If bDecDigits is larger than the number of decimal digits, trailing zeros will be added.

• If bDecDigits is smaller than the number of decimal digits, only bDecDigits digits will be printed.

• If bDecDigits = 0, a signed integer will be printed instead.

bFontSize = font size

• 0 or 1 = nominal size

• 2, 3, 4, ... = multiples of the nominal size

wX_Pos = x position (absolute) for the lower-left corner of the character

wY_Pos = y position (absolute) for the lower-left corner of the character

pPosition = position type for the lower-left corner of the character

• 0 = absolute, actual pixel position on the TFT screen (e.g., wX_Pos = 152, wY_Pos = 86)

• 1 = relative, based on the virtual division of the TFT screen into columns and rows (calculated by FontPixels and FontSpace) (e.g., wX_Pos = 5, wY_Pos = 2; with FontPixels = 8 and FontSpace = 9, the actual position would be x = 5 * 8 = 40; y = 2 * 9 = 18)

wForeColor = character color in 16-bit RGB565 format - used for the glyph pixels

wBackColor = background color in 16-bit RGB565 format - used for empty pixels within the glyph's bounding box

pTransparent = transparency option

• 1 = Yes (use transparency)

• 0 = No (use background color)


Print a signed decimal using SND font.


Example:

TftPrintSndDecimal(-12345.678, 7, 4, 2, 1, 1, 0, WHITE, BLACK, 0)


Note:

-Background color (wBackColor) will be ignored if transparency is enabled, and only the pixels from the glyph will be printed. However, this method is slower than using a background color.

-For further clarification on parameter usage, check TftPrintBdfDecimal() and TftPrintSndString().


$define FontSmooth           0

$define FontMaxSpace         16

$define FontMaxPixels        16

Include "TftLib\Fonts\SND\F28_SND_24x32_Basic_Inconsola.inc"

Include "TftLib\Fonts\SND\F29_SND_24x32_Basic_Ubuntu.inc"

Include "TftLib\TFT_Graphic_Lib.inc"

'...

TftSetUp(0)

TftResetScreen(BLACK)

TftSetSndFont(28,0)

TftPrintSndDecimal(-12345.678, 7, 4, 1, 0, 0, 1, RED, BLUE, 0)

TftPrintSndDecimal(-12345.678, 0, 4, 1, 0, 1, 1, RED, BLUE, 0)

TftPrintSndDecimal(-12345.678, 0, 2, 1, 0, 2, 1, RED, BLUE, 1)

TftSetSndFont(29,0)

TftPrintSndDecimal(-12345.678, 6, 2, 1, 0, 3, 1, RED, BLUE, 1)

TftPrintSndDecimal(12345.678, 0, 4, 1, 0, 4, 1, RED, BLUE, 1)






Created with the Personal Edition of HelpNDoc: Make CHM Help File Creation a Breeze with HelpNDoc