Logo Search packages:      
Sourcecode: inkscape version File versions  Download package

NR::Point Inkscape::Text::Layout::chunkAnchorPoint ( iterator const &  it  )  const

This is that value to apply to the x,y attributes of tspan role=line elements, and hence it takes alignment into account.

Definition at line 225 of file Layout-TNG-OutIter.cpp.

References Inkscape::Text::Layout::iterator::_char_index, and _getChunkWidth().

{
    unsigned chunk_index;

    if (_chunks.empty())
        return NR::Point(0.0, 0.0);

    if (_characters.empty())
        chunk_index = 0;
    else if (it._char_index == _characters.size())
        chunk_index = _chunks.size() - 1;
    else chunk_index = _characters[it._char_index].span(this).in_chunk;

    Alignment alignment = _paragraphs[_lines[_chunks[chunk_index].in_line].in_paragraph].alignment;
    if (alignment == LEFT || alignment == FULL)
        return NR::Point(_chunks[chunk_index].left_x, _lines[chunk_index].baseline_y);

    double chunk_width = _getChunkWidth(chunk_index);
    if (alignment == RIGHT)
        return NR::Point(_chunks[chunk_index].left_x + chunk_width, _lines[chunk_index].baseline_y);
    //centre
    return NR::Point(_chunks[chunk_index].left_x + chunk_width * 0.5, _lines[chunk_index].baseline_y);
}


Generated by  Doxygen 1.6.0   Back to index