Mercurial > emacs
comparison src/font.c @ 96049:380525b11593
(font_parse_fcname): For known key symbols, intern using correct
symbol name.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Tue, 17 Jun 2008 16:04:47 +0000 |
parents | 2a8c4f357ec4 |
children | 4af4f5a1eb34 |
comparison
equal
deleted
inserted
replaced
96048:62044a08f171 | 96049:380525b11593 |
---|---|
1357 { | 1357 { |
1358 if (*p == '\\' && p[1]) | 1358 if (*p == '\\' && p[1]) |
1359 p++; | 1359 p++; |
1360 else if (*p == ':') | 1360 else if (*p == ':') |
1361 { | 1361 { |
1362 family_end = p; | 1362 props_beg = family_end = p; |
1363 props_beg = p + 1; | |
1364 break; | 1363 break; |
1365 } | 1364 } |
1366 else if (*p == '-') | 1365 else if (*p == '-') |
1367 { | 1366 { |
1368 int decimal = 0, size_found = 1; | 1367 int decimal = 0, size_found = 1; |
1398 if (size_beg) | 1397 if (size_beg) |
1399 { | 1398 { |
1400 double point_size = strtod (size_beg, &size_end); | 1399 double point_size = strtod (size_beg, &size_end); |
1401 ASET (font, FONT_SIZE_INDEX, make_float (point_size)); | 1400 ASET (font, FONT_SIZE_INDEX, make_float (point_size)); |
1402 if (*size_end == ':' && size_end[1]) | 1401 if (*size_end == ':' && size_end[1]) |
1403 props_beg = size_end + 1; | 1402 props_beg = size_end; |
1404 } | 1403 } |
1405 if (props_beg) | 1404 if (props_beg) |
1406 { | 1405 { |
1407 /* Now parse ":KEY=VAL" patterns. Store known keys and values in | 1406 /* Now parse ":KEY=VAL" patterns. Store known keys and values in |
1408 extra, copy unknown ones to COPY. It is stored in extra slot by | 1407 extra, copy unknown ones to COPY. It is stored in extra slot by |
1409 the key QCfc_unknown_spec. */ | 1408 the key QCfc_unknown_spec. */ |
1410 char *copy_start, *copy; | 1409 char *copy_start, *copy; |
1410 Lisp_Object val; | |
1411 | 1411 |
1412 copy_start = copy = alloca (name + len - props_beg + 2); | 1412 copy_start = copy = alloca (name + len - props_beg + 2); |
1413 if (! copy) | 1413 if (! copy) |
1414 return -1; | 1414 return -1; |
1415 | 1415 |
1416 p = props_beg; | 1416 for (p = props_beg; *p; p = q) |
1417 while (*p) | |
1418 { | 1417 { |
1419 Lisp_Object val; | |
1420 int word_len, prop; | |
1421 | |
1422 for (q = p + 1; *q && *q != '=' && *q != ':'; q++); | 1418 for (q = p + 1; *q && *q != '=' && *q != ':'; q++); |
1423 word_len = q - p; | |
1424 if (*q != '=') | 1419 if (*q != '=') |
1425 { | 1420 { |
1426 /* Must be an enumerated value. */ | 1421 /* Must be an enumerated value. */ |
1422 int word_len; | |
1423 p = p + 1; | |
1424 word_len = q - p; | |
1427 val = font_intern_prop (p, q - p, 1); | 1425 val = font_intern_prop (p, q - p, 1); |
1428 | 1426 |
1429 #define PROP_MATCH(STR,N) ((word_len == N) && memcmp (p, STR, N) == 0) | 1427 #define PROP_MATCH(STR,N) ((word_len == N) && memcmp (p, STR, N) == 0) |
1430 | 1428 |
1431 if (PROP_MATCH ("light", 5) | 1429 if (PROP_MATCH ("light", 5) |
1454 bcopy (p, copy, word_len); | 1452 bcopy (p, copy, word_len); |
1455 copy += word_len; | 1453 copy += word_len; |
1456 } | 1454 } |
1457 #undef PROP_MATCH | 1455 #undef PROP_MATCH |
1458 } | 1456 } |
1459 else /* KEY=VAL pairs */ | 1457 else |
1460 { | 1458 { |
1459 /* KEY=VAL pairs */ | |
1461 Lisp_Object key; | 1460 Lisp_Object key; |
1462 char *keyhead = p; | 1461 char *keyhead = p; |
1463 | 1462 int prop; |
1464 if (word_len == 9 && memcmp (p, "pixelsize=", 10) == 0) | 1463 |
1464 if (q - p == 10 && memcmp (p + 1, "pixelsize", 9) == 0) | |
1465 prop = FONT_SIZE_INDEX; | 1465 prop = FONT_SIZE_INDEX; |
1466 else | 1466 else |
1467 { | 1467 { |
1468 key = font_intern_prop (p, q - p, 1); | 1468 key = font_intern_prop (p, q - p, 1); |
1469 prop = get_font_prop_index (key); | 1469 prop = get_font_prop_index (key); |
1481 font_prop_validate (prop, Qnil, val)); | 1481 font_prop_validate (prop, Qnil, val)); |
1482 else if (prop >= 0) | 1482 else if (prop >= 0) |
1483 Ffont_put (font, key, val); | 1483 Ffont_put (font, key, val); |
1484 else | 1484 else |
1485 { | 1485 { |
1486 *copy++ = ':'; | |
1487 bcopy (keyhead, copy, q - keyhead); | 1486 bcopy (keyhead, copy, q - keyhead); |
1488 copy += q - keyhead; | 1487 copy += q - keyhead; |
1489 } | 1488 } |
1490 } | 1489 } |
1491 } | 1490 } |
1492 p = *q ? q + 1 : q; | |
1493 } | 1491 } |
1494 if (copy_start != copy) | 1492 if (copy_start != copy) |
1495 font_put_extra (font, QCfc_unknown_spec, | 1493 font_put_extra (font, QCfc_unknown_spec, |
1496 make_unibyte_string (copy_start, copy - copy_start)); | 1494 make_unibyte_string (copy_start, copy - copy_start)); |
1497 } | 1495 } |