Re: [NTG-context] MkIV italic correction?

2009-06-01 Thread Khaled Hosny
On Wed, May 27, 2009 at 01:34:57PM +0900, Dohyun Kim wrote:
 2009/5/22 Taco Hoekwater t...@elvenkind.com:
 
 
  Hans Hagen wrote:
  Taco Hoekwater wrote:
 
  Khaled Hosny wrote:
  Not very helpful in this situation, but FontForge has a non-standard
  italic correction (ITLC) table[1], may be TeX related OpenTyp font
  projects like Latin Modern and Gyre fonts can use it?
 
  That would perhaps not be a bad idea. If that table is there then
  luatex will automatically use it (it is a subtable of 'TeX ', which
  also contains height and depth information, and font dimensions).
 
  so, that data would end up in a regular feature/lookup? of is it an
  entry in the glyph?
 
  They are automatically merged into the glyph, as
 
         glyph.italic_correction
         glyph.tex_height
         glyph.tex_depth
 
 
 Hi,
 
 Considering current state that we don't know any fonts that has ITLC table,
 it would be better than nothing to implement italic correction as follows.

Per FontForge's documentation, it can generate italic correction values,
may be LuaTeX could make use of such feature and provide a way to
generate italic correction values for fonts missing it, may be the tex
height and depth too, if it isn't doing so already? Since FontForge has
access to actual glyph shapes, it might be generating better guesses.

I can generate sample fonts with FontForge for testing, if needed.

Regards,
 Khaled


-- 
 Khaled Hosny
 Arabic localiser and member of Arabeyes.org team
 Free font developer


signature.asc
Description: Digital signature
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] MkIV italic correction?

2009-06-01 Thread Hans Hagen

Khaled Hosny wrote:

On Wed, May 27, 2009 at 01:34:57PM +0900, Dohyun Kim wrote:

2009/5/22 Taco Hoekwater t...@elvenkind.com:


Hans Hagen wrote:

Taco Hoekwater wrote:

Khaled Hosny wrote:

Not very helpful in this situation, but FontForge has a non-standard
italic correction (ITLC) table[1], may be TeX related OpenTyp font
projects like Latin Modern and Gyre fonts can use it?

That would perhaps not be a bad idea. If that table is there then
luatex will automatically use it (it is a subtable of 'TeX ', which
also contains height and depth information, and font dimensions).

so, that data would end up in a regular feature/lookup? of is it an
entry in the glyph?

They are automatically merged into the glyph, as

   glyph.italic_correction
   glyph.tex_height
   glyph.tex_depth


Hi,

Considering current state that we don't know any fonts that has ITLC table,
it would be better than nothing to implement italic correction as follows.


Per FontForge's documentation, it can generate italic correction values,
may be LuaTeX could make use of such feature and provide a way to
generate italic correction values for fonts missing it, may be the tex
height and depth too, if it isn't doing so already? Since FontForge has
access to actual glyph shapes, it might be generating better guesses.

I can generate sample fonts with FontForge for testing, if needed.


as such an italic correction is not part of the font design but a guess 
it makes sense to keep it 'under lua control' so i implemented a 
itls=yes feature (base mode and node mode; is in beta)


Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] MkIV italic correction?

2009-05-27 Thread Hans Hagen

Dohyun Kim wrote:


Considering current state that we don't know any fonts that has ITLC table,
it would be better than nothing to implement italic correction as follows.
In the following code, fontdata is a table returned by the function
fonts.define.read.

local param = fontdata.parameters
local italicangle = fontdata.shared.otfdata.metadata.italicangle
if italicangle and italicangle  0 then
local uwidth = fontdata.shared.otfdata.metadata.uwidth or 40
local factor = fontdata.factor or 655.36
param.slant = - math.tan(italicangle*math.pi/180) * param.quad
for i,v in pairs(fontdata.characters) do
local gl = fontdata.descriptions[i]
local it = (gl.boundingbox[3] - gl.width + uwidth*0.5) * factor
if it  0 then v.italic = it end
end
end


there are seleveral solutions:

- extend the font with this info (faster but then it's always there 
which might not be ok as it's an approximation)


- calculate it after loading (which is what you propose)

in the mkiv code we do have a hook for that kind of things so this is 
then what i propose. watch how we don't scale here, we just add an entry 
to the shared data as that's where we hook in; the real implementation 
would look slightly different as an optimization is possible


\starttext

\startluacode
table.insert(fonts.triggers,itlc)

local function itlc(tfmdata,value)
if value then
-- the magic 40 and it formula come from Dohyun Kim
local fontdata = tfmdata.shared.otfdata or tfmdata.shared.afmdata
local metadata = fontdata and fontdata.metadata
if metadata then
local italicangle = metadata.italicangle
if italicangle and italicangle ~= 0 then
local uwidth = (metadata.uwidth or 40)/2
for unicode, d in next, tfmdata.descriptions do
local it = d.boundingbox[3] - d.width + uwidth
if it ~= 0 then
d.italic = it
end
end
end
end
end
end

fonts.initializers.base.otf.itlc = itlc
fonts.initializers.node.otf.itlc = itlc

fonts.initializers.base.afm.itlc = itlc
fonts.initializers.node.afm.itlc = itlc
\stopluacode

\definedfont[SerifItalic*default at 24pt] test\/test

\definefontfeature[xdefault][default][itlc=yes]

\definedfont[SerifItalic*xdefault at 24pt] test\/test

\stoptext

i could add it to the generic code (although i'm not going to add all 
the other context goodies to the generic code definitely not as long as 
they're experimental)




-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] MkIV italic correction?

2009-05-26 Thread Dohyun Kim
2009/5/22 Taco Hoekwater t...@elvenkind.com:


 Hans Hagen wrote:
 Taco Hoekwater wrote:

 Khaled Hosny wrote:
 Not very helpful in this situation, but FontForge has a non-standard
 italic correction (ITLC) table[1], may be TeX related OpenTyp font
 projects like Latin Modern and Gyre fonts can use it?

 That would perhaps not be a bad idea. If that table is there then
 luatex will automatically use it (it is a subtable of 'TeX ', which
 also contains height and depth information, and font dimensions).

 so, that data would end up in a regular feature/lookup? of is it an
 entry in the glyph?

 They are automatically merged into the glyph, as

        glyph.italic_correction
        glyph.tex_height
        glyph.tex_depth


Hi,

Considering current state that we don't know any fonts that has ITLC table,
it would be better than nothing to implement italic correction as follows.
In the following code, fontdata is a table returned by the function
fonts.define.read.

local param = fontdata.parameters
local italicangle = fontdata.shared.otfdata.metadata.italicangle
if italicangle and italicangle  0 then
local uwidth = fontdata.shared.otfdata.metadata.uwidth or 40
local factor = fontdata.factor or 655.36
param.slant = - math.tan(italicangle*math.pi/180) * param.quad
for i,v in pairs(fontdata.characters) do
local gl = fontdata.descriptions[i]
local it = (gl.boundingbox[3] - gl.width + uwidth*0.5) * factor
if it  0 then v.italic = it end
end
end

Best,
Dohyun Kim
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] MkIV italic correction?

2009-05-22 Thread Taco Hoekwater


Corsair wrote:
 On Thu, May 21, 2009 at 01:59:14PM +0200, Taco Hoekwater wrote:
 Corsair wrote:
 On Thu, May 21, 2009 at 11:55:45AM +0200, Hans Hagen wrote:
 open type fonts have no italic correction info (except in math)
 But I notice that using the same fonts in XeTeX produces italic
 correction.  Is it fake?
 I guess it is using the glyph boundingbox.
 
 Thank you.  This sounds reasonable.  Is there any way I can achieve
 this in MkIV?  I'm currently using \def\/{\kern0.1em}, which is kinda
 dirty...

Hans could implement something like this easily, but whether it does
much good is doubtful (that square box does not actually tell you where
something sticks out, just that it does).

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


Re: [NTG-context] MkIV italic correction?

2009-05-22 Thread Taco Hoekwater


Khaled Hosny wrote:
 
 Not very helpful in this situation, but FontForge has a non-standard
 italic correction (ITLC) table[1], may be TeX related OpenTyp font
 projects like Latin Modern and Gyre fonts can use it?

That would perhaps not be a bad idea. If that table is there then
luatex will automatically use it (it is a subtable of 'TeX ', which
also contains height and depth information, and font dimensions).


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


Re: [NTG-context] MkIV italic correction?

2009-05-22 Thread Hans Hagen

Taco Hoekwater wrote:


Khaled Hosny wrote:

Not very helpful in this situation, but FontForge has a non-standard
italic correction (ITLC) table[1], may be TeX related OpenTyp font
projects like Latin Modern and Gyre fonts can use it?


That would perhaps not be a bad idea. If that table is there then
luatex will automatically use it (it is a subtable of 'TeX ', which
also contains height and depth information, and font dimensions).


so, that data would end up in a regular feature/lookup? of is it an 
entry in the glyph?


for taco: it would be handy then to have a flag telling so, otherwise we 
would have to check for each glyph a field which for huge fonts is a 
slow downer



-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] MkIV italic correction?

2009-05-22 Thread Taco Hoekwater


Hans Hagen wrote:
 Taco Hoekwater wrote:

 Khaled Hosny wrote:
 Not very helpful in this situation, but FontForge has a non-standard
 italic correction (ITLC) table[1], may be TeX related OpenTyp font
 projects like Latin Modern and Gyre fonts can use it?

 That would perhaps not be a bad idea. If that table is there then
 luatex will automatically use it (it is a subtable of 'TeX ', which
 also contains height and depth information, and font dimensions).
 
 so, that data would end up in a regular feature/lookup? of is it an
 entry in the glyph?

They are automatically merged into the glyph, as

glyph.italic_correction
glyph.tex_height
glyph.tex_depth

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


Re: [NTG-context] MkIV italic correction?

2009-05-21 Thread Hans Hagen

Corsair wrote:

Hi all,

Does MkIV support italic correction?  Because the following code
produces two identical f)s

\starttext
{\it f})
{\it f\/})
\stoptext


open type fonts have no italic correction info (except in math)

Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] MkIV italic correction?

2009-05-21 Thread Corsair
On Thu, May 21, 2009 at 11:55:45AM +0200, Hans Hagen wrote:
 open type fonts have no italic correction info (except in math)

But I notice that using the same fonts in XeTeX produces italic
correction.  Is it fake?

-- 
There is no emotion; there is peace.
There is no ignorance; there is knowledge.
There is no passion; there is serenity.
There is no death; there is the Force.


pgpcsgfJ4LDhX.pgp
Description: PGP signature
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] MkIV italic correction?

2009-05-21 Thread Taco Hoekwater

Corsair wrote:

On Thu, May 21, 2009 at 11:55:45AM +0200, Hans Hagen wrote:

open type fonts have no italic correction info (except in math)


But I notice that using the same fonts in XeTeX produces italic
correction.  Is it fake?


I guess it is using the glyph boundingbox.
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] MkIV italic correction?

2009-05-21 Thread Khaled Hosny
On Thu, May 21, 2009 at 11:55:45AM +0200, Hans Hagen wrote:
 Corsair wrote:
 Hi all,

 Does MkIV support italic correction?  Because the following code
 produces two identical f)s

 \starttext
 {\it f})
 {\it f\/})
 \stoptext

 open type fonts have no italic correction info (except in math)

Not very helpful in this situation, but FontForge has a non-standard
italic correction (ITLC) table[1], may be TeX related OpenTyp font
projects like Latin Modern and Gyre fonts can use it?

[1]http://fontforge.sourceforge.net/non-standard.html

Regards,
 Khaled


-- 
 Khaled Hosny
 Arabic localiser and member of Arabeyes.org team
 Free font developer


signature.asc
Description: Digital signature
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] MkIV italic correction?

2009-05-21 Thread Corsair
On Thu, May 21, 2009 at 01:59:14PM +0200, Taco Hoekwater wrote:
 Corsair wrote:
  On Thu, May 21, 2009 at 11:55:45AM +0200, Hans Hagen wrote:
  open type fonts have no italic correction info (except in math)
  
  But I notice that using the same fonts in XeTeX produces italic
  correction.  Is it fake?
 
 I guess it is using the glyph boundingbox.

Thank you.  This sounds reasonable.  Is there any way I can achieve
this in MkIV?  I'm currently using \def\/{\kern0.1em}, which is kinda
dirty...

-- 
There is no emotion; there is peace.
There is no ignorance; there is knowledge.
There is no passion; there is serenity.
There is no death; there is the Force.


pgpBwAEl15ODI.pgp
Description: PGP signature
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] MkIV italic correction?

2009-05-20 Thread Corsair
Hi all,

Does MkIV support italic correction?  Because the following code
produces two identical f)s

\starttext
{\it f})
{\it f\/})
\stoptext

-- 
There is no emotion; there is peace.
There is no ignorance; there is knowledge.
There is no passion; there is serenity.
There is no death; there is the Force.


pgpTLTfcXNdmo.pgp
Description: PGP signature
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] MkIV italic correction?

2009-05-20 Thread Yue Wang
it supports italic correction by default.

On Wed, May 20, 2009 at 2:25 PM, Corsair chris.cors...@gmail.com wrote:
 Hi all,

 Does MkIV support italic correction?  Because the following code
 produces two identical f)s

 \starttext
 {\it f})
 {\it f\/})
 \stoptext

 --
 There is no emotion; there is peace.
 There is no ignorance; there is knowledge.
 There is no passion; there is serenity.
 There is no death; there is the Force.

 ___
 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  : https://foundry.supelec.fr/projects/contextrev/
 wiki     : http://contextgarden.net
 ___


___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] MkIV italic correction?

2009-05-20 Thread Corsair
On Wed, May 20, 2009 at 03:21:59PM +0800, Yue Wang wrote:
 it supports italic correction by default.

Then what's your result of the code?  Does it come with italic
correction?

 On Wed, May 20, 2009 at 2:25 PM, Corsair chris.cors...@gmail.com wrote:
  Hi all,
 
  Does MkIV support italic correction? �Because the following code
  produces two identical f)s
 
  \starttext
  {\it f})
  {\it f\/})
  \stoptext

-- 
There is no emotion; there is peace.
There is no ignorance; there is knowledge.
There is no passion; there is serenity.
There is no death; there is the Force.


pgp4GyvzAdf5U.pgp
Description: PGP signature
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___