private bool AppliesToImpl(DocumentNode node) { if (PlatformTypes.FontFamily.IsAssignableFrom((ITypeId)node.Type)) { DocumentPrimitiveNode documentPrimitiveNode = node as DocumentPrimitiveNode; if (documentPrimitiveNode != null) { DocumentNodeStringValue documentNodeStringValue = documentPrimitiveNode.Value as DocumentNodeStringValue; if (documentNodeStringValue != null) { FontFamily oldFontFamily; FontFamily newFontFamily; FontEmbedder.CreateFontFamilyChange(this.FontFamilyChangeModel.FontChangeType, this.FontFamilyChangeModel.ProjectFont, node.Context, out oldFontFamily, out newFontFamily); return(FontEmbedder.AreFontsEqual(new FontFamily(FontFamilyHelper.EnsureFamilyName(documentNodeStringValue.Value)), oldFontFamily, node.Context)); } } } return(false); }
protected override void ApplyChange(ChangedNodeInfo changedNodeInfo) { DocumentNode node = changedNodeInfo.Node; FontFamily oldFontFamily; FontFamily newFontFamily; FontEmbedder.CreateFontFamilyChange(this.fontFamilyChangeModel.FontChangeType, this.fontFamilyChangeModel.ProjectFont, changedNodeInfo.Node.Context, out oldFontFamily, out newFontFamily); DocumentNode documentNode = (DocumentNode)node.Context.CreateNode(PlatformTypes.FontFamily, (IDocumentNodeValue) new DocumentNodeStringValue(newFontFamily.Source)); if (node.SiteChildIndex != -1) { node.Parent.Children[node.SiteChildIndex] = documentNode; } else { if (node.SitePropertyKey == null) { return; } node.Parent.Properties[(IPropertyId)node.SitePropertyKey] = documentNode; } }