Inkscape
Vector Graphics Editor
|
#include <Layout-TNG-Scanline-Maker.h>
Public Member Functions | |
ShapeScanlineMaker (Shape const *shape, Layout::Direction block_progression) | |
~ShapeScanlineMaker () override | |
std::vector< ScanRun > | makeScanline (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. | |
![]() | |
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 |
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.
Inkscape::Text::Layout::ShapeScanlineMaker::ShapeScanlineMaker | ( | Shape const * | shape, |
Layout::Direction | block_progression | ||
) |
Definition at line 80 of file Layout-TNG-Scanline-Makers.cpp.
References Inkscape::Text::Layout::BOTTOM_TO_TOP, Shape::CalcBBox(), Shape::ConvertToShape(), Shape::Copy(), Inkscape::Text::Layout::LEFT_TO_RIGHT, Inkscape::Text::Layout::RIGHT_TO_LEFT, Inkscape::Text::Layout::TOP_TO_BOTTOM, and Shape::Transform().
|
override |
Definition at line 109 of file Layout-TNG-Scanline-Makers.cpp.
|
overridevirtual |
never true
Implements Inkscape::Text::Layout::ScanlineMaker.
Definition at line 184 of file Layout-TNG-Scanline-Makers.cpp.
|
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.
|
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().
|
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().
|
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.
|
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.
|
private |
Definition at line 163 of file Layout-TNG-Scanline-Maker.h.
|
private |
Definition at line 163 of file Layout-TNG-Scanline-Maker.h.
|
private |
Definition at line 167 of file Layout-TNG-Scanline-Maker.h.
|
private |
Definition at line 166 of file Layout-TNG-Scanline-Maker.h.
|
private |
Definition at line 169 of file Layout-TNG-Scanline-Maker.h.
|
private |
Definition at line 165 of file Layout-TNG-Scanline-Maker.h.
|
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.
|
private |
see #rotated_shape;
Definition at line 160 of file Layout-TNG-Scanline-Maker.h.
|
private |
Definition at line 164 of file Layout-TNG-Scanline-Maker.h.