[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/macterm.c
From: |
Steven Tamm |
Subject: |
[Emacs-diffs] Changes to emacs/src/macterm.c |
Date: |
Mon, 24 Jan 2005 12:59:41 -0500 |
Index: emacs/src/macterm.c
diff -c emacs/src/macterm.c:1.98 emacs/src/macterm.c:1.99
*** emacs/src/macterm.c:1.98 Thu Jan 20 15:22:12 2005
--- emacs/src/macterm.c Mon Jan 24 17:59:36 2005
***************
*** 1991,2010 ****
mac_compute_glyph_string_overhangs (s)
struct glyph_string *s;
{
! #if 0
! /* MAC_TODO: XTextExtents16 does nothing yet... */
! if (s->cmp == NULL
! && s->first_glyph->type == CHAR_GLYPH)
{
! XCharStruct cs;
! int direction, font_ascent, font_descent;
! XTextExtents16 (s->font, s->char2b, s->nchars, &direction,
! &font_ascent, &font_descent, &cs);
! s->right_overhang = cs.rbearing > cs.width ? cs.rbearing - cs.width : 0;
! s->left_overhang = cs.lbearing < 0 ? -cs.lbearing : 0;
}
! #endif
}
--- 1991,2023 ----
mac_compute_glyph_string_overhangs (s)
struct glyph_string *s;
{
! Rect r;
! MacFontStruct *font = s->font;
!
! TextFont (font->mac_fontnum);
! TextSize (font->mac_fontsize);
! TextFace (font->mac_fontface);
! if (s->two_byte_p)
! QDTextBounds (s->nchars * 2, (char *)s->char2b, &r);
! else
{
! int i;
! char *buf = xmalloc (s->nchars);
!
! if (buf == NULL)
! SetRect (&r, 0, 0, 0, 0);
! else
! {
! for (i = 0; i < s->nchars; ++i)
! buf[i] = s->char2b[i].byte2;
! QDTextBounds (s->nchars, buf, &r);
! xfree (buf);
! }
}
!
! s->right_overhang = r.right > s->width ? r.right - s->width : 0;
! s->left_overhang = r.left < 0 ? -r.left : 0;
}
***************
*** 3072,3081 ****
{
int relief_drawn_p = 0;
! /* If S draws into the background of its successor, draw the
! background of the successor first so that S can draw into it.
! This makes S->next use XDrawString instead of XDrawImageString. */
! if (s->next && s->right_overhang && !s->for_overlaps_p)
{
xassert (s->next->img == NULL);
x_set_glyph_string_gc (s->next);
--- 3085,3096 ----
{
int relief_drawn_p = 0;
! /* If S draws into the background of its successor that does not
! draw a cursor, draw the background of the successor first so that
! S can draw into it. This makes S->next use XDrawString instead
! of XDrawImageString. */
! if (s->next && s->right_overhang && !s->for_overlaps_p
! && s->next->hl != DRAW_CURSOR)
{
xassert (s->next->img == NULL);
x_set_glyph_string_gc (s->next);
***************
*** 6756,6785 ****
returns 15 for 12-point Monaco! */
char_width = CharWidth ('m');
! font->max_bounds.rbearing = char_width;
! font->max_bounds.lbearing = 0;
! font->max_bounds.width = char_width;
! font->max_bounds.ascent = the_fontinfo.ascent;
! font->max_bounds.descent = the_fontinfo.descent;
! font->min_bounds = font->max_bounds;
! if (is_two_byte_font || CharWidth ('m') == CharWidth ('i'))
! font->per_char = NULL;
else
{
font->per_char = (XCharStruct *)
xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1));
{
! int c, min_width, max_width;
min_width = max_width = char_width;
for (c = 0x20; c <= 0xff; c++)
{
! font->per_char[c - 0x20] = font->max_bounds;
! char_width = CharWidth (c);
! font->per_char[c - 0x20].width = char_width;
! font->per_char[c - 0x20].rbearing = char_width;
/* Some Japanese fonts (in SJIS encoding) return 0 as the
character width of 0x7f. */
if (char_width > 0)
--- 6771,6810 ----
returns 15 for 12-point Monaco! */
char_width = CharWidth ('m');
! if (is_two_byte_font)
! {
! font->per_char = NULL;
! if (fontface & italic)
! font->max_bounds.rbearing = char_width + 1;
! else
! font->max_bounds.rbearing = char_width;
! font->max_bounds.lbearing = 0;
! font->max_bounds.width = char_width;
! font->max_bounds.ascent = the_fontinfo.ascent;
! font->max_bounds.descent = the_fontinfo.descent;
! font->min_bounds = font->max_bounds;
! }
else
{
font->per_char = (XCharStruct *)
xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1));
{
! int c, min_width, max_width;
! Rect char_bounds, min_bounds, max_bounds;
! char ch;
min_width = max_width = char_width;
+ SetRect (&min_bounds, -32767, -32767, 32767, 32767);
+ SetRect (&max_bounds, 0, 0, 0, 0);
for (c = 0x20; c <= 0xff; c++)
{
! ch = c;
! char_width = CharWidth (ch);
! QDTextBounds (1, &ch, &char_bounds);
! STORE_XCHARSTRUCT (font->per_char[c - 0x20],
! char_width, char_bounds);
/* Some Japanese fonts (in SJIS encoding) return 0 as the
character width of 0x7f. */
if (char_width > 0)
***************
*** 6787,6795 ****
min_width = min (min_width, char_width);
max_width = max (max_width, char_width);
}
! }
! font->min_bounds.width = min_width;
! font->max_bounds.width = max_width;
}
}
--- 6812,6836 ----
min_width = min (min_width, char_width);
max_width = max (max_width, char_width);
}
! if (!EmptyRect (&char_bounds))
! {
! SetRect (&min_bounds,
! max (min_bounds.left, char_bounds.left),
! max (min_bounds.top, char_bounds.top),
! min (min_bounds.right, char_bounds.right),
! min (min_bounds.bottom, char_bounds.bottom));
! UnionRect (&max_bounds, &char_bounds, &max_bounds);
! }
! }
! STORE_XCHARSTRUCT (font->min_bounds, min_width, min_bounds);
! STORE_XCHARSTRUCT (font->max_bounds, max_width, max_bounds);
! if (min_width == max_width
! && max_bounds.left >= 0 && max_bounds.right <= max_width)
! {
! /* Fixed width and no overhangs. */
! xfree (font->per_char);
! font->per_char = NULL;
! }
}
}
***************
*** 9693,9699 ****
0, /* destroy_fringe_bitmap */
mac_per_char_metric,
mac_encode_char,
! NULL, /* mac_compute_glyph_string_overhangs */
x_draw_glyph_string,
mac_define_frame_cursor,
mac_clear_frame_area,
--- 9734,9740 ----
0, /* destroy_fringe_bitmap */
mac_per_char_metric,
mac_encode_char,
! mac_compute_glyph_string_overhangs,
x_draw_glyph_string,
mac_define_frame_cursor,
mac_clear_frame_area,