struct font_info *fontp;
if ((fontset < 0 && (fontset = FRAME_FONTSET (f)) < 0)
- || !(fontp = fs_load_font (f, FRAME_X_FONT_TABLE (f),
+ || !(fontp = FS_LOAD_FONT (f, FRAME_X_FONT_TABLE (f),
charset, NULL, fontset)))
goto font_not_found;
= (font->max_byte1 != 0
? (line_height + font->ascent - font->descent) / 2
: f->output_data.x->font_baseline - fontp->baseline_offset);
+ if (FONT_HEIGHT (font) <= line_height
+ && (font->ascent > baseline
+ || font->descent > line_height - baseline))
+ /* Adjust baseline for this font to show the whole
+ glyphs in a line. */
+ baseline = line_height - font->descent;
+
if (cmpcharp && cmpcharp->cmp_rule == NULL)
{
relative_compose = fontp->relative_compose;
/* The current code at first set foreground to background,
fill the area, then recover the original foreground.
- Aren't there any more smart ways? */
+ Aren't there any smarter ways? */
XGetGCValues (FRAME_X_DISPLAY (f), gc, mask, &xgcv);
XSetForeground (FRAME_X_DISPLAY (f), gc, xgcv.background);
}
#endif
}
- if (!font || require_clipping && !NILP (Vhighlight_wrong_size_font))
+ if (!font)
{
- /* Show rectangles to show that we found no font or a font
- of inappropriate size. */
+ /* Show rectangles to indicate that we found no font. */
+ int limit = cmpcharp ? 1 : len;
- if (cmpcharp)
- XDrawRectangle
- (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
- left, top, run_width - 1, line_height - 1);
- else
- for (i = 0; i < len; i++)
- XDrawRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
- left + glyph_width * i, top,
- glyph_width -1, line_height - 1);
+ for (i = 0; i < limit; i++)
+ XDrawRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
+ left + glyph_width * i, top,
+ glyph_width - 1, line_height - 1);
}
-
+ else if (require_clipping && !NILP (Vhighlight_wrong_size_font))
+ {
+ /* Show ??? to indicate that we found a font of
+ inappropriate size. */
+ int limit = cmpcharp ? 1 : len;
+
+ for (i = 0; i < limit; i++)
+ {
+ XDrawLine (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
+ left + glyph_width * i, top + line_height - 1,
+ left + glyph_width * i + 1, top + line_height - 1);
+ XDrawLine (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
+ left + glyph_width * i, top + line_height - 3,
+ left + glyph_width * i, top + line_height - 1);
+ }
+ }
+
/* We should probably check for XA_UNDERLINE_POSITION and
XA_UNDERLINE_THICKNESS properties on the font, but let's
just get the thing working, and come back to that. */
if (fontset < 0)
return Qnil;
+ if (f->output_data.x->fontset == fontset)
+ /* This fontset is already set in frame F. There's nothing more
+ to do. */
+ return build_string (fontsetname);
+
fontsetp = FRAME_FONTSET_DATA (f)->fontset_table[fontset];
if (!fontsetp->fontname[CHARSET_ASCII])
/* Since x_new_font doesn't update any fontset information, do it now. */
f->output_data.x->fontset = fontset;
- fs_load_font (f, FRAME_X_FONT_TABLE (f),
+ FS_LOAD_FONT (f, FRAME_X_FONT_TABLE (f),
CHARSET_ASCII, XSTRING (result)->data, fontset);
return build_string (fontsetname);
{
Lisp_Object frame;
int count = input_signal_count;
+ /* This must be before UNBLOCK_INPUT
+ since events that arrive in response to the actions above
+ will set it when they are handled. */
+ int previously_visible = f->output_data.x->has_been_visible;
original_left = f->output_data.x->left_pos;
original_top = f->output_data.x->top_pos;
/* Now move the window back to where it was "supposed to be".
But don't do it if the gravity is negative.
When the gravity is negative, this uses a position
- that is 3 pixels too low. Perhaps that's really the border width. */
+ that is 3 pixels too low. Perhaps that's really the border width.
+
+ Don't do this if the window has never been visible before,
+ because the window manager may choose the position
+ and we don't want to override it. */
if (! FRAME_VISIBLE_P (f)
&& f->output_data.x->win_gravity == NorthWestGravity
- && f->output_data.x->has_been_visible)
+ && previously_visible)
{
BLOCK_INPUT;
int size;
int maxnames;
{
- Lisp_Object list, patterns = Qnil, newlist = Qnil, key, tem, second_best;
+ Lisp_Object list, patterns, newlist = Qnil, key, tem, second_best;
Display *dpy = f != NULL ? FRAME_X_DISPLAY (f) : x_display_list->display;
- for (list = Valternative_fontname_alist; CONSP (list);
- list = XCONS (list)->cdr)
- {
- tem = XCONS (list)->car;
- if (CONSP (tem)
- && STRINGP (XCONS (tem)->car)
- && !NILP (Fstring_equal (XCONS (tem)->car, pattern)))
- {
- patterns = XCONS (tem)->cdr;
- break;
- }
- }
+ patterns = Fassoc (pattern, Valternative_fontname_alist);
+ if (NILP (patterns))
+ patterns = Fcons (pattern, Qnil);
- for (patterns = Fcons (pattern, patterns); CONSP (patterns);
- patterns = XCONS (patterns)->cdr, pattern = XCONS (patterns)->car)
+ for (; CONSP (patterns); patterns = XCONS (patterns)->cdr)
{
int num_fonts;
char **names;
+ pattern = XCONS (patterns)->car;
/* See if we cached the result for this particular query. */
if (f && (tem = XCONS (FRAME_X_DISPLAY_INFO (f)->name_list_element)->cdr,
key = Fcons (pattern, make_number (maxnames)),
if (NILP (Fassoc (tem, list)))
{
if (STRINGP (Vx_pixel_size_width_font_regexp)
- && (fast_string_match_ignore_case
- (Vx_pixel_size_width_font_regexp, names[i])
+ && ((fast_c_string_match_ignore_case
+ (Vx_pixel_size_width_font_regexp, names[i]))
>= 0))
/* We can set the value of PIXEL_SIZE to the
width of this font. */
struct font_info *fontp;
unsigned long value;
+ /* If we have found fonts by x_list_font, load one of them. If
+ not, we still try to load a font by the name given as FONTNAME
+ because XListFonts (called in x_list_font) of some X server has
+ a bug of not finding a font even if the font surely exists and
+ is loadable by XLoadQueryFont. */
if (!NILP (font_names))
fontname = (char *) XSTRING (XCONS (font_names)->car)->data;
fontp->size = font->max_bounds.width;
fontp->height = font->ascent + font->descent;
+ if (NILP (font_names))
+ {
+ /* We come here because of a bug of XListFonts mentioned at
+ the head of this block. Let's store this information in
+ the cache for x_list_fonts. */
+ Lisp_Object lispy_name = build_string (fontname);
+ Lisp_Object lispy_full_name = build_string (fontp->full_name);
+
+ XCONS (dpyinfo->name_list_element)->cdr
+ = Fcons (Fcons (Fcons (lispy_name, make_number (256)),
+ Fcons (Fcons (lispy_full_name,
+ make_number (fontp->size)),
+ Qnil)),
+ XCONS (dpyinfo->name_list_element)->cdr);
+ if (full_name)
+ XCONS (dpyinfo->name_list_element)->cdr
+ = Fcons (Fcons (Fcons (lispy_full_name, make_number (256)),
+ Fcons (Fcons (lispy_full_name,
+ make_number (fontp->size)),
+ Qnil)),
+ XCONS (dpyinfo->name_list_element)->cdr);
+ }
+
/* The slot `encoding' specifies how to map a character
code-points (0x20..0x7F or 0x2020..0x7F7F) of each charset to
the font code-points (0:0x20..0x7F, 1:0xA0..0xFF, 0:0x2020..0x7F7F,