-
Notifications
You must be signed in to change notification settings - Fork 13
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
Fonts! #36
Comments
from trying the package it's clear that What's needed for the interaction to happen? I though as a naive implementation we just need to inject something like this into the tectonic input right? \usepackage{fontspec}%
\newfontfeature{Microtype}{protrusion=default;expansion=default;}%
\setmainfont{texgyrepagella-regular.otf}[%
Microtype,
Ligatures = TeX,
BoldFont = texgyrepagella-bold.otf,
ItalicFont = texgyrepagella-italic.otf,
BoldItalicFont = texgyrepagella-bolditalic.otf,
]% |
Something like that, but we would need to figure out how to get all the other font types as well as a good math font. (actually, now that you mention it - my Fontconfig PR to Makie has some code which should work well. I could move some of that dep to Makie for now.) Also, the way the text algorithm works now precludes MakieTeX from hooking into it as it previously did. I'd have to refactor that algorithm to (preferably) accept scatters as well, which could then be used for both emojis and images. |
ok rn I just want a minimal working thing so I can be compliant with publication requirement with Makie and the only requirement is to render something like
using Helvetica (or Nimbus). I think for Makie's use case, i.e., |
are you saying that right now there's no method in this repo that can "see" |
yes, even the old well: you can use LTeX, which should be able to see font, but it hasn't been updated to the new interface. |
How would you do that without a Helvetica math font anyway? Unless I misunderstand this would show up in CMU even in normal latex? |
I don't know but matplotlib (which goes through in any case, when using |
wait, so is this pkg right now completely useless? what does it even do if it can't intercept edit: oh, we can plot |
provides an LTeX layoutable which can render arbitrary latex, that's about it |
for now, if you know which math font you want you could provide a custom preamble to LTeX, like so: tex_to_render = TeXDocument("this is a full and compilable latex document pasted into a string in Julia")
LTeX(fig[i, j]; tex = tex_to_render, ...) and then you can load your custom fonts etc. I'll have a look at how Matplotlib does this and see what I can do though! |
I'd be happy to help since I know a little bit around Makie code base by now |
Am testing out the text refactor-ish thing now...will allow an extension to be added for Pango pretty easily as well. |
ok here's a super hacky idea:
this API shouldn't be too bad because we can take whatever this has the benefit that we can do whatever we want with |
We mostly have that in |
If you have an idea of how we can: then I think those would be the natural next steps. |
we assume for now user has some LaTeX knowledge, so for example in |
Ok, that sounds good. Yeah I guess we can assume that any font a user provides must be installed, I'm not the most familiar with fontconfig but it seems you can specify bold/italic/etc fonts as separate font files. The way I see this, there are two cases:
I guess We could just assume a CMU math font until told otherwise by the user, that works. |
julia> function main()
tex = CachedTeX(MakieTeX.texdoc(raw"$\sqrt{s} = 13 \text{TeV}$"));
f,a,_ = plot(1:3, 1:3)
marker = MakieTeX.recordsurf2img(tex, 4) #increase render density
scatter!(a, 1.5, 1.5; marker, markersize=100)
CairoMakie.save("/tmp/jl_onm7cZSLiJ.png", f)
end I don't understand why it's rotated (I thought |
ok, if we apply julia> function main()
tex = CachedTeX(MakieTeX.texdoc(raw"$\sqrt{s} = 13 \text{TeV}$"));
f,a,_ = plot(1:3, 1:3)
marker = MakieTeX.rotl90(MakieTeX.recordsurf2img(tex, 4))
scatter!(a, 1.5, 1.5; marker, markersize=tex.dims .*2)
CairoMakie.save("/tmp/jl_onm7cZSLiJ.png", f)
end |
Some useful resources for font changes:
The text was updated successfully, but these errors were encountered: