Closed Bug 1901556 Opened 1 year ago Closed 1 year ago

Flexbox layout cuts icon fonts in half

Categories

(Core :: Layout: Text and Fonts, defect)

Firefox 126
defect

Tracking

()

RESOLVED DUPLICATE of bug 479829

People

(Reporter: joshas, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0

Steps to reproduce:

Really peculiar issue with icon font rendering on https://develop.kde.org/hig/icons/ website.

Actual results:

Arrow icons, provided as arrow fonts, are cut into two and rendered on two lines.

Expected results:

Icon should not be split. If I set "flex-shrink: 0" on <a> element containing the icon, this fixes the issue. What is strange, that flex layout can split single object into two and render both on separate lines.

The Bugbug bot thinks this bug should belong to the 'Core::Layout: Text and Fonts' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Layout: Text and Fonts
Product: Firefox → Core

Those arrow icons are not "single objects". They're implemented as ligatures in the font: what looks like a > symbol is actually a ligature of the seven characters go-next.

When the flex item is being shrunk to its minimum width, this results in a line-break after go-.

Applying white-space: nowrap to the <a> element (or the ::before pseudos that generate the icons) would prevent this.

(The fact that when this happens, the icon renders in two fragments is a known issue, see bug 479829. But even if that were fixed, we'd probably still get two lines, with go- on the first and next on the second, and no resulting ligature. The workaround here is to ensure that the hyphen is not treated as a possible line-break, e.g. by setting white-space or text-wrap-mode appropriately. Or don't use potentially-splittable strings as the underlying encoding for what should be a single symbol. There are perfectly good Unicode codepoints for a RIGHT ARROW symbol. Then something reasonable would appear even if the icon font failed to load for whatever reason...)

Marking this as a dupe of bug 479829, which is about inappropriately painting fragments of a ligature when the underlying text is split across lines; but as noted in comment 2, in this example I think the site's CSS should be modified to handle this better, in which case the issue won't arise here.

Status: UNCONFIRMED → RESOLVED
Closed: 1 year ago
Duplicate of bug: 479829
Resolution: --- → DUPLICATE

Thank you for detailed explanation. Apologies for assuming this was a bug.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: