Then, there is Raynes typesetter, and incredibly powerful class. It builds the core to all text rendering, and is completely accessible to you. You have complete control over the way paragraphs are aligned, how they get truncated, how kerning should be applied, how many lines it should render at max, if it should truncate lines... It's a beast, it knows text, it knows about vertical and right to left texts, and it knows how to style text. It knows where the characters of your text are, so you can perform hit tests against them, for example to check on which character the user clicked. You don't have to drop down to the typesetter level, but if you want to, your possibilities are endless.
Acknex TEXT object is a joke compared to the beast that is the typesetter, and I'm going to prove that to you with a few screenshots:




These three screens simply demonstrate the typesetter knows about linebreaks. The first two are two of the three truncation modes, in which the typesetter will add an ellipsis to truncate the text, the second one is simple character wrapping. Supported are the following line break modes:

Code:
enum class LineBreakMode
{
    None,
    WordWrapping,
    CharacterWrapping,
    TruncateHead,
    TruncateTail,
    TruncateMiddle
};



But that is lame, isn't it. How about something fancy, first of all, all non english speaking people: Rejoice, for Unicode is completely supported in Rayne:


Here is the code for that example (note that I had to change the font because the default Rayne font, Helvetica, doesn't support cyrillic):
Code:
RN::UI::Font *font = RN::UI::Font::WithName("Ubuntu Mono", 16.0f);

RN::UI::Label *label = new RN::UI::Label();
label->SetFont(font);
label->SetText(RNUTF8STR(u8"Я люблю Rayne"));
label->SizeToFit(); // Automatically resizes the view so that it comfortably fits its content



Right, so, simple, you can do that in Acknex as well. How about this then, coloured text with different fonts?


And here is the code for that example:
Code:
RN::UI::Font *font = RN::UI::Font::WithName("Ubuntu Mono", 16.0f);
RN::AttributedString *string = new RN::AttributedString(RNUTF8STR(u8"Я люблю Rayne"));
string->AddAttribute(kRNTypesetterFontAttribute, font, RN::Range(0, 7));
string->AddAttribute(kRNTypesetterColorAttribute, RN::UI::Color::WithRNColor(RN::Color::Yellow()), RN::Range(0, 7));
string->AddAttribute(kRNTypesetterColorAttribute, RN::UI::Color::WithRNColor(RN::Color::Red()), RN::Range(8, 5));

RN::UI::Label *label = new RN::UI::Label();
label->SetAttributedText(string);
label->SizeToFit();



That's almost cheating, isn't it?


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com