zplCore.comzplCore.com

FontManager

public sealed class FontManager

Maps ZPL font identifiers (0, A–Z, ^CW aliases, downloaded TTFs) to Skia typefaces. Zebra's resident fonts are proprietary, so embedded open fonts (DejaVu, free license) are used, which renders identically on every OS. Any font can be overridden with FontManager.RegisterFont.

Thread-safe (concurrent dictionaries); shared through ZplResourceStore.Fonts.

Constructors

SignatureDescription
# FontManager()

Properties

PropertyTypeDescription
static DefaultMono { get; }SKTypefaceBuilt-in monospace font (barcode texts, EPL/ZPL bitmap font replacement).
static DefaultSans { get; }SKTypefaceBuilt-in condensed sans font (replacement of Zebra font 0).
FontProvider { get; set; }Func<string, byte[]>Optional callback that supplies TrueType/OpenType data for fonts the label references but nobody registered (e.g. "E:ARIAL.TTF" in ^A@ or ^CW). Called at most once per name; return null when the font is unknown.
Fonts { get; }IReadOnlyCollection<string>
Mono { get; set; }SKTypefaceTypeface for the bitmap fonts A–H without a registered TTF.
Scalable { get; set; }SKTypefaceTypeface for font 0 and other scalable fonts without a registered TTF.
SystemFonts { get; set; }boolResolve names that are neither registered, downloaded nor supplied by FontManager.FontProvider as the family name of an installed system font (e.g. "Arial", "Arial Bold", "E:ARIAL.TTF") via SKFontManager.Default. Off for plain ZPL (a printer only knows its stored fonts); on for the label model (ZplRenderSettings.UseSystemFonts).

Methods

Method SignatureReturnsDescription
static # Convert(byte[] ttf, string name, FontDownloadCommand command = FontDownloadCommand.DY)stringConverts a TrueType/OpenType font file into the printer download command: ~DYd:NAME.TTF,A,T,size,,hex (FontDownloadCommand.DY) or ~DUd:NAME.TTF,size,hex (FontDownloadCommand.DU). name may include a drive ("E:ARIAL.TTF", default E:) and gets ".TTF" when it has no extension.
# LinkFont(string baseFont, string extensionFont, bool link = true)void^FL: links an extension font to a base font (used for characters missing in the base).
# RegisterBitmapFont(string name, BitmapFont font)voidRegisters a downloaded bitmap font (~DB) under a name like "R:MYFONT.FNT".
# RegisterFolder(string directory)voidRegisters every *.ttf/*.otf of a folder; the file name (e.g. "0.ttf", "ARIAL.TTF") is the font name.
# RegisterFont(string name, byte[] ttf)voidRegisters a TrueType/OpenType font under a ZPL name, e.g. "0", "A", or "E:ARIAL.TTF".
# RegisterFont(string name, SKTypeface typeface)void
# RemoveFont(string name)bool
# RenameFont(string name, string newName)boolRenames a registered TrueType font; false when name is unknown or newName exists.