Skip to content

FOP-3356: simulate-style does not slant an italic face or stroke a bold one, and strokes at 1/35 em - #125

Open
plutext wants to merge 1 commit into
apache:mainfrom
plutext:FOP-3356
Open

plutext wants to merge 1 commit into
apache:mainfrom
plutext:FOP-3356

Conversation

@plutext

@plutext plutext commented Oct 6, 2026

Copy link
Copy Markdown

Fixes FOP-3356.

PDFPainter.startSimulateStyle synthesised a style from the font entry's simulate-style flag and the triplet
alone: a bold triplet was stroked with a fixed 0.31543pt line and an italic one sheared by 0.3333, whatever the
face. So an italic face registered for a bold italic triplet was slanted a second time, a bold face registered
for a bold italic one was stroked again, and the stroke, right at about 11pt, was too light at larger sizes and
too heavy at smaller ones.

The change. In startSimulateStyle and endSimulateStyle, used by both drawTextWithDX and
drawTextWithDP:

  • an italic triplet is sheared only where the face's italic angle (CustomFont.getItalicAngle(), from the post
    table) is 0;
  • a bold triplet is stroked only where the face's weight class (CustomFont.getWeight(), from OS/2) is below
    700; an unknown weight, 0, counts as not bold, as before;
  • the stroke is the font size / 35, which is what Word draws for a synthetic bold at every size; at 11.04pt it
    is the former 0.31543.

Only the painted glyphs change, never layout.

Test. PDFPainterTestCase: an italic face not sheared, a bold face not stroked, and the stroke at 22.08pt
(0.63086); each fails without the change. The two existing simulate-style tests now run at 11.04pt, where the
stroke is the former constant. With the change, the fop-core suite passes, 3679 tests and 0 failures, and
checkstyle reports 0 violations.

🤖 Generated with Claude Code

…ld one, and strokes at 1/35 em

PDFPainter.startSimulateStyle synthesised a style from the font entry's simulate-style flag and
the triplet alone: a bold triplet was stroked with a fixed 0.31543pt line and an italic one
sheared by 0.3333, whatever the face. So an italic face registered for a bold italic triplet was
slanted a second time, a bold face registered for a bold italic one was stroked again, and the
stroke, right at about 11pt, was too light at larger sizes and too heavy at smaller ones.

Now an italic triplet is sheared only where the face's italic angle is 0, and a bold one stroked
only where the face's weight class is below 700 (an unknown weight counting as not bold, as
before). The stroke is the font size / 35, which is what Word draws for a synthetic bold at every
size; at 11.04pt it is the former 0.31543. Only the painted glyphs change, never layout.

Tests: PDFPainterTestCase, an italic face not sheared, a bold face not stroked, the stroke at
22.08pt (0.63086); each fails before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant