|
|
|
@ -333,18 +333,25 @@ public:
|
|
|
|
|
FallbackParagraphLayout::FallbackVisualRun::FallbackVisualRun(Font *font, const WChar *chars, int char_count, int x) :
|
|
|
|
|
font(font), glyph_count(char_count)
|
|
|
|
|
{
|
|
|
|
|
const bool isbuiltin = font->fc->IsBuiltInFont();
|
|
|
|
|
|
|
|
|
|
this->glyphs = MallocT<GlyphID>(this->glyph_count);
|
|
|
|
|
this->glyph_to_char = MallocT<int>(this->glyph_count);
|
|
|
|
|
|
|
|
|
|
/* Positions contains the location of the begin of each of the glyphs, and the end of the last one. */
|
|
|
|
|
this->positions = MallocT<float>(this->glyph_count * 2 + 2);
|
|
|
|
|
this->positions[0] = x;
|
|
|
|
|
this->positions[1] = font->fc->GetAscender();
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < this->glyph_count; i++) {
|
|
|
|
|
this->glyphs[i] = font->fc->MapCharToGlyph(chars[i]);
|
|
|
|
|
if (isbuiltin) {
|
|
|
|
|
this->positions[2 * i + 1] = font->fc->GetAscender(); // Apply sprite font's ascender.
|
|
|
|
|
} else if (chars[i] >= SCC_SPRITE_START && chars[i] <= SCC_SPRITE_END) {
|
|
|
|
|
this->positions[2 * i + 1] = font->fc->GetAscender() - font->fc->GetGlyph(this->glyphs[i])->height - 1; // Align sprite glyphs to font baseline.
|
|
|
|
|
} else {
|
|
|
|
|
this->positions[2 * i + 1] = 0; // No ascender adjustment.
|
|
|
|
|
}
|
|
|
|
|
this->positions[2 * i + 2] = this->positions[2 * i] + font->fc->GetGlyphWidth(this->glyphs[i]);
|
|
|
|
|
this->positions[2 * i + 3] = font->fc->GetAscender();
|
|
|
|
|
this->glyph_to_char[i] = i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|