public class FontSubstitutionWarningInfo extends WarningInfo
Examples:
Shows how to get additional information about font substitution.
Document doc = new Document(getMyDir() + "Rendering.docx");
WarningInfoCollection callback = new WarningInfoCollection();
doc.setWarningCallback(callback);
FontSettings fontSettings = new FontSettings();
fontSettings.getSubstitutionSettings().getDefaultFontSubstitution().setDefaultFontName("Arial");
fontSettings.setFontsFolder(getFontsDir(), false);
fontSettings.getSubstitutionSettings().getTableSubstitution().addSubstitutes("Arial", "Arvo", "Slab");
doc.setFontSettings(fontSettings);
doc.save(getArtifactsDir() + "FontSettings.SubstitutionWarnings.pdf");
FontSubstitutionWarningInfo warningInfo = (FontSubstitutionWarningInfo)callback.get(0);
Assert.assertEquals(WarningSource.LAYOUT, warningInfo.getSource());
Assert.assertEquals(WarningType.FONT_SUBSTITUTION, warningInfo.getWarningType());
Assert.assertEquals(FontSubstitutionReason.TABLE_SUBSTITUTION_RULE, warningInfo.getReason());
Assert.assertEquals("Font \'Arial\' has not been found. Using \'Arvo\' font instead. Reason: table substitution.", warningInfo.getDescription());
Assert.assertTrue(warningInfo.getRequestedBold());
Assert.assertFalse(warningInfo.getRequestedItalic());
Assert.assertEquals("Arial", warningInfo.getRequestedFamilyName());
| Modifier and Type | Method and Description |
|---|---|
int |
getReason()
Font substitution reason.
|
boolean |
getRequestedBold()
Indicates whether bold style was requested.
|
java.lang.String |
getRequestedFamilyName()
Requested font family name.
|
boolean |
getRequestedItalic()
Indicates whether italic style was requested.
|
PhysicalFontInfo |
getResolvedFont()
Resolved font.
|
getDescription, getSource, getWarningTypepublic int getReason()
Examples:
Shows how to get additional information about font substitution.
Document doc = new Document(getMyDir() + "Rendering.docx");
WarningInfoCollection callback = new WarningInfoCollection();
doc.setWarningCallback(callback);
FontSettings fontSettings = new FontSettings();
fontSettings.getSubstitutionSettings().getDefaultFontSubstitution().setDefaultFontName("Arial");
fontSettings.setFontsFolder(getFontsDir(), false);
fontSettings.getSubstitutionSettings().getTableSubstitution().addSubstitutes("Arial", "Arvo", "Slab");
doc.setFontSettings(fontSettings);
doc.save(getArtifactsDir() + "FontSettings.SubstitutionWarnings.pdf");
FontSubstitutionWarningInfo warningInfo = (FontSubstitutionWarningInfo)callback.get(0);
Assert.assertEquals(WarningSource.LAYOUT, warningInfo.getSource());
Assert.assertEquals(WarningType.FONT_SUBSTITUTION, warningInfo.getWarningType());
Assert.assertEquals(FontSubstitutionReason.TABLE_SUBSTITUTION_RULE, warningInfo.getReason());
Assert.assertEquals("Font \'Arial\' has not been found. Using \'Arvo\' font instead. Reason: table substitution.", warningInfo.getDescription());
Assert.assertTrue(warningInfo.getRequestedBold());
Assert.assertFalse(warningInfo.getRequestedItalic());
Assert.assertEquals("Arial", warningInfo.getRequestedFamilyName());
int value. The returned value is one of FontSubstitutionReason constants.public java.lang.String getRequestedFamilyName()
Examples:
Shows how to get additional information about font substitution.
Document doc = new Document(getMyDir() + "Rendering.docx");
WarningInfoCollection callback = new WarningInfoCollection();
doc.setWarningCallback(callback);
FontSettings fontSettings = new FontSettings();
fontSettings.getSubstitutionSettings().getDefaultFontSubstitution().setDefaultFontName("Arial");
fontSettings.setFontsFolder(getFontsDir(), false);
fontSettings.getSubstitutionSettings().getTableSubstitution().addSubstitutes("Arial", "Arvo", "Slab");
doc.setFontSettings(fontSettings);
doc.save(getArtifactsDir() + "FontSettings.SubstitutionWarnings.pdf");
FontSubstitutionWarningInfo warningInfo = (FontSubstitutionWarningInfo)callback.get(0);
Assert.assertEquals(WarningSource.LAYOUT, warningInfo.getSource());
Assert.assertEquals(WarningType.FONT_SUBSTITUTION, warningInfo.getWarningType());
Assert.assertEquals(FontSubstitutionReason.TABLE_SUBSTITUTION_RULE, warningInfo.getReason());
Assert.assertEquals("Font \'Arial\' has not been found. Using \'Arvo\' font instead. Reason: table substitution.", warningInfo.getDescription());
Assert.assertTrue(warningInfo.getRequestedBold());
Assert.assertFalse(warningInfo.getRequestedItalic());
Assert.assertEquals("Arial", warningInfo.getRequestedFamilyName());
String value.public boolean getRequestedBold()
Examples:
Shows how to get additional information about font substitution.
Document doc = new Document(getMyDir() + "Rendering.docx");
WarningInfoCollection callback = new WarningInfoCollection();
doc.setWarningCallback(callback);
FontSettings fontSettings = new FontSettings();
fontSettings.getSubstitutionSettings().getDefaultFontSubstitution().setDefaultFontName("Arial");
fontSettings.setFontsFolder(getFontsDir(), false);
fontSettings.getSubstitutionSettings().getTableSubstitution().addSubstitutes("Arial", "Arvo", "Slab");
doc.setFontSettings(fontSettings);
doc.save(getArtifactsDir() + "FontSettings.SubstitutionWarnings.pdf");
FontSubstitutionWarningInfo warningInfo = (FontSubstitutionWarningInfo)callback.get(0);
Assert.assertEquals(WarningSource.LAYOUT, warningInfo.getSource());
Assert.assertEquals(WarningType.FONT_SUBSTITUTION, warningInfo.getWarningType());
Assert.assertEquals(FontSubstitutionReason.TABLE_SUBSTITUTION_RULE, warningInfo.getReason());
Assert.assertEquals("Font \'Arial\' has not been found. Using \'Arvo\' font instead. Reason: table substitution.", warningInfo.getDescription());
Assert.assertTrue(warningInfo.getRequestedBold());
Assert.assertFalse(warningInfo.getRequestedItalic());
Assert.assertEquals("Arial", warningInfo.getRequestedFamilyName());
boolean value.public boolean getRequestedItalic()
Examples:
Shows how to get additional information about font substitution.
Document doc = new Document(getMyDir() + "Rendering.docx");
WarningInfoCollection callback = new WarningInfoCollection();
doc.setWarningCallback(callback);
FontSettings fontSettings = new FontSettings();
fontSettings.getSubstitutionSettings().getDefaultFontSubstitution().setDefaultFontName("Arial");
fontSettings.setFontsFolder(getFontsDir(), false);
fontSettings.getSubstitutionSettings().getTableSubstitution().addSubstitutes("Arial", "Arvo", "Slab");
doc.setFontSettings(fontSettings);
doc.save(getArtifactsDir() + "FontSettings.SubstitutionWarnings.pdf");
FontSubstitutionWarningInfo warningInfo = (FontSubstitutionWarningInfo)callback.get(0);
Assert.assertEquals(WarningSource.LAYOUT, warningInfo.getSource());
Assert.assertEquals(WarningType.FONT_SUBSTITUTION, warningInfo.getWarningType());
Assert.assertEquals(FontSubstitutionReason.TABLE_SUBSTITUTION_RULE, warningInfo.getReason());
Assert.assertEquals("Font \'Arial\' has not been found. Using \'Arvo\' font instead. Reason: table substitution.", warningInfo.getDescription());
Assert.assertTrue(warningInfo.getRequestedBold());
Assert.assertFalse(warningInfo.getRequestedItalic());
Assert.assertEquals("Arial", warningInfo.getRequestedFamilyName());
boolean value.public PhysicalFontInfo getResolvedFont()
PhysicalFontInfo value.