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

translate #169

Open
typemytype opened this issue Oct 1, 2019 · 5 comments
Open

translate #169

typemytype opened this issue Oct 1, 2019 · 5 comments

Comments

@typemytype
Copy link
Member

I came in to a situation where I needed to translate a mathGlyph

if there is interest I can add the full translate as a PR

see https://gist.github.com/typemytype/52de64953b7486ae9090f19525e22c9b

@benkiel
Copy link
Member

benkiel commented Oct 1, 2019

Yes, please!

@anthrotype
Copy link
Member

fontmath objects have __mul__ operator which takes a number value as a factor, while the __add__ operator must be another compatible fontmath object. Maybe this translate method could simply be __add__ but when the type of the second addend is not a fontmath object but an int/float?

@anthrotype
Copy link
Member

Ehm, I actually meant a tuple of int/float
E.g. MathGlyph(glyph) + (10, 10)

similarly for __sub__ ofc

@anthrotype
Copy link
Member

or maybe this could lead to confusions, and an explicit translate method is better.. 🤔

@typemytype
Copy link
Member Author

Adding this to __add__ is not a good idea as this implies __mul__ should also take a mathGlyph, instead of a factor only.

A separate translate is better...

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

3 participants