| 949 | |
| 950 | template<bool LAMode, bool Antialias> |
| 951 | void ResourceTrueTypeFont::renderGlyphs( |
| 952 | const GlyphHeightMap& _glyphHeightMap, |
| 953 | const FT_Library& _ftLibrary, |
| 954 | const FT_Face& _ftFace, |
| 955 | FT_Int32 _ftLoadFlags, |
| 956 | uint8* _texBuffer, |
| 957 | int _texWidth, |
| 958 | int _texHeight) |
| 959 | { |
| 960 | FT_Bitmap ftBitmap; |
| 961 | FT_Bitmap_New(&ftBitmap); |
| 962 | |
| 963 | int texX = mGlyphSpacing; |
| 964 | int texY = mGlyphSpacing; |
| 965 | |
| 966 | for (const auto& sameHeightGlyphs : _glyphHeightMap) |
| 967 | { |
| 968 | int glyphHeight = sameHeightGlyphs.first; |
| 969 | for (const auto& glyph : sameHeightGlyphs.second) |
| 970 | { |
| 971 | GlyphInfo& info = *glyph.second; |
| 972 | |
| 973 | switch (info.codePoint) |
| 974 | { |
| 975 | case FontCodeType::Selected: |
| 976 | case FontCodeType::SelectedBack: |
| 977 | { |
| 978 | renderGlyph<LAMode, false, false>( |
| 979 | info, |
| 980 | charMaskWhite, |
| 981 | charMaskBlack, |
| 982 | charMask.find(info.codePoint)->second, |
| 983 | glyphHeight, |
| 984 | _texBuffer, |
| 985 | _texWidth, |
| 986 | _texHeight, |
| 987 | texX, |
| 988 | texY); |
| 989 | |
| 990 | // Manually adjust the glyph's width to zero. This prevents artifacts from appearing at the seams when |
| 991 | // rendering multi-character selections. |
| 992 | GlyphMap::iterator glyphIter = mGlyphMap.find(info.codePoint); |
| 993 | if (glyphIter != mGlyphMap.end()) |
| 994 | { |
| 995 | glyphIter->second.width = 0.0f; |
| 996 | glyphIter->second.uvRect.right = glyphIter->second.uvRect.left; |
| 997 | } |
| 998 | } |
| 999 | break; |
| 1000 | |
| 1001 | case FontCodeType::Cursor: |
| 1002 | case FontCodeType::Tab: |
| 1003 | renderGlyph<LAMode, false, false>( |
| 1004 | info, |
| 1005 | charMaskWhite, |
| 1006 | charMaskBlack, |
| 1007 | charMask.find(info.codePoint)->second, |
| 1008 | glyphHeight, |