ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <j.hagen@xs4all.nl>
To: Ulrike Fischer <news3@nililand.de>,
	mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: accessing glyphs in the private area
Date: Mon, 1 Oct 2018 10:20:07 +0200	[thread overview]
Message-ID: <2417d2b5-5911-977e-f84a-0fa807aedaa2@xs4all.nl> (raw)
In-Reply-To: <3na012zg9mls.dlg@nililand.de>

On 9/30/2018 10:08 PM, Ulrike Fischer wrote:
> 
> The font Coelacanth (on CTAN) has glyphs in the private area.
> 
> Between 2/2017 (luaotfload in texlive 2017) and now the storing and
> accessing of this glyphs has changed.
> 
> In the lua of the font of 2017 I find e.g.
> 
>    [62860]={
>     ["boundingbox"]=165,
>     ["index"]=2622,
>     ["unicode"]=62860,
>     ["width"]=523,
> 
> and the glyph can be accessed with \Uchar62860
> 
> In the current lua I now find
> 
>   [983910]={
>     ["boundingbox"]=195,
>     ["index"]=2622,
>     ["unicode"]=62860,
>     ["width"]=523,
>    },
> 
> and \Uchar62860 not longer works, one has to use \Uchar983910.
> 
> Is this change intentional? How is one supposed to access such
> chars? The manual says about \Uchar that it "expands to the
> associated Unicode character." but this seems no longer to be true.
> 
> A context example to test is
> 
> \starttext
> \font\test={name:Coelacanth:mode=node;script=latn;language=DFLT;+tlig;}
> \test
> 1.: \Uchar62860
> 
> 2.: \Uchar983910
> 
> \stoptext
\Uchar expands to the character in the font, so to whatever sits in that 
slot ... in fact, fonts in luatex are not that different from 
traditional tex: slot 123 can be anything but it happens that we use 
unicode in the fontloader ..

anyway, the problem, with these private areas is that they are also used 
by the loader (and context) so in order to avoid clashes we move all 
private chars in the font to a dedicated private range

in your case the glyphs have no real useful names so basically i wonder 
what their use it (are they meant for direct access?)

you can define

\def\byindex#1{\ctxlua{
     for k, v in pairs(fonts.hashes.identifiers[true].characters) do
         if v.index == #1 then
             tex.print(utf.char(k))
             break
         end
     end
}}

{\definedfont[Coelacanth] test \byindex{\number"00A33}}

I can remap those privates to a normalized private name, like P0F581 but 
it depends on how bloated fonts become that have lots of privates.

In that case you can have:

\def\byname#1{\ctxlua{
     for k, v in 
pairs(fonts.hashes.identifiers[true].shared.rawdata.descriptions) do
         if v.name == "#1" then
             tex.print(utf.char(k))
             break
         end
     end
}}

{\definedfont[Coelacanth] test \byname {P0F581}}

(btw,  This code is not for context users! They have other means; this 
is typically stuff that differs per macro package. One might for 
instance make a list per font with meaningfull names or so that can be 
accessed in a more friendly way.)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2018-10-01  8:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-30 20:08 Ulrike Fischer
2018-10-01  8:20 ` Hans Hagen [this message]
2018-10-01  9:42   ` Ulrike Fischer
2018-10-01  9:53     ` luigi scarso
2018-10-01 17:29     ` Hans Hagen
2018-10-01 17:55       ` Ulrike Fischer
2018-10-01 20:42         ` Hans Hagen
2018-10-02  4:55         ` luigi scarso
2018-10-02  7:29           ` Ulrike Fischer
2018-10-02  9:29             ` Hans Hagen
2018-10-02 11:39               ` Ulrike Fischer
2018-10-02 12:42                 ` Hans Hagen
2018-10-01 21:11 David Carlisle
2018-10-02  9:13 ` Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2417d2b5-5911-977e-f84a-0fa807aedaa2@xs4all.nl \
    --to=j.hagen@xs4all.nl \
    --cc=news3@nililand.de \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).