Home > Blockchain >  Cairo PDF not converting unicode while creating
Cairo PDF not converting unicode while creating

Time:05-25

I am converting SVG to PDF using Cairo PDF library of Python. It is working well for ASCII characters, but for Unicode chars it is displaying a square box. Is there any solution to deal with this problem?

cairosvg.svg2pdf(
    url='svg_file_with_unicode_character.svg',
    write_to='output.expecting_unicode_character.pdf',
    output_height=720,
    output_width=1200
    )   

CodePudding user response:

I got a solution for this. I included a font called GNU Unifont in SVG as following:

.font-class{
      font-family: Unifont 
}

Which seems to have all the required glyphs for Unicode chars that I need.

Kudos to GNU Unifont! from hint "add font-family" by @RobertLongson

  • Related