[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Patch for Mac OS X Text Drawing
From: |
YAMAMOTO Mitsuharu |
Subject: |
Re: Patch for Mac OS X Text Drawing |
Date: |
Fri, 21 Jan 2005 16:57:51 +0900 |
User-agent: |
Wanderlust/2.12.0 (Your Wildest Dreams) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/21.3.50 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI) |
>>>>> On Wed, 19 Jan 2005 20:48:47 +0900, YAMAMOTO Mitsuharu <address@hidden>
>>>>> said:
>> I had hoped that this would solve the MacOSX bug where if you have
>> some italic text in a window which later is overwritten with spaces
> The X11 version does handle that case. Basically, we can also do
> the same thing on Mac OS X/Carbon (try the attached patch). But
> this is not enough when used with anti-aliasing, because text
> drawing is no longer idempotent: if the same text is drawn several
> times onto the same place, it gets thicker.
The patch below works for me. Carbon Emacs users can test it with the
previously posted macterm.c patch. (Note that the macterm.c patch is
experimental, and only works for one-byte fonts.)
Could someone check if the following change makes sense?
YAMAMOTO Mitsuharu
address@hidden
Index: src/dispextern.h
===================================================================
RCS file: /cvsroot/emacs/emacs/src/dispextern.h,v
retrieving revision 1.192
diff -c -r1.192 dispextern.h
*** src/dispextern.h 10 Jan 2005 13:30:46 -0000 1.192
--- src/dispextern.h 21 Jan 2005 05:03:17 -0000
***************
*** 1193,1198 ****
--- 1193,1203 ----
/* Slice */
struct glyph_slice slice;
+ /* Non-null means the horizontal clipping region starts from the
+ left edge of *clip_head, and ends with the right edge of
+ *clip_tail, not including their overhangs. */
+ struct glyph_string *clip_head, *clip_tail;
+
struct glyph_string *next, *prev;
};
Index: src/xdisp.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xdisp.c,v
retrieving revision 1.966
diff -c -r1.966 xdisp.c
*** src/xdisp.c 19 Jan 2005 10:05:28 -0000 1.966
--- src/xdisp.c 21 Jan 2005 05:03:18 -0000
***************
*** 1776,1781 ****
--- 1776,1799 ----
r.height = s->row->visible_height;
}
+ if (s->clip_head)
+ if (r.x < s->clip_head->x)
+ {
+ if (r.width >= s->clip_head->x - r.x)
+ r.width -= s->clip_head->x - r.x;
+ else
+ r.width = 0;
+ r.x = s->clip_head->x;
+ }
+ if (s->clip_tail)
+ if (r.x + r.width > s->clip_tail->x + s->clip_tail->width)
+ {
+ if (s->clip_tail->x + s->clip_tail->width >= r.x)
+ r.width = s->clip_tail->x + s->clip_tail->width - r.x;
+ else
+ r.width = 0;
+ }
+
/* If S draws overlapping rows, it's sufficient to use the top and
bottom of the window for clipping because this glyph string
intentionally draws over other lines. */
***************
*** 18269,18274 ****
--- 18287,18293 ----
{
int dummy_x = 0;
struct glyph_string *h, *t;
+ struct glyph_string *clip_head = NULL, *clip_tail = NULL;
/* Compute overhangs for all glyph strings. */
if (rif->compute_glyph_string_overhangs)
***************
*** 18289,18294 ****
--- 18308,18314 ----
start = i;
compute_overhangs_and_x (t, head->x, 1);
prepend_glyph_string_lists (&head, &tail, h, t);
+ clip_head = head;
}
/* Prepend glyph strings for glyphs in front of the first glyph
***************
*** 18301,18306 ****
--- 18321,18327 ----
i = left_overwriting (head);
if (i >= 0)
{
+ clip_head = head;
BUILD_GLYPH_STRINGS (i, start, h, t,
DRAW_NORMAL_TEXT, dummy_x, last_x);
for (s = h; s; s = s->next)
***************
*** 18320,18325 ****
--- 18341,18347 ----
DRAW_NORMAL_TEXT, x, last_x);
compute_overhangs_and_x (h, tail->x + tail->width, 0);
append_glyph_string_lists (&head, &tail, h, t);
+ clip_tail = tail;
}
/* Append glyph strings for glyphs following the last glyph
***************
*** 18330,18335 ****
--- 18352,18358 ----
i = right_overwriting (tail);
if (i >= 0)
{
+ clip_tail = tail;
BUILD_GLYPH_STRINGS (end, i, h, t,
DRAW_NORMAL_TEXT, x, last_x);
for (s = h; s; s = s->next)
***************
*** 18337,18342 ****
--- 18360,18371 ----
compute_overhangs_and_x (h, tail->x + tail->width, 0);
append_glyph_string_lists (&head, &tail, h, t);
}
+ if (clip_head || clip_tail)
+ for (s = head; s; s = s->next)
+ {
+ s->clip_head = clip_head;
+ s->clip_tail = clip_tail;
+ }
}
/* Draw all strings. */
- Patch for Mac OS X Text Drawing, Arthur G.P. Schuster, 2005/01/14
- Re: Patch for Mac OS X Text Drawing, Steven Tamm, 2005/01/15
- Re: Patch for Mac OS X Text Drawing, Piet van Oostrum, 2005/01/18
- Re: Patch for Mac OS X Text Drawing, YAMAMOTO Mitsuharu, 2005/01/19
- Re: Patch for Mac OS X Text Drawing,
YAMAMOTO Mitsuharu <=
- Re: Patch for Mac OS X Text Drawing, Richard Stallman, 2005/01/21
- Re: Patch for Mac OS X Text Drawing, YAMAMOTO Mitsuharu, 2005/01/21
- Re: Patch for Mac OS X Text Drawing, Kenichi Handa, 2005/01/22
- Re: Patch for Mac OS X Text Drawing, YAMAMOTO Mitsuharu, 2005/01/22
- Message not available
- Re: Patch for Mac OS X Text Drawing, YAMAMOTO Mitsuharu, 2005/01/24
- Re: Patch for Mac OS X Text Drawing, Kim F. Storm, 2005/01/24
- Re: Patch for Mac OS X Text Drawing, YAMAMOTO Mitsuharu, 2005/01/24
- Re: Patch for Mac OS X Text Drawing, Steven Tamm, 2005/01/24