Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8925991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:51:12+00:00 2026-06-15T07:51:12+00:00

I have a program using iTextSharp that includes the code FontFactory.RegisterDirectories(); foreach (string fontname

  • 0

I have a program using iTextSharp that includes the code

FontFactory.RegisterDirectories();

foreach (string fontname in FontFactory.RegisteredFonts)
{
   Log.Info("**** Found registered font: " + fontname);
}

When I run it (using Mono on a CentOS box), the log shows only the core PostScript fonts:

  • zapfdingbats
  • times-roman
  • times-italic
  • helvetica-boldoblique
  • courier-boldoblique
  • helvetica-bold
  • helvetica
  • courier-oblique
  • helvetica-oblique
  • courier-bold
  • times-bolditalic
  • courier
  • times-bold
  • symbol

But I have 156 TTF files under my /usr/share/fonts directory tree (which is one of the directories mentioned in the code for the RegisterDirectories function). Why aren’t these being registered?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T07:51:13+00:00Added an answer on June 15, 2026 at 7:51 am

    There are subtle differences between iText and iTextSharp.

    In iText, registerDirectories() looks like this:

    public int registerDirectories() {
        int count = 0;
        String windir = System.getenv("windir");
        String fileseparator = System.getProperty("file.separator");
        if (windir != null && fileseparator != null) {
            count += registerDirectory(windir + fileseparator + "fonts");
        }
        count += registerDirectory("/usr/share/X11/fonts", true);
        count += registerDirectory("/usr/X/lib/X11/fonts", true);
        count += registerDirectory("/usr/openwin/lib/X11/fonts", true);
        count += registerDirectory("/usr/share/fonts", true);
        count += registerDirectory("/usr/X11R6/lib/X11/fonts", true);
        count += registerDirectory("/Library/Fonts");
        count += registerDirectory("/System/Library/Fonts");
        return count;
    }
    

    In iTextSharp however, the method looks like this:

    public virtual int RegisterDirectories() {
        string dir = Path.Combine(
            Path.GetDirectoryName(
                Environment.GetFolderPath(Environment.SpecialFolder.System)), "Fonts");
        return RegisterDirectory(dir);
    }
    

    Java is platform independent, so we have to look for the ‘usual suspects’. C# is Windows specific, so we can depend on the environment to tell us where to find fonts. Your question tells us that Mono doesn’t support this, so you’ll have to use FontFactory.RegisterDirectory("/usr/share/fonts");

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a c# program using WPF. I have it that when you press
I have a simple program on windows using visual studios 2008. In my code
I have a program that draws some vector graphics using System.Drawing and the Graphics
I have a program using WPF in C# that uses the .NET 4 Framework
I have an OpenGL-program using GLSL, that I can run just fine with the
I have a C++ program using OpenMP, which will run on several machines that
I have a c++ program using gstreamer. The problem is that several of my
I have a program that gets data from SQL server table. The code is
I have a program that needs to be called using: program parameter1 parameter2 -x1
I have made a program using boost::variant that somehow isn't const correct. error: passing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.