bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#10736: Add "underwave" face attribute


From: Aurélien Aptel
Subject: bug#10736: Add "underwave" face attribute
Date: Mon, 6 Feb 2012 13:00:54 +0100

Changelog
=========

2012-02-06  Aurélien Aptel  <aurelien.aptel@gmail.com>

        Add underwave face attribute for X11, W32 and NextStep.


Summary of the changes
======================

The :underline attribute has now a new way to be set:

(:color color :style style)
   If `color' is a string, underline in it.
   If `color' is `foreground-color', underline with the
   foreground color of the face.

   If `style' is `wave' underline with a wave.
   If `style' is `line' underline with a line.

   If the attribute :color is omited, underline with the
   foreground color of the face.
   If the attribute :style is omited, underline with a line.

All the previous ways to set :underline behave the same.

Customize menu
--------------

The customize menu now looks like this:

 Underline: [Off/On]
   Color: [Foreground color/...]
   Style: [Line/Wave]

Implementation
--------------

-- src/dispextern.h --

Add a new enum for the underlining type.

 enum face_underline_type {
      FACE_UNDER_LINE,
      FACE_UNDER_WAVE,
 };

And a new field in struct face.

 struct face {
        ...
        enum face_underline_type underline_type;
        ...
 };

-- src/xterm.c --

Update X11 backend.

* Add x_draw_underwave().
* The wave is computed from the distance to the left margin so that
  there is no artifact when drawing 2 consecutive waves.
* The drawing is clipped in order to not overlap.

  static void
  x_draw_underwave (struct glyph_string *s)

* Add a new codepath in x_draw_glyph_string() to handle the new style.

 /* Draw underline.  */
 if (s->face->underline_p)
   {
     if (s->face->underline_type == FACE_UNDER_WAVE)
       {
          ...new code...
       }
     else if (s->face->underline_type == FACE_UNDER_LINE)
       {
           ...re-indented old code...
       }

-- src/w32term.m --
-- src/nsterm.c --

Same change made to src/xterm.c, basically.
Just replaced line drawing primitive by the system one.

* Juanma Barranquero helped on the W32 port.
* Alp Aker helped on the NextStep port.

-- src/xfaces.c --

Add List_Object for symbol `line' and `wave'.
Reuse Qforeground_color, QCstyle, QCcolor.
Change checks made to :underline value to accept CONS construct.
Handle CONS construct when updating struct face attribute.

-- lisp/faces.el --
-- doc/lispref/display.texi --

Update :underline documentation

-- lisp/cus-face.el --

Update customize menu for :underline.

(:underline
 (choice :tag "Underline"
        :help-echo "Control text underlining."
        (const :tag "Off" nil)
        (list :tag "On"
          (const :format "" :value :color)
          (choice :tag "Color" (const :tag "Foreground Color"
foreground-color) color)
              (const :format "" :value :style)
              (choice :tag "Style"
                      (const :tag "Line" line)
                      (const :tag "Wave" wave)))))

Attachment: underwave-clip-3.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]