Skip to content

Commit d0908d8

Browse files
committed
clean up
1 parent 33c986b commit d0908d8

File tree

2 files changed

+6
-35
lines changed

2 files changed

+6
-35
lines changed

src/ft2font.cpp

+4-21
Original file line numberDiff line numberDiff line change
@@ -506,23 +506,19 @@ void FT2Font::set_text(
506506
FT_UInt previous = 0;
507507
FT2Font *previous_ft_object = NULL;
508508

509-
FT_WarnCache warn_cache;
510-
511509
for (size_t n = 0; n < N; n++) {
512510
FT_UInt glyph_index = 0;
513511
FT_BBox glyph_bbox;
514512
FT_Pos last_advance;
515513

516514
FT_Error charcode_error, glyph_error;
517515
FT2Font *ft_object_with_glyph = this;
518-
519516
bool was_found = load_char_with_fallback(ft_object_with_glyph, glyph_index, glyphs,
520517
char_to_font, glyph_to_font, codepoints[n], flags,
521-
charcode_error, glyph_error, &warn_cache, false);
518+
charcode_error, glyph_error, false);
522519
if (!was_found) {
523520
// render missing glyph tofu
524521
// come back to top-most font
525-
warn_cache.warn();
526522
ft_object_with_glyph = this;
527523
char_to_font[codepoints[n]] = ft_object_with_glyph;
528524
glyph_to_font[glyph_index] = ft_object_with_glyph;
@@ -583,13 +579,9 @@ void FT2Font::load_char(long charcode, FT_Int32 flags, FT2Font *&ft_object, bool
583579
FT_UInt final_glyph_index;
584580
FT_Error charcode_error, glyph_error;
585581
FT2Font *ft_object_with_glyph = this;
586-
FT_WarnCache warn_cache;
587-
bool was_found = load_char_with_fallback(ft_object_with_glyph,
588-
final_glyph_index, glyphs, char_to_font,
589-
glyph_to_font, charcode, flags, charcode_error,
590-
glyph_error, warn_cache, true);
582+
bool was_found = load_char_with_fallback(ft_object_with_glyph, final_glyph_index, glyphs, char_to_font,
583+
glyph_to_font, charcode, flags, charcode_error, glyph_error, true);
591584
if (!was_found) {
592-
warn_cache.warn();
593585
if (charcode_error) {
594586
throw_ft_error("Could not load charcode", charcode_error);
595587
}
@@ -647,12 +639,9 @@ bool FT2Font::load_char_with_fallback(FT2Font *&ft_object_with_glyph,
647639
FT_Int32 flags,
648640
FT_Error &charcode_error,
649641
FT_Error &glyph_error,
650-
std::vector<FT_WarnCache> &warn_cache,
651642
bool override = false)
652643
{
653-
FT_UInt glyph_index = ft_get_char_index_or_warn(face, charcode, warn=false);
654-
if (!glyph_index){
655-
warn_cache.push_back(charcode, face->family_name)};
644+
FT_UInt glyph_index = ft_get_char_index_or_warn(face, charcode);
656645
if (glyph_index || override) {
657646
if (charcode_error=FT_Load_Glyph(face, glyph_index, flags)) {
658647
return false;
@@ -845,9 +834,3 @@ long FT2Font::get_name_index(char *name)
845834
{
846835
return FT_Get_Name_Index(face, (FT_String *)name);
847836
}
848-
849-
void FT_WarnCache::warn(){
850-
for (int i=0; i<cache.size(); i++){
851-
ft_glyph_warn(cache[i].charcode, cache[i].family_name);
852-
}
853-
}

src/ft2font.h

+2-14
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,6 @@ class FT2Image
6666

6767
extern FT_Library _ft2Library;
6868

69-
class FT_WarnCache{
70-
private:
71-
struct entry{
72-
FT_ULong charcode;
73-
FT_String family_name;
74-
};
75-
std::vector<entry> cache;
76-
public:
77-
FT_WarnCache();
78-
void warn();
79-
};
80-
81-
#endif
8269
class FT2Font
8370
{
8471

@@ -104,7 +91,6 @@ class FT2Font
10491
FT_Int32 flags,
10592
FT_Error &charcode_error,
10693
FT_Error &glyph_error,
107-
FT_WarnCache &warn_cache,
10894
bool override);
10995
void load_glyph(FT_UInt glyph_index, FT_Int32 flags, FT2Font *&ft_object, bool fallback);
11096
void load_glyph(FT_UInt glyph_index, FT_Int32 flags);
@@ -169,3 +155,5 @@ class FT2Font
169155
FT2Font(const FT2Font &);
170156
FT2Font &operator=(const FT2Font &);
171157
};
158+
159+
#endif

0 commit comments

Comments
 (0)