Skip to content

Add expression evaluation to numeric metrics fields in selection info - #2237

Merged
justvanrossum merged 8 commits into
mainfrom
simple-compute
Jul 25, 2025
Merged

justvanrossum merged 8 commits into
mainfrom
simple-compute

Conversation

@justvanrossum

@justvanrossum justvanrossum commented Jul 24, 2025 •

Copy link
Copy Markdown
Member

This fixes #2236.

This introduces an inline calculator in the metrics fields in the selection info panel. It evaluates to a concrete value once you type enter or leave the field.

It supports most common operators and parentheses.

Additionally it allows to use glyph names as variable names, to refer to the metrics value for that glyph. For example, if you type E in the advance width field, it will take the advance width of the E glyph and put that in the field. Likewise, if you type E in the left sidebearing field, it will put the left sidebearing value from the E glyph in the field. But glyph names can also be used as part of an expression, for example E + 10.

There is a special notation for the opposite sidebearing, by adding a ! to the glyph name: if in the left sidebearing field you use E! in the expression, it will take the right sidebearing from E.

@justvanrossum
justvanrossum merged commit e83b4cc into main Jul 25, 2025
@justvanrossum
justvanrossum deleted the simple-compute branch July 25, 2025 09:59
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

Successfully merging this pull request may close these issues.

Numeric sidebearing fields: Allow basic math operations in sidebearing fields.

1 participant