summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Neumann <sven@gimp.org>2003-05-28 00:22:54 +0000
committerSven Neumann <neo@src.gnome.org>2003-05-28 00:22:54 +0000
commit385c32134f499fa3fbe42a9bd2660b4fc9311950 (patch)
tree458d0be5495f121e6adecd112bf9940f9a92d1d5
parent3ec3c482689837c48e633ed9ec35d2ce0334c47a (diff)
downloadpango-385c32134f499fa3fbe42a9bd2660b4fc9311950.tar.gz
added support for rise, strikethru and shape attributes. (#109900).
2003-05-28 Sven Neumann <sven@gimp.org> * pango/pangoft2.c (pango_ft2_render): added support for rise, strikethru and shape attributes. (#109900).
-rw-r--r--ChangeLog5
-rw-r--r--ChangeLog.pre-1-105
-rw-r--r--ChangeLog.pre-1-45
-rw-r--r--ChangeLog.pre-1-65
-rw-r--r--ChangeLog.pre-1-85
-rw-r--r--pango/pangoft2.c138
6 files changed, 107 insertions, 56 deletions
diff --git a/ChangeLog b/ChangeLog
index b1e9bd31..d757c974 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-05-28 Sven Neumann <sven@gimp.org>
+
+ * pango/pangoft2.c (pango_ft2_render): added support for rise,
+ strikethru and shape attributes. (#109900).
+
Tue May 27 18:37:44 2003 Owen Taylor <otaylor@redhat.com>
* pango/mini-fribidi/fribidi.c (fribidi_analyse_string):
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index b1e9bd31..d757c974 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,3 +1,8 @@
+2003-05-28 Sven Neumann <sven@gimp.org>
+
+ * pango/pangoft2.c (pango_ft2_render): added support for rise,
+ strikethru and shape attributes. (#109900).
+
Tue May 27 18:37:44 2003 Owen Taylor <otaylor@redhat.com>
* pango/mini-fribidi/fribidi.c (fribidi_analyse_string):
diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4
index b1e9bd31..d757c974 100644
--- a/ChangeLog.pre-1-4
+++ b/ChangeLog.pre-1-4
@@ -1,3 +1,8 @@
+2003-05-28 Sven Neumann <sven@gimp.org>
+
+ * pango/pangoft2.c (pango_ft2_render): added support for rise,
+ strikethru and shape attributes. (#109900).
+
Tue May 27 18:37:44 2003 Owen Taylor <otaylor@redhat.com>
* pango/mini-fribidi/fribidi.c (fribidi_analyse_string):
diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6
index b1e9bd31..d757c974 100644
--- a/ChangeLog.pre-1-6
+++ b/ChangeLog.pre-1-6
@@ -1,3 +1,8 @@
+2003-05-28 Sven Neumann <sven@gimp.org>
+
+ * pango/pangoft2.c (pango_ft2_render): added support for rise,
+ strikethru and shape attributes. (#109900).
+
Tue May 27 18:37:44 2003 Owen Taylor <otaylor@redhat.com>
* pango/mini-fribidi/fribidi.c (fribidi_analyse_string):
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index b1e9bd31..d757c974 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,3 +1,8 @@
+2003-05-28 Sven Neumann <sven@gimp.org>
+
+ * pango/pangoft2.c (pango_ft2_render): added support for rise,
+ strikethru and shape attributes. (#109900).
+
Tue May 27 18:37:44 2003 Owen Taylor <otaylor@redhat.com>
* pango/mini-fribidi/fribidi.c (fribidi_analyse_string):
diff --git a/pango/pangoft2.c b/pango/pangoft2.c
index d4ffdfa6..1e7f391b 100644
--- a/pango/pangoft2.c
+++ b/pango/pangoft2.c
@@ -73,26 +73,28 @@ static void pango_ft2_font_class_init (PangoFT2FontClass *class);
static void pango_ft2_font_init (PangoFT2Font *ft2font);
static void pango_ft2_font_finalize (GObject *object);
-static PangoFontDescription *pango_ft2_font_describe (PangoFont *font);
+static PangoFontDescription *pango_ft2_font_describe (PangoFont *font);
-static PangoEngineShape * pango_ft2_font_find_shaper (PangoFont *font,
- PangoLanguage *language,
- guint32 ch);
+static PangoEngineShape * pango_ft2_font_find_shaper (PangoFont *font,
+ PangoLanguage *language,
+ guint32 ch);
-static void pango_ft2_font_get_glyph_extents (PangoFont *font,
- PangoGlyph glyph,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect);
+static void pango_ft2_font_get_glyph_extents (PangoFont *font,
+ PangoGlyph glyph,
+ PangoRectangle *ink_rect,
+ PangoRectangle *logical_rect);
-static PangoFontMetrics * pango_ft2_font_get_metrics (PangoFont *font,
- PangoLanguage *language);
+static PangoFontMetrics * pango_ft2_font_get_metrics (PangoFont *font,
+ PangoLanguage *language);
-static void pango_ft2_get_item_properties (PangoItem *item,
- PangoUnderline *uline,
- PangoAttrColor *fg_color,
- gboolean *fg_set,
- PangoAttrColor *bg_color,
- gboolean *bg_set);
+static void pango_ft2_get_item_properties (PangoItem *item,
+ PangoUnderline *uline,
+ gboolean *strikethrough,
+ gint *rise,
+ gboolean *shape_set,
+ PangoRectangle *ink_rect,
+ PangoRectangle *logical_rect);
+
static GType pango_ft2_font_get_type (void);
@@ -852,50 +854,66 @@ pango_ft2_render_layout_line (FT_Bitmap *bitmap,
PangoRectangle ink_rect;
int x_off = 0;
- pango_layout_line_get_extents (line,NULL, &overall_rect);
+ pango_layout_line_get_extents (line, NULL, &overall_rect);
while (tmp_list)
{
PangoUnderline uline = PANGO_UNDERLINE_NONE;
+ gboolean strike, shape_set;
+ gint rise, risen_y;
PangoLayoutRun *run = tmp_list->data;
- PangoAttrColor fg_color, bg_color;
- gboolean fg_set, bg_set;
-
+
tmp_list = tmp_list->next;
- pango_ft2_get_item_properties (run->item, &uline, &fg_color, &fg_set, &bg_color, &bg_set);
+ pango_ft2_get_item_properties (run->item,
+ &uline, &strike, &rise,
+ &shape_set, &ink_rect, &logical_rect);
- if (uline == PANGO_UNDERLINE_NONE)
- pango_glyph_string_extents (run->glyphs, run->item->analysis.font,
- NULL, &logical_rect);
- else
- pango_glyph_string_extents (run->glyphs, run->item->analysis.font,
- &ink_rect, &logical_rect);
+ risen_y = y - PANGO_PIXELS (rise);
- pango_ft2_render (bitmap, run->item->analysis.font, run->glyphs,
- x + PANGO_PIXELS (x_off), y);
+ if (!shape_set)
+ {
+ if (uline == PANGO_UNDERLINE_NONE)
+ pango_glyph_string_extents (run->glyphs, run->item->analysis.font,
+ NULL, &logical_rect);
+ else
+ pango_glyph_string_extents (run->glyphs, run->item->analysis.font,
+ &ink_rect, &logical_rect);
+
+ pango_ft2_render (bitmap, run->item->analysis.font, run->glyphs,
+ x + PANGO_PIXELS (x_off), risen_y);
+ }
switch (uline)
{
case PANGO_UNDERLINE_NONE:
break;
case PANGO_UNDERLINE_DOUBLE:
- pango_ft2_draw_hline (bitmap, y + 4,
+ pango_ft2_draw_hline (bitmap,
+ risen_y + 4,
x + PANGO_PIXELS (x_off + ink_rect.x),
x + PANGO_PIXELS (x_off + ink_rect.x + ink_rect.width));
/* Fall through */
case PANGO_UNDERLINE_SINGLE:
- pango_ft2_draw_hline (bitmap, y + 2,
+ pango_ft2_draw_hline (bitmap,
+ risen_y + 2,
x + PANGO_PIXELS (x_off + ink_rect.x),
x + PANGO_PIXELS (x_off + ink_rect.x + ink_rect.width));
break;
case PANGO_UNDERLINE_LOW:
- pango_ft2_draw_hline (bitmap, y + PANGO_PIXELS (ink_rect.y + ink_rect.height),
+ pango_ft2_draw_hline (bitmap,
+ risen_y + PANGO_PIXELS (ink_rect.y + ink_rect.height),
x + PANGO_PIXELS (x_off + ink_rect.x),
x + PANGO_PIXELS (x_off + ink_rect.x + ink_rect.width));
break;
}
+ if (strike)
+ pango_ft2_draw_hline (bitmap,
+ risen_y + PANGO_PIXELS (logical_rect.y + logical_rect.height / 2),
+ x + PANGO_PIXELS (x_off + logical_rect.x),
+ x + PANGO_PIXELS (x_off + logical_rect.x + logical_rect.width));
+
x_off += logical_rect.width;
}
}
@@ -949,19 +967,23 @@ pango_ft2_render_layout (FT_Bitmap *bitmap,
static void
pango_ft2_get_item_properties (PangoItem *item,
PangoUnderline *uline,
- PangoAttrColor *fg_color,
- gboolean *fg_set,
- PangoAttrColor *bg_color,
- gboolean *bg_set)
+ gboolean *strikethrough,
+ gint *rise,
+ gboolean *shape_set,
+ PangoRectangle *ink_rect,
+ PangoRectangle *logical_rect)
{
GSList *tmp_list = item->analysis.extra_attrs;
- if (fg_set)
- *fg_set = FALSE;
-
- if (bg_set)
- *bg_set = FALSE;
-
+ if (strikethrough)
+ *strikethrough = FALSE;
+
+ if (rise)
+ *rise = 0;
+
+ if (shape_set)
+ *shape_set = FALSE;
+
while (tmp_list)
{
PangoAttribute *attr = tmp_list->data;
@@ -973,25 +995,29 @@ pango_ft2_get_item_properties (PangoItem *item,
*uline = ((PangoAttrInt *)attr)->value;
break;
- case PANGO_ATTR_FOREGROUND:
- if (fg_color)
- *fg_color = *((PangoAttrColor *)attr);
- if (fg_set)
- *fg_set = TRUE;
-
+ case PANGO_ATTR_STRIKETHROUGH:
+ if (strikethrough)
+ *strikethrough = ((PangoAttrInt *)attr)->value;
break;
-
- case PANGO_ATTR_BACKGROUND:
- if (bg_color)
- *bg_color = *((PangoAttrColor *)attr);
- if (bg_set)
- *bg_set = TRUE;
-
+
+ case PANGO_ATTR_SHAPE:
+ if (shape_set)
+ *shape_set = TRUE;
+ if (logical_rect)
+ *logical_rect = ((PangoAttrShape *)attr)->logical_rect;
+ if (ink_rect)
+ *ink_rect = ((PangoAttrShape *)attr)->ink_rect;
break;
-
+
+ case PANGO_ATTR_RISE:
+ if (rise)
+ *rise = ((PangoAttrInt *)attr)->value;
+ break;
+
default:
break;
}
+
tmp_list = tmp_list->next;
}
}