~ubuntu-branches/ubuntu/quantal/xdaliclock/quantal

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
The old font sizes were: 72, 37, 27.
I started over to create the sizes 1024, 512, 256, 128, 65, 33, 16.

How I did it:

   Photoshop:

     Font "Times", Bold, PS Type1, Adobe 1985-1997, Linotype
     1459.47 point font, text "1 2 3 4 5 6 7 8 9 0 - :"
     Save as GIF dalifontA.gif

     Scale by 6.25% (1024 => 64)
     Save as GIF dalifontE.gif

     Scale by 50% (64 => 32)
     Save as GIF dalifontF.gif

     Scale by 50% (32 => 16)
     Save as GIF dalifontG.gif

   Convert to individual 1024-tall XBM files:

     giftopnm dalifontA.gif | pgmtopbm -threshold | \
       pnmcrop -top -bottom > all.pbm

     pamdice -outstem=out -width=1080 all.pbm

     for f in out*.pbm ; do pnmcrop -left -right $f > a && mv a $f ; done

     pnmcat -tb out*.pbm | pnmpad -white -left=16 -right=16 \
       > all2.pbm ; rm out*.pbm

     head -2 all2.pbm # (char height is 12288 / 12 = 1024)

     pamdice -outstem=out -height=1024 all2.pbm

     mv out_00_00.pbm oneA.pbm
     mv out_01_00.pbm twoA.pbm
     mv out_02_00.pbm threeA.pbm
     mv out_03_00.pbm fourA.pbm
     mv out_04_00.pbm fiveA.pbm
     mv out_05_00.pbm sixA.pbm
     mv out_06_00.pbm sevenA.pbm
     mv out_07_00.pbm eightA.pbm
     mv out_08_00.pbm nineA.pbm
     mv out_09_00.pbm zeroA.pbm
     mv out_10_00.pbm slashA.pbm
     mv out_11_00.pbm colonA.pbm

     # Make colon and slash be the same size, but smaller than the digits:
     pnmcat -tb slashA.pbm colonA.pbm | pnmcrop -left -right | \
       pnmpad -white -left=16 -right=16 > all2.pbm
     pamdice -outstem=out -height=1024 all2.pbm
     mv out_00_00.pbm slashA.pbm
     mv out_01_00.pbm colonA.pbm

     rm all.pbm all2.pbm
     for f in *.pbm ; do pbmtoxbm $f > `echo $f | sed 's/pbm/xbm/'` ; done
     rm *.pbm

   Scale the "A = 1024" images down to make most of the smaller versions:

     # B = 512
     for f in *A.xbm ; do \
       xbmtopbm $f | pamscale -reduce 2 | pgmtopbm -threshold \
         > `echo $f | sed 's/A.xbm/B.pbm/'` ; \
       pbmtoxbm `echo $f | sed 's/A.xbm/B.pbm/'` \
         > `echo $f | sed 's/A/B/'` ; \
     done
     rm *.pbm

     # C = 256
     for f in *A.xbm ; do \
       xbmtopbm $f | pamscale -reduce 4 | pgmtopbm -threshold \
         > `echo $f | sed 's/A.xbm/C.pbm/'` ; \
       pbmtoxbm `echo $f | sed 's/A.xbm/C.pbm/'` \
         > `echo $f | sed 's/A/C/'` ; \
     done
     rm *.pbm

     # D = 128
     for f in *A.xbm ; do \
       xbmtopbm $f | pamscale -reduce 8 | pgmtopbm -threshold \
         > `echo $f | sed 's/A.xbm/D.pbm/'` ; \
       pbmtoxbm `echo $f | sed 's/A.xbm/D.pbm/'` \
         > `echo $f | sed 's/A/D/'` ; \
     done
     rm *.pbm

   Start over with the "E" image, for better smoothing:

     giftopnm dalifontE.gif | pgmtopbm -threshold | \
       pnmcrop -top -bottom > all.pbm

     pamdice -outstem=out -width=67 all.pbm

     for f in out*.pbm ; do pnmcrop -left -right $f > a && mv a $f ; done

     pnmcat -tb out*.pbm | pnmpad -white -left=1 -right=1 \
       > all2.pbm ; rm out*.pbm

     head -2 all2.pbm # (char height is 780 / 12 = 65)

     pamdice -outstem=out -height=65 all2.pbm

     mv out_00_00.pbm oneE.pbm
     mv out_01_00.pbm twoE.pbm
     mv out_02_00.pbm threeE.pbm
     mv out_03_00.pbm fourE.pbm
     mv out_04_00.pbm fiveE.pbm
     mv out_05_00.pbm sixE.pbm
     mv out_06_00.pbm sevenE.pbm
     mv out_07_00.pbm eightE.pbm
     mv out_08_00.pbm nineE.pbm
     mv out_09_00.pbm zeroE.pbm
     mv out_10_00.pbm slashE.pbm
     mv out_11_00.pbm colonE.pbm

     # Make colon and slash be the same size, but smaller than the digits:
     pnmcat -tb slashE.pbm colonE.pbm | pnmcrop -left -right | \
       pnmpad -white -left=1 -right=1 > all2.pbm
     pamdice -outstem=out -height=65 all2.pbm
     mv out_00_00.pbm slashE.pbm
     mv out_01_00.pbm colonE.pbm

     rm all.pbm all2.pbm
     for f in *.pbm ; do pbmtoxbm $f > `echo $f | sed 's/pbm/xbm/'` ; done
     rm *.pbm

   Likewise, start over with the "F" image.

     giftopnm dalifontF.gif | pgmtopbm -threshold | \
       pnmcrop -top -bottom > all.pbm

     pamdice -outstem=out -width=34 all.pbm

     for f in out*.pbm ; do pnmcrop -left -right $f > a && mv a $f ; done

     pnmcat -tb out*.pbm | pnmpad -white -left=1 -right=1 \
       > all2.pbm ; rm out*.pbm

     head -2 all2.pbm # (char height is 396 / 12 = 33)

     pamdice -outstem=out -height=33 all2.pbm

     mv out_00_00.pbm oneF.pbm
     mv out_01_00.pbm twoF.pbm
     mv out_02_00.pbm threeF.pbm
     mv out_03_00.pbm fourF.pbm
     mv out_04_00.pbm fiveF.pbm
     mv out_05_00.pbm sixF.pbm
     mv out_06_00.pbm sevenF.pbm
     mv out_07_00.pbm eightF.pbm
     mv out_08_00.pbm nineF.pbm
     mv out_09_00.pbm zeroF.pbm
     mv out_10_00.pbm slashF.pbm
     mv out_11_00.pbm colonF.pbm

     # Make colon and slash be the same size, but smaller than the digits:
     pnmcat -tb slashF.pbm colonF.pbm | pnmcrop -left -right | \
       pnmpad -white -left=1 -right=1 > all2.pbm
     pamdice -outstem=out -height=33 all2.pbm
     mv out_00_00.pbm slashF.pbm
     mv out_01_00.pbm colonF.pbm

     rm all.pbm all2.pbm
     for f in *.pbm ; do pbmtoxbm $f > `echo $f | sed 's/pbm/xbm/'` ; done
     rm *.pbm

   Likewise, start over with the "G" image.

     giftopnm dalifontG.gif | pgmtopbm -threshold | \
       pnmcrop -top -bottom > all.pbm

     pamdice -outstem=out -width=17 all.pbm

     for f in out*.pbm ; do pnmcrop -left -right $f > a && mv a $f ; done

     pnmcat -tb out*.pbm | pnmpad -white -left=1 -right=1 \
       > all2.pbm ; rm out*.pbm

     head -2 all2.pbm # (char height is 192 / 12 = 16)

     pamdice -outstem=out -height=16 all2.pbm

     mv out_00_00.pbm oneG.pbm
     mv out_01_00.pbm twoG.pbm
     mv out_02_00.pbm threeG.pbm
     mv out_03_00.pbm fourG.pbm
     mv out_04_00.pbm fiveG.pbm
     mv out_05_00.pbm sixG.pbm
     mv out_06_00.pbm sevenG.pbm
     mv out_07_00.pbm eightG.pbm
     mv out_08_00.pbm nineG.pbm
     mv out_09_00.pbm zeroG.pbm
     mv out_10_00.pbm slashG.pbm
     mv out_11_00.pbm colonG.pbm

     # Make colon and slash be the same size, but smaller than the digits:
     pnmcat -tb slashG.pbm colonG.pbm | pnmcrop -left -right | \
       pnmpad -white -left=1 -right=1 > all2.pbm
     pamdice -outstem=out -height=16 all2.pbm
     mv out_00_00.pbm slashG.pbm
     mv out_01_00.pbm colonG.pbm

     rm all.pbm all2.pbm
     for f in *.pbm ; do pbmtoxbm $f > `echo $f | sed 's/pbm/xbm/'` ; done
     rm *.pbm

  Then fix the declarations in the xbm files:

     for f in *.xbm ; do \
       sed 's/ char / unsigned char /' < $f > a && mv a $f ; \
     done

#############

  Unfortunately, those sizes aren't optimal for PalmOS screens, which are
  generally only 160 pixels wide.  The "D" characters are 88 wide, so let's
  make a D2 image that is 78 wide, just slightly smaller than the D image:

     giftopnm dalifontA.gif | pamscale 0.1136 | pgmtopbm -threshold | \
       pnmcrop -top -bottom > all.pbm

     pamdice -outstem=out -width=123 all.pbm

     for f in out*.pbm ; do pnmcrop -left -right $f > a && mv a $f ; done

     pnmcat -tb out*.pbm | pnmpad -white -left=1 -right=1 \
       > all2.pbm ; rm out*.pbm

     head -2 all2.pbm # (char height is 1392 / 12 = 116)

     pamdice -outstem=out -height=116 all2.pbm

     mv out_00_00.pbm oneD2.pbm
     mv out_01_00.pbm twoD2.pbm
     mv out_02_00.pbm threeD2.pbm
     mv out_03_00.pbm fourD2.pbm
     mv out_04_00.pbm fiveD2.pbm
     mv out_05_00.pbm sixD2.pbm
     mv out_06_00.pbm sevenD2.pbm
     mv out_07_00.pbm eightD2.pbm
     mv out_08_00.pbm nineD2.pbm
     mv out_09_00.pbm zeroD2.pbm
     mv out_10_00.pbm slashD2.pbm
     mv out_11_00.pbm colonD2.pbm

     # Make colon and slash be the same size, but smaller than the digits:
     pnmcat -tb slashD2.pbm colonD2.pbm | pnmcrop -left -right | \
       pnmpad -white -left=1 -right=1 > all2.pbm
     pamdice -outstem=out -height=116 all2.pbm
     mv out_00_00.pbm slashD2.pbm
     mv out_01_00.pbm colonD2.pbm

     rm all.pbm all2.pbm
     for f in *.pbm ; do pbmtoxbm $f > `echo $f | sed 's/pbm/xbm/'` ; done
     rm *.pbm

     for f in *D2.xbm ; do \
       sed 's/ char / unsigned char /' < $f > a && mv a $f ; \
     done

#############

     Likewise, none of those are optimal sizes for Palm WebOS screens.
     So let's make B2=208, C2=156, C3=90, D3=64 and D4=54 as well.

     for f in *A.xbm ; do xbmtopbm $f | pnmscale -height 302 | \
      pgmtopbm -threshold | pbmtoxbm > `echo $f | sed s/A/B2/` ; done

     for f in *B2.xbm ; do xbmtopbm $f | pnmscale -height 226 | \
      pgmtopbm -threshold | pbmtoxbm > `echo $f | sed s/B2/C2/` ; done

     for f in *C2.xbm ; do xbmtopbm $f | pnmscale -height 131 | \
      pgmtopbm -threshold | pbmtoxbm > `echo $f | sed s/C2/C3/` ; done

     for f in *C3.xbm ; do xbmtopbm $f | pnmscale -height 93 | \
      pgmtopbm -threshold | pbmtoxbm > `echo $f | sed s/C3/D3/` ; done

     for f in *D3.xbm ; do xbmtopbm $f | pnmscale -height 78 | \
      pgmtopbm -threshold | pbmtoxbm > `echo $f | sed s/D3/D4/` ; done

     for f in *{B2,C2,C3,D3,D4}.xbm ; do n=`echo $f|sed 's/\..*$//'`; \
      sed -e "s/noname/$n/g" -e  's/ char / unsigned char /' \
      < $f > a && mv a $f ; done