Re: [NTG-context] issue with italic correction (again)

2019-06-27 Thread Pablo Rodriguez
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
___


Re: [NTG-context] issue with italic correction (again)

2019-06-27 Thread Taco Hoekwater


> On 26 Jun 2019, at 21:53, Pablo Rodriguez  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
___


Re: [NTG-context] issue with italic correction (again)

2019-06-26 Thread Pablo Rodriguez
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
___


Re: [NTG-context] issue with italic correction (again)

2019-06-25 Thread Taco Hoekwater


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

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
___


[NTG-context] issue with italic correction (again)

2019-06-25 Thread Pablo Rodriguez
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
___