-
Notifications
You must be signed in to change notification settings - Fork 8
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
Cache default font #210
Cache default font #210
Conversation
Thanks! We probably don't need to export, as But you can add a docstring so its part of the unexported interface. Just include it using the full |
Fully agreed, thanks ! |
On second thoughts, font-related error handlers needed an update julia> DynamicGrids._fontwrongtype(1)
ERROR: ArgumentError: font must be either a String or a FreeTypeAbstraction.FTFont,
got `1` which is a `Int64`.
...
julia> DynamicGrids._fontnotfounderror("cantarell")
ERROR: ArgumentError: Font "cantarell" wasn't found in this system.
Specify an existing font with the `font` keyword,
or call DynamicGrids.set_default_font first,
or use `text=nothing` to display no text.
...
julia> DynamicGrids._nodefaultfonterror(("cantarell", "sans-serif", "Bookman"))
ERROR: Your system does not contain any of the default fonts
("cantarell", "sans-serif", "Bookman").
Use DynamicGrids.set_default_font first.
... The last commit is a proposition to move those error handlers to the end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Sorry I took so long to review this!
src/outputs/textconfig.jl
Outdated
@noinline _fontnotfounderror(font) = | ||
throw(ArgumentError( | ||
""" | ||
Font "$font" wasn't found in this system. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason these are wrapped so narrow now? 92 chars is the standard max width for Julia.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was an application of "one chunk of thought per line",
which makes things much easier to read.
I agree that the newline before throw
was unnecessary, a9dbfc8 is better ?
Caching default font is the last bit needed to accelerate
savegif
from 12s to 3.4s (fully fixes #194).The timings now are
set_default_font(FTFont(path))
can be used to bypass any findfont call, if desired.Please let me know if this is OK to
export
(I'd add a docstring then).