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

Show warning if font is missing glyphs #661

Merged
merged 6 commits into from
Jan 6, 2023
Merged

Conversation

andersonhc
Copy link
Collaborator

As discussed in #637, this is a first PR only to show a warning if the font is missing glyphs

e.g. Fixes #0

Checklist:

  • The GitHub pipeline is OK (green),
    meaning that both pylint (static code analyzer) and black (code formatter) are happy with the changes of this PR.

  • A unit test is covering the code added / modified by this PR

  • This PR is ready to be merged

  • In case of a new feature, docstrings have been added, with also some documentation in the docs/ folder

  • A mention of the change is present in CHANGELOG.md

By submitting this pull request, I confirm that my contribution is made under the terms of the GNU LGPL 3.0 license.

for unicode in uni_to_new_code_char
if unicode not in cmap
]
if len(missing_glyphs) > 0:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, simple addition!

Could you please add a unit test, and a mention in CHANGELOG.md of this change?

fpdf/output.py Outdated Show resolved Hide resolved
Co-authored-by: Lucas Cimon <925560+Lucas-C@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Jan 6, 2023

Codecov Report

Base: 94.05% // Head: 94.08% // Increases project coverage by +0.03% 🎉

Coverage data is based on head (504c36d) compared to base (8a88954).
Patch coverage: 100.00% of modified lines in pull request are covered.

❗ Current head 504c36d differs from pull request most recent head 3f92160. Consider uploading reports for the commit 3f92160 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #661      +/-   ##
==========================================
+ Coverage   94.05%   94.08%   +0.03%     
==========================================
  Files          26       26              
  Lines        6729     6732       +3     
  Branches     1192     1194       +2     
==========================================
+ Hits         6329     6334       +5     
+ Misses        230      229       -1     
+ Partials      170      169       -1     
Impacted Files Coverage Δ
fpdf/output.py 96.85% <100.00%> (+0.01%) ⬆️
fpdf/fpdf.py 91.66% <0.00%> (+0.11%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -112,3 +113,13 @@ def test_add_font_uppercase():
pdf = FPDF()
pdf.add_font(fname=HERE / "Roboto-BoldItalic.TTF")
assert pdf.fonts is not None and len(pdf.fonts) != 0 # fonts add successful


def test_font_missing_glyphs(caplog):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@Lucas-C Lucas-C merged commit 050e6ff into py-pdf:master Jan 6, 2023
@Lucas-C
Copy link
Member

Lucas-C commented Jan 6, 2023

Merged! Thank you very much @andersonhc 😃

@Lucas-C Lucas-C mentioned this pull request Jan 31, 2023
5 tasks
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

Successfully merging this pull request may close these issues.

2 participants