Hi All
Running prince 7 on RHEL 5.
I've installed a new font via:
yum install fonts-japanese
and I see the corresponding directory /usr/share/fonts/japanese
I added entries to the prince fonts.css file for the corresponding Sazanami Mincho font.
However, it doesn't seem like prince is finding the font.
When I run prince in debug mode, it does not list Sazanami Mincho among the fonts.
I tried running fc-cache.
What am I missing?
Thanks!
If you run "fc-list", is the font listed with that name?
Yes;
# fc-list | grep Sazanami
Sazanami Mincho,さざなみ明朝:style=Mincho-Regular,Regular
Sazanami Gothic,さざなみゴシック:style=Gothic-Regular,Regular
Are you running Prince 7.0 or 7.1? There was a Red Hat Fontconfig issue that we fixed in 7.1.
# prince --version
Prince 7.1
Can you post the debug output you get when running "prince --debug" with this document:
<html>
<body>
<p style="font-family: Sazanami Mincho">Hello, world! さざなみ明朝</p>
</body>
</html>
Well, with the direct specification of font-family, it appears to show up in the debug output (but still doesn't find glyphs); however, I've never had to do this before - and I've added several other fonts.
Your example, with the direct font-family specification, produces:
prince: debug: loading license: /usr/lib/prince/license/license.dat
prince: loading style sheet: /usr/lib/prince/style/fonts.css
prince: debug: loaded resource: /usr/lib/prince/style/fonts.css
prince: debug: loaded resource: type: no
prince: Loading document...
prince: loading HTML input: /tmp/test.html
prince: debug: loaded document: /tmp/test.html
prince: debug: sniffed doctype: XHTML (no namespace)
prince: loading style sheet: /usr/lib/prince/style/xhtml.css
prince: debug: loaded resource: /usr/lib/prince/style/xhtml.css
prince: debug: loaded resource: type: no
prince: loading style sheet: /usr/lib/prince/style/common.css
prince: debug: loaded resource: /usr/lib/prince/style/common.css
prince: debug: loaded resource: type: no
prince: loading style sheet: /usr/lib/prince/style/hyph.css
prince: debug: loaded resource: /usr/lib/prince/style/hyph.css
prince: debug: loaded resource: type: no
prince: loading style sheet: /usr/lib/prince/style/xlink.css
prince: debug: loaded resource: /usr/lib/prince/style/xlink.css
prince: debug: loaded resource: type: no
prince: loading style sheet: /usr/lib/prince/style/mathml.css
prince: debug: loaded resource: /usr/lib/prince/style/mathml.css
prince: debug: loaded resource: type: no
prince: loading style sheet: /usr/lib/prince/style/svg.css
prince: debug: loaded resource: /usr/lib/prince/style/svg.css
prince: debug: loaded resource: type: no
prince: debug: prepack
prince: Converting document...
prince: debug: pack
prince: debug: font request: Sazanami Mincho
prince: debug: font scan: Sazanami Mincho
prince: debug: font scan: Sazanami Mincho, 2 matches
prince: debug: font scan: Times New Roman
prince: debug: font scan: Times New Roman, 4 matches
prince: debug: font scan: DejaVu Serif
prince: debug: font scan: DejaVu Serif, 0 matches
prince: debug: font scan: OpenSymbol
prince: debug: font scan: OpenSymbol, 0 matches
prince: debug: font scan: DejaVu LGC Serif
prince: debug: font scan: DejaVu LGC Serif, 4 matches
prince: debug: font scan: FreeSerif
prince: debug: font scan: FreeSerif, 4 matches
prince: debug: font scan: AR PL ShanHeiSun Uni
prince: debug: font scan: AR PL ShanHeiSun Uni, 2 matches
prince: debug: font scan: AR PL KaitiM Big5
prince: debug: font scan: AR PL KaitiM Big5, 1 matches
prince: debug: font scan: Baekmuk Batang
prince: debug: font scan: Baekmuk Batang, 1 matches
prince: debug: font scan: Baekmuk Dotum
prince: debug: font scan: Baekmuk Dotum, 1 matches
prince: debug: font scan: Baekmuk Gulim
prince: debug: font scan: Baekmuk Gulim, 1 matches
prince: debug: font scan: Baekmuk Headline
prince: debug: font scan: Baekmuk Headline, 1 matches
prince: debug: font scan: Lohit Hindi
prince: debug: font scan: Lohit Hindi, 0 matches
prince: debug: font scan: Ani
prince: debug: font scan: Ani, 0 matches
prince: debug: font scan: Mukti Narrow
prince: debug: font scan: Mukti Narrow, 0 matches
prince: debug: font scan: Lohit Punjabi
prince: debug: font scan: Lohit Punjabi, 0 matches
prince: debug: font scan: Lohit Gujarati
prince: debug: font scan: Lohit Gujarati, 0 matches
prince: debug: font scan: Lohit Tamil
prince: debug: font scan: Lohit Tamil, 0 matches
prince: debug: font scan: Lohit Telugu
prince: debug: font scan: Lohit Telugu, 0 matches
prince: debug: font scan: Lohit Kannada
prince: debug: font scan: Lohit Kannada, 0 matches
prince: debug: font scan: MalOtf
prince: debug: font scan: MalOtf, 0 matches
prince: debug: font scan: Lohit Oriya
prince: debug: font scan: Lohit Oriya, 0 matches
prince: used font: Sazanami Mincho, Mincho-Regular
prince: warning: no glyphs for character U+0081, fallback to '?'
prince: debug: no glyphs for character U+0095, fallback to U+2022
prince: debug: no glyphs for character U+0096, fallback to U+2013
prince: debug: no glyphs for character U+0098, fallback to U+02DC
prince: debug: no glyphs for character U+008E, fallback to U+017D
prince: debug: no glyphs for character U+009C, fallback to U+0153
prince: warning: no glyphs for character U+009D, fallback to '?'
prince: debug: writing output: /tmp/test.pdf
prince: Finished: success
Without it:
prince: debug: loading license: /usr/lib/prince/license/license.dat
prince: loading style sheet: /usr/lib/prince/style/fonts.css
prince: debug: loaded resource: /usr/lib/prince/style/fonts.css
prince: debug: loaded resource: type: no
prince: Loading document...
prince: loading HTML input: /tmp/test.html
prince: debug: loaded document: /tmp/test.html
prince: debug: sniffed doctype: XHTML (no namespace)
prince: loading style sheet: /usr/lib/prince/style/xhtml.css
prince: debug: loaded resource: /usr/lib/prince/style/xhtml.css
prince: debug: loaded resource: type: no
prince: loading style sheet: /usr/lib/prince/style/common.css
prince: debug: loaded resource: /usr/lib/prince/style/common.css
prince: debug: loaded resource: type: no
prince: loading style sheet: /usr/lib/prince/style/hyph.css
prince: debug: loaded resource: /usr/lib/prince/style/hyph.css
prince: debug: loaded resource: type: no
prince: loading style sheet: /usr/lib/prince/style/xlink.css
prince: debug: loaded resource: /usr/lib/prince/style/xlink.css
prince: debug: loaded resource: type: no
prince: loading style sheet: /usr/lib/prince/style/mathml.css
prince: debug: loaded resource: /usr/lib/prince/style/mathml.css
prince: debug: loaded resource: type: no
prince: loading style sheet: /usr/lib/prince/style/svg.css
prince: debug: loaded resource: /usr/lib/prince/style/svg.css
prince: debug: loaded resource: type: no
prince: debug: prepack
prince: Converting document...
prince: debug: pack
prince: debug: font request: serif
prince: debug: font scan: Times New Roman
prince: debug: font scan: Times New Roman, 4 matches
prince: debug: font scan: DejaVu Serif
prince: debug: font scan: DejaVu Serif, 0 matches
prince: debug: font scan: OpenSymbol
prince: debug: font scan: OpenSymbol, 0 matches
prince: debug: font scan: DejaVu LGC Serif
prince: debug: font scan: DejaVu LGC Serif, 4 matches
prince: debug: font scan: FreeSerif
prince: debug: font scan: FreeSerif, 4 matches
prince: debug: font scan: AR PL ShanHeiSun Uni
prince: debug: font scan: AR PL ShanHeiSun Uni, 2 matches
prince: debug: font scan: AR PL KaitiM Big5
prince: debug: font scan: AR PL KaitiM Big5, 1 matches
prince: debug: font scan: Baekmuk Batang
prince: debug: font scan: Baekmuk Batang, 1 matches
prince: debug: font scan: Baekmuk Dotum
prince: debug: font scan: Baekmuk Dotum, 1 matches
prince: debug: font scan: Baekmuk Gulim
prince: debug: font scan: Baekmuk Gulim, 1 matches
prince: debug: font scan: Baekmuk Headline
prince: debug: font scan: Baekmuk Headline, 1 matches
prince: debug: font scan: Lohit Hindi
prince: debug: font scan: Lohit Hindi, 0 matches
prince: debug: font scan: Ani
prince: debug: font scan: Ani, 0 matches
prince: debug: font scan: Mukti Narrow
prince: debug: font scan: Mukti Narrow, 0 matches
prince: debug: font scan: Lohit Punjabi
prince: debug: font scan: Lohit Punjabi, 0 matches
prince: debug: font scan: Lohit Gujarati
prince: debug: font scan: Lohit Gujarati, 0 matches
prince: debug: font scan: Lohit Tamil
prince: debug: font scan: Lohit Tamil, 0 matches
prince: debug: font scan: Lohit Telugu
prince: debug: font scan: Lohit Telugu, 0 matches
prince: debug: font scan: Lohit Kannada
prince: debug: font scan: Lohit Kannada, 0 matches
prince: debug: font scan: MalOtf
prince: debug: font scan: MalOtf, 0 matches
prince: debug: font scan: Lohit Oriya
prince: debug: font scan: Lohit Oriya, 0 matches
prince: used font: Times New Roman, Regular
prince: warning: no glyphs for character U+0081, fallback to '?'
prince: debug: no glyphs for character U+0095, fallback to U+2022
prince: debug: no glyphs for character U+0096, fallback to U+2013
prince: debug: no glyphs for character U+0098, fallback to U+02DC
prince: debug: no glyphs for character U+008E, fallback to U+017D
prince: used font: DejaVu LGC Serif, Book
prince: debug: no glyphs for character U+009C, fallback to U+0153
prince: warning: no glyphs for character U+009D, fallback to '?'
prince: debug: writing output: /tmp/test.pdf
prince: Finished: success
Can you add <?xml version="1.0"?> at the start of the document, or <meta http-equiv="content-type" content="text/html;charset=utf-8"/> in the head, to ensure that the document is being decoded as UTF-8?
Specifying the charset helps; now I get this (though I still have to specify the font directly):
prince: debug: loading license: /usr/lib/prince/license/license.dat
prince: loading style sheet: /usr/lib/prince/style/fonts.css
prince: debug: loaded resource: /usr/lib/prince/style/fonts.css
prince: debug: loaded resource: type: no
prince: Loading document...
prince: loading HTML input: /tmp/test.html
prince: debug: loaded document: /tmp/test.html
prince: debug: sniffed doctype: XHTML (no namespace)
prince: loading style sheet: /usr/lib/prince/style/xhtml.css
prince: debug: loaded resource: /usr/lib/prince/style/xhtml.css
prince: debug: loaded resource: type: no
prince: loading style sheet: /usr/lib/prince/style/common.css
prince: debug: loaded resource: /usr/lib/prince/style/common.css
prince: debug: loaded resource: type: no
prince: loading style sheet: /usr/lib/prince/style/hyph.css
prince: debug: loaded resource: /usr/lib/prince/style/hyph.css
prince: debug: loaded resource: type: no
prince: loading style sheet: /usr/lib/prince/style/xlink.css
prince: debug: loaded resource: /usr/lib/prince/style/xlink.css
prince: debug: loaded resource: type: no
prince: loading style sheet: /usr/lib/prince/style/mathml.css
prince: debug: loaded resource: /usr/lib/prince/style/mathml.css
prince: debug: loaded resource: type: no
prince: loading style sheet: /usr/lib/prince/style/svg.css
prince: debug: loaded resource: /usr/lib/prince/style/svg.css
prince: debug: loaded resource: type: no
prince: debug: prepack
prince: Converting document...
prince: debug: pack
prince: debug: font request: Sazanami Mincho
prince: debug: font scan: Sazanami Mincho
prince: debug: font scan: Sazanami Mincho, 2 matches
prince: debug: font scan: Times New Roman
prince: debug: font scan: Times New Roman, 4 matches
prince: debug: font scan: DejaVu Serif
prince: debug: font scan: DejaVu Serif, 0 matches
prince: debug: font scan: OpenSymbol
prince: debug: font scan: OpenSymbol, 0 matches
prince: debug: font scan: DejaVu LGC Serif
prince: debug: font scan: DejaVu LGC Serif, 4 matches
prince: debug: font scan: FreeSerif
prince: debug: font scan: FreeSerif, 4 matches
prince: debug: font scan: AR PL ShanHeiSun Uni
prince: debug: font scan: AR PL ShanHeiSun Uni, 2 matches
prince: debug: font scan: AR PL KaitiM Big5
prince: debug: font scan: AR PL KaitiM Big5, 1 matches
prince: debug: font scan: Baekmuk Batang
prince: debug: font scan: Baekmuk Batang, 1 matches
prince: debug: font scan: Baekmuk Dotum
prince: debug: font scan: Baekmuk Dotum, 1 matches
prince: debug: font scan: Baekmuk Gulim
prince: debug: font scan: Baekmuk Gulim, 1 matches
prince: debug: font scan: Baekmuk Headline
prince: debug: font scan: Baekmuk Headline, 1 matches
prince: debug: font scan: Lohit Hindi
prince: debug: font scan: Lohit Hindi, 0 matches
prince: debug: font scan: Ani
prince: debug: font scan: Ani, 0 matches
prince: debug: font scan: Mukti Narrow
prince: debug: font scan: Mukti Narrow, 0 matches
prince: debug: font scan: Lohit Punjabi
prince: debug: font scan: Lohit Punjabi, 0 matches
prince: debug: font scan: Lohit Gujarati
prince: debug: font scan: Lohit Gujarati, 0 matches
prince: debug: font scan: Lohit Tamil
prince: debug: font scan: Lohit Tamil, 0 matches
prince: debug: font scan: Lohit Telugu
prince: debug: font scan: Lohit Telugu, 0 matches
prince: debug: font scan: Lohit Kannada
prince: debug: font scan: Lohit Kannada, 0 matches
prince: debug: font scan: MalOtf
prince: debug: font scan: MalOtf, 0 matches
prince: debug: font scan: Lohit Oriya
prince: debug: font scan: Lohit Oriya, 0 matches
prince: used font: Sazanami Mincho, Mincho-Regular
prince: debug: writing output: /tmp/test.pdf
prince: Finished: success
However, as I mentioned, this requires that the font-family be specified directly; if I don't, it doesn't seem to find the font at all, much less use it.
As I don't have direct control over the html that is being generated, this is not an optimal solution; why are other fonts picked up but not this one?
Thanks!
How are you adding it to the fonts.css file? Something like this:
@font-face {
font-family: serif;
src: local("Sazanami Mincho")
}
Wow, I'm an idiot.
I had that entry in the fonts.css file, except that I had left out the "src: " part.
@font-face {
font-family: serif;
local("Sazanami Mincho")
}
Don't know how I missed that. Obviously, once I added back in "src: ", it worked. Thanks for setting me straight!