JuliaGraphics / FreeTypeAbstraction.jl

A Julian abstraction layer over FreeType.jl
Other
25 stars 20 forks source link

add file match to find font() #54

Closed cormullion closed 9 months ago

cormullion commented 3 years ago

Since on Slack I wondered to @jkrumbiegel why this wasn't currently possible, I thought I'd better make an effort and try adding it myself... :)

The intention is to allow specifying a font by giving a filename. So eg in Makie you can now go:

f = Figure()
...
f.scene.attributes[:font] = "BenguiatGothicStd-MediumObl.otf"

This doesn't really add very much functionality since Julius' existing font finding stuff is already pretty good, but users might expect that this more basic way of specifying a font would also be possible.

I also moved the docstring to the exported findfont() function, not sure whether its more likely to be read there.

codecov[bot] commented 3 years ago

Codecov Report

Merging #54 (ef514f7) into master (7eca811) will increase coverage by 0.12%. The diff coverage is 81.81%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #54      +/-   ##
==========================================
+ Coverage   76.44%   76.57%   +0.12%     
==========================================
  Files           6        6              
  Lines         276      286      +10     
==========================================
+ Hits          211      219       +8     
- Misses         65       67       +2     
Impacted Files Coverage Δ
src/findfonts.jl 91.30% <81.81%> (-1.92%) :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 7eca811...ef514f7. Read the comment docs.

jkrumbiegel commented 3 years ago

Thank you! I've added something similar to AbstractPlotting yesterday https://github.com/JuliaPlots/AbstractPlotting.jl/pull/611, so I'm not sure if it makes sense to add this in FreeTypeAbstraction as well. Or if it would have made more sense to add it here in the first place. What do you think @SimonDanisch?

cormullion commented 3 years ago

Haha - happy to go with your version, I'm sure it's better!

SimonDanisch commented 3 years ago

Well, now that you say that... FreeTypeAbstraction seems like the right place, since more packages will profit from a more consistent font loading experience^^