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

settext doesn't use fontsize() #52

Closed
Wikunia opened this issue Mar 27, 2019 · 3 comments
Closed

settext doesn't use fontsize() #52

Wikunia opened this issue Mar 27, 2019 · 3 comments

Comments

@Wikunia
Copy link
Contributor

Wikunia commented Mar 27, 2019

I'm currently using Luxor for my CodePoster project. I wanted to try to set text with different colors for different parts of a text (syntax highlighting) by using settext. I realized that settext doesn't use the fontsize specified by fontsize. This is unexpected behavior for me. I think if not specified directly like <span font='26'>text</span> it should use the fontsize specified by the fontsize command.

@cormullion
Copy link
Member

cormullion commented Mar 27, 2019

Hi! I saw that project, it looks great!

I think the problem here is that there are two simultaneously available text APIs in Cairo. In Luxor, fontsize and fontface are the Toy API, and settext and setfontare the so-called Pro API. They're different Cairo calls and have different behaviours with respect to accessing system fonts. If you mix them, you'll get unexpected results. (I switch between them, because sometimes the Pro API gets more symbols correct, but the Toy API accesses macOS fonts better.)

I would love to have someone provide a full API to Cairo's Pro text API, complete with Pango support, but that's too advanced for me... :)

@Wikunia
Copy link
Contributor Author

Wikunia commented Mar 27, 2019

Thanks for your fast response. Yeah setting fontface and fontsize for textextents and then setfont and settext for the text works.

@cormullion
Copy link
Member

Yes, textextents is the Toy API one that would be mirrored in the Pro API with lots of glyph- functions (https://www.cairographics.org/manual/cairo-text.html) , but those need adding to Cairo.jl by somebody... :)

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

2 participants