Difference: UsingCustomFonts (13 vs. 14)

Revision 142014-06-11 - JeanNeron

Line: 1 to 1
 
META TOPICPARENT name="APPXDeveloper"

Defining Custom Fonts

Line: 9 to 9
 

Overview

Changed:
<
<
When designing graphical images in APPX there are 9 fonts pre-configured with the Desktop Client that are part of the Java installation within the client. In order to use custom fonts not included with the installation, such as bar codes, there are a few steps that must be taken. Follow these steps and you should be able to make use of custom fonts on your PDF outputs. Again, not all custom fonts will work and you may have to try more that one font to find one that does work
>
>
When designing graphical images in APPX there are 9 fonts pre-configured with the Desktop Client that are part of the Java installation within the client. In order to use custom fonts not included with the installation, such as bar codes, there are a few steps that must be taken. Follow these steps and you should be able to make use of custom fonts on your PDF outputs. Again, not all custom fonts will work and you may have to try more that one font to find one that does work.
 

Custom Fonts on a Windows Server

Added:
>
>
There are multiple ways to install and use a font on a Windows Server

Install as Windows Font

 The easiest way to include a custom font is to install the font on your Windows server. The steps to install the font will be different depending on the desktop OS release. The steps below are for Windows XP Professional.

  • Save the font to somewhere on your APPX server
Line: 22 to 25
 
  • Use the Add Fonts selector to find the font
  • Click on OK. This will install the font.
  • Reboot the server!! The font might not be recognized by the PDF printing software until after a reboot.
Added:
>
>
On more recent versions of Windows, you may be able to simply double click the font file. This will display the font, and there will be an 'Install' button to install the font.
 After you have installed a font you must tell Appx the name of the font, not the name of the font file. For example, the "Free 3 of 9" font is distributed in a file named "free3of9.ttf", but the name of the font is actually "Free 3 of 9 Regular". (you can also use "Free 3 of 9"). To find the font name, open the font file (free3of9.ttf) with Font Viewer (the easiest way to do that is to simply double-click on the font file in the Windows file manager).

  • Log into APPX and select Application Design for the app you where you will be using the custom font.
Line: 29 to 34
 
    • Select the ROLLOVER SELECTED state. If you are using Appx 5.2 or later, choose FONT instead.
    • Set the Location Type to SERVER FILE
    • Enter the font name (not the .ttf file name) as the Location Data (Free 3 of 9 Regular, for example). Important: The font name is case sensitive, and it is cached in your session. If you need to correct the name, log off & on again so Appx will pick up the new name.
Changed:
<
<
  • On your image define a field and set these GUI Attributes:
    • Select the Control Type of Label
    • In Resource enter the application and name you set in the above step
    • Leave the Font blank
    • Enter a name in the Name field ( VENDOR BAR CODE in this example)
  • In the Pre-Display event point enter the following code:
      SET      --- WIDGET NAME                =      VENDOR BAR CODE
      READ     --- WIDGET                 HOLD 1 FT 0 BY WIDGET NAME
T     SET      --- II                         =      10
T     SET      --- WIDGET FONT                =  --- II
T     REWRITE  --- WIDGET                 FAIL 0

The font will be embedded in the PDF document so the custom font should be viewable and printable on all systems whether the font is installed on the system or not.

>
>

Install Font in a Folder

 
Changed:
<
<
We have found that not all fonts work on Windows using the above approach. In that case, you can try an alternative approach which will allow APPX to directly access the font file in the directory where it is located. You will need to add an entry to the Windows registry which will provide a search path that APPX will use to find your font files. The following steps should be used to add the necessary registry entry:
>
>
Alternatively, you can install the font in a folder of your choosing, then tell the PDF printing software where to find the font. You will need to add an entry to the Windows registry which will provide a search path that APPX will use to find your font files. You can download one of the attached files at the bottom of the page (either 32 bit or 64 bit depending on your Windows version), edit the path and then simply double click the file to install the change in your registry.
 
Changed:
<
<
  • On your APPX server, open a command prompt or Run dialog box and run regedit (be very, very careful when editing the Windows registry as mistakes can possibly disable your computer)
  • >
    >
    You can also use the following steps to manually change the registry:
     
    Changed:
    <
    <
    • Navigate to HKEY_LOCAL_MACHINE\SOFTWARE
    >
    >
    On your APPX server, open a command prompt or Run dialog box and run regedit (be very, very careful when editing the Windows registry as mistakes can possibly disable your computer)
    • Navigate to HKEY_LOCAL_MACHINE\SOFTWARE for 32 bit Windows, or HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ for 64 bit Windows
     
    • Add new keys for PDFlib\PDFlib\7.0.3
    • Add a new string named searchpath
    Changed:
    <
    <
    • NOTE: on 64-bit Windows hosts (such as Windows 7), the key should be named HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\PDFlib\PDFlib\7.0.3\searchpath
    • Double-click searchpath and enter the path to the directory where you placed the font file. If the font is placed in the default font directory on Windows XP the entry would be c:\WINDOWS\Font. Multiple directories can be entered by separating them with a semicolon.
    >
    >
    • Double-click searchpath and enter the path to the directory where you placed the font file. Multiple directories can be entered by separating them with a semicolon.
     
    • Exit regedit
    Changed:
    <
    <
  • You will also need to define a Named Resource for each font file with the following attributes:
  • >
    >
    You will also need to define a Named Resource for each font file with the following attributes:
     
    • Select the ROLLOVER SELECTED state. If you are using Appx 5.2 or later, choose FONT instead.
    • Set the Location Type to SERVER FILE
    Changed:
    <
    <
    • Enter the name of the font file without an extension in the Location Data field ( free3of9 , for example, free3of9.ttf ).
  • On your output process image define a field and set these GUI Attributes:
    • Select the Widget Control Type of Label
    • In the Resource field, enter the application and the name of the Named Resource that you set in the above step
    • Leave the Font blank
    • Enter a name in the Name field ( VENDOR BAR CODE in this example)
  • In the Pre-Display event point enter the following code:
  •       SET      --- WIDGET NAME                =      VENDOR BAR CODE
          READ     --- WIDGET                 HOLD 1 FT 0 BY WIDGET NAME
    T     SET      --- II                         =      10
    T     SET      --- WIDGET FONT                =  --- II
    T     REWRITE  --- WIDGET                 FAIL 0
    >
    >
    • Enter the name of the font file without an extension in the Location Data field.

    Install Font in a Folder (Method 2)

    An alternative mechanism is to create a PDFlib resource file that defines the searchpath. Here is a sample file:

    PS-Resources-1.0

    SearchPath

    C:\WINDOWS\Font

    C:\MyCustomFonts

    .

    The file must begin with a line that says: PS-Resources-1.0

    Then, each section begins with a resource name (in this case, SearchPath), followed by the values assigned to that resource (C:\WINDOWS\Font and C:\MyCustomFonts), and the section is terminated with a line containing only a period.

    The format of the resource file (along with a list of the resources you can define) is described in section 3.1.3 here: http://www.pdflib.com/fileadmin/pdflib/pdf/manuals/PDFlib-7-tutorial.pdf

    According to that document the resource file is read from the following search path:

    $PDFLIBRESOURCEFILE (or %PDFLIBRESOURCE% on Windows)

    $PWD/upr

    $PWD/pdflib.upr

    $PWD is the current-working-directory of the Appx process: since that can be different for each user, we would recommend using the PDFLIBRESOURCEFILE environment variable (which you can set in the appx.env file).

     

    Custom Fonts on a Unix or Linux Server

    Follow these instructions to install a custom font. This should also work in APPX 4.2.x. This example will refer to the Free3of9.ttf bar code font.

    Line: 77 to 91
     
      • Select the ROLLOVER SELECTED state. If you are using Appx 5.2 or later, choose FONT instead.
      • Set the Location Type to DESIGN FILE
      • Enter the font file name without the extension as the Location Data (free3of9, for example). Remember that file names are case sensitive. The font name is cached in your session. If you need to correct the name, log off & on again so Appx will pick up the new name.
    Added:
    >
    >

    Using the Font in Appx

     
    • On your image define a field and set these GUI Attributes:
      • Select the Control Type of Label
      • In Resource enter the application and name you set in the above step
    Line: 111 to 128
     
    <--/commentPlugin-->

    -- GaryRogers - 2010-06-01

    Added:
    >
    >

    META FILEATTACHMENT attachment="pdflib32.reg" attr="" comment="Registry file for 32 bit Windows" date="1402503950" name="pdflib32.reg" path="pdflib32.reg" size="262" user="JeanNeron" version="1"
    META FILEATTACHMENT attachment="pdflib64.reg" attr="" comment="Registry file for 64 bit Windows" date="1402503988" name="pdflib64.reg" path="pdflib64.reg" size="286" user="JeanNeron" version="1"
     
    This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
    Ideas, requests, problems regarding TWiki? Send feedback