Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dash in glyph names confuses the margin math #76

Open
typoman opened this issue Nov 11, 2023 · 6 comments
Open

Dash in glyph names confuses the margin math #76

typoman opened this issue Nov 11, 2023 · 6 comments

Comments

@typoman
Copy link

typoman commented Nov 11, 2023

It seems that if there is a dash in glyph names the math is not calculated correctly for the margins. Here is an example:

# this works
# >g2-tmp = ^ g1-tmp, g1-tmp

# math is not working correclty
>g2-tmp = ^ g1-tmp*1.25, g1-tmp/1.6

The parser apparently separates the glyph names even when there is no space between dash and a glyph name.

@typoman
Copy link
Author

typoman commented Nov 11, 2023

I tried to use explicit math and glyph name start and end indicators:

>g2-tmp = ^ "g1-tmp" `*1`, "g1-tmp" `/1`

# or

>g2-tmp = ^ "g1-tmp" * 1, "g1-tmp" / 1

and I got this error:

Traceback (most recent call last):
  File "/Applications/RoboFont.app/Contents/Resources/lib/python3.9/vanilla/vanillaBase.py", line 520, in action_
  File "/Users/bman/Library/Application Support/RoboFont/plugins/GlyphConstruction.roboFontExt/lib/glyphConstructionController.py", line 805, in reload
  File "/Users/bman/Library/Application Support/RoboFont/plugins/GlyphConstruction.roboFontExt/lib/glyphConstructionController.py", line 647, in constructionsCallback
  File "/Users/bman/Library/Application Support/RoboFont/plugins/GlyphConstruction.roboFontExt/lib/glyphConstruction.py", line 1212, in GlyphConstructionBuilder
  File "/Users/bman/Library/Application Support/RoboFont/plugins/GlyphConstruction.roboFontExt/lib/glyphConstruction.py", line 200, in _set_leftMargin
TypeError: unsupported operand type(s) for -: 'str' and 'int'
Traceback (most recent call last):
  File "lib/doodleDelegate.pyc", line 89, in sendEvent_
  File "/Applications/RoboFont.app/Contents/Resources/lib/python3.9/vanilla/vanillaBase.py", line 520, in action_
  File "/Users/bman/Library/Application Support/RoboFont/plugins/GlyphConstruction.roboFontExt/lib/glyphConstructionController.py", line 805, in reload
  File "/Users/bman/Library/Application Support/RoboFont/plugins/GlyphConstruction.roboFontExt/lib/glyphConstructionController.py", line 647, in constructionsCallback
  File "/Users/bman/Library/Application Support/RoboFont/plugins/GlyphConstruction.roboFontExt/lib/glyphConstruction.py", line 1212, in GlyphConstructionBuilder
  File "/Users/bman/Library/Application Support/RoboFont/plugins/GlyphConstruction.roboFontExt/lib/glyphConstruction.py", line 200, in _set_leftMargin
TypeError: unsupported operand type(s) for -: 'str' and 'int'

@typemytype
Copy link
Owner

oh 🐔 or 🥚 story..

what should the outcome if this equation be: glyphName-10 and what value should it be when there is a glyph with the name glyphName-10

I will make the "glyphName"-10 stronger and available inside a glyph attribute math.

thanks!!

@typemytype
Copy link
Owner

could you test this patch before I tag a new version number?

thanks

@typoman
Copy link
Author

typoman commented Nov 16, 2023

Thank you for the patch. I tested the the following case:

>g2-tmp = ^ g1-tmp*2, g1-tmp*2

The resulting g2-tmp glyph now has zero width, but it should follow the g1-tmp margins which is not zero width. ლ(▀̿̿Ĺ̯̿̿▀̿ლ)

@typemytype
Copy link
Owner

in case you have glyph names containing -+* its advised to wrap it inbetween quotes

>g2-tmp = ^ "g1-tmp"*2, "g1-tmp"*2

@typoman
Copy link
Author

typoman commented Nov 16, 2023

Thank you, with the latest commit everything seems to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants