//ExStart:GetSubstitutionWithoutSuffixes public static void GetSubstitutionWithoutSuffixes(string dataDir) { Document doc = new Document(dataDir + "Get substitution without suffixes.docx"); DocumentSubstitutionWarnings substitutionWarningHandler = new DocumentSubstitutionWarnings(); doc.WarningCallback = substitutionWarningHandler; ArrayList fontSources = new ArrayList(FontSettings.DefaultInstance.GetFontsSources()); FolderFontSource folderFontSource = new FolderFontSource(dataDir + "Fonts/", true); fontSources.Add(folderFontSource); FontSourceBase[] updatedFontSources = (FontSourceBase[])fontSources.ToArray(typeof(FontSourceBase)); FontSettings.DefaultInstance.SetFontsSources(updatedFontSources); doc.Save(dataDir + "GetSubstitutionWithoutSuffixes_out.pdf"); Assert.AreEqual( "Font 'DINOT-Regular' has not been found. Using 'DINOT' font instead. Reason: font name substitution.", substitutionWarningHandler.FontWarnings[0].Description); }
public void GetSubstitutionWithoutSuffixes() { Document doc = new Document(MyDir + "Get substitution without suffixes.docx"); DocumentSubstitutionWarnings substitutionWarningHandler = new DocumentSubstitutionWarnings(); doc.WarningCallback = substitutionWarningHandler; List <FontSourceBase> fontSources = new List <FontSourceBase>(FontSettings.DefaultInstance.GetFontsSources()); FolderFontSource folderFontSource = new FolderFontSource(FontsDir, true); fontSources.Add(folderFontSource); FontSourceBase[] updatedFontSources = fontSources.ToArray(); FontSettings.DefaultInstance.SetFontsSources(updatedFontSources); doc.Save(ArtifactsDir + "WorkingWithFonts.GetSubstitutionWithoutSuffixes.pdf"); Assert.AreEqual( "Font 'DINOT-Regular' has not been found. Using 'DINOT' font instead. Reason: font name substitution.", substitutionWarningHandler.FontWarnings[0].Description); }