question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Control text leading trim

See original GitHub issue

Hello, 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:open
  • Created 2 years ago
  • Comments:12

github_iconTop GitHub Comments

1reaction
lojjiccommented, Mar 14, 2022

Thank you for the examples! I’m starting to understand better now. 😁

I’ve added a couple things to get closer:

  • textRenderInfo now includes capHeight and xHeight values
  • anchorY now accepts top-cap and top-ex keywords

I 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.

0reactions
souporseriouscommented, Mar 18, 2022

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 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found