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

Nested Color Markup #2273

Closed
mk1x86 opened this issue Aug 28, 2014 · 4 comments
Closed

Nested Color Markup #2273

mk1x86 opened this issue Aug 28, 2014 · 4 comments
Labels

Comments

@mk1x86
Copy link

@mk1x86 mk1x86 commented Aug 28, 2014

Using "This is [RED]red with [YELLOW]yellow[] text[] inside" colors everything except for "yellow" in red. It seems like this is because only the previous color is stored. This could be solved by adding a color stack, which pops the top value when a "[]" is found.

bug

@davebaol
Copy link
Member

@davebaol davebaol commented Aug 28, 2014

Yeah during color markup implementation I've deliberately avoided to use a color stack in order to

  • keep the code as fast and simple as possible.
  • minimize syntax verbosity; actually the end tag [] is optional, as specified by the wiki. This way simple non-nested color sequences, which are the most common case I guess, can be expressed as unclosed color tags. Since the end tags are optional, it's ambiguous when to pop colors from the stack.

Things can change though. Of course written in the wiki doesn't mean written in stone.

@mk1x86
Copy link
Author

@mk1x86 mk1x86 commented Aug 28, 2014

Closing tags would still be optional with a color stack. My problem derives from the fact that I have white glyphs for letters and a few special glyphs in my bitmap font. Adding a special glyph is done via "[WHITE]" + (char)540 + "[]". If the enclosing text is red I get the misbehaviour. I strongly vote for a color stack, I don't think it would be a lot slower, especially since is only done once when updating the text

@davebaol
Copy link
Member

@davebaol davebaol commented Sep 25, 2014

@badlogic @NathanSweet
So, should I add a stack to the color markup?
I'm not sure it's worth as long as #1934 is open, since BitmapFontCache implementation might significantly change as a result of that fix.

@NathanSweet
Copy link
Member

@NathanSweet NathanSweet commented Sep 25, 2014

A stack would be nice. Aye, it might be good to do #1934 first.

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

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.