CairoSVG
CairoSVG copied to clipboard
Support text- and font-related features
Hi, i have simple test.svg file:
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.1" height="15mm" width="30mm"> <text x="10" y="30" style="text-decoration: underline; font-weight: bold; font-style: italic;">wat</text> </svg>
When i try:
cairosvg test.svg -o test.pdf
then the text in test.pdf is bold, italic but NOT underline. test.pdf
Thanks for reporting!
Yes, it's documented. It's not supported, and will probably never be :cry:.
I'm changing the title of this issue for something larger. Many tests are available if anybody wants to help!
Thanks for you response.
First, I didn't find that page. I'm desperately searching for PHP SVG -> PDF converter, which can handle underline text. Or a way, how can I edit existing PDF and set specific text to underline. I am also willing to pay for development, if it was not a high amount.
Unfortunately, underlining text is not easily possible in a clean way with Cairo (the drawing library used by CairoSVG), whose text-related functions are really simple. The solution would be to use Pango, which is possible but really long (and maybe not really interesting).
But… We can try to have simple features (underline, alignment, spacing) with dirty hacks, and forget complicated features (bidi, kerning, alt ghyphs…).
For my situation (I have javascript SVG text editor) I created underline replacer: https://github.com/dominik-selmeci/svg-underline-replacer.
Its not the best solution and only for simple text elements. But it works well for the purpose of the company where I work :).