aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2008-05-14 01:40:23 +0000
committerKenichi Handa2008-05-14 01:40:23 +0000
commit4039e20cf488e5995cc34236be2459e685c03824 (patch)
treee11cdacfeb85f11f24022d3623c561ef4d405161
parent2a7b7982aea93d5bac211492b057b78f3c7ba261 (diff)
downloademacs-4039e20cf488e5995cc34236be2459e685c03824.tar.gz
emacs-4039e20cf488e5995cc34236be2459e685c03824.zip
Throughout the file, delete all USE_FONT_BACKEND
conditionals. Don't check enable_font_backend. Delete all codes used only when USE_FONT_BACKEND is not defined. (handle_auto_composed_prop): Do nothing if it->f is not on a window system. Check how many following characters can be displayed by the same font. (calc_pixel_width_or_height): Type of the 4th arg is changed to 'struct font *'. (get_char_face_and_encoding): Assign the whole encoding task to the `encode-char' method of a font driver. (fill_composite_glyph_string): Adjusted for the change of `struct face' and `struct glyph_string'. (fill_glyph_string): Likewise. (get_per_char_metric): Arguments changed. (x_get_glyph_overhangs): Adjusted for the change of `struct face' and `struct glyph_string'. (produce_stretch_glyph, calc_line_height_property) (x_produce_glyphs): Likewise.
-rw-r--r--src/xdisp.c243
1 files changed, 57 insertions, 186 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index bb9ec58792c..7bccdc10520 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -203,9 +203,7 @@ Boston, MA 02110-1301, USA. */
203#endif 203#endif
204 204
205#ifdef HAVE_WINDOW_SYSTEM 205#ifdef HAVE_WINDOW_SYSTEM
206#ifdef USE_FONT_BACKEND
207#include "font.h" 206#include "font.h"
208#endif /* USE_FONT_BACKEND */
209#endif /* HAVE_WINDOW_SYSTEM */ 207#endif /* HAVE_WINDOW_SYSTEM */
210 208
211#ifndef FRAME_X_OUTPUT 209#ifndef FRAME_X_OUTPUT
@@ -4573,7 +4571,7 @@ handle_auto_composed_prop (it)
4573{ 4571{
4574 enum prop_handled handled = HANDLED_NORMALLY; 4572 enum prop_handled handled = HANDLED_NORMALLY;
4575 4573
4576 if (FUNCTIONP (Vauto_composition_function)) 4574 if (FRAME_WINDOW_P (it->f) && FUNCTIONP (Vauto_composition_function))
4577 { 4575 {
4578 Lisp_Object val = Qnil; 4576 Lisp_Object val = Qnil;
4579 EMACS_INT pos, limit = -1; 4577 EMACS_INT pos, limit = -1;
@@ -4589,10 +4587,8 @@ handle_auto_composed_prop (it)
4589 Lisp_Object cmp_prop; 4587 Lisp_Object cmp_prop;
4590 EMACS_INT cmp_start, cmp_end; 4588 EMACS_INT cmp_start, cmp_end;
4591 4589
4592#ifdef USE_FONT_BACKEND 4590 if (get_property_and_range (pos, Qcomposition, &cmp_prop,
4593 if (enable_font_backend 4591 &cmp_start, &cmp_end, it->string)
4594 && get_property_and_range (pos, Qcomposition, &cmp_prop,
4595 &cmp_start, &cmp_end, it->string)
4596 && cmp_start == pos 4592 && cmp_start == pos
4597 && COMPOSITION_METHOD (cmp_prop) == COMPOSITION_WITH_GLYPH_STRING) 4593 && COMPOSITION_METHOD (cmp_prop) == COMPOSITION_WITH_GLYPH_STRING)
4598 { 4594 {
@@ -4606,7 +4602,7 @@ handle_auto_composed_prop (it)
4606 different font. */ 4602 different font. */
4607 val = Qnil; 4603 val = Qnil;
4608 } 4604 }
4609#endif 4605
4610 if (! NILP (val)) 4606 if (! NILP (val))
4611 { 4607 {
4612 Lisp_Object end; 4608 Lisp_Object end;
@@ -4641,16 +4637,13 @@ handle_auto_composed_prop (it)
4641 int count = SPECPDL_INDEX (); 4637 int count = SPECPDL_INDEX ();
4642 Lisp_Object args[5]; 4638 Lisp_Object args[5];
4643 4639
4640 limit = font_range (pos, limit, FACE_FROM_ID (it->f, it->face_id),
4641 it->f, it->string);
4644 args[0] = Vauto_composition_function; 4642 args[0] = Vauto_composition_function;
4645 specbind (Qauto_composition_function, Qnil); 4643 specbind (Qauto_composition_function, Qnil);
4646 args[1] = make_number (pos); 4644 args[1] = make_number (pos);
4647 args[2] = make_number (limit); 4645 args[2] = make_number (limit);
4648#ifdef USE_FONT_BACKEND 4646 args[3] = it->window;
4649 if (enable_font_backend)
4650 args[3] = it->window;
4651 else
4652#endif /* USE_FONT_BACKEND */
4653 args[3] = Qnil;
4654 args[4] = it->string; 4647 args[4] = it->string;
4655 safe_call (5, args); 4648 safe_call (5, args);
4656 unbind_to (count, Qnil); 4649 unbind_to (count, Qnil);
@@ -4737,7 +4730,6 @@ handle_composition_prop (it)
4737 it->cmp_len = COMPOSITION_LENGTH (prop); 4730 it->cmp_len = COMPOSITION_LENGTH (prop);
4738 /* For a terminal, draw only the first (non-TAB) character 4731 /* For a terminal, draw only the first (non-TAB) character
4739 of the components. */ 4732 of the components. */
4740#ifdef USE_FONT_BACKEND
4741 if (composition_table[id]->method == COMPOSITION_WITH_GLYPH_STRING) 4733 if (composition_table[id]->method == COMPOSITION_WITH_GLYPH_STRING)
4742 { 4734 {
4743 /* FIXME: This doesn't do anything!?! */ 4735 /* FIXME: This doesn't do anything!?! */
@@ -4746,7 +4738,6 @@ handle_composition_prop (it)
4746 cmp->hash_index * 2); 4738 cmp->hash_index * 2);
4747 } 4739 }
4748 else 4740 else
4749#endif /* USE_FONT_BACKEND */
4750 { 4741 {
4751 int i; 4742 int i;
4752 4743
@@ -18816,7 +18807,7 @@ calc_pixel_width_or_height (res, it, prop, font, width_p, align_to)
18816 double *res; 18807 double *res;
18817 struct it *it; 18808 struct it *it;
18818 Lisp_Object prop; 18809 Lisp_Object prop;
18819 void *font; 18810 struct font *font;
18820 int width_p, *align_to; 18811 int width_p, *align_to;
18821{ 18812{
18822 double pixels; 18813 double pixels;
@@ -18869,9 +18860,9 @@ calc_pixel_width_or_height (res, it, prop, font, width_p, align_to)
18869 18860
18870#ifdef HAVE_WINDOW_SYSTEM 18861#ifdef HAVE_WINDOW_SYSTEM
18871 if (EQ (prop, Qheight)) 18862 if (EQ (prop, Qheight))
18872 return OK_PIXELS (font ? FONT_HEIGHT ((XFontStruct *)font) : FRAME_LINE_HEIGHT (it->f)); 18863 return OK_PIXELS (font ? FONT_HEIGHT (font) : FRAME_LINE_HEIGHT (it->f));
18873 if (EQ (prop, Qwidth)) 18864 if (EQ (prop, Qwidth))
18874 return OK_PIXELS (font ? FONT_WIDTH ((XFontStruct *)font) : FRAME_COLUMN_WIDTH (it->f)); 18865 return OK_PIXELS (font ? FONT_WIDTH (font) : FRAME_COLUMN_WIDTH (it->f));
18875#else 18866#else
18876 if (EQ (prop, Qheight) || EQ (prop, Qwidth)) 18867 if (EQ (prop, Qheight) || EQ (prop, Qwidth))
18877 return OK_PIXELS (1); 18868 return OK_PIXELS (1);
@@ -19154,49 +19145,14 @@ get_char_face_and_encoding (f, c, face_id, char2b, multibyte_p, display_p)
19154{ 19145{
19155 struct face *face = FACE_FROM_ID (f, face_id); 19146 struct face *face = FACE_FROM_ID (f, face_id);
19156 19147
19157#ifdef USE_FONT_BACKEND 19148 if (face->font)
19158 if (enable_font_backend)
19159 { 19149 {
19160 struct font *font = (struct font *) face->font_info; 19150 unsigned code = face->font->driver->encode_char (face->font, c);
19161 19151
19162 if (font) 19152 if (code != FONT_INVALID_CODE)
19163 {
19164 unsigned code = font->driver->encode_char (font, c);
19165
19166 if (code != FONT_INVALID_CODE)
19167 STORE_XCHAR2B (char2b, (code >> 8), (code & 0xFF));
19168 else
19169 STORE_XCHAR2B (char2b, 0, 0);
19170 }
19171 }
19172 else
19173#endif /* USE_FONT_BACKEND */
19174 if (!multibyte_p)
19175 {
19176 /* Unibyte case. We don't have to encode, but we have to make
19177 sure to use a face suitable for unibyte. */
19178 STORE_XCHAR2B (char2b, 0, c);
19179 face_id = FACE_FOR_CHAR (f, face, c, -1, Qnil);
19180 face = FACE_FROM_ID (f, face_id);
19181 }
19182 else if (c < 128)
19183 {
19184 /* Case of ASCII in a face known to fit ASCII. */
19185 STORE_XCHAR2B (char2b, 0, c);
19186 }
19187 else if (face->font != NULL)
19188 {
19189 struct font_info *font_info
19190 = FONT_INFO_FROM_ID (f, face->font_info_id);
19191 struct charset *charset = CHARSET_FROM_ID (font_info->charset);
19192 unsigned code = ENCODE_CHAR (charset, c);
19193
19194 if (CHARSET_DIMENSION (charset) == 1)
19195 STORE_XCHAR2B (char2b, 0, code);
19196 else
19197 STORE_XCHAR2B (char2b, (code >> 8), (code & 0xFF)); 19153 STORE_XCHAR2B (char2b, (code >> 8), (code & 0xFF));
19198 /* Maybe encode the character in *CHAR2B. */ 19154 else
19199 FRAME_RIF (f)->encode_char (c, char2b, font_info, charset, NULL); 19155 STORE_XCHAR2B (char2b, 0, 0);
19200 } 19156 }
19201 19157
19202 /* Make sure X resources of the face are allocated. */ 19158 /* Make sure X resources of the face are allocated. */
@@ -19231,56 +19187,14 @@ get_glyph_face_and_encoding (f, glyph, char2b, two_byte_p)
19231 if (two_byte_p) 19187 if (two_byte_p)
19232 *two_byte_p = 0; 19188 *two_byte_p = 0;
19233 19189
19234#ifdef USE_FONT_BACKEND 19190 if (face->font)
19235 if (enable_font_backend)
19236 {
19237 struct font *font = (struct font *) face->font_info;
19238
19239 if (font)
19240 {
19241 unsigned code = font->driver->encode_char (font, glyph->u.ch);
19242
19243 if (code != FONT_INVALID_CODE)
19244 STORE_XCHAR2B (char2b, (code >> 8), (code & 0xFF));
19245 else
19246 STORE_XCHAR2B (char2b, 0, code);
19247 }
19248 }
19249 else
19250#endif /* USE_FONT_BACKEND */
19251 if (!glyph->multibyte_p)
19252 {
19253 /* Unibyte case. We don't have to encode, but we have to make
19254 sure to use a face suitable for unibyte. */
19255 STORE_XCHAR2B (char2b, 0, glyph->u.ch);
19256 }
19257 else if (glyph->u.ch < 128)
19258 {
19259 /* Case of ASCII in a face known to fit ASCII. */
19260 STORE_XCHAR2B (char2b, 0, glyph->u.ch);
19261 }
19262 else
19263 { 19191 {
19264 struct font_info *font_info 19192 unsigned code = face->font->driver->encode_char (face->font, glyph->u.ch);
19265 = FONT_INFO_FROM_ID (f, face->font_info_id);
19266 if (font_info)
19267 {
19268 struct charset *charset = CHARSET_FROM_ID (font_info->charset);
19269 unsigned code = ENCODE_CHAR (charset, glyph->u.ch);
19270 19193
19271 if (CHARSET_DIMENSION (charset) == 1) 19194 if (code != FONT_INVALID_CODE)
19272 STORE_XCHAR2B (char2b, 0, code); 19195 STORE_XCHAR2B (char2b, (code >> 8), (code & 0xFF));
19273 else 19196 else
19274 STORE_XCHAR2B (char2b, (code >> 8), (code & 0xFF)); 19197 STORE_XCHAR2B (char2b, 0, code);
19275
19276 /* Maybe encode the character in *CHAR2B. */
19277 if (CHARSET_ID (charset) != charset_ascii)
19278 {
19279 glyph->font_type
19280 = FRAME_RIF (f)->encode_char (glyph->u.ch, char2b, font_info,
19281 charset, two_byte_p);
19282 }
19283 }
19284 } 19198 }
19285 19199
19286 /* Make sure X resources of the face are allocated. */ 19200 /* Make sure X resources of the face are allocated. */
@@ -19312,16 +19226,14 @@ fill_composite_glyph_string (s, base_face, overlaps)
19312 19226
19313 s->for_overlaps = overlaps; 19227 s->for_overlaps = overlaps;
19314 19228
19315#ifdef USE_FONT_BACKEND 19229 if (s->cmp->method == COMPOSITION_WITH_GLYPH_STRING)
19316 if (enable_font_backend && s->cmp->method == COMPOSITION_WITH_GLYPH_STRING)
19317 { 19230 {
19318 Lisp_Object gstring 19231 Lisp_Object gstring
19319 = AREF (XHASH_TABLE (composition_hash_table)->key_and_value, 19232 = AREF (XHASH_TABLE (composition_hash_table)->key_and_value,
19320 s->cmp->hash_index * 2); 19233 s->cmp->hash_index * 2);
19321 19234
19322 s->face = base_face; 19235 s->face = base_face;
19323 s->font_info = base_face->font_info; 19236 s->font = base_face->font;
19324 s->font = s->font_info->font;
19325 for (i = 0, s->nchars = 0; i < s->cmp->glyph_len; i++, s->nchars++) 19237 for (i = 0, s->nchars = 0; i < s->cmp->glyph_len; i++, s->nchars++)
19326 { 19238 {
19327 Lisp_Object g = LGSTRING_GLYPH (gstring, i); 19239 Lisp_Object g = LGSTRING_GLYPH (gstring, i);
@@ -19336,7 +19248,6 @@ fill_composite_glyph_string (s, base_face, overlaps)
19336 s->width = s->cmp->pixel_width; 19248 s->width = s->cmp->pixel_width;
19337 } 19249 }
19338 else 19250 else
19339#endif /* USE_FONT_BACKEND */
19340 { 19251 {
19341 /* For all glyphs of this composition, starting at the offset 19252 /* For all glyphs of this composition, starting at the offset
19342 S->gidx, until we reach the end of the definition or encounter a 19253 S->gidx, until we reach the end of the definition or encounter a
@@ -19345,7 +19256,6 @@ fill_composite_glyph_string (s, base_face, overlaps)
19345 19256
19346 s->face = NULL; 19257 s->face = NULL;
19347 s->font = NULL; 19258 s->font = NULL;
19348 s->font_info = NULL;
19349 for (i = s->gidx; i < s->cmp->glyph_len; i++) 19259 for (i = s->gidx; i < s->cmp->glyph_len; i++)
19350 { 19260 {
19351 int c = COMPOSITION_GLYPH (s->cmp, i); 19261 int c = COMPOSITION_GLYPH (s->cmp, i);
@@ -19363,7 +19273,6 @@ fill_composite_glyph_string (s, base_face, overlaps)
19363 { 19273 {
19364 s->face = face; 19274 s->face = face;
19365 s->font = s->face->font; 19275 s->font = s->face->font;
19366 s->font_info = FONT_INFO_FROM_FACE (s->f, s->face);
19367 } 19276 }
19368 else if (s->face != face) 19277 else if (s->face != face)
19369 break; 19278 break;
@@ -19448,7 +19357,6 @@ fill_glyph_string (s, face_id, start, end, overlaps)
19448 } 19357 }
19449 19358
19450 s->font = s->face->font; 19359 s->font = s->face->font;
19451 s->font_info = FONT_INFO_FROM_FACE (s->f, s->face);
19452 19360
19453 /* If the specified font could not be loaded, use the frame's font, 19361 /* If the specified font could not be loaded, use the frame's font,
19454 but record the fact that we couldn't load it in 19362 but record the fact that we couldn't load it in
@@ -19512,7 +19420,6 @@ fill_stretch_glyph_string (s, row, area, start, end)
19512 face_id = glyph->face_id; 19420 face_id = glyph->face_id;
19513 s->face = FACE_FROM_ID (s->f, face_id); 19421 s->face = FACE_FROM_ID (s->f, face_id);
19514 s->font = s->face->font; 19422 s->font = s->face->font;
19515 s->font_info = FONT_INFO_FROM_FACE (s->f, s->face);
19516 s->width = glyph->pixel_width; 19423 s->width = glyph->pixel_width;
19517 s->nchars = 1; 19424 s->nchars = 1;
19518 voffset = glyph->voffset; 19425 voffset = glyph->voffset;
@@ -19534,35 +19441,20 @@ fill_stretch_glyph_string (s, row, area, start, end)
19534 return glyph - s->row->glyphs[s->area]; 19441 return glyph - s->row->glyphs[s->area];
19535} 19442}
19536 19443
19537static XCharStruct * 19444static struct font_metrics *
19538get_per_char_metric (f, font, font_info, char2b, font_type) 19445get_per_char_metric (f, font, char2b)
19539 struct frame *f; 19446 struct frame *f;
19540 XFontStruct *font; 19447 struct font *font;
19541 struct font_info *font_info;
19542 XChar2b *char2b; 19448 XChar2b *char2b;
19543 int font_type;
19544{ 19449{
19545#ifdef USE_FONT_BACKEND 19450 static struct font_metrics metrics;
19546 if (enable_font_backend) 19451 unsigned code = (XCHAR2B_BYTE1 (char2b) << 8) | XCHAR2B_BYTE2 (char2b);
19547 { 19452 struct font *fontp;
19548 static XCharStruct pcm_value;
19549 unsigned code = (XCHAR2B_BYTE1 (char2b) << 8) | XCHAR2B_BYTE2 (char2b);
19550 struct font *fontp;
19551 struct font_metrics metrics;
19552 19453
19553 if (! font_info || code == FONT_INVALID_CODE) 19454 if (! font || code == FONT_INVALID_CODE)
19554 return NULL; 19455 return NULL;
19555 fontp = (struct font *) font_info; 19456 font->driver->text_extents (font, &code, 1, &metrics);
19556 fontp->driver->text_extents (fontp, &code, 1, &metrics); 19457 return &metrics;
19557 pcm_value.lbearing = metrics.lbearing;
19558 pcm_value.rbearing = metrics.rbearing;
19559 pcm_value.ascent = metrics.ascent;
19560 pcm_value.descent = metrics.descent;
19561 pcm_value.width = metrics.width;
19562 return &pcm_value;
19563 }
19564#endif /* USE_FONT_BACKEND */
19565 return FRAME_RIF (f)->per_char_metric (font, char2b, font_type);
19566} 19458}
19567 19459
19568/* EXPORT for RIF: 19460/* EXPORT for RIF:
@@ -19580,17 +19472,12 @@ x_get_glyph_overhangs (glyph, f, left, right)
19580 19472
19581 if (glyph->type == CHAR_GLYPH) 19473 if (glyph->type == CHAR_GLYPH)
19582 { 19474 {
19583 XFontStruct *font;
19584 struct face *face; 19475 struct face *face;
19585 struct font_info *font_info;
19586 XChar2b char2b; 19476 XChar2b char2b;
19587 XCharStruct *pcm; 19477 struct font_metrics *pcm;
19588 19478
19589 face = get_glyph_face_and_encoding (f, glyph, &char2b, NULL); 19479 face = get_glyph_face_and_encoding (f, glyph, &char2b, NULL);
19590 font = face->font; 19480 if (face->font && (pcm = get_per_char_metric (f, face->font, &char2b)))
19591 font_info = FONT_INFO_FROM_FACE (f, face);
19592 if (font /* ++KFS: Should this be font_info ? */
19593 && (pcm = get_per_char_metric (f, font, font_info, &char2b, glyph->font_type)))
19594 { 19481 {
19595 if (pcm->rbearing > pcm->width) 19482 if (pcm->rbearing > pcm->width)
19596 *right = pcm->rbearing - pcm->width; 19483 *right = pcm->rbearing - pcm->width;
@@ -20536,7 +20423,7 @@ produce_stretch_glyph (it)
20536 int ascent = 0; 20423 int ascent = 0;
20537 double tem; 20424 double tem;
20538 struct face *face = FACE_FROM_ID (it->f, it->face_id); 20425 struct face *face = FACE_FROM_ID (it->f, it->face_id);
20539 XFontStruct *font = face->font ? face->font : FRAME_FONT (it->f); 20426 struct font *font = face->font ? face->font : FRAME_FONT (it->f);
20540 20427
20541 PREPARE_FACE_FOR_DISPLAY (it->f, face); 20428 PREPARE_FACE_FOR_DISPLAY (it->f, face);
20542 20429
@@ -20677,7 +20564,7 @@ static Lisp_Object
20677calc_line_height_property (it, val, font, boff, override) 20564calc_line_height_property (it, val, font, boff, override)
20678 struct it *it; 20565 struct it *it;
20679 Lisp_Object val; 20566 Lisp_Object val;
20680 XFontStruct *font; 20567 struct font *font;
20681 int boff, override; 20568 int boff, override;
20682{ 20569{
20683 Lisp_Object face_name = Qnil; 20570 Lisp_Object face_name = Qnil;
@@ -20712,7 +20599,6 @@ calc_line_height_property (it, val, font, boff, override)
20712 { 20599 {
20713 int face_id; 20600 int face_id;
20714 struct face *face; 20601 struct face *face;
20715 struct font_info *font_info;
20716 20602
20717 face_id = lookup_named_face (it->f, face_name, 0); 20603 face_id = lookup_named_face (it->f, face_name, 0);
20718 if (face_id < 0) 20604 if (face_id < 0)
@@ -20722,10 +20608,8 @@ calc_line_height_property (it, val, font, boff, override)
20722 font = face->font; 20608 font = face->font;
20723 if (font == NULL) 20609 if (font == NULL)
20724 return make_number (-1); 20610 return make_number (-1);
20725 20611 boff = font->baseline_offset;
20726 font_info = FONT_INFO_FROM_FACE (it->f, face); 20612 if (font->vertical_centering)
20727 boff = font_info->baseline_offset;
20728 if (font_info->vertical_centering)
20729 boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff; 20613 boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff;
20730 } 20614 }
20731 20615
@@ -20767,11 +20651,10 @@ x_produce_glyphs (it)
20767 if (it->what == IT_CHARACTER) 20651 if (it->what == IT_CHARACTER)
20768 { 20652 {
20769 XChar2b char2b; 20653 XChar2b char2b;
20770 XFontStruct *font; 20654 struct font *font;
20771 struct face *face = FACE_FROM_ID (it->f, it->face_id); 20655 struct face *face = FACE_FROM_ID (it->f, it->face_id);
20772 XCharStruct *pcm; 20656 struct font_metrics *pcm;
20773 int font_not_found_p; 20657 int font_not_found_p;
20774 struct font_info *font_info;
20775 int boff; /* baseline offset */ 20658 int boff; /* baseline offset */
20776 /* We may change it->multibyte_p upon unibyte<->multibyte 20659 /* We may change it->multibyte_p upon unibyte<->multibyte
20777 conversion. So, save the current value now and restore it 20660 conversion. So, save the current value now and restore it
@@ -20813,13 +20696,11 @@ x_produce_glyphs (it)
20813 { 20696 {
20814 font = FRAME_FONT (it->f); 20697 font = FRAME_FONT (it->f);
20815 boff = FRAME_BASELINE_OFFSET (it->f); 20698 boff = FRAME_BASELINE_OFFSET (it->f);
20816 font_info = NULL;
20817 } 20699 }
20818 else 20700 else
20819 { 20701 {
20820 font_info = FONT_INFO_FROM_FACE (it->f, face); 20702 boff = font->baseline_offset;
20821 boff = font_info->baseline_offset; 20703 if (font->vertical_centering)
20822 if (font_info->vertical_centering)
20823 boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff; 20704 boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff;
20824 } 20705 }
20825 20706
@@ -20831,8 +20712,7 @@ x_produce_glyphs (it)
20831 20712
20832 it->nglyphs = 1; 20713 it->nglyphs = 1;
20833 20714
20834 pcm = get_per_char_metric (it->f, font, font_info, &char2b, 20715 pcm = get_per_char_metric (it->f, font, &char2b);
20835 FONT_TYPE_FOR_UNIBYTE (font, it->char_to_display));
20836 20716
20837 if (it->override_ascent >= 0) 20717 if (it->override_ascent >= 0)
20838 { 20718 {
@@ -21066,8 +20946,7 @@ x_produce_glyphs (it)
21066 multiplying the width of font by the width of the 20946 multiplying the width of font by the width of the
21067 character. */ 20947 character. */
21068 20948
21069 pcm = get_per_char_metric (it->f, font, font_info, &char2b, 20949 pcm = get_per_char_metric (it->f, font, &char2b);
21070 FONT_TYPE_FOR_MULTIBYTE (font, it->c));
21071 20950
21072 if (font_not_found_p || !pcm) 20951 if (font_not_found_p || !pcm)
21073 { 20952 {
@@ -21147,18 +21026,16 @@ x_produce_glyphs (it)
21147 int boff; /* baseline offset */ 21026 int boff; /* baseline offset */
21148 struct composition *cmp = composition_table[it->cmp_id]; 21027 struct composition *cmp = composition_table[it->cmp_id];
21149 int glyph_len = cmp->glyph_len; 21028 int glyph_len = cmp->glyph_len;
21150 XFontStruct *font = face->font; 21029 struct font *font = face->font;
21151 21030
21152 it->nglyphs = 1; 21031 it->nglyphs = 1;
21153 21032
21154#ifdef USE_FONT_BACKEND
21155 if (cmp->method == COMPOSITION_WITH_GLYPH_STRING) 21033 if (cmp->method == COMPOSITION_WITH_GLYPH_STRING)
21156 { 21034 {
21157 PREPARE_FACE_FOR_DISPLAY (it->f, face); 21035 PREPARE_FACE_FOR_DISPLAY (it->f, face);
21158 font_prepare_composition (cmp, it->f); 21036 font_prepare_composition (cmp, it->f);
21159 } 21037 }
21160 else 21038 else
21161#endif /* USE_FONT_BACKEND */
21162 /* If we have not yet calculated pixel size data of glyphs of 21039 /* If we have not yet calculated pixel size data of glyphs of
21163 the composition for the current face font, calculate them 21040 the composition for the current face font, calculate them
21164 now. Theoretically, we have to check all fonts for the 21041 now. Theoretically, we have to check all fonts for the
@@ -21181,9 +21058,8 @@ x_produce_glyphs (it)
21181 int face_id; 21058 int face_id;
21182 int c; 21059 int c;
21183 XChar2b char2b; 21060 XChar2b char2b;
21184 XCharStruct *pcm; 21061 struct font_metrics *pcm;
21185 int font_not_found_p; 21062 int font_not_found_p;
21186 struct font_info *font_info;
21187 int pos; 21063 int pos;
21188 21064
21189 for (glyph_len = cmp->glyph_len; glyph_len > 0; glyph_len--) 21065 for (glyph_len = cmp->glyph_len; glyph_len > 0; glyph_len--)
@@ -21209,9 +21085,8 @@ x_produce_glyphs (it)
21209 face = face->ascii_face; 21085 face = face->ascii_face;
21210 font = face->font; 21086 font = face->font;
21211 } 21087 }
21212 font_info = FONT_INFO_FROM_FACE (it->f, face); 21088 boff = font->baseline_offset;
21213 boff = font_info->baseline_offset; 21089 if (font->vertical_centering)
21214 if (font_info->vertical_centering)
21215 boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff; 21090 boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff;
21216 font_ascent = FONT_BASE (font) + boff; 21091 font_ascent = FONT_BASE (font) + boff;
21217 font_descent = FONT_DESCENT (font) - boff; 21092 font_descent = FONT_DESCENT (font) - boff;
@@ -21224,8 +21099,7 @@ x_produce_glyphs (it)
21224 { 21099 {
21225 get_char_face_and_encoding (it->f, c, it->face_id, 21100 get_char_face_and_encoding (it->f, c, it->face_id,
21226 &char2b, it->multibyte_p, 0); 21101 &char2b, it->multibyte_p, 0);
21227 pcm = get_per_char_metric (it->f, font, font_info, &char2b, 21102 pcm = get_per_char_metric (it->f, font, &char2b);
21228 FONT_TYPE_FOR_MULTIBYTE (font, c));
21229 } 21103 }
21230 21104
21231 /* Initialize the bounding box. */ 21105 /* Initialize the bounding box. */
@@ -21252,11 +21126,11 @@ x_produce_glyphs (it)
21252 highest = ascent + boff; 21126 highest = ascent + boff;
21253 21127
21254 if (! font_not_found_p 21128 if (! font_not_found_p
21255 && font_info->default_ascent 21129 && font->default_ascent
21256 && CHAR_TABLE_P (Vuse_default_ascent) 21130 && CHAR_TABLE_P (Vuse_default_ascent)
21257 && !NILP (Faref (Vuse_default_ascent, 21131 && !NILP (Faref (Vuse_default_ascent,
21258 make_number (it->char_to_display)))) 21132 make_number (it->char_to_display))))
21259 highest = font_info->default_ascent + boff; 21133 highest = font->default_ascent + boff;
21260 21134
21261 /* Draw the first glyph at the normal position. It may be 21135 /* Draw the first glyph at the normal position. It may be
21262 shifted to right later if some other glyphs are drawn 21136 shifted to right later if some other glyphs are drawn
@@ -21285,15 +21159,12 @@ x_produce_glyphs (it)
21285 pcm = NULL; 21159 pcm = NULL;
21286 else 21160 else
21287 { 21161 {
21288 font_info = FONT_INFO_FROM_FACE (it->f, this_face); 21162 this_boff = font->baseline_offset;
21289 this_boff = font_info->baseline_offset; 21163 if (font->vertical_centering)
21290 if (font_info->vertical_centering)
21291 this_boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff; 21164 this_boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff;
21292 get_char_face_and_encoding (it->f, ch, face_id, 21165 get_char_face_and_encoding (it->f, ch, face_id,
21293 &char2b, it->multibyte_p, 0); 21166 &char2b, it->multibyte_p, 0);
21294 pcm = get_per_char_metric (it->f, font, font_info, &char2b, 21167 pcm = get_per_char_metric (it->f, font, &char2b);
21295 FONT_TYPE_FOR_MULTIBYTE (font,
21296 ch));
21297 } 21168 }
21298 if (! pcm) 21169 if (! pcm)
21299 cmp->offsets[i * 2] = cmp->offsets[i * 2 + 1] = 0; 21170 cmp->offsets[i * 2] = cmp->offsets[i * 2 + 1] = 0;
@@ -21310,13 +21181,13 @@ x_produce_glyphs (it)
21310 alternate chars. */ 21181 alternate chars. */
21311 left = (leftmost + rightmost - width) / 2; 21182 left = (leftmost + rightmost - width) / 2;
21312 btm = - descent + boff; 21183 btm = - descent + boff;
21313 if (font_info->relative_compose 21184 if (font->relative_compose
21314 && (! CHAR_TABLE_P (Vignore_relative_composition) 21185 && (! CHAR_TABLE_P (Vignore_relative_composition)
21315 || NILP (Faref (Vignore_relative_composition, 21186 || NILP (Faref (Vignore_relative_composition,
21316 make_number (ch))))) 21187 make_number (ch)))))
21317 { 21188 {
21318 21189
21319 if (- descent >= font_info->relative_compose) 21190 if (- descent >= font->relative_compose)
21320 /* One extra pixel between two glyphs. */ 21191 /* One extra pixel between two glyphs. */
21321 btm = highest + 1; 21192 btm = highest + 1;
21322 else if (ascent <= 0) 21193 else if (ascent <= 0)