MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetCharacterWidth

Function GetCharacterWidth

src/gfx.cpp:1273–1279  ·  view source on GitHub ↗

* Return width of character glyph. * @param size Font of the character * @param key Character code glyph * @return Width of the character glyph */

Source from the content-addressed store, hash-verified

1271 * @return Width of the character glyph
1272 */
1273uint8_t GetCharacterWidth(FontSize size, char32_t key)
1274{
1275 /* Use _stringwidth_table cache if possible */
1276 if (key >= 32 && key < 256) return _stringwidth_table[size][key - 32];
1277
1278 return GetGlyphWidth(size, key);
1279}
1280
1281/**
1282 * Return the maximum width of single digit.

Callers 7

DrawCharCenteredFunction · 0.85
GetDigitWidthFunction · 0.85
GetBroadestDigitFunction · 0.85
OnInitMethod · 0.85
NextLineMethod · 0.85
GetCaretWidthFunction · 0.85
OnInitMethod · 0.85

Calls 1

GetGlyphWidthFunction · 0.85

Tested by

no test coverage detected