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

Fix font error when font is used by multiple features #11

Merged
merged 3 commits into from
Apr 6, 2020

Conversation

yufeizhu600
Copy link

This PR is a workaround fix for issue#10.
The root cause of the issue#10 is that when introducing the new feature which accept a font_path and font_size as args for add_text() broken the backward compatibility of passing an aggdraw Font object to the function.

This PR restore the compatibility to use font_obj as below, which is also presented in the document.

font_obj = aggdraw.Font('white', '/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf', size=26)
dc.add_text("Some Text", font=font_obj)

I consider it is just a workaround since there is still confusion in the code base that self.style[font] can be either a aggdraw font object or a path to the font file.

@coveralls
Copy link

coveralls commented Jan 28, 2020

Pull Request Test Coverage Report for Build 23

  • 0 of 2 (0.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.3%) to 44.131%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pydecorate/decorator_base.py 0 2 0.0%
Totals Coverage Status
Change from base Build 30: -0.3%
Covered Lines: 188
Relevant Lines: 426

💛 - Coveralls

@djhoese
Copy link
Member

djhoese commented Mar 23, 2020

Sorry about missing this. What is the state of this? Is it still needed?

@yufeizhu600
Copy link
Author

Yes, I think so. It is better to be merged untill a review of the font argument, or review the documents and examples refered font parameter.

@djhoese djhoese changed the title Font bug workaround Fix font error when font is used by multiple features Apr 5, 2020
@djhoese
Copy link
Member

djhoese commented Apr 5, 2020

After #12 is merged, we can maybe rebase this, merge it, then close #10.

@codecov
Copy link

codecov bot commented Apr 6, 2020

Codecov Report

Merging #11 into master will decrease coverage by 0.26%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #11      +/-   ##
==========================================
- Coverage   44.26%   44.00%   -0.27%     
==========================================
  Files           4        4              
  Lines         427      425       -2     
==========================================
- Hits          189      187       -2     
  Misses        238      238              
Impacted Files Coverage Δ
pydecorate/decorator_agg.py 66.15% <ø> (+0.93%) ⬆️
pydecorate/decorator_base.py 41.59% <0.00%> (-0.25%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0b4dc1a...94e049d. Read the comment docs.

@djhoese
Copy link
Member

djhoese commented Apr 6, 2020

Thanks again @yufeizhu600. I would ask for tests but we don't even have real tests for this project yet and I'm not going to make this PR implement it.

@djhoese djhoese merged commit e0b3ad4 into pytroll:master Apr 6, 2020
@djhoese djhoese added the bug label Apr 6, 2020
@djhoese djhoese self-assigned this Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants