RTF to HTML font size bug with Garamond

WPTools 8 is a complete word processing VCL for Delphi 5 up to Delphi and C++Builder. It integrates powerfull editing features such as footnotes, header and footers, tables and DocX import and export.
Posts: 2
Joined: Wed Sep 02, 2015 5:24 pm

RTF to HTML font size bug with Garamond

Postby jocelynp » Tue May 10, 2016 10:56 pm

Please help.

I am assuming its not isolated to this font and size. Is it a bug or a characteristic of RTF to HTML conversion? I am leaning towards that its a bug.

If you have a TWPRichText component with rtf data, and you type in any string with the font name being Garamond and size 11. Then you convert it to HTML, you will note that all the Garamond size 11 fonts will become Garamond size 12 fonts.

I've tried multiple ways of converting using WPTools. They all have the same result as stated above.

** The simplest is:
/* WPRichText1 contains a rtf text "TEST" that is all GARAMOND font size 11 */
WPRichText1.TextLoadFormat := 'RTF';
WPRichText1.TextSaveFormat := 'RTF';
WPRichText2.TextLoadFormat := 'HTML';
WPRichText2.TextSaveFormat := 'HTML';
WPRichText2.AsString := WPRichText1.AsAnsiString('HTML');
/* At this point, WPRichText2 contains a HTML text "TEST" that is all GARAMOND font size 12 */

*** SAMPLE of what happens in the conversion from RTF to HTML:
*** Below is the original rtf text... below shows fontsize is 11 --> "fs22"
{\rtf1\ansi\deff0\uc1\ansicpg1252\deftab254{\fonttbl{\f0\fnil\fcharset1 Arial;}{\f1\fnil\fcharset1 Garamond;}{\f2\fnil\fcharset2 Wingdings;}{\f3\fnil\fcharset2 Symbol;}}{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green255\blue0;\red0\green255\blue255;\red0\green128\blue128;\red0\green0\blue128;\red255\green255\blue255;\red192\green192\blue192;\red128\green128\blue128;\red0\green0\blue0;}\wpprheadfoot1\paperw12240\paperh15840\margl1880\margr1880\margt1440\margb1440\headery720\footery720\endnhere\sectdefaultcl{\*\generator WPTools_7.000;}{\plain\f1\fs22\cf0 TEST\par
*** Below is the HTML text after converting the RTF above using WPTools... below shows fontsize is 12 --> "font-size:12.00pt" =======================================================================
<div><span style="color:black;font-family:'Garamond';font-size:12.00pt;">TEST</span></div>

Return to “WPTools 7 and 8 (VCL)”

Who is online

Users browsing this forum: No registered users and 1 guest