From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/105941 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Rik Kabel Newsgroups: gmane.comp.tex.context Subject: Re: Adjust kern for one character Date: Thu, 26 Dec 2019 07:41:53 -0500 Message-ID: <1faba092-1c2d-d1ed-38c5-130f78da1d73@rik.users.panix.com> References: <0d4b3eb9-57ea-ba2e-2fa2-d0cfc39f4377@panix.com> <566d3c7b-5518-98f4-c66f-f01c0222e8a6@fastwebnet.it> <3198ad57-6581-0876-a111-dc76200d3d9b@rik.users.panix.com> <73379dce-058d-7f04-79ed-1ad555a970ea@gmail.com> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1008035222684284230==" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="61653"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Firefox/60.0 Thunderbird/60.9.1 To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Thu Dec 26 13:42:33 2019 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ikSTI-000FtA-Ar for gctc-ntg-context-518@m.gmane.org; Thu, 26 Dec 2019 13:42:32 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 5357E164718; Thu, 26 Dec 2019 13:42:08 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xYcTzhgo_Wgh; Thu, 26 Dec 2019 13:42:02 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id EFE791646F6; Thu, 26 Dec 2019 13:42:01 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id D15BE1609D1 for ; Thu, 26 Dec 2019 13:42:00 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ltEXWTkGUC5d for ; Thu, 26 Dec 2019 13:41:56 +0100 (CET) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=166.84.1.89; helo=mailbackend.panix.com; envelope-from=context@rik.users.panix.com; receiver= Original-Received: from mailbackend.panix.com (mailbackend.panix.com [166.84.1.89]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 085E0164712 for ; Thu, 26 Dec 2019 13:41:55 +0100 (CET) Original-Received: from [192.168.201.21] (cpe-72-228-11-252.nycap.res.rr.com [72.228.11.252]) by mailbackend.panix.com (Postfix) with ESMTPSA id 47k8jG3ddtz1fmH for ; Thu, 26 Dec 2019 07:41:54 -0500 (EST) In-Reply-To: Content-Language: en-US X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.org gmane.comp.tex.context:105941 Archived-At: This is a multi-part message in MIME format. --===============1008035222684284230== Content-Type: multipart/alternative; boundary="------------E54701FBD543D2227335C1A0" Content-Language: en-US This is a multi-part message in MIME format. --------------E54701FBD543D2227335C1A0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 12/23/2019 18:45, Rik Kabel wrote: > > On 12/22/2019 21:34, Henri Menke wrote: >> >> >> On 12/23/19 3:33 PM, Henri Menke wrote: >>> On 12/23/19 2:30 PM, Rik Kabel wrote: >>>> >>>> On 12/22/2019 17:40, mf wrote: >>>>> Il 22/12/19 22:19, Rik Kabel ha scritto: >>>>>> List, >>>>>> >>>>>> Is there a way in ConTeXt to adjust the left-side kern for one >>>>>> character? The cap J in the font I am using is being set too >>>>>> close to >>>>>> the preceding characters and I would rather not insert a thinspace >>>>>> before each. (Inserting a thinspace is sufficient, but finer control >>>>>> is welcome.) >>>>>> >>>>> \definecharacterspacing[distantJ] >>>>> \setupcharacterspacing[distantJ]["004A][left=.15,alternative=1] % >>>>> 004A >>>>> is the unicode hex index of letter J >>>>> \starttext >>>>>     normal: AJB\par >>>>>     \setcharacterspacing[distantJ] more space on the left: AJB\par >>>>>     \resetcharacterspacing normal again: AJB\par >>>>> \stoptext >>>>> >>>> Thank you for that, Massi. >>>> >>>> Unfortunately, that is too blunt an instrument in this case -- in >>>> addition to the body font where the problem exists, it works on the >>>> heading and titling font, which does not share the problem. >>>> >>>> As Henri's answer hints, I was a bit unclear in my request. It is a >>>> kern >>>> between a word space and the cap J that is the issue. Perhaps a font >>>> feature file is the place to do such a thing. >>> >>> \startluacode >>> fonts.handlers.otf.addfeature { >>>       name = "kern", >>>       type = "kern", >>>       data = { >>>           [" "] = { >>>               ["J"] = 1000 % exaggerated value >> >> Should of course be a Lua comment >> >>             ["J"] = 1000 -- exaggerated value >> >>>           } >>>       } >>> } >>> \stopluacode >>> >>> \setupbodyfont[modern] % have to reload the font >>> >>> \starttext >>> >>> No Jokes! >>> >>> \stoptext >>> > Henri, > > This looks very promising. It works, mostly. That is, all fonts that > use default fontfeatures pick up the change. So, for example, the > companion sansserif for my body font also gets it even though that is > not what I want. > > I can remove kerning from the default fontfeatures and add it back > just for the problematic font, but that means no kerning for the sans > font. > > Is there a way to apply this to one font only (serif upright, bold, > italic, ...) or even a single face (upright), perhaps by giving it a > unique name? I have tried a few variations but had no success. The > fonts-mkiv manual has very little on this, and the cld manual nothing. > Okay, I have progressed further but have run into something (else) I cannot understand. Consider the following example: \definefontfeature [myserif] [mode=node,kern=yes,xkern=yes] \definefontfeature [mysans] [mode=node,kern=yes,xkern=no] \definefontfeature [none] [mode=node] \definefontfamily [mykerns] [serif] [Baskervaldx] [features=myserif] \definefontfamily [mykerns] [sans] [Dejavusans] [features=mysans] \definefontfamily [default] [serif] [Baskervaldx] [features=default] \definefontfamily [default] [sans] [Dejavusans] [features=default] \definefontfamily [nokerns] [serif] [Baskervaldx] [features=none] \definefontfamily [nokerns] [sans] [Dejavusans] [features=none] \definefontfamily [legends] [mono] [Dejavusansmono] [features=default] \startluacode fonts.handlers.otf.addfeature { name = "kern", type = "kern", data = { ["x"] = { ["x"] = -300 }, [" "] = { ["A"] = 1000 } } } fonts.handlers.otf.addfeature { name = "xkern", type = "kern", data = { ["x"] = { ["x"] = 500 }, [" "] = { ["J"] = 500 } } } \stopluacode \startbuffer[Sample] g, Jaxxb AJon \stopbuffer \define[2]\Test{ {\switchtobodyfont[#1]#2\getbuffer[Sample]}} \setupbodyfont[legends] \starttext \starttabulate[|l|l|l|] \NC test \NC Serif \NC Sans \NC \NR \NC nokerns \NC \Test{nokerns}{\tf} \NC \Test{nokerns}{\ss} \NC \NR \NC default \NC \Test{default}{\tf} \NC \Test{default}{\ss} \NC \NR \NC mykerns \NC \Test{mykerns}{\tf} \NC \Test{mykerns}{\ss} \NC \NR \stoptabulate \stoptext It shows, as far as I see, that the kern feature type supports " ", but only when it is named kern. When it is named xkern, as here, it does not support spaces, but does support other characters. If I can get support for a separate feature name, I can easily apply this corrective kern to the single problematic font. I also tried a goodie file, but it, too, did not support the " ". -- Rik --------------E54701FBD543D2227335C1A0 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit


On 12/23/2019 18:45, Rik Kabel wrote:

On 12/22/2019 21:34, Henri Menke wrote:


On 12/23/19 3:33 PM, Henri Menke wrote:
On 12/23/19 2:30 PM, Rik Kabel wrote:

On 12/22/2019 17:40, mf wrote:
Il 22/12/19 22:19, Rik Kabel ha scritto:
List,

Is there a way in ConTeXt to adjust the left-side kern for one
character? The cap J in the font I am using is being set too close to
the preceding characters and I would rather not insert a thinspace
before each. (Inserting a thinspace is sufficient, but finer control
is welcome.)

\definecharacterspacing[distantJ]
\setupcharacterspacing[distantJ]["004A][left=.15,alternative=1] % 004A
is the unicode hex index of letter J
\starttext
    normal: AJB\par
    \setcharacterspacing[distantJ] more space on the left: AJB\par
    \resetcharacterspacing normal again: AJB\par
\stoptext

Thank you for that, Massi.

Unfortunately, that is too blunt an instrument in this case -- in
addition to the body font where the problem exists, it works on the
heading and titling font, which does not share the problem.

As Henri's answer hints, I was a bit unclear in my request. It is a kern
between a word space and the cap J that is the issue. Perhaps a font
feature file is the place to do such a thing.

\startluacode
fonts.handlers.otf.addfeature {
      name = "kern",
      type = "kern",
      data = {
          [" "] = {
              ["J"] = 1000 % exaggerated value

Should of course be a Lua comment

            ["J"] = 1000 -- exaggerated value

          }
      }
}
\stopluacode

\setupbodyfont[modern] % have to reload the font

\starttext

No Jokes!

\stoptext

Henri,

This looks very promising. It works, mostly. That is, all fonts that use default fontfeatures pick up the change. So, for example, the companion sansserif for my body font also gets it even though that is not what I want.

I can remove kerning from the default fontfeatures and add it back just for the problematic font, but that means no kerning for the sans font.

Is there a way to apply this to one font only (serif upright, bold, italic, ...) or even a single face (upright), perhaps by giving it a unique name? I have tried a few variations but had no success. The fonts-mkiv manual has very little on this, and the cld manual nothing.

Okay, I have progressed further but have run into something (else) I cannot understand. Consider the following example:

\definefontfeature   [myserif] [mode=node,kern=yes,xkern=yes]
\definefontfeature   [mysans]  [mode=node,kern=yes,xkern=no]
\definefontfeature   [none]    [mode=node]
\definefontfamily    [mykerns] [serif] [Baskervaldx]    [features=myserif]
\definefontfamily    [mykerns] [sans]  [Dejavusans]     [features=mysans]
\definefontfamily    [default] [serif] [Baskervaldx]    [features=default]
\definefontfamily    [default] [sans]  [Dejavusans]     [features=default]
\definefontfamily    [nokerns] [serif] [Baskervaldx]    [features=none]
\definefontfamily    [nokerns] [sans]  [Dejavusans]     [features=none]
\definefontfamily    [legends] [mono]  [Dejavusansmono] [features=default]

\startluacode
  fonts.handlers.otf.addfeature {
      name = "kern",
      type = "kern",
      data = {
          ["x"] = { ["x"] = -300 },
          [" "] = { ["A"] = 1000 }
      }
  }
  fonts.handlers.otf.addfeature {
      name = "xkern",
      type = "kern",
      data = {
          ["x"] = { ["x"] = 500 },
          [" "] = { ["J"] = 500 }
      }
  }
\stopluacode 

\startbuffer[Sample]
  g, Jaxxb AJon
\stopbuffer

\define[2]\Test{
  {\switchtobodyfont[#1]#2\getbuffer[Sample]}}

\setupbodyfont[legends]

\starttext
\starttabulate[|l|l|l|]
\NC test     \NC  Serif                \NC  Sans                 \NC \NR
\NC nokerns  \NC  \Test{nokerns}{\tf}  \NC  \Test{nokerns}{\ss}  \NC \NR
\NC default  \NC  \Test{default}{\tf}  \NC  \Test{default}{\ss}  \NC \NR
\NC mykerns  \NC  \Test{mykerns}{\tf}  \NC  \Test{mykerns}{\ss}  \NC \NR
\stoptabulate
\stoptext

It shows, as far as I see, that the kern feature type supports " ", but only when it is named kern. When it is named xkern, as here, it does not support spaces, but does support other characters.

If I can get support for a separate feature name, I can easily apply this corrective kern to the single problematic font.

I also tried a goodie file, but it, too, did not support the " ".

--
Rik

--------------E54701FBD543D2227335C1A0-- --===============1008035222684284230== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============1008035222684284230==--