Server Settings - Font Management

Manage fonts for PDF and charting operations

Overview

The Font Management page allows you to register fonts that ColdFusion needs to locate when it renders PDF output with cfdocument. Proper font configuration is essential for creating professional-looking PDFs with consistent typography, internationalization support, and accurate text rendering across different platforms.

ColdFusion automatically registers the Acrobat built-in fonts and fonts in typical system font locations. You can register additional TrueType (TTF), TrueType Collection (TTC), OpenType (OTF), Adobe printer font (PFB, PDF only) and Adobe Font Metrics (AFM, PDF only) files to meet your application's specific design and language requirements.

Font Registry

System Fonts

ColdFusion automatically displays fonts discovered in platform-specific default locations:

  • Windows: The Windows Fonts directory (for example, WINDOWS/Fonts)
  • Unix: TrueType directories such as /usr/share/fonts/default/TrueType and /usr/X11R6/lib/X11/fonts/TTF
  • Other locations: Fonts stored elsewhere must be registered as user-defined fonts

Font Lists

The page shows User Defined Fonts (fonts registered explicitly), Current System Fonts, and the built-in Acrobat fonts (PDF only), with these columns:

  • Font Family: The family name used in CFML code
  • Font Face: The specific face, such as Bold or Italic
  • PostScript Name: The font's PostScript name
  • Font Type: For example, TrueType or Adobe Built-In
  • Usable In: Where the font can be used (PFB and AFM fonts and Acrobat built-in fonts are PDF only)
  • Path: Location of the font file on disk

Adding Custom Fonts

Register New Font with ColdFusion

The page has a single field for registering fonts:

  1. In the New Font/Font Directory field, enter the absolute path to a font file or to a directory containing fonts
  2. Submit the form
  3. Confirm the new fonts appear under User Defined Fonts

Font File Requirements

Fonts must meet these requirements:

  • File format: .ttf, .ttc, .otf, .pfb or .afm (PFB and AFM are usable in PDF only; ColdFusion does not use PFM fonts)
  • Valid font structure and metadata
  • Read permissions for ColdFusion process user
  • Not corrupted or password-protected

Using Fonts in CFML

PDF Generation

Use registered fonts in cfdocument:

PDF Generation with Custom Fonts
// cfdocument is primarily tag-based, wrap in cfscript
cfdocument(format="pdf") {
  writeOutput('
    <style>
      body { font-family: "Arial", sans-serif; }
      h1 { font-family: "Custom Font Name", serif; }
    </style>
    <h1>This uses your custom font</h1>
    <p>This uses Arial</p>
  ');
}
<cfdocument format="pdf">
  <style>
    body { font-family: 'Arial', sans-serif; }
    h1 { font-family: 'Custom Font Name', serif; }
  </style>
  <h1>This uses your custom font</h1>
  <p>This uses Arial</p>
</cfdocument>

Charting Operations

Specify fonts in cfchart and cfchartseries:

Chart Font Configuration
// cfchart is primarily tag-based, wrap in cfscript
cfchart(format="png", font="Arial", fontSize="12") {
  cfchartseries(type="bar") {
    cfchartdata(item="Q1", value="100");
    cfchartdata(item="Q2", value="150");
  }
}
<cfchart format="png" font="Arial" fontSize="12">
  <cfchartseries type="bar">
    <cfchartdata item="Q1" value="100">
    <cfchartdata item="Q2" value="150">
  </cfchartseries>
</cfchart>

Image Manipulation

Use fonts when adding text to images:

Image Text with Custom Fonts
myImage = imageNew("", 400, 300, "rgb", "white");
attr = {
  font: "Arial",
  size: 24,
  style: "bold"
};
imageDrawText(myImage, "Hello World", 50, 100, attr);
<cfset myImage = imageNew("", 400, 300, "rgb", "white")>
<cfset attr = {
  font: "Arial",
  size: 24,
  style: "bold"
}>
<cfset imageDrawText(myImage, "Hello World", 50, 100, attr)>

Font Embedding in PDFs

The Font Management page has no cache, scanning, embedding or subsetting settings. Whether fonts are embedded in generated PDFs is controlled in code with the fontEmbed attribute of cfdocument (fonts are embedded when it is yes or selective). ColdFusion does not embed fonts that are marked as not-for-embedding.

International Font Support

Unicode Fonts

For international character support:

  • Register fonts that include required Unicode ranges
  • Use fonts like Arial Unicode MS for broad coverage
  • Test with actual international content
  • Verify character rendering in PDFs
  • Check for missing glyph fallbacks

Common International Fonts

  • Chinese: SimSun, Microsoft YaHei, WenQuanYi
  • Japanese: MS Gothic, MS Mincho, IPAGothic
  • Korean: Malgun Gothic, Batang, Dotum
  • Arabic: Arial Unicode MS, Tahoma, Traditional Arabic
  • Cyrillic: Arial, Times New Roman, DejaVu Sans

Right-to-Left Languages

When working with RTL languages (Arabic, Hebrew):

  • Use fonts specifically designed for RTL scripts
  • Test text direction in PDFs
  • Verify proper glyph shaping and ligatures
  • Consider using Unicode BIDI control characters

Best Practices

Font Selection

  • Use web-safe fonts when possible for maximum compatibility
  • Choose fonts with broad Unicode coverage for international content
  • Select fonts with full family support (Regular, Bold, Italic, Bold Italic)
  • Verify font licensing allows PDF embedding
  • Test fonts thoroughly before production deployment
  • Maintain a standard font library across environments

Font Organization

  • Store custom fonts in dedicated directory (e.g., /opt/fonts)
  • Use consistent naming conventions for font files
  • Document font licensing and usage rights
  • Maintain font version control and updates
  • Keep backup copies of all custom fonts

Performance

  • Register only fonts actually used by applications
  • Limit the number of different fonts in PDFs
  • Consider using standard fonts when possible

Production Deployment

  • Install identical fonts across all servers in cluster
  • Verify file permissions allow ColdFusion to read fonts
  • Test PDF generation with all custom fonts
  • Document font dependencies for applications
  • Include fonts in deployment automation
  • Monitor for missing font warnings in logs

Troubleshooting Font Issues

Font Not Found Errors

If ColdFusion reports font not found:

  • Verify font is registered in Font Management page
  • Check font file exists at registered path
  • Confirm font name matches exactly (case-sensitive)
  • Restart ColdFusion after adding new fonts
  • Check ColdFusion process has read permissions
  • Review application.log for font loading errors

Incorrect Font Rendering

If PDFs show wrong font or fallback font:

  • Verify font name is spelled correctly in code
  • Check font style (Regular/Bold/Italic) is registered
  • Ensure font supports required characters
  • Test with simpler font name without special characters
  • Restart ColdFusion after registering new fonts

Missing Characters or Squares

If characters appear as boxes or squares:

  • Font doesn't contain glyphs for those characters
  • Use font with broader Unicode coverage
  • Register fallback font that includes characters
  • Check character encoding in source data
  • Verify font file isn't corrupted

Large PDF File Sizes

If PDFs with custom fonts are too large:

  • Reduce number of different fonts used
  • Consider using standard PDF fonts (Times, Helvetica, Courier)
  • Compress PDFs after generation
  • Use fonts with smaller file sizes

Font Registration Fails

If unable to register a font:

  • Verify font file format (TTF, TTC, OTF, PFB or AFM)
  • Check font file isn't corrupted (open in font viewer)
  • Ensure absolute path is correct
  • Verify ColdFusion has read permissions
  • Review coldfusion-error.log for specific error messages

Fonts Work Locally But Not On Server

If fonts work in development but fail in production:

  • Verify fonts are installed on production server
  • Check font paths match between environments
  • Confirm font registration on production server
  • Verify file permissions on production
  • Check for operating system differences (Windows vs Linux)
  • Review case sensitivity of font paths and names

Font Licensing Considerations

Embedding Permissions

Font licenses often include restrictions on embedding:

  • Review font license agreement for embedding rights
  • Check font embedding permissions in font properties
  • Some fonts prohibit PDF embedding entirely
  • Commercial fonts may require additional licensing for server use
  • Free fonts often have fewer restrictions

Server Licensing

Consider licensing for server deployment:

  • Desktop licenses may not cover server use
  • Server licenses often cost more than desktop licenses
  • Check if license covers all servers in cluster
  • Document licensing for compliance audits
  • Keep license agreements with font files

Free Font Alternatives

Consider these free, open-source fonts:

  • Google Fonts: Large collection of free fonts
  • DejaVu Fonts: Excellent Unicode coverage
  • Liberation Fonts: Metric-compatible with common fonts
  • Noto Fonts: Comprehensive international coverage
  • Open Sans, Roboto: Modern, professional appearance

Security Considerations

Font File Security

  • Store font files in protected directories
  • Set appropriate file permissions (read-only for CF process)
  • Validate font files before registration
  • Monitor for unauthorized font file modifications
  • Use virus scanning on uploaded font files

Path Validation

  • Use absolute paths for font registration
  • Validate font directory paths to prevent path traversal
  • Restrict font directories to approved locations
  • Don't allow user input to specify font paths

Related Resources

Server Settings - Font Management | ColdFusion Administrator | CFGuide