Bug 45296 - [PATCH] Bug in Os2Table
Summary: [PATCH] Bug in Os2Table
Status: NEW
Alias: None
Product: Batik - Now in Jira
Classification: Unclassified
Component: Utilities (show other bugs)
Version: 1.8
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Batik Developer's Mailing list
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2008-06-27 02:51 UTC by Ludovic L'Hours
Modified: 2009-03-23 11:36 UTC (History)
0 users



Attachments
Patch of OS2 Font Table (847 bytes, patch)
2008-06-27 02:53 UTC, Ludovic L'Hours
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ludovic L'Hours 2008-06-27 02:51:18 UTC
Hi,

the utility program ttf2svg crashes when converting fonts from Font Freak
(ie http://www.fontfreak.com/fonts/a/Anagram.zip). It seems that during the decoding step of the Os2 table that some fields are optionals and depend on the version of the table (I took the information from FreeType2 web site
http://freetype.sourceforge.net/freetype2/docs/reference/ft2-truetype_tables.html#TT_OS2)

I attached a patch which take care of the version of the table.

I used version 1.8pre but the bug is also present in SVN.


Regards,

Ludovic
Comment 1 Ludovic L'Hours 2008-06-27 02:53:19 UTC
Created attachment 22187 [details]
Patch of OS2 Font Table
Comment 2 Helder Magalhães 2008-11-21 09:36:08 UTC
I've analyzed the patch and, from the link [1], the only things that is not clear to me is if versions are backwards compatible, that is, if a version 2 font includes all version 1 information. The documentation says "only version X tables", something which confuses (me) a bit.

So, my doubt is if:
+        if (version >= 1) {
Should be:
+        if (version == 1) {

Naturally, the same poses for the version 2 check. Apart from this, this seems good to me. A (commented) link to the documentation within the patch would also sound reasonable to further support the version-specific handling. :-)

[1] http://freetype.sourceforge.net/freetype2/docs/reference/ft2-truetype_tables.html#TT_OS2
Comment 3 Ludovic L'Hours 2008-11-21 11:09:57 UTC
I found a more complete (and more official?) documentation than the FreeType one. From [1], all 4 versions of the OS/2 table are presented and they are all backward compatible. The patch could also include the extra fields in to support version 2
and 3.

[1] http://www.microsoft.com/typography/OTSpec/os2.htm
Comment 4 Helder Magalhães 2009-03-23 11:36:59 UTC
Adding the "[PATCH] " prefix to the summary for coherency with other bugs with patches available (although the "PatchAvailable" keyword can also be used, so this is somehow redundant).