Пример #1
0
	void MGUI_Font::LoadFromXml(const char * source)
	{
		DataStreamPtr stream = ResourceManager::Instance()->OpenResource(source);

		if (stream.IsNull())
			return;

		xml_doc doc;
		XmlHelper::LoadXmlFromMem(doc, (char *)stream->GetData());

		xml_node * root = doc.first_node("Font");

		xml_node * node = root->first_node("FontSource");
		d_assert (node != NULL);
		mFontSource = node->first_attribute("value")->value();

		node = root->first_node("Resolution");
		if (node)
			mResolution = atoi(node->first_attribute("value")->value());

		node = root->first_node("CharSize");
		if (node)
			mCharSize = atoi(node->first_attribute("value")->value());

		node = root->first_node("CharRange");
		while (node)
		{
			MGUI_Char low_ch = (MGUI_Char)atoi(node->first_attribute("low")->value());
			MGUI_Char high_ch = (MGUI_Char)atoi(node->first_attribute("high")->value());

			MGUI_CharRange cr = { low_ch, high_ch };

			mCharRanges.PushBack(cr);

			node = node->next_sibling("CharRange");
		}
	}