GMImage.SetFont
---------------

Sets the Text rendering font.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [GraphicsMagick](component_GraphicsMagick.md) | [2.0](newinversion20.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "GMImage.SetFont"; ImageRef; Value ) 

**MBS**( **"GMImage.SetFont";** /\* Sets the Text rendering font. \*/  
**$ImageRef**; /\* The image reference number.e.g. 1 \*/   
**$Value**) /\* The new value. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| ImageRef | The image reference number. | 1 |
| Value | The new value. |  |

### Result

Returns "OK" on success.

### Description

Sets the Text rendering font.  
See [GMImage.ListTypeInfo](GMImageListTypeInfo.md) function to list fonts available.  
  
You can use either [GMImage.SetFontFamily](GMImageSetFontFamily.md) or GMImage.SetFont, but not both.  
### Examples

Picks a ubuntu regular font:

 MBS ("GMImage.SetFont"; $ref ; "@/usr/share/fonts/truetype/ubuntu/Ubuntu-R.ttf")  
Annotate an image on an Ubuntu FileMaker Server:

 Go to Layout \[ “Annotate Test” ; Animation: None \]  
Go to Record/Request/Page \[ First \]  
  
Set Variable \[ $ref ; Value: MBS ( "[GMImage.New](GMImageNew.md)"; "200x200"; "white" ) \]   
\# Settings for the font   
Set Variable \[ $r ; Value: MBS ("[GMImage.SetFontPointSize](GMImageSetFontPointSize.md)"; $ref ; 12) \]   
Set Variable \[ $r ; Value: MBS ("GMImage.SetFont"; $ref ; "@/usr/share/fonts/truetype/ubuntu/Ubuntu-R.ttf") \]   
Set Variable \[ $r ; Value: MBS ("[GMImage.SetFillColor](GMImageSetFillColor.md)"; $ref ; "RGB 0 0 0") \]   
\# Write the text to the picture   
Set Variable \[ $r ; Value: MBS ("[GMImage.Annotate](GMImageAnnotate.md)"; $ref ; "Hello World"; "100x200+10+40"; 1) \]   
\# store the picture in the field   
Set Field \[ WebHook Chat::File ; MBS ( "[GMImage.WriteToPNGContainer](GMImageWriteToPNGContainer.md)"; $ref ) \]   
Commit Records/Requests \[ With dialog: Off \]   
\# Free image   
Set Variable \[ $Error ; Value: MBS ("[GMImage.Free](GMImageFree.md)";$ref ) \]  
### See also

- [GMImage.GetFont](GMImageGetFont.md)
- [GMImage.SetFillColor](GMImageSetFillColor.md)
- [GMImage.SetFontFamily](GMImageSetFontFamily.md)
- [GMImage.SetMatte](GMImageSetMatte.md)
- [GMImage.SetQuiet](GMImageSetQuiet.md)
- [GMImage.SetScene](GMImageSetScene.md)
- [GMImage.SetSize](GMImageSetSize.md)
- [GMImage.SetType](GMImageSetType.md)
- [GMImage.SetXMP](GMImageSetXMP.md)
- [GMImage.WriteToPNGContainer](GMImageWriteToPNGContainer.md)

### Release notes

- **Version 10.4**
    - Added [GMImage.GetFontFamily](https://www.mbsplugins.eu/GMImageGetFontFamily.shtml), [GMImage.GetFontStretch](https://www.mbsplugins.eu/GMImageGetFontStretch.shtml), [GMImage.GetFontStyle](https://www.mbsplugins.eu/GMImageGetFontStyle.shtml), [GMImage.GetFontWeight](https://www.mbsplugins.eu/GMImageGetFontWeight.shtml), [GMImage.SetFontFamily](https://www.mbsplugins.eu/GMImageSetFontFamily.shtml), [GMImage.SetFontStretch](https://www.mbsplugins.eu/GMImageSetFontStretch.shtml), [GMImage.SetFontStyle](https://www.mbsplugins.eu/GMImageSetFontStyle.shtml) and [GMImage.SetFontWeight](https://www.mbsplugins.eu/GMImageSetFontWeight.shtml) functions.

### Example Databases

- [GraphicsMagick/Annotate Image](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/GraphicsMagick/Annotate%20Image.shtml#2ScriptAnchor_)
- [GraphicsMagick/Text Wrap](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/GraphicsMagick/Text%20Wrap.shtml#1ScriptAnchor_)
- [Overlay](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Overlay.shtml#7ScriptAnchor_)

### Blog Entries

- [GraphicsMagick in FileMaker, part 10](https://www.mbsplugins.de/archive/2022-12-10/GraphicsMagick_in_FileMaker_pa/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 18th August 2014 , last changed 17th February 2023

  
[GMImage.SetFilterType](GMImageSetFilterType.md) - [GMImage.SetFontFamily](GMImageSetFontFamily.md)

[HTML Version](GMImageSetFont.shtml)