Skip to content
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

example of how to change the font? #303

Open
ezaron opened this issue Jun 15, 2020 · 3 comments
Open

example of how to change the font? #303

ezaron opened this issue Jun 15, 2020 · 3 comments

Comments

@ezaron
Copy link

ezaron commented Jun 15, 2020

Hello All,

In one of the recent updates of either Winston or Gtk, I noticed that the default font has changed from a sans serif font to a serif font.

Would anyone on this list have a suggestion for how to access the old sans serif font (arial or helvetica or similar)? I am running Julia 1.4.1 on linux.

All the best,
Ed

@tknopp
Copy link
Collaborator

tknopp commented Jun 15, 2020

This is because Gtk/Cairo/Fontconfig now get binaries from BinaryBuilder. This might be the same issue I posted here:

JuliaGraphics/Gtk.jl#507

If you can come up with a minimal example, maybe @lobingera or @giordano can help.

@ezaron
Copy link
Author

ezaron commented Jun 15, 2020

Thx, tknopp. Following through the link you provided and also looking at this Cairo issue,
JuliaGraphics/Cairo.jl#312
it seems like a quick fix is to add the following two lines to the textdraw function in the Winston/src/renderer.jl file:

fs = get(self,:fontsize)
set_font_face(self.ctx, "DejaVu Sans $(fs)px")

I tried a few variations of above, and the following command (from the Cairo sample_text.jl file),

select_font_face(cr, "DejaVu Sans", Cairo.FONT_SLANT_NORMAL,
Cairo.FONT_WEIGHT_BOLD);

when the graphics context is first created, but it didn't work.

Anyway, agreed, this seems to be a lower-level issue related to Cairo or Fontconfig.

@lobingera
Copy link

I don't have a working solution right now - even not on my own computer(s). The set_font_face works with the Pango (pangocairo) interfaces which should work once fontconfig is working, select_font_face with the libcairo 'toy' interface which is only a PoC for testing or similar, in using cairo one should open the font externally (e.g. via Freetype).

I'm not happy with the current setup but to get a stable solution (for Cairo.jl and higher) we need a fontconfig expert (and the julia environment seems to lack one).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants