12.06.2015 Views

The Annoyance Filter.pdf - Fourmilab

The Annoyance Filter.pdf - Fourmilab

The Annoyance Filter.pdf - Fourmilab

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

100 FLASH TEXT EXTRACTOR ANNOYANCE-FILTER §120<br />

string s = "";<br />

for (unsigned int i = 0; i < nGlyphs ; i++) {<br />

unsigned int iIndex = getBits (textGlyphBits );<br />

#ifdef FLASH_PARSE_DEBUG<br />

unsigned int iAdvance = getBits (textAdvanceBits );<br />

#else<br />

#endif<br />

cout ≪ "[" ≪ iIndex ≪ "," ≪ iAdvance ≪ "]␣" ≪ flush ;<br />

getBits (textAdvanceBits ); /∗ Ignore text advance distance ∗/<br />

if (fontId < 0) {<br />

if (verbose ) {<br />

cerr ≪ "Flash␣DefineText␣does␣not␣specify␣font." ≪ endl ;<br />

}<br />

}<br />

else if (fgcp ≠ fontGlyphCount .end ( )) {<br />

if (iIndex ≥ fGlyphs ) {<br />

if (verbose ) {<br />

cerr ≪ "Flash␣DefineText␣glyph␣index␣" ≪ iIndex ≪<br />

"␣exceeds␣font␣size␣of␣" ≪ fGlyphs ≪ "." ≪ endl ;<br />

}<br />

}<br />

else {<br />

if (fFlags & fontWideCodes ) {<br />

unsigned int wc = (∗fontChars )[iIndex ];<br />

s += static cast〈char〉((wc ≫ 8) & # FF);<br />

s += static cast〈char〉(wc & # FF);<br />

}<br />

else {<br />

s += static cast〈char〉((∗fontChars )[iIndex ]);<br />

}<br />

}<br />

}<br />

}<br />

#ifdef FLASH_PARSE_DEBUG<br />

cout ≪ endl ;<br />

cout ≪ "Decoded:␣(" ≪ s ≪ ")" ≪ endl ;<br />

#endif<br />

〈 Decode non-ANSI Flash text 121 〉;<br />

strings .push (s);<br />

}<br />

}<br />

}<br />

This code is used in section 115.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!