ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Ulrike Fischer <news3@nililand.de>
To: ntg-context@ntg.nl
Subject: Re: reencode fonts with fonts.trigger
Date: Wed, 23 Feb 2011 17:46:22 +0100	[thread overview]
Message-ID: <mi4f5c6r3udj.dlg@nililand.de> (raw)
In-Reply-To: <4D63ECF6.1050609@wxs.nl>

Am Tue, 22 Feb 2011 18:05:58 +0100 schrieb Hans Hagen:


>> Khaled had another idea to manipulate (reencode) fonts: He suggested
>> to put a function in fonts.trigger. (Example below). I have some
>> questions regarding this example:

>> 1. Is there a basic flaw in the idea?
 
> When triggers are done, there are only empty entries in the characters 
> table so swapping them has no effect. You can add info to them but some 
> entries in them will be added when scaling takes place.

For which entries can this be a problem?


>> 5. What is the recommanded lua-code to copy/reassign/remap the
>> tables?  Does a library or some helper functions exist which would
>> make it easier to move the tables around?
> 
> For basemode reencoding you can use the changed subtable:
> 
> \starttext
> 
> \directlua{
>      local function chess(tfmdata,value)
>          if value then
>              tfmdata.changed[75] = 81
>              tfmdata.changed[81] = 75
>          end
>      end
>      table.insert(fonts.triggers,"chess")
>      fonts.initializers.base.otf.chess = chess
> }
> 
> \start
>      \font\TestA="file:SkakNew-Figurine.otf:chess=yes"  \TestA\char75 
> \char81 \par
>      \font\TestB="file:SkakNew-Figurine.otf:chess=no"   \TestB\char75 
> \char81 \par
> \stop
> 
> \stoptext

That works fine - even with luaotfload and latex (after I understood
that "basemode" means that I must call the font with "mode=base").
But curiously the dimens of the char change a bit in latex. E.g.
\showthe\fontcharwd reports without the reencoding 8.99998pt, and
9.0pt with the reencoding. In context I get in both cases 9.0pt.

Is it possible to swap (or set) the "tounicode" value at his time so
that copy&paste gives again a "K" for the king and a "Q" for the
queen?


-- 
Ulrike Fischer 

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


  reply	other threads:[~2011-02-23 16:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-22 15:22 Ulrike Fischer
2011-02-22 17:05 ` Hans Hagen
2011-02-23 16:46   ` Ulrike Fischer [this message]
2011-02-22 19:29 ` Hans Hagen
2011-02-23 17:05   ` Ulrike Fischer
2011-02-25 12:30     ` 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=mi4f5c6r3udj.dlg@nililand.de \
    --to=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).