This component is deprecated.

Developers should use roFont methods (GetOneLineHeight and GetOneLineWidth).


The roFontMetrics object allows you to get display size information for a specific font returned by the roFontRegistry.Get() method.

Supported Interfaces


In order to use this object, you must first initialize the roFontMetrics object with a font name that had been previously registered with the roFontRegistry, then the total rendered size of strings in that font can be returned by roFontMetrics.Size().
This object is created with a string that represents the font to use in its size calculations:

  • CreateObject("roFontMetrics", String font)
Example: simple use of roFontRegistry and roFontMetrics to render a string on the roImageCanvas
helloString = "Hello ImageCanvas" 

fontReg = CreateObject("roFontRegistry")
font = fontReg.Get("LCDMono",36,50,false) ' 36pt, 50 is normal
                                          ' weight, no italics 

fontMetrics = CreateObject("roFontMetrics", font) 
stringSize = fontMetrics.size(helloString) 

canvasItem = { 
	TextAttrs:{Color:"#FFCCCCCC", Font:font,  
	VAlign:"VCenter", Direction:"LeftToRight"}
	TargetRect:{x:390,y:357, w:stringSize.w,h:stringSize.h}

canvas = CreateObject("roImageCanvas")
port = CreateObject("roMessagePort")
'Set opaque background
canvas.SetLayer(0, {Color:"#FF000000", CompositionMode:"Source"}) 
canvas.SetLayer(1, canvasItem)