Skip to content

Commit 09584ff

Browse files
committed
remove ft_get_char_index_or_warn
1 parent 9d9c29d commit 09584ff

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

src/ft2font.cpp

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -201,19 +201,6 @@ static void ft_glyph_warn(FT_ULong charcode, FT_String *family_name)
201201
}
202202
}
203203

204-
static FT_UInt
205-
ft_get_char_index_or_warn(FT_Face face, FT_ULong charcode, bool warn = true)
206-
{
207-
FT_UInt glyph_index = FT_Get_Char_Index(face, charcode);
208-
if (glyph_index) {
209-
return glyph_index;
210-
}
211-
if (warn) {
212-
ft_glyph_warn(charcode, face->family_name);
213-
}
214-
return 0;
215-
}
216-
217204
// ft_outline_decomposer should be passed to FT_Outline_Decompose. On the
218205
// first pass, vertices and codes are set to NULL, and index is simply
219206
// incremented for each vertex that should be inserted, so that it is set, at
@@ -592,8 +579,7 @@ void FT2Font::load_char(long charcode, FT_Int32 flags, FT2Font *&ft_object, bool
592579
ft_object = ft_object_with_glyph;
593580
} else {
594581
ft_object = this;
595-
FT_UInt glyph_index = ft_get_char_index_or_warn(face, (FT_ULong)charcode);
596-
582+
FT_UInt glyph_index = FT_Get_Char_Index(face, (FT_ULong) charcode);
597583
if (FT_Error error = FT_Load_Glyph(face, glyph_index, flags)) {
598584
throw_ft_error("Could not load charcode", error);
599585
}
@@ -608,8 +594,7 @@ void FT2Font::load_char(long charcode, FT_Int32 flags, FT2Font *&ft_object, bool
608594

609595
bool FT2Font::get_char_fallback_index(FT_ULong charcode, int& index) const
610596
{
611-
/** can segfault if set to true*/
612-
FT_UInt glyph_index = ft_get_char_index_or_warn(face, charcode, false);
597+
FT_UInt glyph_index = FT_Get_Char_Index(face, charcode);
613598
if (glyph_index) {
614599
// -1 means the host has the char and we do not need to fallback
615600
index = -1;
@@ -642,7 +627,7 @@ bool FT2Font::load_char_with_fallback(FT2Font *&ft_object_with_glyph,
642627
FT_Error &glyph_error,
643628
bool override = false)
644629
{
645-
FT_UInt glyph_index = ft_get_char_index_or_warn(face, charcode, false);
630+
FT_UInt glyph_index = FT_Get_Char_Index(face, charcode);
646631
family_names.push_back(face->family_name);
647632
if (glyph_index || override) {
648633
if ((charcode_error=FT_Load_Glyph(face, glyph_index, flags))) {
@@ -721,8 +706,7 @@ FT_UInt FT2Font::get_char_index(FT_ULong charcode, bool fallback = false)
721706
ft_object = this;
722707
}
723708

724-
// historically, get_char_index never raises a warning
725-
return ft_get_char_index_or_warn(ft_object->get_face(), charcode, false);
709+
return FT_Get_Char_Index(ft_object->get_face(), charcode);
726710
}
727711

728712
void FT2Font::get_width_height(long *width, long *height)

0 commit comments

Comments
 (0)