-
-
Notifications
You must be signed in to change notification settings - Fork 738
Support CSS font size keywords #3242
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
base: main
Are you sure you want to change the base?
Conversation
Add: CSS keyword constants to Travertino and update core style component #17 Update: testbed to handle CSS keywords and improve coverage #24 Add: CSS font size keywords and tests for iOS #5 #10 (#18) Add: windows CSS keyword support and tests #6 #11 (#22) Add: Cocoa CSS keywords support and tests #3 #8 (#23) Add: Gtk css keywords support and tests #4 #9 (#27) Fix: remove xxxl keywords #29 Docs: add css keywords to style reference (#33) Add: Android support for CSS font keywords and tests #2 #7 (#28) ---------- Co-authored-by: Phoebe Schwartz <[email protected]> Co-authored-by: KlaraLindemalm <[email protected]> Co-authored-by: Jacmol <[email protected]> Co-authored-by: carltestar <[email protected]>
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.
Thanks, this looks very thorough.
fix: remove all relative_font_size instances and update documentation --------- Co-authored-by: phoebe <[email protected]>
Hello! We've made the changes to remove the xxxl size and the relative sizes. It passes all of the CI checks but for some reason, it is not passing the docs build. Any ideas as to why? |
It looks like it might be related to RTD's recent switchover to their new management UI. Your original docs builds seems to have fallen into a crack somewhere; I've manually restarted the build, and it seems to have worked. Apologies for the confusion! |
Updated code from review.
@mhsmith I've implemented the changes you suggested! Let me know if there is more we can do for this PR. |
@peschwartz Thanks for the update - @mhsmith and I are both travelling for work at the moment, so we're a little busy; we'll take a look as soon as we get a chance. |
font_size = DEFAULT_FONT.Size | ||
font_size *= FONT_SIZE_SCALE[self.interface.size] |
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.
font_size = DEFAULT_FONT.Size | |
font_size *= FONT_SIZE_SCALE[self.interface.size] | |
font_size = DEFAULT_FONT.Size * FONT_SIZE_SCALE[self.interface.size] |
base_size = NSFont.systemFontSize | ||
font_size = base_size * FONT_SIZE_SCALE[self.interface.size] |
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.
base_size = NSFont.systemFontSize | |
font_size = base_size * FONT_SIZE_SCALE[self.interface.size] | |
font_size = NSFont.systemFontSize * FONT_SIZE_SCALE[self.interface.size] |
default = base_size * FONT_SIZE_SCALE[self.interface.size] | ||
return default |
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.
default = base_size * FONT_SIZE_SCALE[self.interface.size] | |
return default | |
return base_size * FONT_SIZE_SCALE[self.interface.size] |
I'm not able to apply these changes because you didn't enable the "allow edits by maintainers" option. Please do that in future PRs. Meanwhile, you don't need to do anything; I'll merge this branch by creating a separate PR. |
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.
OK, actually there are a few more issues, so I'll leave you to deal with them. Please enable the "allow edits by maintainers" option on this PR anyway – it's at the bottom of the right hand column.
And one more workflow point – please don't click the "resolve" button on review comments – leave that to the person who posted it. This will make it easier to keep track of what's left to be reviewed. (If you accept a suggested change, then it will resolve automatically – this is fine.)
Thanks for your updates, and sorry this is taking so long, but I think we're almost finished now.
@@ -0,0 +1 @@ | |||
Added support for absolute CSS font size keywords in Android, Cocoa, GTK, iOS, and Windows. |
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.
misc
change notes are hidden in the release notes. This is a publicly-visible feature, so the file should be renamed to 1814.feature.rst
.
@@ -96,6 +99,7 @@ def typeface(self, *, default=Typeface.DEFAULT): | |||
def size(self, *, default=None): | |||
"""Return the font size in physical pixels.""" | |||
context = MainActivity.singletonThis | |||
base_size = 14 |
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.
This size will need to be scaled in a similar way to the TypedValue.applyDimension
code below. Otherwise, the text will be too small on high DPI devices (which is virtually all of them). For example, if I edit examples/font_size
to use the font size keywords:
As mentioned at #1814 (comment), on Android, as far as I know, "medium" should be the same as the default for every widget except the TextInput, where the default should be larger.
Please make a similar visual check on as many other platforms as you can, and let me know which ones you've checked. Windows in high DPI mode is the most likely one to have a problem.
When testing on Android, I got this error:
And sure enough, |
That is... shocking... how has that not caused problems? I can only presume it's because all the existing usage is |
Maybe it's been treated as an implicit namespace package, in which case Chaquopy's custom importer may be the reason why it fails on that platform. Still not sure why it isn't breaking the testbed as well, but it's not worth looking into any further. |
Hey @mhsmith, We've looked at this: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork and we aren't seeing this option to allow you maintainer access. How do you think we should proceed? I can give you direct access to our repository if that works. |
It should be at the bottom of the right hand column, as shown in the screenshot on that page. If you can't see it, never mind, I can continue suggesting the changes to you, as we have been doing so far. |
Added backend support for CSS font-size keywords to Android, Cocoa, iOS, GTK, and Windows and updated the core and travertino testing suites. Includes updated documentation.
Fixes #1814
PR Checklist: