Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #3731

Re: Printing UTF8 (Unicode)

From Carlos <carlos@cvkm.cz>
Newsgroups comp.lang.postscript
Subject Re: Printing UTF8 (Unicode)
Date 2022-01-23 13:35 +0100
Message-ID <20220123133511.00003a2f@cvkm.cz> (permalink)
References <4fe53d50-e66a-82b8-48fd-d0928e149698@davidnewall.com> <61ecbe1b$1@news.ausics.net>

Show all headers | View raw


V Sun, 23 Jan 2022 13:31:54 +1100
David Newall <davidn@davidnewall.com> napsáno:

> On 21/1/22 9:56 pm, David Newall wrote:
> > I've written some PostScript to allow me to print UTF8-encoded
> > strings  
> 
> There was an error in unicodeshow.  I wasn't attempting /uniXXXX for 
> codepoints that weren't in Adobe's table.
> 
> Apparently it's also not uncommon to use /uXXXX through /uXXXXXX (4
> to 6 hex digits), so I check for those, too.

Adobe's table (or one similar to it) is included in Ghostscript
(AdobeGlyphList), and maybe other interpreters, too.

Here's an old snippet that gets a glyph name (or uniXXXX) based on its
code:

    /RevList AdobeGlyphList length dict dup begin
      AdobeGlyphList { exch def } forall
    end def
    % code -- (uniXXXX)
    /uniX { 16 6 string cvrs dup length 7 exch sub exch
      (uni0000) 7 string copy dup  4 2 roll putinterval } def
    % font code -- glyphname
    /unitoname { dup RevList exch known
      { RevList exch get }
      { uniX cvn } ifelse
      exch /CharStrings get 1 index known not
      { pop /.notdef } if
    } def

(It doesn't contemplate several names per code... I thought it was a
1-1 relationship.)

If you know you are dealing with modern fonts that include the uni/u
aliases, you can get rid of the Adobe table lookup altogether... You
don't need the canonical glyph names for those fonts.

Back to comp.lang.postscript | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Printing UTF8 (Unicode) David Newall <davidn@davidnewall.com> - 2022-01-21 21:56 +1100
  Re: Printing UTF8 (Unicode) Carlos <carlos@cvkm.cz> - 2022-01-21 14:23 +0100
    Re: Printing UTF8 (Unicode) David Newall <davidn@davidnewall.com> - 2022-01-22 12:27 +1100
  Re: Printing UTF8 (Unicode) David Newall <davidn@davidnewall.com> - 2022-01-23 13:31 +1100
    Re: Printing UTF8 (Unicode) Carlos <carlos@cvkm.cz> - 2022-01-23 13:35 +0100
      Re: Printing UTF8 (Unicode) David Newall <davidn@davidnewall.com> - 2022-01-26 14:59 +1100
        Re: Printing UTF8 (Unicode) Carlos <carlos@cvkm.cz> - 2022-02-10 15:05 +0100
          Re: Printing UTF8 (Unicode) David Newall <davidn@davidnewall.com> - 2022-02-16 13:55 +1100
  Printing UTF8 (Unicode) - opinions please David Newall <davidn@davidnewall.com> - 2022-01-23 14:10 +1100
    Re: Printing UTF8 (Unicode) - opinions please Carlos <carlos@cvkm.cz> - 2022-01-23 13:56 +0100
      Re: Printing UTF8 (Unicode) - opinions please luser droog <luser.droog@gmail.com> - 2022-01-24 08:37 -0800
    Re: Printing UTF8 (Unicode) - opinions please luser droog <luser.droog@gmail.com> - 2022-01-24 08:33 -0800
      Re: Printing UTF8 (Unicode) - opinions please David Newall <davidn@davidnewall.com> - 2022-01-26 15:06 +1100

csiph-web