Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::Text::Layout::iterator Class Reference

Holds a position within the glyph output of Layout. More...

#include <Layout-TNG.h>

Public Member Functions

 iterator ()
 
bool operator== (iterator const &other) const
 
bool operator!= (iterator const &other) const
 
bool operator< (iterator const &other) const
 
bool operator<= (iterator const &other) const
 
bool operator> (iterator const &other) const
 
bool operator>= (iterator const &other) const
 
bool prevGlyph ()
 
bool nextGlyph ()
 
bool prevStartOfSpan ()
 
bool thisStartOfSpan ()
 
bool nextStartOfSpan ()
 
bool prevStartOfChunk ()
 
bool thisStartOfChunk ()
 
bool nextStartOfChunk ()
 
bool prevStartOfLine ()
 
bool thisStartOfLine ()
 
bool nextStartOfLine ()
 
bool thisEndOfLine ()
 
bool prevStartOfShape ()
 
bool thisStartOfShape ()
 
bool nextStartOfShape ()
 
bool nextCharacter ()
 
bool prevCharacter ()
 
bool nextCursorPosition ()
 
bool prevCursorPosition ()
 
bool nextLineCursor (int n=1)
 
bool prevLineCursor (int n=1)
 
bool nextStartOfWord ()
 
bool prevStartOfWord ()
 
bool nextEndOfWord ()
 
bool prevEndOfWord ()
 
bool nextStartOfSentence ()
 
bool prevStartOfSentence ()
 
bool nextEndOfSentence ()
 
bool prevEndOfSentence ()
 
bool prevStartOfParagraph ()
 
bool thisStartOfParagraph ()
 
bool nextStartOfParagraph ()
 
bool prevStartOfSource ()
 
bool thisStartOfSource ()
 
bool nextStartOfSource ()
 
bool cursorUp (int n=1)
 
bool cursorDown (int n=1)
 
bool cursorLeft ()
 
bool cursorRight ()
 
bool cursorUpWithControl ()
 
bool cursorDownWithControl ()
 
bool cursorLeftWithControl ()
 
bool cursorRightWithControl ()
 

Private Member Functions

 iterator (Layout const *p, unsigned c, int g)
 
 iterator (Layout const *p, unsigned c)
 
void beginCursorUpDown ()
 
bool _cursorLeftOrRightLocalX (Direction direction)
 stores the current x coordinate so that the cursor won't drift. See _x_coordinate
 
bool _cursorLeftOrRightLocalXByWord (Direction direction)
 moves forward or backwards by until the next character with is_word_start according to the directionality of the current paragraph, but ignoring block progression.
 

Private Attributes

Layout const * _parent_layout
 
int _glyph_index
 
unsigned _char_index
 index into Layout::glyphs, or -1
 
bool _cursor_moving_vertically
 index into Layout::character
 
double _x_coordinate
 for cursor up/down movement we must maintain the x position where we started so the cursor doesn't 'drift' left or right with the repeated quantization to character boundaries.
 

Friends

class Layout
 

Detailed Description

Holds a position within the glyph output of Layout.

Used to access the output of a Layout, query information and generally move around in it. See Layout for a glossary of the names of functions.

I'm not going to document all the methods because most of their names make their function self-evident.

A lot of the functions would do the same thing in a naive implementation for latin-only text, for example nextCharacter(), nextCursorPosition() and cursorRight(). Generally it's fairly obvious which one you should use in a given situation, but sometimes you might need to put some thought in to it.

All the methods return false if the requested action would have caused the current position to move out of bounds. In this case the position is moved to either begin() or end(), depending on which direction you were going.

Note that some characters do not have a glyph representation (eg line breaks), so if you try using prev/nextGlyph() from one of these you're heading for a crash.

Definition at line 981 of file Layout-TNG.h.

Constructor & Destructor Documentation

◆ iterator() [1/3]

Inkscape::Text::Layout::iterator::iterator ( )
inline

Definition at line 985 of file Layout-TNG.h.

◆ iterator() [2/3]

Inkscape::Text::Layout::iterator::iterator ( Layout const *  p,
unsigned  c,
int  g 
)
inlineprivate

Definition at line 1093 of file Layout-TNG.h.

◆ iterator() [3/3]

Inkscape::Text::Layout::iterator::iterator ( Layout const *  p,
unsigned  c 
)
inlineprivate

Definition at line 1095 of file Layout-TNG.h.

Member Function Documentation

◆ _cursorLeftOrRightLocalX()

bool Inkscape::Text::Layout::iterator::_cursorLeftOrRightLocalX ( Direction  direction)
private

stores the current x coordinate so that the cursor won't drift. See _x_coordinate

moves forward or backwards one cursor position according to the directionality of the current paragraph, but ignoring block progression. Helper for the cursor*() functions.

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

◆ _cursorLeftOrRightLocalXByWord()

bool Inkscape::Text::Layout::iterator::_cursorLeftOrRightLocalXByWord ( Direction  direction)
private

moves forward or backwards by until the next character with is_word_start according to the directionality of the current paragraph, but ignoring block progression.

Helper for the cursor*WithControl() functions.

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

◆ beginCursorUpDown()

void Inkscape::Text::Layout::iterator::beginCursorUpDown ( )
private

◆ cursorDown()

bool Inkscape::Text::Layout::iterator::cursorDown ( int  n = 1)

◆ cursorDownWithControl()

bool Inkscape::Text::Layout::iterator::cursorDownWithControl ( )

◆ cursorLeft()

bool Inkscape::Text::Layout::iterator::cursorLeft ( )

◆ cursorLeftWithControl()

bool Inkscape::Text::Layout::iterator::cursorLeftWithControl ( )

◆ cursorRight()

bool Inkscape::Text::Layout::iterator::cursorRight ( )

◆ cursorRightWithControl()

bool Inkscape::Text::Layout::iterator::cursorRightWithControl ( )

◆ cursorUp()

bool Inkscape::Text::Layout::iterator::cursorUp ( int  n = 1)

◆ cursorUpWithControl()

bool Inkscape::Text::Layout::iterator::cursorUpWithControl ( )

◆ nextCharacter()

bool Inkscape::Text::Layout::iterator::nextCharacter ( )
inline

◆ nextCursorPosition()

bool Inkscape::Text::Layout::iterator::nextCursorPosition ( )

◆ nextEndOfSentence()

bool Inkscape::Text::Layout::iterator::nextEndOfSentence ( )

◆ nextEndOfWord()

◆ nextGlyph()

◆ nextLineCursor()

bool Inkscape::Text::Layout::iterator::nextLineCursor ( int  n = 1)

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

References MIN.

◆ nextStartOfChunk()

bool Inkscape::Text::Layout::iterator::nextStartOfChunk ( )

◆ nextStartOfLine()

bool Inkscape::Text::Layout::iterator::nextStartOfLine ( )

◆ nextStartOfParagraph()

bool Inkscape::Text::Layout::iterator::nextStartOfParagraph ( )

◆ nextStartOfSentence()

bool Inkscape::Text::Layout::iterator::nextStartOfSentence ( )

◆ nextStartOfShape()

bool Inkscape::Text::Layout::iterator::nextStartOfShape ( )

◆ nextStartOfSource()

bool Inkscape::Text::Layout::iterator::nextStartOfSource ( )

◆ nextStartOfSpan()

◆ nextStartOfWord()

bool Inkscape::Text::Layout::iterator::nextStartOfWord ( )

◆ operator!=()

bool Inkscape::Text::Layout::iterator::operator!= ( iterator const &  other) const
inline

Definition at line 994 of file Layout-TNG.h.

References _char_index, and _glyph_index.

◆ operator<()

bool Inkscape::Text::Layout::iterator::operator< ( iterator const &  other) const
inline

Definition at line 1001 of file Layout-TNG.h.

References _char_index.

◆ operator<=()

bool Inkscape::Text::Layout::iterator::operator<= ( iterator const &  other) const
inline

Definition at line 1003 of file Layout-TNG.h.

References _char_index.

◆ operator==()

bool Inkscape::Text::Layout::iterator::operator== ( iterator const &  other) const
inline

Definition at line 992 of file Layout-TNG.h.

References _char_index, and _glyph_index.

◆ operator>()

bool Inkscape::Text::Layout::iterator::operator> ( iterator const &  other) const
inline

Definition at line 1005 of file Layout-TNG.h.

References _char_index.

◆ operator>=()

bool Inkscape::Text::Layout::iterator::operator>= ( iterator const &  other) const
inline

Definition at line 1007 of file Layout-TNG.h.

References _char_index.

◆ prevCharacter()

bool Inkscape::Text::Layout::iterator::prevCharacter ( )
inline

Definition at line 1213 of file Layout-TNG.h.

Referenced by Inkscape::UI::Tools::TextTool::_styleQueried(), and sp_te_insert().

◆ prevCursorPosition()

bool Inkscape::Text::Layout::iterator::prevCursorPosition ( )

◆ prevEndOfSentence()

bool Inkscape::Text::Layout::iterator::prevEndOfSentence ( )

◆ prevEndOfWord()

bool Inkscape::Text::Layout::iterator::prevEndOfWord ( )

◆ prevGlyph()

bool Inkscape::Text::Layout::iterator::prevGlyph ( )
inline

Definition at line 1193 of file Layout-TNG.h.

◆ prevLineCursor()

bool Inkscape::Text::Layout::iterator::prevLineCursor ( int  n = 1)

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

References MIN.

◆ prevStartOfChunk()

bool Inkscape::Text::Layout::iterator::prevStartOfChunk ( )

◆ prevStartOfLine()

bool Inkscape::Text::Layout::iterator::prevStartOfLine ( )

◆ prevStartOfParagraph()

bool Inkscape::Text::Layout::iterator::prevStartOfParagraph ( )

◆ prevStartOfSentence()

bool Inkscape::Text::Layout::iterator::prevStartOfSentence ( )

◆ prevStartOfShape()

bool Inkscape::Text::Layout::iterator::prevStartOfShape ( )

◆ prevStartOfSource()

bool Inkscape::Text::Layout::iterator::prevStartOfSource ( )

◆ prevStartOfSpan()

bool Inkscape::Text::Layout::iterator::prevStartOfSpan ( )

Referenced by insert_text_fallback().

◆ prevStartOfWord()

bool Inkscape::Text::Layout::iterator::prevStartOfWord ( )

◆ thisEndOfLine()

◆ thisStartOfChunk()

bool Inkscape::Text::Layout::iterator::thisStartOfChunk ( )

Referenced by SPFlowtext::getAsText().

◆ thisStartOfLine()

◆ thisStartOfParagraph()

bool Inkscape::Text::Layout::iterator::thisStartOfParagraph ( )

◆ thisStartOfShape()

bool Inkscape::Text::Layout::iterator::thisStartOfShape ( )

◆ thisStartOfSource()

bool Inkscape::Text::Layout::iterator::thisStartOfSource ( )

◆ thisStartOfSpan()

bool Inkscape::Text::Layout::iterator::thisStartOfSpan ( )

Friends And Related Symbol Documentation

◆ Layout

friend class Layout
friend

Definition at line 983 of file Layout-TNG.h.

Member Data Documentation

◆ _char_index

◆ _cursor_moving_vertically

bool Inkscape::Text::Layout::iterator::_cursor_moving_vertically
private

index into Layout::character

Definition at line 1087 of file Layout-TNG.h.

Referenced by beginCursorUpDown(), and nextGlyph().

◆ _glyph_index

◆ _parent_layout

Layout const* Inkscape::Text::Layout::iterator::_parent_layout
private

◆ _x_coordinate

double Inkscape::Text::Layout::iterator::_x_coordinate
private

for cursor up/down movement we must maintain the x position where we started so the cursor doesn't 'drift' left or right with the repeated quantization to character boundaries.

Definition at line 1091 of file Layout-TNG.h.

Referenced by beginCursorUpDown().


The documentation for this class was generated from the following files: