Change: Vertically centre sprite font relative to TrueType font.

This commit is contained in:
Peter Nelson
2022-12-17 23:34:19 +00:00
committed by Tyler Trahan
parent 8599041ce4
commit daaa058493
4 changed files with 10 additions and 7 deletions

View File

@@ -13,6 +13,7 @@
#include "../../strings_func.h"
#include "../../table/control_codes.h"
#include "../../fontcache.h"
#include "../../zoom_func.h"
#include "macos.h"
#include <CoreFoundation/CoreFoundation.h>
@@ -245,7 +246,7 @@ CoreTextParagraphLayout::CoreTextVisualRun::CoreTextVisualRun(CTRunRef run, Font
if (buff[this->glyph_to_char[i]] >= SCC_SPRITE_START && buff[this->glyph_to_char[i]] <= SCC_SPRITE_END) {
this->glyphs[i] = font->fc->MapCharToGlyph(buff[this->glyph_to_char[i]]);
this->positions[i * 2 + 0] = pts[i].x;
this->positions[i * 2 + 1] = font->fc->GetAscender() - font->fc->GetGlyph(this->glyphs[i])->height - 1; // Align sprite glyphs to font baseline.
this->positions[i * 2 + 1] = (font->fc->GetHeight() - ScaleSpriteTrad(FontCache::GetDefaultFontHeight(font->fc->GetSize()))) / 2; // Align sprite font to centre
} else {
this->glyphs[i] = gl[i];
this->positions[i * 2 + 0] = pts[i].x;