HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › HTML/CSS rendering issues › font rendering issue
- This topic has 3 replies, 2 voices, and was last updated Nov 15, 2010
03:54:15 byPD4ML.
-
AuthorPosts
-
July 26, 2010 at 01:12#26422
Helo,
I am using the trial version of PD4ML(PHP wrapper). We are testing it out before purchasing the pro version. I have dumped all the font files that we are using in our report in the “/pd4ml/fonts” folder. I deleted the old “pd4fonts.properties” and the newly generated one looks like this:#this is an autogenerated file. please remove manually any references to copyrighted fonts
#Mon Jul 26 06:03:36 IST 2010
Gotham Bold=Gotham-Bold.ttf
Gotham Bold Italic=Gotham-BoldItalic.ttf
Gotham Book=Gotham-Book.ttf
Gotham Book Italic=Gotham-BookItalic.ttf
KaiTi_GB2312=SIMKAI.TTF
MicrogrammaDBolExt=microgbe.ttf
MicrogrammaDMedExt=microgme.ttf
Myriad Pro=MyriadPro-Regular.otf
Myriad Pro Black=MyriadPro-Black.otf
Myriad Pro Black Italic=MyriadPro-BlackIt.otf
Myriad Pro Bold=MyriadPro-Bold.otf
Myriad Pro Bold Condensed=MyriadPro-BoldCond.otf
Myriad Pro Bold Condensed Italic=MyriadPro-BoldCondIt.otf
Myriad Pro Bold Italic=MyriadPro-BoldIt.otf
Myriad Pro Condensed=MyriadPro-Cond.otf
Myriad Pro Condensed Italic=MyriadPro-CondIt.otf
Myriad Pro Italic=MyriadPro-It.otf
Myriad Pro Light=MyriadPro-Light.otf
Myriad Pro Light Italic=MyriadPro-LightIt.otf
Myriad Pro Semibold=MyriadPro-Semibold.otf
Myriad Web Bold=MYRIADB.TTF
font.dir.location=..\fonts\Note: I had about 25 different fonts in my dir, but only 20 were listed in the properties file (some .otf and .dfont fonts were skipped, not sure why?!)
My test.php using the various font is as below:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <font COLOR="#336da7"> <?php echo date("F j, Y, g:i a"); ?> <p ALIGN="LEFT"> <font face="MicrogrammaDBolExt"> Hello World in MicrogrammaDBolExt!! <br/></font> <font face="MicrogrammaDMedExt"> Hello World in MicrogrammaDMedExt!! <br/></font> <font face="Myriad Pro Semibold"> Hello World in Myriad Pro Semibold!! <br/></font> <font face="Gotham Bold"> Hello World in Gotham Bold!! <br/></font> <font face="Gotham Bold Italic"> Hello World in Gotham Bold Italic!! <br/></font> <font face="Gotham Book"> Hello World in Gotham Book!! <br/></font> <font face="Gotham Book Italic"> Hello World in Gotham Book Italic!! <br/></font> <font face="Myriad Pro"> Hello World in Myriad Pro!! <br/></font> <font face="Myriad Pro Black"> Hello World in Myriad Pro Black!! <br/></font> <font face="Myriad Pro Black Italic"> Hello World in Myriad Pro Black Italic!! <br/></font> <font face="Myriad Pro Bold"> Hello World in Myriad Pro Bold!! <br/></font> <font face="Myriad Pro Bold Condensed"> Hello World in Myriad Pro Bold Condensed!! <br/></font> <font face="Myriad Pro Bold Condensed Italic"> Hello World in Myriad Pro Bold Condensed Italic!! <br/></font> <font face="Myriad Pro Bold Italic"> Hello World in Myriad Pro Bold Italic!! <br/></font> <font face="Myriad Pro Condensed"> Hello World in Myriad Pro Condensed!! <br/></font> <font face="Myriad Pro Condensed Italic"> Hello World in Myriad Pro Condensed Italic!! <br/></font> <font face="Myriad Pro Italic"> Hello World in Myriad Pro Italic!! <br/></font> <font face="Myriad Pro Light"> Hello World in Myriad Pro Light!! <br/></font> <font face="Myriad Pro Light Italic"> Hello World in Myriad Pro Light Italic!! <br/></font> <font face="Myriad Pro Semibold"> Hello World in Myriad Pro Semibold!! <br/></font> <font face="Myriad Web Bold"> Hello World in Myriad Web Bold!! <br/></font> </body> </html>However in the o/p file I can only see the first two fonts being displayed(MicrogrammaDBolExt, MicrogrammaDMedExt). The rest of them (containing spaces in the font names) were ignored. Not sure if I am using the font name right, I am simply pasting the name as available in the properties file. I even tried deleting the last line “font.dir.location=..\fonts\” from the properties file, but no change.
Please advise.
July 26, 2010 at 13:21#28115In HTML you do not need to escape spaces with backslashes. So try to remove all backslashes from face attribute values.
Now:
<font face="Myriad Pro Light">
Should be:
<font face="Myriad Pro Light">July 26, 2010 at 21:34#28116Thanks for your help!
Did that already, din’t help much, some text started appearing in bold, and some in Italic randomly, not the o/p we expected. I put that way with the backslashes deliberately ‘coz I thought the script considered the exact font-name “as is” in the properties file – desperate measure – but din’t work out!
Please if someone can help us with this; we are really looking forward to buying the paid version.
@Guest wrote:
In HTML you do not need to escape spaces with backslashes. So try to remove all backslashes from face attribute values.
Now:
<font face="Myriad Pro Light">
Should be:
<font face="Myriad Pro Light">November 15, 2010 at 03:54#281171. PD4ML supports TTF and OTF fonts. OTFs from Win32 distribution are ok, but there are “third-party” OTFs for some reasons not supported by Java (in the case they are skipped in pd4fonts.properties). Usually it helps to open such OTF file in FontForge application and save as TTF. FontForge is an open source tool for UNIX/Linux platform, which is also available for Win32 as “fontforge-mingw”
2.
<font face="Myriad Pro Light">refers to Myriad Pro Light in pd4fonts.properties.<font face="Myriad Pro Light">refers to Myriad Pro Light Italic,<font face="Myriad Pro Light">refers to Myriad Pro Light Bold. Also<font face="Myriad Pro Light Bold">refers to Myriad Pro Light Bold even if there is no tags around. Probably it can explain some oddities with font styles you faced with. -
AuthorPosts
The forum ‘HTML/CSS rendering issues’ is closed to new topics and replies.
