LibPDF: Make glyphs from standard 14 fonts show up in Type1Font
Previously, we would assume that all standard 14 fonts use a TrueTypeFont dictionary. Now we render them in Type1Font as well, given that it doesn't contain a PostScript font program.
This commit is contained in:
parent
a37f3390dc
commit
ac31b1bda3
Notes:
sideshowbarker
2024-07-17 17:40:13 +09:00
Author: https://github.com/janso3 Commit: https://github.com/SerenityOS/serenity/commit/ac31b1bda3 Pull-request: https://github.com/SerenityOS/serenity/pull/16933 Reviewed-by: https://github.com/nico
1 changed files with 8 additions and 1 deletions
|
@ -78,8 +78,15 @@ float Type1Font::get_char_width(u16 char_code) const
|
|||
|
||||
void Type1Font::draw_glyph(Gfx::Painter& painter, Gfx::FloatPoint point, float width, u32 char_code, Color color)
|
||||
{
|
||||
if (!m_data.font_program)
|
||||
if (!m_data.font_program) {
|
||||
if (m_data.font) {
|
||||
// Account for the reversed font baseline
|
||||
auto position = point.translated(0, -m_data.font->baseline());
|
||||
painter.draw_glyph(position, char_code, *m_data.font, color);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
auto translation = m_data.font_program->glyph_translation(char_code, width);
|
||||
point = point.translated(translation);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue