forked from mirror/openmw-tes3mp
Get rid of the redundant Utf8Stream when during journal index creation
This commit is contained in:
parent
3571f7f413
commit
86a17b1e3e
2 changed files with 13 additions and 12 deletions
|
@ -351,6 +351,7 @@ namespace MWBase
|
||||||
virtual void writeFog(MWWorld::CellStore* cell) = 0;
|
virtual void writeFog(MWWorld::CellStore* cell) = 0;
|
||||||
|
|
||||||
virtual const MWGui::TextColours& getTextColours() = 0;
|
virtual const MWGui::TextColours& getTextColours() = 0;
|
||||||
|
|
||||||
virtual bool injectKeyPress(MyGUI::KeyCode key, unsigned int text) = 0;
|
virtual bool injectKeyPress(MyGUI::KeyCode key, unsigned int text) = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -233,28 +233,26 @@ BookTypesetter::Ptr JournalBooks::createLatinJournalIndex ()
|
||||||
|
|
||||||
typesetter->setSectionAlignment (BookTypesetter::AlignCenter);
|
typesetter->setSectionAlignment (BookTypesetter::AlignCenter);
|
||||||
|
|
||||||
|
char ch = 'A';
|
||||||
|
|
||||||
BookTypesetter::Style* body = typesetter->createStyle ("", MyGUI::Colour::Black);
|
BookTypesetter::Style* body = typesetter->createStyle ("", MyGUI::Colour::Black);
|
||||||
for (int i = 0; i < 26; ++i)
|
for (int i = 0; i < 26; ++i)
|
||||||
{
|
{
|
||||||
char ch = 'A' + i;
|
|
||||||
char buffer [32];
|
char buffer [32];
|
||||||
sprintf (buffer, "( %c )", ch);
|
sprintf (buffer, "( %c )", ch);
|
||||||
|
|
||||||
char buffer2 [32];
|
|
||||||
sprintf(buffer2, "%c", ch);
|
|
||||||
Utf8Stream stream (buffer2);
|
|
||||||
uint32_t first = stream.peek();
|
|
||||||
|
|
||||||
const MWGui::TextColours& textColours = MWBase::Environment::get().getWindowManager()->getTextColours();
|
const MWGui::TextColours& textColours = MWBase::Environment::get().getWindowManager()->getTextColours();
|
||||||
BookTypesetter::Style* style = typesetter->createHotStyle (body, textColours.journalTopic,
|
BookTypesetter::Style* style = typesetter->createHotStyle (body, textColours.journalTopic,
|
||||||
textColours.journalTopicOver,
|
textColours.journalTopicOver,
|
||||||
textColours.journalTopicPressed, first);
|
textColours.journalTopicPressed, (uint32_t) ch);
|
||||||
|
|
||||||
if (i == 13)
|
if (i == 13)
|
||||||
typesetter->sectionBreak ();
|
typesetter->sectionBreak ();
|
||||||
|
|
||||||
typesetter->write (style, to_utf8_span (buffer));
|
typesetter->write (style, to_utf8_span (buffer));
|
||||||
typesetter->lineBreak ();
|
typesetter->lineBreak ();
|
||||||
|
|
||||||
|
ch++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return typesetter;
|
return typesetter;
|
||||||
|
@ -267,15 +265,15 @@ BookTypesetter::Ptr JournalBooks::createCyrillicJournalIndex ()
|
||||||
typesetter->setSectionAlignment (BookTypesetter::AlignCenter);
|
typesetter->setSectionAlignment (BookTypesetter::AlignCenter);
|
||||||
|
|
||||||
BookTypesetter::Style* body = typesetter->createStyle ("", MyGUI::Colour::Black);
|
BookTypesetter::Style* body = typesetter->createStyle ("", MyGUI::Colour::Black);
|
||||||
|
|
||||||
|
unsigned char ch[2] = {0xd0, 0x90}; // CYRILLIC CAPITAL A is a 0xd090 in UTF-8
|
||||||
|
|
||||||
for (int i = 0; i < 32; ++i)
|
for (int i = 0; i < 32; ++i)
|
||||||
{
|
{
|
||||||
char buffer [32];
|
char buffer [32];
|
||||||
sprintf(buffer, "( %c%c )", 0xd0, 0x90 + i); // CYRILLIC CAPITAL A is a 0xd090 in UTF-8
|
sprintf(buffer, "( %c%c )", ch[0], ch[1]);
|
||||||
|
|
||||||
char buffer2 [32];
|
Utf8Stream stream ((char*) ch);
|
||||||
sprintf(buffer2, "%c%c", 0xd0, 0x90 + i);
|
|
||||||
|
|
||||||
Utf8Stream stream (buffer2);
|
|
||||||
uint32_t first = stream.peek();
|
uint32_t first = stream.peek();
|
||||||
|
|
||||||
const MWGui::TextColours& textColours = MWBase::Environment::get().getWindowManager()->getTextColours();
|
const MWGui::TextColours& textColours = MWBase::Environment::get().getWindowManager()->getTextColours();
|
||||||
|
@ -292,6 +290,8 @@ BookTypesetter::Ptr JournalBooks::createCyrillicJournalIndex ()
|
||||||
|
|
||||||
typesetter->write (style, to_utf8_span (buffer));
|
typesetter->write (style, to_utf8_span (buffer));
|
||||||
typesetter->lineBreak ();
|
typesetter->lineBreak ();
|
||||||
|
|
||||||
|
ch[1]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return typesetter;
|
return typesetter;
|
||||||
|
|
Loading…
Reference in a new issue