-
-
Notifications
You must be signed in to change notification settings - Fork 778
Upgrade font_family to a list_property #3526
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
Conversation
Unlike every other backend's |
@mhsmith First of all, thanks a ton for helping me get the Chaquopy example app up and running. Its Python REPL is super handy for API exploration. Second — just to sum up what I've found from the source, Android's docs, and talking with you and Russ on Discord: all text widgets in the Android backend cache their default typeface and default font size, because those aren't the same for every kind of widget, specifically:
Have these been / do we expect these to remain stable? Is there a decent chance those defaults might change, or that other widgets might gain default font quirks, in future versions of Android? I ask for two interrelated reasons.
|
It's possible, they change the system theme fairly often.
Wouldn't that be covered by the same mechanism that handles the Button and TextInput differences? |
Okay then, safer to stick to caching everything's font across the board.
Currently the code applies the bold/normal and italic/normal values that are found on the interface; it doesn't distinguish between a normal that the user explicitly set vs. the default value. I can add a check for that, just to be safe. Correction: I was misreading the code a little, and had it backward. It's not that it would get overridden to normal; it's that the user wouldn't be able to make it normal even if they explicitly request it, because each of the two qualities is only applied if it's turned "on". |
Just laying out what I understand the expected behavior to be: Font Family
Bold / ItalicFor each of these, the default value is Font Size
|
...Now that I think about it, I was mixing up layers in my head. Differentiating between implicit and explicit |
Okay, maintaining status quo on behavior of Android fonts — that is, we're still good for now, and will still have a quirk if any widget ever gets a bold or italic font by default. I don't know if it's worth creating an issue for posterity, or if this thread is sufficient. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've flagged a couple of minor things inline, but otherwise I think this all makes sense.
I'd definitely like Malcolm to take pass at it - especially for the Android side of things. It looks OK to me, but I want to make sure we're not missing anything on Android as part of eagerly caching fonts on instantiation, rather than use.
The sites are back up. How do I rerun the Read the Docs build? I don't see an option to do so, nor, it occurs to me, do I even know where that's invoked. Edit: now a moot point because I made another change, but I'm still curious for future reference. |
If you're a project maintainer on RTD, the UI on the RTD build page has a "rebuild" option. Happy to add you as a maintainer if you want. |
I'd appreciate that, thanks! |
Could you take a look at this when you get a chance please, @mhsmith? |
Sorry, I'll look at it tomorrow. |
Co-authored-by: Malcolm Smith <[email protected]>
Wow, it was apparently over a year ago that I added
list_property
to Travertino. This finally makes use of it.As discussed briefly on Discord with @freakboy3742, the source of truth for Font objects is shifting slightly. Previously, if you created a Font object and it wasn't able to load its font face, it would fall back to system. Now, it throws an
UnknownFontError
— the fallback behavior is instead implemented one level "higher", inPack.apply
. This does mean that in the rare few cases where an end user creates their own Font object, they'll need to make sure the font family is valid.I made adjacent cleanups in some of the files I touched. Some were just typos or changes in wording, but I'll comment inline on a couple that are less self-evident.
PR Checklist: