Loading ...
Sorry, an error occurred while loading the content.

Re: add multibyte support for hardcopy

Expand Messages
  • Bram Moolenaar
    ... That is one of the problems to be solved: How to select the printer fonts. We need a good mechanism for this. And then defaults that work for most
    Message 1 of 9 , Nov 4, 2002
    • 0 Attachment
      Namsh wrote:

      > > Motonobu Ichimura wrote:
      > >
      > > > :hardcopy doesn't support multibyte characters,
      > > > so I wrote a patch to support it.
      > > >
      > > > Currently this patch (can apply from 6.0 to 6.1.247) enables
      > > >
      > > > Japanese EUC-JP
      > > > Japanese SJIS
      > > > Korean EUC-KR
      > > > Chinese Big5
      > > > Chinese GB2312
      > > >
      > > > codeset to print PS file. (PS fontnames are hardcoded yet.)
      > > >
      > > > some screenshots (output ps file using :hardcopy and view with gv)
      > > > are available at
      > > >
      > > > http://www.momonga-linux.org/~famao/vim/
      > >
      > > Thanks for making this patch. I'll await comments.
      >
      > Very good.
      > But I could not see generated ps file because I have no
      > MingMT-.. and SMGothic-.. fonts.
      >
      > Currently I can see the ps file using
      > {"Gulim", "Gulim-Bold",
      > "Gulim-Oblique", "Gulim-BoldOblique"},
      >
      > There's a free truetype fonts (baekmuk-ttf) package.
      > (ftp://ftp.mizi.co.kr/pub/baekmuk)
      > So, how about use such a name for EUC-KR?
      > (ex. fontconfig (XFree86 4.2.x) also use the name from Baekmuk.)
      > Or at lease, let user select the fonts.

      That is one of the problems to be solved: How to select the printer
      fonts. We need a good mechanism for this. And then defaults that work
      for most people.

      --
      Living on Earth includes an annual free trip around the Sun.

      /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
      /// Creator of Vim - Vi IMproved -- http://www.vim.org \\\
      \\\ Project leader for A-A-P -- http://www.a-a-p.org ///
      \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///
    • Nam SungHyun
      ... I think user can print using gs if he can see it using gs . I guess it means no need to know about printer fonts. At least, I can print ps file
      Message 2 of 9 , Nov 4, 2002
      • 0 Attachment
        On Mon, 04 Nov 2002 21:22:47 +0100, Bram Moolenaar wrote:
        >
        > Namsh wrote:
        >
        > > > Motonobu Ichimura wrote:
        > > >
        > > > > :hardcopy doesn't support multibyte characters,
        > > > > so I wrote a patch to support it.
        > >
        > > Currently I can see the ps file using
        > > {"Gulim", "Gulim-Bold",
        > > "Gulim-Oblique", "Gulim-BoldOblique"},
        > >
        > > There's a free truetype fonts (baekmuk-ttf) package.
        > > (ftp://ftp.mizi.co.kr/pub/baekmuk)
        > > So, how about use such a name for EUC-KR?
        >
        > That is one of the problems to be solved: How to select the printer
        > fonts. We need a good mechanism for this. And then defaults that work
        > for most people.

        I think user can print using 'gs' if he can see it using 'gs'.
        I guess it means no need to know about printer fonts.

        At least, I can print ps file (including those generated by vim)
        using ghostscript.

        inf="$1"
        outf=tmp.lj
        gs -q -dSAFER -sDEVICE=ljet4 -sPAPERSIZE=a4 -r600 -dNOPAUSE \
        -sOutputFile=${outf} ${inf} -c quit
        lpr -h ${outf}

        regards,
        namsh
      • Yasuhiro Matsumoto
        ... Hello Ichimura. I tried your patch, it s great!. It is coincidence, I was just talking about this problem with Mike Williams and Bram at last month. I
        Message 3 of 9 , Nov 6, 2002
        • 0 Attachment
          >Hi.
          >
          >:hardcopy doesn't support multibyte characters,
          >so I wrote a patch to support it.
          >
          >Currently this patch (can apply from 6.0 to 6.1.247) enables
          >
          >Japanese EUC-JP
          >Japanese SJIS
          >Korean EUC-KR
          >Chinese Big5
          >Chinese GB2312
          >
          >codeset to print PS file. (PS fontnames are hardcoded yet.)
          >
          >some screenshots (output ps file using :hardcopy and view with gv) are
          >available at

          Hello Ichimura.

          I tried your patch, it's great!.
          It is coincidence, I was just talking about this problem
          with Mike Williams and Bram at last month.

          I guess that it need bit's change. :-)
          I could output ps file on win32 with this patch.
          (I made this patch against your patch.)

          BTW)
          As bram said, there is a problem about
          "How to select the printer fonts."
          I think, it is very difficult for vim to select a CMap.
          Maybe, most users has the other way to output ps like a2ps.
          I think, vim don't need to change more after this patch.

          Thanks.

          *** ex_cmds2.c~ Thu Nov 07 11:42:14 2002
          --- ex_cmds2.c Thu Nov 07 11:39:51 2002
          ***************
          *** 2632,2637 ****
          --- 2632,2638 ----
          #ifdef FEAT_MBYTE
          static void prt_set_mfont __ARGS((int bold, int italic, int underline));
          static void prt_mfont_init __ARGS((void));
          + void mch_print_set_mfont __ARGS((int, int, int));
          #endif
          static void prt_line_number __ARGS((prt_settings_T *psettings, int
          page_line, linenr_T lnum));
          static void prt_header __ARGS((prt_settings_T *psettings, int pagenum,
          linenr_T lnum));
          ***************
          *** 3465,3471 ****
          -250, 805,
          {"Ryumin-Light-RKSJ-H", "GothicBBB-Medium-RKSJ-H",
          "Ryumin-Light-RKSJ-H", "GothicBBB-Medium-RKSJ-H"},
          ! "sjis"
          },
          {
          /* Korean EUC-KR */
          --- 3466,3472 ----
          -250, 805,
          {"Ryumin-Light-RKSJ-H", "GothicBBB-Medium-RKSJ-H",
          "Ryumin-Light-RKSJ-H", "GothicBBB-Medium-RKSJ-H"},
          ! "sjis,shift_jis,cp932"
          },
          {
          /* Korean EUC-KR */
          ***************
          *** 3716,3727 ****
          }
          for (i = 0; i < SUPPORTED_ENCODINGS; i++)
          {
          ! if (!STRICMP(p_enc,prt_ps_mfonts[i].encoding))
          {
          ! prt_ps_mfont = prt_ps_mfonts[i];
          ! prt_has_mfont = TRUE;
          return;
          }
          }
          prt_has_mfont = FALSE;
          }
          --- 3717,3744 ----
          }
          for (i = 0; i < SUPPORTED_ENCODINGS; i++)
          {
          ! char_u *name;
          ! char_u *ptr = vim_strsave(prt_ps_mfonts[i].encoding);
          ! char_u *old = ptr;
          ! if (!ptr)
          {
          ! prt_has_mfont = FALSE;
          return;
          }
          + while(*ptr)
          + {
          + name = ptr;
          + while(*ptr != ',' && *ptr != '\0')
          + ptr++;
          + *ptr++ = 0;
          + if (!STRICMP(p_enc, name))
          + {
          + prt_ps_mfont = prt_ps_mfonts[i];
          + prt_has_mfont = TRUE;
          + return;
          + }
          + }
          + vim_free(old);
          }
          prt_has_mfont = FALSE;
          }
          ***************
          *** 4801,4807 ****
          if (len > 1) {
          int i;
          for (i = 0; i < len ; i++) {
          ! ga_append (&prt_ps_buffer, p[i]);
          }
          goto done;
          }
          --- 4818,4827 ----
          if (len > 1) {
          int i;
          for (i = 0; i < len ; i++) {
          ! ch = p[i];
          ! if (ch == '(' || ch == ')' || ch == '\\')
          ! ga_append(&prt_ps_buffer, IF_EB('\\', 0134));
          ! ga_append(&prt_ps_buffer, ch);
          }
          goto done;
          }
          --

          - Yasuhiro


          _________________________________________________________________
          Add photos to your e-mail with MSN 8. Get 2 months FREE*.
          http://join.msn.com/?page=features/featuredemail
        • Mike Williams
          Hi, I have a few comments. I am no expert in CJKV typography (how to layout the characters) but have experience in the PostScript used to them out, so please
          Message 4 of 9 , Nov 10, 2002
          • 0 Attachment
            Hi,

            I have a few comments. I am no expert in CJKV typography (how to
            layout the characters) but have experience in the PostScript used to
            them out, so please excuse me if I ask any silly questions. I
            haven't seen the full set of patches so I may have missed some things
            answered there.

            I would suggest separating the CMap name from the font name. It may
            be useful to change the CMap name based on the platform - for example
            CMap 90ms-RKSJ-H supports Windows 3.1J and 95J characters sets. To
            the support the Apple Macintosh Traditional Chinese character set you
            need to use B5pc-H CMap. The font and CMap names can be joined
            together when generating the output file.

            A CMap defines the character collection to be used for printing, so
            is also dependent on the display font being used if you want to be
            able to print all the characters in the file. For example, the CMap
            Ext-RKSJ-H includes IBM extensions to the JIS X 0208 character set,
            or ETen-B5-H for the Big Fice character set with the ETen extensions.

            A CMap can also defines the encoding. While RKSJ-H uses EUC-JP and
            Shift-JIS, UniJIS-UCS2-H uses UCS-2 and UniJIS-UTF8-H uses UTF-8.
            The Chinese and Korean character collections support additional
            encodings as well.

            The Courier font used for latin1 encoded files has a width of .6 of
            the selected font height which is font specific (but common to Roman,
            Bold, and Italic versions of Courier). Have you been able to find
            the font metrics for the CID fonts? If not I guess you may be seeing
            an odd spacing between lines (too big a gap is my guess).

            Also, CID fonts can include half-width and proportional versions of
            Latin characters. Are you mapping these back to the full-width
            versions? Or leaving them as they are? Or is this not a problem?

            Another thing to be aware of is that some Adobe documented CMaps may
            not be available on a printer. The behaviour of a printer is
            unpredictable when this happens - it may not print anything, it may
            substitute a default CMap, or it may even revert to printing as
            single byte encoded using Courier or Helvetica. Has anyone tried
            this?

            There are a number of PDFs on CID fonts and CMaps publicly available
            at http://partners.adobe.com/asn/developer/technotes/fonts.html
            In particular Technical Note 5094 may be of interest as it lists the
            current standard Adobe CMaps for Chinese, Japanese and Korean CID
            fonts.

            I am happy to help, do, or review any PostScript coding to support
            multi-byte printing in VIM. Just drop me a line.

            TTFN

            On 7 Nov 2002 at 12:00, Yasuhiro Matsumoto wrote:

            > >Hi.
            > >
            > >:hardcopy doesn't support multibyte characters,
            > >so I wrote a patch to support it.
            > >
            > >Currently this patch (can apply from 6.0 to 6.1.247) enables
            > >
            > >Japanese EUC-JP
            > >Japanese SJIS
            > >Korean EUC-KR
            > >Chinese Big5
            > >Chinese GB2312
            > >
            > >codeset to print PS file. (PS fontnames are hardcoded yet.)
            > >
            > >some screenshots (output ps file using :hardcopy and view with gv) are
            > >available at
            >
            > Hello Ichimura.
            >
            > I tried your patch, it's great!.
            > It is coincidence, I was just talking about this problem
            > with Mike Williams and Bram at last month.
            >
            > I guess that it need bit's change. :-)
            > I could output ps file on win32 with this patch.
            > (I made this patch against your patch.)
            >
            > BTW)
            > As bram said, there is a problem about
            > "How to select the printer fonts."
            > I think, it is very difficult for vim to select a CMap.
            > Maybe, most users has the other way to output ps like a2ps.
            > I think, vim don't need to change more after this patch.
            >
            > Thanks.

            Mike
            --
            One good thing about repeating your mistakes is that you know when to cringe.
          Your message has been successfully submitted and would be delivered to recipients shortly.