Products Technologies Demo Docs Blog Support Company

TX Text Control Linux Preview: Font Handling

TX Text Control for Linux introduces a revamped, cross-platform font rendering system that eliminates the need for manual font installation. The new Linux version simplifies deployment by offering a built-in font system, ensuring consistent, high-quality document rendering across platforms.

TX Text Control Linux Preview: Font Handling

Preview Information

The information presented in this article refers to features and updates planned for the upcoming release of TX Text Control, which has not yet been officially launched. Details and specifications are subject to change until the release is finalized. Please stay tuned for the official release announcement and documentation.

The upcoming release of TX Text Control for Linux represents a significant milestone in the evolution of document processing, promising a platform-independent solution with the same high-quality rendering and performance users have come to expect from our technology. In this article, we focus on the transformative changes made to the font rendering system that is central to our Linux offering.

Font Rendering

In the past, TX Text Control's font rendering relied heavily on Windows-specific technologies, but with our move to Linux, we've completely rewritten the font rendering system to ensure cross-platform compatibility. The result is a robust, platform-independent solution that delivers accurate, high-quality font rendering in Linux environments without sacrificing the speed and efficiency you rely on. The move to Linux involved significant technical updates, such as overhauling key components like the window management system that were originally tightly integrated with Windows. These changes allow us to offer a scalable, flexible document processing solution that seamlessly integrates with Linux systems while maintaining the rich functionality and performance for which TX Text Control is known.

In the Windows versions of TX Text Control, fonts were sourced directly from the fonts installed on the hosting system, such as Windows Server 2019. This approach worked well in traditional environments, where the necessary fonts were already available. However, a key challenge arose with newer systems (Windows Server 2025), which often don't come with a full set of fonts preinstalled. As a result, users had to manually install specific fonts to ensure proper document rendering.

This manual font installation process was particularly problematic in environments such as Docker or cloud deployments, where managing system fonts can be complex and time-consuming. In these scenarios, users were often forced to deal with the additional overhead of configuring and ensuring the correct fonts were available, adding a layer of complexity to the deployment process.

Built-in Font System

With the new TX Text Control for Linux, we've taken steps to streamline font handling and ensure a smoother, more reliable experience across environments without these dependencies.

TX Text Control for Linux now includes a built-in font system that provides a comprehensive set of fonts out-of-the-box, eliminating the need for manual font installation. This new system ensures that documents render correctly regardless of the environment, making it easier for users to deploy and manage TX Text Control in a variety of scenarios.

After adding the NuGet package to the project, a folder named Fonts is automatically added to the project. A standard set of sans-serif and serif fonts for the most common types is included in this folder.

TX Text Control NuGet package

The fonts in this folder can now be used with the TX Text Control to load documents and export them to PDF, for example. What happens if I use a font that doesn't exist in that folder? The following code loads a document that uses the Arial and Segoe UI fonts.

// Create an instance of the TX Text Control ServerTextControl class for server-side document processing
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl())
{
    // Initialize the ServerTextControl object
    tx.Create();

    // Subscribe to the AdaptFont event to handle font substitution
    tx.AdaptFont += Tx_AdaptFont;

    // Enable the AdaptFont event by setting the appropriate FontSettings property
    tx.FontSettings.AdaptFontEvent = true;

    // Load a document into the ServerTextControl instance
    // "font.tx" is the source document, loaded in Internal Unicode format
    tx.Load("font.tx", TXTextControl.StreamType.InternalUnicodeFormat);

    // Save the loaded document as a PDF file
    // "output.pdf" is the target file, saved in Adobe PDF format
    tx.Save("output.pdf", TXTextControl.StreamType.AdobePDF);
}

// Event handler for the AdaptFont event
// This is triggered when a font in the document cannot be found and needs to be substituted
void Tx_AdaptFont(object sender, TXTextControl.AdaptFontEventArgs e)
{
    // Log the name of the missing font
    Console.WriteLine("Font not found: " + e.FontName);

    // Log the name of the font that is being used as a replacement
    Console.WriteLine("Font replaced with: " + e.AdaptedFontName);  
}

When running this code, the following output is generated:

Font not found: Arial
Font replaced with: Liberation Sans
Font not found: Segoe UI
Font replaced with: Liberation Sans

The fonts could not be found and have been replaced with substitutes.

To use other fonts, you can simply copy additional fonts to the predefined Fonts folder when you deploy your application, or you can specify a second location. In the sample application, we simply created a new folder called Additional Fonts and copied Arial and Segoe UI into it.

TX Text Control NuGet package

Now all you need to do is call the static InstallFonts method to register the fonts in the folder.

TXTextControl.ServerTextControl.InstallFonts("Additional Fonts");

Benefits

The new Fonts folder in TX Text Control for Linux provides significant benefits for deployment in App Services or Docker containers. The Fonts folder allows you to package all required fonts directly with your application, eliminating the need to rely on system-installed fonts. This ensures that the application works consistently, regardless of the hosting environment, without additional configuration.

In environments like Docker or Azure App Services, managing and installing system fonts can be challenging due to their lightweight and isolated nature. The Fonts folder streamlines this process by bundling fonts with the application, reducing the complexity of deployment pipelines. By embedding fonts in the application, you can ensure consistent document rendering across instances, environments, and updates. This is particularly beneficial for scaling applications in cloud environments, as font availability is no longer a variable.

Applications with bundled font folders are portable and can be deployed across multiple infrastructures without modification. This makes the solution ideal for containerized deployments where simplicity and predictability are key. There's no need to manage or update system fonts separately. All required font updates can be handled within the application package itself, providing a centralized and straightforward workflow. This innovation ensures a more efficient, reliable, and predictable deployment experience, allowing developers to focus on functionality without worrying about font dependencies.

Stay tuned for more updates on the upcoming release of TX Text Control for Linux, including additional features and improvements that will enhance your document processing capabilities.

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

Related Posts

ASP.NETASP.NET CoreDOCX

Convert MS Word DOCX to PDF including Text Reflow using .NET C# on Linux

This article explains how to use TX Text Control .NET Server to convert a Microsoft Word DOCX document to a PDF file on a Linux system using .NET C#. This conversion process includes text reflow,…


ASP.NETASP.NET CoreLinux

How to Create PDF Documents with TX Text Control using C# .NET on Linux

This article shows how to create professional PDF and PDF/A documents using ASP.NET Core C# on Linux. TX Text Control enables the creation of pixel-perfect PDF documents on any Linux environment…


ASP.NETASP.NET CoreExtraction

Mining PDFs with Regex in C#: Practical Patterns, Tips, and Ideas

Mining PDFs with Regex in C# can be a powerful technique for extracting information from documents. This article explores practical patterns, tips, and ideas for effectively using regular…


ASP.NETASP.NET CoreForms

Streamline Data Collection with Embedded Forms in C# .NET

Discover how to enhance your C# .NET applications by embedding forms for data collection. This article explores the benefits of using Text Control's ASP.NET and ASP.NET Core components to create…


ASP.NETASP.NET CorePDF

Adding QR Codes to PDF Documents in C# .NET

This article explains how to add QR codes to PDF documents with the Text Control .NET Server component in C#. It provides the necessary steps and code snippets for effectively implementing this…