Hello,
We are planning to use Prince in scenarios when we cannot control user input, and we've been testing various fonts related cases. We found a case which we do not know how to make work:
If there is an svg referenced within an html, and let's say Chinese fonts are used within, but the font-family is specified as Arial, the output pdf works differently depending on the system:
- on Windows, no problems, additional fonts are used in pdf and embedded into the pdf,
- on Linux (RedHat 9 specifically), nothing seems to work unless the font-family within the svg is changed to a font-family that includes those Chinese symbols. There are various fonts that support Chinese symbols installed on the system, and we tried specifying them as a font-family for the whole document. Texts outside the svg diagram are converted with correct fonts but they do not affect the svg fonts.
Is there a way to make search for fonts work within svg if their font-family is incorrect on Linux? What is different about the font selection on Windows that it works correctly even though Arial is used within the svg?
It may not be an issue for some other users but our users convert htmls with svg diagrams that have this Arial font specified as default so it is a very real scenario.
I'm attaching a sample input, and output on Linux and Windows. During conversion on Linux, the following is logged:
Arjana
We are planning to use Prince in scenarios when we cannot control user input, and we've been testing various fonts related cases. We found a case which we do not know how to make work:
If there is an svg referenced within an html, and let's say Chinese fonts are used within, but the font-family is specified as Arial, the output pdf works differently depending on the system:
- on Windows, no problems, additional fonts are used in pdf and embedded into the pdf,
- on Linux (RedHat 9 specifically), nothing seems to work unless the font-family within the svg is changed to a font-family that includes those Chinese symbols. There are various fonts that support Chinese symbols installed on the system, and we tried specifying them as a font-family for the whole document. Texts outside the svg diagram are converted with correct fonts but they do not affect the svg fonts.
Is there a way to make search for fonts work within svg if their font-family is incorrect on Linux? What is different about the font selection on Windows that it works correctly even though Arial is used within the svg?
It may not be an issue for some other users but our users convert htmls with svg diagrams that have this Arial font specified as default so it is a very real scenario.
I'm attaching a sample input, and output on Linux and Windows. During conversion on Linux, the following is logged:
prince -v chinese.html -o chinese.pdf
prince: loading document: /opt/Prince/lib/prince/license/license.dat
prince: Loading document...
prince: loading HTML5 input: chinese.html
prince: loading document: chinese.html
prince: Applying style sheets...
prince: Preparing document...
prince: loading image: chinese.svg
prince: loading document: chinese.svg
prince: loading document: /opt/Prince/lib/prince/dtd/svg10/svg10.dtd
prince: Applying style sheets...
prince: loading document: chinese.svg
prince: loading document: chinese.svg
prince: loading document: /opt/Prince/lib/prince/dtd/svg10/svg10.dtd
prince: Applying style sheets...
prince: loading font: /usr/share/fonts/msttcore/arialbd.ttf
prince: used font: Arial, Bold
prince: loading font: /usr/share/fonts/msttcore/arial.ttf
prince: used font: Arial, Regular
prince: loading font: /usr/share/fonts/msttcore/timesbd.ttf
prince: warning: no font for CJK character U+641C, fallback to U+2BD1 ⯑
prince: loading font: /opt/Prince/lib/prince/style/../fonts/prince-fallback.ttf
prince: used font: PrinceFallback, Regular
prince: warning: no font for CJK character U+5C0B, fallback to U+2BD1 ⯑
prince: warning: no font for CJK character U+8A02, fallback to U+2BD1 ⯑
prince: warning: no font for CJK character U+55AE, fallback to U+2BD1 ⯑
prince: warning: no font for CJK character U+5EFA, fallback to U+2BD1 ⯑
prince: warning: no font for CJK character U+7ACB, fallback to U+2BD1 ⯑
prince: warning: no font for CJK character U+4EBA, fallback to U+2BD1 ⯑
prince: Converting document...
prince: loading font: /usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc
prince: used font: Noto Sans CJK SC, Regular
prince: Finished: success
Arjana
Edited by arjana