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

pf4: Unslash tabular zeros via subset & range #18145

Merged
merged 1 commit into from
Jan 10, 2023

Conversation

garrett
Copy link
Member

@garrett garrett commented Jan 9, 2023

Partially addresses #18125

This is the least intrusive change; fonts are embedded as to:

  • Not require buildsystem changes to ship font files
  • Not inflate number of connections from browser to Cockpit
  • Be easily portable to cockpit-machines, cockpit-podman, etc.

It's messy when viewing the stylesheet, so they're at the bottom of the file.

Additionally, subsetting and mapping these custom versions of the fonts are much smaller in size than forking the font and using our own custom version, which would be worse.

@garrett garrett requested review from martinpitt and KKoukiou January 9, 2023 17:39
@garrett
Copy link
Member Author

garrett commented Jan 9, 2023

The original subset and modified fonts, in otf, woff2, and base64 (in the woff2 directory):

🠫 RedHatText-0.zip

@garrett garrett marked this pull request as draft January 9, 2023 17:41
@garrett
Copy link
Member Author

garrett commented Jan 9, 2023

You can see it working in normal weights... but it looks like I messed up the medium weight:

image

I'll fix this tomorrow.

@garrett
Copy link
Member Author

garrett commented Jan 9, 2023

We also don't use tabular numbers everywhere that we should. Look at disks in this screenshot (the numbers on the usage bars, before "free" are all proportional):

image

@garrett garrett temporarily deployed to cockpit-dist January 9, 2023 17:45 — with GitHub Actions Inactive
Copy link
Contributor

@KKoukiou KKoukiou left a comment

Choose a reason for hiding this comment

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

Whoa @garrett that's cool.
Small question. I see in the pixel tests, even zeros without the slash changed enough to make pixel tests fail. Is that expected?

https://cockpit-logs.us-east-1.linodeobjects.com/pull-18145-20230109-173929-c6864d3a-fedora-36/pixeldiff.html#TestBonding-testBasic-networking-bond-settings-dialog

@garrett
Copy link
Member Author

garrett commented Jan 10, 2023

Small question. I see in the pixel tests, even zeros without the slash changed enough to make pixel tests fail. Is that expected?

Yes, see the pixel diff @ #18125 (comment). I didn't get the hinting exactly right, as I had to recreate the inner part without the slash. It's all sub-pixel and nobody would notice except the pixel tests.

After a bit of digging around: The zeros for bold in this PR are actually using bold, not semi-bold. PatternFly is using different weight numbers than I had expected. Fixing now. (They purposefully push the semibold as bold and bold as heavy... and don't use the heavy. I guess because they thought the bold was a bit too much.)

@garrett garrett force-pushed the fonts-tabular-deslash branch from c6864d3 to faa442a Compare January 10, 2023 08:49
@garrett garrett marked this pull request as ready for review January 10, 2023 08:50
@garrett
Copy link
Member Author

garrett commented Jan 10, 2023

I've dropped the unused weights and recalibrated the weight values (as PF uses nonstandard weights to make "bold" show a medium weight instead, as the bold is pretty heavy for a UI).

The adjusted weights are the screenshot was off last night. It has been fixed in the PR.

@garrett garrett temporarily deployed to cockpit-dist January 10, 2023 08:54 — with GitHub Actions Inactive
@KKoukiou
Copy link
Contributor

@garrett when you slide in this screenshot https://cockpit-logs.us-east-1.linodeobjects.com/pull-18145-20230110-084945-faa442a8-fedora-36/pixeldiff.html#TestStorageBasic-testBasic-partition
it's obvious that the new numbers are smaller width than the previous ones. I though we keep the width for the tabular nums as is. Any idea what's causing this issue?

@garrett
Copy link
Member Author

garrett commented Jan 10, 2023

@KKoukiou: No, they're not smaller width. I made sure to preserve the widths. Perhaps tabular isn't being respected and it's dropping in the normal 0, which is a different width? That's the only explanation I can see for differing widths. It seemed to work perfectly in the first try. The pixel diff I made @ #18125 (comment) shows that my original proof of concept had the same exact widths. I did try to optimize the default one a bit more to get the filesize down... I might've messed up the metadata when optimizing.

If that's the case, it's so minor that perhaps we should just standardize the 0 to the tabular width regardless. This would have the side effect of making the file size (and therefore base64 string) smaller too, since it would be just 1 glyph instead of 2.

Or I could try to make sure I don't delete metadata mapping.

Also, I think this is just wrong for hashes: Hashes should use probably monospace, not tabular numbers — that is, they should be fixed width and align. (And therefore, they'd have the 0 with the slash, as I didn't touch monospace.) But something like that should change outside this PR.

@KKoukiou
Copy link
Contributor

The new zero width is obviously bigger than the tabular one. it's visible in most of the screenshots
if you use the slider to move between the current and previous pixel test
https://cockpit-logs.us-east-1.linodeobjects.com/pull-18145-20230110-084945-faa442a8-fedora-36/pixeldiff.html#TestAccounts-testBasic-users-page-medium

I am not trying to be picky, but this cancels the point of tabular - fixed width nums

@garrett garrett force-pushed the fonts-tabular-deslash branch from faa442a to 6b3a103 Compare January 10, 2023 13:33
@garrett
Copy link
Member Author

garrett commented Jan 10, 2023

Original was correct; I did mess up trying to optimize the default. I swapped out the normal one to the original test and it works now.

(I didn't try to optimize the variants, so those should be fine.)

Slash from main:

Screenshot 2023-01-10 at 14-23-54 Networking - garrett@Bolt

This PR (now, fixed):

Screenshot 2023-01-10 at 14-30-06 Networking - garrett@Bolt

Diff:

image

@garrett garrett temporarily deployed to cockpit-dist January 10, 2023 13:40 — with GitHub Actions Inactive
@KKoukiou KKoukiou added the no-test For doc/workflow changes, or experiments which don't need a full CI run, label Jan 10, 2023
@KKoukiou KKoukiou force-pushed the fonts-tabular-deslash branch from 6b3a103 to 5868919 Compare January 10, 2023 14:46
KKoukiou
KKoukiou previously approved these changes Jan 10, 2023
@KKoukiou KKoukiou temporarily deployed to cockpit-dist January 10, 2023 14:52 — with GitHub Actions Inactive
Partially addresses cockpit-project#18125

This is the least intrusive change; fonts are embedded as to:
- Not require buildsystem changes to ship font files
- Not inflate number of connections from browser to Cockpit
- Be easily portable to cockpit-machines, cockpit-podman, etc.

It's messy when viewing the stylesheet, so they're at the bottom of the
file.

Additionally, subsetting and mapping these custom versions of the fonts
are much smaller in size than forking the font and using our own custom
version, which would be worse.

Note: PatternFly, and therefore Cockpit, uses non-standard weights so
medium (semi-bold) becomes bold. Additionally, only regular and medium
weights are used, so we're only including these two weights and their
italic variants in the override. (Leaving out light, bold, and heavy
weights and their italic variants).
@KKoukiou KKoukiou temporarily deployed to cockpit-dist January 10, 2023 15:32 — with GitHub Actions Inactive
@KKoukiou KKoukiou merged commit c3b1824 into cockpit-project:main Jan 10, 2023
@garrett garrett deleted the fonts-tabular-deslash branch January 11, 2023 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-test For doc/workflow changes, or experiments which don't need a full CI run,
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants