ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* issue with italic correction (again)
@ 2019-06-25 19:42 Pablo Rodriguez
  2019-06-25 20:08 ` Taco Hoekwater
  0 siblings, 1 reply; 5+ messages in thread
From: Pablo Rodriguez @ 2019-06-25 19:42 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear list,

[sorry for insisting, but I have the impression that the previous
version of this message went unnoticed.]

I have the following sample:

    \def\DesiredFont{TeX Gyre Termes}
    \definefontfeature[italic][itlc=yes,textitalics=yes]
    \setupitaliccorrection[global, always]
    \definefontfamily
        [mainface]
        [rm]
        [\DesiredFont]
    \definefontfamily
        [mainface_corrected]
        [rm]
        [\DesiredFont]
        [features={italic}]
    \setupbodyfont[mainface]
    \setupitaliccorrection[global,always]
    \starttext
    \startbuffer[chars]
    \startTEXpage[offset=1em]
        \dorecurse{26}
        {\setupbodyfont[mainface]%
            [{\em \recurselevel}]
            [{\em \characters{\recurselevel}}]
            [{\em \Characters{\recurselevel}}]
            ({\em \characters{\recurselevel}})
            ({\em \Characters{\recurselevel}})
        \hfill
        \setupbodyfont[mainface_corrected]
            [{\em \recurselevel}]
            [{\em \characters{\recurselevel}}]
            [{\em \Characters{\recurselevel}}]
            ({\em \characters{\recurselevel}})
            ({\em \Characters{\recurselevel}})
        \par}
    \stopTEXpage
    \stopbuffer
    \getbuffer[chars]
    \def\DesiredFont{TeX Gyre Pagella}
    \getbuffer[chars]
    \stoptext

This shows that sequences such as ({\em f}) are corrected with the
closing parenthesis, but not with the opening one.

Wouldn’t it be possible that italic correction could be enabled also
before the italic glyph(s)?

BTW, I wonder why the second definition of \DesiredFont doesn’t change
the font for the buffer used after it.

Many thanks for your help,

Pablo
--
http://www.ousia.tk
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: issue with italic correction (again)
  2019-06-25 19:42 issue with italic correction (again) Pablo Rodriguez
@ 2019-06-25 20:08 ` Taco Hoekwater
  2019-06-26 19:53   ` Pablo Rodriguez
  0 siblings, 1 reply; 5+ messages in thread
From: Taco Hoekwater @ 2019-06-25 20:08 UTC (permalink / raw)
  To: mailing list for ConTeXt users



> Op 25 jun. 2019 om 21:42 heeft Pablo Rodriguez <oinos@gmx.es> het volgende geschreven:
> 
> BTW, I wonder why the second definition of \DesiredFont doesn’t change
> the font for the buffer used after it.

Using \switchtobodyfont instead of \setupbodyfont for all except the first call should help. You may need to add a \usebodyfont[mainface_corrected] as well (in the setup block). I cannot actually test right now, on a mobile device...

Best wishes,
Taco
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: issue with italic correction (again)
  2019-06-25 20:08 ` Taco Hoekwater
@ 2019-06-26 19:53   ` Pablo Rodriguez
  2019-06-27  8:54     ` Taco Hoekwater
  0 siblings, 1 reply; 5+ messages in thread
From: Pablo Rodriguez @ 2019-06-26 19:53 UTC (permalink / raw)
  To: ntg-context

On 6/25/19 10:08 PM, Taco Hoekwater wrote:
>> Op 25 jun. 2019 om 21:42 heeft Pablo Rodriguez het volgende geschreven:
>>
>> BTW, I wonder why the second definition of \DesiredFont doesn’t change
>> the font for the buffer used after it.
>
> Using \switchtobodyfont instead of \setupbodyfont for all except the
> first call should help. You may need to add a
> \usebodyfont[mainface_corrected] as well (in the setup block). I
> cannot actually test right now, on a mobile device...

Many thanks for your reply, Taco.

I’m afraid that I cannot make it work.

I guess I must be doing something wrong.

I’d like to know which are the differences among \setupbodyfont,
\switchtobodyfont and \usebodyfont.

Many thanks for your help,

Pablo
--
http://www.ousia.tk
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: issue with italic correction (again)
  2019-06-26 19:53   ` Pablo Rodriguez
@ 2019-06-27  8:54     ` Taco Hoekwater
  2019-06-27 13:01       ` Pablo Rodriguez
  0 siblings, 1 reply; 5+ messages in thread
From: Taco Hoekwater @ 2019-06-27  8:54 UTC (permalink / raw)
  To: mailing list for ConTeXt users



> On 26 Jun 2019, at 21:53, Pablo Rodriguez <oinos@gmx.es> wrote:
> 
> On 6/25/19 10:08 PM, Taco Hoekwater wrote:
>>> Op 25 jun. 2019 om 21:42 heeft Pablo Rodriguez het volgende geschreven:
>>> 
>>> BTW, I wonder why the second definition of \DesiredFont doesn’t change
>>> the font for the buffer used after it.
>> 
>> Using \switchtobodyfont instead of \setupbodyfont for all except the
>> first call should help. You may need to add a
>> \usebodyfont[mainface_corrected] as well (in the setup block). I
>> cannot actually test right now, on a mobile device...
> 
> Many thanks for your reply, Taco.
> 
> I’m afraid that I cannot make it work.
> 
> I guess I must be doing something wrong.

No, it is not you. 

The problem is that \definefontfamily always expands its arguments
completely, so by the time you call the body font up, it will already
contain the actual font name instead of the macro \DefinedFont. 

(I had to test that for myself first)

Also, it seems that \definefontfamily does not like redefinitions.

(I had to test that for myself as well)

> 
> I’d like to know which are the differences among \setupbodyfont,
> \switchtobodyfont and \usebodyfont.

Generally, you use \setupbodyfont exactly once, in the setup area. 
This sets up the fonts for the whole document, and it also sets up 
some values for the ‘global environment’ (various internals use the body 
font size, for instance).

If you do not call \setupbodyfont yourself, then ConTeXt will do an implicit

  \setupbodyfont[modern,12pt]

at the \starttext command, just to make sure there is a valid
body font defined.


If you want to use other body font definitions as well, you can use 

  \usebodyfont[mainface_corrected] % etc.

which temporarily switches to the specified body font set, but immediately
switches back to whatever was active before. It exists mostly for
cosmetic reasons. ;)


When you want to switch to any of the preloaded body font sets inside your
document, you normally would use \switchtobodyfont. This only affects the 
document text, not headers and footers, and does also not do the global setup.

You could use \setupbodyfont instead, but \switchtobodyfont is usually what 
you want, and it is also a bit faster.


Anyway, about your example: here is a version that does do the switching:

   \definefontfeature[italic][itlc=yes,textitalics=yes]
   \setupitaliccorrection[global, always]
   \starttext
   \startbuffer[chars]
   \definefontfamily
       [mainface\DesiredFont]
       [rm]
       [\DesiredFont]
   \definefontfamily
       [mainface_corrected\DesiredFont]
       [rm]
       [\DesiredFont]
       [features={italic}]
   \startTEXpage[offset=1em]
       \dorecurse{26}
       {\switchtobodyfont[mainface\DesiredFont]%
           [{\em \recurselevel}]
           [{\em \characters{\recurselevel}}]
           [{\em \Characters{\recurselevel}}]
           ({\em \characters{\recurselevel}})
           ({\em \Characters{\recurselevel}})
       \hfill
       \switchtobodyfont[mainface_corrected\DesiredFont]
           [{\em \recurselevel}]
           [{\em \characters{\recurselevel}}]
           [{\em \Characters{\recurselevel}}]
           ({\em \characters{\recurselevel}})
           ({\em \Characters{\recurselevel}})
       \par}
   \stopTEXpage
   \stopbuffer
   \def\DesiredFont{TeX Gyre Termes}
   \getbuffer[chars]
   \def\DesiredFont{TeX Gyre Pagella}
   \getbuffer[chars]
   \stoptext

Best wishes,
Taco



___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: issue with italic correction (again)
  2019-06-27  8:54     ` Taco Hoekwater
@ 2019-06-27 13:01       ` Pablo Rodriguez
  0 siblings, 0 replies; 5+ messages in thread
From: Pablo Rodriguez @ 2019-06-27 13:01 UTC (permalink / raw)
  To: ntg-context

On 6/27/19 10:54 AM, Taco Hoekwater wrote:
>> On 26 Jun 2019, at 21:53, Pablo Rodriguez wrote:
>> [...]
>> I guess I must be doing something wrong.
>
> No, it is not you.
>
> The problem is that \definefontfamily always expands its arguments
> completely, so by the time you call the body font up, it will already
> contain the actual font name instead of the macro \DefinedFont.
>
> (I had to test that for myself first)
>
> Also, it seems that \definefontfamily does not like redefinitions.
>
> (I had to test that for myself as well)

Many thanks for your detailed explanation, Taco.

I really appreciate to understand how the body font is handled in ConTeXt.

As you wrote, \setupbodyfont is only needed once. I don’t use other body
font command in almost any document. This is a special case, required to
show the difference in italic correction.

Many thanks for your help,

Pablo
--
http://www.ousia.tk
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-06-27 13:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-25 19:42 issue with italic correction (again) Pablo Rodriguez
2019-06-25 20:08 ` Taco Hoekwater
2019-06-26 19:53   ` Pablo Rodriguez
2019-06-27  8:54     ` Taco Hoekwater
2019-06-27 13:01       ` Pablo Rodriguez

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).