diff options
| author | Kenichi Handa | 2008-06-19 00:43:34 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2008-06-19 00:43:34 +0000 |
| commit | d26424c5eb84c4bd153a375052fdc96223e0c46e (patch) | |
| tree | d71ffe8aa73cd92f7636daff06a3d0697d91f390 /src | |
| parent | 4ffe34a4ed2058c93a01c5a176eb0971c61eaa4c (diff) | |
| download | emacs-d26424c5eb84c4bd153a375052fdc96223e0c46e.tar.gz emacs-d26424c5eb84c4bd153a375052fdc96223e0c46e.zip | |
(font_parse_xlfd): Fix previous change.
(font_parse_fcname): Don't use :fc-unknown-spec.
(FRAME_X_DISPLAY_INFO): Besure to have at least 1 pixel height.
(Fcopy_font_spec): Preserve the order of elements in FONT_EXTRA.
(font_add_log): Prepend the driver name to the resulting fonts.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 18 | ||||
| -rw-r--r-- | src/font.c | 77 |
2 files changed, 50 insertions, 45 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 9f65fbe91b9..60cff399cd7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,21 @@ | |||
| 1 | 2008-06-18 Kenichi Handa <handa@m17n.org> | ||
| 2 | |||
| 3 | * font.c (font_parse_xlfd): Fix previous change. | ||
| 4 | (font_parse_fcname): Don't use :fc-unknown-spec. | ||
| 5 | (FRAME_X_DISPLAY_INFO): Besure to have at least 1 pixel height. | ||
| 6 | (Fcopy_font_spec): Preserve the order of elements in FONT_EXTRA. | ||
| 7 | (font_add_log): Prepend the driver name to the resulting fonts. | ||
| 8 | |||
| 9 | * ftfont.c (ftfont_pattern_entity): New arg extra. Caller changed. | ||
| 10 | (ftfont_spec_pattern): Don't check QCfc_unknown_spec and QCname. | ||
| 11 | (ftfont_list) [FC_FONTFORMAT]: Include FC_FONTFORMAT in objset. | ||
| 12 | |||
| 13 | * xftfont.c (QChinting , QCautohint, QChintstyle, QCrgba) | ||
| 14 | (QCembolden): New variables. | ||
| 15 | (syms_of_xftfont): DEFSYM them. | ||
| 16 | (xftfont_open): Call XftFontMatch. Don't trust the result of | ||
| 17 | XftTextExtents8 if the pixel_size is less than 5. | ||
| 18 | |||
| 1 | 2008-06-18 Andreas Schwab <schwab@suse.de> | 19 | 2008-06-18 Andreas Schwab <schwab@suse.de> |
| 2 | 20 | ||
| 3 | * font.c (Ffont_face_attributes): Only define if | 21 | * font.c (Ffont_face_attributes): Only define if |
diff --git a/src/font.c b/src/font.c index ab413f277f2..d49a19acac0 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -1109,7 +1109,7 @@ font_parse_xlfd (name, font) | |||
| 1109 | if (*p == '~') | 1109 | if (*p == '~') |
| 1110 | p++; | 1110 | p++; |
| 1111 | ASET (font, FONT_AVGWIDTH_INDEX, | 1111 | ASET (font, FONT_AVGWIDTH_INDEX, |
| 1112 | font_intern_prop (p, f[XLFD_REGISTRY_INDEX] - 1 - p, 1)); | 1112 | font_intern_prop (p, f[XLFD_REGISTRY_INDEX] - 1 - p, 0)); |
| 1113 | } | 1113 | } |
| 1114 | else | 1114 | else |
| 1115 | { | 1115 | { |
| @@ -1403,16 +1403,9 @@ font_parse_fcname (name, font) | |||
| 1403 | } | 1403 | } |
| 1404 | if (props_beg) | 1404 | if (props_beg) |
| 1405 | { | 1405 | { |
| 1406 | /* Now parse ":KEY=VAL" patterns. Store known keys and values in | 1406 | /* Now parse ":KEY=VAL" patterns. */ |
| 1407 | extra, copy unknown ones to COPY. It is stored in extra slot by | ||
| 1408 | the key QCfc_unknown_spec. */ | ||
| 1409 | char *copy_start, *copy; | ||
| 1410 | Lisp_Object val; | 1407 | Lisp_Object val; |
| 1411 | 1408 | ||
| 1412 | copy_start = copy = alloca (name + len - props_beg + 2); | ||
| 1413 | if (! copy) | ||
| 1414 | return -1; | ||
| 1415 | |||
| 1416 | for (p = props_beg; *p; p = q) | 1409 | for (p = props_beg; *p; p = q) |
| 1417 | { | 1410 | { |
| 1418 | for (q = p + 1; *q && *q != '=' && *q != ':'; q++); | 1411 | for (q = p + 1; *q && *q != '=' && *q != ':'; q++); |
| @@ -1445,13 +1438,6 @@ font_parse_fcname (name, font) | |||
| 1445 | else if (PROP_MATCH ("proportional", 12)) | 1438 | else if (PROP_MATCH ("proportional", 12)) |
| 1446 | ASET (font, FONT_SPACING_INDEX, | 1439 | ASET (font, FONT_SPACING_INDEX, |
| 1447 | make_number (FONT_SPACING_PROPORTIONAL)); | 1440 | make_number (FONT_SPACING_PROPORTIONAL)); |
| 1448 | else | ||
| 1449 | { | ||
| 1450 | /* Unknown key */ | ||
| 1451 | *copy++ = ':'; | ||
| 1452 | bcopy (p, copy, word_len); | ||
| 1453 | copy += word_len; | ||
| 1454 | } | ||
| 1455 | #undef PROP_MATCH | 1441 | #undef PROP_MATCH |
| 1456 | } | 1442 | } |
| 1457 | else | 1443 | else |
| @@ -1473,25 +1459,14 @@ font_parse_fcname (name, font) | |||
| 1473 | for (q = p; *q && *q != ':'; q++); | 1459 | for (q = p; *q && *q != ':'; q++); |
| 1474 | val = font_intern_prop (p, q - p, 0); | 1460 | val = font_intern_prop (p, q - p, 0); |
| 1475 | 1461 | ||
| 1476 | if (! NILP (val)) | 1462 | if (prop >= FONT_FOUNDRY_INDEX |
| 1477 | { | 1463 | && prop < FONT_EXTRA_INDEX) |
| 1478 | if (prop >= FONT_FOUNDRY_INDEX | 1464 | ASET (font, prop, font_prop_validate (prop, Qnil, val)); |
| 1479 | && prop < FONT_EXTRA_INDEX) | 1465 | else |
| 1480 | ASET (font, prop, | 1466 | Ffont_put (font, key, val); |
| 1481 | font_prop_validate (prop, Qnil, val)); | ||
| 1482 | else if (prop >= 0) | ||
| 1483 | Ffont_put (font, key, val); | ||
| 1484 | else | ||
| 1485 | { | ||
| 1486 | bcopy (keyhead, copy, q - keyhead); | ||
| 1487 | copy += q - keyhead; | ||
| 1488 | } | ||
| 1489 | } | ||
| 1490 | } | 1467 | } |
| 1468 | p = q; | ||
| 1491 | } | 1469 | } |
| 1492 | if (copy_start != copy) | ||
| 1493 | font_put_extra (font, QCfc_unknown_spec, | ||
| 1494 | make_unibyte_string (copy_start, copy - copy_start)); | ||
| 1495 | } | 1470 | } |
| 1496 | } | 1471 | } |
| 1497 | else | 1472 | else |
| @@ -2722,7 +2697,7 @@ font_open_entity (f, entity, pixel_size) | |||
| 2722 | struct font_driver_list *driver_list; | 2697 | struct font_driver_list *driver_list; |
| 2723 | Lisp_Object objlist, size, val, font_object; | 2698 | Lisp_Object objlist, size, val, font_object; |
| 2724 | struct font *font; | 2699 | struct font *font; |
| 2725 | int min_width; | 2700 | int min_width, height; |
| 2726 | 2701 | ||
| 2727 | font_assert (FONT_ENTITY_P (entity)); | 2702 | font_assert (FONT_ENTITY_P (entity)); |
| 2728 | size = AREF (entity, FONT_SIZE_INDEX); | 2703 | size = AREF (entity, FONT_SIZE_INDEX); |
| @@ -2756,20 +2731,21 @@ font_open_entity (f, entity, pixel_size) | |||
| 2756 | : font->average_width ? font->average_width | 2731 | : font->average_width ? font->average_width |
| 2757 | : font->space_width ? font->space_width | 2732 | : font->space_width ? font->space_width |
| 2758 | : 1); | 2733 | : 1); |
| 2734 | height = (font->height ? font->height : 1); | ||
| 2759 | #ifdef HAVE_WINDOW_SYSTEM | 2735 | #ifdef HAVE_WINDOW_SYSTEM |
| 2760 | FRAME_X_DISPLAY_INFO (f)->n_fonts++; | 2736 | FRAME_X_DISPLAY_INFO (f)->n_fonts++; |
| 2761 | if (FRAME_X_DISPLAY_INFO (f)->n_fonts == 1) | 2737 | if (FRAME_X_DISPLAY_INFO (f)->n_fonts == 1) |
| 2762 | { | 2738 | { |
| 2763 | FRAME_SMALLEST_CHAR_WIDTH (f) = min_width; | 2739 | FRAME_SMALLEST_CHAR_WIDTH (f) = min_width; |
| 2764 | FRAME_SMALLEST_FONT_HEIGHT (f) = font->height; | 2740 | FRAME_SMALLEST_FONT_HEIGHT (f) = height; |
| 2765 | fonts_changed_p = 1; | 2741 | fonts_changed_p = 1; |
| 2766 | } | 2742 | } |
| 2767 | else | 2743 | else |
| 2768 | { | 2744 | { |
| 2769 | if (FRAME_SMALLEST_CHAR_WIDTH (f) > min_width) | 2745 | if (FRAME_SMALLEST_CHAR_WIDTH (f) > min_width) |
| 2770 | FRAME_SMALLEST_CHAR_WIDTH (f) = min_width, fonts_changed_p = 1; | 2746 | FRAME_SMALLEST_CHAR_WIDTH (f) = min_width, fonts_changed_p = 1; |
| 2771 | if (FRAME_SMALLEST_FONT_HEIGHT (f) > font->height) | 2747 | if (FRAME_SMALLEST_FONT_HEIGHT (f) > height) |
| 2772 | FRAME_SMALLEST_FONT_HEIGHT (f) = font->height, fonts_changed_p = 1; | 2748 | FRAME_SMALLEST_FONT_HEIGHT (f) = height, fonts_changed_p = 1; |
| 2773 | } | 2749 | } |
| 2774 | #endif | 2750 | #endif |
| 2775 | 2751 | ||
| @@ -3676,19 +3652,24 @@ DEFUN ("copy-font-spec", Fcopy_font_spec, Scopy_font_spec, 1, 1, 0, | |||
| 3676 | (font) | 3652 | (font) |
| 3677 | Lisp_Object font; | 3653 | Lisp_Object font; |
| 3678 | { | 3654 | { |
| 3679 | Lisp_Object new_spec, tail, extra; | 3655 | Lisp_Object new_spec, tail, prev, extra; |
| 3680 | int i; | 3656 | int i; |
| 3681 | 3657 | ||
| 3682 | CHECK_FONT (font); | 3658 | CHECK_FONT (font); |
| 3683 | new_spec = font_make_spec (); | 3659 | new_spec = font_make_spec (); |
| 3684 | for (i = 1; i < FONT_EXTRA_INDEX; i++) | 3660 | for (i = 1; i < FONT_EXTRA_INDEX; i++) |
| 3685 | ASET (new_spec, i, AREF (font, i)); | 3661 | ASET (new_spec, i, AREF (font, i)); |
| 3686 | extra = Qnil; | 3662 | extra = Fcopy_sequence (AREF (font, FONT_EXTRA_INDEX)); |
| 3687 | for (tail = AREF (font, FONT_EXTRA_INDEX); CONSP (tail); tail = XCDR (tail)) | 3663 | /* We must remove :font-entity property. */ |
| 3688 | { | 3664 | for (prev = Qnil, tail = extra; CONSP (tail); prev = tail, tail = XCDR (tail)) |
| 3689 | if (! EQ (XCAR (XCAR (tail)), QCfont_entity)) | 3665 | if (EQ (XCAR (XCAR (tail)), QCfont_entity)) |
| 3690 | extra = Fcons (Fcons (XCAR (XCAR (tail)), XCDR (XCAR (tail))), extra); | 3666 | { |
| 3691 | } | 3667 | if (NILP (prev)) |
| 3668 | extra = XCDR (extra); | ||
| 3669 | else | ||
| 3670 | XSETCDR (prev, XCDR (tail)); | ||
| 3671 | break; | ||
| 3672 | } | ||
| 3692 | ASET (new_spec, FONT_EXTRA_INDEX, extra); | 3673 | ASET (new_spec, FONT_EXTRA_INDEX, extra); |
| 3693 | return new_spec; | 3674 | return new_spec; |
| 3694 | } | 3675 | } |
| @@ -4759,7 +4740,13 @@ font_add_log (action, arg, result) | |||
| 4759 | if (FONTP (arg)) | 4740 | if (FONTP (arg)) |
| 4760 | arg = Ffont_xlfd_name (arg, Qt); | 4741 | arg = Ffont_xlfd_name (arg, Qt); |
| 4761 | if (FONTP (result)) | 4742 | if (FONTP (result)) |
| 4762 | result = Ffont_xlfd_name (result, Qt); | 4743 | { |
| 4744 | val = Ffont_xlfd_name (result, Qt); | ||
| 4745 | if (! FONT_SPEC_P (result)) | ||
| 4746 | val = concat3 (SYMBOL_NAME (AREF (result, FONT_TYPE_INDEX)), | ||
| 4747 | build_string (":"), val); | ||
| 4748 | result = val; | ||
| 4749 | } | ||
| 4763 | else if (CONSP (result)) | 4750 | else if (CONSP (result)) |
| 4764 | { | 4751 | { |
| 4765 | result = Fcopy_sequence (result); | 4752 | result = Fcopy_sequence (result); |