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 upPipe dwrite rendering options to rasterize_glyphs #770
Conversation
|
|
|
Do these options need to be stored per text run dynamically? For instance, can they be set once per frame / font or at init time perhaps? How often do they change? |
|
They can't be stored once per frame, it depends on the text run :(. Layout determines whether or not to enable these options for each text run. Even for the same font, depending on the font size, the options can change. |
|
OK, in that case, how about we rename the struct to just be GlyphOptions, and then we can specify which platforms each field applies to. This will allow us to use the same struct for other platform-specific options in the future if we need to. |
|
How do you specify how each field applies to which platform? I couldn't find something like that. I thought about going the GlyphOptions route but we don't use that for CG/Unix and I'd rather keep it very explicit what it's for. That's also why I passed it in as an Option rather than the full struct. |
|
You can use cfg() on each field to make it only available on that platform - but I was actually just suggesting a comment above each field specifying that this applies to Windows only. So I think if we just rename DWriteGlyphOptions -> GlyphOptions and add a comment for each of the two fields saying they only apply to Windows, that would be fine for now. |
|
I agree that |
|
Thanks for the review! Renamed and a comment added saying that GlyphOptions are only used on windows for now. |
|
@bors-servo r+ |
|
|
Pipe dwrite rendering options to rasterize_glyphs Essentially replicating this from gecko - http://searchfox.org/mozilla-central/source/gfx/2d/DrawTargetSkia.cpp#1390 I contemplated various ways to pass glyph rendering options to rasterize_glyphs either through traits or some struct, but we don't do anything special for linux or mac, so using a option seemed like the best thing, even though it exposes "dwrite" and forces the other platforms to use it. Nor could I find a clean way to pass derived types with data only as traits seemed to only pass down method interfaces. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/770) <!-- Reviewable:end -->
|
|
changm commentedJan 23, 2017
•
edited by larsbergstrom
Essentially replicating this from gecko - http://searchfox.org/mozilla-central/source/gfx/2d/DrawTargetSkia.cpp#1390
I contemplated various ways to pass glyph rendering options to rasterize_glyphs either through traits or some struct, but we don't do anything special for linux or mac, so using a option seemed like the best thing, even though it exposes "dwrite" and forces the other platforms to use it. Nor could I find a clean way to pass derived types with data only as traits seemed to only pass down method interfaces.
This change is