ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/defaultfont.C
(Generate patch)

Comparing rxvt-unicode/src/defaultfont.C (file contents):
Revision 1.2 by pcg, Tue Nov 25 15:25:17 2003 UTC vs.
Revision 1.3 by pcg, Thu Nov 27 20:09:00 2003 UTC

168 XSetForeground (DISPLAY, GC, r->PixColors[color]); 168 XSetForeground (DISPLAY, GC, r->PixColors[color]);
169 XFillRectangle (DISPLAY, DRAWABLE, GC, x, y, w, h); 169 XFillRectangle (DISPLAY, DRAWABLE, GC, x, y, w, h);
170 } 170 }
171} 171}
172 172
173static const char *linedraw_cmds[128] = {
174 "1hH", "2hH", "1vV", "2vV",
175 0, 0, 0, 0,
176 0, 0, 0, 0,
177 "1HV", "2H1V", "1H2V", "2HV",
178
179 // 2510
180 "1hV", "2h1V", "1h2V", "2hV",
181 "1Hv", "2H1v", "1H2v", "2Hv",
182 "1hv", "2h1v", "1h2v", "2hv",
183 "1HvV", "2H1vV", "1HV2v", "1Hv2V",
184
185 // 2520
186 "1H2vV", "2Hv1V", "2HV1v", "2HvV",
187 "1hvV", "2h1vV", "1hV2v", "1hv2V",
188 "1h2vV", "2hv1V", "1v2hV", "2hvV",
189 "1hHV", "2h1HV", "2H1hV", "2hH1V",
190
191 // 2530
192 "1hH2V", "2hV1H", "1h2HV", "2hHV",
193 "1hHv", "1vH2h", "1hv2H", "1v2hH",
194 "1hH2v", "1H2hv", "1h2Hv", "2hHv",
195 "1hHvV", "1vVH2h", "1hvV2H", "1vV2hH",
196
197 // 2540
198 "1hHV2v", "1hHv2V", "1hH2vV", "1HV2hv",
199 "1hV2Hv", "1Hv2hV", "1hv2HV", "1V2hHv",
200 "1v2hHV", "1H2hvV", "1h2HvV", "2hHvV",
201 0, 0, 0, 0,
202
203 // 2550
204 0, 0, 0, 0,
205 0, 0, 0, 0,
206 0, 0, 0, 0,
207 0, 0, 0, 0,
208
209 // 2560
210 0, 0, 0, 0,
211 0, 0, 0, 0,
212 0, 0, 0, 0,
213 0, 0, 0, 0,
214
215 // 2570
216 0, "1a", "1b", "1ab",
217 "1h", "1v", "1H", "1V",
218 "2h", "2v", "2H", "2V",
219 "1h2H", "1v2V", "1H2h", "1V2v"
220
221 // to be done
222};
223
173struct rxvt_font_default : rxvt_font { 224struct rxvt_font_default : rxvt_font {
174 bool load (int maxheight) 225 bool load (int maxheight)
175 { 226 {
176 width = 1; height = 1; 227 width = 1; height = 1;
177 ascent = 1; descent = 0; 228 ascent = 1; descent = 0;
179 return true; 230 return true;
180 } 231 }
181 232
182 bool has_codepoint (uint32_t unicode) 233 bool has_codepoint (uint32_t unicode)
183 { 234 {
184 if (unicode <= 0x001f 235 if (unicode <= 0x001f)
236 return true;
185 || (unicode >= 0x80 && unicode <= 0x9f)) 237 if (unicode >= 0x0080 && unicode <= 0x009f)
238 return true;
239
240 if (unicode >= 0x2500 && unicode <= 0x257f
241 && linedraw_cmds[unicode - 0x2500])
186 return true; 242 return true;
187 243
188 switch (unicode) 244 switch (unicode)
189 { 245 {
190 case ZERO_WIDTH_CHAR: 246 case ZERO_WIDTH_CHAR:
204 const text_t *text, int len, 260 const text_t *text, int len,
205 int fg, int bg) 261 int fg, int bg)
206{ 262{
207 clear_rect (x, y, r->TermWin.fwidth * len, r->TermWin.fheight, bg); 263 clear_rect (x, y, r->TermWin.fwidth * len, r->TermWin.fheight, bg);
208 264
265 XSetForeground (DISPLAY, GC, r->PixColors[fg]);
266
209 while (len--) 267 while (len--)
210 { 268 {
269 text_t t = *text++;
270
271 if (t >= 0x2500 & t <= 0x2580 && linedraw_cmds[t - 0x2500])
272 {
273 const char *p = linedraw_cmds[t - 0x2500];
274
275 int x0 = x, x1 = x + (r->TermWin.fwidth - 1) / 2, x2 = x + r->TermWin.fwidth - 1;
276 int y0 = y, y1 = y + (r->TermWin.fheight - 1) / 2, y2 = y + r->TermWin.fheight - 1;
277
278 XGCValues gcv;
279
280 gcv.cap_style = CapButt;
281 XChangeGC (DISPLAY, GC, GCCapStyle, &gcv);
282
283 while (*p)
284 {
285 switch (*p++)
286 {
287 case '1':
288 gcv.line_width = 0;
289 XChangeGC (DISPLAY, GC, GCLineWidth, &gcv);
290 break;
291
292 case '2':
293 gcv.line_width = 2;
294 XChangeGC (DISPLAY, GC, GCLineWidth, &gcv);
295 break;
296
297 case 'h': XDrawLine (DISPLAY, DRAWABLE, GC, x0, y1, x1, y1); break;
298 case 'H': XDrawLine (DISPLAY, DRAWABLE, GC, x1, y1, x2, y1); break;
299 case 'v': XDrawLine (DISPLAY, DRAWABLE, GC, x1, y0, x1, y1); break;
300 case 'V': XDrawLine (DISPLAY, DRAWABLE, GC, x1, y1, x1, y2); break;
301 case 'a': XDrawLine (DISPLAY, DRAWABLE, GC, x0, y2, x2, y0); break;
302 case 'b': XDrawLine (DISPLAY, DRAWABLE, GC, x0, y0, x2, y2); break;
303 }
304 }
305
306 gcv.line_width = 0;
307 XChangeGC (DISPLAY, GC, GCLineWidth, &gcv);
308 }
309 else
211 switch (*text++) 310 switch (*text++)
212 { 311 {
213 case NOCHAR: 312 case NOCHAR:
214 case ZERO_WIDTH_CHAR: 313 case ZERO_WIDTH_CHAR:
215 break; 314 break;
216 default: 315 default:
217 XSetForeground (DISPLAY, GC, r->PixColors[fg]);
218 XDrawRectangle (DISPLAY, DRAWABLE, GC, x + 2, y + 2, r->TermWin.fwidth - 5, r->TermWin.fheight - 5); 316 XDrawRectangle (DISPLAY, DRAWABLE, GC, x + 2, y + 2, r->TermWin.fwidth - 5, r->TermWin.fheight - 5);
219 } 317 }
220 318
221 x += r->TermWin.fwidth; 319 x += r->TermWin.fwidth;
222 } 320 }
223} 321}
224 322

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines