DynaPDF.SetFieldFont
--------------------

Sets or changes the font of a form field.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [DynaPDF](component_DynaPDF.md) | [5.1](newinversion51.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "DynaPDF.SetFieldFont"; PDF; Field; Name { ; Style; Size; Embed; CodePage } ) 

**MBS**( **"DynaPDF.SetFieldFont";** /\* Sets or changes the font of a form field. \*/  
**$PDF**; /\* The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). \*/   
**$Field**; /\* The field index or field name.e.g. "FirstName" \*/   
**$Name**; /\* Font name for new font to set or empty text to deactivate current font.e.g. "Arial" \*/   
**$Style**; /\* Optional; Font style value.   
Can be a combination of values 1 for italic, 2 for bold, 4 for underlined and 8 for striked.e.g. 3 \*/   
**$Size**; /\* Optional; Font size in points.e.g. 12 \*/   
**$Embed**; /\* Optional; Whether to embed font in PDF.   
Can be 1 to embed or 0 to not embed.  
  
Default is 1 since version 12.3.e.g. 1 \*/   
**$CodePage**) /\* Optional; 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.e.g. "Unicode" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| PDF | The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). | $pdf |  |
| Field | The field index or field name. | "FirstName" |  |
| 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. | 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 since version 12.3. | 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 OK or error.

### Description

Sets or changes the font of a form field.   
Form fields support natively only the code pages 1252 and MacRoman.   
See dynapdf\_help manual for details.  
You need to set CMap directory first with [DynaPDF.SetCMapDir](DynaPDFSetCMapDir.md).  
See also [SetFieldFont](https://www.monkeybreadsoftware.com/DynaPDF-Manual/SetFieldFont.shtml) function in DynaPDF manual.

### Examples

Set unicode font:

 Set Variable \[ $r ; Value: MBS ( "[DynaPDF.SetCMapDir](DynaPDFSetCMapDir.md)"; $pdf ; "/Users/cs/Desktop/CMap"; "Recursive" ) \]   
Set Variable \[ $r ; Value: MBS ( "DynaPDF.SetFieldFont"; $pdf ; "Test"; "Arial"; 0; 12; 1; "Unicode") \]   
Set Variable \[ $r ; Value: MBS ("[DynaPDF.SetTextFieldValue](DynaPDFSetTextFieldValue.md)"; $pdf ; "Test"; "你好世界"; ""; "Left") \]  
### See also

- [DynaPDF.GetFieldCount](DynaPDFGetFieldCount.md)
- [DynaPDF.New](DynaPDFNew.md)
- [DynaPDF.SetFieldBBox](DynaPDFSetFieldBBox.md)
- [DynaPDF.SetFieldColor](DynaPDFSetFieldColor.md)
- [DynaPDF.SetFieldFlags](DynaPDFSetFieldFlags.md)
- [DynaPDF.SetFieldFontEx](DynaPDFSetFieldFontEx.md)
- [DynaPDF.SetFieldFontSize](DynaPDFSetFieldFontSize.md)
- [DynaPDF.SetFieldIndex](DynaPDFSetFieldIndex.md)
- [DynaPDF.SetTextFieldValue](DynaPDFSetTextFieldValue.md)
- [DynaPDF.SetUseStdFonts](DynaPDFSetUseStdFonts.md)

### Release notes

- **Version 12.3**
    - Changed [DynaPDF.SetFont](https://www.mbsplugins.eu/DynaPDFSetFont.shtml), [DynaPDF.SetFieldFont](https://www.mbsplugins.eu/DynaPDFSetFieldFont.shtml), [DynaPDF.SetFontEx](https://www.mbsplugins.eu/DynaPDFSetFontEx.shtml) and [DynaPDF.Table.SetFont](https://www.mbsplugins.eu/DynaPDFTableSetFont.shtml) to use unicode as default code page.
- **Version 12.0**
    - Changed [DynaPDF.SetFont](https://www.mbsplugins.eu/DynaPDFSetFont.shtml), [DynaPDF.Table.SetFont](https://www.mbsplugins.eu/DynaPDFTableSetFont.shtml), [DynaPDF.SetFontEx](https://www.mbsplugins.eu/DynaPDFSetFontEx.shtml), [DynaPDF.ChangeFontEx](https://www.mbsplugins.eu/DynaPDFChangeFontEx.shtml), [DynaPDF.SetFieldFont](https://www.mbsplugins.eu/DynaPDFSetFieldFont.shtml) and [DynaPDF.SetBookmarkStyle](https://www.mbsplugins.eu/DynaPDFSetBookmarkStyle.shtml) functions to accept styles as text.

### Blog Entries

- [MBS FileMaker Plugin, version 12.3pr1](https://www.mbsplugins.de/archive/2022-06-02/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 11.6pr2](https://www.mbsplugins.de/archive/2021-12-07/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 5.1 for OS X/Windows](https://www.mbsplugins.de/archive/2015-05-19/MBS_FileMaker_Plugin_51_for_OS/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 5.1pr2](https://www.mbsplugins.de/archive/2015-03-23/MBS_FileMaker_Plugin_version_5/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 19th March 2015 , last changed 17th July 2022

  
[DynaPDF.SetFieldFlags](DynaPDFSetFieldFlags.md) - [DynaPDF.SetFieldFontEx](DynaPDFSetFieldFontEx.md)

[HTML Version](DynaPDFSetFieldFont.shtml)