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

Refactor fonts from dict to classes #798

Merged
merged 3 commits into from
Jun 5, 2023
Merged

Conversation

andersonhc
Copy link
Collaborator

@andersonhc andersonhc commented Jun 2, 2023

This PR is only refactoring the code touching fonts.
Instead of dictionaries, I created the classes TTFFont and CoreFont

This is a first step for the text shaping functionality

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.

@andersonhc andersonhc requested a review from Lucas-C as a code owner June 2, 2023 14:26
@codecov
Copy link

codecov bot commented Jun 2, 2023

Codecov Report

Patch coverage: 95.94% and project coverage change: +0.03 🎉

Comparison is base (567a4bd) 93.29% compared to head (47d1978) 93.33%.

❗ Current head 47d1978 differs from pull request most recent head c8acf05. Consider uploading reports for the commit c8acf05 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #798      +/-   ##
==========================================
+ Coverage   93.29%   93.33%   +0.03%     
==========================================
  Files          27       27              
  Lines        7355     7378      +23     
  Branches     1331     1329       -2     
==========================================
+ Hits         6862     6886      +24     
  Misses        309      309              
+ Partials      184      183       -1     
Impacted Files Coverage Δ
fpdf/fonts.py 95.76% <94.38%> (-4.24%) ⬇️
fpdf/output.py 97.23% <96.87%> (+0.10%) ⬆️
fpdf/fpdf.py 92.62% <100.00%> (+0.07%) ⬆️
fpdf/line_break.py 99.20% <100.00%> (ø)
fpdf/table.py 92.48% <100.00%> (-0.07%) ⬇️

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

fpdf/fpdf.py Show resolved Hide resolved
fpdf/fpdf.py Outdated Show resolved Hide resolved
@Lucas-C
Copy link
Member

Lucas-C commented Jun 5, 2023

This is a really code refactoring!

Thank you @andersonhc 👍

I just had a couple of minor comments, but this PR is excellent.

I'm eager to merge it 😄

@andersonhc
Copy link
Collaborator Author

This is a really code refactoring!

Thank you @andersonhc 👍

I just had a couple of minor comments, but this PR is excellent.

I'm eager to merge it 😄

Thank you!

I'll start another PR soon migrating some functions to the font classes. It should be the last prep PR before text shaping.

@Lucas-C Lucas-C merged commit 3b07d9c into py-pdf:master Jun 5, 2023
10 checks passed
@Lucas-C
Copy link
Member

Lucas-C commented Jun 5, 2023

Merged!

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.

None yet

2 participants