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

Function : Returns the FontId corresponding to the given TextStyle #4901

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

rustbasic
Copy link
Contributor

@rustbasic rustbasic commented Aug 1, 2024

Function : Returns the FontId corresponding to the given TextStyle

Before : hard

    let font_id = TextStyle::Button.resolve(ui.style());

After : easy

    let font_id = ui.text_style_font_id(&TextStyle::Button);

I'm not sure what would be a good name for the function.

@rustbasic rustbasic closed this Aug 1, 2024
@rustbasic rustbasic reopened this Aug 1, 2024
@@ -544,6 +544,11 @@ impl Ui {
self.painter().layer_id()
}

/// Returns the `FontId` corresponding to the given `TextStyle`.
pub fn font_id_by_text_style(&self, style: &TextStyle) -> FontId {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to call it font_id() or text_style_font_id this would match with text_style_height

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you.
Both font_id() and text_style_font_id() looks good.
I'll have to wait for emilk's opinion.

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

Successfully merging this pull request may close these issues.

2 participants