|
© Efflare Systems website : e-mail |
<cfx_imageflare source="
b = Bitmap()
f = Font( 'Coliseum Normal', 36 )
b.size( f.getdimensions('Some Text') )
b.fill( Color('white') )
b.text( 'Some Text', 0, b.height, f, Color('grey') )
b.save( '#expandpath('.\example03a.gif')#' )
">

|
In the ImageFlare API, this method call
is listed twice with differing arguments.
This method is `overloaded`. It can accept either set of arguments. The first definition, which is being used above, anchors text in the lower left corner. The second definition allows you to define a rectangle in which text will be drawn, optionally wrapping lines and performing various other alignment/formatting as set in the Font objects formatting properties. The images to the right demonstrate this difference in possible arguments. |
![]()
|
<cfx_imageflare source="
b = Bitmap(120,80)
b.fill( Color('white') )
f = Font( 'Assiduous', 14 )
f.wordwrap = true
f.aligncenter = true
s = 'This is just some text that we would like to see formatted in various ways.'
b.text( s, 0, 0, b.width, b.height, f, Color('darkgrey') )
b.save( '#expandpath('.\example03d.gif')#' )
">
![]() |
Here, we've created a 120x80 image and drawn some text. Using the
wordwrap and aligncenter
properties of the Font object, we've told ImageFlare to wrap the text into
multiple lines and center it. This is only possible using the second
definition of the text method.
In similar fashion, you can also align text to the right or left. |
<cfx_imageflare source="
s = 'This is just some text that we would like to see formatted in various ways.'
c = Color('darkgrey')
b = Bitmap(260,80)
b.fill( Color('white') )
f = Font( 'Assiduous', 14 )
f.wordwrap = true
f.alignright = true
b.text( s, 0, 0, (b.width/2)-10, b.height, f, c )
f.alignright = false
f.alignleft = true
b.text( s, (b.width/2)+10, 0, b.width, b.height, f, c )
b.line( b.width/2, 0, b.width/2, b.height, c )
b.save( '#expandpath('.\example03e.gif')#' )
">
|
This example draws the same text twice in different places, while using the same Font.
The Font objects alignright and alignleft
properties are adjusted before each string is drawn. Two seperate font objects could have
been created, but in this case it is more convenient and efficient to manipulate the properties.
Finally, a line is drawn between them with b.line( b.width/2, 0, b.width/2, b.height, c ) |
![]() |
![]() |
3 of 9 Barcode 18 Point | |
![]() |
MICR 9 Point |