|
|
@ -29,15 +29,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
namespace
|
|
|
|
namespace
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MyGUI::xml::ElementPtr getProperty(MyGUI::xml::ElementPtr resourceNode, const std::string propertyName)
|
|
|
|
MyGUI::xml::ElementPtr getProperty(MyGUI::xml::ElementPtr resourceNode, std::string_view propertyName)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MyGUI::xml::ElementPtr propertyNode = nullptr;
|
|
|
|
MyGUI::xml::ElementPtr propertyNode = nullptr;
|
|
|
|
MyGUI::xml::ElementEnumerator propertyIterator = resourceNode->getElementEnumerator();
|
|
|
|
MyGUI::xml::ElementEnumerator propertyIterator = resourceNode->getElementEnumerator();
|
|
|
|
while (propertyIterator.next("Property"))
|
|
|
|
while (propertyIterator.next("Property"))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::string key = propertyIterator->findAttribute("key");
|
|
|
|
if (propertyIterator->findAttribute("key") == propertyName)
|
|
|
|
|
|
|
|
|
|
|
|
if (key == propertyName)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
propertyNode = propertyIterator.current();
|
|
|
|
propertyNode = propertyIterator.current();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -55,17 +53,17 @@ namespace
|
|
|
|
MyGUI::xml::ElementEnumerator layersIterator = root->getElementEnumerator();
|
|
|
|
MyGUI::xml::ElementEnumerator layersIterator = root->getElementEnumerator();
|
|
|
|
while (layersIterator.next("Layer"))
|
|
|
|
while (layersIterator.next("Layer"))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::string name = layersIterator->findAttribute("name");
|
|
|
|
if (layersIterator->findAttribute("name") == "JournalBooks")
|
|
|
|
|
|
|
|
|
|
|
|
if (name == "JournalBooks")
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MyGUI::xml::ElementPtr sizeProperty = getProperty(layersIterator.current(), "Size");
|
|
|
|
MyGUI::xml::ElementPtr sizeProperty = getProperty(layersIterator.current(), "Size");
|
|
|
|
const std::string& sizeValue
|
|
|
|
if (sizeProperty != nullptr)
|
|
|
|
= sizeProperty != nullptr ? sizeProperty->findAttribute("value") : std::string();
|
|
|
|
{
|
|
|
|
|
|
|
|
std::string sizeValue = sizeProperty->findAttribute("value");
|
|
|
|
if (!sizeValue.empty())
|
|
|
|
if (!sizeValue.empty())
|
|
|
|
return MyGUI::IntSize::parse(sizeValue);
|
|
|
|
return MyGUI::IntSize::parse(sizeValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return MyGUI::RenderManager::getInstance().getViewSize();
|
|
|
|
return MyGUI::RenderManager::getInstance().getViewSize();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -215,7 +213,7 @@ namespace
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[[noreturn]] void fail(std::istream& stream, const std::string& fileName, const std::string& message)
|
|
|
|
[[noreturn]] void fail(std::istream& stream, std::string_view fileName, std::string_view message)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::stringstream error;
|
|
|
|
std::stringstream error;
|
|
|
|
error << "Font loading error: " << message;
|
|
|
|
error << "Font loading error: " << message;
|
|
|
@ -291,7 +289,7 @@ namespace Gui
|
|
|
|
MyGUI::IntSize bookSize = getBookSize(layersStream.get());
|
|
|
|
MyGUI::IntSize bookSize = getBookSize(layersStream.get());
|
|
|
|
float bookScale = osgMyGUI::ScalingLayer::getScaleFactor(bookSize);
|
|
|
|
float bookScale = osgMyGUI::ScalingLayer::getScaleFactor(bookSize);
|
|
|
|
|
|
|
|
|
|
|
|
const auto oldDataPath = dataManager->getDataPath("");
|
|
|
|
const auto oldDataPath = dataManager->getDataPath({});
|
|
|
|
dataManager->setResourcePath("fonts");
|
|
|
|
dataManager->setResourcePath("fonts");
|
|
|
|
std::unique_ptr<MyGUI::IDataStream> dataStream(dataManager->getData(fileName));
|
|
|
|
std::unique_ptr<MyGUI::IDataStream> dataStream(dataManager->getData(fileName));
|
|
|
|
|
|
|
|
|
|
|
@ -303,8 +301,7 @@ namespace Gui
|
|
|
|
bool valid = false;
|
|
|
|
bool valid = false;
|
|
|
|
if (resourceNode.next("Resource"))
|
|
|
|
if (resourceNode.next("Resource"))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::string type = resourceNode->findAttribute("type");
|
|
|
|
valid = resourceNode->findAttribute("type") == "ResourceTrueTypeFont";
|
|
|
|
valid = (type == "ResourceTrueTypeFont");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (valid == false)
|
|
|
|
if (valid == false)
|
|
|
@ -450,7 +447,7 @@ namespace Gui
|
|
|
|
defaultHeight->addAttribute("value", fontSize);
|
|
|
|
defaultHeight->addAttribute("value", fontSize);
|
|
|
|
MyGUI::xml::ElementPtr source = root->createChild("Property");
|
|
|
|
MyGUI::xml::ElementPtr source = root->createChild("Property");
|
|
|
|
source->addAttribute("key", "Source");
|
|
|
|
source->addAttribute("key", "Source");
|
|
|
|
source->addAttribute("value", std::string(bitmapFilename));
|
|
|
|
source->addAttribute("value", bitmapFilename);
|
|
|
|
MyGUI::xml::ElementPtr codes = root->createChild("Codes");
|
|
|
|
MyGUI::xml::ElementPtr codes = root->createChild("Codes");
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 256; i++)
|
|
|
|
for (int i = 0; i < 256; i++)
|
|
|
@ -532,12 +529,12 @@ namespace Gui
|
|
|
|
additional.insert(std::make_pair(84, 0x2122)); // trademark sign
|
|
|
|
additional.insert(std::make_pair(84, 0x2122)); // trademark sign
|
|
|
|
additional.insert(std::make_pair(45, 0x2212)); // minus sign
|
|
|
|
additional.insert(std::make_pair(45, 0x2212)); // minus sign
|
|
|
|
|
|
|
|
|
|
|
|
for (std::multimap<int, int>::iterator it = additional.begin(); it != additional.end(); ++it)
|
|
|
|
for (const auto [key, value] : additional)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (it->first != i)
|
|
|
|
if (key != i)
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
code = codes->createChild("Code");
|
|
|
|
code = codes->createChild("Code");
|
|
|
|
code->addAttribute("index", it->second);
|
|
|
|
code->addAttribute("index", value);
|
|
|
|
code->addAttribute("coord",
|
|
|
|
code->addAttribute("coord",
|
|
|
|
MyGUI::utility::toString(x1) + " " + MyGUI::utility::toString(y1) + " "
|
|
|
|
MyGUI::utility::toString(x1) + " " + MyGUI::utility::toString(y1) + " "
|
|
|
|
+ MyGUI::utility::toString(w) + " " + MyGUI::utility::toString(h));
|
|
|
|
+ MyGUI::utility::toString(w) + " " + MyGUI::utility::toString(h));
|
|
|
@ -638,10 +635,9 @@ namespace Gui
|
|
|
|
return mFontHeight;
|
|
|
|
return mFontHeight;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::string FontLoader::getFontForFace(const std::string& face)
|
|
|
|
std::string_view FontLoader::getFontForFace(std::string_view face)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const std::string lowerFace = Misc::StringUtils::lowerCase(face);
|
|
|
|
if (Misc::StringUtils::ciEqual(face, "daedric"))
|
|
|
|
if (lowerFace == "daedric")
|
|
|
|
|
|
|
|
return "ScrollFont";
|
|
|
|
return "ScrollFont";
|
|
|
|
|
|
|
|
|
|
|
|
return "DefaultFont";
|
|
|
|
return "DefaultFont";
|
|
|
|