Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Fix incorrect math surrounding text transforms in CGContextDrawGlyphRun#1188

Merged
ms-jihua merged 2 commits into
microsoft:CT-DWfrom
ms-jihua:fix_math
Oct 19, 2016
Merged

Fix incorrect math surrounding text transforms in CGContextDrawGlyphRun#1188
ms-jihua merged 2 commits into
microsoft:CT-DWfrom
ms-jihua:fix_math

Conversation

@ms-jihua

Copy link
Copy Markdown
Contributor

The text transforms were being incorrectly applied, directly concatenated onto the final transform.
The text transform must be applied in text space (centered on the glyph run, inverted)

Fixes #1113
Fixes #1135

The text transforms were being incorrectly applied, directly concatenated onto the final transform.
The text transform must be applied in text space (centered on the glyph run, inverted)

Fixes microsoft#1113
Fixes microsoft#1135
// Technically there should be a horizontal translation to the center as well,
// but it's to the center of _each individual glyph_, as the reference platform applies the text matrix to each glyph individually
// Uncertain whether it's ever going to be worth it to support this using DWrite, so just ignore it for now
transform = CGAffineTransformConcat(CGAffineTransformMake(1, 0, 0, -1, 0, baselineCenterDelta), transform);

@rajsesh rajsesh Oct 19, 2016

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could skip the initial CGAffineTransformConcat since transform is identity. #Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or rather: CGAffineTransform transform = CGAffineTransformMake(...);


In reply to: 84172077 [](ancestors = 84172077)

@DHowett-MSFT

Copy link
Copy Markdown

So this anchors the bottom left of the text at the text position?
If the context is transformed 1 0 0 -1 0 0, it then anchors the top left of the upside-down text at the text position?

@DHowett-MSFT

Copy link
Copy Markdown

:shipit:

@ms-jihua

Copy link
Copy Markdown
Contributor Author

More or less yes. At the baseline instead of the bottom/top left corner though.


In reply to: 254951164 [](ancestors = 254951164)

@ms-jihua ms-jihua merged commit 222ec5f into microsoft:CT-DW Oct 19, 2016
@ms-jihua ms-jihua deleted the fix_math branch February 1, 2017 22:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants