Mirror of Font.cpp's BucketFTPixelSize (not exported): snap an ideal pixel size to the 4px grid the FreeType atlas actually rasterizes at.
| 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. |
| 182 | static 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 |
no outgoing calls
no test coverage detected