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

Method createMsdfFaceGlyphInfo

MyGUIEngine/src/MyGUI_ResourceTrueTypeFont.cpp:1142–1165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1140
1141 #ifdef MYGUI_MSDF_FONTS
1142 GlyphInfo ResourceTrueTypeFont::createMsdfFaceGlyphInfo(
1143 Char _codePoint,
1144 const msdfgen::Shape& _shape,
1145 double _advance,
1146 int _fontAscent)
1147 {
1148 msdfgen::Shape::Bounds bounds = _shape.getBounds();
1149 double range = mMsdfRange / 2.0;
1150 if (_shape.contours.empty())
1151 {
1152 bounds = {0, 0, 0, 0};
1153 range = 0;
1154 }
1155
1156 double bearingX = bounds.l;
1157
1158 return GlyphInfo(
1159 _codePoint,
1160 bounds.r - bounds.l + 2 * range,
1161 bounds.t - bounds.b + 2 * range,
1162 _advance - bearingX + range,
1163 bearingX - range,
1164 std::floor(_fontAscent - bounds.t - mOffsetHeight - range));
1165 }
1166
1167 int ResourceTrueTypeFont::createMsdfGlyph(const GlyphInfo& _glyphInfo, GlyphHeightMap& _glyphHeightMap)
1168 {

Callers

nothing calls this directly

Calls 3

GlyphInfoClass · 0.85
getBoundsMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected