mekkablue / mekkablue/InsertInflections
An incorrect node may be inserted
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
-
my environment
macOS Sierra 10.12.4
Glyphs 2.4.1 (983) -
detail
When the first segment and another segment have missing inflections, the inflection node for the first segment may be inserted at wrong location.
Assuming that the length of nodes are 23 at first, after an inflection is inserted at some segment, then the length of nodes becomes 26.
So the nodes of the first segment should be now consist of nodes[23], nodes[24], nodes[25] and nodes[0], but actually nodes[20], nodes[21], nodes[22] and nodes[0] are referenced because numberOfNodes is not updated. Therefore computeInflection may calculate a wrong inflectionTime for the first segment.
Some modification as below may resolve this issue and attached test.ufo.zip may be helpful.
--- a/InsertInflections.glyphsFilter/Contents/Resources/InsertInflections.py
+++ b/InsertInflections.glyphsFilter/Contents/Resources/InsertInflections.py
@@ -100,7 +100,8 @@ class GlyphsFilterInsertInflections ( NSObject, GlyphsFilterProtocol ):
for i in range(numberOfNodes-1, -1, -1):
node = thisPath.nodes[i]
if node.type == CURVE:
- nl = [ thisPath.nodes[ (x+numberOfNodes)%numberOfNodes ] for x in range( i-3, i+1 ) ]
+ cur_numberOfNodes = len( thisPath.nodes )
+ nl = [ thisPath.nodes[ (x+cur_numberOfNodes)%cur_numberOfNodes ] for x in range( i-3, i+1 ) ]
inflections = self.computeInflection( nl[0], nl[1], nl[2], nl[3] )
if len(inflections) == 1:
inflectionTime = inflections[0]
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in InsertInflections.glyphsFilter/Contents/Resources/InsertInflections.py, especially the node-processing loop and its computeInflection call. Reproduce the case with the attached test.ufo.zip, then verify that the first segment's inflection is calculated from the current path nodes and lands at the correct location.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- desktop, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100