Forum How do I...?

local fonts on Windows, opentype

johnfox
Not having success getting PrinceXML to recognize local fonts. Here's my declaration:


@font-face {
font-family: "Univers 47 Condensed Light";
src: local("C:\WINDOWS\Fonts\Univers-CondensedLight.otf");
}

@font-face {
font-family: "Univers 67 Condensed";
src: local("C:\WINDOWS\Fonts\Univers-CondensedBold.otf")
}
@font-face {
font-family: "Univers 57 Condensed";
src: local("C:\WINDOWS\Fonts\Univers-Condensed.otf")
}
mikeday
If these are OpenType fonts with PostScript (Type 1) outlines, Prince doesn't support this format yet. We plan to add support soon. In the meantime, Prince does support OpenType fonts with TrueType outlines.
johnfox
As it turns out, I had 3 mistakes.

1. The slashes were going in the wrong direction.
2. It only works if I use the URL descriptor instead of local
3. My fonts were not Opentype with ttf outlines.

I fixed these 3 things and it's running great.
mikeday
We have now released the first beta for Prince 7.0, which does support OpenType fonts with PostScript/CFF outlines (.otf fonts).
harold1
I am using Prince 7.0 Beta 1 and can't get any local OpenType fonts to work (under Windows XP SP3 32-bit). I don't get any errors in the Output Log panel, but the fonts are not displayed or embedded either.

Truetype fonts work, but I can't get any OTF fonts to work. A sample snippet with the correct CSS would be helpful (all the examples on the site use TTF).
mikeday
If the fonts are installed on the system, then it should just be a matter of referring to them by the correct font-family name (eg. font-family: Arial).

If the font files are there but haven't been installed for applications to use, then you will need to write a @font-face rule like this:
@font-face {
    font-family: MyFont;
    src: url("C:\\Path\\To\\Font.otf")
}

then use font-family: MyFont to apply it.
harold1
This is exactly how I went about it. There seem to be 2 issues with the downloadable Prince 7 beta version:

mikeday wrote:
If the fonts are installed on the system, then it should just be a matter of referring to them by the correct font-family name (eg. font-family: Arial).


This works but ONLY for TrueType fonts. Most of my fonts are otf (OpenType with PostScript outlines). Are these supposed to work in Beta 1?

mikeday wrote:
If the font files are there but haven't been installed for applications to use, then you will need to write a @font-face rule like this:
@font-face {
    font-family: MyFont;
    src: url("C:\\Path\\To\\Font.otf")
}

then use font-family: MyFont to apply it.


This doesn't work at all (for either ttf or otf fonts). The font-face definitions are silently ignored, and the font is not embedded nor rendered.
oliof
Works for me under Mac and Linux. Can you post your CSS code? Maybe it's a simple syntax error.
harold1
Thanks Oliof and Mike, indeed this was caused by a syntax error. My @font-face definition was nested in the @page definition. Moving it to the top level fixed all issues.