dompdf / php-svg-lib

SVG file parsing / rendering library
GNU Lesser General Public License v3.0
1.41k stars 77 forks source link

Custom Font not working #123

Closed fateenarinah closed 4 months ago

fateenarinah commented 4 months ago

Hi! I'm encountering an issue with an SVG image that uses the Open Sans font family. When I upload it into Dompdf, the font family gets changed to something else. I've already tried setting the SVG code to use the Open Sans font family, but it's not working. I'd greatly appreciate it if someone could guide me on how to properly utilize the Open Sans font family in my SVG code.

Below is the SVG code I'm currently using.

Screenshot 2024-07-05 121805

and the output Screenshot 2024-07-05 121934

I've examined the SVG code using the SVG Viewer and have attached the output below. It appears to be functioning properly there, but when I transfer it to Dompdf, an issue similar to the one shown in the first screenshot arises.

Screenshot 2024-07-05 121958

bsweeney commented 4 months ago

SvgLib does not yet have font management logic. Because of this you have to specify the path to the font file instead of the font name, unless you're using a core PDF font such as helvetica or a generic font family such as sans-serif. See #110 for details and updates on improved font selection support.

I see you also have a tspan in there, which is also not yet supported. Follow #64 for updates on that feature.