summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-07-29 14:14:19 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-07-29 14:14:19 -0700
commiteacb6b4bfa897c12c41a4af73f40ab61b45a8548 (patch)
treed0f9e055b6780b64db72c65753a793e1d1a59f66
parent5402029425ceee114d7ed071ac981227f0d1fc38 (diff)
parent096a60526593c1571da1ec9137b878ad8178f833 (diff)
downloademacs-eacb6b4bfa897c12c41a4af73f40ab61b45a8548.tar.gz
Merge from trunk.
-rw-r--r--ChangeLog7
-rw-r--r--admin/MAINTAINERS5
-rwxr-xr-xautogen/configure2
-rw-r--r--configure.in2
-rw-r--r--doc/emacs/ChangeLog5
-rw-r--r--doc/emacs/mule.texi2
-rw-r--r--doc/lispref/ChangeLog5
-rw-r--r--doc/lispref/display.texi2
-rw-r--r--etc/ChangeLog4
-rw-r--r--etc/NEWS12
-rw-r--r--lisp/gnus/ChangeLog5
-rw-r--r--lisp/gnus/mm-decode.el8
-rw-r--r--lisp/org/ChangeLog5
-rw-r--r--src/ChangeLog58
-rw-r--r--src/alloc.c6
-rw-r--r--src/buffer.c2
-rw-r--r--src/image.c10
-rw-r--r--src/lread.c3
-rw-r--r--src/nsfns.m13
-rw-r--r--src/nsfont.m57
-rw-r--r--src/nsmenu.m23
-rw-r--r--src/nsterm.h8
-rw-r--r--src/nsterm.m214
-rw-r--r--src/print.c12
24 files changed, 355 insertions, 115 deletions
diff --git a/ChangeLog b/ChangeLog
index a21cf9dde20..de89768c0a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,4 @@
-2011-07-28 Paul Eggert <eggert@cs.ucla.edu>
+2011-07-29 Paul Eggert <eggert@cs.ucla.edu>
Merge from gnulib, using build-aux to remove clutter (Bug#9169).
* m4/largefile.m4: New file, so that Emacs does not mess up when
@@ -30,6 +30,11 @@
'configure'.
* make-dist: Adjust to new build-aux and build-aux/snippit dirs.
+2011-07-28 Alp Aker <alp.tekin.aker@gmail.com>
+
+ * configure.in (HAVE_RSVG): Allow use of -lrsvg-2 for any NextStep
+ build, not just GNUstep (Bug#9177).
+
2011-07-28 Paul Eggert <eggert@cs.ucla.edu>
Assume freestanding C89 headers, string.h, stdlib.h.
diff --git a/admin/MAINTAINERS b/admin/MAINTAINERS
index 1d988a25626..e4a04763061 100644
--- a/admin/MAINTAINERS
+++ b/admin/MAINTAINERS
@@ -79,6 +79,11 @@ Michael Olson
doc/misc/erc.texi
lisp/emacs-lisp/tq.el
+Bastien Guerry
+ Org
+ lisp/org/*
+ doc/misc/org.texi
+
==============================================================================
2.
==============================================================================
diff --git a/autogen/configure b/autogen/configure
index ec0764613f1..074850731b0 100755
--- a/autogen/configure
+++ b/autogen/configure
@@ -10240,7 +10240,7 @@ fi
### Use -lrsvg-2 if available, unless `--with-rsvg=no' is specified.
HAVE_RSVG=no
-if test "${HAVE_X11}" = "yes" || test "${NS_IMPL_GNUSTEP}" = "yes"; then
+if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes"; then
if test "${with_rsvg}" != "no"; then
RSVG_REQUIRED=2.11.0
RSVG_MODULE="librsvg-2.0 >= $RSVG_REQUIRED"
diff --git a/configure.in b/configure.in
index fe77a40ac27..08c5cee8e8f 100644
--- a/configure.in
+++ b/configure.in
@@ -1821,7 +1821,7 @@ fi
### Use -lrsvg-2 if available, unless `--with-rsvg=no' is specified.
HAVE_RSVG=no
-if test "${HAVE_X11}" = "yes" || test "${NS_IMPL_GNUSTEP}" = "yes"; then
+if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes"; then
if test "${with_rsvg}" != "no"; then
RSVG_REQUIRED=2.11.0
RSVG_MODULE="librsvg-2.0 >= $RSVG_REQUIRED"
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index e10b9a83a43..794771e24d3 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,8 @@
+2011-07-28 Eli Zaretskii <eliz@gnu.org>
+
+ * mule.texi (Bidirectional Editing): Document the fact that
+ bidi-display-reordering is t by default.
+
2011-07-15 Lars Magne Ingebrigtsen <larsi@gnus.org>
* help.texi (Misc Help): Mention `describe-prefix-bindings'
diff --git a/doc/emacs/mule.texi b/doc/emacs/mule.texi
index 3c970ecb12c..4f1683ef5ea 100644
--- a/doc/emacs/mule.texi
+++ b/doc/emacs/mule.texi
@@ -1703,7 +1703,7 @@ Annex #9, for reordering of bidirectional text for display.
whether text in the buffer is reordered for display. If its value is
non-@code{nil}, Emacs reorders characters that have right-to-left
directionality when they are displayed. The default value is
-@code{nil}.
+@code{t}.
Each paragraph of bidirectional text can have its own @dfn{base
direction}, either right-to-left or left-to-right. (Paragraph
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index d59bbf87bce..f08ee3a227c 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,8 @@
+2011-07-28 Eli Zaretskii <eliz@gnu.org>
+
+ * display.texi (Bidirectional Display): Document the fact that
+ bidi-display-reordering is t by default.
+
2011-07-23 Eli Zaretskii <eliz@gnu.org>
* display.texi (Bidirectional Display): New section.
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 903232bcbda..077d0992232 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -6007,7 +6007,7 @@ a ``Full bidirectionality'' class implementation of the @acronym{UBA}.
whether text in the buffer is reordered for display. If its value is
non-@code{nil}, Emacs reorders characters that have right-to-left
directionality when they are displayed. The default value is
-@code{nil}. Text in overlay strings (@pxref{Overlay
+@code{t}. Text in overlay strings (@pxref{Overlay
Properties,,before-string}), display strings (@pxref{Overlay
Properties,,display}), and @code{display} text properties
(@pxref{Display Property}) is also reordered if the buffer whose text
diff --git a/etc/ChangeLog b/etc/ChangeLog
index a5d209774ea..e54e8d81b8a 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,3 +1,7 @@
+2011-07-28 Andreas Schwab <schwab@linux-m68k.org>
+
+ * NEWS: Document ## and #:.
+
2011-07-28 Carsten Dominik <carsten.dominik@gmail.com>
* refcards/orgcard.tex: Document `org-copy-visible'.
diff --git a/etc/NEWS b/etc/NEWS
index ffce9da51e4..6a1bb6c1c5e 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -173,8 +173,11 @@ in your ~/.authinfo file instead.
See the node "Bidirectional Editing" in the Emacs Manual for some
additional documentation.
-To turn this on in any given buffer, set the buffer-local variable
-`bidi-display-reordering' to a non-nil value. The default is nil.
+To turn this off in any given buffer, set the buffer-local variable
+`bidi-display-reordering' to a nil value. The default is t. For text
+that includes no right-to-left characters, the result of reordering
+looks exactly as it did in previous versions, i.e. there's no
+reordering at all.
The buffer-local variable `bidi-paragraph-direction', if non-nil,
forces each paragraph in the buffer to have its base direction
@@ -1164,6 +1167,11 @@ as well as those in the -*- line.
** rx.el has a new `group-n' construct for explicitly numbered groups.
** keymaps can inherit from multiple parents.
+
+** New reader macro ## which stands for the empty symbol.
+This means that the empty symbol can now be read back. Also, #: by itself
+(when not immediately followed by a possible symbol character) stands for
+an empty uninterned symbol.
* Changes in Emacs 24.1 on non-free operating systems
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index f90e180b128..acdd1033933 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,8 @@
+2011-07-29 Daniel Dehennin <daniel.dehennin@baby-gnu.org>
+
+ * mm-decode.el (mm-dissect-buffer): Add a default content-disposition
+ in mm handle if none is specified.
+
2011-07-24 Andrew Cohen <cohen@andy.bu.edu>
* nnimap.el (nnimap-make-thread-query): Quote message-ids for gmail.
diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el
index a51c6630ac5..692175d471f 100644
--- a/lisp/gnus/mm-decode.el
+++ b/lisp/gnus/mm-decode.el
@@ -564,7 +564,13 @@ Postpone undisplaying of viewers for types in
(setq ct (mail-fetch-field "content-type")
ctl (and ct (mail-header-parse-content-type ct))
cte (mail-fetch-field "content-transfer-encoding")
- cd (mail-fetch-field "content-disposition")
+ cd (or (mail-fetch-field "content-disposition")
+ (when (and ctl
+ (eq 'mm-inline-text
+ (cadr (mm-assoc-string-match
+ mm-inline-media-tests
+ (car ctl)))))
+ "inline"))
;; Newlines in description should be stripped so as
;; not to break the MIME tag into two or more lines.
description (message-fetch-field "content-description")
diff --git a/lisp/org/ChangeLog b/lisp/org/ChangeLog
index 6af95d39ae2..0822f313ac4 100644
--- a/lisp/org/ChangeLog
+++ b/lisp/org/ChangeLog
@@ -3293,9 +3293,10 @@
* org-capture.el (org-capture-fill-template): fix bug with the
display of interactive prompt in templates expansion.
-2011-07-28 Reiner Steib <reinersteib+gmane@imap.cc>
+2011-07-28 Reiner Steib <reiner.steib@gmx.de>
- * org-clock.el (org-clock-display): docstring fiw.
+ * org-clock.el (org-clock-display): Document how to remove subtree
+ times.
2011-07-28 Eric Schulte <schulte.eric@gmail.com>
diff --git a/src/ChangeLog b/src/ChangeLog
index d618b30ceba..9e8aedfd36b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,9 +1,65 @@
-2011-07-28 Paul Eggert <eggert@cs.ucla.edu>
+2011-07-29 Paul Eggert <eggert@cs.ucla.edu>
* Makefile.in (gl-stamp): move-if-change now in build-aux (Bug#9169).
2011-07-28 Paul Eggert <eggert@cs.ucla.edu>
+ * image.c (check_image_size): Use 1024x1024 if unknown frame (Bug#9189).
+ This is needed if max-image-size is a floating-point number.
+
+2011-07-28 Andreas Schwab <schwab@linux-m68k.org>
+
+ * print.c (print_object): Print empty symbol as ##.
+
+ * lread.c (read1): Read ## as empty symbol.
+
+2011-07-28 Alp Aker <alp.tekin.aker@gmail.com>
+
+ * nsfns.m (x_set_foreground_color): Set f->foreground_pixel when
+ setting frame foreground color (Bug#9175).
+ (x_set_background_color): Likewise.
+
+ * nsmenu.m (-setText): Size tooltip dimensions precisely to
+ contents (Bug#9176).
+ (EmacsTooltip -init): Remove bezels and add shadows to
+ tooltip windows.
+
+ * nsterm.m (ns_dumpglyphs_stretch): Avoid overwriting left fringe
+ or scroll bar (Bug#8470).
+
+ * nsfont.m (nsfont_open): Remove assignment to voffset and
+ unnecessary vars hshink, expand, hd, full_height, min_height.
+ (nsfont_draw): Use s->ybase as baseline for glyph drawing (Bug#8913).
+
+ * nsterm.h (nsfont_info): Remove voffset field.
+
+2011-07-28 Alp Aker <alp.tekin.aker@gmail.com>
+
+ Implement strike-through and overline on NextStep (Bug#8863).
+
+ * nsfont.m (nsfont_open): Use underline position provided by font,
+ instead of hard-coded value of 2.
+ (nsfont_draw): Call ns_draw_text_decoration instead.
+
+ * nsterm.h: Add declaration for ns_draw_text_decoration.
+
+ * nsterm.m (ns_draw_text_decoration): New function for drawing
+ underline, overline, and strike-through.
+ (ns_dumpglyphs_image, ns_dumpglyphs_stretch): Add call to
+ ns_draw_text_decoration. Change treatment of cursor drawing to
+ accomodate underlining, etc.
+
+2011-07-28 Eli Zaretskii <eliz@gnu.org>
+
+ * buffer.c (init_buffer_once): Set bidi-display-reordering to t by
+ default.
+
+2011-07-28 Paul Eggert <eggert@cs.ucla.edu>
+
+ * alloc.c (memory_full) [!SYNC_INPUT]: Fix signal-related race.
+ Without this fix, if a signal arrives just after memory fills up,
+ 'malloc' might be invoked reentrantly.
+
* image.c (x_check_image_size) [!HAVE_X_WINDOWS]: Return 1.
In other words, assume that every image size is allowed, on non-X
hosts. This assumption is probably wrong, but it lets Emacs compile.
diff --git a/src/alloc.c b/src/alloc.c
index eb0185a8e35..b96fc1f0642 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -3282,12 +3282,16 @@ memory_full (size_t nbytes)
int enough_free_memory = 0;
if (SPARE_MEMORY < nbytes)
{
- void *p = malloc (SPARE_MEMORY);
+ void *p;
+
+ MALLOC_BLOCK_INPUT;
+ p = malloc (SPARE_MEMORY);
if (p)
{
free (p);
enough_free_memory = 1;
}
+ MALLOC_UNBLOCK_INPUT;
}
if (! enough_free_memory)
diff --git a/src/buffer.c b/src/buffer.c
index a40275db8de..45d6fa36d04 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -4926,7 +4926,7 @@ init_buffer_once (void)
BVAR (&buffer_defaults, truncate_lines) = Qnil;
BVAR (&buffer_defaults, word_wrap) = Qnil;
BVAR (&buffer_defaults, ctl_arrow) = Qt;
- BVAR (&buffer_defaults, bidi_display_reordering) = Qnil;
+ BVAR (&buffer_defaults, bidi_display_reordering) = Qt;
BVAR (&buffer_defaults, bidi_paragraph_direction) = Qnil;
BVAR (&buffer_defaults, cursor_type) = Qt;
BVAR (&buffer_defaults, extra_line_spacing) = Qnil;
diff --git a/src/image.c b/src/image.c
index fb1d825fa54..d1091aec6f3 100644
--- a/src/image.c
+++ b/src/image.c
@@ -1053,9 +1053,13 @@ check_image_size (struct frame *f, int width, int height)
&& height <= XINT (Vmax_image_size));
else if (FLOATP (Vmax_image_size))
{
- xassert (f);
- w = FRAME_PIXEL_WIDTH (f);
- h = FRAME_PIXEL_HEIGHT (f);
+ if (f != NULL)
+ {
+ w = FRAME_PIXEL_WIDTH (f);
+ h = FRAME_PIXEL_HEIGHT (f);
+ }
+ else
+ w = h = 1024; /* Arbitrary size for unknown frame. */
return (width <= XFLOAT_DATA (Vmax_image_size) * w
&& height <= XFLOAT_DATA (Vmax_image_size) * h);
}
diff --git a/src/lread.c b/src/lread.c
index 0613ad037bf..78ff195e990 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2670,6 +2670,9 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
}
goto read_symbol;
}
+ /* ## is the empty symbol. */
+ if (c == '#')
+ return Fintern (build_string (""), Qnil);
/* Reader forms that can reuse previously read objects. */
if (c >= '0' && c <= '9')
{
diff --git a/src/nsfns.m b/src/nsfns.m
index 0452086201e..85246a4c25f 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -321,6 +321,7 @@ static void
x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
NSColor *col;
+ CGFloat r, g, b, alpha;
if (ns_lisp_to_color (arg, &col))
{
@@ -332,6 +333,10 @@ x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
[f->output_data.ns->foreground_color release];
f->output_data.ns->foreground_color = col;
+ [col getRed: &r green: &g blue: &b alpha: &alpha];
+ FRAME_FOREGROUND_PIXEL (f) =
+ ARGB_TO_ULONG ((int)(alpha*0xff), (int)(r*0xff), (int)(g*0xff), (int)(b*0xff));
+
if (FRAME_NS_VIEW (f))
{
update_face_from_frame_parameter (f, Qforeground_color, arg);
@@ -348,7 +353,7 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
struct face *face;
NSColor *col;
NSView *view = FRAME_NS_VIEW (f);
- float alpha;
+ CGFloat r, g, b, alpha;
if (ns_lisp_to_color (arg, &col))
{
@@ -364,10 +369,14 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
[col retain];
[f->output_data.ns->background_color release];
f->output_data.ns->background_color = col;
+
+ [col getRed: &r green: &g blue: &b alpha: &alpha];
+ FRAME_BACKGROUND_PIXEL (f) =
+ ARGB_TO_ULONG ((int)(alpha*0xff), (int)(r*0xff), (int)(g*0xff), (int)(b*0xff));
+
if (view != nil)
{
[[view window] setBackgroundColor: col];
- alpha = [col alphaComponent];
if (alpha != 1.0)
[[view window] setOpaque: NO];
diff --git a/src/nsfont.m b/src/nsfont.m
index 76c70aadf9f..60f8c5321aa 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -804,8 +804,6 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
font->props[FONT_FILE_INDEX] = Qnil;
{
- double expand, hshrink;
- float full_height, min_height, hd;
const char *fontName = [[nsfont fontName] UTF8String];
int len = strlen (fontName);
@@ -837,26 +835,16 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
[sfont maximumAdvancement].width : ns_char_width (sfont, '0');
brect = [sfont boundingRectForFont];
- full_height = brect.size.height;
- min_height = [sfont ascender] - adjusted_descender;
- hd = full_height - min_height;
- /* standard height, similar to Carbon. Emacs.app: was 0.5 by default. */
- expand = 0.0;
- hshrink = 1.0;
-
- font_info->underpos = 2; /*[sfont underlinePosition] is often clipped out */
+ font_info->underpos = [sfont underlinePosition];
font_info->underwidth = [sfont underlineThickness];
font_info->size = font->pixel_size;
- font_info->voffset = lrint (hshrink * [sfont ascender] + expand * hd / 2);
/* max bounds */
- font_info->max_bounds.ascent =
- lrint (hshrink * [sfont ascender] + expand * hd/2);
+ font_info->max_bounds.ascent = lrint ([sfont ascender]);
/* Descender is usually negative. Use floor to avoid
clipping descenders. */
- font_info->max_bounds.descent =
- -lrint (floor(hshrink* adjusted_descender - expand*hd/2));
+ font_info->max_bounds.descent = -lrint (floor(adjusted_descender));
font_info->height =
font_info->max_bounds.ascent + font_info->max_bounds.descent;
font_info->max_bounds.width = lrint (font_info->width);
@@ -1165,7 +1153,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y,
/* set up for character rendering */
- r.origin.y += font->voffset + (s->height - font->height)/2;
+ r.origin.y = s->ybase;
col = (NS_FACE_FOREGROUND (face) != 0
? ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f)
@@ -1196,20 +1184,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y,
/*[context GSSetTextDrawingMode: GSTextFill]; /// not implemented yet */
}
- /* do underline */
- if (face->underline_p)
- {
- if (face->underline_color != 0)
- [ns_lookup_indexed_color (face->underline_color, s->f) set];
- else
- [col set];
- DPSmoveto (context, r.origin.x, r.origin.y + font->underpos);
- DPSlineto (context, r.origin.x+r.size.width, r.origin.y+font->underpos);
- if (face->underline_color != 0)
- [col set];
- }
- else
- [col set];
+ [col set];
/* draw with DPSxshow () */
DPSmoveto (context, r.origin.x, r.origin.y);
@@ -1255,23 +1230,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y,
CGContextSetTextDrawingMode (gcontext, kCGTextFill);
}
- if (face->underline_p)
- {
- if (face->underline_color != 0)
- [ns_lookup_indexed_color (face->underline_color, s->f) set];
- else
- [col set];
- CGContextBeginPath (gcontext);
- CGContextMoveToPoint (gcontext,
- r.origin.x, r.origin.y + font->underpos);
- CGContextAddLineToPoint (gcontext, r.origin.x + r.size.width,
- r.origin.y + font->underpos);
- CGContextStrokePath (gcontext);
- if (face->underline_color != 0)
- [col set];
- }
- else
- [col set];
+ [col set];
CGContextSetTextPosition (gcontext, r.origin.x, r.origin.y);
CGContextShowGlyphsWithAdvances (gcontext, s->char2b + s->cmp_from,
@@ -1287,6 +1246,10 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y,
CGContextRestoreGState (gcontext);
}
#endif /* NS_IMPL_COCOA */
+
+ /* Draw underline, overline, strike-through. */
+ ns_draw_text_decoration (s, face, col, r.size.width, r.origin.x);
+
return to-from;
}
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 6931b7a3c01..6bde229ed4d 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -1228,8 +1228,8 @@ update_frame_tool_bar (FRAME_PTR f)
[textField setEditable: NO];
[textField setSelectable: NO];
- [textField setBordered: YES];
- [textField setBezeled: YES];
+ [textField setBordered: NO];
+ [textField setBezeled: NO];
[textField setDrawsBackground: YES];
win = [[NSWindow alloc]
@@ -1237,6 +1237,7 @@ update_frame_tool_bar (FRAME_PTR f)
styleMask: 0
backing: NSBackingStoreBuffered
defer: YES];
+ [win setHasShadow: YES];
[win setReleasedWhenClosed: NO];
[win setDelegate: self];
[[win contentView] addSubview: textField];
@@ -1257,17 +1258,15 @@ update_frame_tool_bar (FRAME_PTR f)
- (void) setText: (char *)text
{
NSString *str = [NSString stringWithUTF8String: text];
- NSRect r = [textField frame];
- NSSize textSize = [str sizeWithAttributes:
- [NSDictionary dictionaryWithObject: [[textField font] screenFont]
- forKey: NSFontAttributeName]];
- NSSize padSize = [[[textField font] screenFont]
- boundingRectForFont].size;
-
- r.size.width = textSize.width + padSize.width/2;
- r.size.height = textSize.height + padSize.height/2;
- [textField setFrame: r];
+ NSRect r = [textField frame];
+ NSSize tooltipDims;
+
[textField setStringValue: str];
+ tooltipDims = [[textField cell] cellSize];
+
+ r.size.width = tooltipDims.width;
+ r.size.height = tooltipDims.height;
+ [textField setFrame: r];
}
- (void) showAtX: (int)x Y: (int)y for: (int)seconds
diff --git a/src/nsterm.h b/src/nsterm.h
index f419391a11e..6ea9161c922 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -467,7 +467,6 @@ struct nsfont_info
#endif
char bold, ital; /* convenience flags */
char synthItal;
- float voffset; /* mean of ascender/descender offsets */
XCharStruct max_bounds;
/* we compute glyph codes and metrics on-demand in blocks of 256 indexed
by hibyte, lobyte */
@@ -825,6 +824,13 @@ extern unsigned long ns_get_rgb_color (struct frame *f,
float r, float g, float b, float a);
extern NSPoint last_mouse_motion_position;
+/* From nsterm.m, needed in nsfont.m. */
+#ifdef __OBJC__
+extern void
+ns_draw_text_decoration (struct glyph_string *s, struct face *face,
+ NSColor *defaultCol, CGFloat width, CGFloat x);
+#endif
+
#ifdef NS_IMPL_GNUSTEP
extern char gnustep_base_version[]; /* version tracking */
#endif
diff --git a/src/nsterm.m b/src/nsterm.m
index e45dc1a902d..d4b1a3f8473 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -263,8 +263,6 @@ static void ns_condemn_scroll_bars (struct frame *f);
static void ns_judge_scroll_bars (struct frame *f);
void x_set_frame_alpha (struct frame *f);
-/* FIXME: figure out what to do with underline_minimum_offset. */
-
/* ==========================================================================
@@ -2597,6 +2595,107 @@ ns_get_glyph_string_clip_rect (struct glyph_string *s, NativeRectangle *nr)
return n;
}
+void
+ns_draw_text_decoration (struct glyph_string *s, struct face *face,
+ NSColor *defaultCol, CGFloat width, CGFloat x)
+/* --------------------------------------------------------------------------
+ Draw underline, overline, and strike-through on glyph string s.
+ -------------------------------------------------------------------------- */
+{
+ if (s->for_overlaps)
+ return;
+
+ /* Do underline. */
+ if (face->underline_p)
+ {
+ NSRect r;
+ unsigned long thickness, position;
+
+ /* If the prev was underlined, match its appearance. */
+ if (s->prev && s->prev->face->underline_p
+ && s->prev->underline_thickness > 0)
+ {
+ thickness = s->prev->underline_thickness;
+ position = s->prev->underline_position;
+ }
+ else
+ {
+ struct font *font;
+ unsigned long descent;
+
+ font=s->font;
+ descent = s->y + s->height - s->ybase;
+
+ /* Use underline thickness of font, defaulting to 1. */
+ thickness = (font && font->underline_thickness > 0)
+ ? font->underline_thickness : 1;
+
+ /* Determine the offset of underlining from the baseline. */
+ if (x_underline_at_descent_line)
+ position = descent - thickness;
+ else if (x_use_underline_position_properties
+ && font && font->underline_position >= 0)
+ position = font->underline_position;
+ else if (font)
+ position = lround (font->descent / 2);
+ else
+ position = underline_minimum_offset;
+
+ position = max (position, underline_minimum_offset);
+
+ /* Ensure underlining is not cropped. */
+ if (descent <= position)
+ {
+ position = descent - 1;
+ thickness = 1;
+ }
+ else if (descent < position + thickness)
+ thickness = 1;
+ }
+
+ s->underline_thickness = thickness;
+ s->underline_position = position;
+
+ r = NSMakeRect (x, s->ybase + position, width, thickness);
+
+ if (face->underline_defaulted_p)
+ [defaultCol set];
+ else
+ [ns_lookup_indexed_color (face->underline_color, s->f) set];
+ NSRectFill (r);
+ }
+
+ /* Do overline. We follow other terms in using a thickness of 1
+ and ignoring overline_margin. */
+ if (face->overline_p)
+ {
+ NSRect r;
+ r = NSMakeRect (x, s->y, width, 1);
+
+ if (face->overline_color_defaulted_p)
+ [defaultCol set];
+ else
+ [ns_lookup_indexed_color (face->overline_color, s->f) set];
+ NSRectFill (r);
+ }
+
+ /* Do strike-through. We follow other terms for thickness and
+ vertical position.*/
+ if (face->strike_through_p)
+ {
+ NSRect r;
+ unsigned long dy;
+
+ dy = lrint ((s->height - 1) / 2);
+ r = NSMakeRect (x, s->y + dy, width, 1);
+
+ if (face->strike_through_color_defaulted_p)
+ [defaultCol set];
+ else
+ [ns_lookup_indexed_color (face->strike_through_color, s->f) set];
+ NSRectFill (r);
+ }
+}
static void
ns_draw_box (NSRect r, float thickness, NSColor *col, char left_p, char right_p)
@@ -2854,6 +2953,7 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r)
char raised_p;
NSRect br;
struct face *face;
+ NSColor *tdCol;
NSTRACE (ns_dumpglyphs_image);
@@ -2882,10 +2982,7 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r)
else
face = FACE_FROM_ID (s->f, s->first_glyph->face_id);
- if (s->hl == DRAW_CURSOR)
- [FRAME_CURSOR_COLOR (s->f) set];
- else
- [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f) set];
+ [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f) set];
if (bg_height > s->slice.height || s->img->hmargin || s->img->vmargin
|| s->img->mask || s->img->pixmap == 0 || s->width != s->background_width)
@@ -2923,6 +3020,27 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r)
[img compositeToPoint: NSMakePoint (x, y + s->slice.height)
operation: NSCompositeSourceOver];
+ if (s->hl == DRAW_CURSOR)
+ {
+ [FRAME_CURSOR_COLOR (s->f) set];
+ if (s->w->phys_cursor_type == FILLED_BOX_CURSOR)
+ tdCol = ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f);
+ else
+ /* Currently on NS img->mask is always 0. Since
+ get_window_cursor_type specifies a hollow box cursor when on
+ a non-masked image we never reach this clause. But we put it
+ in in antipication of better support for image masks on
+ NS. */
+ tdCol = ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f);
+ }
+ else
+ {
+ tdCol = ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f);
+ }
+
+ /* Draw underline, overline, strike-through. */
+ ns_draw_text_decoration (s, face, tdCol, br.size.width, br.origin.x);
+
/* Draw relief, if requested */
if (s->img->relief || s->hl ==DRAW_IMAGE_RAISED || s->hl ==DRAW_IMAGE_SUNKEN)
{
@@ -2967,22 +3085,49 @@ ns_dumpglyphs_stretch (struct glyph_string *s)
NSRect r[2];
int n, i;
struct face *face;
+ NSColor *fgCol, *bgCol;
if (!s->background_filled_p)
{
n = ns_get_glyph_string_clip_rect (s, r);
*r = NSMakeRect (s->x, s->y, s->background_width, s->height);
+ ns_focus (s->f, r, n);
+
+ if (s->hl == DRAW_MOUSE_FACE)
+ {
+ face = FACE_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id);
+ if (!face)
+ face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
+ }
+ else
+ face = FACE_FROM_ID (s->f, s->first_glyph->face_id);
+
+ bgCol = ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f);
+ fgCol = ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f);
+
for (i=0; i<n; i++)
{
if (!s->row->full_width_p)
{
+ int overrun, leftoverrun;
+
/* truncate to avoid overwriting fringe and/or scrollbar */
- int overrun = max (0, (s->x + s->background_width)
- - (WINDOW_BOX_RIGHT_EDGE_X (s->w)
- - WINDOW_RIGHT_FRINGE_WIDTH (s->w)));
+ overrun = max (0, (s->x + s->background_width)
+ - (WINDOW_BOX_RIGHT_EDGE_X (s->w)
+ - WINDOW_RIGHT_FRINGE_WIDTH (s->w)));
r[i].size.width -= overrun;
+ /* truncate to avoid overwriting to left of the window box */
+ leftoverrun = (WINDOW_BOX_LEFT_EDGE_X (s->w)
+ + WINDOW_LEFT_FRINGE_WIDTH (s->w)) - s->x;
+
+ if (leftoverrun > 0)
+ {
+ r[i].origin.x += leftoverrun;
+ r[i].size.width -= leftoverrun;
+ }
+
/* XXX: Try to work between problem where a stretch glyph on
a partially-visible bottom row will clear part of the
modeline, and another where list-buffers headers and similar
@@ -2998,30 +3143,37 @@ ns_dumpglyphs_stretch (struct glyph_string *s)
FRAME_PIXEL_WIDTH (s->f));
}
+ [bgCol set];
+
/* NOTE: under NS this is NOT used to draw cursors, but we must avoid
overwriting cursor (usually when cursor on a tab) */
if (s->hl == DRAW_CURSOR)
{
- r[i].origin.x += s->width;
- r[i].size.width -= s->width;
- }
- }
+ CGFloat x, width;
- ns_focus (s->f, r, n);
+ x = r[i].origin.x;
+ width = s->w->phys_cursor_width;
+ r[i].size.width -= width;
+ r[i].origin.x += width;
- if (s->hl == DRAW_MOUSE_FACE)
- {
- face = FACE_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id);
- if (!face)
- face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
- }
- else
- face = FACE_FROM_ID (s->f, s->first_glyph->face_id);
+ NSRectFill (r[i]);
- [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f) set];
+ /* Draw overlining, etc. on the cursor. */
+ if (s->w->phys_cursor_type == FILLED_BOX_CURSOR)
+ ns_draw_text_decoration (s, face, bgCol, width, x);
+ else
+ ns_draw_text_decoration (s, face, fgCol, width, x);
+ }
+ else
+ {
+ NSRectFill (r[i]);
+ }
- NSRectFill (r[0]);
- NSRectFill (r[1]);
+ /* Draw overlining, etc. on the stretch glyph (or the part
+ of the stretch glyph after the cursor). */
+ ns_draw_text_decoration (s, face, fgCol, r[i].size.width,
+ r[i].origin.x);
+ }
ns_unfocus (s->f);
s->background_filled_p = 1;
}
@@ -6556,23 +6708,17 @@ Only works on OSX 10.6 or later. */);
Vx_toolkit_scroll_bars = Qnil;
#endif
- /* these are unsupported but we need the declarations to avoid whining
- messages from cus-start.el */
DEFVAR_BOOL ("x-use-underline-position-properties",
x_use_underline_position_properties,
- doc: /* NOT SUPPORTED UNDER NS.
-*Non-nil means make use of UNDERLINE_POSITION font properties.
+ doc: /*Non-nil means make use of UNDERLINE_POSITION font properties.
A value of nil means ignore them. If you encounter fonts with bogus
UNDERLINE_POSITION font properties, for example 7x13 on XFree prior
-to 4.1, set this to nil.
-
-NOTE: Not supported on Mac yet. */);
+to 4.1, set this to nil. */);
x_use_underline_position_properties = 0;
DEFVAR_BOOL ("x-underline-at-descent-line",
x_underline_at_descent_line,
- doc: /* NOT SUPPORTED UNDER NS.
-*Non-nil means to draw the underline at the same place as the descent line.
+ doc: /* Non-nil means to draw the underline at the same place as the descent line.
A value of nil means to draw the underline according to the value of the
variable `x-use-underline-position-properties', which is usually at the
baseline level. The default value is nil. */);
diff --git a/src/print.c b/src/print.c
index f1907a31465..35f89860843 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1536,13 +1536,19 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
else
confusing = 0;
+ size_byte = SBYTES (name);
+
if (! NILP (Vprint_gensym) && !SYMBOL_INTERNED_P (obj))
{
PRINTCHAR ('#');
PRINTCHAR (':');
}
-
- size_byte = SBYTES (name);
+ else if (size_byte == 0)
+ {
+ PRINTCHAR ('#');
+ PRINTCHAR ('#');
+ break;
+ }
for (i = 0, i_byte = 0; i_byte < size_byte;)
{
@@ -1555,7 +1561,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
{
if (c == '\"' || c == '\\' || c == '\''
|| c == ';' || c == '#' || c == '(' || c == ')'
- || c == ',' || c =='.' || c == '`'
+ || c == ',' || c == '.' || c == '`'
|| c == '[' || c == ']' || c == '?' || c <= 040
|| confusing)
PRINTCHAR ('\\'), confusing = 0;