| 39 | } |
| 40 | |
| 41 | void ResourceManualFont::deserialization(xml::ElementPtr _node, Version _version) |
| 42 | { |
| 43 | Base::deserialization(_node, _version); |
| 44 | |
| 45 | xml::ElementEnumerator node = _node->getElementEnumerator(); |
| 46 | while (node.next()) |
| 47 | { |
| 48 | if (node->getName() == "Property") |
| 49 | { |
| 50 | std::string_view key = node->findAttribute("key"); |
| 51 | std::string_view value = node->findAttribute("value"); |
| 52 | if (key == "Source") |
| 53 | mSource = value; |
| 54 | else if (key == "DefaultHeight") |
| 55 | mDefaultHeight = utility::parseInt(value); |
| 56 | else if (key == "Shader") |
| 57 | mShader = value; |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | loadTexture(); |
| 62 | |
| 63 | if (mTexture != nullptr) |
| 64 | { |
| 65 | if (!mShader.empty()) |
| 66 | mTexture->setShader(mShader); |
| 67 | int textureWidth = mTexture->getWidth(); |
| 68 | int textureHeight = mTexture->getHeight(); |
| 69 | |
| 70 | node = _node->getElementEnumerator(); |
| 71 | while (node.next()) |
| 72 | { |
| 73 | if (node->getName() == "Codes") |
| 74 | { |
| 75 | xml::ElementEnumerator element = node->getElementEnumerator(); |
| 76 | while (element.next("Code")) |
| 77 | { |
| 78 | std::string value; |
| 79 | // описане глифов |
| 80 | if (element->findAttribute("index", value)) |
| 81 | { |
| 82 | Char id = 0; |
| 83 | if (value == "cursor") |
| 84 | id = static_cast<Char>(FontCodeType::Cursor); |
| 85 | else if (value == "selected") |
| 86 | id = static_cast<Char>(FontCodeType::Selected); |
| 87 | else if (value == "selected_back") |
| 88 | id = static_cast<Char>(FontCodeType::SelectedBack); |
| 89 | else if (value == "substitute") |
| 90 | id = static_cast<Char>(FontCodeType::NotDefined); |
| 91 | else |
| 92 | id = utility::parseUInt(value); |
| 93 | |
| 94 | FloatPoint bearing(utility::parseValue<FloatPoint>(element->findAttribute("bearing"))); |
| 95 | |
| 96 | // texture coordinates |
| 97 | FloatCoord coord(utility::parseValue<FloatCoord>(element->findAttribute("coord"))); |
| 98 |
nothing calls this directly
no test coverage detected