Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit a801484

Browse files
committed
[[ Bug 17782 ]] Take rotation component into account when measuring text bounds on Windows
1 parent 42352a6 commit a801484

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

libgraphics/src/context.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2738,7 +2738,7 @@ MCGFloat MCGContextMeasurePlatformText(MCGContextRef self, const unichar_t *p_te
27382738
if (t_success)
27392739
{
27402740
// MM-2014-06-02: [[ CoreText ]] We no no longer need to store the style - was only needed by Mac/ATSUI.
2741-
t_key_length = p_length + sizeof(p_length) + sizeof(p_font . fid) + sizeof(p_font . size) + sizeof(p_transform . a) + sizeof(p_transform . d);
2741+
t_key_length = p_length + sizeof(p_length) + sizeof(p_font . fid) + sizeof(p_font . size) + sizeof(p_transform . a) * 4;
27422742
t_success = MCMemoryNew(t_key_length, t_key);
27432743
}
27442744

@@ -2772,10 +2772,13 @@ MCGFloat MCGContextMeasurePlatformText(MCGContextRef self, const unichar_t *p_te
27722772
t_key_ptr += sizeof(p_font . size);
27732773

27742774
// MM-2014-04-16: [[ Bug 11964 ]] Store the scale of the transform in the key.
2775-
// We only need to store the (x?) scale of the transform as that is all that will effect the text measurment.
2776-
// (We are ignoring rotation for the time being).
2775+
// Don't store translation component of transform as it has no effect on bounds
27772776
MCMemoryCopy(t_key_ptr, &p_transform . a, sizeof(p_transform . a));
27782777
t_key_ptr += sizeof(p_transform . a);
2778+
MCMemoryCopy(t_key_ptr, &p_transform . b, sizeof(p_transform . b));
2779+
t_key_ptr += sizeof(p_transform . b);
2780+
MCMemoryCopy(t_key_ptr, &p_transform . c, sizeof(p_transform . c));
2781+
t_key_ptr += sizeof(p_transform . c);
27792782
MCMemoryCopy(t_key_ptr, &p_transform . d, sizeof(p_transform . d));
27802783
t_key_ptr += sizeof(p_transform . d);
27812784

libgraphics/src/w32text.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,8 +606,8 @@ MCGFloat __MCGContextMeasurePlatformTextScreen(MCGContextRef self, const unichar
606606
{
607607
XFORM t_xform;
608608
t_xform . eM11 = p_transform . a;
609-
t_xform . eM12 = 0;
610-
t_xform . eM21 = 0;
609+
t_xform . eM12 = p_transform . b;
610+
t_xform . eM21 = p_transform . c;
611611
t_xform . eM22 = p_transform . d;
612612
t_xform . eDx = 0;
613613
t_xform . eDy = 0;

0 commit comments

Comments
 (0)