Page 1 of 1

RTF - Error reading font table

Posted: Mon May 26, 2014 9:50 am
by x_ginger
Hi Sergey
We've got an RTF file with some fonts. There is a mistake in the font table.

This is what the file contains:
{\rtf1\ansi\version3110450
{\fonttbl{\f46\fswiss\fcharset204 Calibri;}{\froman \fcharset204 Times New Roman;}}{\colortbl;\red0\green0\blue255;\red0\green0\blue128;\red128\green0\blue0;\red0\green128\blue0;\red192\green192\blue192;\red118\green237\blue129;\red0\green0\blue0;}

\pard\fi0\li0\qc\ri0\sb0\sa0\itap0 \plain \f2 \b\lang1049\fs24 \'c4\'ee\'e2\'b3\'e4\'ea\'e0
\par \pard\fi0\li0\qc\ri0\sb0\sa0\itap0 \plain \f2 \lang1049\fs24 \'ef\'f0\'ee \'e4\'ee\'f1\'f2\'e0\'e2\'ea\'f3 SMS
\par \pard\sl-450\slmult0\fi570\li0\ql\ri0\sb0\sa0\itap0 \plain \f2 \lang1049\fs24 \tab \plain \f3 \i\lang1049\fs20 \'e4\'ee\'e2\'b3\'e4\'ea\'e0 \'f1\'f4\'ee\'f0\'ec\'ee\'e2\'e0\'ed\'e0 \'e2 \'e5\'eb\'e5\'ea\'f2\'f0\'ee\'ed\'ed\'ee\'ec\'f3 \'e2\'e8\'e3\'eb\'ff\'e4\'b3.
\par \pard\fi0\li0\ql\ri0\sb0\sa0\itap0 \plain \f2 \lang1049\fs28 \par}

As you can see the second font in the font table doesn't have a property \f
{\f46\fswiss\fcharset204 Calibri;}
{\froman \fcharset204 Times New Roman;}
Is it possible to add to the font table both fonts? Now your editor adds just one font with the name 'CalibriTimes New Roman'. MS Word uses the second font for all document.
Yes, we can change templates. But users can save their own templates with the same errors. So would you please to help us?

Posted: Tue May 27, 2014 10:10 am
by Sergey Tkachenko
Sorry, erroneous files may lead to erroneous results (according to the RTF specification, \f cannot be omitted)
Handling this bug would require rewriting reading RTF font table completely