adobe / adobe/balance-text

Miscalculation when using custom fonts

Open
#80 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.4k
Forks
77
PR merge metrics
No merged PRs in 30d

Description

Thanks for developing this amazing script!

I just wanted to flag this issue in case anyone else has experienced it.

I only notice the issue when loading a custom font (from MyFonts) where the text is be balanced across too many lines, so text that could easily fit on 2 lines would render over 3 lines.

I think the issue can be traced back to the **nowrapHeight** calculation. I've fixed the issue for myself by changing line 313 from `$this.css('line-height', 'normal');` to `$this.css('line-height', '1');`

Contributor guide

Open the contributing guide

Research direction

Inspect line 313 where the nowrapHeight calculation sets line-height, then reproduce the issue with a custom MyFonts font and text that should fit on two lines. Done means the text no longer wraps across too many lines when the reported line-height adjustment is applied.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.