Always shape at size=upem

Fixes bug with uniscribe not handling GIGANTIC sizes.
This commit is contained in:
Behdad Esfahbod 2011-09-16 01:11:30 -04:00
parent 674ee58d9b
commit 7bf6ecd3bf
3 changed files with 6 additions and 6 deletions

View File

@ -494,7 +494,7 @@ font_options_t::get_font (void) const
font = hb_font_create (face); font = hb_font_create (face);
unsigned int upem = hb_face_get_upem (face); unsigned int upem = hb_face_get_upem (face);
hb_font_set_scale (font, font_size * upem, font_size * upem); hb_font_set_scale (font, upem, upem);
hb_face_destroy (face); hb_face_destroy (face);
#if HAVE_FREETYPE #if HAVE_FREETYPE

View File

@ -80,7 +80,7 @@ void
view_cairo_t::init (const font_options_t *font_opts) view_cairo_t::init (const font_options_t *font_opts)
{ {
lines = g_array_new (FALSE, FALSE, sizeof (line_t)); lines = g_array_new (FALSE, FALSE, sizeof (line_t));
upem = hb_face_get_upem (hb_font_get_face (font_opts->get_font ())); scale = double (font_opts->font_size) / hb_face_get_upem (hb_font_get_face (font_opts->get_font ()));
} }
void void
@ -115,8 +115,8 @@ view_cairo_t::consume_line (hb_buffer_t *buffer,
for (i = 0; i < (int) l.num_glyphs; i++) for (i = 0; i < (int) l.num_glyphs; i++)
{ {
l.glyphs[i].index = hb_glyph[i].codepoint; l.glyphs[i].index = hb_glyph[i].codepoint;
l.glyphs[i].x = ( hb_position->x_offset + x) / double (upem); l.glyphs[i].x = ( hb_position->x_offset + x) * scale;
l.glyphs[i].y = (-hb_position->y_offset + y) / double (upem); l.glyphs[i].y = (-hb_position->y_offset + y) * scale;
x += hb_position->x_advance; x += hb_position->x_advance;
y += -hb_position->y_advance; y += -hb_position->y_advance;
@ -174,7 +174,7 @@ double
view_cairo_t::line_width (unsigned int i) view_cairo_t::line_width (unsigned int i)
{ {
line_t &line = g_array_index (lines, line_t, i); line_t &line = g_array_index (lines, line_t, i);
return line.glyphs[line.num_glyphs].x / double (upem); return line.glyphs[line.num_glyphs].x * scale;
} }
void void

View File

@ -57,7 +57,7 @@ struct view_cairo_t : output_options_t, view_options_t {
double line_width (unsigned int i); double line_width (unsigned int i);
GArray *lines; GArray *lines;
unsigned int upem; double scale;
}; };
#endif #endif