jobsta/reportbro-lib

add italic,bold, italicBold fonts - got error

4t4nner opened this issue · 2 comments

If i try add multiple font files

additional_fonts = [
        dict(
            value='OpenSans', 
            filename=assetFontPath + 'OpenSans-Regular.ttf',
            bold_italic_filename=assetFontPath + 'OpenSans-BoldItalic.ttf',
            bold_filename=assetFontPath + 'OpenSans-Bold.ttf',
            italic_filename=assetFontPath + 'OpenSans-Italic.ttf'
        )
    ]

I got an error "undefined font opensans"
I debug into lib code and find that in set_font added only first opensansB font and font['added'] set to True, but opensans font and other not added.

Then I get this error

if I change lib code like this:

                if not font['added'].get(family + '_' + style):
                    filename = font['style2filename'].get(style)
                    self.add_font(family, style=style, fname=filename, uni=font['uni'])
                    font['added'][family + '_' + style] = True

all works

This is indeed a bug, your fix is ok (assuming you changed 'added' from bool to dict). This will be fixed with the next release.

Fixed with 932b0be