Font families are a grouping of four styles of fonts (regular, bold, italic, and bold italic). These are used by the FormattedTextArea class to change fonts and specify styles. Five font families are included and accessed through the DPDF_FontFamily Enumeration:
- FontFamily.Times - Times Font Family
- FontFamily.Helvetica - Helvetica Family
- FontFamily.Courier - Courier Family
- FontFamily.Symbol - Symbol Family
- FontFamily.ZapfDingbats - Zapf Dingbats Font Family
NOTE:The Symbol and Zapf Dingbats have the same font specified to all four font styles. New font families can be created by instantiating a FontFamily class and specifying the fonts for each style. These can include any of the 14 built-in fonts or TrueType fonts.
New font families can be created by passing four Fonts into a AddFontFamily Method. The name specified in the constructor is the name used to specify the font in an FormattedTextArea.
[ASP - VBScript]
<!-- METADATA TYPE="typelib" UUID="{DF9225FE-94A4-490D-8CAD-E8366CE621D3}" -->
<%
Dim MyDocument
Dim MyPage
Dim MyVerdana
Dim MyVerdanaBold
Dim MyVerdanaItalic
Dim MyVerdanaBoldItalic
Dim MyVerdanaFontFamily
' Create four TrueType fonts.
Set MyDocument = Server.CreateObject( "DynamicPDF.Document" )
Set MyPage = MyDocument.AddPage()
MyVerdana = MyDocument.AddFont( "C:\Windows\Fonts\Verdana.ttf" )
MyVerdanaBold= MyDocument.AddFont( "C:\Windows\Fonts\Verdanab.ttf" )
MyVerdanaItalic = MyDocument.AddFont( "C:\Windows\Fonts\Verdanai.ttf" )
MyVerdanaBoldItalic = MyDocument.AddFont( "C:\Windows\Fonts\Verdanaz.ttf" )
' Create a font family for Verdana.
MyVerdanaFontFamily = MyDocument.AddFontFamily( "Verdana", MyVerdana, MyVerdanaBold, MyVerdanaItalic, MyVerdanaBoldItalic )
NOTE: In order to use a created font family in an FormattedTextArea you must add it through the FormattedTextArea
<%
' Add the font family creaded above to an Formatted text area.
Dim MyFormattedText
MyFormattedText = "Formatted text area provide rich formatting support for " + _
"text that appears in the document. You have complete control over 8 paragraph " + _
"properties: spacing before, spacing after, first line indentation, left indentation," + _
" right indentation, alignment, allowing orphan lines, and white space preservation; " + _
"6 font properties: <font face='Times'>font face,</font> <font>font size,</font> <font color='FF0000'>color, " + _
"</font><b>bold,</b> <u>" + _
"underline</u>; and 2 line properties: leading, and leading type. Text can " + _
"also be rotated."
Dim MyFormattedTextArea
Set MyFormattedTextArea = MyPage.AddFormattedTextArea( MyFormattedText, 100, 140, 300, 250, MyVerdanaFontFamily, 12, True )
MyDocument.DrawToWeb
Set MyPage = Nothing
Set MyDocument = Nothing
%>
| See Also |
DPDF_FontFamily Enumeration | Fonts And Text

