public EntityManager(FontCollection FontCollection) { this.fonts_ = null; this.fonts_ = FontCollection; this.mapper_ = new Entity2FontMapper(this.fonts_, true); this.list_ = new ArrayList(5); this.fontFamilyInfos_ = new Hashtable(5, 0.5f); for (int i = 0; i < this.mapper_.FontTable_Count; i++) { FontFamilyInfo fontFamilyInfo = new FontFamilyInfo(); FontTable fontTable = this.mapper_.GetFontTable(i); fontFamilyInfo.FontFamily = fontTable.FontFamily; fontFamilyInfo.Name = fontTable.Name; fontFamilyInfo.CorrectB = fontTable.CorrectB; fontFamilyInfo.CorrectH = fontTable.CorrectH; fontFamilyInfo.CorrectW = fontTable.CorrectW; fontFamilyInfo.CorrectY = fontTable.CorrectY; fontFamilyInfo.CorrectX = fontTable.CorrectX; this.list_.Add(fontFamilyInfo); this.fontFamilyInfos_.Add(fontFamilyInfo.FontFamily, fontFamilyInfo); } this.mapper_.ClearFontTables(); this.ids_ = new MapItems(); this.ops_ = new MapItems(); try { for (int i = 0; i < this.mapper_.uniCats_.Count; i++) { bool isActive = false; UnicodeCategory unicodeCategory = this.mapper_.uniCats_.Indexer(i); isActive = false; switch (unicodeCategory.ID) { case 1: case 3: case 4: case 7: case 9: case 11: case 12: case 14: case 0x16: case 0x1d: case 0x1f: case 0x20: isActive = true; break; } this.ids_.Put(unicodeCategory.ID, unicodeCategory.Name, isActive); isActive = false; switch (unicodeCategory.ID) { case 1: case 11: case 12: case 0x10: case 0x11: case 0x12: case 0x18: case 0x19: case 0x1d: case 0x20: isActive = true; break; } this.ops_.Put(unicodeCategory.ID, unicodeCategory.Name, isActive); } for (int g = 0; g < this.Count; g++) { Glyph glyph = this.Get(g); if ((glyph != null) && glyph.IsVisible) { this.ops_.Ref(glyph.Category.ID, true); this.ids_.Ref(glyph.Category.ID, true); if (glyph.FontFamily.Length > 0) { this.ops_.Ref(glyph.Category.ID, false); this.ids_.Ref(glyph.Category.ID, false); } } } } catch { } }
private void Parse(XmlDocument xmlDoc) { try { XmlNode root = xmlDoc.DocumentElement; if (!root.HasChildNodes) { return; } int count = 0; count = root.ChildNodes.Count; for (int i = 0; i < count; i++) { XmlNode child = root.ChildNodes[i]; if (child != null) { string id = ""; string name = ""; string description = ""; string min = ""; string max = ""; string sType = ""; XmlNode node = child.Attributes.GetNamedItem("name", ""); if (node != null) { name = node.Value; } node = child.Attributes.GetNamedItem("index", ""); if (node != null) { id = node.Value; } node = child.Attributes.GetNamedItem("dscription", ""); if (node != null) { description = node.Value; } node = child.Attributes.GetNamedItem("min", ""); if (node != null) { min = node.Value; } node = child.Attributes.GetNamedItem("max", ""); if (node != null) { max = node.Value; } node = child.Attributes.GetNamedItem("type", ""); if (node != null) { sType = node.Value; } UnicodeCategory category = new UnicodeCategory(id, name, sType, description, min, max); this.list_.Add(category); } } } catch { } }