Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 16a3fb9

Browse filesBrowse files
committed
remove ft_get_char_index_or_warn
1 parent c719d89 commit 16a3fb9
Copy full SHA for 16a3fb9

File tree

1 file changed

+8
-20
lines changed
Filter options

1 file changed

+8
-20
lines changed

‎src/ft2font.cpp

Copy file name to clipboardExpand all lines: src/ft2font.cpp
+8-20Lines changed: 8 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,11 @@ 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);
583+
if (!glyph_index){
584+
// testing if this was ever reached/is no longer needed
585+
//ft_glyph_warn((FT_ULong)charcode, face->family_name);
586+
}
597587
if (FT_Error error = FT_Load_Glyph(face, glyph_index, flags)) {
598588
throw_ft_error("Could not load charcode", error);
599589
}
@@ -608,8 +598,7 @@ void FT2Font::load_char(long charcode, FT_Int32 flags, FT2Font *&ft_object, bool
608598

609599
bool FT2Font::get_char_fallback_index(FT_ULong charcode, int& index) const
610600
{
611-
/** can segfault if set to true*/
612-
FT_UInt glyph_index = ft_get_char_index_or_warn(face, charcode, false);
601+
FT_UInt glyph_index = FT_Get_Char_Index(face, charcode);
613602
if (glyph_index) {
614603
// -1 means the host has the char and we do not need to fallback
615604
index = -1;
@@ -642,7 +631,7 @@ bool FT2Font::load_char_with_fallback(FT2Font *&ft_object_with_glyph,
642631
FT_Error &glyph_error,
643632
bool override = false)
644633
{
645-
FT_UInt glyph_index = ft_get_char_index_or_warn(face, charcode, false);
634+
FT_UInt glyph_index = FT_Get_Char_Index(face, charcode);
646635
family_names.push_back(face->family_name);
647636
if (glyph_index || override) {
648637
if ((charcode_error=FT_Load_Glyph(face, glyph_index, flags))) {
@@ -721,8 +710,7 @@ FT_UInt FT2Font::get_char_index(FT_ULong charcode, bool fallback = false)
721710
ft_object = this;
722711
}
723712

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

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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.