comparison src/ftxfont.c @ 91906:a18321dbb8fa

(ftxfont_default_fid): Delete it. (ftxfont_open): Set xfont->fid to 0. (ftxfont_end_for_frame): Clear data specifi to the frame and the font-driver.
author Kenichi Handa <handa@m17n.org>
date Sun, 17 Feb 2008 02:03:19 +0000
parents ffe8367d4bdc
children 919240e47747
comparison
equal deleted inserted replaced
91905:6ae79e72fea7 91906:a18321dbb8fa
44 static int ftxfont_draw_bitmap P_ ((FRAME_PTR, GC, GC *, struct font *, 44 static int ftxfont_draw_bitmap P_ ((FRAME_PTR, GC, GC *, struct font *,
45 unsigned, int, int, XPoint *, int, int *, 45 unsigned, int, int, XPoint *, int, int *,
46 int)); 46 int));
47 static void ftxfont_draw_backgrond P_ ((FRAME_PTR, struct font *, GC, 47 static void ftxfont_draw_backgrond P_ ((FRAME_PTR, struct font *, GC,
48 int, int, int)); 48 int, int, int));
49 static Font ftxfont_default_fid P_ ((FRAME_PTR));
50 49
51 struct ftxfont_frame_data 50 struct ftxfont_frame_data
52 { 51 {
53 /* Background and foreground colors. */ 52 /* Background and foreground colors. */
54 XColor colors[2]; 53 XColor colors[2];
240 XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc, 239 XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
241 x, y - font->ascent, width, y + font->descent); 240 x, y - font->ascent, width, y + font->descent);
242 XSetForeground (FRAME_X_DISPLAY (f), gc, xgcv.foreground); 241 XSetForeground (FRAME_X_DISPLAY (f), gc, xgcv.foreground);
243 } 242 }
244 243
245 /* Return the default Font ID on frame F. */
246
247 static Font
248 ftxfont_default_fid (f)
249 FRAME_PTR f;
250 {
251 static int fid_known;
252 static Font fid;
253
254 if (! fid_known)
255 {
256 fid = XLoadFont (FRAME_X_DISPLAY (f), "fixed");
257 if (! fid)
258 {
259 fid = XLoadFont (FRAME_X_DISPLAY (f), "*");
260 if (! fid)
261 abort ();
262 }
263 fid_known = 1;
264 }
265 return fid;
266 }
267
268 /* Prototypes for font-driver methods. */ 244 /* Prototypes for font-driver methods. */
269 static Lisp_Object ftxfont_list P_ ((Lisp_Object, Lisp_Object)); 245 static Lisp_Object ftxfont_list P_ ((Lisp_Object, Lisp_Object));
270 static Lisp_Object ftxfont_match P_ ((Lisp_Object, Lisp_Object)); 246 static Lisp_Object ftxfont_match P_ ((Lisp_Object, Lisp_Object));
271 static struct font *ftxfont_open P_ ((FRAME_PTR, Lisp_Object, int)); 247 static struct font *ftxfont_open P_ ((FRAME_PTR, Lisp_Object, int));
272 static void ftxfont_close P_ ((FRAME_PTR, struct font *)); 248 static void ftxfont_close P_ ((FRAME_PTR, struct font *));
319 if (! font) 295 if (! font)
320 { 296 {
321 free (xfont); 297 free (xfont);
322 return NULL; 298 return NULL;
323 } 299 }
324 300 xfont->fid = (Font) 0;
325 xfont->fid = ftxfont_default_fid (f);
326 xfont->ascent = font->ascent; 301 xfont->ascent = font->ascent;
327 xfont->descent = font->descent; 302 xfont->descent = font->descent;
328 xfont->max_bounds.width = font->font.size; 303 xfont->max_bounds.width = font->font.size;
329 xfont->min_bounds.width = font->min_width; 304 xfont->min_bounds.width = font->min_width;
330 font->font.font = xfont; 305 font->font.font = xfont;
453 XFreeGC (FRAME_X_DISPLAY (f), data->gcs[i]); 428 XFreeGC (FRAME_X_DISPLAY (f), data->gcs[i]);
454 free (data); 429 free (data);
455 data = next; 430 data = next;
456 } 431 }
457 UNBLOCK_INPUT; 432 UNBLOCK_INPUT;
433 font_put_frame_data (f, &ftxfont_driver, NULL);
458 return 0; 434 return 0;
459 } 435 }
460 436
461 437
462 438