Web Hosting Talk







View Full Version : Embed font in RTF? Huh?


Omnibot
09-09-2007, 12:19 AM
According to the RTF specs, it is possible to embed a font in an RTF file:
http://latex2rtf.sourceforge.net/rtfspec_6.html


RTF supports embedded fonts with the \fontemb group located inside a font definition. An embedded font can be specified by a file name, or the actual font data may be located inside the group.


What are they talking about? (i.e., specifying a file name in the file just isn't the same as embedding the font in the file...)

I can't find any actual example of how to use the \fontemb function. :unhappy: Anybody know if it is actually possible to embed a font in an RTF file?

Bangalore Job Mob
09-09-2007, 12:35 AM
If you google it there are some more explicit examples out there. Haven't actually tried it myself.

Font Table

The \ fonttbl control word introduces the font table group. This group
defines the fonts available in the document and has the following syntax:

<fonttbl> '{' \ fonttbl (<fontinfo> | ('{' <fontinfo> '}'))+ '}'

<fontinfo> <fontnum><fontfamily><fcharset><fprq><fontemb>?<codepage>?
<fontname><fontaltname> ';'

<fontnum> \ f

<fontfamily> \ fnil | \ froman | \ fswiss | \ fmodern | \ fscript |
\ fdecor | \ ftech | \ fbidi

<fcharset \ fcharset

<fprq> \ fprq

<fontname> #PCDATA

<fontaltname> '{\*' \falt #PCDATA '}'

<fontemb> '{\ *' \ fontemb <fonttype> <fontfname>? <data>? '}'

<fonttype> \ ftnil | \ fttruetype

<fontfname> '{\ * \ fontfile <codepage>? #PCDATA '}'

<codepage> \ cpg


Note for <fontemb> that either <fontname> or <data> must be present,
although both may be present. All fonts available to the RTF writer
can be included in the font table, even if the document doesn't use all
the fonts.

Omnibot
09-10-2007, 11:35 AM
Thanks. How is the font data actually to be stored in the file? As AFM data? I have downloaded so far nearly 100 random RTF files off google and have never found one example of an embedded font.

Bangalore Job Mob
09-10-2007, 12:44 PM
Well I would imagine TrueType would be the most appropriate and widely supported.

Omnibot
09-11-2007, 02:22 PM
Since RTF is an ascii file, how would a TTF be embedded into it? And I still can't find an example of the actual syntax to do it. No matter how hard I look.

I'm beginning to suspect that no one has ever embedded a font into an RTF file and references to font-embedding are hypothetical and never actually implemented.

Bangalore Job Mob
09-11-2007, 03:49 PM
All files can be represented as ASCII. What particular escape notation the RTF spec wants, I have no idea, but if no reader supports the feature then there probably isn't much point.