yWorks/svg2pdf.js

custom fonts in jspdf take effect but not for svg

zhyale opened this issue · 3 comments

I have created a custom Chinese font MiSans-Normal for jsPDF, and test OK for jspdf.text() , but Chinese characters are still messy code in jspdf.svg( ) .
I am not sure whether it is a bug, or any option need to be configured, can you help me, thank you :)

try add font-family in svg, and it will use fonts defines in jsPDF

<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
        <style>
            text {
                font-family: MiSan-Normal;
            };
        </style> 
            <text > 文字 </text>
 </svg>

try add font-family in svg, and it will use fonts defines in jsPDF

<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
        <style>
            text {
                font-family: MiSan-Normal;
            };
        </style> 
            <text > 文字 </text>
 </svg>

Thank you very much, it works now :)

rafh commented

@zhyale I ran into the same issue and switched over to svg2pdf. However, I'm not able to get the correct fonts passed to my svg. Do you have an example of how you accomplished this task?