Re: dia 0.90: printing Japanese using --enable-freetype ?



Cyrille Chepelov <cyrille chepelov org> writes:

Le Wed, Jun 05, 2002, à 04:37:20PM +0200, Mike Fabian a écrit:


    [... snip ...]

     /xi /xi /xi /xi /xi /xi /xi /xi /xi /xi /xi /xi /xi /xi /xi /xi
    ] /e0 exch def

Can you unsnip the complete array ?

The problem is not only that one cannot print the Asian glyphs, one
cannot print anything correctly when using these fonts, not even a
simple ASCII string like "xyz". If this problem is solved, I guess
printing will work for east Asian languages when '--enable-freetype'
is used.

Does it work, in your experience, when --disable-freetype ?

No, Japanese printing does not work without '--enable-freetype'
either. In that case fonts are not embedded into the PostScript
output, printer resident (or Ghostscript resident) fonts are used
instead.

I could make Japanese printing work with dia-0.88.1 by applying the
attached patch, but this patch doesn't work anymore for dia-0.90,
because the reencoding of the fonts for printing seems to have been
changed on dia-0.90 and I was unable to fix it.

This patch does:

   - use gdk_fontset_load instead of gdk_font_load *except*
     for fonts which have "fontspecific" in their XLFD
     (Symbol and Dingbats), for these fonts gdk_fontset_load
     failed for reasons unknown to me.

   - increase NUM_X11_FONTS to 3 and add the URW PostScript fonts
     as the preferred fonts to the font_data[] array in font.c
     and leave the bitmap fonts only as a fallback

     The bitmap fonts are not scalable if the directories are marked
     with ":unscaled" in /etc/X11/XF86Config. SuSE Linux >= 7.3 has 
     ":unscaled" by default on all directories containing bitmap
     fonts, RedHat Linux as well. This causes problems with dia
     as Dia can't scale the fonts anymore.

     Using the scalable URW PostScript fonts fixes the problem.
     On top of that the URW fonts look better and agree better
     with the printing output one gets. 

     For each of the basic Adobe PostScript fonts there is one URW
     font which very closely resembles the Adobe font. Therefore using
     the URW fonts for display on X11 as well will look very similar
     to the final output on the printer.

     If one prints via Ghostscript, the URW fonts are even used
     for printing, i.e. using the URW fonts on screen as well
     improves WYSIWYG.

     The URW fonts are available on practically all Linux systems,
     therefore it should not hurt to make them the default and
     leave the adobe bitmap fonts only as a fallback.

   - added Japanese fonts to font_data[]:

        +  /* Japanese, Sat Mar  2 02:13:21 2002  Mike Fabian  <mfabian suse de> */
        +  { "Ryumin-Light-EUC-H",
        +    "Ryumin-Light-EUC-H",
        +    { "-kochi-mincho-medium-r-normal-*-%d-*-*-*-*-*-*-*",
        +      NULL,
        +      NULL
        +    }
        +  },
        +  { "GothicBBB-Medium-EUC-H",
        +    "GothicBBB-Medium-EUC-H",
        +    { "-kochi-gothic-medium-r-normal-*-%d-*-*-*-*-*-*-*",
        +      NULL,
        +      NULL
             }

   - avoid the reencoding of the Japanese fonts and the URW Dingbats
     font:

       diff -ru dia-0.88.1.orig/app/render_eps.c dia-0.88.1/app/render_eps.c
       --- dia-0.88.1.orig/app/render_eps.c     Mon Mar 26 03:05:16 2001
       +++ dia-0.88.1/app/render_eps.c  Thu Mar 21 12:36:28 2002
       @@ -167,7 +167,12 @@
        {
          /* Don't reencode the Symbol font, as it doesn't work in latin1 encoding.
           * Instead, just define Symbol-latin1 to be the same as Symbol. */
       -  if (!strcmp(fontname, "Symbol"))
       +  /* Don't do that for the Dingbats and the Japanese fonts either! */
       +  /* Sat Mar  2 02:08:34 2002  Mike Fabian  <mfabian suse de> */
       +  if (strcasestr(fontname, "Symbol") ||
       +      strcasestr(fontname, "Dingbats") ||
       +      strcasestr(fontname, "Ryumin") ||
       +      strcasestr(fontname, "GothicBBB"))
            fprintf(file,
                   "/%s-latin1\n"
                   "    /%s findfont\n"
       @@ -310,6 +315,8 @@
          print_reencode_font(file, "Symbol");
          print_reencode_font(file, "ZapfChancery-MediumItalic");
          print_reencode_font(file, "ZapfDingbats");
       +  print_reencode_font(file, "Ryumin-Light-EUC-H");
       +  print_reencode_font(file, "GothicBBB-Medium-EUC-H");
        #endif /* !HAVE_UNICODE */

          fprintf(file,


This made Japanese work on screen and for printing. It also made the
Dingbats font print correctly, which it didn't do before.

Unfortunately this patch doesn't work for Japanese anymore for
dia-0.90, print_reencode seems to be gone in dia-0.90 and I could not
yet find how to adapt this patch to make it work again.

Attachment: dia-fonts.dif
Description: Binary data



-- 
Mike Fabian   <mfabian suse de>   http://www.suse.de/~mfabian
睡眠不足はいい仕事の敵\xA4 。


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]