ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Palatino patch for the current ConTeXt version
@ 2013-11-17 11:23 honyk
  0 siblings, 0 replies; 9+ messages in thread
From: honyk @ 2013-11-17 11:23 UTC (permalink / raw)
  To: 'mailing list for ConTeXt users'

Hello Everyone,

I am trying to fix a Palatino small caps issue using the procedure explained
here:
http://wiki.contextgarden.net/Palatino_Linotype_under_MKIV

That fix seems to be obsolete nowadays and returning errors. 

I've changed 
fonts.otf.enhancers.patches["^pala"] 
to 
fonts.handlers.otf.enhancers.patches["^pala"]
which compiles, but it does nothing.

I've also tried this variant, but that 'patch' function is never called even
though I clear my font cache every run:

\startluacode
local fonts    = fonts
local otf      = fonts.handlers.otf
local patches  = otf.enhancers.patches
local register = patches.register
local report   = patches.report

function patch (data,filename) 
    report("I am here")
    report("processing data %s", table.serialize(data))
end

register("after","prepare glyphs","^pala", patch)
\stopluacode


Any idea?

Thanks, Jan

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Palatino patch for the current ConTeXt version
       [not found] <001a01cee387$691cd370$3b567a50$@tosovsky@email.cz>
  2013-11-17 11:44 ` Hans Hagen
  2013-12-01  8:40 ` Jan Tosovsky
@ 2013-12-21 10:02 ` Jan Tosovsky
  2 siblings, 0 replies; 9+ messages in thread
From: Jan Tosovsky @ 2013-12-21 10:02 UTC (permalink / raw)
  To: 'mailing list for ConTeXt users'

On 2013-11-17 Jan Tosovsky wrote:
> I am trying to fix a Palatino small caps issue using the procedure
> explained here:
> http://wiki.contextgarden.net/Palatino_Linotype_under_MKIV
> 
> That fix seems to be obsolete nowadays and returning errors.
> 

thanks a lot to all who participated on this issue, especially to Khaled for
fixing the internal font processing. Now Palatino font doesn't need to be
patched on client side which simplifies the font setup significantly.

I've updated that Wiki page accordingly. Feel free to correct me.

Jan

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Palatino patch for the current ConTeXt version
       [not found] <001a01cee387$691cd370$3b567a50$@tosovsky@email.cz>
  2013-11-17 11:44 ` Hans Hagen
@ 2013-12-01  8:40 ` Jan Tosovsky
  2013-12-21 10:02 ` Jan Tosovsky
  2 siblings, 0 replies; 9+ messages in thread
From: Jan Tosovsky @ 2013-12-01  8:40 UTC (permalink / raw)
  To: 'mailing list for ConTeXt users'

On 2013-11-17 Jan Tosovsky wrote:
> 
> I am trying to fix a Palatino small caps issue using the procedure
> explained here:
> http://wiki.contextgarden.net/Palatino_Linotype_under_MKIV
> 
> That fix seems to be obsolete nowadays and returning errors.
> 

almost fixed now using this procedure:

1) Create a new LFG file

local fix_pala = {
   comment = "Switching i.sc glyphs indexes",
   fixes = function(data)
      local descriptions = data.descriptions
      descriptions[983201].index = 1170
      descriptions[983261].index = 1110
   end
}

return {
   name = "pala",
   comment = "Switching the small capped 'i' to a dotless variant in
Palatino Linotype.",
   treatments = {
      ["pala.ttf"]   = fix_pala,
      ["palai.ttf"]  = fix_pala,
      ["palab.ttf"]  = fix_pala,
      ["palabi.ttf"] = fix_pala,      
   },
}


2) Place it into the folder where other LFG files are stored
(tex\texmf-context\tex\context\fonts)

3) Execute 'mtxrun --generate' command to include newly added LFG file
into a file database

4) Specify a new font feature referencing to this goodie in the source file:

\definefontfeature[dotlessi][mode=base,goodies=pala]
\definefontfamily[palatino][rm][Palatino
Linotype][features={default,quality,dotlessi}]
\setupbodyfont[palatino]
\starttext
{Athenians \smallcaps{Athenians}}\par
{Athenians \sc{Athenians}}\par
{\it Athenians \smallcaps{Athenians}}\par
{\bf Athenians \smallcaps{Athenians}}\par
{\bi Athenians \smallcaps{Athenians}}\par
\stoptext

5) Trigger the generating

It works except the regular font style. In this case \smallcaps option
behaves differently than for e.g. \it or \bf styles. I am quite confused.
Moreover, when faked caps are switched on using \sc, it works. Can anybody
explain what is happening here?

Thanks, Jan

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Palatino patch for the current ConTeXt version
  2013-11-27 20:55         ` Hans Hagen
@ 2013-11-29 19:44           ` Jan Tosovsky
  0 siblings, 0 replies; 9+ messages in thread
From: Jan Tosovsky @ 2013-11-29 19:44 UTC (permalink / raw)
  To: 'mailing list for ConTeXt users'

On 2013-11-27 Hans Hagen wrote:
> On 11/27/2013 9:16 PM, Jan Tosovsky wrote:
> > On 2013-11-27 Hans Hagen wrote:
> >> On 11/27/2013 12:40 AM, Jan Tosovsky wrote:
> >>> On 2013-11-17 Hans Hagen wrote:
> >>>> On 11/17/2013 12:23 PM, honyk wrote:
> >>>>> Hello Everyone,
> >>>>>
> >>>>> I am trying to fix a Palatino small caps issue using the
> >>>>> procedure explained here:
> >>>>> http://wiki.contextgarden.net/Palatino_Linotype_under_MKIV
> >>>>>
> >>>>> That fix seems to be obsolete nowadays and returning errors.
> >
> > This LFG core settings:
> > unicodes = {
> >     ["a.sc"] = 97,     (1)
> >     ["b.sc"] = 983261, (2)
> > },
> >
> > (1) replaces all small 'a' into small caps variants - just for
> > testing purposes
> > (2) doesn't replace small caps 'i' to small caps 'b', but when small
> > caps text is selected, b is copied into the clipboard - so some
> > replacement is performed, but incomplete.
> >
> 
> this mechanism assumes that the shapes match the one that unicode
> expects so the (default) tounicode is used ... originally this features
> was meant for fonts with a faulty mapping (some dingbat fonts have
> that)
> 

So a different approach is needed. In another thread we've found out that
there are two glyphs of the same name:

glyph index | glyph name
1110        | i.sc        / small caps dotlessi
1170        | i.sc        / small caps i 

Currently when 'i' is to be rendered as small caps, 1170 is used, but I'd
like to use 1110 instead.

Can this be specified using a LFG file?

Thanks, Jan

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Palatino patch for the current ConTeXt version
       [not found]       ` <00b901ceebad$900fb0a0$b02f11e0$@tosovsky@email.cz>
@ 2013-11-27 20:55         ` Hans Hagen
  2013-11-29 19:44           ` Jan Tosovsky
  0 siblings, 1 reply; 9+ messages in thread
From: Hans Hagen @ 2013-11-27 20:55 UTC (permalink / raw)
  To: ntg-context

On 11/27/2013 9:16 PM, Jan Tosovsky wrote:
> On 2013-11-27 Hans Hagen wrote:
>> On 11/27/2013 12:40 AM, Jan Tosovsky wrote:
>>> On 2013-11-17 Hans Hagen wrote:
>>>> On 11/17/2013 12:23 PM, honyk wrote:
>>>>> Hello Everyone,
>>>>>
>>>>> I am trying to fix a Palatino small caps issue using the procedure
>>>>> explained here:
>>>>> http://wiki.contextgarden.net/Palatino_Linotype_under_MKIV
>>>>>
>>>>> That fix seems to be obsolete nowadays and returning errors.
>>>>>
>>>>
>>>> there are several ways to apply patches runtime, see *.lfg files
>>>> (and also fonts-mkiv.pdf)
>>>
>>> 1) I've created a sample LFG file
>>> 2) placed it into the folder where other LFG files are stored
>>> 3) removed pala.tma and pala.tmc files from the cache
>>> 4) triggered the generating
>>>
>>> My pala.lfg file seems to be ignored:
>>>
>>> return {
>>>       name = "pala",
>>>       comment = "Switching the small capped 'i' to a dotless variant
>>>                  in Palatino Linotype.",
>>>           remapping = {
>>>           tounicode = true,
>>>           unicodes = {
>>>               ["i.sc"] = 983201,
>>>           },
>>>       },
>>> }
>>
>> you have to load them ... see fonts-mkiv.pdf
>
> Thanks, I got it. Two next steps are required and one turned out as
> redundant.
>
> 1) Create a sample LFG file
> 2) Place it into the folder where other LFG files are stored
> 3) NEW! Execute 'mtxrun --generate' command to include newly added LFG file
> into a file database
> 4) NEW! Specify a new font feature referencing to this goodie:
> \definefontfeature[dotlessi][mode=base,goodies=pala,unicoding=yes]
> \definefontfamily[mainface][rm][Palatino
> Linotype][features={default,quality,dotlessi}]
> 5) Trigger the generating
>
> It does something, but not what I need :-)
>
> My MWE:
> \definefontfeature[dotlessi][mode=base,goodies=pala,unicoding=yes]
> \definefontfamily[palatino][rm][Palatino
> Linotype][features={default,quality,dotlessi}]
> \setupbodyfont[palatino]
> \starttext
> Athenians \sc{Athenians}
> \stoptext
>
> This LFG core settings:
> unicodes = {
>     ["a.sc"] = 97,     (1)
>     ["b.sc"] = 983261, (2)
> },
>
> (1) replaces all small 'a' into small caps variants - just for testing
> purposes
> (2) doesn't replace small caps 'i' to small caps 'b', but when small caps
> text is selected, b is copied into the clipboard - so some replacement is
> performed, but incomplete.
>
> Maybe other tables need to be tweaked as well...
> Has anybody any experience with this?

this mechanism assumes that the shapes match the one that unicode 
expects so the (default) tounicode is used ... originally this features 
was meant for fonts with a faulty mapping (some dingbat fonts have that)

Hans




-- 

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Palatino patch for the current ConTeXt version
  2013-11-27  8:37     ` Hans Hagen
@ 2013-11-27 20:16       ` Jan Tosovsky
       [not found]       ` <00b901ceebad$900fb0a0$b02f11e0$@tosovsky@email.cz>
  1 sibling, 0 replies; 9+ messages in thread
From: Jan Tosovsky @ 2013-11-27 20:16 UTC (permalink / raw)
  To: 'mailing list for ConTeXt users'

On 2013-11-27 Hans Hagen wrote:
> On 11/27/2013 12:40 AM, Jan Tosovsky wrote:
> > On 2013-11-17 Hans Hagen wrote:
> >> On 11/17/2013 12:23 PM, honyk wrote:
> >>> Hello Everyone,
> >>>
> >>> I am trying to fix a Palatino small caps issue using the procedure
> >>> explained here:
> >>> http://wiki.contextgarden.net/Palatino_Linotype_under_MKIV
> >>>
> >>> That fix seems to be obsolete nowadays and returning errors.
> >>>
> >>
> >> there are several ways to apply patches runtime, see *.lfg files
> >> (and also fonts-mkiv.pdf)
> >
> > 1) I've created a sample LFG file
> > 2) placed it into the folder where other LFG files are stored
> > 3) removed pala.tma and pala.tmc files from the cache
> > 4) triggered the generating
> >
> > My pala.lfg file seems to be ignored:
> >
> > return {
> >      name = "pala",
> >      comment = "Switching the small capped 'i' to a dotless variant
> >                 in Palatino Linotype.",
> >          remapping = {
> >          tounicode = true,
> >          unicodes = {
> >              ["i.sc"] = 983201,
> >          },
> >      },
> > }
> 
> you have to load them ... see fonts-mkiv.pdf

Thanks, I got it. Two next steps are required and one turned out as
redundant.

1) Create a sample LFG file
2) Place it into the folder where other LFG files are stored
3) NEW! Execute 'mtxrun --generate' command to include newly added LFG file
into a file database
4) NEW! Specify a new font feature referencing to this goodie:
\definefontfeature[dotlessi][mode=base,goodies=pala,unicoding=yes]
\definefontfamily[mainface][rm][Palatino
Linotype][features={default,quality,dotlessi}]
5) Trigger the generating

It does something, but not what I need :-)

My MWE:
\definefontfeature[dotlessi][mode=base,goodies=pala,unicoding=yes]
\definefontfamily[palatino][rm][Palatino
Linotype][features={default,quality,dotlessi}]
\setupbodyfont[palatino]
\starttext
Athenians \sc{Athenians}
\stoptext

This LFG core settings:
unicodes = {
   ["a.sc"] = 97,     (1)
   ["b.sc"] = 983261, (2) 
},

(1) replaces all small 'a' into small caps variants - just for testing
purposes
(2) doesn't replace small caps 'i' to small caps 'b', but when small caps
text is selected, b is copied into the clipboard - so some replacement is
performed, but incomplete.

Maybe other tables need to be tweaked as well...
Has anybody any experience with this?

Thanks, Jan

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Palatino patch for the current ConTeXt version
       [not found]   ` <008801ceeb00$db41e820$91c5b860$@tosovsky@email.cz>
@ 2013-11-27  8:37     ` Hans Hagen
  2013-11-27 20:16       ` Jan Tosovsky
       [not found]       ` <00b901ceebad$900fb0a0$b02f11e0$@tosovsky@email.cz>
  0 siblings, 2 replies; 9+ messages in thread
From: Hans Hagen @ 2013-11-27  8:37 UTC (permalink / raw)
  To: ntg-context

On 11/27/2013 12:40 AM, Jan Tosovsky wrote:
> On 2013-11-17 Hans Hagen wrote:
>> On 11/17/2013 12:23 PM, honyk wrote:
>>> Hello Everyone,
>>>
>>> I am trying to fix a Palatino small caps issue using the procedure
>>> explained here:
>>> http://wiki.contextgarden.net/Palatino_Linotype_under_MKIV
>>>
>>> That fix seems to be obsolete nowadays and returning errors.
>>>
>>
>> there are several ways to apply patches runtime, see *.lfg files (and
>> also fonts-mkiv.pdf)
>
> 1) I've created a sample LFG file
> 2) placed it into the folder where other LFG files are stored
> 3) removed pala.tma and pala.tmc files from the cache
> 4) triggered the generating
>
> My pala.lfg file seems to be ignored:
>
> return {
>      name = "pala",
>      comment = "Switching the small capped 'i' to a dotless variant in
> Palatino Linotype.",
>      remapping = {
>          tounicode = true,
>          unicodes = {
>              ["i.sc"] = 983201,
>          },
>      },
> }
>
> 1) How the LFG file is matched with the font? Is it via the 'name'
> parameter, "pala" in my case? Does that name equals to the file title
> without an extension or something else?
>
> 2) Should I see that comment in the log or is it just a remark for editors?
>
> 3) Can I emulate this patch via direct editing of pala.tma file? When I
> change the 'unicodes' value there, it has no impact on generating (nothing
> changes in the output).

you have to load them ... see fonts-mkiv.pdf

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Palatino patch for the current ConTeXt version
  2013-11-17 11:44 ` Hans Hagen
@ 2013-11-26 23:40   ` Jan Tosovsky
       [not found]   ` <008801ceeb00$db41e820$91c5b860$@tosovsky@email.cz>
  1 sibling, 0 replies; 9+ messages in thread
From: Jan Tosovsky @ 2013-11-26 23:40 UTC (permalink / raw)
  To: 'mailing list for ConTeXt users'

On 2013-11-17 Hans Hagen wrote:
> On 11/17/2013 12:23 PM, honyk wrote:
> > Hello Everyone,
> >
> > I am trying to fix a Palatino small caps issue using the procedure
> > explained here:
> > http://wiki.contextgarden.net/Palatino_Linotype_under_MKIV
> >
> > That fix seems to be obsolete nowadays and returning errors.
> >
> 
> there are several ways to apply patches runtime, see *.lfg files (and
> also fonts-mkiv.pdf)

1) I've created a sample LFG file
2) placed it into the folder where other LFG files are stored
3) removed pala.tma and pala.tmc files from the cache
4) triggered the generating

My pala.lfg file seems to be ignored:

return {
    name = "pala",
    comment = "Switching the small capped 'i' to a dotless variant in
Palatino Linotype.",
    remapping = {
        tounicode = true,
        unicodes = {
            ["i.sc"] = 983201,
        },
    },
}

1) How the LFG file is matched with the font? Is it via the 'name'
parameter, "pala" in my case? Does that name equals to the file title
without an extension or something else?

2) Should I see that comment in the log or is it just a remark for editors?

3) Can I emulate this patch via direct editing of pala.tma file? When I
change the 'unicodes' value there, it has no impact on generating (nothing
changes in the output).

Thanks, Jan

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Palatino patch for the current ConTeXt version
       [not found] <001a01cee387$691cd370$3b567a50$@tosovsky@email.cz>
@ 2013-11-17 11:44 ` Hans Hagen
  2013-11-26 23:40   ` Jan Tosovsky
       [not found]   ` <008801ceeb00$db41e820$91c5b860$@tosovsky@email.cz>
  2013-12-01  8:40 ` Jan Tosovsky
  2013-12-21 10:02 ` Jan Tosovsky
  2 siblings, 2 replies; 9+ messages in thread
From: Hans Hagen @ 2013-11-17 11:44 UTC (permalink / raw)
  To: ntg-context

On 11/17/2013 12:23 PM, honyk wrote:
> Hello Everyone,
>
> I am trying to fix a Palatino small caps issue using the procedure explained
> here:
> http://wiki.contextgarden.net/Palatino_Linotype_under_MKIV
>
> That fix seems to be obsolete nowadays and returning errors.
>
> I've changed
> fonts.otf.enhancers.patches["^pala"]
> to
> fonts.handlers.otf.enhancers.patches["^pala"]
> which compiles, but it does nothing.
>
> I've also tried this variant, but that 'patch' function is never called even
> though I clear my font cache every run:
>
> \startluacode
> local fonts    = fonts
> local otf      = fonts.handlers.otf
> local patches  = otf.enhancers.patches
> local register = patches.register
> local report   = patches.report
>
> function patch (data,filename)
>      report("I am here")
>      report("processing data %s", table.serialize(data))
> end
>
> register("after","prepare glyphs","^pala", patch)
> \stopluacode
>
>
> Any idea?

patches are applied when a font is cached so you need to wipe the cache 
after defining such a patch

there are several ways to apply patches runtime, see *.lfg files (and 
also fonts-mkiv.pdf)

Hans



-- 

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2013-12-21 10:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-17 11:23 Palatino patch for the current ConTeXt version honyk
     [not found] <001a01cee387$691cd370$3b567a50$@tosovsky@email.cz>
2013-11-17 11:44 ` Hans Hagen
2013-11-26 23:40   ` Jan Tosovsky
     [not found]   ` <008801ceeb00$db41e820$91c5b860$@tosovsky@email.cz>
2013-11-27  8:37     ` Hans Hagen
2013-11-27 20:16       ` Jan Tosovsky
     [not found]       ` <00b901ceebad$900fb0a0$b02f11e0$@tosovsky@email.cz>
2013-11-27 20:55         ` Hans Hagen
2013-11-29 19:44           ` Jan Tosovsky
2013-12-01  8:40 ` Jan Tosovsky
2013-12-21 10:02 ` Jan Tosovsky

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