GlyphContext - return null if typeface does not have key for char (avoid KeyNotFoundException)
This commit is contained in:
1 parent
340c270e8a
commit
83cb900c1c
1 file changed
+2
-1
@@ -48,7 +48,8 @@ namespace mbts.ui.utility.text {
|
||||
var advance_widths = new double[text.Length];
|
||||
double glyph_width = 0;
|
||||
for (int n = 0; n < text.Length; n++) {
|
||||
var gc = _char_map[text[n]];
|
||||
if (!_char_map.TryGetValue(text[n], out (ushort index, double width) gc))
|
||||
return null;
|
||||
glyph_indices[n] = gc.index;
|
||||
double w = gc.width * font_size;
|
||||
advance_widths[n] = w;
|
||||
|
||||
Reference in new issue
Block a user