1991 |
mac_compute_glyph_string_overhangs (s) |
mac_compute_glyph_string_overhangs (s) |
1992 |
struct glyph_string *s; |
struct glyph_string *s; |
1993 |
{ |
{ |
1994 |
#if 0 |
Rect r; |
1995 |
/* MAC_TODO: XTextExtents16 does nothing yet... */ |
MacFontStruct *font = s->font; |
1996 |
|
|
1997 |
|
TextFont (font->mac_fontnum); |
1998 |
|
TextSize (font->mac_fontsize); |
1999 |
|
TextFace (font->mac_fontface); |
2000 |
|
|
2001 |
if (s->cmp == NULL |
if (s->two_byte_p) |
2002 |
&& s->first_glyph->type == CHAR_GLYPH) |
QDTextBounds (s->nchars * 2, (char *)s->char2b, &r); |
2003 |
|
else |
2004 |
{ |
{ |
2005 |
XCharStruct cs; |
int i; |
2006 |
int direction, font_ascent, font_descent; |
char *buf = xmalloc (s->nchars); |
2007 |
XTextExtents16 (s->font, s->char2b, s->nchars, &direction, |
|
2008 |
&font_ascent, &font_descent, &cs); |
if (buf == NULL) |
2009 |
s->right_overhang = cs.rbearing > cs.width ? cs.rbearing - cs.width : 0; |
SetRect (&r, 0, 0, 0, 0); |
2010 |
s->left_overhang = cs.lbearing < 0 ? -cs.lbearing : 0; |
else |
2011 |
|
{ |
2012 |
|
for (i = 0; i < s->nchars; ++i) |
2013 |
|
buf[i] = s->char2b[i].byte2; |
2014 |
|
QDTextBounds (s->nchars, buf, &r); |
2015 |
|
xfree (buf); |
2016 |
|
} |
2017 |
} |
} |
2018 |
#endif |
|
2019 |
|
s->right_overhang = r.right > s->width ? r.right - s->width : 0; |
2020 |
|
s->left_overhang = r.left < 0 ? -r.left : 0; |
2021 |
} |
} |
2022 |
|
|
2023 |
|
|
3085 |
{ |
{ |
3086 |
int relief_drawn_p = 0; |
int relief_drawn_p = 0; |
3087 |
|
|
3088 |
/* If S draws into the background of its successor, draw the |
/* If S draws into the background of its successor that does not |
3089 |
background of the successor first so that S can draw into it. |
draw a cursor, draw the background of the successor first so that |
3090 |
This makes S->next use XDrawString instead of XDrawImageString. */ |
S can draw into it. This makes S->next use XDrawString instead |
3091 |
if (s->next && s->right_overhang && !s->for_overlaps_p) |
of XDrawImageString. */ |
3092 |
|
if (s->next && s->right_overhang && !s->for_overlaps_p |
3093 |
|
&& s->next->hl != DRAW_CURSOR) |
3094 |
{ |
{ |
3095 |
xassert (s->next->img == NULL); |
xassert (s->next->img == NULL); |
3096 |
x_set_glyph_string_gc (s->next); |
x_set_glyph_string_gc (s->next); |
6771 |
returns 15 for 12-point Monaco! */ |
returns 15 for 12-point Monaco! */ |
6772 |
char_width = CharWidth ('m'); |
char_width = CharWidth ('m'); |
6773 |
|
|
6774 |
font->max_bounds.rbearing = char_width; |
if (is_two_byte_font) |
6775 |
font->max_bounds.lbearing = 0; |
{ |
6776 |
font->max_bounds.width = char_width; |
font->per_char = NULL; |
|
font->max_bounds.ascent = the_fontinfo.ascent; |
|
|
font->max_bounds.descent = the_fontinfo.descent; |
|
6777 |
|
|
6778 |
font->min_bounds = font->max_bounds; |
if (fontface & italic) |
6779 |
|
font->max_bounds.rbearing = char_width + 1; |
6780 |
|
else |
6781 |
|
font->max_bounds.rbearing = char_width; |
6782 |
|
font->max_bounds.lbearing = 0; |
6783 |
|
font->max_bounds.width = char_width; |
6784 |
|
font->max_bounds.ascent = the_fontinfo.ascent; |
6785 |
|
font->max_bounds.descent = the_fontinfo.descent; |
6786 |
|
|
6787 |
if (is_two_byte_font || CharWidth ('m') == CharWidth ('i')) |
font->min_bounds = font->max_bounds; |
6788 |
font->per_char = NULL; |
} |
6789 |
else |
else |
6790 |
{ |
{ |
6791 |
font->per_char = (XCharStruct *) |
font->per_char = (XCharStruct *) |
6792 |
xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1)); |
xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1)); |
6793 |
{ |
{ |
6794 |
int c, min_width, max_width; |
int c, min_width, max_width; |
6795 |
|
Rect char_bounds, min_bounds, max_bounds; |
6796 |
|
char ch; |
6797 |
|
|
6798 |
min_width = max_width = char_width; |
min_width = max_width = char_width; |
6799 |
|
SetRect (&min_bounds, -32767, -32767, 32767, 32767); |
6800 |
|
SetRect (&max_bounds, 0, 0, 0, 0); |
6801 |
for (c = 0x20; c <= 0xff; c++) |
for (c = 0x20; c <= 0xff; c++) |
6802 |
{ |
{ |
6803 |
font->per_char[c - 0x20] = font->max_bounds; |
ch = c; |
6804 |
char_width = CharWidth (c); |
char_width = CharWidth (ch); |
6805 |
font->per_char[c - 0x20].width = char_width; |
QDTextBounds (1, &ch, &char_bounds); |
6806 |
font->per_char[c - 0x20].rbearing = char_width; |
STORE_XCHARSTRUCT (font->per_char[c - 0x20], |
6807 |
|
char_width, char_bounds); |
6808 |
/* Some Japanese fonts (in SJIS encoding) return 0 as the |
/* Some Japanese fonts (in SJIS encoding) return 0 as the |
6809 |
character width of 0x7f. */ |
character width of 0x7f. */ |
6810 |
if (char_width > 0) |
if (char_width > 0) |
6812 |
min_width = min (min_width, char_width); |
min_width = min (min_width, char_width); |
6813 |
max_width = max (max_width, char_width); |
max_width = max (max_width, char_width); |
6814 |
} |
} |
6815 |
} |
if (!EmptyRect (&char_bounds)) |
6816 |
font->min_bounds.width = min_width; |
{ |
6817 |
font->max_bounds.width = max_width; |
SetRect (&min_bounds, |
6818 |
|
max (min_bounds.left, char_bounds.left), |
6819 |
|
max (min_bounds.top, char_bounds.top), |
6820 |
|
min (min_bounds.right, char_bounds.right), |
6821 |
|
min (min_bounds.bottom, char_bounds.bottom)); |
6822 |
|
UnionRect (&max_bounds, &char_bounds, &max_bounds); |
6823 |
|
} |
6824 |
|
} |
6825 |
|
STORE_XCHARSTRUCT (font->min_bounds, min_width, min_bounds); |
6826 |
|
STORE_XCHARSTRUCT (font->max_bounds, max_width, max_bounds); |
6827 |
|
if (min_width == max_width |
6828 |
|
&& max_bounds.left >= 0 && max_bounds.right <= max_width) |
6829 |
|
{ |
6830 |
|
/* Fixed width and no overhangs. */ |
6831 |
|
xfree (font->per_char); |
6832 |
|
font->per_char = NULL; |
6833 |
|
} |
6834 |
} |
} |
6835 |
} |
} |
6836 |
|
|
9734 |
0, /* destroy_fringe_bitmap */ |
0, /* destroy_fringe_bitmap */ |
9735 |
mac_per_char_metric, |
mac_per_char_metric, |
9736 |
mac_encode_char, |
mac_encode_char, |
9737 |
NULL, /* mac_compute_glyph_string_overhangs */ |
mac_compute_glyph_string_overhangs, |
9738 |
x_draw_glyph_string, |
x_draw_glyph_string, |
9739 |
mac_define_frame_cursor, |
mac_define_frame_cursor, |
9740 |
mac_clear_frame_area, |
mac_clear_frame_area, |