X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/40d83b412f584cc02e68d4eac8fd5e6eb769e2fe..0a2132baa8e795b72d35833209132d23a1553bc2:/src/xfont.c diff --git a/src/xfont.c b/src/xfont.c index 3e0fcd2cd7..2c3ca91162 100644 --- a/src/xfont.c +++ b/src/xfont.c @@ -594,16 +594,14 @@ xfont_match (Lisp_Object frame, Lisp_Object spec) { if (XGetFontProperty (xfont, XA_FONT, &value)) { - int len; char *s; s = (char *) XGetAtomName (display, (Atom) value); - len = strlen (s); /* If DXPC (a Differential X Protocol Compressor) Ver.3.7 is running, XGetAtomName will return null string. We must avoid such a name. */ - if (len > 0) + if (*s) { entity = font_make_entity (); ASET (entity, FONT_TYPE_INDEX, Qx); @@ -739,7 +737,7 @@ xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) So, we try again with wildcards in RESX and RESY. */ Lisp_Object temp; - temp = Fcopy_font_spec (entity); + temp = copy_font_spec (entity); ASET (temp, FONT_DPI_INDEX, Qnil); len = font_unparse_xlfd (temp, pixel_size, name, 512); if (len <= 0 || (len = xfont_encode_coding_xlfd (name)) < 0) @@ -844,22 +842,25 @@ xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) font->average_width = XINT (val) / 10; if (font->average_width < 0) font->average_width = - font->average_width; - if (font->average_width == 0 - && encoding->ascii_compatible_p) + else { - int width = font->space_width, n = pcm != NULL; + if (font->average_width == 0 + && encoding->ascii_compatible_p) + { + int width = font->space_width, n = pcm != NULL; - for (char2b.byte2 = 33; char2b.byte2 <= 126; char2b.byte2++) - if ((pcm = xfont_get_pcm (xfont, &char2b)) != NULL) - width += pcm->width, n++; - if (n > 0) - font->average_width = width / n; + for (char2b.byte2 = 33; char2b.byte2 <= 126; char2b.byte2++) + if ((pcm = xfont_get_pcm (xfont, &char2b)) != NULL) + width += pcm->width, n++; + if (n > 0) + font->average_width = width / n; + } + if (font->average_width == 0) + /* No easy way other than this to get a reasonable + average_width. */ + font->average_width + = (xfont->min_bounds.width + xfont->max_bounds.width) / 2; } - if (font->average_width == 0) - /* No easy way other than this to get a reasonable - average_width. */ - font->average_width - = (xfont->min_bounds.width + xfont->max_bounds.width) / 2; } BLOCK_INPUT; @@ -966,11 +967,11 @@ xfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct f { XFontStruct *xfont = ((struct xfont_info *) font)->xfont; int width = 0; - int i, first, x; + int i, first; if (metrics) memset (metrics, 0, sizeof (struct font_metrics)); - for (i = 0, x = 0, first = 1; i < nglyphs; i++) + for (i = 0, first = 1; i < nglyphs; i++) { XChar2b char2b; static XCharStruct *pcm;