Skip to content

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

Closed
joefreeman wants to merge 2 commits into
Automattic:masterfrom
joefreeman:master
Closed

joefreeman wants to merge 2 commits into
Automattic:masterfrom
joefreeman:master

Conversation

@joefreeman

Copy link
Copy Markdown
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

LinusU commented Nov 16, 2015

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
Contributor Author

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

@LinusU

LinusU commented Nov 19, 2015

Copy link
Copy Markdown
Collaborator

@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