summaryrefslogtreecommitdiffstats
path: root/src/sp-text.cpp
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2010-05-14 20:13:53 +0000
committertavmjong-free <tavmjong@free.fr>2010-05-14 20:13:53 +0000
commitf1b28615cb0ce50d3e0d9ba841d700a2905fdbec (patch)
tree9f79944a2155574686f05d1dd59042cf1b42e35b /src/sp-text.cpp
parentTranslations. Belarusian translation by Hleb Valoshka. (diff)
downloadinkscape-f1b28615cb0ce50d3e0d9ba841d700a2905fdbec.tar.gz
inkscape-f1b28615cb0ce50d3e0d9ba841d700a2905fdbec.zip
Add dx (kerning), dy (vertical shifting), and rotate widgets to
text toolbar along with routines needed by them. (bzr r9417)
Diffstat (limited to 'src/sp-text.cpp')
-rw-r--r--src/sp-text.cpp72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/sp-text.cpp b/src/sp-text.cpp
index 11665b890..0f21b59d1 100644
--- a/src/sp-text.cpp
+++ b/src/sp-text.cpp
@@ -926,6 +926,50 @@ void TextTagAttributes::transform(Geom::Matrix const &matrix, double scale_x, do
*it = it->computed * scale_y;
}
+double TextTagAttributes::getDx(unsigned index)
+{
+ if( attributes.dx.size() == 0 ) {
+ return 0.0;
+ }
+ if( index < attributes.dx.size() ) {
+ return attributes.dx[index].computed;
+ } else {
+ return 0.0; // attributes.dx.back().computed;
+ }
+}
+
+
+double TextTagAttributes::getDy(unsigned index)
+{
+ if( attributes.dy.size() == 0 ) {
+ return 0.0;
+ }
+ if( index < attributes.dy.size() ) {
+ return attributes.dy[index].computed;
+ } else {
+ return 0.0; // attributes.dy.back().computed;
+ }
+}
+
+
+void TextTagAttributes::addToDx(unsigned index, double delta)
+{
+ SVGLength zero_length;
+ zero_length = 0.0;
+
+ if (attributes.dx.size() < index + 1) attributes.dx.resize(index + 1, zero_length);
+ attributes.dx[index] = attributes.dx[index].computed + delta;
+}
+
+void TextTagAttributes::addToDy(unsigned index, double delta)
+{
+ SVGLength zero_length;
+ zero_length = 0.0;
+
+ if (attributes.dy.size() < index + 1) attributes.dy.resize(index + 1, zero_length);
+ attributes.dy[index] = attributes.dy[index].computed + delta;
+}
+
void TextTagAttributes::addToDxDy(unsigned index, Geom::Point const &adjust)
{
SVGLength zero_length;
@@ -941,6 +985,19 @@ void TextTagAttributes::addToDxDy(unsigned index, Geom::Point const &adjust)
}
}
+double TextTagAttributes::getRotate(unsigned index)
+{
+ if( attributes.rotate.size() == 0 ) {
+ return 0.0;
+ }
+ if( index < attributes.rotate.size() ) {
+ return attributes.rotate[index].computed;
+ } else {
+ return attributes.rotate.back().computed;
+ }
+}
+
+
void TextTagAttributes::addToRotate(unsigned index, double delta)
{
SVGLength zero_length;
@@ -956,6 +1013,21 @@ void TextTagAttributes::addToRotate(unsigned index, double delta)
}
+void TextTagAttributes::setRotate(unsigned index, double angle)
+{
+ SVGLength zero_length;
+ zero_length = 0.0;
+
+ if (attributes.rotate.size() < index + 2) {
+ if (attributes.rotate.empty())
+ attributes.rotate.resize(index + 2, zero_length);
+ else
+ attributes.rotate.resize(index + 2, attributes.rotate.back());
+ }
+ attributes.rotate[index] = mod360(angle);
+}
+
+
/*
Local Variables:
mode:c++