Forum How do I...?

Bold font is getting bolded

dpirkle
We are using a custom font with Prince 10, and have run into a problem where the bold font is having additional bolding applied in the PDF. If, as a workaround, I specify a different font family for the bold font, and use that without any font-weight, then I get the desired rendering. Trying to use it as the bold version of the same font-family as the other fonts results in extra bolding of the bold font. I must not be setting this up correctly, but I've run out of ideas on what to do, other than the workaround I mentioned, so I'm hoping to get a pointer here.

Here's how the fonts are set up:

@font-face {
  font-family: Invitae;
  font-style: normal;
  font-weight: normal;
  src: url('./fonts/Invitae-Regular.ttf');
}

@font-face {
  font-family: Invitae;
  font-style: normal;
  font-weight: bold;
  src: url('./fonts/Invitae-Bold.ttf');
}

@font-face {
  font-family: Invitae;
  font-style: italic;
  font-weight: normal;
  src: url('./fonts/Invitae-Italic.ttf');
}

@font-face {
  font-family: Invitae;
  font-style: italic;
  font-weight: bold;
  src: url('./fonts/Invitae-Bold-Italic.ttf');
}


Then text styled with
font-family: 'Invitae';
font-weight: bold;

uses the bold font but applies extra bolding to it in the PDF.

If I change the bold font import to:
@font-face {
  font-family: InvitaeBold;
  font-style: normal;
  font-weight: normal;
  src: url('./fonts/Invitae-Bold.ttf');
}

and use it specifying font-family: 'InvitaeBold', with no font-weight, then the bold font renders without any additional bolding applied to it.

Any pointers on how to set this up?
mikeday
I suspect the font is incorrectly mislabelled as not being bold in its internal metadata, so Prince is trying to be helpful. Until we can adjust @font-face rules to handle this situation I think the easiest solution is just to run Prince with the --no-artificial-fonts option, which disables fake bold and italic.
dpirkle
Thanks for the suggestion: that removed the extra bolding. Fyi, I am attaching the font file in case you want to dig into what's going on. I know that if I open it on my mac, with Font Book, it displays Bold at the top, which perhaps means that it sees it as being a bold font.
  1. Invitae-Bold.ttf57.0 kB
mikeday
Thanks, we have now fixed this issue in latest builds so that a @font-face rule with font-weight: bold or font-style: italic will now not be artificially emboldened or slanted, as appropriate.