set_font
Summary
Changes the default font.Usage
pdf(set_font, hash( [ name, font_name, ] [ size, font_size, ] [ colorCMYK, cmyk_color,] [ colorRGB, rgb_color, ] [ justification, text_justification ] ) )
Parameters
Name | Type | Description | Required |
---|---|---|---|
name | string | The font type (name). | No. |
size | integer | The size of the font. | No. |
colorCMYK | array | The CMYK color. | No. |
colorRGB | array | The RGB color. | No. |
justification | string | The text alignment. | No. |
Description
This function makes it possible to change the default/current font and the text color, style, etc. The following list shows the fonts that can be used.
- Courier-Bold
- Courier-BoldOblique
- Courier-Oblique
- Courier
- Helvetica-Bold
- Helvetica-BoldOblique
- Helvetica-Oblique
- Helvetic
- Symbol
- Times-Bold
- Times-BoldItalic
- Times-Italic
- Times-Roman
Either the "colorRGB" or the "colorCMYK" parameter can be used to specify the font color. The "colorRGB" parameter must be an array consisting of three integers between 0 and 255. The "colorCMYK" parameter must be an array of four decimal values between 0 and 1.
The justification parameter controls the text alignment, it can be:
- left
- right
- center
- full
Examples
Example 1
{pdf( 'set_font', hash( 'name', 'Times-Roman', 'size', 12 ) )} {pdf( 'text', 'Hello world'|wash( 'pdf' ) )} {pdf( 'new_line' )} {pdf( 'new_line' )} {pdf( 'set_font', hash( 'name', 'Times-Italic', 'size', 10, 'justification', 'full', 'colorRGB', array( 255, 255, 128 ) ) )} {pdf( 'text', 'Example'|wash( 'pdf' ) )}
This example demonstrates how to change the default font type, size, style, and color.
Balazs Halasy (13/05/2004 3:15 pm)
Balazs Halasy (04/05/2005 11:43 am)
Comments
There are no comments.