Forum Bugs

font-weight lighter

jt
Hi,

I think that the "lighter" value for the "font-weight" property does not work properly. I tried to expose it in the example below (the bold fonts receive a "normal" font-weight, and the normal fonts receive a "lighter"). Only the original bold fonts are going to be embedded in the pdf.

<html>
  <head>
    <style type='text/css'>
      @font-face {
        font-family: "Liberation Serif";
        font-style: normal;
        font-weight: normal;
        src: url(http://www.princexml.com/fonts/liberation/LiberationSerif-Bold.ttf);
      }
  
      @font-face {
        font-family: "Liberation Serif";
        font-style: italic;
        font-weight: normal;
        src: url(http://www.princexml.com/fonts/liberation/LiberationSerif-BoldItalic.ttf);
      }
  
      @font-face {
        font-family: "Liberation Serif";
        font-style: italic;
        font-weight: lighter;
        src: url(http://www.princexml.com/fonts/liberation/LiberationSerif-Italic.ttf);
      }
  
      @font-face {
        font-family: "Liberation Serif";
        font-style: normal;
        font-weight: lighter;
        src: url(http://www.princexml.com/fonts/liberation/LiberationSerif-Regular.ttf);
      }
      html {
        font-family: "Liberation Serif";
        font-style: normal;
        font-weight: lighter;
      }
      .normal {
        font-weight: normal;
      }
      .italic {
        font-style: italic;
      }
    </style>
  </head>
  <body>
    <div> Lighter </div>
    <div class='normal'> Normal </div>
    <div class='italic'> Lighter Italic </div>
    <div class='normal italic'> Normal Italic </div>
  </body>
</html>


--
jt
mikeday
The "bolder" and "lighter" font-weight keywords are relative values, that when applied to an element should make the element have a bolder or lighter font weight than its parent element. For this reason I don't think it makes sense to specify them in a @font-face rule, which should instead specify the absolute boldness of the font. The other issue is that currently Prince only supports two levels of boldness: normal and bold, and all the other levels are mapped to one of these. In the future we should support additional levels of boldness, and I have added this issue to the development roadmap.
jt
Yes, I thought I could use the "lighter" value as an absolute boldness parameter. Actually, I want to use fonts that are available in different boldness like black, semi-bold, light and use the font-weight property to choose them. This could be coupled with font-style, font-stretch, ... I understand it is on the roadmap :-)

Thanks.
--
jt
mikeday
We have now released the first beta of Prince 7.0, which includes support for all nine levels of font-weight described in the CSS specifications.