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

Temporary style builders: Do nothing if content lambda does not emit commands #17

Open
okarmazin opened this issue Sep 18, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@okarmazin
Copy link
Owner

There is no reason to apply and immediately revert a style if there was no content to be affected by the style.

The following pattern currently blindly emits the surrounding Command.TextSize(2,2), Command.TextSize(1,1).

// current text size: 1x1
withTextSize(2, 2) {
  // This does nothing, so why not avoid 
  // setting the temporary 2x2 text size as well?
}

While emitting the commands is benign, it would be nice if we didn't send unnecessary commands to the printer.

Task: If the content lambda of temporary style builders didn't do anything, do not apply the surrounding style either.

@okarmazin okarmazin added the enhancement New feature or request label Sep 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant