Load Custom Fonts

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Comparison MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-comparison -- dnx GroupDocs.Comparison.Mcp --yes
Folders, licensing and more →

GroupDocs.Comparison for Python via .NET can compare documents that use non-standard fonts. Register the custom font directory through a LoadOptions instance before opening the documents.

Example: Connect custom fonts and compare documents

from groupdocs.comparison import Comparer
from groupdocs.comparison.options import LoadOptions

def load_custom_fonts():
    load_options = LoadOptions()
    load_options.font_directories.append("./fonts/")

    with Comparer("./source.docx", load_options) as comparer:
        comparer.add("./target.docx", load_options)
        comparer.compare("./result.docx")

if __name__ == "__main__":
    load_custom_fonts()

source.docx is the source file used in this example. Click here to download it.

target.docx is the target file used in this example. Click here to download it.

Binary file (DOCX, 11 KB)

Download full output

The ./fonts/ directory in the example should contain the .otf or .ttf files needed to render the document accurately.