ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <j.hagen@xs4all.nl>
To: Ao Shen <shenao6626@gmail.com>,
	mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Negative width vrule ignored in LuaMETATeX
Date: Fri, 24 Apr 2020 20:11:01 +0200	[thread overview]
Message-ID: <13249986-f9ea-78d5-0a37-71ad600ac06b@xs4all.nl> (raw)
In-Reply-To: <CAOyvy4=YxV-1Nh4Ot78Kym8EY8dQYio71qRu2h3=Xyj3jTMcBg@mail.gmail.com>

On 4/24/2020 7:44 PM, Ao Shen wrote:
> Thanks for your timely reply!
> 
> Hans Hagen <j.hagen@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
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________

      parent reply	other threads:[~2020-04-24 18:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-24 14:42 SAO Ocean
2020-04-24 14:48 ` Wolfgang Schuster
2020-04-24 15:37 ` Hans Hagen
     [not found]   ` <CAOyvy4=YxV-1Nh4Ot78Kym8EY8dQYio71qRu2h3=Xyj3jTMcBg@mail.gmail.com>
2020-04-24 18:11     ` 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=13249986-f9ea-78d5-0a37-71ad600ac06b@xs4all.nl \
    --to=j.hagen@xs4all.nl \
    --cc=ntg-context@ntg.nl \
    --cc=shenao6626@gmail.com \
    /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).