Odoo Help


font mapping for reportlab?

on 2/28/14, 1:42 AM 1,467 views

I have not fonts : Helvetica Courier Times (-Roman) on my system with Fedora fc20 (fc14,15,16 ...)

I see font mapping in /report/render/rml2pdf/customfonts.py

    for family, font, filename, mode in CustomTTFonts:
    if os.path.isabs(filename) and os.path.exists(filename):
        rmldoc.setTTFontMapping(family, font, filename, mode)
        print "'", family,"', '", font,"', '", filename,"', '", mode, "'"     # my work
   print rmldoc.getAvailableFonts()                                           # my work

Bath this not work for windows fonts in Linux, and I see squares against cyrillic symbols in many reports.

I add mapping

    rmldoc.setTTFontMapping("Helvetica", "Helvetica", "/usr/share/fonts/dejavu/DejaVuSerifCondensed.ttf", "Book")
    rmldoc.setTTFontMapping("Helvetica", "Helvetica-Italic", "/usr/share/fonts/dejavu/DejaVuSerifCondensed-Italic.ttf", "Italic")
    rmldoc.setTTFontMapping("Helvetica", "Helvetica-Bold", "/usr/share/fonts/dejavu/DejaVuSerifCondensed-Bold.ttf", "Bold")
    rmldoc.setTTFontMapping("Helvetica", "Helvetica-BoldItalic", "/usr/share/fonts/dejavu/DejaVuSerifCondensed-BoldItalic.ttf", "Bold Italic")
    rmldoc.setTTFontMapping('Times', 'Times-Roman', '/usr/share/fonts/dejavu/DejaVuSans.ttf', 'Book')
    rmldoc.setTTFontMapping('Times', 'Times', '/usr/share/fonts/dejavu/DejaVuSans.ttf', 'Book')
    rmldoc.setTTFontMapping('Times', 'Times-Bold', '/usr/share/fonts/dejavu/DejaVuSans-Bold.ttf', 'Bold')
    rmldoc.setTTFontMapping('Times', 'Times-BoldOblique', '/usr/share/fonts/dejavu/DejaVuSans-BoldOblique.ttf', 'Bold Oblique')
    rmldoc.setTTFontMapping('Times', 'Times-Oblique', '/usr/share/fonts/dejavu/DejaVuSans-Oblique.ttf', 'Oblique')
    rmldoc.setTTFontMapping('Courier', 'Courier', '/usr/share/fonts/dejavu/DejaVuSansMono.ttf', 'Book')
    rmldoc.setTTFontMapping('Courier', 'Courier-Bold', '/usr/share/fonts/dejavu/DejaVuSansMono-Bold.ttf', 'Bold')
    rmldoc.setTTFontMapping('Courier', 'Courier-BoldOblique', '/usr/share/fonts/dejavu/DejaVuSansMono-BoldOblique.ttf', 'Bold Oblique')
    rmldoc.setTTFontMapping('Courier', 'Courier-Oblique', '/usr/share/fonts/dejavu/DejaVuSansMono-Oblique.ttf', 'Oblique')

After that i can see cyrillic symbols in all reports with windows fonts.

My question : If posible, check font maping for fonts which aren't set in OS.

This about openerp-8.0dev-20140116-000101.tar.gz , reportlab 2.5 | 3.0

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 2/28/14, 1:42 AM
Seen: 1467 times
Last updated: 3/16/15, 8:10 AM