diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/font.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/font.c b/src/font.c index 564c53ae54e..575975ced73 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -3337,6 +3337,38 @@ font_load_for_lface (struct frame *f, Lisp_Object *attrs, Lisp_Object spec) | |||
| 3337 | /* No font is listed for SPEC, but each font-backend may have | 3337 | /* No font is listed for SPEC, but each font-backend may have |
| 3338 | different criteria about "font matching". So, try it. */ | 3338 | different criteria about "font matching". So, try it. */ |
| 3339 | entity = font_matching_entity (f, attrs, spec); | 3339 | entity = font_matching_entity (f, attrs, spec); |
| 3340 | /* Perhaps the user asked for a font "Foobar-123", and we | ||
| 3341 | interpreted "-123" as the size, whereas it really is part of | ||
| 3342 | the name. So we reset the size to nil and the family name to | ||
| 3343 | the entire "Foobar-123" thing, and try again with that. */ | ||
| 3344 | if (NILP (entity)) | ||
| 3345 | { | ||
| 3346 | name = Ffont_get (spec, QCuser_spec); | ||
| 3347 | if (STRINGP (name)) | ||
| 3348 | { | ||
| 3349 | char *p = SDATA (name), *q = strrchr (p, '-'); | ||
| 3350 | |||
| 3351 | if (q != NULL && c_isdigit (q[1])) | ||
| 3352 | { | ||
| 3353 | char *tail; | ||
| 3354 | double font_size = strtod (q + 1, &tail); | ||
| 3355 | |||
| 3356 | if (font_size > 0 && tail != q + 1) | ||
| 3357 | { | ||
| 3358 | Lisp_Object lsize = Ffont_get (spec, QCsize); | ||
| 3359 | |||
| 3360 | if ((FLOATP (lsize) && XFLOAT_DATA (lsize) == font_size) | ||
| 3361 | || (INTEGERP (lsize) && XINT (lsize) == font_size)) | ||
| 3362 | { | ||
| 3363 | ASET (spec, FONT_FAMILY_INDEX, | ||
| 3364 | font_intern_prop (p, tail - p, 1)); | ||
| 3365 | ASET (spec, FONT_SIZE_INDEX, Qnil); | ||
| 3366 | entity = font_matching_entity (f, attrs, spec); | ||
| 3367 | } | ||
| 3368 | } | ||
| 3369 | } | ||
| 3370 | } | ||
| 3371 | } | ||
| 3340 | if (NILP (entity)) | 3372 | if (NILP (entity)) |
| 3341 | return Qnil; | 3373 | return Qnil; |
| 3342 | } | 3374 | } |