Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 365801d

Browse files
committed
Do not warn for get_char_index
1 parent 34b0123 commit 365801d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/ft2font.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,14 @@ static FT_UInt ft_glyph_warn(FT_ULong charcode)
185185
return 0;
186186
}
187187

188-
static FT_UInt ft_get_char_index_or_warn(FT_Face face, FT_ULong charcode)
188+
static FT_UInt ft_get_char_index_or_warn(FT_Face face, FT_ULong charcode, bool warn = true)
189189
{
190190
FT_UInt glyph_index = FT_Get_Char_Index(face, charcode);
191191
if (glyph_index) {
192192
return glyph_index;
193193
}
194-
return ft_glyph_warn(charcode);
194+
if (warn) return ft_glyph_warn(charcode);
195+
else return 0;
195196
}
196197

197198
// ft_outline_decomposer should be passed to FT_Outline_Decompose. On the
@@ -752,7 +753,8 @@ FT_UInt FT2Font::get_char_index(FT_ULong charcode, bool fallback = false)
752753
ft_object = this;
753754
}
754755

755-
return ft_get_char_index_or_warn(ft_object->get_face(), charcode);
756+
// historically, get_char_index never raises a warning
757+
return ft_get_char_index_or_warn(ft_object->get_face(), charcode, false);
756758
}
757759

758760
void FT2Font::get_cbox(FT_BBox &bbox)

0 commit comments

Comments
 (0)