Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Hacking's just another word for nothing left to kludge.


devel / comp.lang.postscript / Re: Revised idea for utf8show

SubjectAuthor
* Revised idea for utf8showDavid Newall
`* Re: Revised idea for utf8showDavid Newall
 `- Re: Revised idea for utf8showluser droog

1
Revised idea for utf8show

<61f6d2db$1@news.ausics.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=137&group=comp.lang.postscript#137

  copy link   Newsgroups: comp.lang.postscript
Newsgroups: comp.lang.postscript
X-Mozilla-News-Host: news://news.ausics.net:119
From: davidn@davidnewall.com (David Newall)
Subject: Revised idea for utf8show
Date: Mon, 31 Jan 2022 05:03:06 +1100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.14.0
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: news.ausics.net
Message-ID: <61f6d2db$1@news.ausics.net>
Organization: Ausics - https://www.ausics.net
Lines: 58
X-Complaints: abuse@ausics.net
Path: i2pn2.org!rocksolid2!news.neodome.net!news.mixmin.net!news.ausics.net!not-for-mail
 by: David Newall - Sun, 30 Jan 2022 18:03 UTC

Hi All,

Yes, requiring a modified font is ugly, but a map from UNICODE values to
glyph names is absolutely required.

Fonts don't have /uniXXXX aliases for all glyphs, nor do they reliably
use the names in AdobeGlyphList (which, anyway, does not even cover all
written languages).

I think I've come up with an elegant solution. It allows you to specify
the actual glyph names from fonts that you use, or use AdobeGlyphList if
you think that will be sufficient (it probably won't be.)

I would greatly value constructive criticism.

Meet unicodefont:

font array|dict unicodefont dict

Prepare a dictionary derived from font, adding a UNICODE map based on
array or dict. The result, after registering with definefont, will be
suitable for use with the utf8show family of operators.

If an array is passed, it must contain one element for each UNICODE
value to be installed in the map. Each element is an array containing
a UNICODE value followed by one or more glyph names. The first name
found in the font is associated with the UNICODE value.

If a dict is passed, it's keys must be glyph names and values must
be UNICODE values.

Although the standard AdobeGlyphList could be used, this is not
recommended. Fonts often use names that are different to those in
AdobeGlyphList, and also often include many glyphs which are not
listed in it. Using AdobeGlyphList is likely to result in characters
not being painted even though they present in the font.

It is strongly recommended that your encoding array maps all names
actually used by the font with UNICODE values. Fontforge
(https://fontforge.org) can generate a map of a font's glyphs when
saving in .otf or .ttf format with the "output glyph map" option
enabled. This produces a .g2n file which can be processed by awk:
BEGIN{print "<<"}
/GLYPHID .*PSNAME .*UNICODE .*/{print "/"$4, "16#"$6}
END{print ">>"}

The original font is not modified. A new font named key is created.

Here's an example:

%!
/Helvetica-Unicode /Helvetica findfont 20 scalefont AdobeGlyphList
unicodefont setfont
100 300 moveto <~=(Q2XDf'&.FDi;]J=KV=7P-UZJ=Q~> utf8show showpage

Regards,

David

Re: Revised idea for utf8show

<61f76b74@news.ausics.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=138&group=comp.lang.postscript#138

  copy link   Newsgroups: comp.lang.postscript
Subject: Re: Revised idea for utf8show
Newsgroups: comp.lang.postscript
References: <61f6d2db$1@news.ausics.net>
From: davidn@davidnewall.com (David Newall)
Date: Mon, 31 Jan 2022 15:54:11 +1100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.14.0
MIME-Version: 1.0
In-Reply-To: <61f6d2db$1@news.ausics.net>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: news.ausics.net
Message-ID: <61f76b74@news.ausics.net>
Organization: Ausics - https://www.ausics.net
Lines: 24
X-Complaints: abuse@ausics.net
Path: i2pn2.org!i2pn.org!news.bbs.nz!news.ausics.net!not-for-mail
 by: David Newall - Mon, 31 Jan 2022 04:54 UTC

On 31/1/22 5:03 am, David Newall wrote:
> Yes, requiring a modified font is ugly, but a map from UNICODE values to
> glyph names is absolutely required.

Following up on my own post, I should mention alternative ideas that I
have.

First is to include the UnicodeEncoding map with the string when
invoking utf8show:

/MyUnicode AdobeGlyphList makeunicode def
MyUnicode (UTF8 String) utf8show

Second is to have a global map, akin to currentpoint:

AdobeGlyphList makeunicode setunicode
(UTF8 String) utf8show

Are these ideas better or worse than what I previously discussed?

Thanks,

David

Re: Revised idea for utf8show

<c5602a45-4b74-41c1-a3cd-9d0819409610n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=139&group=comp.lang.postscript#139

  copy link   Newsgroups: comp.lang.postscript
X-Received: by 2002:ac8:5908:: with SMTP id 8mr17577594qty.61.1643695429792;
Mon, 31 Jan 2022 22:03:49 -0800 (PST)
X-Received: by 2002:a05:6808:d52:: with SMTP id w18mr296801oik.48.1643695429497;
Mon, 31 Jan 2022 22:03:49 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.postscript
Date: Mon, 31 Jan 2022 22:03:49 -0800 (PST)
In-Reply-To: <61f76b74@news.ausics.net>
Injection-Info: google-groups.googlegroups.com; posting-host=97.87.183.68; posting-account=G1KGwgkAAAAyw4z0LxHH0fja6wAbo7Cz
NNTP-Posting-Host: 97.87.183.68
References: <61f6d2db$1@news.ausics.net> <61f76b74@news.ausics.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c5602a45-4b74-41c1-a3cd-9d0819409610n@googlegroups.com>
Subject: Re: Revised idea for utf8show
From: luser.droog@gmail.com (luser droog)
Injection-Date: Tue, 01 Feb 2022 06:03:49 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 28
 by: luser droog - Tue, 1 Feb 2022 06:03 UTC

On Sunday, January 30, 2022 at 10:54:28 PM UTC-6, David Newall wrote:
> On 31/1/22 5:03 am, David Newall wrote:
> > Yes, requiring a modified font is ugly, but a map from UNICODE values to
> > glyph names is absolutely required.
> Following up on my own post, I should mention alternative ideas that I
> have.
>
> First is to include the UnicodeEncoding map with the string when
> invoking utf8show:
>
> /MyUnicode AdobeGlyphList makeunicode def
> MyUnicode (UTF8 String) utf8show
>
> Second is to have a global map, akin to currentpoint:
>
> AdobeGlyphList makeunicode setunicode
> (UTF8 String) utf8show
>
> Are these ideas better or worse than what I previously discussed?
>
> Thanks,
>
> David

I think all of these would be fine, such as they are. But I see more
potential with the first idea of wrapping up all the information in
the font. It may be possible to wrap the functionality of the glyph
lookup in the /BuildChar procedure and get the whole thing to
work with show or cshow.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor