Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
So far we can find several components using both syntax: font-weight: normal
and font-weight: 400
, or font-weight: bold
and font-weight: 700
in the Umami theme.
font-weight: normal
is the same asfont-weight: 400
and it's not a matter of browser compatibility since all accept both syntax.
Proposed resolution
Decide if we should use font-weight: normal
/font-weight: 400
and font-weight: bold
/font-weight: 700
and implement it.
Remaining tasks
- Decide which syntax we should use.
- Review the current code to be sure we use the chosen syntax everywhere.
Comment | File | Size | Author |
---|---|---|---|
#15 | numeric-values-2950158-15.patch | 5.71 KB | Vidushi Mehta |
#9 | font_weight_umami-2950158-9.patch | 7.64 KB | Shiva Srikanth T |
Comments
Comment #2
Eli-T"font-weight: normal" is much more prevalent in core than font-weight: 400':
so I'd suggest going with "font-weight: normal" all other things being equal.
Comment #3
ckrinaSorry, I wasn't specific enough: we should decide between:
-
font-weight: normal
orfont-weight: 400
-
font-weight: bold
orfont-weight: 700
In general I prefer using the numbered weight because it clearly indicates which one are you using (IE
font-weight: normal
can be fauxfont-weight: 200
).But since this project is clearly delimited, I'd be OK with
font-weight: normal
andfont-weight: bold
(even I'd prefer the numbered one ;) ).Comment #4
ckrinaComment #5
ckrinaComment #6
ankitjain28may CreditAttribution: ankitjain28may as a volunteer and at Google Summer of Code commentedAdded the patch as per the above requirements.
Comment #7
ankitjain28may CreditAttribution: ankitjain28may as a volunteer and at Google Summer of Code commentedComment #8
Shiva Srikanth T CreditAttribution: Shiva Srikanth T as a volunteer commented@ankitjain28may issue is related to Component Umami demo but you have created a patch for core misc, module and theme css files, patch should be created for umami theme.
Comment #9
Shiva Srikanth T CreditAttribution: Shiva Srikanth T as a volunteer commentedUploaded new patch.
Comment #13
Vidushi Mehta CreditAttribution: Vidushi Mehta at gai Technologies Pvt Ltd commented#9 has changed the font-weight on all files which was decided according to this issue in the comments thread. Marking as RTBC.
Comment #14
lauriiiUmami uses webfonts which we should take that into account to the consideration since most of Drupal core haven't been built webfonts in mind. As pointed out by @ckrina on #3, the mapping of weight names to numeric values might be different between browsers. Since we are planning to only import specific weights of the webfont in #2943657: Embedding only needed weights for Open Sans and Scope One we should use the numeric values to ensure that webfont for the weight is included.
Comment #15
Vidushi Mehta CreditAttribution: Vidushi Mehta at gai Technologies Pvt Ltd commentedAdded a patch which has numeric values on all the files.
Comment #16
markconroy CreditAttribution: markconroy as a volunteer and at Annertech commentedI agree with @lauriii in #14.
It ensures we have a consistent experience across browsers and is more future-proof.
Comment #17
markconroy CreditAttribution: markconroy as a volunteer and at Annertech commentedThanks @Vidushi Mehta
The patch from #15 applies cleanly and replaces all instances of
font-weight: <word>
.This will be even better when #2943657: Embedding only needed weights for Open Sans and Scope One lands. Thanks for you work.
Comment #20
lauriiiThank you for the review and documenting the steps you took on reviewing the patch!
Looks good! I also confirmed that the patch still changes all the instances of font-weight to use numeric values.
Committed cdbb68b and pushed to 8.6.x. Also cherry-picked e3e7141 and pushed to 8.5.x. 🚀Thanks!