[XeTeX] Several suggestions and bug reports concerning Asian language support

Yin Dian yindian at gmail.com
Fri Oct 19 04:03:00 CEST 2007


Hi jjgod,

You've done quite a good job! Thanks a lot.

Regards.

-Yin

On 10/19/07, Jjgod Jiang <gzjjgod at gmail.com> wrote:
>
> Hi Yin, Jonathan,
>
> 2007/10/18, Yin Dian <yindian at gmail.com>:
> > 2. Wrong width for CJK Ext-B characters.
> >
> > This bug is introduced in revision 93 of xdvipdfmx. Revision 92
> generates
> > the correct result, while the following revisions not.
>
> After some debugging, it turns out this bug is introduced by
> do_glyph_array() in
> dvi.c of xdvipdfmx, after r93, it use FreeType version to determinate
> whether
> to retrieve the horiAdvance data directly from FreeType or load it by
> itself, but
> there is a little difference between these two cases, which results the
> miscalculation for Sun-ExtB.ttf font.
>
> Let's see the calling sequence of case 1:
>
> xdvipdfmx: dvi.c: FT_Load_Glyph
> freetype: truetype/ttgload.c: TT_Load_Glyph
> freetype: truetype/ttgload.c: load_truetype_glyph
> freetype: truetype/ttgload.c: Get_HMetrics
>
> In Get_HMetrics(), if flag FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH
> is not set, and face->postscript.isFixedPitch (Sun-ExtB.ttf is declared as
> fixed pitch), it will use face->horizontal.advance_Width_Max as the
> advance
> width. (which is 299, but that glyph advance should be 256, as recorded in
> SFNT table).
>
> So here is a simple patch of xdvipdfmx to fix this:
>
> Index: src/dvi.c
> ===================================================================
> --- src/dvi.c   (revision 96)
> +++ src/dvi.c   (working copy)
> @@ -1961,7 +1961,7 @@
>              font->glyph_widths[glyph_id] = 0;
>          }
>          else {
> -          FT_Load_Glyph(font->ft_face, glyph_id, FT_LOAD_NO_SCALE);
> +          FT_Load_Glyph(font->ft_face, glyph_id, FT_LOAD_NO_SCALE |
> FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH);
>            font->glyph_widths[glyph_id] = (font->layout_dir == 0)
>                                            ?
> font->ft_face->glyph->metrics.horiAdvance
>                                            :
> font->ft_face->glyph->metrics.vertAdvance;
>
>
> - Jiang
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://tug.org/pipermail/xetex/attachments/20071019/6a8dae6c/attachment.html 


More information about the XeTeX mailing list