Skip to content

Conversation

@leo60228
Copy link
Member

On some platforms, there are thin gaps between block characters, presumably due to rounding error. This adds slight negative kerning between blocks to heavily reduce it. It's not eliminated entirely (possibly due to glyph caching quirks?), annoyingly.

Before:
before, with gaps
After:
after, with fewer gaps

This approach makes long strings of blocks slightly narrower. The width of individual blocks could be increased to compensate, but I wasn't sure this was really necessary.

@leo60228 leo60228 requested a review from rossjrw October 23, 2025 21:50
@emmiegit
Copy link
Member

I was wondering what was causing that.

@rossjrw
Copy link
Member

rossjrw commented Oct 23, 2025

@leo60228 any chance you could add a screenshot with "scp-[4 redacts]" to check it still feels like the right width?

@leo60228
Copy link
Member Author

Before:
before, with gaps
After:
after, with fewer gaps and imperceptibly narrower width

@leo60228
Copy link
Member Author

I added an emoji form, which should appear identically including respecting font color but go through a codepath less likely to have issues with this case (it's non-deterministic, but I haven't been able to reproduce the issue after this change). I've tested this in Firefox/Chromium/WebKit on Linux, but would appreciate testing on other platforms, since several aspects of font rendering is OS-specific. For reference, the SVG used is:

<svg xmlns="http://www.w3.org/2000/svg">
	<rect fill="currentColor" style="fill: context-fill;" x="-20" y="-2371" width="1800" height="2880"/>
</svg>

(Firefox doesn't implement currentColor as required by the final SVGinOT spec, and instead implements context-fill from earlier drafts. By my testing and reading of the relevant specs, this markup should use context-fill on browsers where it's considered a valid keyword, and currentColor otherwise.)

@rossjrw
Copy link
Member

rossjrw commented Oct 24, 2025

Windows 10, Firefox 144, 125% OS scaling:

Current RedactRect has lots of lines (every 1-3 characters), new RedactRect has much fewer lines (every 24ish characters).

Screenshot image

Windows 10, Firefox 144, 100% OS scaling:

Current RR has a line every 1-2 characters. New RR has a line about every 4 characters.

Screenshot image

Android, Firefox:

No lines visible in either current or new RR

(There are some lines visible in the screenshot but it's waaayyy bigger than my phone is, and they're not visible on screen at all. Except the ones in the non-RR bit)

Screenshot

MacOS, Firefox 144:

No lines visible in either current or new RR.

Screenshot is of the built in retina screen. Same result on a standard 1440p screen at 100% and 125% scaling.

Screenshot image

MacOS, Safari:

Exactly the same result as Firefox so I'm not going to bother screenshotting it, except that the pre-RR sample had tons of lines (every 2 characters).


I could also test on Linux but I figure you already covered that.

Overall review: new RR improves over current RR and does not introduce any regressions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants