~ubuntu-branches/ubuntu/utopic/inkscape/utopic-proposed

« back to all changes in this revision

Viewing changes to src/libnrtype/Layout-TNG-OutIter.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alex Valavanis
  • Date: 2010-09-12 19:44:58 UTC
  • mfrom: (1.1.12 upstream) (45.1.3 maverick)
  • Revision ID: james.westby@ubuntu.com-20100912194458-4sjwmbl7dlsrk5dc
Tags: 0.48.0-1ubuntu1
* Merge with Debian unstable (LP: #628048, LP: #401567, LP: #456248, 
  LP: #463602, LP: #591986)
* debian/control: 
  - Ubuntu maintainers
  - Promote python-lxml, python-numpy, python-uniconvertor to Recommends.
  - Demote pstoedit to Suggests (universe package).
  - Suggests ttf-dejavu instead of ttf-bitstream-vera (LP: #513319)
* debian/rules:
  - Run intltool-update on build (Ubuntu-specific).
  - Add translation domain to .desktop files (Ubuntu-specific).
* debian/dirs:
  - Add usr/share/pixmaps.  Allow inkscape.xpm installation
* drop 50-poppler-API.dpatch (now upstream)
* drop 51-paste-in-unwritable-directory.dpatch (now upstream) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
221
221
    }
222
222
}
223
223
 
 
224
boost::optional<Geom::Point> Layout::baselineAnchorPoint() const
 
225
{
 
226
    iterator pos = this->begin();
 
227
    Geom::Point left_pt = this->characterAnchorPoint(pos);
 
228
    pos.thisEndOfLine();
 
229
    Geom::Point right_pt = this->characterAnchorPoint(pos);
 
230
 
 
231
    if (this->_blockProgression() == LEFT_TO_RIGHT || this->_blockProgression() == RIGHT_TO_LEFT) {
 
232
        left_pt = Geom::Point(left_pt[Geom::Y], left_pt[Geom::X]);
 
233
        right_pt = Geom::Point(right_pt[Geom::Y], right_pt[Geom::X]);
 
234
    }
 
235
 
 
236
    switch (this->paragraphAlignment(pos)) {
 
237
        case LEFT:
 
238
        case FULL:
 
239
            return left_pt;
 
240
            break;
 
241
        case CENTER:
 
242
            return (left_pt + right_pt)/2; // middle point
 
243
            break;
 
244
        case RIGHT:
 
245
            return right_pt;
 
246
            break;
 
247
        default:
 
248
            return boost::optional<Geom::Point>();
 
249
            break;
 
250
    }
 
251
}
 
252
 
224
253
Geom::Point Layout::chunkAnchorPoint(iterator const &it) const
225
254
{
226
255
    unsigned chunk_index;
705
734
    unsigned line_index = _parent_layout->_characters[_char_index].chunk(_parent_layout).in_line;
706
735
    if (line_index == _parent_layout->_lines.size() - 1) 
707
736
        return false; // nowhere to go
708
 
                else
 
737
    else
709
738
        n = MIN (n, static_cast<int>(_parent_layout->_lines.size() - 1 - line_index));
710
739
    if (_parent_layout->_lines[line_index + n].in_shape != _parent_layout->_lines[line_index].in_shape) {
711
740
        // switching between shapes: adjust the stored x to compensate
728
757
        line_index = _parent_layout->_characters[_char_index].chunk(_parent_layout).in_line;
729
758
    if (line_index == 0) 
730
759
        return false; // nowhere to go
731
 
                else 
 
760
    else
732
761
        n = MIN (n, static_cast<int>(line_index));
733
762
    if (_parent_layout->_lines[line_index - n].in_shape != _parent_layout->_lines[line_index].in_shape) {
734
763
        // switching between shapes: adjust the stored x to compensate