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

Improve addFont method for DefaultFont in Document class #53

Open
microshine opened this issue Mar 24, 2023 · 0 comments
Open

Improve addFont method for DefaultFont in Document class #53

microshine opened this issue Mar 24, 2023 · 0 comments

Comments

@microshine
Copy link
Contributor

The current implementation of the addFont method in the PDFDocument class for DefaultFont allows registering the same font multiple times. This behavior needs to be improved so that the method can detect if the added font is already registered and return the existing font instead of registering it again. Additionally, when registering fonts, a random UUID is assigned to each font. For system fonts, it would be better to use special names instead of UUIDs (e.g., Acrobat registers Helvetica as Helv).

Steps to reproduce:

  1. Create a PDFDocument instance.
  2. Call the addFont method multiple times for the same DefaultFont with different names.
  3. Observe that the font is registered multiple times.

Expected behavior:

The addFont method should detect if the added font is already registered and return the existing font instead of registering it again.

Actual behavior:

The addFont method registers the same font multiple times.

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