Hi,
is it possible to mix different font-styles/formats inside a single text with the format-tags? E.g. a text with some bold or colored words?
thanks
rob
Formatting with the ReneredStringParser-tags
Moderators: CEGUI MVP, CEGUI Team
Re: Formatting with the ReneredStringParser-tags
Huh, doesn't seem like it lets me do more than one "colour" statement, here. Everything after the second statement is ignored.
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Formatting with the ReneredStringParser-tags
Hi,
Yes, this is perfectly possible. One key thing to be aware of is that each font size or style (i.e. bold, standard, italic) requires a separate font specification. Once you have those you can happily use any font and any colours via the formatting tags within in a string.
For example, if you have DejaVuSans-10 and DejaVuSansBold-10 as your fonts, you could set the following:
and get, something similar to:
CE
r0br0y wrote:is it possible to mix different font-styles/formats inside a single text with the format-tags? E.g. a text with some bold or colored words?
Yes, this is perfectly possible. One key thing to be aware of is that each font size or style (i.e. bold, standard, italic) requires a separate font specification. Once you have those you can happily use any font and any colours via the formatting tags within in a string.
For example, if you have DejaVuSans-10 and DejaVuSansBold-10 as your fonts, you could set the following:
Code: Select all
"[colour='FFFF0000"][font='DejaVuSans-10']This is Red DejaVuSans font, and [colour='FF00FF00']this is green. [colour='FF0000FF'][font='DejaVuSansBold-10']This is a different font in blue!"
and get, something similar to:
This is Red DejaVuSans font, and this is green. This is a different font in blue!
CE
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Re: Formatting with the ReneredStringParser-tags
thanks,
that really clears things up - cool feature!
that really clears things up - cool feature!
Re: Formatting with the ReneredStringParser-tags
How do I use the padding-tag or how to define a Rect-Poperty as string?
Same for image-size
thanks
Same for image-size
thanks
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Formatting with the ReneredStringParser-tags
Ok. To recap on some of the basics of this
The RenderedString system as provided should be thought of as a state machine - so tags do not affect one part of the text, but rather they set some state(s) that stay in effect until either the end of the string or until some other tag changes the state.
All tags are in the form:
[tag-name='value']
value is always in single quotes.
To print a [ in the string you have to escape it with backslash. There is no need to escape the ending ]. If you're putting such things in C/C++ strings, don't forget to additionally escape the backslash character:
And, to answer your actual questions:
Generally values are in the same format as for xml / script properties.
A Rect looks like:
so that's l (ell), t, r and b to specify the left, top, right and bottom edges. They have to be in this order.
A Size is:
so, w for width and h for height. Again, the order is important.
All values are floats.
HTH
CE
The RenderedString system as provided should be thought of as a state machine - so tags do not affect one part of the text, but rather they set some state(s) that stay in effect until either the end of the string or until some other tag changes the state.
All tags are in the form:
[tag-name='value']
value is always in single quotes.
To print a [ in the string you have to escape it with backslash. There is no need to escape the ending ]. If you're putting such things in C/C++ strings, don't forget to additionally escape the backslash character:
Code: Select all
const char* c_string = "This is escaped \\[not_a_tag]"
And, to answer your actual questions:
Generally values are in the same format as for xml / script properties.
A Rect looks like:
Code: Select all
l:<left_edge> t:<top_edge> r:<right_edge> b:<bottom_edge>
so that's l (ell), t, r and b to specify the left, top, right and bottom edges. They have to be in this order.
A Size is:
Code: Select all
w:<width> h:<height>
so, w for width and h for height. Again, the order is important.
All values are floats.
HTH
CE
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Re: Formatting with the ReneredStringParser-tags
Hmmm, working now... I dunno what I did to make more than one colour tag not work.
Re: Formatting with the ReneredStringParser-tags
r0br0y wrote:thanks,
that really clears things up - cool feature!
Who is online
Users browsing this forum: Google [Bot] and 11 guests