mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:47:37 +00:00
LibPDF: Hack around a FIXME in TrueTypePainter::get_glyph_width()
This will need further thought once we implement support for the truetype 'post' table, but for now it's correct most of the time, and better than not doing it.
This commit is contained in:
parent
448eaa2966
commit
83d29b3e45
1 changed files with 4 additions and 2 deletions
|
@ -141,8 +141,10 @@ PDFErrorOr<void> TrueTypePainter::draw_glyph(Gfx::Painter& painter, Gfx::FloatPo
|
||||||
|
|
||||||
Optional<float> TrueTypePainter::get_glyph_width(u8 char_code) const
|
Optional<float> TrueTypePainter::get_glyph_width(u8 char_code) const
|
||||||
{
|
{
|
||||||
// FIXME: Make this use the char_code lookup method used in draw_glyph().
|
// FIXME: Make this use the full char_code lookup method used in draw_glyph() once that's complete.
|
||||||
return m_font->glyph_width(char_code);
|
auto char_name = m_encoding->get_name(char_code);
|
||||||
|
u32 unicode = glyph_name_to_unicode(char_name).value_or(char_code);
|
||||||
|
return m_font->glyph_width(unicode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrueTypePainter::set_font_size(float font_size)
|
void TrueTypePainter::set_font_size(float font_size)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue