Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upChange add_native_font to accept Into<NativeFontHandle> #668
Comments
|
@MSleepyPanda at what stage in WR would you expect the actual |
|
In add_native_font, even before crossing ipc/thread boundaries: let msg = ApiMsg::AddNativeFont(key, native_font_handle);let msg = ApiMsg::AddNativeFont(key, native_font_handle.into());This way, we would have minimal code change and backend stays the same (therefore things shouldn't break). Although this is a backwards compatible and ~3 lines change, i prefer to ask first :) |
|
@MSleepyPanda I don't mind those 3 lines, but it seems non-obvious to me as to why the change would help any test case. If your backend API is generic over |
|
I agree that one could do this as well locally - but this would increase the plug and play effect, since this API relies on external crates (not defined in webrender-/traits) and therefore would benefit from this kind of interop. This is an idiomatic pattern, at least used often in crates, to accept This is more or less personal preference. I would like to see it beeing implemented in webrender because it would otherwise cause, even though small, "boilerplate" for implementors. |
Is it used in
Yes, but the difference here is that All in all, I'd be perfectly fine with the PR if this is going to save more than 3 lines of code on your side ;) |
|
@MSleepyPanda Are you still planning to work on this? |
|
Let's close for now since there isn't any activity. Please feel free to reopen if there's any plan to move forward with this. |
This change on add_native_font would allow more idiomatic conversion. This change is backwards compatible, so existing APIs won't need to adapt.
rust playground: poc
For context, i maintain rust-font-loader which uses wingdi instead of DirectWrite, because the winapi-rs bindings currently don't support directwrite in its full extend (e.g. detection of monospaced fonts). But DirectWrite has a interop interface, so conversion from and to LogFontW is possible. I implemented the necesseary parts for DWrote, if they land, one would be able to add a LogFontW as a NativeFontHandle.