<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://typophile.com" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>Typophile - True Type parsing issue - Comments</title>
 <link>http://typophile.com/node/35069</link>
 <description>Comments for &quot;True Type parsing issue&quot;</description>
 <language>en</language>
<item>
 <title>It’s hard to say for sure</title>
 <link>http://typophile.com/node/35069#comment-212966</link>
 <description>&lt;p&gt;It&amp;#8217;s hard to say for sure without seeing the rest of the font data, but I would guess that what you&amp;#8217;re calling the data for the blank glyph *is* in fact padding at the end of the first glyph. There can be 0 - 3 pad bytes at the end of each glyph&amp;#8217;s data, depending on the length of the data and &amp;#8217;loca&amp;#8217; format (&amp;#8217;indexToLocFormat&amp;#8217; value from the &lt;a class=&quot;freelinking-external&quot; href=&quot;http://www.microsoft.com/typography/otspec/head.htm&quot;&gt;&amp;#8217;head&amp;#8217; table&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Are you reading the &amp;#8217;loca&amp;#8217; table to obtain each glyph&amp;#8217;s offset and length within the &amp;#8217;glyf&amp;#8217; table? I would be surprised to see such results if so, as it would indicate corruption (as an aside: if you haven&amp;#8217;t already verified the integrity of the data, you should consider doing so with &lt;a class=&quot;freelinking-external&quot; href=&quot;http://www.microsoft.com/typography/FontValidator.mspx&quot;&gt;Font Validator&lt;/a&gt; or other utility). Truly blank glyphs will have a length of zero.&lt;/p&gt;
&lt;p&gt;If you&amp;#8217;re not using the &amp;#8217;loca&amp;#8217; values...well, you need to. The &amp;#8217;glyf&amp;#8217; table data is meaningless without the &amp;#8217;loca&amp;#8217;.&lt;/p&gt;
</description>
 <pubDate>Thu, 12 Jul 2007 08:59:43 -0700</pubDate>
 <dc:creator>j.hadley</dc:creator>
 <guid isPermaLink="false">comment 212966 at http://typophile.com</guid>
</item>
<item>
 <title>True Type parsing issue</title>
 <link>http://typophile.com/node/35069</link>
 <description>&lt;p&gt;Hey!&lt;br /&gt;
I&amp;#8217;m currently writing a parser for the TrueType file format for a project I&amp;#8217;m doing. I don&amp;#8217;t need all the tables present in the TT standard, and everything I&amp;#8217;ve parsed so far has worked out nicely. Now I&amp;#8217;m battling with the glyf-table, which I just can seem to get right!&lt;/p&gt;
&lt;p&gt;When I parse this table, everything works as expected as long as there are no blank glyphs (zero contours (spaces etc)). Sometime when my parser hits a blank glyph it gets out of synch, which of course has devastating effects...&lt;/p&gt;
&lt;p&gt;The files I&amp;#8217;m parsing don&amp;#8217;t have composite glyphs, so I don&amp;#8217;t have to worry about that (contour values = -1).&lt;/p&gt;
&lt;p&gt;I think I&amp;#8217;ve localized the error. If I look at my font in a hex editor I can see that the blank glyphs do not have a full glyph-header (n_contours, x_min, y_min, x_max, y_max). Instead they seem to have an arbitrary (usually 1-3) byte entries which are zero, and then the next glyph on comes right after that.&lt;br /&gt;
For instance, a blank glyph in a hex editor looks like this:&lt;/p&gt;
&lt;p&gt;... 05 e6 fa 1a    |    00    |    00 01 01 AA ...&lt;/p&gt;
&lt;p&gt;The first part is the en parts of the previous glyph. This seems to be correct - I get the right point values and flags for it.&lt;/p&gt;
&lt;p&gt;The middle part is a single 0 entry, and that&amp;#8217;s all I can find from the blank glyph.&lt;/p&gt;
&lt;p&gt;The last part first says 0001 countours, which is correct, and 01AA xMin which is also correct for the following glyph. As you can see, the middle glyph, which is a blank glyph, only has one single entry... no full 5 Short value glyf-header!&lt;/p&gt;
&lt;p&gt;I have no clue why that is! For a while I thought the varying amount of zero entries were some kind of allignment padding in the file, but that doesn&amp;#8217;t seem right...&lt;/p&gt;
&lt;p&gt;I&amp;#8217;m thankful for any help I can get to help me out here!&lt;br /&gt;
Thanks in advance!!&lt;/p&gt;
&lt;p&gt;/Magnus&lt;/p&gt;
</description>
 <comments>http://typophile.com/node/35069#comments</comments>
 <category domain="http://typophile.com/taxonomy/term/6">Build</category>
 <pubDate>Thu, 12 Jul 2007 05:34:29 -0700</pubDate>
 <dc:creator>repstosw</dc:creator>
 <guid isPermaLink="false">35069 at http://typophile.com</guid>
</item>
</channel>
</rss>
