Kōtuku
  • Gallery
  • API
  • Wiki
  • GitHub
    •  Overview
    • CharWidth()
    • RefreshFonts()
    • ResolveFamilyName()
    • SelectFont()
    • StringWidth()
    • Audio
    • Config
    • Core
    • Display
    • Document
    • Font
    • HTTP
    • Network
    • Regex
    • SVG
    • Tiri
    • Vector
    • XML
    • XQuery
    • XRandR
      • Audio
      • MP3
      • Sound
      • File
      • MetaClass
      • Module
      • StorageDevice
      • Task
      • Thread
      • Time
      • Compression
      • CompressedStream
      • Config
      • LZMAStream
      • Script
      • Tiri
      • XML
      • XQuery
      • Controller
      • BlurFX
      • ColourFX
      • CompositeFX
      • ConvolveFX
      • DisplacementFX
      • FilterEffect
      • FloodFX
      • ImageFX
      • LightingFX
      • MergeFX
      • MorphologyFX
      • OffsetFX
      • RemapFX
      • SourceFX
      • TurbulenceFX
      • WaveFunctionFX
      • Scintilla
      • Bitmap
      • Clipboard
      • Display
      • Document
      • Font
      • Image
      • Pointer
      • Surface
      • SVG
      • ClientSocket
      • HTTP
      • NetClient
      • NetLookup
      • NetServer
      • NetSocket
      • Proxy
      • Gradient
      • GradientConic
      • GradientContour
      • GradientDiamond
      • GradientDiffusion
      • GradientDistal
      • GradientGouraud
      • GradientLinear
      • GradientMesh
      • GradientRadial
      • GradientVoronoi
      • 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
      • Kōtuku Objects
      • Kōtuku In Depth
      • Kōtuku Design Patterns
      • Coding With AI
      • Regex Manual
      • XML Comparisons
      • Tiri Reference Manual
      • Config API
      • Defer Syntax
      • GUI API
      • HTTP Server API
      • I/O API
      • JSON API
      • OAuth API
      • Options API
      • Proxy Server API
      • Tempus API
      • URL API
      • VFX API
      • Widgets
      • RIPL Reference Manual
      • Origo
      • Flute / Unit Testing
      • Tuku
      • Embedded Document Format
      • TDL Reference Manual
      • TDL Tools
      • Action Reference Manual
      • System Error Codes

Font Module

Provides font management functionality and hosts the Font class.

The Font module maintains the system font database and provides query functions for resolving font family names, styles, file paths and metadata. Fixed-size bitmap fonts are recognised through the Windows .fon format, while TrueType fonts are scanned as scalable font resources.

Bitmap fonts can be opened and drawn directly by the Font class. Scalable TrueType rendering is handled by the Vector module and VectorText class; the Font module supplies the database information that allows those fonts to be selected.

For a thorough introduction to typesetting history and terminology as it applies to computing, we recommend visiting Google Fonts Knowledge page: https://fonts.google.com/knowledge

Functions

CharWidth | RefreshFonts | ResolveFamilyName | SelectFont | StringWidth

Structures

RGB8

Classes

Font

Constants

FMETA

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 value.

Returns the pixel width of a bitmap font character. Char is interpreted as a Unicode character value. Bitmap fonts provide a maximum of 256 glyph slots; unsupported characters fall back to the font's default character.

The font's GlyphSpacing value is not included in the returned width. If Font is NULL or has no character table, the result is 0.

Result

The pixel width of the character, or 0 if it cannot be measured.

Font module documentation © Paul Manias © 1998-2026

RefreshFonts()

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

ERR fnt::RefreshFonts()

Scans the fonts: volume and rebuilds the font database.

Refreshing fonts can take an extensive amount of time because each font file must be analysed for family, style, metric and metadata information. The fonts:fonts.cfg file is rewritten on completion.

Error Codes

OkayOperation successful.
AccessObjectAccess to the font database was denied, or the object does not exist.
GetFieldFailed to read font database entries after scanning.
OpenFileFailed to open fonts:fonts.cfg for writing.
Font module documentation © Paul Manias © 1998-2026

ResolveFamilyName()

Convert a CSV family string to a single family name.

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

Converts a CSV family string to one resolved family name. String is parsed from left to right, with each family name or wildcard tested against the font database in order. If a single asterisk is used to terminate the list, the system default is returned when no earlier name matches.

Individual names may use the common wildcards ? and *; for example, Times New * can match Times New Roman if it is available.

The returned Result is borrowed storage. Copy it immediately if it needs to survive a later font database refresh.

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.
GetFieldGetField() failed to retrieve a field value
NullArgsFunction call missing argument value(s)
Font module documentation © Paul Manias © 1998-2026

SelectFont()

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

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

Resolves a font family Name and preferred Style to a font file path. The family name must exist in the font database. If the requested style is unavailable, the function falls back to the face's regular style or first registered style.

Error Codes

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

StringWidth()

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

INT fnt::StringWidth(objFont * Font, STRVIEW String, INT Chars)
ParameterDescription
FontAn initialised font object.
StringThe string to be calculated.
CharsThe maximum number of characters to measure, or -1 to measure the entire string.

Calculates the pixel width of String using the supplied Font object's current metrics and spacing settings. Line feeds are handled by measuring each line independently and returning the width of the longest line.

Word wrapping is not applied, even if WrapEdge has been set on the Font object.

Result

The pixel width of the string, or 0 if Font is NULL, uninitialised or String is empty.

Font module documentation © Paul Manias © 1998-2026

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-2026

RGB8 Structure

8-bit RGB colour value.

FieldTypeDescription
RedUINT8Red component value
GreenUINT8Green component value
BlueUINT8Blue component value
AlphaUINT8Alpha component value
Font module documentation © Paul Manias © 1998-2026