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

Configurable label font #774

Closed
thecodewarrior opened this issue Mar 29, 2020 · 3 comments
Closed

Configurable label font #774

thecodewarrior opened this issue Mar 29, 2020 · 3 comments
Labels
enhancement adds or requests a new feature widget concerns a particular widget

Comments

@thecodewarrior
Copy link
Contributor

It would be great if labels could have configurable fonts. One of my projects needs labels with monospaced text, but I don't want all the text in the UI to be monospaced. From what I can tell this isn't possible right now since at the moment Label's get_layout gets the font name from the theme. Probably the most elegant solution would be an Option<String> with the theme being used as the default if the font is None.

@cmyr
Copy link
Member

cmyr commented Mar 30, 2020

I agree this makes sense, and a PR would be welcome; font should work the same as color and size.

cc @futurepaul who has been thinking about this lately.

@cmyr cmyr added enhancement adds or requests a new feature widget concerns a particular widget labels Mar 30, 2020
@futurepaul
Copy link
Collaborator

I haven't tried anything out yet but ideally you can follow the example of the builder / setter pair we have for size and color. That way Label::new sets the font as theme::FONT_NAME and then the builder or setter updates that value, no need for an option. I'm curious if we can do KeyOrValue here as well, but I haven't used that yet with a String so no guarantees.

@thecodewarrior
Copy link
Contributor Author

thecodewarrior commented Mar 30, 2020

theme::FONT_NAME is the key for the environment, not the actual font name. If we don't use an Option then we either store the env key, meaning we couldn't directly set the font name, or directly store the font name and grab the theme font name once during creation, neither of which are good ideas IMO.

edit: Looking into it, I think making KeyOrValue work is the best option.

thecodewarrior added a commit to thecodewarrior/druid that referenced this issue Mar 30, 2020
thecodewarrior added a commit to thecodewarrior/druid that referenced this issue Mar 30, 2020
thecodewarrior added a commit to thecodewarrior/druid that referenced this issue Apr 3, 2020
thecodewarrior added a commit to thecodewarrior/druid that referenced this issue Apr 3, 2020
thecodewarrior added a commit to thecodewarrior/druid that referenced this issue Apr 3, 2020
@cmyr cmyr closed this as completed in df88830 Apr 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement adds or requests a new feature widget concerns a particular widget
Projects
None yet
Development

No branches or pull requests

3 participants