forked from olsak/OpTeX
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Insert color literals before certain whatsits
Fixes olsak#73 and hopefully also other potential issues.
- Loading branch information
Showing
1 changed file
with
9 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c51f957
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, describe more, what it does. I know that pdfliterals can be not only color settings. What does the attribute-color management with such pdfliterals?
c51f957
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current code was optimistic: PDF literals and PDF stores and restores don't interfere with colors, and if they do, the user knows what they are doing.
This change makes the code pessimistic: every PDF literal and PDF (re)store messes with colors, so change the color before them to reflect the current settings.
Example:
\Blue\pdfliteral{0 0 1 rg}A
Before processing:
Old code produced:
New code produces:
So the code still expects that there noone else changes colors (which works with TikZ, since its settings are local), but now reflects the current color also before whatsit nodes.
The TikZ problem:
Old code ("whatsits don't need color, insert color only before first glyph"):
After this commit ("whatsits also need color, but we still think everything is the implicit black, there is no red setting"):
Non color changing literals are not treated specially. As other literals and (re)stores they just require an injection of a color changing whatsit if current color has not been yet injected.