10 #include "../stdafx.h"
12 #include "../fontcache.h"
13 #include "../blitter/factory.hpp"
14 #include "../core/bitmath_func.hpp"
15 #include "../gfx_layout.h"
18 #include "../safeguards.h"
38 free(iter.second.second);
49 for (
int i = 0; i < 256; i++) {
52 for (
int j = 0; j < 256; j++) {
74 void TrueTypeFontCache::SetGlyphPtr(
GlyphID key,
const GlyphEntry *glyph,
bool duplicate)
77 Debug(fontcache, 3,
"Allocating root glyph cache for size {}", this->
fs);
82 Debug(fontcache, 3,
"Allocating glyph cache for range 0x{:02X}00, size {}",
GB(key, 8, 8), this->
fs);
86 Debug(fontcache, 4,
"Set glyph for unicode character 0x{:04X}, size {}", key, this->
fs);
102 if (glyph ==
nullptr || glyph->
sprite ==
nullptr) {
104 glyph = this->GetGlyphPtr(key);
112 if ((key & SPRITE_GLYPH) != 0)
return this->
parent->
GetGlyph(key);
116 if (glyph !=
nullptr && glyph->
sprite !=
nullptr)
return glyph->
sprite;
120 if (question_glyph == 0) {
123 #define CPSET { 0, 0, 0, 0, 1 }
124 #define CP___ { 0, 0, 0, 0, 0 }
126 CP___, CP___, CPSET, CPSET, CPSET, CPSET, CP___, CP___,
127 CP___, CPSET, CPSET, CP___, CP___, CPSET, CPSET, CP___,
128 CP___, CP___, CP___, CP___, CP___, CPSET, CPSET, CP___,
129 CP___, CP___, CP___, CP___, CPSET, CPSET, CP___, CP___,
130 CP___, CP___, CP___, CPSET, CPSET, CP___, CP___, CP___,
131 CP___, CP___, CP___, CPSET, CPSET, CP___, CP___, CP___,
132 CP___, CP___, CP___, CPSET, CPSET, CP___, CP___, CP___,
133 CP___, CP___, CP___, CP___, CP___, CP___, CP___, CP___,
134 CP___, CP___, CP___, CPSET, CPSET, CP___, CP___, CP___,
135 CP___, CP___, CP___, CPSET, CPSET, CP___, CP___, CP___,
146 builtin_questionmark_data
150 assert(spr !=
nullptr);
154 this->SetGlyphPtr(key, &new_glyph,
false);
159 glyph = this->GetGlyphPtr(question_glyph);
160 this->SetGlyphPtr(key, glyph,
true);
165 return this->InternalGetGlyph(key, GetFontAAState(this->
fs));
172 length = iter->second.first;
173 return iter->second.second;
176 const void *result = this->InternalGetFontTable(tag, length);
178 this->
font_tables[tag] = std::pair<size_t, const void *>(length, result);