FONT, CFONT

Top  Previous  Next

Syntax

 

1. font col|{numexpr}, row|{numexpr}, cols|{numexpr}, rows|{numexpr} [,fontname] [,font fontcode |{expr}] [,symset symset] [,size | size {sizeexpr}] [,bold] [,italic] [,underline] [,light] [,shade percent|{numexpr}] [,fixed | proportional] [,color] [,rgb rrggbb] [,justification] [,upper|lower|proper] [,fit] [,weight w|weightname] [,style style|stylename] [,column n]

 

2. font "text|!=text|~regexp|!~regexp[@left,top,right.bottom]", col|{numexpr}, row|{numexpr}, cols|{numexpr}, rows|{numexpr} [,fontname] [,font fontcode|expr} ] [,symset symset] [,size | size {sizeexpr}] [,bold] [,italic] [,underline] [,light] [,shade percent|{numexpr}] [,fixed | proportional] [,color] [,rgb rrggbb] [,justification] [,upper|lower|proper] [,fit] ] [,weight w|weightname] [,style style|stylename] [,column n]

 

If cfont is used, then columns and rows are interpreted to be the opposite corner of the region, and columns and rows are calculated by UnForm.

 

Description

 

The font keyword applies font control to all input stream text in the defined region of column, row, columns, and rows.   The other parameters are all optional.  If used, numexpr is a Business Basic expression that generates a numeric value for the column, row, columns, or rows.

 

If syntax 2 is used, then font attributes are applied relative to the occurrence of text or the regular expression regexpr.  In these cases, there may be no attribute regions, or several. column and row are 0-based in these formats, and can be negative if required.  The search for text or regexpr can be limited to a region on the page by adding a suffix in the format '@left,top,right,bottom'.  To use a literal "@" character in text or regexpr, it is necessary to specify "\@".

 

If the syntax "!=text" or "!~regexpr" is used, then the search is for positions NOT equal to the text or NOT matching the regular expression.  When using the NOT syntax, only one search is performed per line in the search region.

 

Font Names and Numbers

fontname can be Courier (the default), CGtimes, or Univers.  These fonts are standard on virtually all PCL5 compatible printers.  Alternately, font fontcode can specify a specific fontcode supported by your printer.  For example, if your printer supports True Type Arial, specify "font 16602".  Bitmap fonts (as opposed to scalable fonts) should not be used. fontname and fontcode can also be specified from the "ufparam.txt" file.  UnForm uses HP/GL by default for laser output, and justification is supported on all native printer fonts.  However, if the –nohpgl command line option is used, then only certain, known fonts (found in fonts.txt in the UnForm directory) can be properly justified, if the center, decimal, or right justification option is used.  When producing PDF output, only native PDF fonts and TrueType fonts are supported.  All others are mapped to one of these fonts: Courier, Helvetica, or Times-Roman.

 

Symbol Sets

symset can be any symbol set supported by your printer.  The default symbol set is "9J", using a Windows ANSI character set. symset can also be a name from the "ufparam.txt" file.  The pdf driver only supports the Windows ANSI symbol set.

 

Point and Pitch Sizes

size is a numerical value that specifies the point size of a proportionally spaced font or the pitch size of a fixed font.  Values range from about 4 to 999.75.  The default is based on the rows per page. Note that for proportional fonts, the larger the number, the larger the size printed. Fixed fonts are the opposite.  Size can be specified as an expression, if it is prefixed with the keyword "size".

 

Attribute Styles

The words "bold", "italic", "underline", and "light" will apply the indicated attribute(s) to the text.

 

Shaded Text

Percent indicates the percent gray to print the text, from 0 (white) to 100 (black).  The default is black.

 

Fixed and Proportional Text

Any font code below 4100 is presumed to be fixed (mono-spaced), and codes 4100 and up are presumed to be proportional.  To override this assumption, specify one of the words "fixed" or "proportional".

 

Color

Color can be specified as "white", "cyan", "magenta", "yellow", "blue", "green", "red", or "black", or you can name an RGB value as a 6-character hex string with "rgb rrggbb", where rr is red (00-FF), gg is green (00-FF), and bb is blue (00-FF).

 

Justification

justification can be one of the following words:  "left", "center", "right", or "decimal".  UnForm will remove leading and trailing spaces from the text and justify it within the column specification.  Decimal justification will use a "." character unless a "decimal=character" line is placed in the ufparam.txt file under the [defaults] section.

 

Text Case Conversion

The mutually exclusive "upper", "lower", and "proper" options will convert the text in the fonted region to all UPPER, lower, or Proper case.  Proper case capitalizes the initial letter of each word or word segment preceded by a non-letter or non-digit character.

 

Fit to Width

If the "fit" option is used, then each line in the font region is scaled down, if necessary, to fit within the defined number of columns for the region.  This differs from the text command's fit option, in that each line is treated distinctly, rather than the entire set of lines being calculated as a unit.

 

Weight and Style

Some laser printer fonts must be specified with given weight or style in order to be selected by the printer.  For example, the font Clarendon Condensed is only available if the condensed style is specified, by adding "style 4" or "condensed" to the font command.  Style and weight options and codes can be found in the ufparam.txt file.  Note that fonts are expressly designed for certain weights and styles, and simply specifying an unsupported value does not produce the desired result.  In fact, it may result in selection of a different font entirely.  Check your printer's documentation or control panel prints for supported fonts.

 

Note that if you use identical font commands for two adjacent or overlapping regions, UnForm will combine the regions.  For proportionally spaced fonts, the result will be misaligned columns.  To avoid this, you can add non-operational options, like "black" or "shade 100" to alternating commands, so UnForm will not treat them as identical.  Alternatively, use the column option, specifying a unique column between 0 and 222 to prevent region combining.

 

 

Examples:

 

font 10,20,29,50,cgtimes,12,center will change the text in the region starting at column 10, row 20, for 29 columns and 50 rows, to 12-point cgtimes.  The text will be centered within the 29 column width.

 

cfont 1,20,132,52,courier,16.67 will change the font of the region specified to 16.67 pitch courier.  Since courier is a mono-spaced font, the number 16.67 is interpreted as a pitch (characters per inch) rather than a point size.

 

cfont {pos("Description"=text$[22]},23,{pos("Units"=text$[22])-1},60,univers,10 will calculate the starting and ending column based upon where "Description" and "Units" occur in line 22, and change the font for that column range, for rows 23 through 60.

 

 

Drivers: all, but note the following:

 

PDF: maps pcl font names and numbers to Courier, Helvetica, or Times-Roman.  Symbol set 9J is the default and the only symbol set supported.

 

Ps: maps pcl font names and numbers to a setting defined in the [psmap] section of ufparam.txt.  Matching Type1 font files can be installed in the psfont directory.

 

zebra: symbol sets are not supported. size is limited to scalability of the font in the printer's firmware, typically integer multiples of the base font size in dots.  Color is not supported, nor is justification.  Shading can be either 100% (black) or 0% (white).  Font names are not mapped.  Specify fonts instead as font codes, which must be internal font identifiers, such as a-f, 0-9.  See the ZPL documentation for font codes.

 

The fit option is only supported in pcl, ps, and pdf drivers.

 

AFO jobs not supported.