ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
To: ntg-context@ntg.nl, Idris Samawi Hamid <ishamid@colostate.edu>
Subject: Re: hz in MkIV
Date: Mon, 4 Jul 2016 09:54:42 +0200	[thread overview]
Message-ID: <a8c38578-a542-5a25-407f-f2238a1652b2@wxs.nl> (raw)
In-Reply-To: <CAMHZ1dZv+=dRT-1_uCH_M3Dnx0FyRj1GcPYirb1dTsPe9U8wng@mail.gmail.com>

On 7/4/2016 6:56 AM, Mohammad Hossein Bateni wrote:
> Hi,
>
> In MkIV, the syntax for using hz seems to have changed from
> \setupfonthandling to \setupfontexpansion (similarly for protrusion).
> What is the equivalent of the following?  Is this feature supported in
> MkIV and LuaTeX?  I tried changing/adding entries to
> fonts.expansions.vectors.quality (and .default) to no apparent avail.
>
>
> \startfonthandling [hz]
>   \defineadjustfactor A .5
>   \defineadjustfactor B .7
>   \defineadjustfactor C .7
>   ...
> \stopfonthandling

it's no longer done that way .. there are reasonable defaults built in 
but you can define your own variants

\startluacode
     local byte = string.byte

     fonts.expansions.classes.mine = {
         stretch = 2,
         shrink  = 2,
         step    = .5,
         factor  = 1
     }

     fonts.expansions.vectors.mine = {
         [byte('a')] = 0.2,
         [byte('e')] = 0.5,
         [byte('i')] = 1.4,
         [byte('o')] = 1.8,
         [byte('u')] = 1.2,
         [byte('y')] = 1.5,
     }
\stopluacode

\definefontfeature[mine-1] [default][expansion=mine-1]
\definefontfeature[mine-2] [default][expansion=mine-2]
\definefontfeature[mine-3] [default][expansion=mine-3]

\setupfontexpansion [mine-1][vector=mine,class=mine]
\setupfontexpansion [mine-2][vector=mine,class=mine,factor=2]
\setupfontexpansion 
[mine-3][vector=mine,stretch=4,shrink=4,step=.25,factor=2]

\setupalign[hz]

\starttext

\startoverlay
     {\framed[align={normal,hz}]{\red  \definedfont[Serif*mine-1]\input 
tufte\relax}}
     {\framed[align={normal,hz}]{\blue \definedfont[Serif*mine-2]\input 
tufte\relax}}
     {\framed[align={normal,hz}]{\green\definedfont[Serif*mine-3]\input 
tufte\relax}}
\stopoverlay

\stoptext

> In any case, I'm happy that hz works for Arabic/Farsi despite some
> warnings suggesting the contrary
> (https://mailman.ntg.nl/pipermail/ntg-context/2008/029765.html).  It
> does make certain Farsi texts look better, however, support for
> tatweel/kashida would be ideal.  In fact, I was trying to see if I could
> somehow get it to work, building on top of hz.  Hans, do you have any
> suggestions for this?  Would this be feasible and/or worth trying?

I have no clue how well it works with marks and cursive

> I once converted Vafa Khalighi's XeTeX-based code to Lua but ran into
> several setbacks.  (The idea is to insert a sequence of
> (ZWJ,\nobreak,stretchable leader,\nobreak,ZWJ) between certain character
> pairs that join one another.)  Here are some of the issues I faced:
> 1) This could not be turned off and on within a paragraph because I was
> hooking into processors.before action.
> 2) The mechanism for some (all?) center alignments (including default
> figure captions) interferes with what I was hacking (or, to be more
> precise, it's the other way around) and causes unnecessary use of
> tatweel in those settings.
> 3) Later I noticed that the added sequence did not inherit many
> properties (like font style or color).
> 4) The optimum values for the stretches I put in depend on the context,
> particularly because some environments manipulate \spaceskip for other
> reasons.
>
> Sorry for the mumbling.  I can explain more if anyone is interested in
> helping to improve this functionality.  Attached is what I have now.

a more advanced mechanism has been built in already half a decade ago, 
using alternative feature sets but not many fonts have them (example in 
solutions-001.tex); i can imagine that you construct extra features

(the husayni font has a whole series of extra features to support this 
optimization)

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

      reply	other threads:[~2016-07-04  7:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-04  4:56 Mohammad Hossein Bateni
2016-07-04  7:54 ` Hans Hagen [this message]

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=a8c38578-a542-5a25-407f-f2238a1652b2@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ishamid@colostate.edu \
    --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).