Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.1   6.2   6.3   6.4   6.5   7.0   7.1   7.2   7.3   7.4    Statistic  

GMImage.FontTypeMetrics

Queries space needed for text.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
GraphicsMagick 7.3 Yes Yes Yes Yes Yes

MBS( "GMImage.FontTypeMetrics"; ImageRef; text )

Parameters

Parameter Description Example value
ImageRef The image reference number. 1
text Some text "Hello World"

Result

Returns list or error.

Description

Queries space needed for text.
Obtain font metrics for text string given current font, point size, and density settings.
Returns list with following values:

Examples

Draw some text on a picture:

# open a picture
Variable setzen [ $ref ; Wert: MBS("GMImage.NewFromContainer"; Annotate Image::InputImage) ]
# set font size
Variable setzen [ $r ; Wert: MBS("GMImage.SetFontPointsize"; $ref; 20) ]
# set the font
Variable setzen [ $r ; Wert: MBS("GMImage.SetFont"; $ref; "@/System/Library/Fonts/LucidaGrande.ttc") ]
# set the fill color
Variable setzen [ $r ; Wert: MBS("GMImage.SetFillColor"; $ref; "RGB 0 0 0") ]
# Query size for this text:
Variable setzen [ $r ; Wert: MBS("GMImage.FontTypeMetrics"; $ref; Annotate Image::Text) ]
# draw the text:
Variable setzen [ $r ; Wert: MBS("GMImage.Annotate"; $ref; Annotate Image::Text; "100x200+10+40"; 1) ]
# write image
Feldwert setzen [ Annotate Image::OutputImage ; MBS( "GMImage.WriteToPNGContainer"; $ref ) ]
# free memory
Variable setzen [ $Error ; Wert: MBS("GMImage.Destroy";$ref) ]

Measure text:

MBS("GMImage.FontTypeMetrics"; $ref; Annotate Image::Text)

Example result:
"528.000000
47.000000
39.000000
-8.000000
66.000000
40.000000"

See also


GMImage.Flop   -   GMImage.Format

Feedback: Report problem or ask question.




Links
MBS FileMaker Plugins