aboutsummaryrefslogtreecommitdiffstats
path: root/src/xterm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xterm.c')
-rw-r--r--src/xterm.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/xterm.c b/src/xterm.c
index c1ed1b230e8..5501f563819 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -5076,6 +5076,7 @@ struct font_info
5076{ 5076{
5077 XFontStruct *font; 5077 XFontStruct *font;
5078 char *name; 5078 char *name;
5079 char *full_name;
5079}; 5080};
5080 5081
5081/* A table of all the fonts we have already loaded. */ 5082/* A table of all the fonts we have already loaded. */
@@ -5089,6 +5090,11 @@ static int x_font_table_size;
5089 0 <= n_fonts <= x_font_table_size. */ 5090 0 <= n_fonts <= x_font_table_size. */
5090static int n_fonts; 5091static int n_fonts;
5091 5092
5093/* Give frame F the font named FONTNAME as its default font, and
5094 return the full name of that font. FONTNAME may be a wildcard
5095 pattern; in that case, we choose some font that fits the pattern.
5096 The return value shows which font we chose. */
5097
5092Lisp_Object 5098Lisp_Object
5093x_new_font (f, fontname) 5099x_new_font (f, fontname)
5094 struct frame *f; 5100 struct frame *f;
@@ -5121,10 +5127,11 @@ x_new_font (f, fontname)
5121 5127
5122 for (i = 0; i < n_fonts; i++) 5128 for (i = 0; i < n_fonts; i++)
5123 for (j = 0; j < n_matching_fonts; j++) 5129 for (j = 0; j < n_matching_fonts; j++)
5124 if (!strcmp (x_font_table[i].name, font_names[j])) 5130 if (!strcmp (x_font_table[i].name, font_names[j])
5131 || !strcmp (x_font_table[i].full_name, font_names[j]))
5125 { 5132 {
5126 already_loaded = i; 5133 already_loaded = i;
5127 fontname = font_names[j]; 5134 fontname = x_font_table[i].full_name;
5128 goto found_font; 5135 goto found_font;
5129 } 5136 }
5130 } 5137 }
@@ -5138,6 +5145,7 @@ x_new_font (f, fontname)
5138 else 5145 else
5139 { 5146 {
5140 int i; 5147 int i;
5148 char *full_name;
5141 XFontStruct *font; 5149 XFontStruct *font;
5142 5150
5143 /* Try to find a character-cell font in the list. */ 5151 /* Try to find a character-cell font in the list. */
@@ -5181,9 +5189,27 @@ x_new_font (f, fontname)
5181 * sizeof (x_font_table[0]))); 5189 * sizeof (x_font_table[0])));
5182 } 5190 }
5183 5191
5192 /* Try to get the full name of FONT. Put it in full_name. */
5193 full_name = 0;
5194 for (i = 0; i < font->n_properties; i++)
5195 {
5196 char *atom
5197 = XGetAtomName (x_current_display, font->properties[i].name);
5198 if (!strcmp (atom, "FONT"))
5199 full_name = XGetAtomName (x_current_display,
5200 (Atom) (font->properties[i].card32));
5201 XFree (atom);
5202 }
5203
5184 x_font_table[n_fonts].name = (char *) xmalloc (strlen (fontname) + 1); 5204 x_font_table[n_fonts].name = (char *) xmalloc (strlen (fontname) + 1);
5185 bcopy (fontname, x_font_table[n_fonts].name, strlen (fontname) + 1); 5205 bcopy (fontname, x_font_table[n_fonts].name, strlen (fontname) + 1);
5206 if (full_name != 0)
5207 x_font_table[n_fonts].full_name = full_name;
5208 else
5209 x_font_table[n_fonts].full_name = x_font_table[n_fonts].name;
5186 f->display.x->font = x_font_table[n_fonts++].font = font; 5210 f->display.x->font = x_font_table[n_fonts++].font = font;
5211
5212 fontname = full_name;
5187 } 5213 }
5188 5214
5189 /* Now make the frame display the given font. */ 5215 /* Now make the frame display the given font. */