Installing True Type Font for use in texttoimage

Author Message

willy jansen

Wednesday 11 August 2004 3:02:40 am

I wanted to create coloured image buttons and headers without using photoshop. I found a lot of topics in the forum about the use of True Type Fonts (ttf) in combination with the Texttoimage function. I 've put it all together below.

Texttoimage is the ezpublish function that converts text to an image. Ideal for creating buttons or nice headers.
It works more or less like this:

{'Amazing Button Text'|texttoimage('arial')}

You can paste this in a .tpl (pagelayout.tpl) to see what happens...
Texxtoimage is further explained here: http://ez.no/ez_publish/documentation/development/libraries/ez_template/operators/image_handling

I didn't want to use the boring Arial but the more spectacular Willies Super Bold font that I have as willy.ttf on my Windows computer.

I uploaded my new font as willy.ttf to design/standard/fonts. (as pointed out by Jan in http://ez.no/community/forum/install_configuration/texttoimage_how_is_working_/re_texttoimage_how_is_working_) It should be place in my site's design directory (design/corporate/fonts) but for some reason it didn't work out)

After that i added an entry to settings/texttoimage.ini

[willy]
Family=willy
PointSize=14
XAdjustment=0
YAdjustment=0
WidthAdjustment=8
HeightAdjustment=6
BackgroundColor=#FFFFFF
TextColor=#000066

(Thanks to Ekkehard for pointing this out in http://ez.no/community/forum/suggestions/dynamic_heading_generator)

I changed the pagelayout.tpl

{'Amazing Button Text in Willies Font'|texttoimage('willy')}

to see it work.

I wanted to use various colours. This had to be changed in the settings/texttoimage.ini. There I added 4 more entries.

[willy-blue]
Family=willy
PointSize=14
XAdjustment=0
YAdjustment=0
WidthAdjustment=8
HeightAdjustment=6
BackgroundColor=#FFFFFF
TextColor=#004E9E

[willy-red]
Family=willy
PointSize=14
XAdjustment=0
YAdjustment=0
WidthAdjustment=8
HeightAdjustment=6
BackgroundColor=#FFFFFF
TextColor=#B11A3B

[willy-green]
Family=willy
PointSize=14
XAdjustment=0
YAdjustment=0
WidthAdjustment=8
HeightAdjustment=6
BackgroundColor=#FFFFFF
TextColor=#006C3A

[willy-yellow]
Family=willy
PointSize=14
XAdjustment=0
YAdjustment=0
WidthAdjustment=8
HeightAdjustment=6
BackgroundColor=#FFFFFF
TextColor=#F6BE62

To conclude I changed the pagelayout.tpl

{'Happy Things for Blue People'|texttoimage('willy-blue')}
{'Happy Things for Red People'|texttoimage('willy-red')}
{'Happy Things for Green People'|texttoimage('willy-green')}
{'Happy Things for Yellow People'|texttoimage('willy-yellow')}

It made me happy...

Another usefull thread is: http://ez.no/community/forum/setup_design/texttoimage_how_to_set_character_size

Tony Wood

Wednesday 11 August 2004 3:13:53 am

Nice posting...
This would make a great article... You should post it to documentation http://ez.no/ez_publish/documentation

--tony

Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development

Power to the Editor!

Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 31 2025 06:24:12
Script start
Timing: Jan 31 2025 06:24:12
Module start 'layout'
Timing: Jan 31 2025 06:24:12
Module start 'content'
Timing: Jan 31 2025 06:24:12
Module end 'content'
Timing: Jan 31 2025 06:24:12
Script end

Main resources:

Total runtime0.0134 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0050 588.2813151.2266
Module start 'layout' 0.00500.0022 739.507836.6797
Module start 'content' 0.00720.0048 776.187590.3125
Module end 'content' 0.01190.0014 866.500033.9922
Script end 0.0134  900.4922 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002518.3123140.0002
Check MTime0.00117.9420140.0001
Mysql Total
Database connection0.00075.488710.0007
Mysqli_queries0.002015.143330.0007
Looping result0.00000.074810.0000
Template Total0.00118.210.0011
Template load0.00086.124310.0008
Template processing0.00032.008210.0003
Override
Cache load0.00064.406310.0006
General
dbfile0.00032.088380.0000
String conversion0.00000.067740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs