mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 17:58:18 +03:00
LibPDF: Tweak vertical position of truetype fonts
The vertical coordinates for truetype fonts are different somehow. We compensated a bit for that; now we compensate some more. This is still not 100% perfect, but much better than before.
This commit is contained in:
parent
b5aef8e404
commit
13f007aadb
Notes:
sideshowbarker
2024-07-17 07:16:27 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/13f007aadb Pull-request: https://github.com/SerenityOS/serenity/pull/22821
@ -53,7 +53,8 @@ PDFErrorOr<void> TrueTypeFont::draw_glyph(Gfx::Painter& painter, Gfx::FloatPoint
|
||||
auto style = renderer.state().paint_style;
|
||||
|
||||
// Account for the reversed font baseline
|
||||
auto position = point.translated(0, -m_font->baseline());
|
||||
auto position = point.translated(0, -m_font->pixel_metrics().descent - m_font->baseline());
|
||||
|
||||
if (style.has<Color>()) {
|
||||
painter.draw_glyph(position, char_code, *m_font, style.get<Color>());
|
||||
} else {
|
||||
|
@ -71,7 +71,7 @@ PDFErrorOr<void> Type1Font::draw_glyph(Gfx::Painter& painter, Gfx::FloatPoint po
|
||||
|
||||
if (!m_font_program) {
|
||||
// Account for the reversed font baseline
|
||||
auto position = point.translated(0, -m_font->baseline());
|
||||
auto position = point.translated(0, -m_font->pixel_metrics().descent - m_font->baseline());
|
||||
// FIXME: Bounding box and sample point look to be pretty wrong
|
||||
if (style.has<Color>()) {
|
||||
painter.draw_glyph(position, char_code, *m_font, style.get<Color>());
|
||||
|
Loading…
Reference in New Issue
Block a user