seek-oss / capsize

Flipping how we define typography in CSS.
https://seek-oss.github.io/capsize/
MIT License
1.51k stars 37 forks source link

xWidthAvg: Update character frequency weightings data source #167

Closed michaeltaranto closed 7 months ago

michaeltaranto commented 7 months ago

Character frequency weightings used to calculate the xWidthAvg metrics were previously hard coded internally, and were an adaption from a frequency table on Wikipedia.

We now generate these weightings based on the abstracts of WikiNews articles, making it possible to add support for other languages that make use of non-latin unicode subsets, e.g. Thai.

The updated xWidthAvg metrics are very close to the original hard coded values. This results in either no or extremely minor changes to the generated fallback font CSS, meaning we don't expect any notable changes to consumers, with the benefit being this lays the ground work to support additional language subsets in the future.


Note for the reviewer

This PR is in preparation for a follow up PR that introduces unicode subset support. So some refactoring in this PR is in service of a cleaner diff for the next PR.

changeset-bot[bot] commented 7 months ago

🦋 Changeset detected

Latest commit: 9161d71368486ecfcb137a8784919c7891032df5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ------------------- | ----- | | @capsizecss/metrics | Minor |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR