Skip to content
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

GlyphBrush bundles upstream GlyphBrush and Pipeline #23

Closed
dhardy opened this issue Nov 2, 2019 · 2 comments
Closed

GlyphBrush bundles upstream GlyphBrush and Pipeline #23

dhardy opened this issue Nov 2, 2019 · 2 comments
Labels
question Further information is requested

Comments

@dhardy
Copy link

dhardy commented Nov 2, 2019

I wish to calculate an optimal window size (using GlyphCruncher::glyph_bounds), then create that window. Resizing the window after creation has unwanted side-effects.

Using wgpu_glyph it does not appear that I am able to do this, at least without creating the GlyphBrush twice. Yet from examining the source, it appears that the only reason for this is that GlyphBrush encapsulates both the glyph_brush and the pipeline.

Probably the simplest solution (though awkward) is to allow a GlyphBrush to be created from an existing object of the upstream GlyphBrush type.

@hecrj hecrj added the question Further information is requested label Nov 2, 2019
@hecrj
Copy link
Owner

hecrj commented Nov 2, 2019

Resizing the window after creation has unwanted side-effects.

Do you mean for your particular use case? wgpu_glyph should work well as long as you resize your swap chain correctly.

Using wgpu_glyph it does not appear that I am able to do this, at least without creating the GlyphBrush twice.

Could you elaborate a bit on this? You only need wgpu::Device to create a GlyphBrush, which can be obtained in wgpu without a window. You do not need a window for rendering either, as you can obtain a TextureView from any Texture. Maybe there is something particular to your use case that I am missing?


In any case, I agree that the GlyphBrush struct is doing way too much stuff. We should split it and define clear boundaries, maybe exposing the Cache as a first-class concept of the API.

I will most likely end up building a new text rendering crate at some point for iced with text shaping support. I'd like to wait until then before refactoring wgpu_glyph.

@dhardy
Copy link
Author

dhardy commented Mar 3, 2020

I finally got around to solving my issue by resizing after creation: kas-gui/kas#69

Regarding the other point about caches, I just opened this: alexheretic/glyph-brush#97

@dhardy dhardy closed this as completed Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants