diff options
| author | Steven Tamm | 2004-08-04 06:04:39 +0000 |
|---|---|---|
| committer | Steven Tamm | 2004-08-04 06:04:39 +0000 |
| commit | cc02ceeea1c29881f88c715e6bfa6e80d7bfb2be (patch) | |
| tree | 2ea01f5b8d0f27f3375acdecb04d1c0ffe296a11 /src | |
| parent | 66cecdb8bb957ab93b7ece7f22edb5ff04ab19d2 (diff) | |
| download | emacs-cc02ceeea1c29881f88c715e6bfa6e80d7bfb2be.tar.gz emacs-cc02ceeea1c29881f88c715e6bfa6e80d7bfb2be.zip | |
macterm.c (mac_encode_char): Add charset argument and update
to use encoding_type
(x_new_font,x_new_fontset): Merge in changes from xterm.c;
switch to pure fontset
(decode_mac_font_name): Temporarily remove decoding
(x_font_name_to_mac_font_name): Temporarily remove encoding
(x_load_font): Temporarily remove encoding
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog.22 | 10 | ||||
| -rw-r--r-- | src/macterm.c | 74 |
2 files changed, 60 insertions, 24 deletions
diff --git a/src/ChangeLog.22 b/src/ChangeLog.22 index 4b5fed13b07..ff218c86911 100644 --- a/src/ChangeLog.22 +++ b/src/ChangeLog.22 | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2004-08-03 Steven Tamm <steventamm@mac.com> | ||
| 2 | |||
| 3 | * macterm.c (mac_encode_char): Add charset argument and update | ||
| 4 | to use encoding_type | ||
| 5 | (x_new_font,x_new_fontset): Merge in changes from xterm.c; | ||
| 6 | switch to pure fontset | ||
| 7 | (decode_mac_font_name): Temporarily remove decoding | ||
| 8 | (x_font_name_to_mac_font_name): Temporarily remove encoding | ||
| 9 | (x_load_font): Temporarily remove encoding | ||
| 10 | |||
| 1 | 2004-06-30 Kenichi Handa <handa@m17n.org> | 11 | 2004-06-30 Kenichi Handa <handa@m17n.org> |
| 2 | 12 | ||
| 3 | * xfaces.c (Fface_font): If frame is not on a window system, | 13 | * xfaces.c (Fface_font): If frame is not on a window system, |
diff --git a/src/macterm.c b/src/macterm.c index d9655dab3c3..297683f6d9b 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -82,7 +82,9 @@ Boston, MA 02111-1307, USA. */ | |||
| 82 | #include "window.h" | 82 | #include "window.h" |
| 83 | #include "intervals.h" | 83 | #include "intervals.h" |
| 84 | #include "composite.h" | 84 | #include "composite.h" |
| 85 | #include "character.h" | ||
| 85 | #include "coding.h" | 86 | #include "coding.h" |
| 87 | #include "ccl.h" | ||
| 86 | 88 | ||
| 87 | /* Set of macros that handle mapping of Mac modifier keys to emacs. */ | 89 | /* Set of macros that handle mapping of Mac modifier keys to emacs. */ |
| 88 | #define macCtrlKey (NILP (Vmac_reverse_ctrl_meta) ? controlKey : \ | 90 | #define macCtrlKey (NILP (Vmac_reverse_ctrl_meta) ? controlKey : \ |
| @@ -1527,7 +1529,8 @@ XTreset_terminal_modes () | |||
| 1527 | /* Function prototypes of this page. */ | 1529 | /* Function prototypes of this page. */ |
| 1528 | 1530 | ||
| 1529 | static XCharStruct *x_per_char_metric P_ ((XFontStruct *, XChar2b *)); | 1531 | static XCharStruct *x_per_char_metric P_ ((XFontStruct *, XChar2b *)); |
| 1530 | static int mac_encode_char P_ ((int, XChar2b *, struct font_info *, int *)); | 1532 | static int mac_encode_char P_ ((int, XChar2b *, struct font_info *, |
| 1533 | struct charset *, int *)); | ||
| 1531 | 1534 | ||
| 1532 | 1535 | ||
| 1533 | /* Return a pointer to per-char metric information in FONT of a | 1536 | /* Return a pointer to per-char metric information in FONT of a |
| @@ -1630,13 +1633,13 @@ mac_per_char_metric (font, char2b, font_type) | |||
| 1630 | the two-byte form of C. Encoding is returned in *CHAR2B. */ | 1633 | the two-byte form of C. Encoding is returned in *CHAR2B. */ |
| 1631 | 1634 | ||
| 1632 | static int | 1635 | static int |
| 1633 | mac_encode_char (c, char2b, font_info, two_byte_p) | 1636 | mac_encode_char (c, char2b, font_info, charset, two_byte_p) |
| 1634 | int c; | 1637 | int c; |
| 1635 | XChar2b *char2b; | 1638 | XChar2b *char2b; |
| 1636 | struct font_info *font_info; | 1639 | struct font_info *font_info; |
| 1640 | struct charset *charset; | ||
| 1637 | int *two_byte_p; | 1641 | int *two_byte_p; |
| 1638 | { | 1642 | { |
| 1639 | int charset = CHAR_CHARSET (c); | ||
| 1640 | XFontStruct *font = font_info->font; | 1643 | XFontStruct *font = font_info->font; |
| 1641 | 1644 | ||
| 1642 | /* FONT_INFO may define a scheme by which to encode byte1 and byte2. | 1645 | /* FONT_INFO may define a scheme by which to encode byte1 and byte2. |
| @@ -1649,14 +1652,15 @@ mac_encode_char (c, char2b, font_info, two_byte_p) | |||
| 1649 | 1652 | ||
| 1650 | if (CHARSET_DIMENSION (charset) == 1) | 1653 | if (CHARSET_DIMENSION (charset) == 1) |
| 1651 | { | 1654 | { |
| 1652 | ccl->reg[0] = charset; | 1655 | ccl->reg[0] = CHARSET_ID (charset); |
| 1653 | ccl->reg[1] = char2b->byte2; | 1656 | ccl->reg[1] = XCHAR2B_BYTE2 (char2b); |
| 1657 | ccl->reg[2] = -1; | ||
| 1654 | } | 1658 | } |
| 1655 | else | 1659 | else |
| 1656 | { | 1660 | { |
| 1657 | ccl->reg[0] = charset; | 1661 | ccl->reg[0] = CHARSET_ID (charset); |
| 1658 | ccl->reg[1] = char2b->byte1; | 1662 | ccl->reg[1] = XCHAR2B_BYTE1 (char2b); |
| 1659 | ccl->reg[2] = char2b->byte2; | 1663 | ccl->reg[2] = XCHAR2B_BYTE2 (char2b); |
| 1660 | } | 1664 | } |
| 1661 | 1665 | ||
| 1662 | ccl_driver (ccl, NULL, NULL, 0, 0, NULL); | 1666 | ccl_driver (ccl, NULL, NULL, 0, 0, NULL); |
| @@ -1664,15 +1668,15 @@ mac_encode_char (c, char2b, font_info, two_byte_p) | |||
| 1664 | /* We assume that MSBs are appropriately set/reset by CCL | 1668 | /* We assume that MSBs are appropriately set/reset by CCL |
| 1665 | program. */ | 1669 | program. */ |
| 1666 | if (font->max_byte1 == 0) /* 1-byte font */ | 1670 | if (font->max_byte1 == 0) /* 1-byte font */ |
| 1667 | char2b->byte1 = 0, char2b->byte2 = ccl->reg[1]; | 1671 | STORE_XCHAR2B (char2b, 0, ccl->reg[1]); |
| 1668 | else | 1672 | else |
| 1669 | char2b->byte1 = ccl->reg[1], char2b->byte2 = ccl->reg[2]; | 1673 | STORE_XCHAR2B (char2b, ccl->reg[1], ccl->reg[2]); |
| 1670 | } | 1674 | } |
| 1671 | else if (font_info->encoding[charset]) | 1675 | else if (font_info->encoding_type) |
| 1672 | { | 1676 | { |
| 1673 | /* Fixed encoding scheme. See fontset.h for the meaning of the | 1677 | /* Fixed encoding scheme. See fontset.h for the meaning of the |
| 1674 | encoding numbers. */ | 1678 | encoding numbers. */ |
| 1675 | int enc = font_info->encoding[charset]; | 1679 | unsigned char enc = font_info->encoding_type; |
| 1676 | 1680 | ||
| 1677 | if ((enc == 1 || enc == 2) | 1681 | if ((enc == 1 || enc == 2) |
| 1678 | && CHARSET_DIMENSION (charset) == 2) | 1682 | && CHARSET_DIMENSION (charset) == 2) |
| @@ -1681,6 +1685,7 @@ mac_encode_char (c, char2b, font_info, two_byte_p) | |||
| 1681 | if (enc == 1 || enc == 3) | 1685 | if (enc == 1 || enc == 3) |
| 1682 | char2b->byte2 |= 0x80; | 1686 | char2b->byte2 |= 0x80; |
| 1683 | 1687 | ||
| 1688 | /* | ||
| 1684 | if (enc == 4) | 1689 | if (enc == 4) |
| 1685 | { | 1690 | { |
| 1686 | int sjis1, sjis2; | 1691 | int sjis1, sjis2; |
| @@ -1689,6 +1694,7 @@ mac_encode_char (c, char2b, font_info, two_byte_p) | |||
| 1689 | char2b->byte1 = sjis1; | 1694 | char2b->byte1 = sjis1; |
| 1690 | char2b->byte2 = sjis2; | 1695 | char2b->byte2 = sjis2; |
| 1691 | } | 1696 | } |
| 1697 | */ | ||
| 1692 | } | 1698 | } |
| 1693 | 1699 | ||
| 1694 | if (two_byte_p) | 1700 | if (two_byte_p) |
| @@ -4943,11 +4949,16 @@ x_new_font (f, fontname) | |||
| 4943 | register char *fontname; | 4949 | register char *fontname; |
| 4944 | { | 4950 | { |
| 4945 | struct font_info *fontp | 4951 | struct font_info *fontp |
| 4946 | = FS_LOAD_FONT (f, 0, fontname, -1); | 4952 | = FS_LOAD_FONT (f, fontname); |
| 4947 | 4953 | ||
| 4948 | if (!fontp) | 4954 | if (!fontp) |
| 4949 | return Qnil; | 4955 | return Qnil; |
| 4950 | 4956 | ||
| 4957 | if (FRAME_FONT (f) == (XFontStruct *) (fontp->font)) | ||
| 4958 | /* This font is already set in frame F. There's nothing more to | ||
| 4959 | do. */ | ||
| 4960 | return build_string (fontp->full_name); | ||
| 4961 | |||
| 4951 | FRAME_FONT (f) = (XFontStruct *) (fontp->font); | 4962 | FRAME_FONT (f) = (XFontStruct *) (fontp->font); |
| 4952 | FRAME_BASELINE_OFFSET (f) = fontp->baseline_offset; | 4963 | FRAME_BASELINE_OFFSET (f) = fontp->baseline_offset; |
| 4953 | FRAME_FONTSET (f) = -1; | 4964 | FRAME_FONTSET (f) = -1; |
| @@ -4995,29 +5006,35 @@ x_new_font (f, fontname) | |||
| 4995 | Lisp_Object | 5006 | Lisp_Object |
| 4996 | x_new_fontset (f, fontsetname) | 5007 | x_new_fontset (f, fontsetname) |
| 4997 | struct frame *f; | 5008 | struct frame *f; |
| 4998 | char *fontsetname; | 5009 | Lisp_Object fontsetname; |
| 4999 | { | 5010 | { |
| 5000 | int fontset = fs_query_fontset (build_string (fontsetname), 0); | 5011 | int fontset = fs_query_fontset (fontsetname, 0); |
| 5001 | Lisp_Object result; | 5012 | Lisp_Object result; |
| 5002 | 5013 | ||
| 5003 | if (fontset < 0) | 5014 | if (fontset > 0 && FRAME_FONTSET(f) == fontset) |
| 5004 | return Qnil; | ||
| 5005 | |||
| 5006 | if (FRAME_FONTSET (f) == fontset) | ||
| 5007 | /* This fontset is already set in frame F. There's nothing more | 5015 | /* This fontset is already set in frame F. There's nothing more |
| 5008 | to do. */ | 5016 | to do. */ |
| 5009 | return fontset_name (fontset); | 5017 | return fontset_name (fontset); |
| 5018 | else if (fontset == 0) | ||
| 5019 | /* The default fontset can't be the default font. */ | ||
| 5020 | return Qt; | ||
| 5010 | 5021 | ||
| 5011 | result = x_new_font (f, (SDATA (fontset_ascii (fontset)))); | 5022 | if (fontset > 0) |
| 5023 | result = x_new_font (f, (SDATA (fontset_ascii (fontset)))); | ||
| 5024 | else | ||
| 5025 | result = x_new_font (f, SDATA (fontsetname)); | ||
| 5012 | 5026 | ||
| 5013 | if (!STRINGP (result)) | 5027 | if (!STRINGP (result)) |
| 5014 | /* Can't load ASCII font. */ | 5028 | /* Can't load ASCII font. */ |
| 5015 | return Qnil; | 5029 | return Qnil; |
| 5016 | 5030 | ||
| 5031 | if (fontset < 0) | ||
| 5032 | fontset = new_fontset_from_font_name (result); | ||
| 5033 | |||
| 5017 | /* Since x_new_font doesn't update any fontset information, do it now. */ | 5034 | /* Since x_new_font doesn't update any fontset information, do it now. */ |
| 5018 | FRAME_FONTSET(f) = fontset; | 5035 | FRAME_FONTSET(f) = fontset; |
| 5019 | 5036 | ||
| 5020 | return build_string (fontsetname); | 5037 | return fontset_name (fontset); |
| 5021 | } | 5038 | } |
| 5022 | 5039 | ||
| 5023 | 5040 | ||
| @@ -5856,16 +5873,20 @@ decode_mac_font_name (char *name, int size, short scriptcode) | |||
| 5856 | return; | 5873 | return; |
| 5857 | } | 5874 | } |
| 5858 | 5875 | ||
| 5876 | #if 0 | ||
| 5877 | /* MAC_TODO: Fix encoding system... */ | ||
| 5859 | setup_coding_system (coding_system, &coding); | 5878 | setup_coding_system (coding_system, &coding); |
| 5860 | coding.src_multibyte = 0; | 5879 | coding.src_multibyte = 0; |
| 5861 | coding.dst_multibyte = 1; | 5880 | coding.dst_multibyte = 1; |
| 5862 | coding.mode |= CODING_MODE_LAST_BLOCK; | 5881 | coding.mode |= CODING_MODE_LAST_BLOCK; |
| 5863 | coding.composing = COMPOSITION_DISABLED; | 5882 | coding.dst_bytes = MAX_MULTsize; |
| 5864 | buf = (char *) alloca (size); | 5883 | coding.destination = (char *) alloca (size); |
| 5884 | coding_decode_c_string(&coding, name, strlen(name), qNil); | ||
| 5865 | 5885 | ||
| 5866 | decode_coding (&coding, name, buf, strlen (name), size - 1); | 5886 | decode_coding (&coding, name, buf, strlen (name), size - 1); |
| 5867 | bcopy (buf, name, coding.produced); | 5887 | bcopy (buf, name, coding.produced); |
| 5868 | name[coding.produced] = '\0'; | 5888 | name[coding.produced] = '\0'; |
| 5889 | #endif | ||
| 5869 | } | 5890 | } |
| 5870 | 5891 | ||
| 5871 | 5892 | ||
| @@ -5957,6 +5978,8 @@ x_font_name_to_mac_font_name (char *xf, char *mf) | |||
| 5957 | else | 5978 | else |
| 5958 | sprintf (mf, "%s-%s-%s", foundry, family, cs); | 5979 | sprintf (mf, "%s-%s-%s", foundry, family, cs); |
| 5959 | 5980 | ||
| 5981 | #if 0 | ||
| 5982 | /* MAC_TODO: Fix coding system to use objects */ | ||
| 5960 | if (!NILP (coding_system)) | 5983 | if (!NILP (coding_system)) |
| 5961 | { | 5984 | { |
| 5962 | setup_coding_system (coding_system, &coding); | 5985 | setup_coding_system (coding_system, &coding); |
| @@ -5966,6 +5989,7 @@ x_font_name_to_mac_font_name (char *xf, char *mf) | |||
| 5966 | encode_coding (&coding, family, mf, strlen (family), sizeof (Str32) - 1); | 5989 | encode_coding (&coding, family, mf, strlen (family), sizeof (Str32) - 1); |
| 5967 | mf[coding.produced] = '\0'; | 5990 | mf[coding.produced] = '\0'; |
| 5968 | } | 5991 | } |
| 5992 | #endif | ||
| 5969 | } | 5993 | } |
| 5970 | 5994 | ||
| 5971 | 5995 | ||
| @@ -6741,6 +6765,9 @@ x_load_font (f, fontname, size) | |||
| 6741 | fontp->height = max_height; | 6765 | fontp->height = max_height; |
| 6742 | } | 6766 | } |
| 6743 | 6767 | ||
| 6768 | #if 0 /* MAC_TODO: fill these out with more reasonably values */ | ||
| 6769 | |||
| 6770 | /* MAC_TODO: The script encoding is irrelevant in unicode? */ | ||
| 6744 | /* The slot `encoding' specifies how to map a character | 6771 | /* The slot `encoding' specifies how to map a character |
| 6745 | code-points (0x20..0x7F or 0x2020..0x7F7F) of each charset to | 6772 | code-points (0x20..0x7F or 0x2020..0x7F7F) of each charset to |
| 6746 | the font code-points (0:0x20..0x7F, 1:0xA0..0xFF), or | 6773 | the font code-points (0:0x20..0x7F, 1:0xA0..0xFF), or |
| @@ -6777,7 +6804,6 @@ x_load_font (f, fontname, size) | |||
| 6777 | : 1))); /* 0xA0A0..0xFFFF */ | 6804 | : 1))); /* 0xA0A0..0xFFFF */ |
| 6778 | } | 6805 | } |
| 6779 | 6806 | ||
| 6780 | #if 0 /* MAC_TODO: fill these out with more reasonably values */ | ||
| 6781 | fontp->baseline_offset | 6807 | fontp->baseline_offset |
| 6782 | = (XGetFontProperty (font, dpyinfo->Xatom_MULE_BASELINE_OFFSET, &value) | 6808 | = (XGetFontProperty (font, dpyinfo->Xatom_MULE_BASELINE_OFFSET, &value) |
| 6783 | ? (long) value : 0); | 6809 | ? (long) value : 0); |