Thanks alexs. I found another solution, which is to search for mirrored components and slant them negative twice as much. I did some manual testing which works fine. But the angle is a bit off when I do it by script, which I don’t understand?
and when I slant the component by script it seems to ignore the middle x-height origin? again what works manually, but it’s ignored in the script.
# 6) Cursify all mirrored components in the Italic masters.
mirrored_component_layers = []
for master in new_masters:
if master.internalAxesValues[italic_axis_id] == 1:
for glyph in font.glyphs:
layer = glyph.layers[master.id]
x_height_half = master.xHeight / 2.0
italic_angle_twice = -abs(italic_angle * 2.0)
if not layer.components or not layer.isMasterLayer:
continue
# check for mirrored components
for component in layer.components:
if component.transform[0] == -1 and component.transform[3] != -1:
# Apply the italic transformation to mirrored components
layer.slantX_origin_doCorrection_checkSelection_(italic_angle_twice, x_height_half, True, True)
break
elif component.transform[0] != -1 and component.transform[3] == -1:
# Apply the italic transformation to mirrored components
layer.slantX_origin_doCorrection_checkSelection_(italic_angle_twice, x_height_half, True, True)
break
And last question. All my kerning is not copied to the new italic layers, can you spot why? It should be included in this part right?
I would strongly recommend to also set alignment type to 3.
Instead of rotating 180°, it’s generally a good idea to vertically and horizontally flip once. That achieves the same result, but eliminates rounding errors.
Yes, the result is the same, but I’ve found there to be rounding errors occasionally, because I often use the rotate palette with 90°, rotating 90° twice sometimes resulted in the vertical position not to be correct.
I’m not sure that would fix anything. I might be wrong. But as of now I’ve done my parens, brace, brackets, exclamdown and questiondown with flipped. Which works fine and my issue seems to be a bit different.
I have these issues:
I found another solution, which is to search for mirrored components and slant them negative twice as much. I did some manual testing which works fine. But the angle is a bit off when I do it by script, which I don’t understand? and when I slant the component by script it seems to ignore the middle x-height origin? again what works manually, but it’s ignored in the script.
# 6) Cursify all mirrored components in the Italic masters.
mirrored_component_layers = []
for master in new_masters:
if master.internalAxesValues[italic_axis_id] == 1:
for glyph in font.glyphs:
layer = glyph.layers[master.id]
x_height_half = master.xHeight / 2.0
italic_angle_twice = -abs(italic_angle * 2.0)
if not layer.components or not layer.isMasterLayer:
continue
# check for mirrored components
for component in layer.components:
if component.transform[0] == -1 and component.transform[3] != -1:
# Apply the italic transformation to mirrored components
layer.slantX_origin_doCorrection_checkSelection_(italic_angle_twice, x_height_half, True, True)
break
elif component.transform[0] != -1 and component.transform[3] == -1:
# Apply the italic transformation to mirrored components
layer.slantX_origin_doCorrection_checkSelection_(italic_angle_twice, x_height_half, True, True)
break
And last question. All my kerning is not copied to the new italic layers, can you spot why? It should be included in this part right?
You should never slant/transform components. They will pick up the slanted shapes from the base glyph. Set up the components as I showed above (rotate 180° or click both slant buttons in the transform panel).
You will run into problems once you start building italic/slanted parentheses. A flipped italic parenthesis will slant into the opposite direction if merely flipped instead of rotated. Please always rotate instead of flipping one-dimensionally.
Do you know why my kerning pairs are not copied? I guess the problem is this line: font.copyGlyphs_sourceFontMasterID_targetFontMasterID_addMissing_(font, master.id, new_master.id, addMissing)
How is it going with your Italify script, is it still very buggy? Cause it would be awesome to be able to call from a script like this.
Kerning is not stored in your glyphs. It’s its own dictionary. You can find it as Font.kerning. Use the master IDs to access the kerning for each master.
I haven’t found the time to work on Italify much more, I’m okay with where it is right now (although I know it’s extremely far from being easily usable and reliable). It’s on my mind, though, thanks for the reminder.