Replies: 4 comments 7 replies
-
great work! matplotlib doesn't really have the best the best API for working with fonts since obviously it isn't really the point of the library. It would be nice for ezdxf to handle fonts in a backend-agnostic way. I'm sure there are performance tricks that could get it at least equal to matplotlib like caching rendered glyphs (which is just an example, I don't know if that would be beneficial). |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
So far accomplished and pushed to the
Render time doesn't feel slower than before, there's less caching than before, only the unscaled glyph paths are cached now - there's room for improvement if needed, and the @mbway Do you really need the methods For the new As the todo:
|
Beta Was this translation helpful? Give feedback.
-
@mbway I refactored the whole |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
@mbway Hi! I'm experimenting with the
fonttools
and figured out how to render TrueType fonts withoutMatplotlib
and the best part is that the result looks like the rendering in BricsCAD with only minor differences - although I have no idea about "kerning" and other advanced font features: yellow in the back the fonttools rendering, blue the BricsCAD renderingMore differences to TrueView 2023:
I have to test if the "homemade" rendering is faster or slower than the rendering of
Matplotlib
andMatplotlib
has still one big advantage: the font-manger locates the TrueType fonts automatically on Windows, Linux and macOS.The
fonttools
is a pure Python package and the base install has no dependencies - the kind of libraries I like and could imagine adding as a dependency to theezdxf
core library. This would add reliable text measurement to the core library.Unless further testing hits some showstoppers and I have a replacement for Matplotlib's font manager, I'd like to replace all font rendering for the
drawing
add-on with my own font rendering class that generates the text paths for the Matplotlib and PyQt backends and more backends to come, thePyMuPDF
package is a good candidate for an accurate and fast PDF backend.Beta Was this translation helpful? Give feedback.
All reactions