mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-24 04:11:50 -04:00
Move logic for determining Russian index page count to a shared place
This commit is contained in:
parent
d100867bce
commit
e04f0a8bd6
@ -156,6 +156,13 @@ namespace MWGui
|
|||||||
return MWGui::BookTypesetter::Utf8Span(begin, begin + text.length());
|
return MWGui::BookTypesetter::Utf8Span(begin, begin + text.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getCyrillicIndexPageCount()
|
||||||
|
{
|
||||||
|
// For small font size split alphabet to two columns (2x15 characers), for big font size split it to three
|
||||||
|
// colums (3x10 characters).
|
||||||
|
return Settings::gui().mFontSize < 18 ? 2 : 3;
|
||||||
|
}
|
||||||
|
|
||||||
typedef TypesetBook::Ptr book;
|
typedef TypesetBook::Ptr book;
|
||||||
|
|
||||||
JournalBooks::JournalBooks(JournalViewModel::Ptr model, ToUTF8::FromType encoding)
|
JournalBooks::JournalBooks(JournalViewModel::Ptr model, ToUTF8::FromType encoding)
|
||||||
@ -277,13 +284,8 @@ namespace MWGui
|
|||||||
|
|
||||||
// for small font size split alphabet to two columns (2x15 characers), for big font size split it to three
|
// for small font size split alphabet to two columns (2x15 characers), for big font size split it to three
|
||||||
// colums (3x10 characters).
|
// colums (3x10 characters).
|
||||||
int sectionBreak = 10;
|
mIndexPagesCount = getCyrillicIndexPageCount();
|
||||||
mIndexPagesCount = 3;
|
int sectionBreak = 30 / mIndexPagesCount;
|
||||||
if (Settings::gui().mFontSize < 18)
|
|
||||||
{
|
|
||||||
sectionBreak = 15;
|
|
||||||
mIndexPagesCount = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned char ch[3] = { 0xd0, 0x90, 0x00 }; // CYRILLIC CAPITAL A is a 0xd090 in UTF-8
|
unsigned char ch[3] = { 0xd0, 0x90, 0x00 }; // CYRILLIC CAPITAL A is a 0xd090 in UTF-8
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
MWGui::BookTypesetter::Utf8Span to_utf8_span(std::string_view text);
|
MWGui::BookTypesetter::Utf8Span to_utf8_span(std::string_view text);
|
||||||
|
int getCyrillicIndexPageCount();
|
||||||
|
|
||||||
const MyGUI::Colour journalHeaderColour = MyGUI::Colour(0.60f, 0.00f, 0.00f);
|
const MyGUI::Colour journalHeaderColour = MyGUI::Colour(0.60f, 0.00f, 0.00f);
|
||||||
|
|
||||||
|
@ -221,14 +221,8 @@ namespace
|
|||||||
// Latin = 26 (13 + 13)
|
// Latin = 26 (13 + 13)
|
||||||
mIndexRowCount = 13;
|
mIndexRowCount = 13;
|
||||||
bool isRussian = (mEncoding == ToUTF8::WINDOWS_1251);
|
bool isRussian = (mEncoding == ToUTF8::WINDOWS_1251);
|
||||||
if (isRussian)
|
if (isRussian) // Cyrillic is either (10 + 10 + 10) or (15 + 15)
|
||||||
{
|
mIndexRowCount = MWGui::getCyrillicIndexPageCount();
|
||||||
// This should match the logic in createCyrillicJournalIndex
|
|
||||||
if (Settings::gui().mFontSize < 18)
|
|
||||||
mIndexRowCount = 15; // Cyrillic = 30 (15 + 15)
|
|
||||||
else
|
|
||||||
mIndexRowCount = 10; // Cyrillic = 30 (10 + 10 + 10)
|
|
||||||
}
|
|
||||||
|
|
||||||
mControllerButtons.a = "#{sSelect}";
|
mControllerButtons.a = "#{sSelect}";
|
||||||
mControllerButtons.x = "#{OMWEngine:JournalQuests}";
|
mControllerButtons.x = "#{OMWEngine:JournalQuests}";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user