MCPcopy Create free account
hub / github.com/MyGUI/mygui / renderMsdfGlyphs

Method renderMsdfGlyphs

MyGUIEngine/src/MyGUI_ResourceTrueTypeFont.cpp:1205–1337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1203 }
1204
1205 void ResourceTrueTypeFont::renderMsdfGlyphs(
1206 const GlyphHeightMap& _glyphHeightMap,
1207 msdfgen::FontHandle* _fontHandle,
1208 uint8* _texBuffer,
1209 int _texWidth,
1210 int _texHeight)
1211 {
1212 int texX = mGlyphSpacing, texY = mGlyphSpacing;
1213
1214 for (const auto& sameHeightGlyphs : _glyphHeightMap)
1215 {
1216 int glyphHeight = sameHeightGlyphs.first;
1217 for (const auto& glyph : sameHeightGlyphs.second)
1218 {
1219 GlyphInfo& info = *glyph.second;
1220
1221 switch (info.codePoint)
1222 {
1223 case FontCodeType::Selected:
1224 case FontCodeType::SelectedBack:
1225 {
1226 renderGlyph<false, false, false>(
1227 info,
1228 charMaskWhite,
1229 charMaskBlack,
1230 charMask.find(info.codePoint)->second,
1231 glyphHeight,
1232 _texBuffer,
1233 _texWidth,
1234 _texHeight,
1235 texX,
1236 texY);
1237
1238 // Manually adjust the glyph's width to zero. This prevents artifacts from appearing at the seams when
1239 // rendering multi-character selections.
1240 GlyphMap::iterator glyphIter = mGlyphMap.find(info.codePoint);
1241 if (glyphIter != mGlyphMap.end())
1242 {
1243 glyphIter->second.width = 0.0f;
1244 glyphIter->second.uvRect.right = glyphIter->second.uvRect.left;
1245 }
1246 }
1247 break;
1248
1249 case FontCodeType::Cursor:
1250 case FontCodeType::Tab:
1251 renderGlyph<false, false, false>(
1252 info,
1253 charMaskWhite,
1254 charMaskBlack,
1255 charMask.find(info.codePoint)->second,
1256 glyphHeight,
1257 _texBuffer,
1258 _texWidth,
1259 _texHeight,
1260 texX,
1261 texY);
1262 break;

Callers

nothing calls this directly

Calls 12

loadGlyphFunction · 0.85
edgeColoringSimpleFunction · 0.85
generateMSDFFunction · 0.85
Vector2Class · 0.85
pixelFloatToByteFunction · 0.85
getBoundsMethod · 0.80
findMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45
normalizeMethod · 0.45
widthMethod · 0.45
heightMethod · 0.45

Tested by

no test coverage detected