summaryrefslogtreecommitdiffstats
path: root/src/libnrtype
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2008-11-21 05:24:08 +0000
committerTed Gould <ted@canonical.com>2008-11-21 05:24:08 +0000
commit44a3a78fb6a3863c0c7f3c1193837337e68a67e4 (patch)
tree1722ee5ec6f88c881cd4124923354b3c1311501b /src/libnrtype
parentMerge from trunk (diff)
downloadinkscape-44a3a78fb6a3863c0c7f3c1193837337e68a67e4.tar.gz
inkscape-44a3a78fb6a3863c0c7f3c1193837337e68a67e4.zip
Merge from fe-moved
(bzr r6891)
Diffstat (limited to 'src/libnrtype')
-rw-r--r--src/libnrtype/FontInstance.cpp4
-rw-r--r--src/libnrtype/Layout-TNG-Compute.cpp2
-rw-r--r--src/libnrtype/Layout-TNG-Input.cpp8
-rw-r--r--src/libnrtype/Layout-TNG-OutIter.cpp2
-rw-r--r--src/libnrtype/Layout-TNG-Output.cpp2
-rw-r--r--src/libnrtype/Layout-TNG.h2
-rw-r--r--src/libnrtype/RasterFont.cpp2
-rw-r--r--src/libnrtype/font-instance.h2
8 files changed, 16 insertions, 8 deletions
diff --git a/src/libnrtype/FontInstance.cpp b/src/libnrtype/FontInstance.cpp
index d7d45b1e3..e1413b46e 100644
--- a/src/libnrtype/FontInstance.cpp
+++ b/src/libnrtype/FontInstance.cpp
@@ -615,7 +615,7 @@ bool font_instance::FontSlope(double &run, double &rise)
return true;
}
-boost::optional<Geom::Rect> font_instance::BBox(int glyph_id)
+Geom::OptRect font_instance::BBox(int glyph_id)
{
int no=-1;
if ( id_to_no.find(glyph_id) == id_to_no.end() ) {
@@ -629,7 +629,7 @@ boost::optional<Geom::Rect> font_instance::BBox(int glyph_id)
no=id_to_no[glyph_id];
}
if ( no < 0 ) {
- return boost::optional<Geom::Rect>();
+ return Geom::OptRect();
} else {
Geom::Point rmin(glyphs[no].bbox[0],glyphs[no].bbox[1]);
Geom::Point rmax(glyphs[no].bbox[2],glyphs[no].bbox[3]);
diff --git a/src/libnrtype/Layout-TNG-Compute.cpp b/src/libnrtype/Layout-TNG-Compute.cpp
index 57be6033a..2e65c2b24 100644
--- a/src/libnrtype/Layout-TNG-Compute.cpp
+++ b/src/libnrtype/Layout-TNG-Compute.cpp
@@ -615,7 +615,6 @@ class Layout::Calculator
iter_source_text++;
char_index_in_unbroken_span++;
char_byte = iter_source_text.base() - unbroken_span.input_stream_first_character.base();
- glyph_rotate = 0.0;
}
advance_width *= direction_sign;
@@ -1014,6 +1013,7 @@ unsigned Layout::Calculator::_buildSpansForPara(ParagraphInfo *para) const
if (text_source->dy.size() > char_index_in_source) new_span.dx = text_source->dy[char_index_in_source];
}
if (text_source->rotate.size() > char_index_in_source) new_span.rotate = text_source->rotate[char_index_in_source];
+ else if (char_index_in_source == 0) new_span.rotate = 0.f;
if (input_index == 0 && para->unbroken_spans.empty() && !new_span.y._set && _flow._input_wrap_shapes.empty()) {
// if we don't set an explicit y some of the automatic wrapping code takes over and moves the text vertically
// so that the top of the letters is at zero, not the baseline
diff --git a/src/libnrtype/Layout-TNG-Input.cpp b/src/libnrtype/Layout-TNG-Input.cpp
index a5ae1cd81..2ee0051a4 100644
--- a/src/libnrtype/Layout-TNG-Input.cpp
+++ b/src/libnrtype/Layout-TNG-Input.cpp
@@ -54,6 +54,14 @@ void Layout::appendText(Glib::ustring const &text, SPStyle *style, void *source_
_copyInputVector(optional_attributes->dx, optional_attributes_offset, &new_source->dx, new_source->text_length);
_copyInputVector(optional_attributes->dy, optional_attributes_offset, &new_source->dy, new_source->text_length);
_copyInputVector(optional_attributes->rotate, optional_attributes_offset, &new_source->rotate, new_source->text_length);
+ if (!optional_attributes->rotate.empty() && optional_attributes_offset >= optional_attributes->rotate.size()) {
+ SVGLength last_rotate;
+ last_rotate = 0.f;
+ for (std::vector<SVGLength>::const_iterator it = optional_attributes->rotate.begin() ; it != optional_attributes->rotate.end() ; ++it)
+ if (it->_set)
+ last_rotate = *it;
+ new_source->rotate.resize(1, last_rotate);
+ }
}
_input_stream.push_back(new_source);
diff --git a/src/libnrtype/Layout-TNG-OutIter.cpp b/src/libnrtype/Layout-TNG-OutIter.cpp
index abe282005..bbd4aa6fd 100644
--- a/src/libnrtype/Layout-TNG-OutIter.cpp
+++ b/src/libnrtype/Layout-TNG-OutIter.cpp
@@ -200,7 +200,7 @@ Layout::iterator Layout::sourceToIterator(void *source_cookie) const
return sourceToIterator(source_cookie, Glib::ustring::const_iterator(std::string::const_iterator(NULL)));
}
-boost::optional<Geom::Rect> Layout::glyphBoundingBox(iterator const &it, double *rotation) const
+Geom::OptRect Layout::glyphBoundingBox(iterator const &it, double *rotation) const
{
if (rotation) *rotation = _glyphs[it._glyph_index].rotation;
return _glyphs[it._glyph_index].span(this).font->BBox(_glyphs[it._glyph_index].glyph);
diff --git a/src/libnrtype/Layout-TNG-Output.cpp b/src/libnrtype/Layout-TNG-Output.cpp
index a93993c56..49967cd59 100644
--- a/src/libnrtype/Layout-TNG-Output.cpp
+++ b/src/libnrtype/Layout-TNG-Output.cpp
@@ -117,7 +117,7 @@ void Layout::getBoundingBox(NRRect *bounding_box, Geom::Matrix const &transform,
Geom::Matrix total_transform = glyph_matrix;
total_transform *= transform;
if(_glyphs[glyph_index].span(this).font) {
- boost::optional<Geom::Rect> glyph_rect = _glyphs[glyph_index].span(this).font->BBox(_glyphs[glyph_index].glyph);
+ Geom::OptRect glyph_rect = _glyphs[glyph_index].span(this).font->BBox(_glyphs[glyph_index].glyph);
if (glyph_rect) {
Geom::Point bmi = glyph_rect->min(), bma = glyph_rect->max();
Geom::Point tlp(bmi[0],bmi[1]), trp(bma[0],bmi[1]), blp(bmi[0],bma[1]), brp(bma[0],bma[1]);
diff --git a/src/libnrtype/Layout-TNG.h b/src/libnrtype/Layout-TNG.h
index 3d0c57288..19680b140 100644
--- a/src/libnrtype/Layout-TNG.h
+++ b/src/libnrtype/Layout-TNG.h
@@ -449,7 +449,7 @@ public:
/** Returns the bounding box of the given glyph, and its rotation.
The centre of rotation is the horizontal centre of the box at the
text baseline. */
- boost::optional<Geom::Rect> glyphBoundingBox(iterator const &it, double *rotation) const;
+ Geom::OptRect glyphBoundingBox(iterator const &it, double *rotation) const;
/** Returns the zero-based line number of the character pointed to by
\a it. */
diff --git a/src/libnrtype/RasterFont.cpp b/src/libnrtype/RasterFont.cpp
index 3fbbe62d7..14f6c7afa 100644
--- a/src/libnrtype/RasterFont.cpp
+++ b/src/libnrtype/RasterFont.cpp
@@ -107,7 +107,7 @@ void raster_font::BBox(int glyph_id,NRRect *area)
{
area->x0=area->y0=area->x1=area->y1=0;
if ( daddy == NULL ) return;
- boost::optional<Geom::Rect> res=daddy->BBox(glyph_id);
+ Geom::OptRect res=daddy->BBox(glyph_id);
if (res) {
Geom::Point bmi=res->min(),bma=res->max();
Geom::Point tlp(bmi[0],bmi[1]),trp(bma[0],bmi[1]),blp(bmi[0],bma[1]),brp(bma[0],bma[1]);
diff --git a/src/libnrtype/font-instance.h b/src/libnrtype/font-instance.h
index 2c8340e8a..4209a20af 100644
--- a/src/libnrtype/font-instance.h
+++ b/src/libnrtype/font-instance.h
@@ -78,7 +78,7 @@ public:
bool FontMetrics(double &ascent, double &descent, double &leading);
bool FontSlope(double &run, double &rise);
// for generating slanted cursors for oblique fonts
- boost::optional<Geom::Rect> BBox(int glyph_id);
+ Geom::OptRect BBox(int glyph_id);
// creates a rasterfont for the given style
raster_font* RasterFont(Geom::Matrix const &trs, double stroke_width,