diff options
| author | Miles Bader | 2005-01-24 22:34:31 +0000 |
|---|---|---|
| committer | Miles Bader | 2005-01-24 22:34:31 +0000 |
| commit | 87795686a9e8ea51ec492d01d7dce4698b14f3af (patch) | |
| tree | 737f41796d19fc2dae8a9b77ecf372ae9cca9f01 /src/macterm.c | |
| parent | 7ed0a705d1cf6dcf340b3407bbffd21f1cfbc925 (diff) | |
| parent | 6adb6f01302f35954f3b50bbf8ae8d94af268792 (diff) | |
| download | emacs-87795686a9e8ea51ec492d01d7dce4698b14f3af.tar.gz emacs-87795686a9e8ea51ec492d01d7dce4698b14f3af.zip | |
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-6
Merge from emacs--cvs-trunk--0
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-48
- miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-51
Update from CVS
Diffstat (limited to 'src/macterm.c')
| -rw-r--r-- | src/macterm.c | 105 |
1 files changed, 73 insertions, 32 deletions
diff --git a/src/macterm.c b/src/macterm.c index d083252d90c..9a1ee834ce5 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -1997,20 +1997,33 @@ static void | |||
| 1997 | mac_compute_glyph_string_overhangs (s) | 1997 | mac_compute_glyph_string_overhangs (s) |
| 1998 | struct glyph_string *s; | 1998 | struct glyph_string *s; |
| 1999 | { | 1999 | { |
| 2000 | #if 0 | 2000 | Rect r; |
| 2001 | /* MAC_TODO: XTextExtents16 does nothing yet... */ | 2001 | MacFontStruct *font = s->font; |
| 2002 | |||
| 2003 | TextFont (font->mac_fontnum); | ||
| 2004 | TextSize (font->mac_fontsize); | ||
| 2005 | TextFace (font->mac_fontface); | ||
| 2002 | 2006 | ||
| 2003 | if (s->cmp == NULL | 2007 | if (s->two_byte_p) |
| 2004 | && s->first_glyph->type == CHAR_GLYPH) | 2008 | QDTextBounds (s->nchars * 2, (char *)s->char2b, &r); |
| 2009 | else | ||
| 2005 | { | 2010 | { |
| 2006 | XCharStruct cs; | 2011 | int i; |
| 2007 | int direction, font_ascent, font_descent; | 2012 | char *buf = xmalloc (s->nchars); |
| 2008 | XTextExtents16 (s->font, s->char2b, s->nchars, &direction, | 2013 | |
| 2009 | &font_ascent, &font_descent, &cs); | 2014 | if (buf == NULL) |
| 2010 | s->right_overhang = cs.rbearing > cs.width ? cs.rbearing - cs.width : 0; | 2015 | SetRect (&r, 0, 0, 0, 0); |
| 2011 | s->left_overhang = cs.lbearing < 0 ? -cs.lbearing : 0; | 2016 | else |
| 2017 | { | ||
| 2018 | for (i = 0; i < s->nchars; ++i) | ||
| 2019 | buf[i] = s->char2b[i].byte2; | ||
| 2020 | QDTextBounds (s->nchars, buf, &r); | ||
| 2021 | xfree (buf); | ||
| 2022 | } | ||
| 2012 | } | 2023 | } |
| 2013 | #endif | 2024 | |
| 2025 | s->right_overhang = r.right > s->width ? r.right - s->width : 0; | ||
| 2026 | s->left_overhang = r.left < 0 ? -r.left : 0; | ||
| 2014 | } | 2027 | } |
| 2015 | 2028 | ||
| 2016 | 2029 | ||
| @@ -3078,10 +3091,12 @@ x_draw_glyph_string (s) | |||
| 3078 | { | 3091 | { |
| 3079 | int relief_drawn_p = 0; | 3092 | int relief_drawn_p = 0; |
| 3080 | 3093 | ||
| 3081 | /* If S draws into the background of its successor, draw the | 3094 | /* If S draws into the background of its successor that does not |
| 3082 | background of the successor first so that S can draw into it. | 3095 | draw a cursor, draw the background of the successor first so that |
| 3083 | This makes S->next use XDrawString instead of XDrawImageString. */ | 3096 | S can draw into it. This makes S->next use XDrawString instead |
| 3084 | if (s->next && s->right_overhang && !s->for_overlaps_p) | 3097 | of XDrawImageString. */ |
| 3098 | if (s->next && s->right_overhang && !s->for_overlaps_p | ||
| 3099 | && s->next->hl != DRAW_CURSOR) | ||
| 3085 | { | 3100 | { |
| 3086 | xassert (s->next->img == NULL); | 3101 | xassert (s->next->img == NULL); |
| 3087 | x_set_glyph_string_gc (s->next); | 3102 | x_set_glyph_string_gc (s->next); |
| @@ -6780,30 +6795,40 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 6780 | returns 15 for 12-point Monaco! */ | 6795 | returns 15 for 12-point Monaco! */ |
| 6781 | char_width = CharWidth ('m'); | 6796 | char_width = CharWidth ('m'); |
| 6782 | 6797 | ||
| 6783 | font->max_bounds.rbearing = char_width; | 6798 | if (is_two_byte_font) |
| 6784 | font->max_bounds.lbearing = 0; | 6799 | { |
| 6785 | font->max_bounds.width = char_width; | 6800 | font->per_char = NULL; |
| 6786 | font->max_bounds.ascent = the_fontinfo.ascent; | ||
| 6787 | font->max_bounds.descent = the_fontinfo.descent; | ||
| 6788 | 6801 | ||
| 6789 | font->min_bounds = font->max_bounds; | 6802 | if (fontface & italic) |
| 6803 | font->max_bounds.rbearing = char_width + 1; | ||
| 6804 | else | ||
| 6805 | font->max_bounds.rbearing = char_width; | ||
| 6806 | font->max_bounds.lbearing = 0; | ||
| 6807 | font->max_bounds.width = char_width; | ||
| 6808 | font->max_bounds.ascent = the_fontinfo.ascent; | ||
| 6809 | font->max_bounds.descent = the_fontinfo.descent; | ||
| 6790 | 6810 | ||
| 6791 | if (is_two_byte_font || CharWidth ('m') == CharWidth ('i')) | 6811 | font->min_bounds = font->max_bounds; |
| 6792 | font->per_char = NULL; | 6812 | } |
| 6793 | else | 6813 | else |
| 6794 | { | 6814 | { |
| 6795 | font->per_char = (XCharStruct *) | 6815 | font->per_char = (XCharStruct *) |
| 6796 | xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1)); | 6816 | xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1)); |
| 6797 | { | 6817 | { |
| 6798 | int c, min_width, max_width; | 6818 | int c, min_width, max_width; |
| 6819 | Rect char_bounds, min_bounds, max_bounds; | ||
| 6820 | char ch; | ||
| 6799 | 6821 | ||
| 6800 | min_width = max_width = char_width; | 6822 | min_width = max_width = char_width; |
| 6823 | SetRect (&min_bounds, -32767, -32767, 32767, 32767); | ||
| 6824 | SetRect (&max_bounds, 0, 0, 0, 0); | ||
| 6801 | for (c = 0x20; c <= 0xff; c++) | 6825 | for (c = 0x20; c <= 0xff; c++) |
| 6802 | { | 6826 | { |
| 6803 | font->per_char[c - 0x20] = font->max_bounds; | 6827 | ch = c; |
| 6804 | char_width = CharWidth (c); | 6828 | char_width = CharWidth (ch); |
| 6805 | font->per_char[c - 0x20].width = char_width; | 6829 | QDTextBounds (1, &ch, &char_bounds); |
| 6806 | font->per_char[c - 0x20].rbearing = char_width; | 6830 | STORE_XCHARSTRUCT (font->per_char[c - 0x20], |
| 6831 | char_width, char_bounds); | ||
| 6807 | /* Some Japanese fonts (in SJIS encoding) return 0 as the | 6832 | /* Some Japanese fonts (in SJIS encoding) return 0 as the |
| 6808 | character width of 0x7f. */ | 6833 | character width of 0x7f. */ |
| 6809 | if (char_width > 0) | 6834 | if (char_width > 0) |
| @@ -6811,9 +6836,25 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 6811 | min_width = min (min_width, char_width); | 6836 | min_width = min (min_width, char_width); |
| 6812 | max_width = max (max_width, char_width); | 6837 | max_width = max (max_width, char_width); |
| 6813 | } | 6838 | } |
| 6814 | } | 6839 | if (!EmptyRect (&char_bounds)) |
| 6815 | font->min_bounds.width = min_width; | 6840 | { |
| 6816 | font->max_bounds.width = max_width; | 6841 | SetRect (&min_bounds, |
| 6842 | max (min_bounds.left, char_bounds.left), | ||
| 6843 | max (min_bounds.top, char_bounds.top), | ||
| 6844 | min (min_bounds.right, char_bounds.right), | ||
| 6845 | min (min_bounds.bottom, char_bounds.bottom)); | ||
| 6846 | UnionRect (&max_bounds, &char_bounds, &max_bounds); | ||
| 6847 | } | ||
| 6848 | } | ||
| 6849 | STORE_XCHARSTRUCT (font->min_bounds, min_width, min_bounds); | ||
| 6850 | STORE_XCHARSTRUCT (font->max_bounds, max_width, max_bounds); | ||
| 6851 | if (min_width == max_width | ||
| 6852 | && max_bounds.left >= 0 && max_bounds.right <= max_width) | ||
| 6853 | { | ||
| 6854 | /* Fixed width and no overhangs. */ | ||
| 6855 | xfree (font->per_char); | ||
| 6856 | font->per_char = NULL; | ||
| 6857 | } | ||
| 6817 | } | 6858 | } |
| 6818 | } | 6859 | } |
| 6819 | 6860 | ||
| @@ -9719,7 +9760,7 @@ static struct redisplay_interface x_redisplay_interface = | |||
| 9719 | 0, /* destroy_fringe_bitmap */ | 9760 | 0, /* destroy_fringe_bitmap */ |
| 9720 | mac_per_char_metric, | 9761 | mac_per_char_metric, |
| 9721 | mac_encode_char, | 9762 | mac_encode_char, |
| 9722 | NULL, /* mac_compute_glyph_string_overhangs */ | 9763 | mac_compute_glyph_string_overhangs, |
| 9723 | x_draw_glyph_string, | 9764 | x_draw_glyph_string, |
| 9724 | mac_define_frame_cursor, | 9765 | mac_define_frame_cursor, |
| 9725 | mac_clear_frame_area, | 9766 | mac_clear_frame_area, |