Skip to content

Unify the API for working with fonts when Pango is enabled. #543

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

Closed
wants to merge 2 commits into from

Conversation

joefreeman
Copy link
Contributor

Relating to the discussion of issue #525, I've tried to make sure that the API works the same whether or not Pango is enabled. Previously, calling addFont with Pango enabled would cause the font rendering to break. Also, the font had to be referenced by family name. With this change, the addFont call is optional, but if it is called, the font can be referenced using the name provided to the Font constructor.

So, after setting up the font like this:

var font = new Font('myFontAlias', '/path/to/MyFont.ttf');
context.addFont(font);

This:

context.font = '50px myFontAlias';

Is equivalent to this (assuming the font's family name is 'My Font'):

context.font = '50px \'My Font\'';

But I'm not familiar with C++, Pango or Cairo, so my changes might be no good.

@LinusU
Copy link
Collaborator

LinusU commented Nov 16, 2015

Hi @joefreeman, I'm sorry that this has fallen thru the cracks. Would you mind rebasing on master? I will make sure to review this. Thanks 👍

@joefreeman
Copy link
Contributor Author

No need - looks like this is working in master now. I'll close this and my issue...

@LinusU
Copy link
Collaborator

LinusU commented Nov 19, 2015

@joefreeman Are you sure? Did you test it with built pango support?

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

Successfully merging this pull request may close these issues.

2 participants