comparison src/objects-x.c @ 3389:77b0b03fbc47

[xemacs-hg @ 2006-05-09 10:40:07 by stephent] Avoid leaking FontStructs. <87lktblbyt.fsf@tleepslib.sk.tsukuba.ac.jp>
author stephent
date Tue, 09 May 2006 10:40:09 +0000
parents 316fddbf58e2
children ac11131c6de9
comparison
equal deleted inserted replaced
3388:e7fb0df1caea 3389:77b0b03fbc47
307 maybe_signal_error (Qgui_error, "Couldn't load font", f->name, 307 maybe_signal_error (Qgui_error, "Couldn't load font", f->name,
308 Qfont, errb); 308 Qfont, errb);
309 return 0; 309 return 0;
310 } 310 }
311 311
312 if (rf && fs)
313 {
314 XFreeFont (dpy, fs);
315 fs = NULL; /* we don' need no steenkin' X font */
316 }
317
312 if (fs && !fs->max_bounds.width) 318 if (fs && !fs->max_bounds.width)
313 { 319 {
314 /* yes, this has been known to happen. */ 320 /* yes, this has been known to happen. */
315 XFreeFont (dpy, fs); 321 XFreeFont (dpy, fs);
316 fs = NULL; 322 fs = NULL;
317 maybe_signal_error (Qgui_error, "X font is too small", f->name, Qfont, 323 maybe_signal_error (Qgui_error, "X font is too small", f->name, Qfont,
318 errb); 324 errb);
319 if (!rf) 325 return 0;
320 return 0;
321 } 326 }
322 327
323 /* Now that we're sure that we will succeed, we can allocate data without 328 /* Now that we're sure that we will succeed, we can allocate data without
324 fear that the finalize method may get fucked. */ 329 fear that the finalize method may get fucked. */
325 f->data = xnew (struct x_font_instance_data); 330 f->data = xnew (struct x_font_instance_data);
351 f->width = (2*glyphinfo.width + len)/(2*len); 356 f->width = (2*glyphinfo.width + len)/(2*len);
352 } 357 }
353 f->height = rf->height; 358 f->height = rf->height;
354 f->proportional_p = 1; /* we can't recognize monospaced fonts! */ 359 f->proportional_p = 1; /* we can't recognize monospaced fonts! */
355 360
356 DEBUG_XFT4 (0, "initialized metrics ascent %d descent %d width %d height %d\n", 361 /* #### This message appears wa-a-ay too often!
357 f->ascent, f->descent, f->width, f->height); 362 We probably need to cache truenames or something?
358 /* we also output on initialization of any font below */ 363 Even if Xft does it for us, we cons too many font instances. */
359 DEBUG_XFT1 (2, "initialized Xft font %s\n", XSTRING_DATA(f->name)); 364 DEBUG_XFT4 (0,
360 fs = NULL; /* we don' need no steenkin' X font */ 365 "initialized metrics ascent %d descent %d width %d height %d\n",
366 f->ascent, f->descent, f->width, f->height);
361 } 367 }
362 else 368 else
363 { 369 {
364 DEBUG_XFT1 (0, "couldn't initialize Xft font %s\n", 370 DEBUG_XFT1 (0, "couldn't initialize Xft font %s\n",
365 XSTRING_DATA(f->name)); 371 XSTRING_DATA(f->name));