Difference between revisions of "Component: gLCD Font Library (Graphical Library)"

From Flowcode Help
Jump to navigationJump to search
(XML import)
 
 
(29 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
+
{| style="width:50%"
 
 
{| width="50%"
 
 
|-
 
|-
| width="20%" style="color: gray;" | Author
+
| width="20%" style="color:gray;" | Author
 
| Matrix TSL
 
| Matrix TSL
 
|-
 
|-
| width="20%" style="color: gray;" | Version
+
| width="20%" style="color:gray;" | Version
| 1.0 (Release)
+
| 19.1
 
|-
 
|-
| width="20%" style="color: gray;" | Category
+
| width="20%" style="color:gray;" | Category
 
| Graphical Library
 
| Graphical Library
 
|}
 
|}
  
  
 +
==gLCD Font Library component==
 +
A component designed to simplify the task of creating dynamic fonts for use with graphical displays.
 +
 +
==Version information==
 +
 +
Library Version, Component Version, Date, Author, Info
 +
11, 1.0, 20-06-24, BR, Renamed Number fonts to (Number Only)
 +
12, 1.0, 20-06-24, BR, Added new sizes of Arial and SevenSegment fonts
 +
13, 1.0, 20-06-24, BR, Fixed a bug with fonts with more then 255 bytes per character
 +
14, 1.0, 09-08-24, MW, Added new font size variations
 +
15, 1.0, 12-08-24, BR, Fixed a bug with fonts with more then 65535 bytes per font set
 +
16, 16.0, 13-08-24, MW, Added new sizes of Arial, Courier, Fourteen and SevenSegment fonts
 +
16, 16.0, 13-08-24, MW, corrected spelling of Segment and Calibri fonts
 +
16, 16.0, 14-08-24, MW & BR, changed the way the fonts work by reading font from a text file instead of within Font component
 +
17, 17.0, 30-08-24, BR, Added dynamic font selection and made public
 +
17, 17.0, 30-08-24, BR, Added watchdog disable to prevent taking too long error message
 +
17, 17.0, 30-08-24, BR, Changed dynamic font file from .txt to .xml to work with dynamic library updates
 +
22, 19.1, 02-09-24, BR, Changed single .xml font file to multiple files to speed up font parsing system
 +
23, 19.1, 05-09-24, BR, Now works with fonts with and without library headers allowing for easier font development
 +
23, 19.1, 05-09-24, BR, Any printed ASCII above 127 is now treated as a degrees character
 +
23, 19.1, 05-09-24, BR, Fixed degrees symbol out of bounds issue
 +
24, 19.1, 05-09-24, BR, Added a calculation to show the number of ROM bytes used by the selected font
 +
25, 19.1, 11-09-24, BR, Allowed fonts with uppercase characters only to convert lowercase characters to uppercase
 +
26, 19.1, 26-10-24, BR, Mod to allow larger space widths to be entered
 +
27, 19.1, 04-11-24, BR, Fixed a bug with the space widths and reapplied the previous method, now with more options
 +
  
==[[File:Component Icon 1b08885c_807e_4631_930e_a4fef06159dc.png|Image]] gLCD Font Library component==
 
A component designed to simplify the task of creating dynamic fonts for use with graphical displays.
 
  
==Examples==
+
==Detailed description==
''<span style="color:red;">No additional examples</span>''
+
 
 +
The font component provides a series of bitmap glyphs to the graphical display components and is built into these components.
 +
 
 +
Each font can be capable of providing a full character set or just a set of numeric characters, these latter being marked with the word Number.
 +
 
 +
 
 +
===Custom Fonts===
 +
 
 +
Custom fonts can be created using the Custom option and providing a link to a file generated by a tool called The Dot Factory.
 +
 
 +
To do this you must first download and install the dot factory on your computer.
  
 +
[[File:TheDotFactory.zip]]
  
==Downloadable macro reference==
+
http://www.eran.io/the-dot-factory-an-lcd-font-and-image-generator/
  
===<span style="font-weight: normal;"><u><tt>ReadWidth</tt></u></span>===
 
Gets the width of the ASCII character font data
 
  
'''Parameters'''
+
Once the software is installed, run the software and click the spanner (wrench) icon next to the Preset. Configure the software like this.
  
:[[Variable Types|BYTE]] ''Character''
+
[[file:DotFactorySettings.jpg]]
::ASCII position so A = 'A'
 
  
  
'''Return value'''
+
For a fixed width font like courier new you can change the Width (x) setting from Tightest to Fixed.
  
:[[Variable Types|BYTE]]
+
Click Apply and then click the folder next to the Font option to set the font type and size. Click OK when done.
  
  
===<span style="font-weight: normal;"><u><tt>ReadFontStat</tt></u></span>===
+
In the main text window underneath the Font you can specify the characters you will create glyphs for. This can be reduced to ensure you only create glyphs for characters you are going to be using in your program.
Collects a stat about the selected font
 
  
'''Parameters'''
 
  
:[[Variable Types|BYTE]] ''Index''
+
For a complete font glyph set similar to other Flowcode fonts copy and paste the following into the text field.
::0=SpaceColumns, 1=CharacterHeight
 
  
 +
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
  
'''Return value'''
 
  
:[[Variable Types|BYTE]]
+
Once you're done click the Generate button and then click File and Save as files, save to a location on your PC ideally with your Flowcode project file.
  
 +
In Flowcode point the custom file to the .c file generated by the dot factory.
  
===<span style="font-weight: normal;"><u><tt>ReadASCIILUT</tt></u></span>===
+
The new custom font should now simulate and work on embedded hardware. The Flowcode file will need to retain the link to the font .c file so be sure to keep both files when transferring projects.
Gets a single pixel column byte from the selected ASCII character font data.
 
  
'''Parameters'''
+
==Examples==
  
:[[Variable Types|BYTE]] ''Character''
 
::ASCII position so A = 'A'
 
  
:[[Variable Types|BYTE]] ''ByteIndex''
 
::Range: 0 to ((PixelWidth - 1) * BytesPerColumn)
 
  
  
'''Return value'''
 
  
:[[Variable Types|BYTE]]
 
  
  
  
==Simulation macro reference==
 
  
''This component does not contain any simulation macros''
 
  
  
==Property reference==
 
<span style="font-weight: normal;"><u>Embed Font Set</u></span>
 
  
This property is of type ''True or false'' and can be referenced with the variable name ''EmbedFont''.
 
  
Specifies whether or not to add an embedded font set into the program memory.
 
  
Some displays have their own in-built font set and so do not require an additional embedded font.
 
  
<span style="font-weight: normal;"><u>Font</u></span>
 
  
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''Font''.
 
  
Font picker to decide which font to use on your display.
 
  
<span style="font-weight: normal;"><u>Character Spacing</u></span>
 
  
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''FontSpace''.
 
  
Sets the number of blank pixels between each character when printing text.
 
  
Default 1.
 
  
<span style="font-weight: normal;"><u>Space Width</u></span>
 
  
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''SpaceWidth''.
 
  
Sets the number of horizontal pixels used to represent a space character.
+
''<span style="color:red;">No additional examples</span>''
  
<span style="font-weight: normal;"><u>Width Fixed</u></span>
 
  
This property is of type ''True or false'' and can be referenced with the variable name ''WidthFixed''.
 
  
Details if the font has fixed width characters or variable width characters.
 
  
<span style="font-weight: normal;"><u>Pixel Width</u></span>
 
  
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''PixelWidth''.
 
  
Details the pixel width of the font for fixed width characters.
 
  
<span style="font-weight: normal;"><u>Pixel Height</u></span>
 
  
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''PixelHeight''.
 
  
Details the pixel height of the font.
 
  
<span style="font-weight: normal;"><u>First Character</u></span>
 
  
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''FirstChar''.
 
  
Details the first printable ASCI character.
 
  
<span style="font-weight: normal;"><u>Character Count</u></span>
 
  
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''CharCount''.
+
==Macro reference==
  
Details the number of characters available, different fonts may have different characters available.
+
===ReadASCIILUT===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadASCIILUT'''
 +
|-
 +
| colspan="2" | Gets a single pixel column byte from the selected ASCII character font data.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Character
 +
|-
 +
| colspan="2" | ASCII position so A = 'A'&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | ByteIndex
 +
|-
 +
| colspan="2" | Range: 0 to ((PixelWidth - 1) * BytesPerColumn)&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
 +
 
 +
 
 +
===ReadFontStat===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadFontStat'''
 +
|-
 +
| colspan="2" | Collects a stat about the selected font&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Index
 +
|-
 +
| colspan="2" | 0=SpaceColumns, 1=CharacterHeight&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
 +
 
 +
 
 +
===ReadWidth===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadWidth'''
 +
|-
 +
| colspan="2" | Gets the width of the ASCII character font data&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Character
 +
|-
 +
| colspan="2" | ASCII position so A = 'A'&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
 +
 
 +
 
 +
==Property reference==
 +
 
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
 +
|-
 +
|-
 +
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 +
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Font Settings
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 +
| width="90%" | Enabled
 +
|-
 +
| colspan="2" | Allows the font to be disabled when not in use which allows for faster loading and simulation.&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 +
| width="90%" | Embed Font Set
 +
|-
 +
| colspan="2" | Specifies whether or not to add an embedded font set into the program memory. Some displays have their own in-built font set and so do not require an additional embedded font.&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 +
| width="90%" | Embed Width Data
 +
|-
 +
| colspan="2" | Specifies whether or not to add an embedded font set into the program memory. Some displays have their own in-built font set and so do not require an additional embedded font.&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 +
| width="90%" | Font
 +
|-
 +
| colspan="2" | Font picker to decide which font to use on your display.&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 +
| width="90%" | Bytes Required
 +
|-
 +
| colspan="2" | Number of bytes required in program memory to store the selected font.&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 +
| width="90%" | Character Spacing
 +
|-
 +
| colspan="2" | Sets the number of blank pixels between each character when printing text.&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 +
| width="90%" | Width Fixed
 +
|-
 +
| colspan="2" | Details if the font has fixed width characters or variable width characters.&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 +
| width="90%" | Height Fixed
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 +
| width="90%" | Pixel Width
 +
|-
 +
| colspan="2" | Details the pixel width of the font for fixed width characters.&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 +
| width="90%" | Pixel Height
 +
|-
 +
| colspan="2" | Details the pixel height of the font.&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 +
| width="90%" | First Character
 +
|-
 +
| colspan="2" | Details the first printable ASCI character.&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 +
| width="90%" | Character Count
 +
|-
 +
| colspan="2" | Details the number of characters available, different fonts may have different characters available.&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 +
| width="90%" | Uppercase Only
 +
|-
 +
| colspan="2" | Only Uppercase characters are supported, convert any lowercase to uppercase before printing.&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 +
| width="90%" | Bytes Per Column
 +
|-
 +
| colspan="2" | &nbsp;
 +
|}
  
<span style="font-weight: normal;"><u>Bytes Per Column</u></span>
+
==Component Source Code==
  
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''BytesPerColumn''.
+
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_Lib_Fonts.fcfx FC_Comp_Source_Lib_Fonts.fcfx]
  
''<span style="color:red;">No additional information</span>''
+
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_Lib_Fonts.fcfx FC_Comp_Source_Lib_Fonts.fcfx]

Latest revision as of 08:59, 9 June 2025

Author Matrix TSL
Version 19.1
Category Graphical Library


gLCD Font Library component

A component designed to simplify the task of creating dynamic fonts for use with graphical displays.

Version information

Library Version, Component Version, Date, Author, Info
11, 1.0, 20-06-24, BR, Renamed Number fonts to (Number Only)
12, 1.0, 20-06-24, BR, Added new sizes of Arial and SevenSegment fonts
13, 1.0, 20-06-24, BR, Fixed a bug with fonts with more then 255 bytes per character
14, 1.0, 09-08-24, MW, Added new font size variations
15, 1.0, 12-08-24, BR, Fixed a bug with fonts with more then 65535 bytes per font set
16, 16.0, 13-08-24, MW, Added new sizes of Arial, Courier, Fourteen and SevenSegment fonts
16, 16.0, 13-08-24, MW, corrected spelling of Segment and Calibri fonts
16, 16.0, 14-08-24, MW & BR, changed the way the fonts work by reading font from a text file instead of within Font component
17, 17.0, 30-08-24, BR, Added dynamic font selection and made public
17, 17.0, 30-08-24, BR, Added watchdog disable to prevent taking too long error message
17, 17.0, 30-08-24, BR, Changed dynamic font file from .txt to .xml to work with dynamic library updates
22, 19.1, 02-09-24, BR, Changed single .xml font file to multiple files to speed up font parsing system
23, 19.1, 05-09-24, BR, Now works with fonts with and without library headers allowing for easier font development
23, 19.1, 05-09-24, BR, Any printed ASCII above 127 is now treated as a degrees character
23, 19.1, 05-09-24, BR, Fixed degrees symbol out of bounds issue
24, 19.1, 05-09-24, BR, Added a calculation to show the number of ROM bytes used by the selected font
25, 19.1, 11-09-24, BR, Allowed fonts with uppercase characters only to convert lowercase characters to uppercase
26, 19.1, 26-10-24, BR, Mod to allow larger space widths to be entered
27, 19.1, 04-11-24, BR, Fixed a bug with the space widths and reapplied the previous method, now with more options


Detailed description

The font component provides a series of bitmap glyphs to the graphical display components and is built into these components.

Each font can be capable of providing a full character set or just a set of numeric characters, these latter being marked with the word Number.


Custom Fonts

Custom fonts can be created using the Custom option and providing a link to a file generated by a tool called The Dot Factory.

To do this you must first download and install the dot factory on your computer.

File:TheDotFactory.zip

http://www.eran.io/the-dot-factory-an-lcd-font-and-image-generator/


Once the software is installed, run the software and click the spanner (wrench) icon next to the Preset. Configure the software like this.

DotFactorySettings.jpg


For a fixed width font like courier new you can change the Width (x) setting from Tightest to Fixed.

Click Apply and then click the folder next to the Font option to set the font type and size. Click OK when done.


In the main text window underneath the Font you can specify the characters you will create glyphs for. This can be reduced to ensure you only create glyphs for characters you are going to be using in your program.


For a complete font glyph set similar to other Flowcode fonts copy and paste the following into the text field.

!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~


Once you're done click the Generate button and then click File and Save as files, save to a location on your PC ideally with your Flowcode project file.

In Flowcode point the custom file to the .c file generated by the dot factory.

The new custom font should now simulate and work on embedded hardware. The Flowcode file will need to retain the link to the font .c file so be sure to keep both files when transferring projects.

Examples

No additional examples








Macro reference

ReadASCIILUT

Fc9-comp-macro.png ReadASCIILUT
Gets a single pixel column byte from the selected ASCII character font data. 
Fc9-u8-icon.png - BYTE Character
ASCII position so A = 'A' 
Fc9-u16-icon.png - UINT ByteIndex
Range: 0 to ((PixelWidth - 1) * BytesPerColumn) 
Fc9-u8-icon.png - BYTE Return


ReadFontStat

Fc9-comp-macro.png ReadFontStat
Collects a stat about the selected font 
Fc9-u8-icon.png - BYTE Index
0=SpaceColumns, 1=CharacterHeight 
Fc9-u8-icon.png - BYTE Return


ReadWidth

Fc9-comp-macro.png ReadWidth
Gets the width of the ASCII character font data 
Fc9-u8-icon.png - BYTE Character
ASCII position so A = 'A' 
Fc9-u8-icon.png - BYTE Return


Property reference

Fc9-prop-icon.png Properties
Fc9-conn-icon.png Font Settings
Fc9-type-7-icon.png Enabled
Allows the font to be disabled when not in use which allows for faster loading and simulation. 
Fc9-type-7-icon.png Embed Font Set
Specifies whether or not to add an embedded font set into the program memory. Some displays have their own in-built font set and so do not require an additional embedded font. 
Fc9-type-7-icon.png Embed Width Data
Specifies whether or not to add an embedded font set into the program memory. Some displays have their own in-built font set and so do not require an additional embedded font. 
Fc9-type-16-icon.png Font
Font picker to decide which font to use on your display. 
Fc9-type-21-icon.png Bytes Required
Number of bytes required in program memory to store the selected font. 
Fc9-type-21-icon.png Character Spacing
Sets the number of blank pixels between each character when printing text. 
Fc9-type-7-icon.png Width Fixed
Details if the font has fixed width characters or variable width characters. 
Fc9-type-7-icon.png Height Fixed
 
Fc9-type-21-icon.png Pixel Width
Details the pixel width of the font for fixed width characters. 
Fc9-type-21-icon.png Pixel Height
Details the pixel height of the font. 
Fc9-type-21-icon.png First Character
Details the first printable ASCI character. 
Fc9-type-21-icon.png Character Count
Details the number of characters available, different fonts may have different characters available. 
Fc9-type-7-icon.png Uppercase Only
Only Uppercase characters are supported, convert any lowercase to uppercase before printing. 
Fc9-type-21-icon.png Bytes Per Column
 

Component Source Code

Please click here to download the component source project: FC_Comp_Source_Lib_Fonts.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_Lib_Fonts.fcfx