The Joomla! Community Portal ™

Sun

12

Mar

2006

PDF Fonts in Joomla 1.5
Written by David Gal   
Sunday, 12 March 2006 23:27
The new pdf generator can handle utf-8 text sources. This requires using suitable Unicode fonts. The font files are actually in postscript form with a php file for lookup references. There are not too many postscript free fonts out there so the solution is to convert Truetype Unicode fonts to the format needed for the pdf generator. This raises some dilemmas:
  • There is no single pan-Unicode font that has all glyphs
  • Anything that gets close to it is very large - 400k or so and this gets embedded in the pdf
  • Some info regarding the fonts:
  • A font that covers Latin and extended Latin might be about 40k
  • A Latin font (like above) that also includes Cyrillic and Greek might be about 130K which is about the reasonable size limit
  • We can say that a regional font (Middle East, Indic, Far East CJK, Far East Other, etc.) would be manageable size wise.
  • There are many many fonts for single language glyphs with many resources available (see below)
  • We have implemented a solution that allows the language packs to define which pdf font file set should be used with the language. The pdf font files can optionally be included in the language pack and will be installed together with the language. Details of the solution:
  • The Vera font (see specifications below) is installed with the eng_GB language pack and will be shipped already installed and selected
  • Selection of a pdf font file set is via a new metadata tag in the language.xml file
  • English (GB) eng_GB 0 eng_GB, en_GB, en, english, english-uk, uk, Vera
  • A pdf_fonts folder has been added under the site language folder. Additional pdf font file sets can be loaded manually into this folder. To use the font, the metadata tag in the language.xml needs to be edited.
  • Alternately additional fonts can be automatically loaded when the language pack is installed
  • To include pdf font file sets with the language packs the font files need to be included in the zip file and the language.xml file needs to have the following tags added after the ini files
  • Cyberbas.php Cyberbas.z Cyberbas.ctg.z
  • Several "Regional" font file sets (specificaitons below) willl be made available to translation teams to include in their respective language packs as they choose
  • Tools to convert Truetype Unicode fonts to suitable font file sets have been included in the svn under the tcpdf library in a tools folder (instructions included)
  •