Logo Search packages:      
Sourcecode: inkscape version File versions

Inkscape::Text::Layout::Calculator Class Reference

List of all members.

Detailed Description

private to Layout. Does the real work of text flowing.

This class does a standard greedy paragraph wrapping algorithm.

Very high-level overview:

foreach(paragraph) {
  call pango_itemize() (_buildPangoItemizationForPara())
  break into spans, without dealing with wrapping (_buildSpansForPara())
  foreach(line in flow shape) {
    foreach(chunk in flow shape) {   (in _buildChunksInScanRun())
      // this inner loop in _measureUnbrokenSpan()
      if the line height changed discard the line and start again
      keep adding characters until we run out of space in the chunk, then back up to the last word boundary
      (do sensible things if there is no previous word break)
    push all the glyphs, chars, spans, chunks and line to output (not completely trivial because we must draw rtl in character order) (in _outputLine())
  push the paragraph (in calculate())

...and all of that needs to work vertically too, and with all the little details that make life annoying

Definition at line 62 of file Layout-TNG-Compute.cpp.

Public Member Functions

bool calculate ()
 Calculator (Layout *text_flow)

Private Member Functions

bool _buildChunksInScanRun (ParagraphInfo const &para, UnbrokenSpanPosition const &start_span_pos, ScanlineMaker::ScanRun const &scan_run, std::vector< ChunkInfo > *chunk_info, LineHeight *line_height) const
void _buildPangoItemizationForPara (ParagraphInfo *para) const
unsigned _buildSpansForPara (ParagraphInfo *para) const
void _createFirstScanlineMaker ()
bool _findChunksForLine (ParagraphInfo const &para, UnbrokenSpanPosition *start_span_pos, std::vector< ChunkInfo > *chunk_info, LineHeight *line_height)
double _getChunkLeftWithAlignment (ParagraphInfo const &para, std::vector< ChunkInfo >::const_iterator it_chunk, double *add_to_each_whitespace) const
bool _goToNextWrapShape ()
bool _measureUnbrokenSpan (ParagraphInfo const &para, BrokenSpan *span, BrokenSpan *last_break_span, BrokenSpan *last_emergency_break_span, double maximum_width) const
void _outputLine (ParagraphInfo const &para, LineHeight const &line_height, std::vector< ChunkInfo > const &chunk_info)

Static Private Member Functions

static PangoLogAttr const & _charAttributes (ParagraphInfo const &para, UnbrokenSpanPosition const &span_pos)
static void _computeFontLineHeight (font_instance *font, double font_size, SPStyle const *style, LineHeight *line_height, double *line_height_multiplier)

Private Attributes

Direction _block_progression
unsigned _current_shape_index
double _font_factory_size_multiplier
PangoContext * _pango_context
 index into Layout::_input_wrap_shapes
double _y_offset


class SpanPosition


struct  BrokenSpan
struct  ChunkInfo
struct  InputItemInfo
struct  PangoItemInfo
struct  ParagraphInfo
struct  UnbrokenSpan
struct  UnbrokenSpanPosition

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

Generated by  Doxygen 1.6.0   Back to index