Parasol Framework
  • Gallery
  • API
  • Wiki
  • GitHub
    •  Overview
    • CharWidth()
    • GetList()
    • RefreshFonts()
    • ResolveFamilyName()
    • SelectFont()
    • StringWidth()
    • Audio
    • Core
    • Display
    • Fluid
    • Font
    • Network
    • Vector
      • Audio
      • Sound
      • File
      • MetaClass
      • Module
      • StorageDevice
      • Task
      • Thread
      • Time
      • Compression
      • Config
      • Script
      • XML
      • Controller
      • BlurFX
      • ColourFX
      • CompositeFX
      • ConvolveFX
      • DisplacementFX
      • FilterEffect
      • FloodFX
      • ImageFX
      • LightingFX
      • MergeFX
      • MorphologyFX
      • OffsetFX
      • RemapFX
      • SourceFX
      • TurbulenceFX
      • WaveFunctionFX
      • Scintilla
      • ScintillaSearch
      • Bitmap
      • Clipboard
      • Display
      • Document
      • Font
      • Picture
      • Pointer
      • Surface
      • SVG
      • ClientSocket
      • HTTP
      • NetSocket
      • Proxy
      • Vector
      • VectorClip
      • VectorColour
      • VectorEllipse
      • VectorFilter
      • VectorGradient
      • VectorGroup
      • VectorImage
      • VectorPath
      • VectorPattern
      • VectorPolygon
      • VectorRectangle
      • VectorScene
      • VectorShape
      • VectorSpiral
      • VectorText
      • VectorTransition
      • VectorViewport
      • VectorWave
      • Linux Builds
      • Windows Builds
      • Customising Your Build
      • Parasol Objects
      • Parasol In Depth
      • Fluid Reference Manual
      • Common API
      • FileSearch API
      • GUI API
      • JSON API
      • VFX API
      • Widgets
      • RIPL Reference Manual
      • Parasol Cmd Tool
      • Flute / Unit Testing
      • Embedded Document Format
      • FDL Reference Manual
      • FDL Tools
      • Action Reference Manual
      • System Error Codes

Font Module

Functions

CharWidth | GetList | RefreshFonts | ResolveFamilyName | SelectFont | StringWidth

Structures

FontList | RGB8

Classes

Font

Constants

ALIGN | FMETA | FSS | FTF | HINT

CharWidth()

Returns the width of a character.

INT fnt::CharWidth(objFont * Font, UINT Char)
ParameterDescription
FontThe font to use for calculating the character width.
CharA unicode character.

This function will return the pixel width of a bitmap font character. The character is specified as a unicode value in the Char parameter.

The font's GlyphSpacing value is not used in calculating the character width.

Result

The pixel width of the character will be returned.

Font module documentation © Paul Manias © 1998-2025

GetList()

Returns a list of all available system fonts.

ERR fnt::GetList(struct FontList ** Result)
ParameterDescription
ResultThe font list is returned here.

This function returns a linked list of all available system fonts. The list must be terminated once it is no longer required.

Error Codes

OkayOperation successful.
AccessObjectAccess to the font database was denied, or the object does not exist.
NullArgsFunction call missing argument value(s)
Font module documentation © Paul Manias © 1998-2025

RefreshFonts()

Refreshes the system font list with up-to-date font information.

ERR fnt::RefreshFonts()

This function scans the fonts: volume and refreshes the font database.

Refreshing fonts can take an extensive amount of time as each font file needs to be completely analysed for information. The fonts:fonts.cfg file will be re-written on completion to reflect current font settings.

Error Codes

OkayFonts were successfully refreshed.
AccessObjectAccess to the font database was denied, or the object does not exist.
Font module documentation © Paul Manias © 1998-2025

ResolveFamilyName()

Convert a CSV family string to a single family name.

ERR fnt::ResolveFamilyName(CSTRING String, CSTRING * Result)
ParameterDescription
StringA CSV family string to resolve.
ResultThe nominated family name is returned in this parameter.

Use ResolveFamilyName() to convert complex CSV family strings to a single family name. The provided String will be parsed in sequence, with priority given from left to right. If a single asterisk is used to terminate the list, it is guaranteed that the system default will be returned if no valid match is made.

It is valid for individual names to utilise the common wildcards ? and * to make a match. E.g. Times New * would be able to match to Times New Roman if available.

Error Codes

OkayOperation successful.
SearchIt was not possible to resolve the String to a known font family.
AccessObjectAccess to the font database was denied, or the object does not exist.
GetFieldA call to GetField() failed to retrieve a field value.
NullArgsFunction call missing argument value(s)
Font module documentation © Paul Manias © 1998-2025

SelectFont()

Searches for a 'best fitting' font file, based on family name and style.

ERR fnt::SelectFont(CSTRING Name, CSTRING Style, CSTRING * Path, FMETA * Meta)
ParameterDescription
NameThe name of a font face to search for (case insensitive).
StyleThe required style, e.g. Bold or Italic. Using camel-case for each word is compulsory.
PathThe location of the best-matching font file is returned in this parameter.
MetaOptional, returns additional meta information about the font file.

This function resolves a font family Name and Style to a font file path. It works on a best efforts basis; the Name must exist but the Style is a non-mandatory preference.

The resulting Path must be freed once it is no longer required.

Error Codes

OkayOperation successful.
SearchUnable to find a suitable font.
AccessObjectAccess to the font database was denied, or the object does not exist.
NullArgsFunction call missing argument value(s)
Font module documentation © Paul Manias © 1998-2025

StringWidth()

Returns the pixel width of any given string in relation to a font's settings.

INT fnt::StringWidth(objFont * Font, CSTRING String, INT Chars)
ParameterDescription
FontAn initialised font object.
StringThe string to be calculated.
CharsThe number of characters (not bytes, so consider UTF-8 serialisation) to be used in calculating the string length, or -1 to use the entire string.

This function calculates the pixel width of any string in relation to a font's object definition. The routine takes into account any line feeds that might be specified in the String, so if the String contains 8 lines, then the width of the longest line will be returned.

Word wrapping will not be taken into account, even if it has been enabled in the font object.

Result

The pixel width of the string is returned - this will be zero if there was an error or the string is empty.

Font module documentation © Paul Manias © 1998-2025

ALIGN Type

Universal values for alignment of graphics and text

NameDescription
ALIGN::BOTTOMAlign to bottom
ALIGN::CENTERSynonym for HORIZONTAL | VERTICAL
ALIGN::HORIZONTALAlign to horizontal center
ALIGN::LEFTAlign to left
ALIGN::MIDDLESynonym for HORIZONTAL | VERTICAL
ALIGN::RIGHTAlign to right
ALIGN::TOPAlign to top
ALIGN::VERTICALAlign to vertical center
Font module documentation © Paul Manias © 1998-2025

FMETA Type

Result flags for the SelectFont() function.

NameDescription
FMETA::HIDDENThe font should not appear in any named list shown to the user.
FMETA::HINT_INTERNALThe Freetype hinter should be used.
FMETA::HINT_LIGHTThe light version of the Freetype hinter should be used.
FMETA::HINT_NORMALThe hinting information provided by the font should be given preference.
FMETA::SCALEDThe font is scalable (assume fixed otherwise).
FMETA::VARIABLEThis is a scalable font featuring variable metrics.
Font module documentation © Paul Manias © 1998-2025

FSS Type

Options for the StringSize() function.

NameDescription
FSS::ALLProcess all characters.
FSS::LINETerminate operation at the first line feed or word-wrap.
Font module documentation © Paul Manias © 1998-2025

FTF Type

Font flags

NameDescription
FTF::BASE_LINEThe Font's Y coordinate is the base line.
FTF::BOLDFont is described as having a bold weight (read only).
FTF::HEAVY_LINEUnderline the font with a double-sized line, using the colour defined in Underline.
FTF::ITALICFont is described as using italics (read only).
Font module documentation © Paul Manias © 1998-2025

HINT Type

Force hinting options for a font.

NameDescription
HINT::INTERNALThe Freetype hinter will be forcibly imposed.
HINT::LIGHTThe light version of the Freetype hinter will be forcibly imposed.
HINT::NORMALThe hinting information provided by the font will be given preference.
Font module documentation © Paul Manias © 1998-2025

FontList Structure

For GetList(), describes a system font.

FieldTypeDescription
Nextstruct FontList *Pointer to the next entry in the list.
NameSTRINGThe name of the font face.
AliasSTRINGReference to another font Name if this is an alias.
PointsINT *Pointer to an array of fixed point sizes supported by the font.
StylesSTRINGSupported styles are listed here in CSV format.
AxesSTRINGFor variable fonts, lists all supported axis codes in CSV format
ScalableBYTETRUE if the font is scalable.
VariableBYTETRUE if the font has variable metrics.
HintingHINTHinting options
HiddenBYTETRUE if the font should be hidden from user font lists.
Font module documentation © Paul Manias © 1998-2025

RGB8 Structure

8-bit RGB colour value.

FieldTypeDescription
RedUBYTERed component value
GreenUBYTEGreen component value
BlueUBYTEBlue component value
AlphaUBYTEAlpha component value
Font module documentation © Paul Manias © 1998-2025