Set custom fonts

You can add custom font sources.

The following code snippet shows how to add a custom font source:

import com.groupdocs.viewer.Viewer;
import com.groupdocs.viewer.fonts.FolderFontSource;
import com.groupdocs.viewer.fonts.FontSettings;
import com.groupdocs.viewer.fonts.SearchOption;
import com.groupdocs.viewer.options.HtmlViewOptions;
// ...

FolderFontSource fontSource = new FolderFontSource("C:\\custom_fonts", SearchOption.TOP_FOLDER_ONLY);
FontSettings.setFontSources(fontSource);

try (Viewer viewer = new Viewer("sample.docx")) {
    HtmlViewOptions viewOptions = HtmlViewOptions.forEmbeddedResources();
    viewer.view(viewOptions);
}