carb::simplegui::FontConfig

Defined in carb/simplegui/SimpleGuiTypes.h

struct FontConfig

Structure defining the configuration for a font.

Public Functions

inline FontConfig()

Constructor.

Public Members

void *fontData

TTF/OTF data.

int fontDataSize

TTF/OTF data size.

bool fontDataOwnedByAtlas

true - TTF/OTF data ownership taken by the container ImFontAtlas (will delete memory itself).

int fontNo

0 - Index of font within TTF/OTF file

float sizePixels

Size in pixels for rasterizer (more or less maps to the resulting font height).

int oversampleH

3 - Rasterize at higher quality for sub-pixel positioning. We don’t use sub-pixel positions on the Y axis.

int oversampleV

1 - Rasterize at higher quality for sub-pixel positioning. We don’t use sub-pixel positions on the Y axis.

bool pixelSnapH

false - Align every glyph to pixel boundary. Useful e.g. if you are merging a non-pixel aligned font with the default font. If enabled, you can set OversampleH/V to 1.

Float2 glyphExtraSpacing

0, 0 - Extra spacing (in pixels) between glyphs. Only X axis is supported for now.

Float2 glyphOffset

0, 0 - Offset all glyphs from this font input.

const Wchar *glyphRanges

NULL - Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list). THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE.

float glyphMinAdvanceX

0 - Minimum AdvanceX for glyphs, set Min to align font icons, set both Min/Max to enforce mono-space font

float glyphMaxAdvanceX

FLT_MAX - Maximum AdvanceX for glyphs.

bool mergeMode

false - Merge into previous ImFont, so you can combine multiple inputs font into one ImFont (e.g. ASCII font + icons + Japanese glyphs). You may want to use GlyphOffset.y when merge font of different heights.

uint32_t rasterizerFlags

0x00 - Settings for custom font rasterizer (e.g. ImGuiFreeType). Leave as zero if you aren’t using one.

float rasterizerMultiply

1.0f - Brighten (>1.0f) or darken (<1.0f) font output. Brightening small fonts may be a good workaround to make them more readable.

char name[40]

(internal) Name (strictly to ease debugging)

Font *dstFont

(internal)