Odoo Help


This community 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.


font mapping for reportlab?

on 2/28/14, 1:42 AM 908 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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)


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