diff options
-rw-r--r-- | xps/xpsfont.c | 15 | ||||
-rw-r--r-- | xps/xpsglyphs.c | 11 |
2 files changed, 16 insertions, 10 deletions
diff --git a/xps/xpsfont.c b/xps/xpsfont.c index e983df35..561cc7ec 100644 --- a/xps/xpsfont.c +++ b/xps/xpsfont.c @@ -41,11 +41,14 @@ void xps_measure_font_glyph(xps_context_t *ctx, fz_font *font, int gid, xps_glyph_metrics_t *mtx) { int mask = FT_LOAD_NO_BITMAP | FT_LOAD_NO_HINTING | FT_LOAD_IGNORE_TRANSFORM; - FT_Fixed adv; + FT_Face face = font->ftface; + FT_Fixed hadv, vadv; + + FT_Set_Char_Size(face, 64, 64, 72, 72); + FT_Get_Advance(face, gid, mask, &hadv); + FT_Get_Advance(face, gid, mask | FT_LOAD_VERTICAL_LAYOUT, &vadv); - FT_Set_Char_Size(font->ftface, 64, 64, 72, 72); - FT_Get_Advance(font->ftface, gid, mask, &adv); - mtx->hadv = adv / 65536.0f; - mtx->vadv = -1000 / 1000.0f; - mtx->vorg = 880 / 1000.0f; + mtx->hadv = hadv / 65536.0f; + mtx->vadv = vadv / 65536.0f; + mtx->vorg = face->ascender / (float) face->units_per_EM; } diff --git a/xps/xpsglyphs.c b/xps/xpsglyphs.c index 1c67ebaa..74d80f56 100644 --- a/xps/xpsglyphs.c +++ b/xps/xpsglyphs.c @@ -177,6 +177,7 @@ xps_parse_glyphs_imp(xps_context_t *ctx, fz_matrix ctm, fz_font *font, float siz char *indices, char *unicode, int is_charpath) { xps_glyph_metrics_t mtx; + fz_matrix tm; float e, f; float x = originx; float y = originy; @@ -197,7 +198,12 @@ xps_parse_glyphs_imp(xps_context_t *ctx, fz_matrix ctm, fz_font *font, float siz un = strlen(us); } - ctx->text = fz_newtext(font, fz_scale(size, -size), is_sideways); + if (is_sideways) + tm = fz_concat(fz_scale(-size, size), fz_rotate(90)); + else + tm = fz_scale(size, -size); + + ctx->text = fz_newtext(font, tm, is_sideways); while ((us && un > 0) || (is && *is)) { @@ -448,9 +454,6 @@ xps_parse_glyphs(xps_context_t *ctx, fz_matrix ctm, font_size = atof(font_size_att); - if (is_sideways) - fz_warn("sideways text not implemented!"); - xps_begin_opacity(ctx, ctm, opacity_mask_uri, dict, opacity_att, opacity_mask_tag); /* |