plotters icon indicating copy to clipboard operation
plotters copied to clipboard

Proposal: support custom text rendering

Open pr2502 opened this issue 5 years ago β€’ 1 comments

Hello. I created this PR as a means to ask you, if you'd be open to generalization of the text drawing API. What I've changed here allows me to swap plotters::style::TextStyle for my own type implementing plotters_backend::BackendTextStyle in arguments of DrawingArea::draw_text, which means I can provide my own text renderer. I can use this to supply my own bitmap font renderer since rusttype doesn't support these (yet at least), it could be also used to replace rusttype with pango or some other font drawing library, which might be useful when a project is already using those.

However trying to allow this everywhere would be a much larger change than what I did here, requiring swapping every TextStyle for another type variable _: BackendTextStyle, which will have some impact on the public API too.

If you think this is something you'd want implemented I'd be happy to spend the time on it. Thanks for your work on plotters!

pr2502 avatar Oct 04 '20 21:10 pr2502

Codecov Report

Merging #192 into master will decrease coverage by 0.02%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #192      +/-   ##
==========================================
- Coverage   68.83%   68.81%   -0.03%     
==========================================
  Files          56       56              
  Lines        4313     4313              
==========================================
- Hits         2969     2968       -1     
- Misses       1344     1345       +1     
Impacted Files Coverage Ξ”
src/chart/context.rs 83.29% <100.00%> (ΓΈ)
src/drawing/area.rs 93.07% <100.00%> (ΓΈ)
src/coord/ranged3d/projection.rs 73.86% <0.00%> (-1.14%) :arrow_down:

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 6da6db4...fba38b9. Read the comment docs.

codecov[bot] avatar Oct 04 '20 21:10 codecov[bot]