[cairo-commit] libsvg/src svg_element.c, 1.37, 1.38 svg_style.c,
1.22, 1.23 svg_text.c, 1.14, 1.15 svgint.h, 1.46, 1.47
Keith Packard
commit at pdx.freedesktop.org
Tue Jul 19 07:34:56 PDT 2005
Committed by: keithp
Update of /cvs/cairo/libsvg/src
In directory gabe:/tmp/cvs-serv31138/src
Modified Files:
svg_element.c svg_style.c svg_text.c svgint.h
Log Message:
2005-07-19 Keith Packard <keithp at keithp.com>
* src/svg_element.c: (_svg_element_apply_attributes):
* src/svg_style.c: (_svg_style_render):
* src/svg_text.c: (_svg_text_render):
* src/svgint.h:
Pull text anchor support up into libsvg.
set_text_anchor left in engine to avoid breaking ABI.
Index: svg_element.c
===================================================================
RCS file: /cvs/cairo/libsvg/src/svg_element.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- svg_element.c 18 Jul 2005 21:55:06 -0000 1.37
+++ svg_element.c 19 Jul 2005 14:34:54 -0000 1.38
@@ -509,6 +509,7 @@
break;
case SVG_ELEMENT_TYPE_TEXT:
status = _svg_text_apply_attributes (&element->e.text, attributes);
+ element->e.text.text_anchor = element->style.text_anchor;
break;
case SVG_ELEMENT_TYPE_TSPAN:
status = _svg_tspan_apply_attributes (&element->e.tspan, attributes);
Index: svg_style.c
===================================================================
RCS file: /cvs/cairo/libsvg/src/svg_style.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- svg_style.c 12 May 2005 18:37:49 -0000 1.22
+++ svg_style.c 19 Jul 2005 14:34:54 -0000 1.23
@@ -909,12 +909,6 @@
return status;
}
- if (style->flags & SVG_STYLE_FLAG_TEXT_ANCHOR) {
- status = (engine->set_text_anchor) (closure, style->text_anchor);
- if (status)
- return status;
- }
-
return SVG_STATUS_SUCCESS;
}
Index: svg_text.c
===================================================================
RCS file: /cvs/cairo/libsvg/src/svg_text.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- svg_text.c 18 Jul 2005 21:55:06 -0000 1.14
+++ svg_text.c 19 Jul 2005 14:34:54 -0000 1.15
@@ -179,6 +179,22 @@
(engine->measure_position) (closure,
&text->group.x, &text->group.y, &x, &y);
+
+ if (text->text_anchor != SVG_TEXT_ANCHOR_START) {
+ _svg_text_extents (text, &w, &h, engine, closure);
+
+ switch (text->text_anchor) {
+ case SVG_TEXT_ANCHOR_END:
+ x -= w;
+ y -= h;
+ break;
+ case SVG_TEXT_ANCHOR_MIDDLE:
+ x -= w/2;
+ y -= h/2;
+ break;
+ }
+ }
+
for (e = 0; e < text->group.num_elements; e++)
{
status = (engine->begin_element) (closure);
Index: svgint.h
===================================================================
RCS file: /cvs/cairo/libsvg/src/svgint.h,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- svgint.h 18 Jul 2005 21:55:06 -0000 1.46
+++ svgint.h 19 Jul 2005 14:34:54 -0000 1.47
@@ -241,6 +241,7 @@
typedef struct svg_text {
struct svg_group group;
+ svg_text_anchor_t text_anchor;
} svg_text_t;
typedef struct svg_ellipse {
More information about the cairo-commit
mailing list