[NTG-context] Negative width vrule ignored in LuaMETATeX
Hans Hagen
j.hagen at xs4all.nl
Fri Apr 24 20:11:01 CEST 2020
On 4/24/2020 7:44 PM, Ao Shen wrote:
> Thanks for your timely reply!
>
> Hans Hagen <j.hagen at xs4all.nl> 于2020年4月24日周五 下午11:38写道:
>>
>> no, but i must admit that it's kind of a border case ... i'll fix it but
>> also wonder if *no* visual rule showing up is intended (i would then
>> also expect an engine to show a rule .. could be an interesting new
>> (luametatex) option as it saves kerns in some cases)
>
> My use cases of negative vrule is a little tricky. I'm trying to comply with
> W3C's [Requirements for Japanese Text Layout](https://www.w3.org/TR/jlreq/).
> It states that
>
> In principle, closing brackets (cl-02), commas (cl-07) or full stops (cl-06)
> at the line end have a half em space after them (see Fig. 3.20). This half em
> space can be deleted for line adjustment. However, the possibilities are only
> half em space or solid. Other spaces, such as a quarter em space should not be
> used.
>
> The tricky part is that I also want the opening fullwidth bracket at the
> beginning of the line to be solid, i.e., without half em sidebearing on the left
> to make the left margin visually more aligned (this is one but not the only way
> of line begining handling shown in jlreq).
>
> To achieve this, in the scripts handler I use the following injector between
> 'full_width_close' and 'full_width_open':
>
> \hskip -0.5em \penalty 100 \hskip 0.5em minus 0.5em \vrule width
> -0.5em height 0pt
> ^^^(a) ^^^(b)
>
> If line is broken here, the only broken points are (a) before the glue or (b) at
> the penalty point. With the vrule the sidebearing of the opening bracket at
> beginning of next line is eliminated.
>
> In this particular case, a kern is not applicable because it won't survive the
> line break. And here a vrule showing nothing is intended.
How about something ...
\startluacode
local classes = fonts.protrusions.classes
local vectors = fonts.protrusions.vectors
classes.myown = {
vector = 'myown',
factor = 1,
}
vectors.myown = table.merged (vectors.quality, {
[0x0028] = { 1, 0 }, -- (
[0x0029] = { 0, 1 }, -- )
})
\stopluacode
\starttext
\showframe
\definefontfeature[whatever][default][protrusion=myown]
\definedfont[Serif*whatever] \setupalign[hanging]
\dorecurse{100}{(#1) }
\stoptext
of course you need to define the cjk fences etc.
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
-----------------------------------------------------------------
More information about the ntg-context
mailing list