Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

TorgoX (1933)


"Il est beau comme la retractilité des serres des oiseaux rapaces [...] et surtout, comme la rencontre fortuite sur une table de dissection d'une machine à coudre et d'un parapluie !" -- Lautréamont

Journal of TorgoX (1933)

Monday August 25, 2003
08:02 PM

Stark Raving RTF

[ #14316 ]
Dear Log,

So in writing the RTF book, I had the following section, which I ended up cutting out for reasons of space.

It is customary to declare \f0, then \f1, then \f2, and so on in order, going up by one each time. But there are word processors that don't quite follow that convention. It is typical of RTF that the specification does not actually lay out this convention; in fact, it does not say what an RTF-reading program should do in the case of running into a font table like this:

  {\f4321 Times Roman;}
  {\f-2000 Helvetica;}
  {\f1001 Helvetica;}
  {\f3000 Times Roman;}
  {\f2147483648 Verdana;}
  {\f-2147483648 Symbol;}
  {\f1001 Times Roman;}
  {\f5000 \'a5;}
  {\f5050 ;}

While this font table is actually legal according to the RTF specification, it is very strange, in several respects: it has several codes per font (1001 and -2000 both map to Helvetica), several fonts per code (1001 is defined twice), the numbers out of order, two very large font numbers (2,147,483,648 and -2,147,483,648), a font whose name is an empty string, and a font whose name is just the yen symbol, ¥ (properly escaped as \'a5). Surprisingly, MSWord 2000 and WordPerfect 8 tolerate all these things, but some other word processors are not as forgiving. For example, negative font numbers crash AbiWord 1.0.3. This is a typical example of why you should stick to a "common sense" reading of the specification -- of any technical specification, not just the RTF spec.

And I thought, yeah, okay, but there would never actually be a program that emitted anything but a "common sense" font-table, right? And then, just the other day I got a document whose font-table is this:

{\f7102 \fnil Andale Mono;}
{\f2001 \fnil Arial;}
{\f12077 \fnil Arial Black;}
{\f10973 \fnil Arial MT Black;}
{\f10967 \fnil Arial MT Condensed Light;}
{\f2000 \fnil Arial Narrow;}
{\f11223 \fnil Arial Narrow MT;}
{\f12777 \fnil Avant Garde;}
{\f2035 \fnil Bell MT;}
{\f12760 \fnil Benguiat Frisky;}
{\f12939 \fnil Bernhard Modern;}
{\f10957 \fnil Bodoni MT Ultra Bold;}
{\f13001 \fnil Bookman;}
{\f8188 \fnil Bookshelf Symbol 1;}
{\f4578 \fnil Bookshelf Symbol 2;}
{\f8588 \fnil Bookshelf Symbol 3;}
{\f2003 \fnil Capitals;}
{\f2002 \fnil Charcoal;}
{\f16383 \fnil Chicago;}
{\f4513 \fnil Comic Sans MS;}
{\f12981 \fnil Cooper Black;}
{\f22 \fmodern Courier;}
{\f2005 \fnil Courier New;}
{\f2029 \fnil Desdemona;}
{\f15900 \fnil Dom Casual;}
{\f1171 \fnil Earth;}
{\f2033 \fnil Eurostile;}
{\f2307 \fnil Gadget;}
{\f3 \fswiss Geneva;}
{\f12171 \fnil Georgia;}
{\f15011 \fnil Gill Sans Condensed Bold;}
{\f12762 \fnil Graphite Light;}
{\f12770 \fnil Graphite Light Narrow;}
{\f21 \fswiss Helvetica;}
{\f2039 \fnil Impact;}
{\f10840 \fnil Klang MT;}
{\f8763 \fnil Lucida Casual;}
{\f2019 \fnil Lucida Handwriting;}
{\f9998 \fnil Milestones;}
{\f4 \fmodern Monaco;}
{\f2515 \fnil MT Extra;}
{\f10909 \fnil New Berolina MT;}
{\f13005 \fnil New Century Schoolbook;}
{\f2 \froman New York;}
{\f10897 \fnil Old English Text MT;}
{\f16 \froman Palatino;}
{\f13003 \fnil Phyllis;}
{\f13000 \fnil Poster Bodoni;}
{\f2004 \fnil Sand;}
{\f10890 \fnil Script MT Bold;}
{\f15054 \fnil Signet Roundhand;}
{\f23 \ftech Symbol;}
{\f2006 \fnil Techno;}
{\f1025 \fnil Teletext;}
{\f2305 \fnil Textile;}
{\f20 \froman Times;}
{\f2010 \fnil Times New Roman;}
{\f1109 \fnil Trebuchet MS;}
{\f7203 \fnil Verdana;}
{\f14860 \fnil Vic Sans;}
{\f12022 \fnil Vic Sans Etc;}
{\f14866 \fnil Vic Serif;}
{\f5363 \fnil Vic Serif Etc;}
{\f14213 \fnil Webdings;}
{\f1792 \fnil Wingdings;}
{\f13009 \fnil Zapf Chancery;}
{\f13 \ftech Zapf Dingbats;}}

Yup, nonsequential font-ID numbers, some of them rather large. (Of course the document doesn't actually use any but two of those fonts.)

At least none are negative, and there's no redeclarations.

And speaking of fonts, yes, I too wish to destroy Comic Sans. In my future world, all text is in Hobo or Gang Tattoo Gothic.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Source (Score:3, Interesting)

    by ziggy (25) on 2003.08.26 16:32 (#23515) Journal
    Out of curiosity, what produced this RTF document? Looks like a Mac -- monaco is a dead giveaway. My money is on AppleWorks. :-)
    • Re:Source (Score:3, Interesting)

      I'm actually not sure what produced it -- but I think it was MS Works for MacOS, back when MS's MacOS division was one crazy guy that lived in the plenum under the lobby.