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

private to Layout. More...

#include <Layout-TNG-Scanline-Maker.h>

Inheritance diagram for Inkscape::Text::Layout::ShapeScanlineMaker:
Inkscape::Text::Layout::ScanlineMaker

Public Member Functions

 ShapeScanlineMaker (Shape const *shape, Layout::Direction block_progression)
 
 ~ShapeScanlineMaker () override
 
std::vector< ScanRunmakeScanline (Layout::FontMetrics const &line_height) override
 Returns a list of chunks on the current line which can fit text with the given properties.
 
void completeLine () override
 Indicates that the caller has successfully filled the current line and hence that the next call to makeScanline() should return lines on the next lower line.
 
double yCoordinate () override
 Returns the y coordinate of the top of the scanline that will be returned by the next call to makeScanline().
 
void setNewYCoordinate (double new_y) override
 Forces an arbitrary change in the stored y coordinate of the object.
 
bool canExtendCurrentScanline (Layout::FontMetrics const &line_height) override
 never true
 
void setLineHeight (Layout::FontMetrics const &line_height) override
 Sets current line block height.
 
- Public Member Functions inherited from Inkscape::Text::Layout::ScanlineMaker
virtual ~ScanlineMaker ()=default
 

Private Attributes

Shape_rotated_shape
 To generate scanlines for top-to-bottom text it is easiest if we simply rotate the given shape by a multiple of 90 degrees.
 
bool _shape_needs_freeing
 see #rotated_shape;
 
float _bounding_box_top
 
float _bounding_box_bottom
 
float _y
 
float _rasterizer_y
 
int _current_rasterization_point
 
float _current_line_height
 
bool _negative_block_progression
 

Detailed Description

private to Layout.

Generates scanlines inside an arbitrary shape

This is the 'perfect', and hence slowest, implementation of a Layout::ScanlineMaker, which will return exact bounds for any given input shape.

Definition at line 130 of file Layout-TNG-Scanline-Maker.h.

Constructor & Destructor Documentation

◆ ShapeScanlineMaker()

◆ ~ShapeScanlineMaker()

Inkscape::Text::Layout::ShapeScanlineMaker::~ShapeScanlineMaker ( )
override

Definition at line 109 of file Layout-TNG-Scanline-Makers.cpp.

Member Function Documentation

◆ canExtendCurrentScanline()

bool Inkscape::Text::Layout::ShapeScanlineMaker::canExtendCurrentScanline ( Layout::FontMetrics const &  line_height)
overridevirtual

never true

Implements Inkscape::Text::Layout::ScanlineMaker.

Definition at line 184 of file Layout-TNG-Scanline-Makers.cpp.

◆ completeLine()

void Inkscape::Text::Layout::ShapeScanlineMaker::completeLine ( )
overridevirtual

Indicates that the caller has successfully filled the current line and hence that the next call to makeScanline() should return lines on the next lower line.

There is no error return, the next call to makeScanline() will give an error if there is no more space.

Implements Inkscape::Text::Layout::ScanlineMaker.

Definition at line 165 of file Layout-TNG-Scanline-Makers.cpp.

◆ makeScanline()

std::vector< Layout::ScanlineMaker::ScanRun > Inkscape::Text::Layout::ShapeScanlineMaker::makeScanline ( Layout::FontMetrics const &  line_height)
overridevirtual

Returns a list of chunks on the current line which can fit text with the given properties.

It is up to the caller to discard any chunks which are too narrow for its needs. This function may change the y coordinate between calls if the new height too big to fit in the space remaining in this shape. Returns an empty vector if there is no space left in the current shape.

Implements Inkscape::Text::Layout::ScanlineMaker.

Definition at line 116 of file Layout-TNG-Scanline-Makers.cpp.

References Inkscape::Text::Layout::FontMetrics::emSize(), FloatLigne::Flatten(), FloatLigne::Over(), result, and FloatLigne::runs.

Referenced by Inkscape::Text::Layout::_calculateCursorShapeForEmpty().

◆ setLineHeight()

void Inkscape::Text::Layout::ShapeScanlineMaker::setLineHeight ( Layout::FontMetrics const &  line_height)
overridevirtual

Sets current line block height.

Call before completeLine() to correct for actually used line height (in case some chunks with larger font-size rolled back).

Implements Inkscape::Text::Layout::ScanlineMaker.

Definition at line 190 of file Layout-TNG-Scanline-Makers.cpp.

References Inkscape::Text::Layout::FontMetrics::emSize().

◆ setNewYCoordinate()

void Inkscape::Text::Layout::ShapeScanlineMaker::setNewYCoordinate ( double  new_y)
overridevirtual

Forces an arbitrary change in the stored y coordinate of the object.

The next call to makeScanline() will return runs whose top is at the new coordinate.

Implements Inkscape::Text::Layout::ScanlineMaker.

Definition at line 176 of file Layout-TNG-Scanline-Makers.cpp.

◆ yCoordinate()

double Inkscape::Text::Layout::ShapeScanlineMaker::yCoordinate ( )
overridevirtual

Returns the y coordinate of the top of the scanline that will be returned by the next call to makeScanline().

Implements Inkscape::Text::Layout::ScanlineMaker.

Definition at line 170 of file Layout-TNG-Scanline-Makers.cpp.

Member Data Documentation

◆ _bounding_box_bottom

float Inkscape::Text::Layout::ShapeScanlineMaker::_bounding_box_bottom
private

Definition at line 163 of file Layout-TNG-Scanline-Maker.h.

◆ _bounding_box_top

float Inkscape::Text::Layout::ShapeScanlineMaker::_bounding_box_top
private

Definition at line 163 of file Layout-TNG-Scanline-Maker.h.

◆ _current_line_height

float Inkscape::Text::Layout::ShapeScanlineMaker::_current_line_height
private

Definition at line 167 of file Layout-TNG-Scanline-Maker.h.

◆ _current_rasterization_point

int Inkscape::Text::Layout::ShapeScanlineMaker::_current_rasterization_point
private

Definition at line 166 of file Layout-TNG-Scanline-Maker.h.

◆ _negative_block_progression

bool Inkscape::Text::Layout::ShapeScanlineMaker::_negative_block_progression
private

Definition at line 169 of file Layout-TNG-Scanline-Maker.h.

◆ _rasterizer_y

float Inkscape::Text::Layout::ShapeScanlineMaker::_rasterizer_y
private

Definition at line 165 of file Layout-TNG-Scanline-Maker.h.

◆ _rotated_shape

Shape* Inkscape::Text::Layout::ShapeScanlineMaker::_rotated_shape
private

To generate scanlines for top-to-bottom text it is easiest if we simply rotate the given shape by a multiple of 90 degrees.

This stores that. If no rotation was needed we can simply store the pointer we were given and set shape_needs_freeing appropriately.

Definition at line 157 of file Layout-TNG-Scanline-Maker.h.

◆ _shape_needs_freeing

bool Inkscape::Text::Layout::ShapeScanlineMaker::_shape_needs_freeing
private

see #rotated_shape;

Definition at line 160 of file Layout-TNG-Scanline-Maker.h.

◆ _y

float Inkscape::Text::Layout::ShapeScanlineMaker::_y
private

Definition at line 164 of file Layout-TNG-Scanline-Maker.h.


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