Skip to content

Commit 39c8238

Browse files
committed
Remove forced fallback from FT2Font::load_char
The only thing that expected this to work is Type 3 fonts in the PDF backend, but only to avoid an error when loading a range of characters (not all of which would be used.) This would introduce an odd behaviour in that `load_char` could never fail even if the glyph never existed. You would instead end up with the `null` glyph from the last font.
1 parent a6ac58f commit 39c8238

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/ft2font.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ void FT2Font::load_char(long charcode, FT_Int32 flags, FT2Font *&ft_object, bool
552552
bool was_found = load_char_with_fallback(ft_object_with_glyph, final_glyph_index,
553553
glyphs, char_to_font,
554554
charcode, flags, charcode_error, glyph_error,
555-
glyph_seen_fonts, true);
555+
glyph_seen_fonts);
556556
if (!was_found) {
557557
ft_glyph_warn(charcode, glyph_seen_fonts);
558558
if (charcode_error) {
@@ -613,15 +613,14 @@ bool FT2Font::load_char_with_fallback(FT2Font *&ft_object_with_glyph,
613613
FT_Int32 flags,
614614
FT_Error &charcode_error,
615615
FT_Error &glyph_error,
616-
std::set<FT_String*> &glyph_seen_fonts,
617-
bool override = false)
616+
std::set<FT_String*> &glyph_seen_fonts)
618617
{
619618
FT_UInt glyph_index = FT_Get_Char_Index(face, charcode);
620619
if (!warn_if_used) {
621620
glyph_seen_fonts.insert(face->family_name);
622621
}
623622

624-
if (glyph_index || override) {
623+
if (glyph_index) {
625624
charcode_error = FT_Load_Glyph(face, glyph_index, flags);
626625
if (charcode_error) {
627626
return false;
@@ -647,7 +646,7 @@ bool FT2Font::load_char_with_fallback(FT2Font *&ft_object_with_glyph,
647646
bool was_found = fallback->load_char_with_fallback(
648647
ft_object_with_glyph, final_glyph_index, parent_glyphs,
649648
parent_char_to_font, charcode, flags,
650-
charcode_error, glyph_error, glyph_seen_fonts, override);
649+
charcode_error, glyph_error, glyph_seen_fonts);
651650
if (was_found) {
652651
return true;
653652
}

src/ft2font.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ class FT2Font
131131
FT_Int32 flags,
132132
FT_Error &charcode_error,
133133
FT_Error &glyph_error,
134-
std::set<FT_String*> &glyph_seen_fonts,
135-
bool override);
134+
std::set<FT_String*> &glyph_seen_fonts);
136135
void load_glyph(FT_UInt glyph_index, FT_Int32 flags);
137136
std::tuple<long, long> get_width_height();
138137
std::tuple<long, long> get_bitmap_offset();

0 commit comments

Comments
 (0)