parallax / jsPDF

Client-side JavaScript PDF generation for everyone.
https://parall.ax/products/jspdf
MIT License
29.41k stars 4.68k forks source link

[ttffont.js] preferredFamily is undefined in NameTable #3755

Open yeori opened 4 months ago

yeori commented 4 months ago

NameTable.preferredFamily is undefined

https://github.com/parallax/jsPDF/blob/5d09af9135a2fe049c7d3c8b95df280d22e4a6db/src/libs/ttffont.js#L1269

The ttf specification says preferredFamily is at nameID 16 (nameID 15 is said to be reserved, which is undefined)

https://learn.microsoft.com/ko-kr/typography/opentype/spec/name#name-ids https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6name.html

Sample

Font Inter from google fonts at https://fonts.google.com/selection?query=Inter

Inter-Thin.ttf.zip

It has preferredFamily as 'Inter' and preferredSubfamily as 'Thin'

Thanks.

krrish-sehgal commented 1 month ago

I would like to work on this , Please assign me this issue under hacktoberfest 2024. Thanks.