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 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 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. Thanks, MHB
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 -----------------------------------------------------------------
participants (2)
-
Hans Hagen
-
Mohammad Hossein Bateni