What were you trying to do?
I am using Cormorant Infant font and want to use glyphs in ss02 and also to apply the kerning.
How did you attempt to do it?
This is the part of the code, where I configure this behavior:
const oCormorantInfantFont = await pdfDoc.embedFont( oCormorantInfantFontBytes, {
features: {
kern: true,
ss02: true
}
});
What actually happened?
But with or without params in features, the result is same.
What did you expect to happen?
To see the glyphs from ss02 and correct space between letters, defined by kerning.
How can we reproduce the issue?
const { PDFDocument, rgb, PageSizes } = PDFLib
const sCormorantInfantUrl = location.origin + '/CormorantInfant-Bold.ttf';
const oCormorantInfantFontBytes = await fetch( sCormorantInfantUrl ).then( res => res.arrayBuffer( ) );
const pdfDoc = await PDFDocument.create()
const mmToPoints = (mm) => mm * 2.83465;
pdfDoc.registerFontkit( fontkit );
const oCormorantInfantFont = await pdfDoc.embedFont( oCormorantInfantFontBytes, {
features: {
kern: true,
ss02: true
}
});
const oPage = pdfDoc.addPage([
mmToPoints( 148.5 ),
mmToPoints( 210 )
]);
const sMainTitle = 'УПРАЖНЕНИЕ'
const fMainTitleSize = 31;
const fMainTitleTextSize = oCormorantInfantFont.widthOfTextAtSize(
sMainTitle,
fMainTitleSize
);
// Draw the string of text on the page
oPage.drawText( sMainTitle, {
x: ( oPage.getWidth( ) - fMainTitleTextSize ) / 2,
y: oPage.getHeight( ) * 920675676e-9,
size: fMainTitleSize,
align: 'center',
font: oCormorantInfantFont,
color: rgb( 0.659, 0.294, 0.396 ),
})
const pdfDataUri = await pdfDoc.saveAsBase64({ dataUri: true });
document.getElementById( 'pdf' ).src = pdfDataUri;
Version
1.4.0
What environment are you running pdf-lib in?
Browser
Checklist
Additional Notes
No response
What were you trying to do?
I am using Cormorant Infant font and want to use glyphs in ss02 and also to apply the kerning.
How did you attempt to do it?
This is the part of the code, where I configure this behavior:
What actually happened?
But with or without params in
features, the result is same.What did you expect to happen?
To see the glyphs from ss02 and correct space between letters, defined by kerning.
How can we reproduce the issue?
Version
1.4.0
What environment are you running pdf-lib in?
Browser
Checklist
Additional Notes
No response