The Annoyance Filter.pdf - Fourmilab
The Annoyance Filter.pdf - Fourmilab
The Annoyance Filter.pdf - Fourmilab
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
96 FLASH TEXT EXTRACTOR ANNOYANCE-FILTER §117<br />
117. <strong>The</strong> DefineFont tag actually contains only one thing of interest to us: the number of glyphs in<br />
the font. We save the glyph count in the fontFlyphCount map, tagged by the font ID.<br />
〈 Parse Flash DefineFont tag 117 〉 ≡<br />
{<br />
#ifdef FLASH_PARSE_DEBUG<br />
cout ≪ "DefineFont" ≪ endl ;<br />
#endif<br />
unsigned short fontID = get16 ( );<br />
unsigned int offsetTable = get16 ( );<br />
#ifdef FLASH_PARSE_DEBUG<br />
cout ≪ "␣␣Font␣ID:␣" ≪ fontID ≪ endl ;<br />
cout ≪ "␣␣Glyph␣count:␣" ≪ (offsetTable /2) ≪ endl ;<br />
#endif<br />
fontGlyphCount .insert (make pair (fontID , offsetTable /2));<br />
ignoreTag (2 ∗ 2);<br />
}<br />
This code is used in section 115.<br />
118. <strong>The</strong> DefineFont2 tag adds a font name to the fields in the original DefineFont tag. We consider<br />
this font name as an eligible string if the textOnly constraint isn’t true .<br />
〈 Parse Flash DefineFont2 tag 118 〉 ≡<br />
{<br />
#ifdef FLASH_PARSE_DEBUG<br />
cout ≪ "DefineFont2" ≪ endl ;<br />
#endif<br />
}<br />
unsigned short fontID = get16 ( );<br />
get16 ( ); /∗ Flag bits ∗/ /∗ Parse the font name ∗/<br />
unsigned int fontNameLen = get8 ( );<br />
string fontName ;<br />
getString (fontName , fontNameLen );<br />
if (¬textOnly ) {<br />
strings .push (fontName );<br />
} /∗ Get the number of glyphs. ∗/<br />
unsigned int nGlyphs = get16 ( );<br />
fontGlyphCount .insert (make pair (fontID , nGlyphs ));<br />
ignoreTag (2 + 2 + 1 + fontNameLen + 2);<br />
This code is used in section 115.