-
Notifications
You must be signed in to change notification settings - Fork 14
add support for creating variation fonts #20
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
Conversation
src/font_face.rs
Outdated
|
||
pub fn has_variations(&self) -> bool { | ||
unsafe { | ||
let face5: Option<ComPtr<IDWriteFontFace5>> = (*self.native.get()).query_interface(&IDWriteFontFace5::uuidof()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can just match on it
&self, | ||
simulations: DWRITE_FONT_SIMULATIONS, | ||
axis_values: &[DWRITE_FONT_AXIS_VALUE], | ||
) -> Option<FontFace> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we have some sort of an error code here (and return Result
)?
src/font_face.rs
Outdated
axis_values: &[DWRITE_FONT_AXIS_VALUE], | ||
) -> Option<FontFace> { | ||
unsafe { | ||
let face5: Option<ComPtr<IDWriteFontFace5>> = (*self.native.get()).query_interface(&IDWriteFontFace5::uuidof()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this how extension methods are discovered in dwrote? I wonder if the query_interface would be better to call at the construction site and just cache this ComPtr<IDWriteFontFace5>
somewhere.
I added support for caching the FontFace5 on demand - I don't want to impose the cost of querying it on all fonts, just the ones that need it for variations. As for errors, the errors are mostly dealt with ahead of time in Gecko, and we just need a pass or fail here with Option being what is most consistent with dwrote. This is a niche case where I do not believe having to construct a new error type just for it would add any value, since it would require decoding HRESULTs and other nastiness. And I don't know there's anything we can do with the HRESULT either. |
Is it really going to show up in any profiles though? I imagine we do hundreds of COM calls on a font, so querying the interface at load time shouldn't be a concern. |
It mirrors the way we deal with it in Gecko. There's no need to incur the
expense when for 99% of fonts it is not needed at all.
…On Fri, Sep 21, 2018 at 4:36 PM Dzmitry Malyshau ***@***.***> wrote:
I don't want to impose the cost of querying it on all fonts, just the ones
that need it for variations.
Is it really going to show up in any profiles though? I imagine we do
hundreds of COM calls on a font, so querying the interface at load time
shouldn't be a concern.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#20 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABY60fnZWXJ7KszGFpCbUOF8SigI2Azuks5udU3ngaJpZM4W0EIp>
.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be great if somebody from regular reviewers would also take a look before merging.
hmm, doesn't look like there are permanent reviewers |
📌 Commit 8dbd988 has been approved by |
add support for creating variation fonts This is necessary to fix downstream Gecko bug https://bugzilla.mozilla.org/show_bug.cgi?id=1441323
☀️ Test successful - status-appveyor |
This is necessary to fix downstream Gecko bug https://bugzilla.mozilla.org/show_bug.cgi?id=1441323