Forum How do I...?

Simplified Chinese Font

mynhardt
I registered the following true type font wts55.ttf on the windows platform.
It registers correctly but when viewing prince's debug statements
it seems that it's not picking up the registered font.

What could be the cause of this. Am I correct in thinking that prince
uses the operating system to get to the global fonts directory in this case
windows, windows/fonts/

I have used the following font file with success ukai.ttf but
when embedding the file the document size is too big. That's
why I'm trying to use the simplified font for chinese which
is a smaller file.

Any help would be appreciated
mikeday
Prince queries the operating system to determine the available system fonts, so it should pick up a new font that you've installed. I'll run some tests here with the wts55 font.

Regarding the size issue, we are planning to add support for font subsetting to a future version of Prince, in which only the glyphs that you actually use will be embedded in the final PDF file. This should greatly reduce the size of PDF files that use Chinese fonts. In the meantime, you may be able to use an external tool to optimise your PDF files, for example I think that the professional version of Acrobat can do this.
mikeday
I was unable to install the wts55.ttf font on Windows XP, which did not recognise it as a valid TrueType font file, no idea why. However, I was able to use the font with Prince by referencing the file explicitly using an @font-face rule, as demonstrated here.

It seems that there is something unusual about this font that is causing Windows to treat it differently from other fonts, which must be why Prince is not picking it up when it queries Windows for the set of installed fonts.

By the way, the font also seems to be missing some common characters, so perhaps it is not the best font to use. Have you tried the Arphic fonts?
mynhardt
Hey

No I haven't tried Arphic fonts yet but having a look at it now. Hopefully it's
what I'm looking for.

Thanx for your help
It's appreciated
mynhardt
I downloaded the file gkai00mp.ttf from the following URL
http://cg.scs.carleton.ca/~luc/china.html and then clicking on
Arphic Technology.

I have the following question, when I'm using this file
for simplified chinese prince is telling me it couldn't find
the glyph in the font table for example U+516C.

But when using the character map utility on windows
I can find the glyph associated to that position in the table.

I have limited experience with fonts so this is more for clarification
if I understand this correctly and why I can find the glyph but
prince can not.
If possible do you know of any font files I can download to
support simplified chinese?

Any help will be appreciated
mikeday
That font should work fine with Prince, and it does contain a glyph for character U+516C, so if you get a message saying it doesn't then Prince must not be finding the font. When I reference the font explicitly using an @font-face rule Prince load the font without any problems:
@font-face {
    font-family: zh;
    src: url("gkai00mp.ttf")
}

body { font-family: zh }

On Linux I can also install the font and refer to it by name without any problems:
body { font-family: AR PL KaitiM GB }

However, when I install the font on Windows XP it does not seem to be visible to Prince, and running with the --debug command line option does not show the font in the list of detected fonts. I'll try and find out what is causing this. In the meantime, you can use an @font-face rule to workaround the problem by explicitly specifying the font filename.
mikeday
There appears to be a limitation in the Prince font scanning code on Windows which causes Prince to overlook some non-Latin fonts, including the Arphic fonts. We will be able to fix this limitation in the next release of Prince.
mikeday
For the record, this bug should be fixed in Prince 6.0.
mikeday
We have added support for TrueType font subsetting to Prince 6.0 rev 4, which should greatly reduce the size of generated PDF files that use embedded Chinese fonts.