LMD-Tools Font Image List Guide


Font Collection


TLMDFontCollection component adds the possibility to use so called private fonts. Private fonts - are fonts that are not installed in the operating system, but instead, loaded from an application resources at run-time.  This feature allows to use third-party icon fonts like Google Material Icons fonts, or even fully custom fonts with selected icons only.

 

The component allows to load and process *.ttf and *.otf font files. Currently, the component cannot extract the list of code-points from the font files, so for most known icon fonts the list is hard-coded along with the code-point names.

 

Additionally, TLMDFontCollection is able to load *.zip custom font files produced by IcoMoon or Fontello web applications. In such cases the component extracts code-point list along with code-point names from the contained JSON description.

 

Font collection should be linked to a TLMDFontImageList component using image list's FontSource and FontNames properties.

 

Using font collection

 

Font collection component can be placed on a VCL form from Delphi Palette window:

 

clip0024

 

Double clicking on the empty component collection will show file open dialog in which the loading font file can be selected. As noted above *.ttf, *.otf and zip files, produces by mentioned web applications are supported.

 

The selected font file will be loaded and parsed to determine the font metadata, such as font name, copyright, etc. Loaded font is represented as the item in font collection Items property. Items collection editor can be shown via clicking on a 'Items' component context menu item. Alternatively, Items property can be double clicked in Delphi Object Inspector.

 

clip0026

 

clip0025

 

Selecting the item in the items editor will show its properties in Object Inspector. The Data property provides a way to load or clear font via the property editor drop-down list. If the font is loaded all other properties provides read-only information about the font. Additionally, the Size property editor allows to compress/decompress font data to minimize DFM file size.

 

clip0027   clip0028

 

The Codepoints property stores supported code-point list along with code-point names for custom fonts. Each line in the Codepoints string list should contain a name and hexadecimal symbol code separated with space. Code-point list is primarily used by the font image list editor at design-time to show known icons image list.

 

clip0029

 

After font collection configuration it can be connected the the font list component via its FontSource and FontName properties. And then the font image list can be filled with the icons from one of the contained in a collection custom font.

 

clip0030