| 2249 | } |
| 2250 | |
| 2251 | float GetGlyphOffsetX(int FontSize, char TextCharacter) const override |
| 2252 | { |
| 2253 | if(m_pGlyphMap->DefaultFace() == nullptr) |
| 2254 | return -1.0f; |
| 2255 | |
| 2256 | FT_Set_Pixel_Sizes(m_pGlyphMap->DefaultFace(), 0, FontSize); |
| 2257 | const char *pTmp = &TextCharacter; |
| 2258 | const int NextCharacter = str_utf8_decode(&pTmp); |
| 2259 | |
| 2260 | if(NextCharacter) |
| 2261 | { |
| 2262 | #if FREETYPE_MAJOR >= 2 && FREETYPE_MINOR >= 7 && (FREETYPE_MINOR > 7 || FREETYPE_PATCH >= 1) |
| 2263 | const FT_Int32 FTFlags = FT_LOAD_BITMAP_METRICS_ONLY | FT_LOAD_NO_BITMAP; |
| 2264 | #else |
| 2265 | const FT_Int32 FTFlags = FT_LOAD_RENDER | FT_LOAD_NO_BITMAP; |
| 2266 | #endif |
| 2267 | if(FT_Load_Char(m_pGlyphMap->DefaultFace(), NextCharacter, FTFlags)) |
| 2268 | { |
| 2269 | log_debug("textrender", "Error loading glyph. Chr=%d", NextCharacter); |
| 2270 | return -1.0f; |
| 2271 | } |
| 2272 | |
| 2273 | return (float)(m_pGlyphMap->DefaultFace()->glyph->metrics.horiBearingX >> 6); |
| 2274 | } |
| 2275 | return 0.0f; |
| 2276 | } |
| 2277 | |
| 2278 | int CalculateTextWidth(const char *pText, int TextLength, int FontWidth, int FontHeight) const override |
| 2279 | { |
nothing calls this directly
no test coverage detected