Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
DynaPDF.SetFont
The function loads a font that can be used for text output and interactive form fields.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
DynaPDF | 3.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
The PDF reference returned from DynaPDF.New. | |||
Name | Font name for new font to set or empty text to deactivate current font. | "Arial" | |
Style | Font style value. Can be a combination of values 1 for italic, 2 for bold, 4 for underlined and 8 for striked. With version 12.0 or newer, this can be passed as text: UltraCondensed, ExtraCondensed, SemiCondensed, Condensed, SemiExpanded, ExtraExpanded, UltraExpanded, Expanded, ExtraBold, DemiBold, Bold, UltraBlack, Black, Normal, Italic, Underlined, Striked, VerticalMode, Thin, ExtraLight, Light, Regular, Medium, DoubleUnderlined. |
3 | Optional |
Size | Font size in points. | 12 | Optional |
Embed | Whether to embed font in PDF. Can be 1 to embed or 0 to not embed. Default is 1. |
1 | Optional |
CodePage | The code page to use. Code page can be 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 8859-2, 8859-3, 8859-4, 8859-5, 8859-6, 8859-7, 8859-8, 8859-9, 8859-10, 8859-13, 8859-14, 8859-15, 8859-16, Symbol, 437, 737, 775, 850, 852, 855, 857, 860, 861, 862, 863, 864, 865, 866, 869, 874, Unicode. Default is unicode since v12.3, but was 1252 for Windows ANSI before. |
"Unicode" | Optional |
Result
Returns font handle or error message.
Description
The function loads a font that can be used for text output and interactive form fields.See also DynaPDF.GetFontSelMode and DynaPDF.SetFontSelMode function for the current selection mode.
See also SetFont function in DynaPDF manual.
Examples
Sets a font:
MBS("DynaPDF.SetFont"; $pdf; "Zapf Dingbats"; 0; 12)
Sets italic font:
MBS("DynaPDF.SetFont"; $pdf; "Times"; 1; 40; 1; "unicode")
Set font variants with style as text:
Set Variable [ $r ; Value: MBS("DynaPDF.AppendPage"; $pdf) ]
Set Variable [ $fontName ; Value: "Avenir Next Condensed" ]
Set Variable [ $r ; Value: MBS("DynaPDF.SetFillColor"; $pdf; 0; 0; 0) ]
Set Variable [ $r ; Value: MBS("DynaPDF.SetFont"; $pdf; $fontName; ""; 12) ]
Set Variable [ $r ; Value: MBS("DynaPDF.WriteText"; $pdf; 100; 500; "Normal text") ]
Set Variable [ $r ; Value: MBS("DynaPDF.SetFont"; $pdf; $fontName; "bold"; 12) ]
Set Variable [ $r ; Value: MBS("DynaPDF.WriteText"; $pdf; 100; 450; "Bold text") ]
Set Variable [ $r ; Value: MBS("DynaPDF.SetFont"; $pdf; $fontName; "italic"; 12) ]
Set Variable [ $r ; Value: MBS("DynaPDF.WriteText"; $pdf; 100; 400; "Italic text") ]
Set Variable [ $r ; Value: MBS("DynaPDF.SetFont"; $pdf; $fontName; "condensed"; 12) ]
Set Variable [ $r ; Value: MBS("DynaPDF.WriteText"; $pdf; 100; 350; "Condensed text") ]
Set Variable [ $r ; Value: MBS("DynaPDF.SetFont"; $pdf; $fontName; "condensed bold"; 12) ]
Set Variable [ $r ; Value: MBS("DynaPDF.WriteText"; $pdf; 100; 300; "Condensed bold text") ]
Set Variable [ $r ; Value: MBS("DynaPDF.EndPage"; $pdf) ]
Set font variants with style as numbers:
Set Variable [ $r ; Value: MBS("DynaPDF.AppendPage"; $pdf) ]
Set Variable [ $fontName ; Value: "Avenir Next Condensed" ]
Set Variable [ $r ; Value: MBS("DynaPDF.SetFillColor"; $pdf; 0; 0; 0) ]
Set Variable [ $r ; Value: MBS("DynaPDF.SetFont"; $pdf; $fontName; 0; 12) ]
Set Variable [ $r ; Value: MBS("DynaPDF.WriteText"; $pdf; 100; 500; "Normal text") ]
Set Variable [ $r ; Value: MBS("DynaPDF.SetFont"; $pdf; $fontName; 2; 12) ]
Set Variable [ $r ; Value: MBS("DynaPDF.WriteText"; $pdf; 100; 450; "Bold text") ]
Set Variable [ $r ; Value: MBS("DynaPDF.SetFont"; $pdf; $fontName; 1; 12) ]
Set Variable [ $r ; Value: MBS("DynaPDF.WriteText"; $pdf; 100; 400; "Italic text") ]
Set Variable [ $r ; Value: MBS("DynaPDF.SetFont"; $pdf; $fontName; 1792; 12) ]
Set Variable [ $r ; Value: MBS("DynaPDF.WriteText"; $pdf; 100; 350; "Condensed text") ]
Set Variable [ $r ; Value: MBS("DynaPDF.SetFont"; $pdf; $fontName; 1792 + 2; 12) ]
Set Variable [ $r ; Value: MBS("DynaPDF.WriteText"; $pdf; 100; 300; "Condensed bold text") ]
Set Variable [ $r ; Value: MBS("DynaPDF.EndPage"; $pdf) ]
See also
- DynaPDF.SetAltFonts
- DynaPDF.SetBBox
- DynaPDF.SetFontEx
- DynaPDF.SetUseStdFonts
- DynaPDF.SetUseSystemFonts
- DynaPDF.TestGlyphs
- DynaPDF.WriteFTextEx
- DynaPDF.WriteStyledText
- DynaPDF.WriteStyledTextEx
- DynaPDF.WriteText
Release notes
- Version 12.3
- Changed DynaPDF.SetFont, DynaPDF.SetFieldFont, DynaPDF.SetFontEx and DynaPDF.Table.SetFont to use unicode as default code page.
- Version 12.0
- Changed DynaPDF.SetFont, DynaPDF.Table.SetFont, DynaPDF.SetFontEx, DynaPDF.ChangeFontEx, DynaPDF.SetFieldFont and DynaPDF.SetBookmarkStyle functions to accept styles as text.
Example Databases
- Barcode/QRCode PDF
- DynaPDF/Add Page Numbers
- DynaPDF/Book Creation
- DynaPDF/Bookmarks
- DynaPDF/Create DeviceN ColorSpace
- DynaPDF/Create PDF with Bezier Curves
- DynaPDF/Create Text as PDFA
- DynaPDF/Styled Text
- DynaPDF/WriteFText
- DynaPDF/ZUGFeRD and Facture-X/ZUGFeRD Invoice
Blog Entries
- Page Layouting in DynaPDF
- MBS Plugin Advent calendar: 15 - DynaPDF
- Merge documents with DynaPDF
- Add page links for FileMaker
- MBS FileMaker Plugin, version 12.3pr1
- MBS FileMaker Plugin, version 11.6pr2
- New in MBS FileMaker Plugin 11.2
FileMaker Magazin
This function checks for a license.
Created 18th August 2014, last changed 8th April 2025
