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

[Feature Request] Change estimate_text_size to take &mut self #535

Open
ecton opened this issue Jan 12, 2024 · 0 comments
Open

[Feature Request] Change estimate_text_size to take &mut self #535

ecton opened this issue Jan 12, 2024 · 0 comments

Comments

@ecton
Copy link

ecton commented Jan 12, 2024

What is the feature ?

I think that DrawingBackend:estimate_text_size should accept an &mut self instead of &self.

(Optional) Why this feature is useful and how people would use the feature ?

I think that it's reasonable to expect that a drawing surface needs to alter its state (current font settings) to be able to perform text measurements.

I say this because while adding plotters support for Kludgine, I ended up switching from implementing DrawingBackend directly on my renderer type to implementing it on a RefCell<&mut Renderer<..>>, because my set_font_family function requires &mut self.

If this function accepted an &mut self, I could avoid a second layer of RefCell -- the first layer being the one DrawingArea utilizes already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant