summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@src.gnome.org>2004-02-29 20:46:30 +0000
committerOwen Taylor <otaylor@src.gnome.org>2004-02-29 20:46:30 +0000
commit25c8ec71bed7f5daa42b17220e0bf00a1ef1e3bc (patch)
treedd9deb76034448b2e12777d8a62df99405f6388b /pango
parentb1a7956a523e80a793461cc11d8d15c6b51b4dcc (diff)
downloadpango-25c8ec71bed7f5daa42b17220e0bf00a1ef1e3bc.tar.gz
un Feb 29 15:31:09 2004 Owen Taylor <otaylor@redhat.com>
Patch from Nicolas Setton, #114237 * pango/pango-attributes.h pango/pango-markup.c: Add a new underline type, PANGO_UNDERLINE_ERROR. * pango/pangowin32.c pango/pangox.c pango/pangoft2.c: Implement drawing of PANGO_UNDERLINE_ERROR. * pango/pango-layout.c (pango_layout_run_get_extents): Handle PANGO_UNDERLINE_ERROR.
Diffstat (limited to 'pango')
-rw-r--r--pango/pango-attributes.h3
-rw-r--r--pango/pango-layout.c6
-rw-r--r--pango/pango-markup.c2
-rw-r--r--pango/pangoft2.c23
-rw-r--r--pango/pangowin32.c23
-rw-r--r--pango/pangox.c21
6 files changed, 77 insertions, 1 deletions
diff --git a/pango/pango-attributes.h b/pango/pango-attributes.h
index 30a2fb24..48241860 100644
--- a/pango/pango-attributes.h
+++ b/pango/pango-attributes.h
@@ -88,7 +88,8 @@ typedef enum {
PANGO_UNDERLINE_NONE,
PANGO_UNDERLINE_SINGLE,
PANGO_UNDERLINE_DOUBLE,
- PANGO_UNDERLINE_LOW
+ PANGO_UNDERLINE_LOW,
+ PANGO_UNDERLINE_ERROR,
} PangoUnderline;
struct _PangoAttribute
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 645aba6a..c09d238f 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -3595,6 +3595,12 @@ pango_layout_run_get_extents (PangoLayoutRun *run,
{
case PANGO_UNDERLINE_NONE:
break;
+ case PANGO_UNDERLINE_ERROR:
+ if (run_ink)
+ run_ink->height = MAX (run_ink->height, 3 * PANGO_SCALE - run_ink->y);
+ if (run_logical)
+ run_logical->height = MAX (run_logical->height, 3 * PANGO_SCALE - run_logical->y);
+ break;
case PANGO_UNDERLINE_SINGLE:
if (run_ink)
run_ink->height = MAX (run_ink->height, 2 * PANGO_SCALE - run_ink->y);
diff --git a/pango/pango-markup.c b/pango/pango-markup.c
index 3764fdcb..a4bd108c 100644
--- a/pango/pango-markup.c
+++ b/pango/pango-markup.c
@@ -1151,6 +1151,8 @@ span_parse_func (MarkupData *md,
ul = PANGO_UNDERLINE_DOUBLE;
else if (strcmp (underline, "low") == 0)
ul = PANGO_UNDERLINE_LOW;
+ else if (strcmp (underline, "error") == 0)
+ ul = PANGO_UNDERLINE_ERROR;
else if (strcmp (underline, "none") == 0)
ul = PANGO_UNDERLINE_NONE;
else
diff --git a/pango/pangoft2.c b/pango/pangoft2.c
index cc1b4c54..a6706c76 100644
--- a/pango/pangoft2.c
+++ b/pango/pangoft2.c
@@ -807,6 +807,29 @@ pango_ft2_render_layout_line (FT_Bitmap *bitmap,
x + PANGO_PIXELS (x_off + ink_rect.x),
x + PANGO_PIXELS (x_off + ink_rect.x + ink_rect.width));
break;
+ case PANGO_UNDERLINE_ERROR:
+ {
+ int point_x;
+ int counter = 0;
+ int end_x = x + PANGO_PIXELS (x_off + ink_rect.x + ink_rect.width);
+
+ for (point_x = x + PANGO_PIXELS (x_off + ink_rect.x) - 1;
+ point_x < end_x;
+ point_x += 2)
+ {
+ if (counter)
+ pango_ft2_draw_hline (bitmap,
+ risen_y + 2,
+ point_x, MIN (point_x + 1, end_x));
+ else
+ pango_ft2_draw_hline (bitmap,
+ risen_y + 3,
+ point_x, MIN (point_x + 1, end_x));
+
+ counter = (counter + 1) % 2;
+ }
+ }
+ break;
case PANGO_UNDERLINE_LOW:
pango_ft2_draw_hline (bitmap,
risen_y + PANGO_PIXELS (ink_rect.y + ink_rect.height),
diff --git a/pango/pangowin32.c b/pango/pangowin32.c
index 97e84d46..d143aef9 100644
--- a/pango/pangowin32.c
+++ b/pango/pangowin32.c
@@ -801,6 +801,29 @@ pango_win32_render_layout_line (HDC hdc,
points[0].y = points[1].y = y + 2;
Polyline (hdc, points, 2);
break;
+ case PANGO_UNDERLINE_ERROR:
+ {
+ int point_x;
+ int counter = 0;
+ int end_x = x + PANGO_PIXELS (x_off + ink_rect.x + ink_rect.width);
+
+ for (point_x = x + PANGO_PIXELS (x_off + ink_rect.x) - 1;
+ point_x < end_x;
+ point_x += 2)
+ {
+ points[0].x = point_x;
+ points[1].x = MAX (point_x + 1, end_x);
+
+ if (counter)
+ points[0].y = points[1].y = y + 2;
+ else
+ points[0].y = points[1].y = y + 3;
+
+ Polyline (hdc, points, 2);
+ counter = (counter + 1) % 2;
+ }
+ }
+ break;
case PANGO_UNDERLINE_LOW:
points[0].x = x + PANGO_PIXELS (x_off + ink_rect.x) - 1;
points[0].y = points[1].y = y + PANGO_PIXELS (ink_rect.y + ink_rect.height) + 2;
diff --git a/pango/pangox.c b/pango/pangox.c
index 91c3c75e..f0708ffa 100644
--- a/pango/pangox.c
+++ b/pango/pangox.c
@@ -1500,6 +1500,27 @@ pango_x_render_layout_line (Display *display,
x + (x_off + ink_rect.x) / PANGO_SCALE - 1, y + 2,
x + (x_off + ink_rect.x + ink_rect.width) / PANGO_SCALE, y + 2);
break;
+ case PANGO_UNDERLINE_ERROR:
+ {
+ int point_x;
+ int counter = 0;
+ int end_x = x + (x_off + ink_rect.x + ink_rect.width) / PANGO_SCALE;
+
+ for (point_x = x + PANGO_PIXELS (x_off + ink_rect.x) - 1;
+ point_x < end_x;
+ point_x += 2)
+ {
+ if (counter)
+ XDrawLine (display, drawable, gc,
+ point_x, y + 2, MIN (point_x + 1, end_x), y + 2);
+ else
+ XDrawLine (display, drawable, gc,
+ point_x, y + 3, MIN (point_x + 1, end_x), y + 3);
+
+ counter = (counter + 1) % 2;
+ }
+ }
+ break;
case PANGO_UNDERLINE_LOW:
XDrawLine (display, drawable, fg_gc,
x + (x_off + ink_rect.x) / PANGO_SCALE - 1, y + (ink_rect.y + ink_rect.height) / PANGO_SCALE + 2,