summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2011-03-30 13:24:22 +0200
committerTor Andersson <tor.andersson@artifex.com>2011-03-30 13:24:22 +0200
commit37d60c8460bfa3607f4621a71b85920f6b7b76f3 (patch)
tree4870fed1aedf313b1ddd7aecfdb2786e99029ea5
parent49b5087171894c97168b44b04c9d9b1f6d8f7df8 (diff)
downloadmupdf-37d60c8460bfa3607f4621a71b85920f6b7b76f3.tar.xz
xps: Support vertical writing mode.
-rw-r--r--xps/xpsfont.c15
-rw-r--r--xps/xpsglyphs.c11
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);
/*