FOnline Engine
Current master GitHub
Documentation Docs/en/reference/font-format/layout.md

Text Layout Contract

Generated reference. Do not edit directly. Update BuildTools/FontFormatInterface.json, then run python BuildTools/docs_font_format.py --write.

Index Formats FOFNT BMFont Binding Layout Rendering Validation Canonical JSON Guide

FontFlag values

Name Value Source behavior
None 0x0000 Applies no optional text-layout or glyph-rendering flags
NoWrap 0x0001 Truncates the remaining text at rectangle-width overflow instead of wrapping it
TruncateLine 0x0002 Skips overflowing glyphs through the next newline instead of wrapping the current line
CenterX 0x0004 Horizontally centers each rendered line within the target rectangle
CenterY 0x0008 Vertically centers the complete text block within the target rectangle
AlignRight 0x0010 Right-aligns each rendered line within the target rectangle
AlignBottom 0x0020 Aligns the text block to the bottom and makes SkipLines count from the trailing lines
KeepTail 0x0040 Renders the tail of a text block that is taller than the target rectangle
NoColorize 0x0080 Removes inline color tags while retaining the supplied base text color
Justify 0x0100 Distributes extra spacing between words to fill each line’s target width
Bordered 0x0200 Uses the bordered or outlined font-texture variant for glyph rendering

Layout rules

Stable ID Rule Requirement Why Source
font-format.layout.text-format TextFormat value Pass a Font slot, FontFlag bitmask, and nonnegative SkipLines count as TextFormat. The exported value type is a fixed 12-byte layout consumed by measurement and drawing. Source/Client/FontManager.h
font-format.layout.wrap-overflow Width overflow and wrapping With finite width, default layout wraps at the latest space or tab and inserts a line break before an overlong token when no break point exists. Layout mutates its cached text copy to establish line boundaries without changing the caller’s source string. Source/Client/FontManager.cpp
font-format.layout.no-wrap-and-truncate NoWrap and TruncateLine NoWrap ends draw text at the first width overflow; TruncateLine removes overflowing glyphs through the next authored newline. These flags intentionally choose different loss behavior and should not be treated as synonyms. Source/Client/FontManager.cpp
font-format.layout.horizontal-alignment Horizontal alignment CenterX and AlignRight position each line independently inside the supplied rectangle; do not combine contradictory alignment flags. The initial and every post-newline X coordinate are recalculated from that line’s measured width. Source/Client/FontManager.cpp
font-format.layout.vertical-alignment Vertical alignment CenterY centers the visible block and AlignBottom places it against the rectangle bottom using LineHeight and YAdvance. Vertical placement depends on the number of lines that fit, not the total source-string byte length. Source/Client/FontManager.cpp
font-format.layout.skip-lines-and-tail SkipLines and KeepTail SkipLines removes leading lines by default and trailing lines with AlignBottom; KeepTail discards leading overflow so the newest visible lines remain. These mechanisms serve pagination and log-tail behavior but use different counters and overflow conditions. Source/Client/FontManager.cpp
font-format.layout.justification Justification Justify distributes remaining finite rectangle width over breakable spaces on wrapped non-skipped lines. Tabs are fixed at four SpaceWidth units and are not justification opportunities. Source/Client/FontManager.cpp
font-format.layout.utf8-and-missing-glyphs UTF-8 and missing glyphs Author every required Unicode codepoint; invalid UTF-8 and absent glyphs consume no glyph width and render no fallback symbol. The layout maps invalid sequences to codepoint zero and unknown codepoints to zero advance, while drawing skips missing map entries. Source/Client/FontManager.cpp
font-format.layout.measurement Measurement matches layout Use Game.GetTextInfo and related line helpers with the same rectangle and TextFormat used for drawing, but do not infer draw-only NoWrap truncation from measurement. Measurement and drawing share GetOrFormat, skips, line metrics, and bind-time scale; NoWrap truncation is intentionally gated to Draw mode. Source/Client/FontManager.cpp, Source/Scripting/ClientGlobalScriptMethods.cpp
Start typing to search.