Forum How do I...?

HTML with Times New Roman Chinese chars -> PDF problem

Limak74
Hi All
I have the following problem:
<html>
<head>
<title> External Payment Report </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="author" content="Unknown"/>
<meta name="subject" content="Jul - Sep, 2012 "/>
<meta name="keywords" content="Payment "/>
<meta name="date" content="2013-01-28 09:09:18"/>
<meta name="generator" content=""/>

<STYLE TYPE = "text/css">
<!--
.boxtitle {  font-size: 15px; font-weight: bold; color: #FFFFFF; background-color: #718796}
.boxfield {  font-family: "Times New Roman"; font-weight: bold; color: #000000; background-color: #DDDDCC; clip:   rect(   ); width: 20%}
.boxvalue  {  font-family: "Times New Roman"; color: #000000; background-color: #EEEEDD;font-size:12px}
.boxvalue1 {  font-family: "Times New Roman"; color: #000000; background-color: #99CCFF;  font-size:12px }
.boxvalue2 {  font-family: "Times New Roman"; color: #000000; background-color: #FFFFCC;  font-size:12px }
.boxvalue3 {  font-family: "Times New Roman"; color: #000000; background-color: #e0c0c0;  font-size:12px }
-->
</STYLE>
</head>

<body bgcolor="#FFFFFF" text="#000000">
...
<table>
<tr>
<td class="boxvalue" width="265">KGI - 年度前景及建议 (The Annual Outlook and Recommendations )&nbsp;&nbsp;(CSAORC)</td>
</tr></table>
</body>
</html>


I have installed the msttcorefonts package
I was trying to give explicit path to font
by adding
@font-face {
    font-family: "Times New Roman";
    font-style: normal;
    font-weight: normal;
    src: url("/usr/share/fonts/msttcorefonts/times.ttf")
}

@font-face {
    font-family: "Times New Roman";
    font-style: normal;
    font-weight: bold;
    src: url("/usr/share/fonts/msttcorefonts/timesbd.ttf")
}
....


still w/o success :( The HTML on the screen is perfect
but PDF output is not
Replace all Chinese chars with "?"

What I do wrong?
in addition I have checked /usr/share/fonts/msttcorefonts/fonts.dir
not sure if it's a problem but I don't see UTF8
times.ttf -monotype-times new roman-medium-r-normal--0-0-0-0-p-0-ascii-0
times.ttf -monotype-times new roman-medium-r-normal--0-0-0-0-p-0-iso10646-1
times.ttf -monotype-times new roman-medium-r-normal--0-0-0-0-p-0-iso8859-10
times.ttf -monotype-times new roman-medium-r-normal--0-0-0-0-p-0-iso8859-13
times.ttf -monotype-times new roman-medium-r-normal--0-0-0-0-p-0-iso8859-15
times.ttf -monotype-times new roman-medium-r-normal--0-0-0-0-p-0-iso8859-1
times.ttf -monotype-times new roman-medium-r-normal--0-0-0-0-p-0-iso8859-2
times.ttf -monotype-times new roman-medium-r-normal--0-0-0-0-p-0-iso8859-3
times.ttf -monotype-times new roman-medium-r-normal--0-0-0-0-p-0-iso8859-4
times.ttf -monotype-times new roman-medium-r-normal--0-0-0-0-p-0-iso8859-5
times.ttf -monotype-times new roman-medium-r-normal--0-0-0-0-p-0-iso8859-6
times.ttf -monotype-times new roman-medium-r-normal--0-0-0-0-p-0-iso8859-7
times.ttf -monotype-times new roman-medium-r-normal--0-0-0-0-p-0-iso8859-8
times.ttf -monotype-times new roman-medium-r-normal--0-0-0-0-p-0-iso8859-9
times.ttf -monotype-times new roman-medium-r-normal--0-0-0-0-p-0-koi8-r
times.ttf -monotype-times new roman-medium-r-normal--0-0-0-0-p-0-koi8-ru


When doing it from command line I have the following errors:
prince: TW-CS_FY2012-Q4.html:245: error: htmlParseEntityRef: no name
prince: TW-CS_FY2012-Q4.html:406: error: htmlParseEntityRef: no name
prince: TW-CS_FY2012-Q4.html:555: error: htmlParseEntityRef: no name
prince: TW-CS_FY2012-Q4.html:704: error: htmlParseEntityRef: no name
prince: TW-CS_FY2012-Q4.html:1809: error: htmlParseEntityRef: no name
prince: TW-CS_FY2012-Q4.html:2565: error: htmlParseEntityRef: no name
prince: warning: no glyphs for character U+5E74, fallback to '?'
prince: warning: no glyphs for character U+5EA6, fallback to '?'
prince: warning: no glyphs for character U+524D, fallback to '?'
prince: warning: no glyphs for character U+666F, fallback to '?'
prince: warning: no glyphs for character U+53CA, fallback to '?'
prince: warning: no glyphs for character U+5EFA, fallback to '?'
prince: warning: no glyphs for character U+8BAE, fallback to '?'


Can someone tell me what I do wrong?
Best Regards
Kamil
mikeday
Times New Roman does not support Chinese, so you will need to install some Chinese fonts. The Arphic fonts are good, and are available as packages for most Linux distributions.
Limak74
mikeday wrote:
Times New Roman does not support Chinese, ...

Sorry I'm a little confused as HTML on the screen looks good with Times New Roman font so how could be that it's not supported?
Is it any difference between Windows fonts and those msttcorefonts ?
On the main page of PrinceXML is written that it supports many lang
I thought the hint given in documentation to install msttcorefonts is enough
Could someone provide me a step by step solution for that case?

Thx in advance
Kamil
mikeday
When you specify "font-family: Times New Roman" you are really specifying "font-family: Times New Roman, serif" so Prince and the browser will first check Times New Roman, and then fallback to the default serif font for characters that Times New Roman does not support.

Since Times New Roman does not support Chinese, the glyphs for these characters are actually coming from other fonts. On Linux, Prince will search for the Arphic fonts, "AR PL UMing CN" and "AR PL SungtiL GB" and use these for Chinese characters.

If you are running Red Hat Enterprise Linux 6 (RHEL6) then you can get these fonts by installing the cjkuni-uming-fonts package.

If you have different Chinese fonts installed, you can edit the definition of serif found in fonts.css (usually found in /usr/lib/prince/style) to specify your preferred fonts instead. Font files are generally found in /usr/share/fonts.