Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
文档中的文本可以使用各种字体进行格式化,例如Arial,Times New Roman,Verdana等。 当Aspose.Words呈现文档时,它会尝试选择文档中指定的字体。
但是,在某些情况下,无法找到确切的字体,并且Aspose.Words必须将其替换为类似的字体。 Aspose.Words根据以下过程选择字体:
FontConfig实用程序应用OS字体设置(如果它们可用)。 此非Windows功能必须与FontConfig兼容的OS一起使用。 几乎任何基于Unix的OS已经有一个FontConfig库,旨在提供系统范围的字体配置,自定义和访问应用程序。 否则,用户可以轻松安装此库。FontConfig实用程序处于禁用状态。 您可以按如下方式启用它: fontSettings->get_SubstitutionSettings()->get_FontConfigSubstitution()->set_Enabled(true);
<TableSubstitutionSettings xmlns="Aspose.Words">
<SubstitutesTable>
<Item OriginalFont="Arabic Transparent" SubstituteFonts="Arial" />
…
</SubstitutesTable>
</TableSubstitutionSettings>
fontSettings->get_SubstitutionSettings()->get_TableSubstitution()->Load(u"Table.xml");
fontSettings->get_SubstitutionSettings()->get_TableSubstitution()->Save(u"MyTable.xml");
fontSettings->get_SubstitutionSettings()->get_TableSubstitution()->set_Enabled(false);
System::SharedPtr<FontInfoCollection> fontInfos = doc->get_FontInfos();
fontSettings->get_SubstitutionSettings()->get_FontInfoSubstitution()->set_Enabled(false);
FontInfo替换也失败时,将应用DefaultFont替换规则。 默认情况下也启用此规则。 根据此规则,Aspose.Words将尝试使用DefaultFontName属性中指定的默认字体。 如果用户没有选择自己的默认字体,那么"Times New Roman"将被用作默认字体。 可以禁用此规则,如下所示: fontSettings->get_SubstitutionSettings()->get_DefaultFontSubstitution()->set_Enabled(false);
fontSettings->get_SubstitutionSettings()->get_DefaultFontSubstitution()->get_DefaultFontName();
fontSettings->get_SubstitutionSettings()->get_DefaultFontSubstitution()->set_DefaultFontName(u"Arial");
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.