[poppler] [Patch] Fix bug 15301 for Chinese font

Albert Astals Cid aacid at kde.org
Mon Dec 1 13:11:19 PST 2008


A Dilluns 01 Desembre 2008, JustFillBug va escriure:
> https://bugs.freedesktop.org/show_bug.cgi?id=15301
>
> Attached patch fixed bug 15301 for specific CJK Fonts.

That looks ugly, but in case we have to end up doing that the list of fonts 
and the obtention of the freetype flags should end up in a common file so 
SplashOutputDev can use it too.

Albert

>
>
> --- CairoFontEngine.cc.orig	2008-12-01 17:26:16.000000000 +0800
> +++ CairoFontEngine.cc	2008-12-01 17:26:21.000000000 +0800
> @@ -220,9 +220,37 @@
>      delete tmpFileName;
>    }
>
> -  cairo_font_face = cairo_ft_font_face_create_for_ft_face (face,
> -							   FT_LOAD_NO_HINTING |
> -							   FT_LOAD_NO_BITMAP);
> +  {
> +    // Find out tricky fonts which need HINTING to render properly.
> +    // See freetype src/truetype/ttobjs.c: tt_face_init()
> +    static const char* const  trick_names[] =
> +    {
> +      "DFKaiSho-SB",     /* dfkaisb.ttf */
> +      "DFKai-SB",        /* kaiu.ttf */
> +      "HuaTianSongTi?",  /* htst3.ttf */
> +      "MingLiU",         /* mingliu.ttf & mingliu.ttc */
> +      "PMingLiU",        /* mingliu.ttc */
> +      "MingLi43",        /* mingli.ttf */
> +      NULL
> +    };
> +    int load_flag = FT_LOAD_NO_BITMAP;
> +    GBool tricky = gFalse;
> +    int nn;
> +
> +    for (nn = 0; trick_names[nn] != NULL; nn++ )
> +    {
> +      if (face->family_name && strstr(face->family_name, trick_names[nn] )
> ) +      {
> +	tricky = gTrue;
> +	break;
> +      }
> +    }
> +    if (!tricky)
> +      load_flag |= FT_LOAD_NO_HINTING;
> +
> +    cairo_font_face = cairo_ft_font_face_create_for_ft_face (face,
> load_flag); +  }
> +
>    if (cairo_font_face_status (cairo_font_face)) {
>      error(-1, "could not create cairo font: %s\n", cairo_status_to_string
> (cairo_font_face_status (cairo_font_face))); goto err2; /* this doesn't do
> anything, but it looks like we're
>
>
>
>
> _______________________________________________
> poppler mailing list
> poppler at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/poppler




More information about the poppler mailing list