Control text leading trim
See original GitHub issueHello, thank you for this amazing library! I’m currently using the Text
component in @react-three/drei
and wondering if there’s a way to achieve control over leading trim? I was looking to use Capsize to possibly do it, but then came across #82 which says blockBounds
and visibleBounds
were added which seems like could be helpful here. I would love a first-class way to control this, but interested if you have a suggestion to hack a solution for now? Happy to help look into a PR for support if you’re interested 🙂
Issue Analytics
- State:
- Created 2 years ago
- Comments:12
Top Results From Across the Web
Leading-Trim: The Future of Digital Typesetting - CSS-Tricks
leading -trim is a suggested new CSS property that lets us remove the extra spacing in every font so that we can more...
Read more >Leading-Trim: The Future of Digital Typesetting | by Ethan Wang
Leading -trim is a new CSS property that the CSS Working Group is introducing. Just as the name suggests, it works like a...
Read more >Caveats and Uses for Leading Trim (Text Crop)
The W3C working group have a draft proposal for a leading-trim property which allows authors to control the white space above and below...
Read more >Trim and TrimEnds functions in Power Apps - Microsoft Learn
The Trim function removes all spaces from a string of text except for single spaces between words. The TrimEnds function removes all spaces ......
Read more >Leading Trim is in the works! - Zell Liew
Leading Trim is a part of a new CSS Specification (currently being written by @fantasai) for improving text layout. leading-trim together ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you for the examples! I’m starting to understand better now. 😁
I’ve added a couple things to get closer:
textRenderInfo
now includescapHeight
andxHeight
valuesanchorY
now acceptstop-cap
andtop-ex
keywordsI think the big missing piece now is that the font sizing (and therefore line height) is solely based on the “em height” as defined in CSS, whereas you want to have it use the cap height as the basis, does that sound accurate? I’ll ponder this some more.
Ah, ok that makes way more sense now! Dividing the line height by the font size is exactly what I was looking for and looks like it works with Capsize as expected now 😎. I was definitely overcomplicating that lol.
Thank you so much for all of your help on this so far and for adding the extra needed info and features! Happy to help test the
fontSizeBasis
feature once it’s ready if you go that route 😃