ParthDesai / freetype-go

Automatically exported from code.google.com/p/freetype-go
Other
0 stars 0 forks source link

Potential MSIRP implementation issue in hint.go #12

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
in hint.go line 671:

curDist := dotProduct(f26dot6(p.X-ref.X), f26dot6(p.Y-ref.Y), h.gs.dv)

as per the specifications:
https://developer.apple.com/fonts/TrueType-Reference-Manual/RM05/Chap5.html#IP

I think the distance should be computed using the projection vector and not the 
dual vector.  (h.gs.pv instead of h.gs.dv)

correct line:
curDist := dotProduct(f26dot6(p.X-ref.X), f26dot6(p.Y-ref.Y), h.gs.pv)

The equivalent code in Freetype is:
distance = CUR_Func_project( CUR.zp1.cur + point,
                                 CUR.zp0.cur + CUR.GS.rp0 );

Where CUR_Func_project use the projection vector:
return TT_DotFix14( (FT_UInt32)dx, (FT_UInt32)dy,
                        CUR.GS.projVector.x,
                        CUR.GS.projVector.y );

Original issue reported on code.google.com by jeremie....@gmail.com on 4 Nov 2014 at 1:38

GoogleCodeExporter commented 9 years ago
Thanks for the report. I think you're right.

Is there a particular font that there's a difference on, or were you simply 
reading both the C code and the Go code?

Original comment by nigel...@golang.org on 6 Nov 2014 at 8:47

GoogleCodeExporter commented 9 years ago
unfortunately, I'm just reading both code :/
It would be awesome to have full unit test coverage for hinting instructions 
but this doesn't seems to exist (or is hard to find).

Original comment by jeremie....@gmail.com on 6 Nov 2014 at 10:09

GoogleCodeExporter commented 9 years ago
This issue was closed by revision a123d4416a3c.

Original comment by nigel...@golang.org on 6 Nov 2014 at 10:37