25

I have a problem with WebKit report .mako file. when I use:

<html>
    <head>
        <style type="text/css">${css}</style>  
    </head>
    <body>
        % for o in objects:
            <p style="font-family:'Free 3 of 9';">${o.name}</p>
        % endfor
    </body>
</html>

in .mako file it is working but if I use

<html>
    <head>
        <style type="text/css">${css}</style>   
    </head>
    <body>
        % for o in objects:
            <p class="barcode39">${o.name}</p>
        % endfor
    </body>
</html>

and this class is declared in field "css" of data.xml in report_webkit

.barcode39 {
    font-family: 'Free 3 of 9';
    font-size: 36;
    color: red;
}

font-family: 'Free 3 of 9' does not work. If I use another font-family it is working. What could be the problem?

I have placed font in /usr/share/fonts/truetype and also run fc-cache -fv. Thanks in advance.

Mordecai
  • 1,414
  • 1
  • 7
  • 20
Pooja
  • 575
  • 10
  • 28
  • Did you check in your browser's inspector if the correct css is being applied? The `barcode39` class might be being overridden by something else in the second case since in the first case an inlined style like `style=...` would take priority over other styles. – Ian Wilson Jul 26 '13 at 07:20
  • Hello, Thanks for quick reply but if i am using different fonts in .barcode39 class other than "Free 3 of 9" then it's working for e.g. "Times New Roman". – Pooja Jul 26 '13 at 12:21
  • have you installed that font in your system? – Tintumon M Aug 10 '15 at 05:36
  • @Mdymade Have you solved the problem? – gkiko Nov 05 '15 at 05:46
  • Hello, I am not using it anymore. – Pooja Nov 09 '15 at 10:33

2 Answers2

1

I was facing the same problem and put the font name into single quotes solved my problem. For example:-

style="font-family:'Free 3 of 9';"
Tharindu Lakshan
  • 3,995
  • 6
  • 24
  • 44
0

Try adding a font-face rule to your stylesheet. Something like:

@font-face {
    font-family: 'Free 3 of 9';
    src: url(/usr/share/fonts/truetype/free_3_of_9.woff) format('woff');
}
tshimkus
  • 1,173
  • 2
  • 17
  • 24