mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:17:35 +00:00
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
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)
|
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;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto translation = m_data.font_program->glyph_translation(char_code, width);
|
auto translation = m_data.font_program->glyph_translation(char_code, width);
|
||||||
point = point.translated(translation);
|
point = point.translated(translation);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue