Search Locate Previous Next Contents

leaf.TrueFont – using TrueType fonts directly

In general, NewLeaf expects you to work with a table of font short codes and definitions. This allows your reports to be output directly to PostScript devices (or Acrobat Distiller) and will enable reports to be rendered well on HTML browsers.

However if you allow users to pick arbitrary fonts from those available on their Windows installation, you will need to use this function in place of leaf.Font to choose the font definition.

The simple syntax is:

leaf.TrueFont 'Verdana,18/24'  © 18pt on 24pt spacing

which is just the same as for leaf.Font. In addition, you can choose italic and/or bold variants with the syntax:

leaf.TrueFont 'comic sans,14' 1       © Italic
leaf.TrueFont 'book antiqua,18' 0 800 © bold

The names you give are matched against the current list of installed fonts, case-independent omitting blanks. Only the leading part of the name is used, so ‘comic’, ‘comic sans’ and ‘comic sans ms’ all match ‘Comic Sans MS’ which is the actual name of the Windows font.

The codes for font weight are 400 (normal) and any number above 400 (typically 800) for bold. These are the same numbers as are used in the APL ‘Font’ object.



Continue to: leaf.table.Align – set cell alignment in tables
© Copyright Causeway Graphical Systems Ltd 2001