17#ifndef PANGO_ENABLE_ENGINE
18#define PANGO_ENABLE_ENGINE
45 unsigned optional_attributes_offset,
46 Glib::ustring::const_iterator text_begin,
47 Glib::ustring::const_iterator text_end)
49 if (style ==
nullptr)
return;
53 new_source->
source = source;
54 new_source->
text = &text;
57 new_source->
style = style;
66 for ( ; text_begin != text_end && text_begin != text.end() ; ++text_begin)
69 if (optional_attributes) {
76 if (!optional_attributes->
rotate.empty() && optional_attributes_offset >= optional_attributes->
rotate.size()) {
79 for (
auto it : optional_attributes->
rotate)
82 new_source->
rotate.resize(1, last_rotate);
94void Layout::_copyInputVector(std::vector<SVGLength>
const &input_vector,
unsigned input_offset, std::vector<SVGLength> *output_vector,
size_t max_length)
96 output_vector->clear();
97 if (input_offset >= input_vector.size())
return;
98 output_vector->reserve(std::min(max_length, input_vector.size() - input_offset));
99 while (input_offset < input_vector.size() && max_length != 0) {
100 if (!input_vector[input_offset]._set)
102 output_vector->push_back(input_vector[input_offset]);
113 new_code->
source = source;
114 new_code->
code = code;
116 new_code->
ascent = ascent;
125 _input_wrap_shapes.push_back({.shape = std::move(shape), .display_align = display_align});
142 std::cerr <<
"Layout::InputTextStream::styleGetBlockProgression: invalid writing mode." << std::endl;
175 SPStyle const *this_style = style;
181 switch (style->text_align.computed) {
195 if (this_style ==
nullptr)
break;
203 if (descr ==
nullptr)
return nullptr;
205 pango_font_description_free(descr);
216 pango_font_description_set_size(descr,
FontFactory::get().fontSize * PANGO_SCALE);
_PangoFontDescription PangoFontDescription
std::shared_ptr< FontInstance > Face(PangoFontDescription *descr, bool canFail=true)
Represents a control code item in the input stream.
Represents a text item in the input stream.
LengthAdjust lengthAdjust
SPCSSBaseline styleGetDominantBaseline() const
std::vector< SVGLength > y
SPCSSTextOrientation styleGetTextOrientation() const
std::vector< SVGLength > dy
Alignment styleGetAlignment(Direction para_direction, bool try_text_align) const
Glib::ustring::const_iterator text_begin
owned by the caller
std::vector< SVGLength > rotate
std::vector< SVGLength > x
These vectors can (often will) be shorter than the text in this source, but never longer.
std::vector< SVGLength > dx
PangoFontDescription * styleGetFontDescription() const
The return value must be freed with pango_font_description_free()
Glib::ustring::const_iterator text_end
std::shared_ptr< FontInstance > styleGetFontInstance() const
SPStyle * style
in characters, from text_start to text_end only
~InputStreamTextSource() override
Direction styleGetBlockProgression() const
sigc::scoped_connection style_conn
Glib::ustring const * text
void clear()
Empties everything stored in this class and resets it to its original state, like when it was created...
Alignment
For expressing paragraph alignment.
void appendControlCode(TextControlCode code, SPObject *source, double width=0.0, double ascent=0.0, double descent=0.0)
Control codes are metadata in the text stream to signify items that occupy real space (unlike style c...
void _clearInputObjects()
Erases all the stuff set by the owner as input, ie _input_stream and _input_wrap_shapes.
static void _copyInputVector(std::vector< SVGLength > const &input_vector, unsigned input_offset, std::vector< SVGLength > *output_vector, size_t max_length)
The parameters to appendText() are allowed to be a little bit complex.
void appendWrapShape(std::unique_ptr< Shape > shape, DisplayAlign display_align=DISPLAY_ALIGN_BEFORE)
Stores another shape inside which to flow the text.
void appendText(Glib::ustring const &text, SPStyle *style, SPObject *source, OptionalTextTagAttrs const *optional_attributes, unsigned optional_attributes_offset, Glib::ustring::const_iterator text_begin, Glib::ustring::const_iterator text_end)
adds a new piece of text to the end of the current list of text to be processed.
std::vector< InputStreamItem * > _input_stream
This is our internal storage for all the stuff passed to the appendText() and appendControlCode() fun...
DisplayAlign
Display alignment for shapes.
std::vector< InputWrapShape > _input_wrap_shapes
Direction
Used to specify any particular text direction required.
TextControlCode
Control codes which can be embedded in the text to be flowed.
static FontFactory & get(Args &&... args)
SPObject is an abstract base class of all of the document nodes at the SVG document level.
SPStyle * style
Represents the style properties, whether from presentation attributes, the style attribute,...
sigc::connection connectRelease(sigc::slot< void(SPObject *)> slot)
Connects to the release request signal.
SPObject * object
Object we are attached to.
T< SPAttr::TEXT_ALIGN, SPIEnum< SPCSSTextAlign > > text_align
text alignment (css2 16.2) (not to be confused with text-anchor)
T< SPAttr::TEXT_ANCHOR, SPIEnum< SPTextAnchor > > text_anchor
Anchor of the text (svg1.1 10.9.1)
T< SPAttr::WRITING_MODE, SPIEnum< SPCSSWritingMode > > writing_mode
Writing mode (svg1.1 10.7.2, CSS Writing Modes 3)
PangoFontDescription * ink_font_description_from_style(SPStyle const *style)
TODO: insert short description here.
static Layout::Alignment text_anchor_to_alignment(unsigned anchor, Layout::Direction para_direction)
Helper class to stream background task notifications as a series of messages.
The optional attributes which can be applied to a SVG text or related tag.
std::vector< SVGLength > y
std::vector< SVGLength > rotate
std::vector< SVGLength > x
std::vector< SVGLength > dy
std::vector< SVGLength > dx
LengthAdjust lengthAdjust
@ SP_CSS_TEXT_ANCHOR_MIDDLE
@ SP_CSS_TEXT_ANCHOR_START
@ SP_CSS_TEXT_ALIGN_RIGHT
@ SP_CSS_TEXT_ALIGN_CENTER
@ SP_CSS_TEXT_ALIGN_START
@ SP_CSS_TEXT_ALIGN_JUSTIFY
@ SP_CSS_WRITING_MODE_TB_RL
@ SP_CSS_WRITING_MODE_LR_TB
@ SP_CSS_WRITING_MODE_TB_LR
@ SP_CSS_WRITING_MODE_RL_TB
SPStyle - a style object for SPItem objects.