Mercurial > hg > xemacs-beta
comparison src/glyphs.c @ 4815:6540302eedf5
Fix query_string_geometry lookup domain
author | Didier Verna <didier@lrde.epita.fr> |
---|---|
date | Sat, 09 Jan 2010 15:31:25 +0100 |
parents | 8f1ee2d15784 |
children | 576f09d387d5 |
comparison
equal
deleted
inserted
replaced
4814:ae2e0c1c8fae | 4815:6540302eedf5 |
---|---|
2377 query_string_geometry (Lisp_Object string, Lisp_Object face, | 2377 query_string_geometry (Lisp_Object string, Lisp_Object face, |
2378 int* width, int* height, int* descent, Lisp_Object domain) | 2378 int* width, int* height, int* descent, Lisp_Object domain) |
2379 { | 2379 { |
2380 struct font_metric_info fm; | 2380 struct font_metric_info fm; |
2381 unsigned char charsets[NUM_LEADING_BYTES]; | 2381 unsigned char charsets[NUM_LEADING_BYTES]; |
2382 struct face_cachel frame_cachel; | 2382 struct face_cachel cachel; |
2383 struct face_cachel *cachel; | 2383 struct face_cachel *the_cachel; |
2384 Lisp_Object frame = DOMAIN_FRAME (domain); | 2384 Lisp_Object window = DOMAIN_WINDOW (domain); |
2385 Lisp_Object frame = DOMAIN_FRAME (domain); | |
2385 | 2386 |
2386 CHECK_STRING (string); | 2387 CHECK_STRING (string); |
2387 | 2388 |
2388 /* Compute height */ | 2389 /* Compute height */ |
2389 if (height) | 2390 if (height) |
2394 XSTRING_LENGTH (string)); | 2395 XSTRING_LENGTH (string)); |
2395 | 2396 |
2396 /* Fallback to the default face if none was provided. */ | 2397 /* Fallback to the default face if none was provided. */ |
2397 if (!NILP (face)) | 2398 if (!NILP (face)) |
2398 { | 2399 { |
2399 reset_face_cachel (&frame_cachel); | 2400 reset_face_cachel (&cachel); |
2400 update_face_cachel_data (&frame_cachel, frame, face); | 2401 update_face_cachel_data (&cachel, |
2401 cachel = &frame_cachel; | 2402 /* #### NOTE: in fact, I'm not sure if it's |
2403 #### possible to *not* get a window | |
2404 #### here, but you never know... | |
2405 #### -- dvl */ | |
2406 NILP (window) ? frame : window, | |
2407 face); | |
2408 the_cachel = &cachel; | |
2402 } | 2409 } |
2403 else | 2410 else |
2404 { | 2411 the_cachel = WINDOW_FACE_CACHEL (DOMAIN_XWINDOW (domain), |
2405 cachel = WINDOW_FACE_CACHEL (DOMAIN_XWINDOW (domain), | 2412 DEFAULT_INDEX); |
2406 DEFAULT_INDEX); | 2413 |
2407 } | 2414 ensure_face_cachel_complete (the_cachel, domain, charsets); |
2408 | 2415 face_cachel_charset_font_metric_info (the_cachel, charsets, &fm); |
2409 ensure_face_cachel_complete (cachel, domain, charsets); | |
2410 face_cachel_charset_font_metric_info (cachel, charsets, &fm); | |
2411 | 2416 |
2412 *height = fm.ascent + fm.descent; | 2417 *height = fm.ascent + fm.descent; |
2413 /* #### descent only gets set if we query the height as well. */ | 2418 /* #### descent only gets set if we query the height as well. */ |
2414 if (descent) | 2419 if (descent) |
2415 *descent = fm.descent; | 2420 *descent = fm.descent; |
2416 } | 2421 } |
2417 | 2422 |
2418 /* Compute width */ | 2423 /* Compute width */ |
2419 if (width) | 2424 if (width) |
2420 { | 2425 *width = redisplay_text_width_string (domain, |
2421 if (!NILP (face)) | 2426 NILP (face) ? Vdefault_face : face, |
2422 *width = redisplay_frame_text_width_string (XFRAME (frame), | 2427 0, string, 0, -1); |
2423 face, | |
2424 0, string, 0, -1); | |
2425 else | |
2426 *width = redisplay_frame_text_width_string (XFRAME (frame), | |
2427 Vdefault_face, | |
2428 0, string, 0, -1); | |
2429 } | |
2430 } | 2428 } |
2431 | 2429 |
2432 Lisp_Object | 2430 Lisp_Object |
2433 query_string_font (Lisp_Object string, Lisp_Object face, Lisp_Object domain) | 2431 query_string_font (Lisp_Object string, Lisp_Object face, Lisp_Object domain) |
2434 { | 2432 { |