Skip to content

Conversation

@devunt
Copy link

@devunt devunt commented Nov 26, 2025

Bitmap glyphs use Y-down coordinate system (top at y=0), while outline/COLR fonts use Y-up (baseline at y=0). When glyph_transform (skew for synthetic italic) is applied to bitmap glyphs, the skew origin is at the top-left corner instead of the baseline, causing the italic effect to lean in the wrong direction.

Fix

  • Negate the shear coefficients to account for Y-down coordinates
  • Apply the skew around the bottom of the image (y=height) instead of the top (y=0)

Screenshots

CleanShot 2025-11-26 at 22 32 26 CleanShot 2025-11-26 at 22 32 50

@DJMcNab
Copy link
Member

DJMcNab commented Nov 26, 2025

I think it would probably be easier to review if you merged this and #1306 into a single PR, as they're touching very similar code.

Would you be willing to add some tests here? I believe that the existing test in

#[test]
#[cfg_attr(skip_gpu_tests, ignore)]
fn little_bitmap() {
let font_size = 10.;
let scene = encode_noto_bitmap(TEXT, font_size);
let params = TestParams::new(
"little_bitmap",
(font_size * 10.) as _,
(font_size * 1.25).ceil() as _,
);
snapshot_test_sync(scene, &params)
.unwrap()
.assert_mean_less_than(0.001);
}
has most of the infra you'd need, and just needs to be copied to add a more interesting transform. You'll need to have git lfs installed.

My gut reaction here is that a much simpler solution is possible, possibly to both issues. But for awareness, I haven't looked too closely. Essentially, the issue in both cases is that the glyph_transform is applied before or after another transform in the pipeline, so the transform doesn't apply properly. I just want to double check that you have confirmed that there aren't any solutions of that form for this issue.

This is related to #1273, but there's nothing actionable to be taken from that PR here.

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.

2 participants