Use Morrowind's fonts

actorid
scrawl 12 years ago
parent 8bd712cc95
commit daab4f55a3

@ -33,7 +33,7 @@ add_openmw_dir (mwgui
enchantingdialog trainingwindow travelwindow imagebutton exposedwindow cursor spellicons
merchantrepair repair soulgemdialog companionwindow bookpage journalviewmodel journalbooks
keywordsearch itemmodel containeritemmodel inventoryitemmodel sortfilteritemmodel itemview
tradeitemmodel companionitemmodel pickpocketitemmodel
tradeitemmodel companionitemmodel pickpocketitemmodel fontloader
)
add_openmw_dir (mwdialogue

@ -380,7 +380,7 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
mEnvironment.setWindowManager (new MWGui::WindowManager(
mExtensions, mFpsLevel, mOgre, mCfgMgr.getLogPath().string() + std::string("/"),
mCfgMgr.getCachePath ().string(), mScriptConsoleMode, mTranslationDataStorage));
mCfgMgr.getCachePath ().string(), mScriptConsoleMode, mTranslationDataStorage, mEncoding));
if (mNewGame)
mEnvironment.getWindowManager()->setNewGame(true);

@ -223,6 +223,9 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
Style * createStyle (char const * fontName, Colour fontColour)
{
if (strcmp(fontName, "") == 0)
return createStyle(MyGUI::FontManager::getInstance().getDefaultFont().c_str(), fontColour);
for (Styles::iterator i = mBook->mStyles.begin (); i != mBook->mStyles.end (); ++i)
if (i->match (fontName, fontColour, fontColour, fontColour, 0))
return &*i;
@ -405,7 +408,8 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
while (!stream.eof () && !ucsLineBreak (stream.peek ()) && ucsBreakingSpace (stream.peek ()))
{
MyGUI::GlyphInfo* gi = style->mFont->getGlyphInfo (stream.peek ());
space_width += gi->advance;
if (gi)
space_width += gi->advance + gi->bearingX;
stream.consume ();
}
@ -414,7 +418,8 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
while (!stream.eof () && !ucsLineBreak (stream.peek ()) && !ucsBreakingSpace (stream.peek ()))
{
MyGUI::GlyphInfo* gi = style->mFont->getGlyphInfo (stream.peek ());
word_width += gi->advance + gi->bearingX;
if (gi)
word_width += gi->advance + gi->bearingX;
word_height = line_height;
++character_count;
stream.consume ();
@ -628,6 +633,9 @@ namespace
{
MyGUI::GlyphInfo* gi = mFont->getGlyphInfo (ch);
if (!gi)
return;
MyGUI::FloatRect vr;
vr.left = mCursor.left + gi->bearingX;
@ -647,7 +655,8 @@ namespace
{
MyGUI::GlyphInfo* gi = mFont->getGlyphInfo (ch);
mCursor.left += gi->bearingX + gi->advance;
if (gi)
mCursor.left += gi->bearingX + gi->advance;
}
private:

@ -115,7 +115,7 @@ namespace MWGui
void Response::write(BookTypesetter::Ptr typesetter, KeywordSearchT* keywordSearch, std::map<std::string, Link*>& topicLinks) const
{
BookTypesetter::Style* title = typesetter->createStyle("EB Garamond", MyGUI::Colour(223/255.f, 201/255.f, 159/255.f));
BookTypesetter::Style* title = typesetter->createStyle("", MyGUI::Colour(223/255.f, 201/255.f, 159/255.f));
typesetter->sectionBreak(9);
if (mTitle != "")
typesetter->write(title, to_utf8_span(mTitle.c_str()));
@ -159,7 +159,7 @@ namespace MWGui
if (hyperLinks.size() && MWBase::Environment::get().getWindowManager()->getTranslationDataStorage().hasTranslation())
{
BookTypesetter::Style* style = typesetter->createStyle("EB Garamond", MyGUI::Colour(202/255.f, 165/255.f, 96/255.f));
BookTypesetter::Style* style = typesetter->createStyle("", MyGUI::Colour(202/255.f, 165/255.f, 96/255.f));
size_t formatted = 0; // points to the first character that is not laid out yet
for (std::map<Range, intptr_t>::iterator it = hyperLinks.begin(); it != hyperLinks.end(); ++it)
{
@ -197,7 +197,7 @@ namespace MWGui
void Response::addTopicLink(BookTypesetter::Ptr typesetter, intptr_t topicId, size_t begin, size_t end) const
{
BookTypesetter::Style* style = typesetter->createStyle("EB Garamond", MyGUI::Colour(202/255.f, 165/255.f, 96/255.f));
BookTypesetter::Style* style = typesetter->createStyle("", MyGUI::Colour(202/255.f, 165/255.f, 96/255.f));
const MyGUI::Colour linkHot (143/255.f, 155/255.f, 218/255.f);
const MyGUI::Colour linkNormal (112/255.f, 126/255.f, 207/255.f);
@ -215,7 +215,7 @@ namespace MWGui
void Message::write(BookTypesetter::Ptr typesetter, KeywordSearchT* keywordSearch, std::map<std::string, Link*>& topicLinks) const
{
BookTypesetter::Style* title = typesetter->createStyle("EB Garamond", MyGUI::Colour(223/255.f, 201/255.f, 159/255.f));
BookTypesetter::Style* title = typesetter->createStyle("", MyGUI::Colour(223/255.f, 201/255.f, 159/255.f));
typesetter->sectionBreak(9);
typesetter->write(title, to_utf8_span(mText.c_str()));
}
@ -465,7 +465,7 @@ namespace MWGui
(*it)->write(typesetter, &mKeywordSearch, mTopicLinks);
BookTypesetter::Style* body = typesetter->createStyle("EB Garamond", MyGUI::Colour::White);
BookTypesetter::Style* body = typesetter->createStyle("", MyGUI::Colour::White);
// choices
const MyGUI::Colour linkHot (223/255.f, 201/255.f, 159/255.f);

@ -0,0 +1,238 @@
#include "fontloader.hpp"
#include <OgreResourceGroupManager.h>
#include <OgreTextureManager.h>
#include <MyGUI_ResourceManager.h>
#include <MyGUI_FontManager.h>
#include <MyGUI_ResourceManualFont.h>
#include <MyGUI_XmlDocument.h>
#include <MyGUI_FactoryManager.h>
#include <components/misc/stringops.hpp>
namespace
{
unsigned long utf8ToUnicode(const std::string& utf8)
{
size_t i = 0;
unsigned long unicode;
size_t todo;
unsigned char ch = utf8[i++];
if (ch <= 0x7F)
{
unicode = ch;
todo = 0;
}
else if (ch <= 0xBF)
{
throw std::logic_error("not a UTF-8 string");
}
else if (ch <= 0xDF)
{
unicode = ch&0x1F;
todo = 1;
}
else if (ch <= 0xEF)
{
unicode = ch&0x0F;
todo = 2;
}
else if (ch <= 0xF7)
{
unicode = ch&0x07;
todo = 3;
}
else
{
throw std::logic_error("not a UTF-8 string");
}
for (size_t j = 0; j < todo; ++j)
{
unsigned char ch = utf8[i++];
if (ch < 0x80 || ch > 0xBF)
throw std::logic_error("not a UTF-8 string");
unicode <<= 6;
unicode += ch & 0x3F;
}
if (unicode >= 0xD800 && unicode <= 0xDFFF)
throw std::logic_error("not a UTF-8 string");
if (unicode > 0x10FFFF)
throw std::logic_error("not a UTF-8 string");
return unicode;
}
}
namespace MWGui
{
FontLoader::FontLoader(ToUTF8::FromType encoding)
{
if (encoding == ToUTF8::WINDOWS_1252)
mEncoding = ToUTF8::CP437;
else
mEncoding = encoding;
}
void FontLoader::loadAllFonts()
{
Ogre::StringVector groups = Ogre::ResourceGroupManager::getSingleton().getResourceGroups ();
for (Ogre::StringVector::iterator it = groups.begin(); it != groups.end(); ++it)
{
Ogre::StringVectorPtr resourcesInThisGroup = Ogre::ResourceGroupManager::getSingleton ().findResourceNames (*it, "*.fnt");
for (Ogre::StringVector::iterator resource = resourcesInThisGroup->begin(); resource != resourcesInThisGroup->end(); ++resource)
{
loadFont(*resource);
}
}
}
typedef struct
{
float x;
float y;
} Point;
typedef struct
{
float u1; // appears unused, always 0
Point top_left;
Point top_right;
Point bottom_left;
Point bottom_right;
float width;
float height;
float u2; // appears unused, always 0
float kerning;
float ascent;
} GlyphInfo;
void FontLoader::loadFont(const std::string &fileName)
{
Ogre::DataStreamPtr file = Ogre::ResourceGroupManager::getSingleton().openResource(fileName);
float fontSize;
int one;
file->read(&fontSize, sizeof(fontSize));
file->read(&one, sizeof(int));
assert(one == 1);
file->read(&one, sizeof(int));
assert(one == 1);
char name_[284];
file->read(name_, sizeof(name_));
std::string name(name_);
GlyphInfo data[256];
file->read(data, sizeof(data));
file->close();
// Create the font texture
std::string bitmapFilename = "Fonts/" + std::string(name) + ".tex";
Ogre::DataStreamPtr bitmapFile = Ogre::ResourceGroupManager::getSingleton().openResource(bitmapFilename);
int width, height;
bitmapFile->read(&width, sizeof(int));
bitmapFile->read(&height, sizeof(int));
std::vector<Ogre::uchar> textureData;
textureData.resize(width*height*4);
bitmapFile->read(&textureData[0], width*height*4);
bitmapFile->close();
std::string textureName = name;
Ogre::Image image;
image.loadDynamicImage(&textureData[0], width, height, Ogre::PF_BYTE_RGBA);
Ogre::TexturePtr texture = Ogre::TextureManager::getSingleton().createManual(textureName,
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Ogre::TEX_TYPE_2D,
width, height, 0, Ogre::PF_BYTE_RGBA);
texture->loadImage(image);
// Register the font with MyGUI
MyGUI::ResourceManualFont* font = static_cast<MyGUI::ResourceManualFont*>(
MyGUI::FactoryManager::getInstance().createObject("Resource", "ResourceManualFont"));
// We need to emulate loading from XML because the data members are private as of mygui 3.2.0
MyGUI::xml::Document xmlDocument;
MyGUI::xml::ElementPtr root = xmlDocument.createRoot("ResourceManualFont");
if (name.size() >= 5 && Misc::StringUtils::ciEqual(name.substr(0, 5), "magic"))
root->addAttribute("name", "Magic Cards");
else if (name.size() >= 7 && Misc::StringUtils::ciEqual(name.substr(0, 7), "century"))
root->addAttribute("name", "Century Gothic");
else if (name.size() >= 7 && Misc::StringUtils::ciEqual(name.substr(0, 7), "daedric"))
root->addAttribute("name", "Daedric");
else
return; // no point in loading it, since there is no way of using additional fonts
MyGUI::xml::ElementPtr defaultHeight = root->createChild("Property");
defaultHeight->addAttribute("key", "DefaultHeight");
defaultHeight->addAttribute("value", fontSize);
MyGUI::xml::ElementPtr source = root->createChild("Property");
source->addAttribute("key", "Source");
source->addAttribute("value", std::string(textureName));
MyGUI::xml::ElementPtr codes = root->createChild("Codes");
for(int i = 0; i < 256; i++)
{
int x1 = data[i].top_left.x*width;
int y1 = data[i].top_left.y*height;
int w = data[i].top_right.x*width - x1;
int h = data[i].bottom_left.y*height - y1;
ToUTF8::Utf8Encoder encoder(mEncoding);
unsigned long unicodeVal = utf8ToUnicode(encoder.getUtf8(std::string(1, (unsigned char)(i))));
MyGUI::xml::ElementPtr code = codes->createChild("Code");
code->addAttribute("index", unicodeVal);
code->addAttribute("coord", MyGUI::utility::toString(x1) + " "
+ MyGUI::utility::toString(y1) + " "
+ MyGUI::utility::toString(w) + " "
+ MyGUI::utility::toString(h));
code->addAttribute("advance", data[i].width);
code->addAttribute("bearing", MyGUI::utility::toString(data[i].kerning) + " "
+ MyGUI::utility::toString((fontSize-data[i].ascent)));
// ASCII vertical bar, use this as text input cursor
if (i == 124)
{
MyGUI::xml::ElementPtr cursorCode = codes->createChild("Code");
cursorCode->addAttribute("index", MyGUI::FontCodeType::Cursor);
cursorCode->addAttribute("coord", MyGUI::utility::toString(x1) + " "
+ MyGUI::utility::toString(y1) + " "
+ MyGUI::utility::toString(w) + " "
+ MyGUI::utility::toString(h));
cursorCode->addAttribute("advance", data[i].width);
cursorCode->addAttribute("bearing", MyGUI::utility::toString(data[i].kerning) + " "
+ MyGUI::utility::toString((fontSize-data[i].ascent)));
}
}
// These are required as well, but the fonts don't provide them
for (int i=0; i<3; ++i)
{
MyGUI::FontCodeType::Enum type;
if(i == 0)
type = MyGUI::FontCodeType::Selected;
else if (i == 1)
type = MyGUI::FontCodeType::SelectedBack;
else if (i == 2)
type = MyGUI::FontCodeType::NotDefined;
MyGUI::xml::ElementPtr cursorCode = codes->createChild("Code");
cursorCode->addAttribute("index", type);
cursorCode->addAttribute("coord", "0 0 0 0");
cursorCode->addAttribute("advance", "0");
cursorCode->addAttribute("bearing", "0 0");
}
font->deserialization(root, MyGUI::Version(3,2,0));
MyGUI::ResourceManager::getInstance().addResource(font);
}
}

@ -0,0 +1,25 @@
#ifndef MWGUI_FONTLOADER_H
#define MWGUI_FONTLOADER_H
#include <components/to_utf8/to_utf8.hpp>
namespace MWGui
{
/// @brief loads Morrowind's .fnt/.tex fonts for use with MyGUI and Ogre
class FontLoader
{
public:
FontLoader (ToUTF8::FromType encoding);
void loadAllFonts ();
private:
ToUTF8::FromType mEncoding;
void loadFont (const std::string& fileName);
};
}
#endif

@ -202,14 +202,14 @@ namespace MWGui
float BookTextParser::widthForCharGlyph(unsigned unicodeChar) const
{
std::string fontName(mTextStyle.mFont == "Default" ? "EB Garamond" : mTextStyle.mFont);
std::string fontName(mTextStyle.mFont == "Default" ? MyGUI::FontManager::getInstance().getDefaultFont() : mTextStyle.mFont);
return MyGUI::FontManager::getInstance().getByName(fontName)
->getGlyphInfo(unicodeChar)->width;
}
float BookTextParser::currentFontHeight() const
{
std::string fontName(mTextStyle.mFont == "Default" ? "EB Garamond" : mTextStyle.mFont);
std::string fontName(mTextStyle.mFont == "Default" ? MyGUI::FontManager::getInstance().getDefaultFont() : mTextStyle.mFont);
return MyGUI::FontManager::getInstance().getByName(fontName)->getDefaultHeight();
}

@ -189,14 +189,14 @@ book JournalBooks::createEmptyJournalBook ()
{
BookTypesetter::Ptr typesetter = createTypesetter ();
BookTypesetter::Style* header = typesetter->createStyle ("EB Garamond", MyGUI::Colour (0.60f, 0.00f, 0.00f));
BookTypesetter::Style* body = typesetter->createStyle ("EB Garamond", MyGUI::Colour::Black);
BookTypesetter::Style* header = typesetter->createStyle ("", MyGUI::Colour (0.60f, 0.00f, 0.00f));
BookTypesetter::Style* body = typesetter->createStyle ("", MyGUI::Colour::Black);
typesetter->write (header, to_utf8_span ("You have no journal entries!"));
typesetter->lineBreak ();
typesetter->write (body, to_utf8_span ("You should have gone though the starting quest and got an initial quest."));
BookTypesetter::Style* big = typesetter->createStyle ("EB Garamond 24", MyGUI::Colour::Black);
BookTypesetter::Style* big = typesetter->createStyle ("", MyGUI::Colour::Black);
BookTypesetter::Style* test = typesetter->createStyle ("MonoFont", MyGUI::Colour::Blue);
typesetter->sectionBreak (20);
@ -231,8 +231,8 @@ book JournalBooks::createJournalBook ()
{
BookTypesetter::Ptr typesetter = createTypesetter ();
BookTypesetter::Style* header = typesetter->createStyle ("EB Garamond", MyGUI::Colour (0.60f, 0.00f, 0.00f));
BookTypesetter::Style* body = typesetter->createStyle ("EB Garamond", MyGUI::Colour::Black);
BookTypesetter::Style* header = typesetter->createStyle ("", MyGUI::Colour (0.60f, 0.00f, 0.00f));
BookTypesetter::Style* body = typesetter->createStyle ("", MyGUI::Colour::Black);
mModel->visitJournalEntries (0, AddJournalEntry (typesetter, body, header, true));
@ -243,8 +243,8 @@ book JournalBooks::createTopicBook (uintptr_t topicId)
{
BookTypesetter::Ptr typesetter = createTypesetter ();
BookTypesetter::Style* header = typesetter->createStyle ("EB Garamond", MyGUI::Colour (0.60f, 0.00f, 0.00f));
BookTypesetter::Style* body = typesetter->createStyle ("EB Garamond", MyGUI::Colour::Black);
BookTypesetter::Style* header = typesetter->createStyle ("", MyGUI::Colour (0.60f, 0.00f, 0.00f));
BookTypesetter::Style* body = typesetter->createStyle ("", MyGUI::Colour::Black);
mModel->visitTopicName (topicId, AddTopicName (typesetter, header));
@ -259,8 +259,8 @@ book JournalBooks::createQuestBook (uintptr_t questId)
{
BookTypesetter::Ptr typesetter = createTypesetter ();
BookTypesetter::Style* header = typesetter->createStyle ("EB Garamond", MyGUI::Colour (0.60f, 0.00f, 0.00f));
BookTypesetter::Style* body = typesetter->createStyle ("EB Garamond", MyGUI::Colour::Black);
BookTypesetter::Style* header = typesetter->createStyle ("", MyGUI::Colour (0.60f, 0.00f, 0.00f));
BookTypesetter::Style* body = typesetter->createStyle ("", MyGUI::Colour::Black);
mModel->visitQuestName (questId, AddQuestName (typesetter, header));
@ -275,7 +275,7 @@ book JournalBooks::createTopicIndexBook ()
typesetter->setSectionAlignment (BookTypesetter::AlignCenter);
BookTypesetter::Style* body = typesetter->createStyle ("EB Garamond", MyGUI::Colour::Black);
BookTypesetter::Style* body = typesetter->createStyle ("", MyGUI::Colour::Black);
for (int i = 0; i < 26; ++i)
{
@ -300,7 +300,7 @@ book JournalBooks::createTopicIndexBook ()
book JournalBooks::createTopicIndexBook (char character)
{
BookTypesetter::Ptr typesetter = BookTypesetter::create (0x7FFFFFFF, 0x7FFFFFFF);
BookTypesetter::Style* style = typesetter->createStyle ("EB Garamond", MyGUI::Colour::Black);
BookTypesetter::Style* style = typesetter->createStyle ("", MyGUI::Colour::Black);
mModel->visitTopicNamesStartingWith (character, AddTopicLink (typesetter, style));
@ -310,7 +310,7 @@ book JournalBooks::createTopicIndexBook (char character)
book JournalBooks::createQuestIndexBook (bool activeOnly)
{
BookTypesetter::Ptr typesetter = BookTypesetter::create (0x7FFFFFFF, 0x7FFFFFFF);
BookTypesetter::Style* base = typesetter->createStyle ("EB Garamond", MyGUI::Colour::Black);
BookTypesetter::Style* base = typesetter->createStyle ("", MyGUI::Colour::Black);
mModel->visitQuestNames (activeOnly, AddQuestLink (typesetter, base));

@ -42,6 +42,7 @@
#include "inventorywindow.hpp"
#include "bookpage.hpp"
#include "itemview.hpp"
#include "fontloader.hpp"
namespace MWGui
{
@ -49,7 +50,7 @@ namespace MWGui
WindowManager::WindowManager(
const Compiler::Extensions& extensions, int fpsLevel, OEngine::Render::OgreRenderer *ogre,
const std::string& logpath, const std::string& cacheDir, bool consoleOnlyScripts,
Translation::Storage& translationDataStorage)
Translation::Storage& translationDataStorage, ToUTF8::FromType encoding)
: mGuiManager(NULL)
, mRendering(ogre)
, mHud(NULL)
@ -109,6 +110,10 @@ namespace MWGui
mGuiManager = new OEngine::GUI::MyGUIManager(mRendering->getWindow(), mRendering->getScene(), false, logpath);
mGui = mGuiManager->getGui();
// Load fonts
FontLoader fontLoader (encoding);
fontLoader.loadAllFonts();
//Register own widgets with MyGUI
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::MWSkill>("Widget");
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::MWAttribute>("Widget");

@ -83,7 +83,7 @@ namespace MWGui
WindowManager(const Compiler::Extensions& extensions, int fpsLevel,
OEngine::Render::OgreRenderer *mOgre, const std::string& logpath,
const std::string& cacheDir, bool consoleOnlyScripts,
Translation::Storage& translationDataStorage);
Translation::Storage& translationDataStorage, ToUTF8::FromType encoding);
virtual ~WindowManager();
/**

@ -46,7 +46,7 @@ void writeMissing(bool last)
int write_table(const std::string &charset, const std::string &tableName)
{
// Write table header
cout << "static char " << tableName << "[] =\n{\n";
cout << "static signed char " << tableName << "[] =\n{\n";
// Open conversion system
iconv_t cd = iconv_open ("UTF-8", charset.c_str());
@ -106,6 +106,8 @@ int main()
"\n";
write_table("WINDOWS-1252", "windows_1252");
write_table("CP437", "cp437");
// Close namespace
cout << "\n}\n\n";

@ -790,6 +790,265 @@ static signed char windows_1252[] =
2, -61, -66, 0, 0, 0,
2, -61, -65, 0, 0, 0
};
static signed char cp437[] =
{
1, 0, 0, 0, 0, 0,
1, 1, 0, 0, 0, 0,
1, 2, 0, 0, 0, 0,
1, 3, 0, 0, 0, 0,
1, 4, 0, 0, 0, 0,
1, 5, 0, 0, 0, 0,
1, 6, 0, 0, 0, 0,
1, 7, 0, 0, 0, 0,
1, 8, 0, 0, 0, 0,
1, 9, 0, 0, 0, 0,
1, 10, 0, 0, 0, 0,
1, 11, 0, 0, 0, 0,
1, 12, 0, 0, 0, 0,
1, 13, 0, 0, 0, 0,
1, 14, 0, 0, 0, 0,
1, 15, 0, 0, 0, 0,
1, 16, 0, 0, 0, 0,
1, 17, 0, 0, 0, 0,
1, 18, 0, 0, 0, 0,
1, 19, 0, 0, 0, 0,
1, 20, 0, 0, 0, 0,
1, 21, 0, 0, 0, 0,
1, 22, 0, 0, 0, 0,
1, 23, 0, 0, 0, 0,
1, 24, 0, 0, 0, 0,
1, 25, 0, 0, 0, 0,
1, 26, 0, 0, 0, 0,
1, 27, 0, 0, 0, 0,
1, 28, 0, 0, 0, 0,
1, 29, 0, 0, 0, 0,
1, 30, 0, 0, 0, 0,
1, 31, 0, 0, 0, 0,
1, 32, 0, 0, 0, 0,
1, 33, 0, 0, 0, 0,
1, 34, 0, 0, 0, 0,
1, 35, 0, 0, 0, 0,
1, 36, 0, 0, 0, 0,
1, 37, 0, 0, 0, 0,
1, 38, 0, 0, 0, 0,
1, 39, 0, 0, 0, 0,
1, 40, 0, 0, 0, 0,
1, 41, 0, 0, 0, 0,
1, 42, 0, 0, 0, 0,
1, 43, 0, 0, 0, 0,
1, 44, 0, 0, 0, 0,
1, 45, 0, 0, 0, 0,
1, 46, 0, 0, 0, 0,
1, 47, 0, 0, 0, 0,
1, 48, 0, 0, 0, 0,
1, 49, 0, 0, 0, 0,
1, 50, 0, 0, 0, 0,
1, 51, 0, 0, 0, 0,
1, 52, 0, 0, 0, 0,
1, 53, 0, 0, 0, 0,
1, 54, 0, 0, 0, 0,
1, 55, 0, 0, 0, 0,
1, 56, 0, 0, 0, 0,
1, 57, 0, 0, 0, 0,
1, 58, 0, 0, 0, 0,
1, 59, 0, 0, 0, 0,
1, 60, 0, 0, 0, 0,
1, 61, 0, 0, 0, 0,
1, 62, 0, 0, 0, 0,
1, 63, 0, 0, 0, 0,
1, 64, 0, 0, 0, 0,
1, 65, 0, 0, 0, 0,
1, 66, 0, 0, 0, 0,
1, 67, 0, 0, 0, 0,
1, 68, 0, 0, 0, 0,
1, 69, 0, 0, 0, 0,
1, 70, 0, 0, 0, 0,
1, 71, 0, 0, 0, 0,
1, 72, 0, 0, 0, 0,
1, 73, 0, 0, 0, 0,
1, 74, 0, 0, 0, 0,
1, 75, 0, 0, 0, 0,
1, 76, 0, 0, 0, 0,
1, 77, 0, 0, 0, 0,
1, 78, 0, 0, 0, 0,
1, 79, 0, 0, 0, 0,
1, 80, 0, 0, 0, 0,
1, 81, 0, 0, 0, 0,
1, 82, 0, 0, 0, 0,
1, 83, 0, 0, 0, 0,
1, 84, 0, 0, 0, 0,
1, 85, 0, 0, 0, 0,
1, 86, 0, 0, 0, 0,
1, 87, 0, 0, 0, 0,
1, 88, 0, 0, 0, 0,
1, 89, 0, 0, 0, 0,
1, 90, 0, 0, 0, 0,
1, 91, 0, 0, 0, 0,
1, 92, 0, 0, 0, 0,
1, 93, 0, 0, 0, 0,
1, 94, 0, 0, 0, 0,
1, 95, 0, 0, 0, 0,
1, 96, 0, 0, 0, 0,
1, 97, 0, 0, 0, 0,
1, 98, 0, 0, 0, 0,
1, 99, 0, 0, 0, 0,
1, 100, 0, 0, 0, 0,
1, 101, 0, 0, 0, 0,
1, 102, 0, 0, 0, 0,
1, 103, 0, 0, 0, 0,
1, 104, 0, 0, 0, 0,
1, 105, 0, 0, 0, 0,
1, 106, 0, 0, 0, 0,
1, 107, 0, 0, 0, 0,
1, 108, 0, 0, 0, 0,
1, 109, 0, 0, 0, 0,
1, 110, 0, 0, 0, 0,
1, 111, 0, 0, 0, 0,
1, 112, 0, 0, 0, 0,
1, 113, 0, 0, 0, 0,
1, 114, 0, 0, 0, 0,
1, 115, 0, 0, 0, 0,
1, 116, 0, 0, 0, 0,
1, 117, 0, 0, 0, 0,
1, 118, 0, 0, 0, 0,
1, 119, 0, 0, 0, 0,
1, 120, 0, 0, 0, 0,
1, 121, 0, 0, 0, 0,
1, 122, 0, 0, 0, 0,
1, 123, 0, 0, 0, 0,
1, 124, 0, 0, 0, 0,
1, 125, 0, 0, 0, 0,
1, 126, 0, 0, 0, 0,
1, 127, 0, 0, 0, 0,
2, -61, -121, 0, 0, 0,
2, -61, -68, 0, 0, 0,
2, -61, -87, 0, 0, 0,
2, -61, -94, 0, 0, 0,
2, -61, -92, 0, 0, 0,
2, -61, -96, 0, 0, 0,
2, -61, -91, 0, 0, 0,
2, -61, -89, 0, 0, 0,
2, -61, -86, 0, 0, 0,
2, -61, -85, 0, 0, 0,
2, -61, -88, 0, 0, 0,
2, -61, -81, 0, 0, 0,
2, -61, -82, 0, 0, 0,
2, -61, -84, 0, 0, 0,
2, -61, -124, 0, 0, 0,
2, -61, -123, 0, 0, 0,
2, -61, -119, 0, 0, 0,
2, -61, -90, 0, 0, 0,
2, -61, -122, 0, 0, 0,
2, -61, -76, 0, 0, 0,
2, -61, -74, 0, 0, 0,
2, -61, -78, 0, 0, 0,
2, -61, -69, 0, 0, 0,
2, -61, -71, 0, 0, 0,
2, -61, -65, 0, 0, 0,
2, -61, -106, 0, 0, 0,
2, -61, -100, 0, 0, 0,
2, -62, -94, 0, 0, 0,
2, -62, -93, 0, 0, 0,
2, -62, -91, 0, 0, 0,
3, -30, -126, -89, 0, 0,
2, -58, -110, 0, 0, 0,
2, -61, -95, 0, 0, 0,
2, -61, -83, 0, 0, 0,
2, -61, -77, 0, 0, 0,
2, -61, -70, 0, 0, 0,
2, -61, -79, 0, 0, 0,
2, -61, -111, 0, 0, 0,
2, -62, -86, 0, 0, 0,
2, -62, -70, 0, 0, 0,
2, -62, -65, 0, 0, 0,
3, -30, -116, -112, 0, 0,
2, -62, -84, 0, 0, 0,
2, -62, -67, 0, 0, 0,
2, -62, -68, 0, 0, 0,
2, -62, -95, 0, 0, 0,
2, -62, -85, 0, 0, 0,
2, -62, -69, 0, 0, 0,
3, -30, -106, -111, 0, 0,
3, -30, -106, -110, 0, 0,
3, -30, -106, -109, 0, 0,
3, -30, -108, -126, 0, 0,
3, -30, -108, -92, 0, 0,
3, -30, -107, -95, 0, 0,
3, -30, -107, -94, 0, 0,
3, -30, -107, -106, 0, 0,
3, -30, -107, -107, 0, 0,
3, -30, -107, -93, 0, 0,
3, -30, -107, -111, 0, 0,
3, -30, -107, -105, 0, 0,
3, -30, -107, -99, 0, 0,
3, -30, -107, -100, 0, 0,
3, -30, -107, -101, 0, 0,
3, -30, -108, -112, 0, 0,
3, -30, -108, -108, 0, 0,
3, -30, -108, -76, 0, 0,
3, -30, -108, -84, 0, 0,
3, -30, -108, -100, 0, 0,
3, -30, -108, -128, 0, 0,
3, -30, -108, -68, 0, 0,
3, -30, -107, -98, 0, 0,
3, -30, -107, -97, 0, 0,
3, -30, -107, -102, 0, 0,
3, -30, -107, -108, 0, 0,
3, -30, -107, -87, 0, 0,
3, -30, -107, -90, 0, 0,
3, -30, -107, -96, 0, 0,
3, -30, -107, -112, 0, 0,
3, -30, -107, -84, 0, 0,
3, -30, -107, -89, 0, 0,
3, -30, -107, -88, 0, 0,
3, -30, -107, -92, 0, 0,
3, -30, -107, -91, 0, 0,
3, -30, -107, -103, 0, 0,
3, -30, -107, -104, 0, 0,
3, -30, -107, -110, 0, 0,
3, -30, -107, -109, 0, 0,
3, -30, -107, -85, 0, 0,
3, -30, -107, -86, 0, 0,
3, -30, -108, -104, 0, 0,
3, -30, -108, -116, 0, 0,
3, -30, -106, -120, 0, 0,
3, -30, -106, -124, 0, 0,
3, -30, -106, -116, 0, 0,
3, -30, -106, -112, 0, 0,
3, -30, -106, -128, 0, 0,
2, -50, -79, 0, 0, 0,
2, -61, -97, 0, 0, 0,
2, -50, -109, 0, 0, 0,
2, -49, -128, 0, 0, 0,
2, -50, -93, 0, 0, 0,
2, -49, -125, 0, 0, 0,
2, -62, -75, 0, 0, 0,
2, -49, -124, 0, 0, 0,
2, -50, -90, 0, 0, 0,
2, -50, -104, 0, 0, 0,
2, -50, -87, 0, 0, 0,
2, -50, -76, 0, 0, 0,
3, -30, -120, -98, 0, 0,
2, -49, -122, 0, 0, 0,
2, -50, -75, 0, 0, 0,
3, -30, -120, -87, 0, 0,
3, -30, -119, -95, 0, 0,
2, -62, -79, 0, 0, 0,
3, -30, -119, -91, 0, 0,
3, -30, -119, -92, 0, 0,
3, -30, -116, -96, 0, 0,
3, -30, -116, -95, 0, 0,
2, -61, -73, 0, 0, 0,
3, -30, -119, -120, 0, 0,
2, -62, -80, 0, 0, 0,
3, -30, -120, -103, 0, 0,
2, -62, -73, 0, 0, 0,
3, -30, -120, -102, 0, 0,
3, -30, -127, -65, 0, 0,
2, -62, -78, 0, 0, 0,
3, -30, -106, -96, 0, 0,
2, -62, -96, 0, 0, 0
};
}

@ -63,6 +63,12 @@ Utf8Encoder::Utf8Encoder(const FromType sourceEncoding):
translationArray = ToUTF8::windows_1251;
break;
}
case ToUTF8::CP437:
{
translationArray = ToUTF8::cp437;
break;
}
default:
{
assert(0);

@ -12,8 +12,9 @@ namespace ToUTF8
{
WINDOWS_1250, // Central ane Eastern European languages
WINDOWS_1251, // Cyrillic languages
WINDOWS_1252 // Used by English version of Morrowind (and
WINDOWS_1252, // Used by English version of Morrowind (and
// probably others)
CP437 // Used for fonts (*.fnt) if data files encoding is 1252. Otherwise, uses the same encoding as the data files.
};
FromType calculateEncoding(const std::string& encodingName);

@ -2,7 +2,6 @@
<MyGUI type="Skin">
<Skin name = "TextBox" size = "16 16">
<Property key="FontName" value = "EB Garamond" />
<Property key="FontHeight" value = "16" />
<Property key="TextAlign" value = "ALIGN_DEFAULT" />
<Property key="TextColour" value = "0.7 0.7 0.7" />

@ -23,56 +23,21 @@
</Codes>
</Resource>
<Resource type="ResourceTrueTypeFont" name="EB Garamond 24">
<Property key="Source" value="EBGaramond-Regular.ttf"/>
<Property key="Size" value="24"/>
<Property key="Resolution" value="72"/>
<Resource type="ResourceTrueTypeFont" name="MonoFont">
<Property key="Source" value="DejaVuLGCSansMono.ttf"/>
<Property key="Size" value="18"/>
<Property key="Resolution" value="50"/>
<Property key="Antialias" value="false"/>
<Property key="TabWidth" value="8"/>
<Property key="OffsetHeight" value="0"/>
<Codes>
<Code range="33 126"/>
<Code range="160"/> <!-- Non-breaking space -->
<Code range="192 382"/> <!-- Central and Eastern European languages glyphs -->
<Code range="192 382"/>
<Code range="1025 1105"/>
<Code range="2026"/> <!-- Ellipsis -->
<Code range="8470"/>
<Code range="8211"/> <!-- Minus -->
<Code range="8216 8217"/> <!-- Single quotes -->
<Code range="8220 8221"/> <!-- Right and Left Double Quotation mark -->
<Code hide="128"/>
<Code hide="1026 1039"/>
<Code hide="1104"/>
</Codes>
</Resource>
<Resource type="ResourceTrueTypeFont" name="Daedric">
<!--<Property key="Source" value="Oblivion/Oblivion Worn.ttf"/>-->
<Property key="Source" value="Oblivion/Oblivion.ttf"/>
<Property key="Size" value="24"/>
<Property key="Resolution" value="72"/>
<Property key="Antialias" value="false"/>
<Property key="TabWidth" value="8"/>
<Property key="OffsetHeight" value="0"/>
<Codes>
<Code range="65 122"/>
</Codes>
</Resource>
<Resource type="ResourceTrueTypeFont" name="MonoFont">
<Property key="Source" value="DejaVuLGCSansMono.ttf"/>
<Property key="Size" value="18"/>
<Property key="Resolution" value="50"/>
<Property key="Antialias" value="false"/>
<Property key="TabWidth" value="8"/>
<Property key="OffsetHeight" value="0"/>
<Codes>
<Code range="33 126"/>
<Code range="192 382"/>
<Code range="1025 1105"/>
<Code range="8470"/>
<Code hide="128"/>
<Code hide="1026 1039"/>
<Code hide="1104"/>
</Codes>
</Resource>
</MyGUI>

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI>
<MyGUI type="Font">
<Property key="Default" value="EB Garamond"/>
<Property key="Default" value="Magic Cards"/>
</MyGUI>
<MyGUI type="Pointer">

Loading…
Cancel
Save