*automaticAlignment*
Defines whether the component is automatically aligned.
Type: bool
*alignment*
New in version 2.5.
TODO
What’s the difference between those? Please for API and coding, as well as UI considerations.
I am working on a plugin for displaying those and related statuses, but I am confused by those slightly different properties. In the UI you can only Enable/Disable “Automatic Alignment”. But by enabling and disabling some components in a test setup, as well as reading those 2 properties, I can’t get my head around which is doing what.
B)
It also appears that automaticAlignment returns True or False, while alignment can return 0, 1 and -1. What does that mean?
C)
Also it appears that if I start with one component, and set Automatic Alignment in the UI for it, and copy/paste it, it will have the same state for automaticAlignment (as expected). However if I disable and re-enable that second component’s Alignment in the UI, I can never get the Automatic Alignment state back, only the alignment. Urgh, this is so confusing.
here’s my Skedge snippet that you can try with for example 2 “acutecomb” instances in another random glyph:
from AppKit import NSColor
alignmentColors = {
-1 : NSColor.redColor(),
0 : NSColor.yellowColor(),
1 : NSColor.greenColor(),
}
for c in Glyphs.font.selectedLayers[0].components:
try:
alignmentColors[c.alignment].setFill()
c.bezierPath.fill()
except:
pass
if c.automaticAlignment:
NSColor.greenColor().setStroke()
c.bezierPath.stroke()
And which one is the one that the user sets in the UI: Context Menu > Enable/Disable Automatic alignment?
Now after you added .isAligned() here, we got even 3 different alignments on a component, and in my initial question I was already confused by the 2 different alignments.
Main reason why I ask:
My Plugin is supposed to show broken alignments, that happen when you generate an instance as a .glyphs file and add this as a new master to the font. (Which I hereby might consider a BTW-bug-report )
– while “breaks” means just, that the components don’t have the same alignment state as in the other masters.
And this adds to the confusion
So how can I tell?
I want to get the proper information, in order to visualize it properly, in order to have the user have a consistent setup through all masters (which can easily happen to not be, and it’s hard to spot single components that are for example not aligned in one master).
I try a little more later with a clean mind and let you know about potential continued struggles
The set value in .alignment might not be in effect as because of a number of reasons. Some base glyphs are not aligned by default (so it needs a GSAlignmentForce, a previous component is not aligned…