gFont Documentation

Installation

Coldfusion MX, unlike previous versions, requires you to add the tag manually in the administrator. Simply point to the DLL in the installation directory and give it the tag name "cfx_gfont". Finally and importantly, make sure you check the "Keep Library Loaded" checkbox.

After installing the package, you will need to refresh your Coldfusion Application Server settings. [1] This can be done in any of the following ways:

  • Restart the Coldfusion Application Server [2]
  • Use the Coldfusion Administrator to view and ok the gFont settings
  • Refresh Coldfusion settings manually with <cfset result = cfusion_settings_refresh()>

1 If you are using a version of Coldfusion Server older than 4.5, you may not have to do any of the steps listed above unless upgrading.

2 If you are upgrading, you must "Restart the Coldfusion Application Server". This includes upgrades from the demo to retail version. This is due to the extremely beneficial caching Coldfusion uses on the custom tag dll. Running tags without this caching is definitely not recommended. Note: This is shown as "Keep Library Loaded [X] Check this box to retain the library in RAM." in the Coldfusion Administrator.

Upgrading from a demo version to the corresponding retail version should require no programming changes and all cached images will work as if nothing happened.

When upgrading from a licensed version to an updated licensed version (or uninstalling), you will need to stop the Coldfusion Server in order for the upgrade to work correctly.

Tips

  • The GIF format is the best choice for the type of images generated with gFont.
  • Use Windows 2000 Notepad or similar to preview fonts on your system and get their exact names.
  • By default, fonts are antialiased dynamically in the same way as a standard windows application.

Return Values

image.link » The name of the generated image. This is relative to the cachedir.
image.cached » Returns a 1 if a cached image is found and used.
Returns a 0 if the image needed to be generated.
image.width » Width of the generated image. 0 when image is cached.
image.height » Height of the generated image. 0 when image is cached.

Tag Attributes


Legend » required • optional • advanced

name default value notes
cachedir C:\Inetpub\ wwwroot\ _cache  Full path to cache storage directory without trailing slash. This attribute is actually optional in the tag call, but of course required for everything to work. The default value is conveniently read from the following registry entry.

HKEY_LOCAL_MACHINE\SOFTWARE\Efflare\cfx_gfont\cache

The installation software allows you to set this easily.

Setting this registry entry to your own global cachedir is recommended so you do not have to include this attribute in every call to the tag.

Performance concious developers might be interested in something similar to our setup. Set the cachedir registry value to C:\Inetpub\wwwroot\_cache then create _cache virtual directories on all sites which point to that dir. This allows global caching across all sites on a machine, which can lead to even better performance. This even works when you use the same directory for other Efflare tags.
text default text Text to render, special characters and extra spaces accepted
font verdana Font name. (Win2k Notepad lists the correct names if needed)
size 0 Font size. If positive, specifies font height in points. If 0, uses default size (specific to each font). If negative, specifies font height in pixels.
background FFFFFF Background color in RRGGBB hexadecimal format and without the # sign
color 000000 Text color in RRGGBB hexadecimal format and without the # sign
italic 0 0 = off, 1 = on
bold 0 0 = off, 1 = on
underline 0 0 = off, 1 = on
strikeout 0 0 = off, 1 = on
spacing 0 Pixels added between characters
trim 0 0 = render font normally
1 = trim fonts character specific overhangs from the left of the first char and right of the last character. (Note : fonts with negative overhangs ARE accounted for unlike most windows applications and will be displayed in full without being cut off regardless of this setting) (raster fonts are not affected by this setting)
quality 1 0 = render jagged without antialiasing
1 = render antialiased with standard 'font smoothing'
2 = render antialiased with cleartype (NT 5.1+)
transparent 0 If 1 the background will be transparent (gif only)
charset default Provides multilanguage unicode support. Possible values :
default ansi symbol shiftjis gb2312 hangeul chinesebig5 oem johab hebrew arabic greek turkish thai easteurope russian mac baltic
format gif Save as this image type... gif, jpg, png, bmp, pcx, etc... gif is the preferred format, but png (usually a bit smaller than gif, but browser support issues, especially with transparency) or even jpg (much larger for this sort of image) are available for those that need them.
target *special* Allows you to specify the name of the output image. This is the base filename without the image extension. By default this is calculated automatically using an MD5 hash to allow intelligent caching of images. If you define target, images will still be cached but will not be intelligently recreated when other attributes in the tag change. This means the cached image would need to be deleted manually before changes in the tag attributes take effect. All of this is of course irrelevant if you do not override target. You can also set cache=0 to overwrite cached images on every call.
cache 1 0 = recreate output image every time
1 = cache intelligently

Examples

<cfx_gfont text="cfx gfont" font="Apollyon™" size=72 color=B4000C background=DBD6CD italic=1>
<img src="/_cache/#image.link#">

<cfx_gfont text="SMALL FONT FROM WWW.04.JP.ORG" font="04b" size=6 background=DBD6CD>
<img src="/_cache/#image.link#">

<cfx_gfont>
<img src="/_cache/#image.link#">

<cfx_gfont font=fixedsys text="FixedSys raster font">
<img src="/_cache/#image.link#">

<cfx_gfont font="Institution" size=18 text="Bold Italic Underline" bold=1 italic=1 underline=1>
<img src="/_cache/#image.link#">

<cfx_gfont font="Trebuchet MS" size=14 text="Special Characters « £ æ © ¢ † ® ™ § å ë ð ‰ »">
<img src="/_cache/#image.link#">

<cfx_gfont charset="arabic" size=36 text="arabic » åãáßÞÝÛÚØÕÔÒÑ">
<img src="/_cache/#image.link#">

<cfx_gfont charset="thai" size=36 text="thai - ãñåáÒ»">
<img src="/_cache/#image.link#">

<cfx_gfont text="QWERTY" size=36 font="WP japanese">
<img src="/_cache/#image.link#">

<cfx_gfont text="unforced antialias : size 7" size=7>
<img src="/_cache/#image.link#">

<cfx_gfont text="Gallery"
background=DBD6CD
trim=1
spacing=20
target="gallery"
format="gif"
font="Campaign-Normal"
size=72>
<img src="/_cache/#image.link#">