fix(blitz-paint): synthetic italic oblique shears in opposite direction (leans left)

Open Beginner friendly
#1,614 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
frontend

Research direction

Start with the glyph transforms at packages/blitz-paint/src/text.rs:306-309 and packages/parley_code_editor/src/paint.rs:214-217, then check how each applies Affine::skew for synthetic italic or oblique text. The issue identifies the sign of the shear as the problem; done means both transforms lean glyphs forward to the right. The payload names no tests, so look for existing coverage of synthetic italic rendering before making a change.

Written by the indexing model from the issue text.

Description

Description

When synthetic italic or oblique is active (e.g. for fonts lacking an italic face when font-style: italic or font-style: oblique is specified), blitz-paint and parley_code_editor calculate the glyph skew transform using a positive horizontal shear:

Affine::skew(angle.to_radians().tan() as f64, 0.0)

In 2D graphics screen coordinates (Y-down), ascenders lie at negative Y relative to baseline (y < 0).
Kurbo's Affine::skew(skew_x, 0.0) evaluates coordinates as:

x' = x + skew_x * y
y' = y

With skew_x = +tan(angle) > 0, points above the baseline (y < 0) yield x' = x + (+tan) * (-|y|) < x, leaning ascenders to the left (\\) instead of standard italic slant to the right (/).

Negating the tangent (-angle.to_radians().tan() as f64) ensures x' = x + (-tan) * (-|y|) > x, shearing ascenders forward in the +X direction (/).

Minimal Reproduction
<!DOCTYPE html>
<html>
<head>
<style>
  @font-face {
    font-family: 'ReproNormalOnly';
    src: local('Helvetica');
    font-style: normal;
  }
  .italic {
    font-family: 'ReproNormalOnly';
    font-style: italic;
  }
</style>
</head>
<body>
  <p class=italic>Synthetic Italic</p>
</body>
</html>
References
Dominant language
Rust
Stars
4.4k
Forks
267
Avg merge
6h 38m
Merged PRs (30d)
164

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DioxusLabs/blitz

All issues in DioxusLabs/blitz

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.