Conversation
Guard the registerFamily insertion path with a contains check so that calling registerFamily with the same familyName/fullName pair more than once does not grow the family list unboundedly and slow down font lookup. Add a package-private getRegisteredFamily accessor and a unit test to cover the deduplication invariant. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Not up to standards ⛔
|
|
Hi @asturio, This PR backports the font family duplicate-registration fix to the Whenever you get a chance, I'd appreciate your review, and if it looks good, approval/merge into I'd also kindly ask, once merged, if an official release including this fix could be cut — particularly for the Java 8-compatible line (#1621), since I'd rather rely on an official release than patch it in locally. Thanks for maintaining OpenPDF! |



Description of the new Feature/Bugfix
FontFactoryImp.registerFamilyappended a[familyName, fullName]pair toits internal family list on every call, even when that exact pair was
already registered. Repeated registration of the same font grew the list
unboundedly and slowed down font lookup over time.
Guarded the insertion path with a
containscheck so the samefamilyName/fullName pair is only ever added once. Added a package-private
getRegisteredFamilyaccessor and a unit test covering the deduplicationinvariant.
Related Issue: none (found during code review, not tied to a filed issue)
Unit-Tests for the new Feature/Bugfix
Compatibilities Issues
No behavioral change for callers -
registerFamilystill registers thepair, just without duplicating it on repeat calls. No existing method
signatures changed;
getRegisteredFamilyis a new package-privateaccessor, added only for the test.
Your real name
Diego Garcia
Testing details
Added
FontFactoryImpTestcoverage for the dedup invariant. Fullopenpdftest suite run locally with no regressions.🤖 Generated with Claude Code