Menu

Error message - .fam file not found

2006-06-14
2013-05-01
  • David Thielen

    David Thielen - 2006-06-14

    Hi;

    I am getting the following error on one system only:

    Helvetica-Bold not found as resource. (The *.afm files must exist as resources in the package com.lowagie.text.pdf.fonts)

    One thing unusualy about this system, Windows is installed on drive E:, not C:. Is it possible iTextDotNet looks for fonts in C:\windows\fonts?

    Or could it be something else?

    thanks - dave

     
    • Kazuya Ujihara

      Kazuya Ujihara - 2006-06-14

      Searching resource as the following order.
      * Current Directory
      * Directory of Entry assembly
      * Entry assembly
      * Specified assembly
      * Calling assembly
      * assemblies loaded in AppDomain
      * %CommonProgramFiles%\Ujihara\JavaResouces

      The details to see JSharpResource class in JSharpLib.

       
      • Kazuya Ujihara

        Kazuya Ujihara - 2006-06-14

        The resources are obtained as JSharpResource$ResourceEnum object. See JSharpLib class. The class doesn't contain any hard coded drive. I recommend you to debug on the system.

         
        • David Thielen

          David Thielen - 2006-06-14

          Unfortunately it's on a production server so I can't put VS 2005 on it. However what I have determined is the problem occurs because it cannot find the windows fonts and tries to use the internal fonts. So...

          1) I think the problem is it is never able to find these afm files but it doesn't matter on other systems because on them it finds the Windows fonts. Do I need to call Assembly.LoadFile() or something liek that in itext.dll?

          2) For loading the fonts, I think iTextDotNet should get the windows directory, add fonts to it, and pass that directory in during initialization as where to look for fonts. I know the java version has c:\windows\fonts hardcoded as one to try but for the .NET version it can get the windows directory and just use that.

          ??? - thanks - dave

           
          • Kazuya Ujihara

            Kazuya Ujihara - 2006-06-14

            You have to call FontFactory.registerDirectories() in order to search Windows font automatically.
            See UsingFontFactory sample code <http://www.ujihara.jp/iTextdotNET/examples/com/lowagie/examples/fonts/getting/UsingFontFactory.java>.
            Java version is hard-coded but .NET version get the location of font directory from Windows registry.

             
            • David Thielen

              David Thielen - 2006-06-14

              I may have an old version of FontFactory.java - it still shows the list of directories used in the java world. If my version is out of date, where is the latest .NET 2.0 version?

              If it is still that way, to use the Windows location you can get the fonts directory location from the following registry location:

              [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell
              Folders]
              "Fonts"="C:\\WINDOWS\\Fonts"

               
              • Kazuya Ujihara

                Kazuya Ujihara - 2006-06-14

                > If my version is out of date, where is the latest .NET 2.0 version?

                Oops. This feature is implemented only in a .NET Framework 1.1 version. I'll add it in the next version.

                 
              • Kazuya Ujihara

                Kazuya Ujihara - 2006-06-14

                Addtionally, FontFactory.registerDirectory(String dir) method adds a directory path in the list for searching a font.

                 
          • David Thielen

            David Thielen - 2006-06-14

            Hi;

            The other question is why does it not find the .afm files. Is there som load call I need to do like the LoadFile("iTextAsian")?

            thanks - dave

             
            • Kazuya Ujihara

              Kazuya Ujihara - 2006-06-14

              > I need to do like the LoadFile("iTextAsian")?

              Yes, because .NET Framework can't find a resource in the other assembly until the assembly is loaded.

               
              • David Thielen

                David Thielen - 2006-06-15

                I tried that and still got the error. I call the Assembly.Load() before I make any calls into iText but once I do call into iText, if it can't find the windows fonts, I get this error.

                This only happens if it cannot find the windows fonts.

                ??? - thanks - dave

                 
                • Kazuya Ujihara

                  Kazuya Ujihara - 2006-06-15

                  You should call FontFactory.registerDirectory(String) to add a Windows font directory in a TrueType font searching list.
                  Assembly.Load() is only for reading CLR resuorces.

                   
    • David Thielen

      David Thielen - 2006-06-14

      So should I do Assembly.Load("iText")?

      thanks - dave

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.