Index: dvi.c =================================================================== --- dvi.c (revision 34) +++ dvi.c (working copy) @@ -117,6 +117,7 @@ unsigned long rgba_color; FT_Face ft_face; unsigned short *glyph_widths; + int layout_dir; #endif } *loaded_fonts = NULL; static int num_loaded_fonts = 0, max_loaded_fonts = 0; @@ -830,6 +831,7 @@ mrec->opt.glyph_widths[i] = 0xffff; } loaded_fonts[cur_id].glyph_widths = mrec->opt.glyph_widths; + loaded_fonts[cur_id].layout_dir = layout_dir; if (verbose) MESG(">"); @@ -1667,7 +1669,9 @@ if (glyph_id < font->ft_face->num_glyphs) { if (font->glyph_widths[glyph_id] == 0xffff) { FT_Load_Glyph(font->ft_face, glyph_id, FT_LOAD_NO_SCALE); - font->glyph_widths[glyph_id] = font->ft_face->glyph->advance.x; + font->glyph_widths[glyph_id] = (font->layout_dir == 0) + ? font->ft_face->glyph->metrics.horiAdvance + : font->ft_face->glyph->metrics.vertAdvance; } glyph_width = (double)font->size * (double)font->glyph_widths[glyph_id] / (double)font->ft_face->units_per_EM; if (compute_boxes && link_annot && marked_depth >= tagged_depth) {