MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / BucketFTPixelSizeTool

Function BucketFTPixelSizeTool

apps/tools/Tools/commands/FontCommand.cpp:182–190  ·  view source on GitHub ↗

Mirror of Font.cpp's BucketFTPixelSize (not exported): snap an ideal pixel size to the 4px grid the FreeType atlas actually rasterizes at.

Source from the content-addressed store, hash-verified

180// Mirror of Font.cpp's BucketFTPixelSize (not exported): snap an ideal pixel
181// size to the 4px grid the FreeType atlas actually rasterizes at.
182static int BucketFTPixelSizeTool(float idealPx)
183{
184 int bucketed = static_cast<int>((idealPx + 2.0f) / 4.0f) * 4;
185 if (bucketed < 8)
186 bucketed = 8;
187 if (bucketed > 160)
188 bucketed = 160;
189 return bucketed;
190}
191// font textwidth — engine-exact rendered text width as a screen-width fraction
192//
193// Reproduces the FreeType branch of Engine::GetTextWidth (FontDraw.cpp): resolve

Callers 1

setupFontTextWidthFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected