Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Letter spacing for numbers with font Montserrat #3809

Open
RainerRoss opened this issue Jan 6, 2025 · 0 comments
Open

Letter spacing for numbers with font Montserrat #3809

RainerRoss opened this issue Jan 6, 2025 · 0 comments

Comments

@RainerRoss
Copy link

RainerRoss commented Jan 6, 2025

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

@RainerRoss RainerRoss changed the title Letter spacing for numbers at font Montserrat Letter spacing for numbers with font Montserrat Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant