| 291 | } |
| 292 | |
| 293 | void FontExportSerializer::generateFont(DataPtr _data) |
| 294 | { |
| 295 | std::string fontName = _data->getPropertyValue("FontName"); |
| 296 | removeFont(fontName); |
| 297 | |
| 298 | const std::string& resourceCategory = MyGUI::ResourceManager::getInstance().getCategoryName(); |
| 299 | MyGUI::ResourceTrueTypeFont* font = |
| 300 | MyGUI::FactoryManager::getInstance().createObject<MyGUI::ResourceTrueTypeFont>(resourceCategory); |
| 301 | |
| 302 | font->setResourceName(fontName); |
| 303 | |
| 304 | font->setSource(_data->getPropertyValue("Source")); |
| 305 | font->setSize(_data->getPropertyValue<float>("Size")); |
| 306 | font->setResolution(_data->getPropertyValue<int>("Resolution")); |
| 307 | font->setHinting(_data->getPropertyValue("Hinting")); |
| 308 | font->setAntialias(_data->getPropertyValue<bool>("Antialias")); |
| 309 | font->setTabWidth(_data->getPropertyValue<float>("TabWidth")); |
| 310 | font->setOffsetHeight(_data->getPropertyValue<int>("OffsetHeight")); |
| 311 | font->setSubstituteCode(_data->getPropertyValue<int>("SubstituteCode")); |
| 312 | font->setDistance(_data->getPropertyValue<int>("Distance")); |
| 313 | font->setMsdfMode(_data->getPropertyValue<bool>("MsdfMode")); |
| 314 | font->setMsdfRange(_data->getPropertyValue<int>("MsdfRange")); |
| 315 | font->setShader(_data->getPropertyValue("Shader")); |
| 316 | |
| 317 | const std::string& ranges = _data->getPropertyValue("FontCodeRanges"); |
| 318 | std::vector<std::string> values = MyGUI::utility::split(ranges, "|"); |
| 319 | for (const auto& value : values) |
| 320 | { |
| 321 | MyGUI::IntSize size = MyGUI::IntSize::parse(value); |
| 322 | font->addCodePointRange(size.width, size.height); |
| 323 | } |
| 324 | |
| 325 | font->initialise(); |
| 326 | |
| 327 | MyGUI::ResourceManager::getInstance().addResource(font); |
| 328 | } |
| 329 | |
| 330 | void FontExportSerializer::removeFont(std::string_view _fontName) |
| 331 | { |
nothing calls this directly
no test coverage detected