/[drupal]/contributions/modules/signwriter/README.txt
ViewVC logotype

Contents of /contributions/modules/signwriter/README.txt

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.5 - (show annotations) (download)
Mon Sep 8 02:07:34 2008 UTC (14 months, 2 weeks ago) by agileware
Branch: MAIN
CVS Tags: DRUPAL-6--1-0, DRUPAL-6--1-1, HEAD
Branch point for: DRUPAL-6--1
Changes since 1.4: +19 -12 lines
File MIME type: text/plain
* Updated to drupal 6
* Fixed bug in multiline functionality causing blank lines to be inserted
1 ------------------------The Signwriter Drupal Module-------------------------
2
3 The Signwriter module allows you to use custom fonts in headings. It does this
4 by replacing html headings with an image generated from a TrueType font file
5 which you provide. It also has a number of additional features:
6
7 - Multiple profiles allow you to have different settings for different
8 headings.
9
10 - Profiles can provide input filters to replace text matching a regular
11 expression.
12
13 - Images generated can be transparent or opaque.
14
15 - Text can be positioned within a background image.
16
17 - Text can be left, right, or center aligned.
18
19 - Font size can be automatically reduced to fit the text within a specified
20 maximum width.
21
22 - Images are cached to improve performance under high load.
23
24 - Generated images can be gif, png, jpeg, or bmp.
25
26 - Themes can use profiles configured by a user, or create their own.
27
28 From 5.x-1.2:
29
30 - Drop shadows can be added to the text.
31
32 - Multiple lines of text can be made into an image.
33
34 Signwriter is made for drupal 4.7, but it can be used by themes in earlier
35 versions of drupal without needing to enable the module. Signwriter requires
36 the GD library to work properly (read on for more info).
37
38
39
40 ---------------------------------Installation---------------------------------
41
42 Installation is trivial, simply untar the module:
43 cd /path/to/drupal/modules
44 tar xzf /path/to/signwriter-4.7.0.tar.gz
45 Next, enable the module under drupal under admin>>modules.
46
47
48 -----------------------------The GD Image Library-----------------------------
49
50 Signwriter uses the GD Image library (http://php.net/image). GD comes
51 installed by default in php >= 4.3, but can be enabled at compile time in
52 earlier versions. If your php installation is on windows, try uncommenting the
53 line which reads 'extension=php_gd2.dll' in your php.ini.
54
55 ------------------------------------Usage-------------------------------------
56
57 There are two main scenarios under which you may wish to use signwriter:
58
59 1. As a filter to replace headings or custom tags in node text, and
60
61 2. To generate headings in a theme.
62
63 In the second scenario, you can use signwriter profiles administered under
64 drupal, or you can create your own in php.
65
66 ------------------------Creating Profiles Under Drupal------------------------
67 A signwriter profile is a collection of settings which can be used to create an
68 image. To manage your profiles, go to admin>>settings>>signwriter. From here
69 you can add, delete, or edit profiles. If you add or edit a profile, you will
70 be taken to a profile settings page. On each profile settings page there are a
71 number of options which may be set, each of which is explained on that page.
72
73
74
75 --------------------------Scenario 1: Using Filters---------------------------
76
77 If a signwriter profile has a pattern defined then it will be available as an
78 input filter under admin>>input formats. After enabling the filter, any text
79 matched by the pattern will be replaced with a signwriter image.
80
81 -----Example: Replacing h2 headings in nodes-----
82
83 1. Create a profile under admin>>settings>>signwriter called 'H2 Filter', making
84 sure to enter /<h2>.*?<\/h2>/ under 'Pattern to Match When Used as
85 a Filter'. There are some example patterns on the page.
86
87 2. Go to admin>>input formats and edit your input format of choice. There
88 should be an option to enable 'H2 Filter'.
89
90 3. After enabling the filter, create a new page using your input format of
91 choice. Make sure you put in at least one h2 heading:
92 <h2>signwriter filter test</h2>.
93
94 4. Your headings should be replaced by signwriter images in the submitted page.
95
96
97
98 -------------------------Scenario 2: Theme Development------------------------
99
100 To use signwriter in a theme you have two options to configure it. You can
101 enable the module in drupal and configure it on the admin>>settings>>signwriter
102 page by adding one or more profiles, or you can create profiles yourself using
103 php.
104
105 -----Creating and Loading Profiles in php-----
106
107 If you are administering your profiles under drupal, then in your theme code
108 you will want to load one like this:
109 <?php $profile = signwriter_load_profile('Example Profile'); ?>
110 Note that you can pass a profile name or id to signwriter_load_profile().
111
112 As a php object, a signwriter profile has the following fields, most of which
113 correspond to a setting on the edit profile form:
114 <?php
115 $profile->text //The text to display. Can contain html entities.
116 //For example, &amp; will be displayed as &
117 $profile->fontfile
118 $profile->fontsize
119 $profile->foreground
120 $profile->background
121 $profile->width
122 $profile->height
123 $profile->maxwidth
124 $profile->imagetype
125 $profile->cachedir // defaults to <drupaldir>/signwriter-cache
126 $profile->textalign
127 $profile->transparent
128 $profile->bgimage
129 $profile->xoffset
130 $profile->yoffset
131 ?>
132
133 Any of these fields can be overridden in the theme after loading the profile.
134
135 If you want to create a profile from scratch then you will at least need to
136 define $profile->fontfile all other settings will revert to
137 defaults if not set. An advantage to creating the profile from scratch is that
138 the module doesn't need to be enabled, and meddlesome users can't ruin your
139 nice headings.
140
141 After you have loaded or created a profile you can use signwriter_title_convert
142 or signwriter_text_convert to replace, for example, your $title in page.tpl.php
143 (if you're using phptemplate).
144
145 -----Example 1: Replacing the page title in your theme-----
146
147 1. Create a signwriter profile in drupal called 'Theme Heading', and assign
148 the other settings to your liking.
149
150 2. In your phptemplate theme add the following code to your page.tpl.php where
151 you want to print the page title:
152 <?php
153 if ($title != '') {
154 $profile = signwriter_load_profile('Theme Heading');
155 // at this point you could override any settings. for example:
156 // $profile->fontsize = 43; // override the font size
157 print signwriter_title_convert($title, $profile);
158 }
159 ?>
160
161 3. Refresh the page in drupal and your title should appear in your custom font.
162
163 -----Example 2: Using signwriter without configuring it in drupal-----
164
165 1. Add your custom font to your theme directory. In this example we'll use Arial.ttf.
166
167 2. In your phptemplate theme add the following code to your page.tpl.php:
168 <?php
169 if ($title != '') {
170 $profile->fontfile = 'Arial';
171 $profile->fontsize = 15;
172 $profile->foreground = 'ff0000'; // red
173 $profile->background = 'ffffff'; // white. If your text is jagged then change this to your page background colour
174 $profile->maxwidth = 600;
175 $profile->transparent = true;
176 print signwriter_title_convert($title, $profile);
177 }
178 ?>
179
180 3. Refresh the page in drupal and your title should appear in red Arial size 15 text.
181
182 -------------------------------About Signwriter-------------------------------
183 Signwriter was created by Agileware (http://www.agileware.net).
184 And ported to Drupal6 by Catorg (http://www.catorg.co.uk) and Agileware.
185

  ViewVC Help
Powered by ViewVC 1.1.2