MCPcopy Create free account
hub / github.com/ddnet/ddnet / AdjustFontSize

Method AdjustFontSize

src/engine/client/text.cpp:2240–2249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2238 }
2239
2240 int AdjustFontSize(const char *pText, int TextLength, int MaxSize, int MaxWidth) const override
2241 {
2242 const int WidthOfText = CalculateTextWidth(pText, TextLength, 0, 100);
2243
2244 int FontSize = 100.0f / ((float)WidthOfText / (float)MaxWidth);
2245 if(MaxSize > 0 && FontSize > MaxSize)
2246 FontSize = MaxSize;
2247
2248 return FontSize;
2249 }
2250
2251 float GetGlyphOffsetX(int FontSize, char TextCharacter) const override
2252 {

Callers 1

UpdateEntityLayerTextMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected