Forums / Setup & design / Installing True Type Font for use in texttoimage

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

eZ debug

Timing: Jan 20 2025 00:18:15
Script start
Timing: Jan 20 2025 00:18:15
Module start 'content'
Timing: Jan 20 2025 00:18:16
Module end 'content'
Timing: Jan 20 2025 00:18:16
Script end

Main resources:

Total runtime1.2110 sec
Peak memory usage4,096.0000 KB
Database Queries191

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0060 589.1016180.8125
Module start 'content' 0.00601.1053 769.9141541.5625
Module end 'content' 1.11120.0997 1,311.4766332.7422
Script end 1.2110  1,644.2188 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.3071210.0002
Check MTime0.00140.1145210.0001
Mysql Total
Database connection0.00070.060710.0007
Mysqli_queries1.147694.76081910.0060
Looping result0.00140.11731890.0000
Template Total1.186297.920.5931
Template load0.00180.146520.0009
Template processing1.184497.800920.5922
Template load and register function0.00010.009310.0001
states
state_id_array0.00110.091610.0011
state_identifier_array0.00070.059620.0004
Override
Cache load0.00150.1226280.0001
Sytem overhead
Fetch class attribute can translate value0.00120.101630.0004
Fetch class attribute name0.00110.091730.0004
XML
Image XML parsing0.00210.175330.0007
class_abstraction
Instantiating content class attribute0.00000.000830.0000
General
dbfile0.00710.5900270.0003
String conversion0.00000.000530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
5content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 21
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs