Repository navigation
fix: accept unquoted non-ASCII font-family values - #384
amandeavor wants to merge 3 commits into
Conversation
font-family-papandreou throws on unquoted names with non-ASCII characters (e.g. font-family="微软雅黑"). Browsers still honor those attribute values, so fall back to treating the whole string as a single family name (yWorks#330).
|
The test should verify that the PDF actually shows the correct glyphs from that font, i.e. that when adding that specific font to jspdf, the resulting pdf will actually use the embedded matching font. It's not enough to show that a library does not throw an exception. You need to check the output and verify that it's actually working.... |
|
@yGuy Added! The test now defines a fallback list containing an unquoted non-ASCII family name alongside the registered custom font ( Also enhanced the fallback parsing in |
|
So just to get this right, your code now calls the font parsing library and if the library fails to parse properly, it does the parsing itself in a very rudimentary form? I guess you should rather fix the font parsing library, then. Also please disclose it, if you this is actually just all AI slop (which seems likely, looking at your github history). |
|
Thanks for the candid feedback, @yGuy. You make a completely fair point on the architecture — resolving this in the font parsing library directly is the cleaner root fix and avoids maintaining duplicate fallback parsing here. To answer your question directly: I do use AI-assisted tooling in my prototyping workflow, alongside local test reproduction and manual review before opening PRs. That said, I hear your concern loud and clear about avoiding piecemeal workarounds when an upstream parser fix is the right path. I'll close this PR so we don't carry an ad-hoc fallback here, and look into addressing the font family handling in the parser library instead. Thanks for the review and perspective. |
Summary
font-family-papandreouthrows on unquoted non-ASCII family names such asfont-family="微软雅黑".Fixes #330.
Test plan
npm test -- test/font-family-unquoted-utf8