Forum Bugs

font-face problem with Adobe Source Code Pro font

mn4367
I've created new font-face definitions for monospace which should use the free Adobe Source Code Pro font.

If I now use <strong><code> Prince seems to choose the correct font, but it is rendered twice with a tiny horizontal offset. I'm not sure if this is really a bug or if I'm doing something wrong, please take a look at the screenshot and the HTML sample.

Thanks,
Michael
  1. SourceCodePro.zip217.4 kB
  2. Test.html1.4 kB
  3. Test.pdf177.1 kB
  4. screenshot.png31.5 kB
skycaptain
I haven't checked all through but using --no-artificial-fonts seems to work.

Edit: You are using a medium weight font for bold text. This may - and this is just my guess - confuse prince. In your case you are telling prince in the font-face-declaration that the file should be 700 weight but the otf-file tells prince, that it's actually 500 weight. Thats why prince creates an artificial font for the bold text. In order to fix that you have to define the font-weights properly:

@font-face {
    font-family: "Source Code Pro";
    font-style: normal;
    font-weight: 500;
    src: url("SourceCodePro-Medium.ttf");
}
@font-face {
    font-family: "Source Code Pro";
    font-style: italic;
    font-weight: 500;
    src: url("SourceCodePro-MediumIt.otf");
}
code {
    font-family: "Source Code Pro";
}
strong {
    font-weight: 500;
}

Edited by skycaptain

mn4367
OK, with font-weight: 500 it works, thank you!