Forum Bugs

Having trouble with font-weight

PrinceXML appears not to be picking up -light and -medium variations on a font. I am including a weight stack, 100 to 900, as a screenshot including the font "Formata" rendered by Prince and Firefox.

Peculiarly, for the first three weights, Prince drops to Times New Roman instead.

In that Firefox rendering, 100-300 are Formata Light, 400 is Formata, 500 is Formata Medium, and 600-900 are Formata Bold.

I tried referring to Formata-Medium as the font family, to no effect - that caused the expected fallback to Times New Roman, as if there was no font by that name (which there is not.) I also tried the CSS labelled weights to no effect, though they do not appear in this stack because I ran out of screen.

Producing code:



    <style type="text/css">

      ts1, ts2, ts3, ts4, ts5, ts6, ts7, ts8, ts9 { display: block; font-family: formata; font-size: 250%; }

      ts1 { font-weight: 100; }
      ts2 { font-weight: 200; }
      ts3 { font-weight: 300; }
      ts4 { font-weight: 400; }
      ts5 { font-weight: 500; }
      ts6 { font-weight: 600; }
      ts7 { font-weight: 700; }
      ts8 { font-weight: 800; }
      ts9 { font-weight: 900; }




    <ts1>100 The quick brown fox</ts1>
    <ts2>200 The quick brown fox</ts2>
    <ts3>300 The quick brown fox</ts3>
    <ts4>400 The quick brown fox</ts4>
    <ts5>500 The quick brown fox</ts5>
    <ts6>600 The quick brown fox</ts6>
    <ts7>700 The quick brown fox</ts7>
    <ts8>800 The quick brown fox</ts8>
    <ts9>900 The quick brown fox</ts9>



I would like to use Formata Medium - Bold is much too heavy in context. Halp?

John Haugeland is

Edited by StoneCypher

Okay, so I discovered how to force-relate hard coded paths to weight face combinations, which will get me through this. For other people who need that:

@font-face { font-family: formata; font-style: normal; font-weight: 500; src: url("C:\\fonts\\Formata-Regular.ttf"); }
@font-face { font-family: formata; font-style: normal; font-weight: 600; src: url("C:\\fonts\\Formata-Medium.ttf"); }
@font-face { font-family: formata; font-style: italic; font-weight: 300; src: url("C:\\fonts\\Formata-Regular.ttf"); }

header      { display: block; background-color: #eeeeff; position: relative; font-family: formata; }
header name { position: absolute; top:0; left:0; font-size: 275%; font-weight: 600; margin: -0.075em 0 0 0; padding: 0; }

Be nice to see this fixed, though.

John Haugeland is

Did "Formata Light" work as a font-family name? And is there a way that we can reproduce this issue without having to pay several hundred euros to buy the font pack? :)
Here's a free font with multiple weights to test out:,600italic,700italic,400,600,700

I'm having issues getting Prince to include the SemiBold weight (600) using a common font face and weight combo:

@import url(",600italic,700italic,400,600,700");

	font-family: 'Open Sans', sans-serif;
	font-weight: normal; /* aka 400 */

Works as expected.

	font-family: 'Open Sans', sans-serif;
	font-weight: 600; /* aka Semi Bold */

Uses Bold face (should be semi-bold).

	font-family: 'Open Sans', sans-serif;
	font-weight: bold; /* aka 700 */

Uses Bold face.

It seems to use Open Sans Bold... even when I don't include the bold face in the @import command!

Adding !important to make sure the font-weight: 600 overrides any previous bold setting didn’t seem to help.

I'm using Acrobat Pro to check which fonts are used where... and SemiBold doesn’t even appear in the used fonts list (it appears to be ignored completely by Prince).

Any ideas?


Using the prince --scanfonts output I was able to get the PDF to look right, but Acrobat Pro still can’t differentiate between the regular and middle weight (e.g. it appears that the regular weight is embedded twice, but clearly one of those is the Semi Bold weight).

Note sure if it's a font thing, and Acrobat thing or both, but it appears to be working.
So I had this problem again, and I went to ask the internet what it thought

And the internet ... sent me back to myself. From eleven years ago?

Anyway, the punchlines are these:

1. Use unix style forward slash URLs at all times
2. Relative URLs should not be dot prefixed
3. Tilde references are unreliable
4. Traversal outside the host directory is inadvisable
5. The thing that keeps punching you in the teeth is trusting the `format(whatever)` thing. Remove it and it'll start working

John Haugeland is