parallax/jsPDF

Letter spacing for numbers with font Montserrat

Closed this issue · 1 comments

Hi,
I use the Montserrat Font for creating PDF's with jsPDF 2.5.2 and I need letter spacing for numbers.
For my website it works when I add: font-feature-settings: "tnum"

@font-face {
   font-family: "Montserrat-Regular";
   font-feature-settings: "tnum";
   font-style: normal;
   ont-weight: 400;
}

it is possible to do the same with jsPDF

I tried this but it doesn't work perfect for me

function addFonts(doc) {
    const montserratRegular = readFile('/fonts/Montserrat-Regular.js');
    doc.addFileToVFS('Montserrat-Regular-normal.ttf', montserratRegular);
    doc.addFont('Montserrat-Regular-normal.ttf', 'Montserrat-Regular', 'normal');
}

doc.setFontSize(10);
doc.setFont('Montserrat-Regular', 'normal');
doc.text('124.11', 100, 50, {align:'right', charSpace:'0.1'});

thanks for tips
Rainer

This issue is stale because it has been open 90 days with no activity. It will be closed soon. Please comment/reopen if this issue is still relevant.