Re: [NTG-context] issue with optical bounds (OpenType)

2018-12-10 Thread Pablo Rodriguez
On 12/10/18 10:51 AM, Hans Hagen wrote:
> On 12/9/2018 8:54 PM, Pablo Rodriguez wrote:
>> []
>> My own vectors wouldn’t solve the issue, because the variable would be:
>>
>> lfbd(Ὧ) = glyph.width(Ω) - glyph.width(Ὧ)
>>
>> I need to place glyphs accurately, not characters. Character dimensions
>> wouldn’t help to get hanging diacritics.
> 
> well, these dimensions are available so one could use them in 
> constructing additional lfbd feature specifications (add f eatures 
> runtime)

Many thanks for your reply, Hans.

In order to modify the fonts, it would be helpful to have a function
that can substract two glyph widths of a given font, such as:

function document.hanging_diacritics(char_one, char_two)
return (char_one.glyphwidth - char_two.glyphwidth)
end

I don’t have any idea about how to do it. This way I don’t have to
calculate the value for each glyph feature and I can simply add the
values to the font.

BTW, what kind of specifications you think can be constructed for the
lfbd feature (sorry, but I don’t get 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
___

Re: [NTG-context] issue with optical bounds (OpenType)

2018-12-10 Thread Hans Hagen

On 12/9/2018 8:54 PM, Pablo Rodriguez wrote:

On 12/9/18 6:53 PM, Hans Hagen wrote:

On 12/9/2018 5:35 PM, Pablo Rodriguez wrote:

[...]
-Is there any way that I can apply pure raw lfbd/rtbd values to
protrusion with no other protrusion calculation at all in opbd?


you can create your own vectors if you want


My own vectors wouldn’t solve the issue, because the variable would be:

lfbd(Ὧ) = glyph.width(Ω) - glyph.width(Ὧ)

I need to place glyphs accurately, not characters. Character dimensions
wouldn’t help to get hanging diacritics.


well, these dimensions are available so one could use them in 
constructing additional lfbd feature specifications (add f eatures 
runtime)



-In order to avoid editing all the Greek fonts to get hanging
diacritics: is there any way to replicate the lfbd feature with
"fonts.handlers.otf.addfeature"?


probably with some lua magic one can do a lot but these are typical
things i do when i need them (also because one needs to check the whole
of unicode and cook up categories, this kind of stuff is: do it all
robust and well or don't do it; also one doesn't know how consistent
font designs are)


The variable is so simple that the glyph with diacritical marks should
be placed in the beginning of the line as it had no such marks.


the mechanism is more complex: the linebreak algorithm has to take this 
into account (both ends of a potential line) and also look over e.g. par 
starts and so


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
___

Re: [NTG-context] issue with optical bounds (OpenType)

2018-12-09 Thread Pablo Rodriguez
On 12/9/18 6:53 PM, Hans Hagen wrote:
> On 12/9/2018 5:35 PM, Pablo Rodriguez wrote:
>> [...]
>> -Is there any way that I can apply pure raw lfbd/rtbd values to
>> protrusion with no other protrusion calculation at all in opbd?
> 
> you can create your own vectors if you want

My own vectors wouldn’t solve the issue, because the variable would be:

   lfbd(Ὧ) = glyph.width(Ω) - glyph.width(Ὧ)

I need to place glyphs accurately, not characters. Character dimensions
wouldn’t help to get hanging diacritics.

>> -In order to avoid editing all the Greek fonts to get hanging
>> diacritics: is there any way to replicate the lfbd feature with
>> "fonts.handlers.otf.addfeature"?
> 
> probably with some lua magic one can do a lot but these are typical 
> things i do when i need them (also because one needs to check the whole 
> of unicode and cook up categories, this kind of stuff is: do it all 
> robust and well or don't do it; also one doesn't know how consistent 
> font designs are)

The variable is so simple that the glyph with diacritical marks should
be placed in the beginning of the line as it had no such marks.

If the font has all glyphs for uppercase letters with the same width for
the letter strokes, a general approach (such as the menttioned above, I
guess it) would work.

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 optical bounds (OpenType)

2018-12-09 Thread Hans Hagen

On 12/9/2018 5:35 PM, Pablo Rodriguez wrote:

On 12/9/18 2:22 PM, Hans Hagen wrote:

[...]

you confuse mechanism:

- protrusion only happen at the start and end of the line
- kerning (like single does) happens everywhere

so, you need to extend "lfbd" and not use some own kerning feature
"leftbounds" which applyu it everywhere while "lfbd" is treated special
i.e. sets the protrusion values (when "opbd" is enabled) ... no other
way to do this


In that case, I have some questions:

-Is it possible to enable standard protrusion with opbd? (I mean, I
don’t any other character protruded when opbd is enabled.)


well, you want to use what the font provides and if the font is 
incomplete i'd not trust the bits that are there either


when opbd is enabled protrusion is taken from that so you should add all 
chars that you want to prodrude then in an addendum to is (k



-Is there any way that I can apply pure raw lfbd/rtbd values to
protrusion with no other protrusion calculation at all in opbd?


you can create your own vectors if you want


-In order to avoid editing all the Greek fonts to get hanging
diacritics: is there any way to replicate the lfbd feature with
"fonts.handlers.otf.addfeature"?


probably with some lua magic one can do a lot but these are typical 
things i do when i need them (also because one needs to check the whole 
of unicode and cook up categories, this kind of stuff is: do it all 
robust and well or don't do it; also one doesn't know how consistent 
font designs are)

 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
___

Re: [NTG-context] issue with optical bounds (OpenType)

2018-12-09 Thread Pablo Rodriguez
On 12/9/18 2:22 PM, Hans Hagen wrote:
>> [...]
> you confuse mechanism:
> 
> - protrusion only happen at the start and end of the line
> - kerning (like single does) happens everywhere
> 
> so, you need to extend "lfbd" and not use some own kerning feature 
> "leftbounds" which applyu it everywhere while "lfbd" is treated special 
> i.e. sets the protrusion values (when "opbd" is enabled) ... no other 
> way to do this

In that case, I have some questions:

-Is it possible to enable standard protrusion with opbd? (I mean, I
don’t any other character protruded when opbd is enabled.)

-Is there any way that I can apply pure raw lfbd/rtbd values to
protrusion with no other protrusion calculation at all in opbd?

-In order to avoid editing all the Greek fonts to get hanging
diacritics: is there any way to replicate the lfbd feature with
"fonts.handlers.otf.addfeature"?

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 optical bounds (OpenType)

2018-12-09 Thread Hans Hagen

On 12/9/2018 1:34 PM, Pablo Rodriguez wrote:

On 12/7/18 11:25 PM, Hans Hagen wrote:

On 12/7/2018 9:14 PM, Pablo Rodriguez wrote:

[...]
The issue is that, although opbd values are used, that results from opbd
and from single placement in addfeature are different (although LuaTeX
reports the same values for lfbd).


because you implement it as kerning and not as opbd (protrusion is not
kerning) ... you can try to change the name to "lfbd" (if you would
enable lfbd as feature for sure you would get funny kerning so opbd
picks up from those instead)


If protrusion has to apply other values than the ones besides opbd, the
values for optical bounds aren’t reliable for accurate glyph
positioning. Sorry, but otherwise there is no need for optical margins
in OpenType (standard protrusion would be all that is needed).

Kerning might be selectively applied, such as in:

 \startluacode
 fonts.handlers.otf.addfeature {
 name = "leftbounds",
 type = "single",
 data = {
 Ἠ = { -212, 0, -212, 0 },
 Ὧ = { -196, 0, -196, 0 },
 }
 }
 \stopluacode
 \definefontfeature[default][default][protrusion=quality]
 \definefontfeature[leftbounds][leftbounds=yes]
 \setupfirstline
[alternative=word, n=1, style={\feature[+][leftbounds]}]
 \showframe
 \setuplayout[page]
 \definefontfamily[mainface][rm][Typographica Old Standard]
 \definefontfamily[mainface][tt][Latin Modern Mono]
 \setupbodyfont[mainface, 300pt]
 \setupalign[hanging]
 \startbuffer
 «a\par
 «b\par
 Ω\par
 Ὧ\par
 Ἠ\par
 \stopbuffer
 \starttext
 \setupparagraphintro[each][\setfirstline]
 \getbuffer
 \stoptext

At least to get Greek hanging diacritics, I think this is the way to go.
It would be extremely useful to enable a \setuplineintro for verse.

It would be also useful to have a function that substracts the width of
two given glyphs. (This is exactly the amount to get hanging diacritics
properly kerned.)

you confuse mechanism:

- protrusion only happen at the start and end of the line
- kerning (like single does) happens everywhere

so, you need to extend "lfbd" and not use some own kerning feature 
"leftbounds" which applyu it everywhere while "lfbd" is treated special 
i.e. sets the protrusion values (when "opbd" is enabled) ... no other 
way to do this


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
___

Re: [NTG-context] issue with optical bounds (OpenType)

2018-12-09 Thread Pablo Rodriguez
On 12/7/18 11:25 PM, Hans Hagen wrote:
> On 12/7/2018 9:14 PM, Pablo Rodriguez wrote:
>> [...]
>> The issue is that, although opbd values are used, that results from opbd
>> and from single placement in addfeature are different (although LuaTeX
>> reports the same values for lfbd).
> 
> because you implement it as kerning and not as opbd (protrusion is not 
> kerning) ... you can try to change the name to "lfbd" (if you would 
> enable lfbd as feature for sure you would get funny kerning so opbd 
> picks up from those instead)

If protrusion has to apply other values than the ones besides opbd, the
values for optical bounds aren’t reliable for accurate glyph
positioning. Sorry, but otherwise there is no need for optical margins
in OpenType (standard protrusion would be all that is needed).

Kerning might be selectively applied, such as in:

\startluacode
fonts.handlers.otf.addfeature {
name = "leftbounds",
type = "single",
data = {
Ἠ = { -212, 0, -212, 0 },
Ὧ = { -196, 0, -196, 0 },
}
}
\stopluacode
\definefontfeature[default][default][protrusion=quality]
\definefontfeature[leftbounds][leftbounds=yes]
\setupfirstline
   [alternative=word, n=1, style={\feature[+][leftbounds]}]
\showframe
\setuplayout[page]
\definefontfamily[mainface][rm][Typographica Old Standard]
\definefontfamily[mainface][tt][Latin Modern Mono]
\setupbodyfont[mainface, 300pt]
\setupalign[hanging]
\startbuffer
«a\par
«b\par
Ω\par
Ὧ\par
Ἠ\par
\stopbuffer
\starttext
\setupparagraphintro[each][\setfirstline]
\getbuffer
\stoptext

At least to get Greek hanging diacritics, I think this is the way to go.
It would be extremely useful to enable a \setuplineintro for verse.

It would be also useful to have a function that substracts the width of
two given glyphs. (This is exactly the amount to get hanging diacritics
properly kerned.)

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 optical bounds (OpenType)

2018-12-07 Thread Hans Hagen

On 12/7/2018 9:14 PM, Pablo Rodriguez wrote:

On 12/7/18 8:15 PM, Hans Hagen wrote:

On 12/7/2018 7:54 PM, Pablo Rodriguez wrote:

Shouldn’t be the output from both methods be exactly the same?


maybe you need to choose a script and/or language


Many thanks for your reply, Hans.

I modified the font myself and the Greek script is required and selected
(with the Latin script, that OT opbd property doesn’t work at all).

The issue is that, although opbd values are used, that results from opbd
and from single placement in addfeature are different (although LuaTeX
reports the same values for lfbd).
because you implement it as kerning and not as opbd (protrusion is not 
kerning) ... you can try to change the name to "lfbd" (if you would 
enable lfbd as feature for sure you would get funny kerning so opbd 
picks up from those instead)



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
___

Re: [NTG-context] issue with optical bounds (OpenType)

2018-12-07 Thread Pablo Rodriguez
On 12/7/18 8:15 PM, Hans Hagen wrote:
> On 12/7/2018 7:54 PM, Pablo Rodriguez wrote:
>> Shouldn’t be the output from both methods be exactly the same?
> 
> maybe you need to choose a script and/or language

Many thanks for your reply, Hans.

I modified the font myself and the Greek script is required and selected
(with the Latin script, that OT opbd property doesn’t work at all).

The issue is that, although opbd values are used, that results from opbd
and from single placement in addfeature are different (although LuaTeX
reports the same values for lfbd).

Just in case it helps,

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 optical bounds (OpenType)

2018-12-07 Thread Hans Hagen

On 12/7/2018 7:54 PM, Pablo Rodriguez wrote:


Shouldn’t be the output from both methods be exactly the same?

maybe you need to choose a script and/or language

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
___