Skip to content

Commit

Permalink
Fix #230
Browse files Browse the repository at this point in the history
  • Loading branch information
mekkablue committed May 30, 2021
1 parent 9771453 commit d08181f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Build Glyphs/Build Circled Glyphs.py
Expand Up @@ -707,10 +707,18 @@ def BuildCircledGlyphsMain( self, sender=None ):
if thisArea > maxArea:
maxArea = thisArea
biggestLayer = thisLayer

angleInRadians = math.atan2( biggestLayer.bounds.size.height, biggestLayer.bounds.size.width*1.4 + minDistanceBetweenFigures )

if biggestLayer:
height = biggestLayer.bounds.size.height
width = biggestLayer.bounds.size.width
else:
# fallback values
height, width = 700.0, 500.0
print("⚠️ Warning: could not determine bounds of relevant layers, resorting to defaults. Are the glyphs empty?")

angleInRadians = math.atan2( height, width*1.4 + minDistanceBetweenFigures )
scaledHeight = math.sin(angleInRadians) * radius * 2 * 0.9
scaleFactor = scaledHeight / biggestLayer.bounds.size.height
scaleFactor = scaledHeight / height
scaleFactors.append(scaleFactor)
print("Scale factor for master '%s': %.1f" % (thisMaster.name, scaleFactor))

Expand Down

0 comments on commit d08181f

Please sign in to comment.