Skip to content

Commit f7d11ae

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 cf9aff6 commit f7d11ae

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
@@ -529,7 +529,7 @@ void FT2Font::load_char(long charcode, FT_Int32 flags, FT2Font *&ft_object, bool
529529
bool was_found = load_char_with_fallback(ft_object_with_glyph, final_glyph_index,
530530
glyphs, char_to_font,
531531
charcode, flags, charcode_error, glyph_error,
532-
glyph_seen_fonts, true);
532+
glyph_seen_fonts);
533533
if (!was_found) {
534534
ft_glyph_warn(charcode, glyph_seen_fonts);
535535
if (charcode_error) {
@@ -590,15 +590,14 @@ bool FT2Font::load_char_with_fallback(FT2Font *&ft_object_with_glyph,
590590
FT_Int32 flags,
591591
FT_Error &charcode_error,
592592
FT_Error &glyph_error,
593-
std::set<FT_String*> &glyph_seen_fonts,
594-
bool override = false)
593+
std::set<FT_String*> &glyph_seen_fonts)
595594
{
596595
FT_UInt glyph_index = FT_Get_Char_Index(face, charcode);
597596
if (!warn_if_used) {
598597
glyph_seen_fonts.insert(face->family_name);
599598
}
600599

601-
if (glyph_index || override) {
600+
if (glyph_index) {
602601
charcode_error = FT_Load_Glyph(face, glyph_index, flags);
603602
if (charcode_error) {
604603
return false;
@@ -624,7 +623,7 @@ bool FT2Font::load_char_with_fallback(FT2Font *&ft_object_with_glyph,
624623
bool was_found = fallback->load_char_with_fallback(
625624
ft_object_with_glyph, final_glyph_index, parent_glyphs,
626625
parent_char_to_font, charcode, flags,
627-
charcode_error, glyph_error, glyph_seen_fonts, override);
626+
charcode_error, glyph_error, glyph_seen_fonts);
628627
if (was_found) {
629628
return true;
630629
}

src/ft2font.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ class FT2Font
126126
FT_Int32 flags,
127127
FT_Error &charcode_error,
128128
FT_Error &glyph_error,
129-
std::set<FT_String*> &glyph_seen_fonts,
130-
bool override);
129+
std::set<FT_String*> &glyph_seen_fonts);
131130
void load_glyph(FT_UInt glyph_index, FT_Int32 flags);
132131
std::tuple<long, long> get_width_height();
133132
std::tuple<long, long> get_bitmap_offset();

0 commit comments

Comments
 (0)