applyTransform is Inaccurate

I’ve been trying to make a script that slants only the anchors and paths in a glyph, while leaving the component in tact and keeping the metrics in tact.

I made this script that uses an applyTransform on the whole layer, while also correcting for the italic offset and then moving the components back to it’s original position. The results are off compared to using the transformations panel and setting the origin to centre, centre of x-height.

One thing to note is on L:20: skewRadians = round(math.radians(skewAngle),2) I had to actually round it to 2 units otherwise it was really off in the end (in my example of skewing 13 degrees, it is 0.8 degrees off). But even now it’s off by 1 unit at the top of the glyphs.

What’s a better way to do this so that the transform is more accurate.

Please see this test file I’ve made. First master is the upright master, 2nd master is a decomposed master using transformation panel skew, last master uses my script (keeping components in tact):

Any help is much appreciated!!!

The easies would be to not slant the components to begin with.

But I tried your script and it seems to work correctly.