Inkscape
Vector Graphics Editor
|
#include <sp-text.h>
Public Member Functions | |
SPText () | |
~SPText () override | |
int | tag () const override |
SPCurve | getNormalizedBpath () const |
Converts the text object to its component curves. | |
void | rebuildLayout () |
Completely recalculates the layout. | |
void | show_shape_inside () |
This two functions are useful because layout calculations need text visible for example Calculating a invisible char position object or pasting text with paragraphs that overflow shape defined. | |
void | hide_shape_inside () |
void | _clearFlow (Inkscape::DrawingGroup *in_arena) |
discards the drawing objects representing this text. | |
std::unique_ptr< Shape > | getExclusionShape () const |
Union all exclusion shapes. | |
std::unique_ptr< Shape > | getInclusionShape (SPShape *shape) const |
Add a single inclusion shape with padding. | |
std::vector< std::unique_ptr< Shape > > | makeEffectiveShapes () const |
Compute the final effective shapes: All inclusion shapes shrunk by the padding, from which we subtract the exclusion shapes expanded by their padding. | |
std::optional< Geom::Point > | getBaselinePoint () const |
Get the position of the baseline point for this text object. | |
void | optimizeTextpathText () |
Optimize textpath text on next set_transform. | |
void | build (SPDocument *doc, Inkscape::XML::Node *repr) override |
void | release () override |
void | child_added (Inkscape::XML::Node *child, Inkscape::XML::Node *ref) override |
void | remove_child (Inkscape::XML::Node *child) override |
void | set (SPAttr key, const char *value) override |
void | update (SPCtx *ctx, unsigned int flags) override |
void | modified (unsigned int flags) override |
Inkscape::XML::Node * | write (Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned int flags) override |
Geom::OptRect | bbox (Geom::Affine const &transform, SPItem::BBoxType type) const override |
void | print (SPPrintContext *ctx) override |
const char * | typeName () const override |
The item's type name, not node tag name. | |
const char * | displayName () const override |
The item's type name as a translated human string. | |
char * | description () const override |
Inkscape::DrawingItem * | show (Inkscape::Drawing &drawing, unsigned int key, unsigned int flags) override |
void | hide (unsigned int key) override |
void | snappoints (std::vector< Inkscape::SnapCandidatePoint > &p, Inkscape::SnapPreferences const *snapprefs) const override |
Geom::Affine | set_transform (Geom::Affine const &transform) override |
void | getLinked (std::vector< SPObject * > &objects, LinkedObjectNature direction=LinkedObjectNature::ANY) const override |
Get objects which are linked to this object as either a source or a target. | |
void | remove_svg11_fallback () |
Remove 'x' and 'y' values on children (lines) or they will be interpreted as absolute positions when 'inline-size' is removed. | |
void | newline_to_sodipodi () |
Convert new lines in 'inline-size' text to tspans with sodipodi:role="tspan". | |
void | sodipodi_to_newline () |
Convert tspans with sodipodi:role="tspans" to ' '. | |
bool | is_horizontal () const |
bool | has_inline_size () const |
bool | has_shape_inside () const |
Geom::OptRect | get_frame () |
Inkscape::XML::Node * | get_first_rectangle () |
SPItem * | get_first_shape_dependency () |
Get the first shape reference which affects the position and layout of this text item. | |
const std::vector< SPItem * > | get_all_shape_dependencies () const |
void | remove_newlines () |
![]() | |
SPItem () | |
~SPItem () override | |
SPClipPath * | getClipObject () const |
SPMask * | getMaskObject () const |
SPClipPathReference & | getClipRef () |
SPMaskReference & | getMaskRef () |
std::optional< Geom::PathVector > | getClipPathVector () const |
Return the path vector of the clipping region. | |
std::optional< Geom::PathVector > | getClipPathVector (SPItem const *root) const |
Return the path vector of the clipping region, combined with the clipping regions of all groups containing this object up to and including root. | |
SPText const * | getClipTextObject () const |
Return the text object, IF and only if this item is clipped by a single SPText object. | |
SPAvoidRef & | getAvoidRef () |
bool | isLocked () const |
void | setLocked (bool lock, bool recursive=false) |
bool | isHidden () const |
void | setHidden (bool hidden) |
bool | isSensitive () const |
void | setHighlight (Inkscape::Colors::Color color) |
bool | isHighlightSet () const |
virtual Inkscape::Colors::Color | highlight_color () const |
bool | isEvaluated () const |
void | setEvaluated (bool visible) |
void | resetEvaluated () |
bool | unoptimized () |
bool | isHidden (unsigned display_key) const |
bool | isExplicitlyHidden () const |
Returns something suitable for the ‘Hide’ checkbox in the Object Properties dialog box. | |
void | setExplicitlyHidden (bool val) |
Sets the display CSS property to ‘hidden’ if val is true, otherwise makes it unset. | |
void | setCenter (Geom::Point const &object_centre) |
Sets the transform_center_x and transform_center_y properties to retain the rotation center. | |
bool | updateCenterIfSet (Geom::Point const ¢er) |
void | unsetCenter () |
bool | isCenterSet () const |
Geom::Point | getCenter (bool ensure_uptodate=true) const |
void | scaleCenter (Geom::Scale const &sc) |
bool | isVisibleAndUnlocked () const |
bool | isVisibleAndUnlocked (unsigned display_key) const |
Geom::Affine | getRelativeTransform (SPObject const *obj) const |
bool | raiseOne () |
bool | lowerOne () |
void | raiseToTop () |
void | lowerToBottom () |
SPGroup * | getParentGroup () const |
Return the parent, only if it's a group object. | |
void | moveTo (SPItem *target, bool intoafter) |
Move this SPItem into or after another SPItem in the doc. | |
sigc::connection | connectTransformed (sigc::slot< void(Geom::Affine const *, SPItem *)> slot) |
Geom::OptRect | geometricBounds (Geom::Affine const &transform=Geom::identity()) const |
Get item's geometric bounding box in this item's coordinate system. | |
Geom::OptRect | visualBounds (Geom::Affine const &transform=Geom::identity(), bool wfilter=true, bool wclip=true, bool wmask=true) const |
Get item's visual bounding box in this item's coordinate system. | |
Geom::OptRect | bounds (BBoxType type, Geom::Affine const &transform=Geom::identity()) const |
Geom::OptRect | documentGeometricBounds () const |
Get item's geometric bbox in document coordinate system. | |
Geom::OptRect | documentVisualBounds () const |
Get item's visual bbox in document coordinate system. | |
Geom::OptRect | documentBounds (BBoxType type) const |
Geom::OptRect | documentPreferredBounds () const |
virtual std::optional< Geom::PathVector > | documentExactBounds () const |
Get an exact geometric shape representing the visual bounds of the item in the document coordinates. | |
Geom::OptRect | desktopGeometricBounds () const |
Get item's geometric bbox in desktop coordinate system. | |
Geom::OptRect | desktopVisualBounds () const |
Get item's visual bbox in desktop coordinate system. | |
Geom::OptRect | desktopPreferredBounds () const |
Geom::OptRect | desktopBounds (BBoxType type) const |
unsigned int | pos_in_parent () const |
char * | detailedDescription () const |
Returns a string suitable for status bar, formatted in pango markup language. | |
bool | isFiltered () const |
Returns true if the item is filtered, false otherwise. | |
SPObject * | isInMask () const |
SPObject * | isInClipPath () const |
void | invoke_print (SPPrintContext *ctx) |
Inkscape::DrawingItem * | invoke_show (Inkscape::Drawing &drawing, unsigned int key, unsigned int flags) |
void | invoke_hide (unsigned int key) |
void | invoke_hide_except (unsigned key, const std::vector< SPItem const * > &to_keep) |
Invoke hide on all non-group items, except for the list of items to keep. | |
void | getSnappoints (std::vector< Inkscape::SnapCandidatePoint > &p, Inkscape::SnapPreferences const *snapprefs=nullptr) const |
void | adjust_pattern (Geom::Affine const &postmul, bool set=false, PaintServerTransform=TRANSFORM_BOTH) |
void | adjust_hatch (Geom::Affine const &postmul, bool set=false, PaintServerTransform=TRANSFORM_BOTH) |
void | adjust_gradient (Geom::Affine const &postmul, bool set=false) |
void | adjust_clip (Geom::Affine const &postmul, bool set=false) |
void | remove_clip_transforms () |
void | adjust_stroke (double ex) |
void | adjust_stroke_width_recursive (double ex) |
Recursively scale stroke width in item and its children by expansion. | |
void | freeze_stroke_width_recursive (bool freeze) |
void | adjust_paint_recursive (Geom::Affine advertized_transform, Geom::Affine t_ancestors, PaintServerType type=GRADIENT) |
Recursively compensate pattern or gradient transform. | |
bool | collidesWith (Geom::PathVector const &shape) const |
Checks for visual collision with another item. | |
bool | collidesWith (SPItem const &other) const |
void | doWriteTransform (Geom::Affine const &transform, Geom::Affine const *adv=nullptr, bool compensate=true) |
Set a new transform on an object. | |
void | set_item_transform (Geom::Affine const &transform_matrix) |
Sets item private transform (not propagated to repr), without compensating stroke widths, gradients, patterns as sp_item_write_transform does. | |
Inkscape::DrawingItem * | get_arenaitem (unsigned key) const |
Return the arenaitem corresponding to the given item in the display with the given key. | |
Geom::Affine | i2doc_affine () const |
Returns the accumulated transformation of the item and all its ancestors, including root's viewport. | |
Geom::Affine | i2dt_affine () const |
Returns the transformation from item to desktop coords. | |
void | set_i2d_affine (Geom::Affine const &transform) |
Geom::Affine | dt2i_affine () const |
Returns the transformation from desktop to item coords. | |
bool | isExpanded () const |
void | setExpanded (bool expand) |
void | rotate_rel (Geom::Rotate const &rotation) |
void | scale_rel (Geom::Scale const &scale) |
void | skew_rel (double skewX, double skewY) |
void | move_rel (Geom::Translate const &tr) |
virtual void | removeTransformsRecursively (SPObject const *root) |
virtual void | convert_to_guides () const |
![]() | |
SPObject () | |
Constructor, sets all attributes to default values. | |
SPObject (SPObject const &)=delete | |
SPObject & | operator= (SPObject const &)=delete |
~SPObject () override | |
Destructor, frees the used memory and unreferences a potential successor of the object. | |
char const * | getId () const |
Returns the objects current ID string. | |
void | getIds (std::set< std::string > &ret) const |
Accumulate this id and all it's descendants ids. | |
std::string | getUrl () const |
Get the id in a URL format. | |
Inkscape::XML::Node * | getRepr () |
Returns the XML representation of tree. | |
Inkscape::XML::Node const * | getRepr () const |
Returns the XML representation of tree. | |
void | releaseReferences () |
Cleans up an SPObject, releasing its references and requesting that references to it be released. | |
sigc::connection | connectRelease (sigc::slot< void(SPObject *)> slot) |
Connects to the release request signal. | |
bool | isSiblingOf (SPObject const *object) const |
std::vector< SPObject * > | getLinked (LinkedObjectNature direction=LinkedObjectNature::ANY) const |
Get objects which are linked, like above. | |
bool | isAncestorOf (SPObject const *object) const |
True if object is non-NULL and this is some in/direct parent of object. | |
SPObject const * | nearestCommonAncestor (SPObject const *object) const |
Returns youngest object being parent to this and object. | |
SPObject const * | getTopAncestorNonLayer () const |
Returns ancestor non layer. | |
SPObject * | getNext () |
SPObject * | getPrev () |
Returns previous object in sibling list or NULL. | |
bool | hasChildren () const |
SPObject * | firstChild () |
SPObject const * | firstChild () const |
SPObject * | lastChild () |
SPObject const * | lastChild () const |
SPObject * | nthChild (unsigned index) |
SPObject const * | nthChild (unsigned index) const |
std::vector< SPObject * > | childList (bool add_ref, Action action=ActionGeneral) |
Retrieves the children as a std vector object, optionally ref'ing the children in the process, if add_ref is specified. | |
std::vector< SPObject * > | ancestorList (bool root_to_tip) |
Retrieves a list of ancestors of the object, as an easy to use vector. | |
SPObject * | appendChildRepr (Inkscape::XML::Node *repr) |
Append repr as child of this object. | |
char const * | label () const |
Gets the author-visible label property for the object or a default if no label is defined. | |
char const * | defaultLabel () const |
Returns a default label property for this object. | |
void | setLabel (char const *label) |
Sets the author-visible label for this object. | |
char * | title () const |
Returns the title of this object, or NULL if there is none. | |
bool | setTitle (char const *title, bool verbatim=false) |
Sets the title of this object. | |
char * | desc () const |
Returns the description of this object, or NULL if there is none. | |
bool | setDesc (char const *desc, bool verbatim=false) |
Sets the description of this object. | |
Glib::ustring | getExportFilename () const |
Get and set the exportable filename on this object. | |
void | setExportFilename (Glib::ustring filename) |
Geom::Point | getExportDpi () const |
Get and set the exported DPI for this objet, if available. | |
void | setExportDpi (Geom::Point dpi) |
CollectionPolicy | collectionPolicy () const |
Set the policy under which this object will be orphan-collected. | |
void | setCollectionPolicy (CollectionPolicy policy) |
Sets the orphan-collection policy in effect for this object. | |
void | requestOrphanCollection () |
Requests a later automatic call to collectOrphan(). | |
void | collectOrphan () |
Unconditionally delete the object if it is not referenced. | |
void | hrefObject (SPObject *owner=nullptr) |
Increase weak refcount. | |
void | unhrefObject (SPObject *owner=nullptr) |
Decrease weak refcount. | |
bool | isReferenced () |
Check if object is referenced by any other object. | |
void | deleteObject (bool propagate, bool propagate_descendants) |
Deletes an object, unparenting it from its parent. | |
void | deleteObject (bool propagate=true) |
Deletes on object. | |
void | cropToObject (SPObject *except) |
Removes all children except for the given object, it's children and it's ancesstors. | |
void | cropToObjects (std::vector< SPObject * > except_objects) |
Removes objects which are not related to given list of objects. | |
void | getObjectsExcept (std::vector< SPObject * > &objects, const std::vector< SPObject * > &except) |
Get all child objects except for any in the list. | |
void | getLinkedRecursive (std::vector< SPObject * > &objects, LinkedObjectNature direction=LinkedObjectNature::ANY) const |
Grows the input list with all linked items recursively in both child nodes and links of links. | |
sigc::connection | connectDelete (sigc::slot< void(SPObject *)> slot) |
Connects a slot to be called when an object is deleted. | |
sigc::connection | connectPositionChanged (sigc::slot< void(SPObject *)> slot) |
SPObject * | successor () |
Returns the object which supercedes this one (if any). | |
void | setSuccessor (SPObject *successor) |
Indicates that another object supercedes this one. | |
void | setTmpSuccessor (SPObject *tmpsuccessor) |
Indicates that another object supercedes temporaty this one. | |
void | unsetTmpSuccessor () |
Unset object supercedes. | |
void | fixTmpSuccessors () |
Fix temporary successors in duple stamp. | |
Inkscape::XML::Node * | updateRepr (unsigned int flags=SP_OBJECT_WRITE_EXT) |
Updates the object's repr based on the object's state. | |
Inkscape::XML::Node * | updateRepr (Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned int flags) |
Updates the given repr based on the object's state. | |
void | requestDisplayUpdate (unsigned int flags) |
Queues an deferred update of this object's display. | |
void | updateDisplay (SPCtx *ctx, unsigned int flags) |
Updates the object's display immediately. | |
void | requestModified (unsigned int flags) |
Requests that a modification notification signal be emitted later (e.g. | |
void | emitModified (unsigned int flags) |
Emits the MODIFIED signal with the object's flags. | |
sigc::connection | connectModified (sigc::slot< void(SPObject *, unsigned int)> slot) |
Connects to the modification notification signal. | |
void | _sendDeleteSignalRecursive () |
Sends the delete signal to all children of this object recursively. | |
void | _updateTotalHRefCount (int increment) |
Adds increment to _total_hrefcount of object and its parents. | |
void | _requireSVGVersion (unsigned major, unsigned minor) |
void | _requireSVGVersion (Inkscape::Version version) |
Lifts SVG version of all root objects to version. | |
void | attach (SPObject *object, SPObject *prev) |
Put object into object tree, under parent, and behind prev; also update object's XML space. | |
void | reorder (SPObject *obj, SPObject *prev) |
In list of object's children, move object behind prev. | |
void | detach (SPObject *object) |
Remove object from parent's children, release and unref it. | |
SPObject * | get_child_by_repr (Inkscape::XML::Node *repr) |
Return object's child whose node pointer equals repr. | |
void | invoke_build (SPDocument *document, Inkscape::XML::Node *repr, unsigned int cloned) |
int | getIntAttribute (char const *key, int def) |
unsigned | getPosition () |
char const * | getAttribute (char const *name) const |
void | appendChild (Inkscape::XML::Node *child) |
void | addChild (Inkscape::XML::Node *child, Inkscape::XML::Node *prev=nullptr) |
void | setKeyValue (SPAttr key, char const *value) |
Call virtual set() function of object. | |
void | setAttribute (Inkscape::Util::const_char_ptr key, Inkscape::Util::const_char_ptr value) |
void | setAttributeDouble (Inkscape::Util::const_char_ptr key, double value) |
void | setAttributeOrRemoveIfEmpty (Inkscape::Util::const_char_ptr key, Inkscape::Util::const_char_ptr value) |
void | readAttr (char const *key) |
Read value of key attribute from XML node into object. | |
void | readAttr (SPAttr keyid) |
char const * | getTagName () const |
void | removeAttribute (char const *key) |
void | setCSS (SPCSSAttr *css, char const *attr) |
void | changeCSS (SPCSSAttr *css, char const *attr) |
bool | storeAsDouble (char const *key, double *val) const |
virtual void | read_content () |
void | recursivePrintTree (unsigned level=0) |
void | objectTrace (std::string const &, bool in=true, unsigned flags=0) |
std::string | generate_unique_id (char const *default_id=nullptr) const |
Generate a document-wide unique id for this object. | |
Static Public Member Functions | |
static void | _adjustCoordsRecursive (SPItem *item, Geom::Affine const &m, double ex, bool is_root=true) |
when the object is transformed it's nicer to change the font size and coordinates when we can, rather than just applying a matrix transform. | |
static void | _adjustFontsizeRecursive (SPItem *item, double ex, bool is_root=true) |
![]() | |
static unsigned int | display_key_new (unsigned numkeys) |
Allocates unique integer keys. | |
static unsigned | ensure_key (Inkscape::DrawingItem *di) |
Ensures that a drawing item's key is the first of a block of ITEM_KEY_SIZE keys, assigning it such a key if necessary. | |
Public Attributes | |
TextTagAttributes | attributes |
Inkscape::Text::Layout | layout |
std::unordered_map< unsigned, Inkscape::Text::StyleAttachments > | view_style_attachments |
bool | _optimizeTextpathText = false |
![]() | |
unsigned int | sensitive: 1 |
unsigned int | stop_paint: 1 |
unsigned | bbox_valid: 1 |
double | transform_center_x |
double | transform_center_y |
bool | freeze_stroke_width |
bool | _is_expanded = false |
Geom::Affine | transform |
Geom::OptRect | doc_bbox |
Geom::Rect | viewport |
std::vector< std::pair< Glib::ustring, Glib::ustring > > | rootsatellites |
std::vector< SPItemView > | views |
sigc::signal< void(Geom::Affine const *, SPItem *)> | _transformed_signal |
std::optional< Inkscape::Colors::Color > | _highlightColor |
![]() | |
unsigned int | cloned: 1 |
SPObject * | clone_original {nullptr} |
unsigned int | uflags: 16 |
unsigned int | mflags: 16 |
SPIXmlSpace | xml_space |
Glib::ustring | lang |
unsigned int | hrefcount {0} |
unsigned int | _total_hrefcount {0} |
SPDocument * | document {nullptr} |
SPObject * | parent {nullptr} |
int | refCount {1} |
std::list< SPObject * > | hrefList |
SPStyle * | style |
Represents the style properties, whether from presentation attributes, the style attribute, or inherited. | |
SPStyle * | context_style |
Represents the style that should be used to resolve 'context-fill' and 'context-stroke'. | |
sigc::signal< void(SPObject *)> | _release_signal |
sigc::signal< void(SPObject *)> | _delete_signal |
sigc::signal< void(SPObject *)> | _position_changed_signal |
sigc::signal< void(SPObject *, unsigned int)> | _modified_signal |
SPObject * | _successor {nullptr} |
SPObject * | _tmpsuccessor {nullptr} |
CollectionPolicy | _collection_policy {SPObject::COLLECT_WITH_PARENT} |
char * | _label {nullptr} |
char * | _default_label {nullptr} |
ChildrenList | children |
Private Member Functions | |
void | _buildLayoutInit () |
Initializes layout from <text> (i.e. | |
unsigned | _buildLayoutInput (SPObject *object, Inkscape::Text::Layout::OptionalTextTagAttrs const &parent_optional_attrs, unsigned parent_attrs_offset, bool in_textpath) |
Recursively walks the xml tree adding tags and their contents. | |
SVGLength * | _getFirstXLength () |
Find first x/y values which may be in a descendent element. | |
SVGLength * | _getFirstYLength () |
Private Attributes | |
SPCSSAttr * | css |
SPText::SPText | ( | ) |
Definition at line 74 of file sp-text.cpp.
|
override |
Definition at line 77 of file sp-text.cpp.
References css, and sp_repr_css_attr_unref().
|
static |
when the object is transformed it's nicer to change the font size and coordinates when we can, rather than just applying a matrix transform.
is_root is used to indicate to the function that it should extend zero-length position vectors to length 1 in order to record the new position. This is necessary to convert from objects whose position is completely specified by transformations.
Definition at line 1009 of file sp-text.cpp.
References _adjustCoordsRecursive(), SPObject::children, and item.
Referenced by _adjustCoordsRecursive(), and set_transform().
|
static |
Definition at line 924 of file sp-text.cpp.
References _adjustFontsizeRecursive(), Geom::are_near(), SPObject::children, SPStyle::font_size, item, SPStyle::letter_spacing, SPStyle::line_height, SP_CSS_UNIT_EM, SP_CSS_UNIT_EX, SP_CSS_UNIT_NONE, SP_CSS_UNIT_PERCENT, SP_FONT_SIZE_LENGTH, SPObject::style, SPObject::updateRepr(), and SPStyle::word_spacing.
Referenced by _adjustFontsizeRecursive(), _ungroup_compensate_source_transform(), set_transform(), and SPFlowtext::set_transform().
|
private |
Initializes layout from <text> (i.e.
this node).
Definition at line 495 of file sp-text.cpp.
References Shape::AddEdge(), Shape::AddPoint(), Inkscape::Text::Layout::appendWrapShape(), Inkscape::Text::Layout::FontMetrics::ascent, Inkscape::Text::Layout::FontMetrics::computeEffective(), Geom::GenericRect< C >::corner(), Inkscape::Text::Layout::FontMetrics::descent, FontFactory::FaceFromStyle(), SPStyle::font_size, Inkscape::Util::EnableSingleton< FontFactory >::get(), get_frame(), has_inline_size(), layout, SPStyle::line_height, Inkscape::Text::Layout::LINE_HEIGHT_NORMAL, makeEffectiveShapes(), Inkscape::Text::Layout::FontMetrics::reset(), SPStyle::shape_inside, SP_CSS_UNIT_NONE, SP_CSS_WHITE_SPACE_PRE, SP_CSS_WHITE_SPACE_PRELINE, SP_CSS_WHITE_SPACE_PREWRAP, Inkscape::Text::Layout::strut, SPObject::style, uncross(), SPStyle::white_space, Inkscape::Text::Layout::WRAP_INLINE_SIZE, Inkscape::Text::Layout::wrap_mode, Inkscape::Text::Layout::WRAP_NONE, Inkscape::Text::Layout::WRAP_SHAPE_INSIDE, Inkscape::Text::Layout::WRAP_WHITE_SPACE, and Inkscape::Text::Layout::FontMetrics::xheight.
Referenced by rebuildLayout().
|
private |
Recursively walks the xml tree adding tags and their contents.
The non-trivial code does two things: firstly, it manages the positioning attributes and their inheritance rules, and secondly it keeps track of line breaks and makes sure both that they are assigned the correct SPObject and that we don't get a spurious extra one at the end of the flow.
Definition at line 561 of file sp-text.cpp.
References _buildLayoutInput(), _getFirstXLength(), _getFirstYLength(), SVGLength::_set, Inkscape::Text::Layout::appendControlCode(), Inkscape::Text::Layout::appendText(), child, SVGLength::computed, SPStyle::display, SPObject::getPrev(), SPObject::hasChildren(), Inkscape::Text::Layout::inputExists(), is_horizontal(), layout, Inkscape::Text::Layout::lengthAdjust, Inkscape::Text::Layout::PARAGRAPH_BREAK, SP_CSS_DISPLAY_NONE, sp_repr_is_meta_element(), SP_TSPAN_ROLE_UNSPECIFIED, SPObject::style, Inkscape::Text::Layout::textLength, SVGLength::unit, SVGLength::value, Inkscape::Text::Layout::WRAP_INLINE_SIZE, Inkscape::Text::Layout::wrap_mode, Inkscape::Text::Layout::WRAP_SHAPE_INSIDE, Inkscape::Text::Layout::OptionalTextTagAttrs::x, and Inkscape::Text::Layout::OptionalTextTagAttrs::y.
Referenced by _buildLayoutInput(), and rebuildLayout().
void SPText::_clearFlow | ( | Inkscape::DrawingGroup * | in_arena | ) |
discards the drawing objects representing this text.
Definition at line 1032 of file sp-text.cpp.
References Inkscape::DrawingItem::clearChildren().
Referenced by hide(), modified(), and update().
|
private |
Find first x/y values which may be in a descendent element.
Definition at line 842 of file sp-text.cpp.
References attributes, child, SPObject::children, and TextTagAttributes::getFirstXLength().
Referenced by _buildLayoutInput().
|
private |
Definition at line 861 of file sp-text.cpp.
References attributes, child, SPObject::children, and TextTagAttributes::getFirstYLength().
Referenced by _buildLayoutInput().
|
overridevirtual |
Reimplemented from SPItem.
Definition at line 311 of file sp-text.cpp.
References Inkscape::Text::Layout::bounds(), layout, and SPItem::VISUAL_BBOX.
Referenced by print().
|
overridevirtual |
Reimplemented from SPItem.
Definition at line 84 of file sp-text.cpp.
References SPItem::build(), css, DX, DY, LENGTHADJUST, SPObject::readAttr(), SPObject::repr, ROTATE, SODIPODI_LINESPACING, TEXTLENGTH, X, and Y.
|
overridevirtual |
Reimplemented from SPObject.
Definition at line 134 of file sp-text.cpp.
References SPObject::child_added(), ref, and SPObject::requestDisplayUpdate().
|
overridevirtual |
Reimplemented from SPItem.
Definition at line 354 of file sp-text.cpp.
References Geom::Affine::descrim(), SPStyle::font_family, SPStyle::font_size, Inkscape::Preferences::get(), Inkscape::Preferences::getInt(), SPItem::i2doc_affine(), Inkscape::Text::Layout::inputTruncated(), layout, Inkscape::Util::Quantity::quantity, SP_CSS_UNIT_PT, SP_IS_TEXT_TEXTPATH(), sp_style_get_css_unit_string(), Inkscape::Util::Quantity::string(), SPObject::style, te_get_layout(), and xml_quote_strdup().
|
overridevirtual |
The item's type name as a translated human string.
Translated string for UI display.
Reimplemented from SPItem.
Definition at line 344 of file sp-text.cpp.
References has_inline_size(), and has_shape_inside().
const std::vector< SPItem * > SPText::get_all_shape_dependencies | ( | ) | const |
Definition at line 1218 of file sp-text.cpp.
References SPObject::firstChild(), SPStyle::shape_inside, sp_textpath_get_path_item(), and SPObject::style.
Referenced by get_first_shape_dependency(), and getLinked().
Inkscape::XML::Node * SPText::get_first_rectangle | ( | ) |
Definition at line 1177 of file sp-text.cpp.
References SPObject::getRepr(), item, SPStyle::shape_inside, and SPObject::style.
Referenced by get_frame().
SPItem * SPText::get_first_shape_dependency | ( | ) |
Get the first shape reference which affects the position and layout of this text item.
This can be either a shape-inside or a textPath referenced shape. If this text does not depend on any other shape, then return NULL.
Definition at line 1210 of file sp-text.cpp.
References get_all_shape_dependencies(), and item.
Referenced by _ungroup_compensate_source_transform().
Geom::OptRect SPText::get_frame | ( | ) |
Definition at line 1127 of file sp-text.cpp.
References attributes, SPStyle::direction, TextTagAttributes::firstXY(), Geom::GenericRect< Coord >::from_xywh(), get_first_rectangle(), Inkscape::XML::Node::getAttributeDouble(), has_inline_size(), height, SPStyle::inline_size, is_horizontal(), SP_CSS_DIRECTION_LTR, SP_CSS_DIRECTION_RTL, SP_CSS_TEXT_ANCHOR_END, SP_CSS_TEXT_ANCHOR_MIDDLE, SP_CSS_TEXT_ANCHOR_START, SPObject::style, SPStyle::text_anchor, width, Geom::X, and Geom::Y.
Referenced by _buildLayoutInit().
std::optional< Geom::Point > SPText::getBaselinePoint | ( | ) | const |
Get the position of the baseline point for this text object.
Definition at line 955 of file sp-text.cpp.
References Inkscape::Text::Layout::baselineAnchorPoint(), layout, and Inkscape::Text::Layout::outputExists().
std::unique_ptr< Shape > SPText::getExclusionShape | ( | ) | const |
Union all exclusion shapes.
Definition at line 713 of file sp-text.cpp.
References bool_op_union, butt_straight, join_round, margin, result, SPStyle::shape_subtract, and SPObject::style.
Referenced by makeEffectiveShapes().
Add a single inclusion shape with padding.
Definition at line 759 of file sp-text.cpp.
References bool_op_diff, butt_straight, SPShape::curve(), fill_nonZero, flatten(), join_round, result, SPShape::set_shape(), SPStyle::shape_padding, SPObject::style, and SPItem::transform.
Referenced by makeEffectiveShapes().
|
overridevirtual |
Get objects which are linked to this object as either a source or a target.
Reimplemented from SPObject.
Definition at line 1195 of file sp-text.cpp.
References SPObject::ANY, SPObject::DEPENDENCY, get_all_shape_dependencies(), SPObject::getLinked(), and item.
SPCurve SPText::getNormalizedBpath | ( | ) | const |
Converts the text object to its component curves.
Definition at line 878 of file sp-text.cpp.
References Inkscape::Text::Layout::convertToCurves(), and layout.
bool SPText::has_inline_size | ( | ) | const |
Definition at line 1115 of file sp-text.cpp.
References SPStyle::inline_size, and SPObject::style.
Referenced by _buildLayoutInit(), displayName(), get_frame(), insert_text_fallback(), remove_newlines(), typeName(), and update().
bool SPText::has_shape_inside | ( | ) | const |
Definition at line 1121 of file sp-text.cpp.
References SPStyle::shape_inside, and SPObject::style.
Referenced by displayName(), insert_text_fallback(), remove_newlines(), and typeName().
|
overridevirtual |
Reimplemented from SPItem.
Definition at line 327 of file sp-text.cpp.
References _clearFlow(), key, view_style_attachments, and SPItem::views.
void SPText::hide_shape_inside | ( | ) |
Definition at line 395 of file sp-text.cpp.
References SPObject::changeCSS(), css, SPStyle::shape_inside, sp_css_attr_from_style(), sp_repr_css_attr_unref(), sp_repr_css_unset_property(), SP_STYLE_FLAG_IFSET(), and SPObject::style.
bool SPText::is_horizontal | ( | ) | const |
Definition at line 1109 of file sp-text.cpp.
References mode, SP_CSS_WRITING_MODE_LR_TB, SP_CSS_WRITING_MODE_RL_TB, SPObject::style, and SPStyle::writing_mode.
Referenced by _buildLayoutInput(), get_frame(), insert_text_fallback(), and update().
std::vector< std::unique_ptr< Shape > > SPText::makeEffectiveShapes | ( | ) | const |
Compute the final effective shapes: All inclusion shapes shrunk by the padding, from which we subtract the exclusion shapes expanded by their padding.
Definition at line 810 of file sp-text.cpp.
References bool_op_diff, getExclusionShape(), getInclusionShape(), result, SPStyle::shape_inside, SPStyle::shape_subtract, and SPObject::style.
Referenced by _buildLayoutInit().
|
overridevirtual |
Reimplemented from SPItem.
Definition at line 216 of file sp-text.cpp.
References _clearFlow(), child, SPObject::children, SPItem::geometricBounds(), layout, SPObject::parent, Inkscape::Text::Layout::show(), sp_object_ref(), sp_object_unref(), SPObject::style, view_style_attachments, and SPItem::views.
void SPText::newline_to_sodipodi | ( | ) |
Convert new lines in 'inline-size' text to tspans with sodipodi:role="tspan".
Note sodipodi:role="tspan" will be removed in the future!
Definition at line 1051 of file sp-text.cpp.
References Inkscape::Text::Layout::begin(), Inkscape::Text::Layout::characterAt(), Inkscape::Text::Layout::end(), layout, Inkscape::Text::Layout::iterator::nextCharacter(), sp_te_delete(), sp_te_insert_line(), and Inkscape::Text::Layout::validateIterator().
|
inline |
Optimize textpath text on next set_transform.
Definition at line 108 of file sp-text.h.
References _optimizeTextpathText.
|
overridevirtual |
Reimplemented from SPItem.
Definition at line 480 of file sp-text.cpp.
References bbox(), SPItem::desktopVisualBounds(), SPObject::document, Geom::GenericRect< Coord >::from_xywh(), SPItem::geometricBounds(), SPDocument::getDimensions(), SPItem::i2dt_affine(), layout, and Inkscape::Text::Layout::print().
void SPText::rebuildLayout | ( | ) |
Completely recalculates the layout.
Definition at line 883 of file sp-text.cpp.
References _buildLayoutInit(), _buildLayoutInput(), Inkscape::Text::Layout::calculateFlow(), child, SPObject::children, Inkscape::Text::Layout::chunkAnchorPoint(), Inkscape::Text::Layout::clear(), Inkscape::Text::Layout::dumpAsText(), Inkscape::Text::Layout::fitToPathAlign(), layout, SPTextPath::originalPath, Inkscape::Text::Layout::sourceToIterator(), SP_TSPAN_ROLE_UNSPECIFIED, and SPTextPath::startOffset.
Referenced by insert_text_fallback(), and update().
|
overridevirtual |
Reimplemented from SPItem.
Definition at line 99 of file sp-text.cpp.
References SPItem::release(), and view_style_attachments.
|
overridevirtual |
Reimplemented from SPObject.
Definition at line 140 of file sp-text.cpp.
References SPObject::remove_child(), and SPObject::requestDisplayUpdate().
void SPText::remove_newlines | ( | ) |
Definition at line 1001 of file sp-text.cpp.
References has_inline_size(), has_shape_inside(), SPStyle::inline_size, remove_newlines_recursive(), SPStyle::shape_inside, SPObject::style, and SPObject::updateRepr().
void SPText::remove_svg11_fallback | ( | ) |
Remove 'x' and 'y' values on children (lines) or they will be interpreted as absolute positions when 'inline-size' is removed.
Definition at line 1041 of file sp-text.cpp.
References child, and SPObject::children.
|
overridevirtual |
Reimplemented from SPItem.
Definition at line 105 of file sp-text.cpp.
References attributes, key, SPStyle::line_height, TextTagAttributes::readSingleAttribute(), SPObject::removeAttribute(), SPObject::requestDisplayUpdate(), SPItem::set(), SODIPODI_LINESPACING, SP_CSS_UNIT_PERCENT, sp_svg_read_percentage(), SPObject::style, and SPItem::viewport.
|
overridevirtual |
Reimplemented from SPItem.
Definition at line 417 of file sp-text.cpp.
References _adjustCoordsRecursive(), _adjustFontsizeRecursive(), _optimizeTextpathText, SVGLength::_set, SPItem::adjust_gradient(), SPItem::adjust_pattern(), SPItem::adjust_stroke_width_recursive(), attributes, Geom::Affine::descrim(), Inkscape::Preferences::get(), Inkscape::Preferences::getBool(), TextTagAttributes::getTextLength(), SPStyle::inline_size, Geom::Affine::inverse(), SPStyle::shape_inside, SP_IS_TEXT_TEXTPATH(), and SPObject::style.
|
overridevirtual |
Reimplemented from SPItem.
Definition at line 315 of file sp-text.cpp.
References SPItem::geometricBounds(), key, layout, SPObject::parent, Inkscape::DrawingGroup::setPickChildren(), Inkscape::DrawingItem::setStyle(), Inkscape::Text::Layout::show(), SPObject::style, and view_style_attachments.
void SPText::show_shape_inside | ( | ) |
This two functions are useful because layout calculations need text visible for example Calculating a invisible char position object or pasting text with paragraphs that overflow shape defined.
I have doubts about transform into a toggle function
Definition at line 410 of file sp-text.cpp.
References SPObject::changeCSS(), and css.
|
overridevirtual |
Reimplemented from SPItem.
Definition at line 379 of file sp-text.cpp.
References Inkscape::Text::Layout::baselineAnchorPoint(), SPItem::i2dt_affine(), Inkscape::SnapPreferences::isTargetSnappable(), layout, Inkscape::Text::Layout::outputExists(), Inkscape::SNAPSOURCE_TEXT_ANCHOR, Inkscape::SNAPTARGET_TEXT_ANCHOR, Inkscape::SNAPTARGET_TEXT_BASELINE, and te_get_layout().
void SPText::sodipodi_to_newline | ( | ) |
Convert tspans with sodipodi:role="tspans" to '
'.
Note sodipodi:role="tspan" will be removed in the future!
Definition at line 1077 of file sp-text.cpp.
References child, SPObject::childList(), SPObject::lastChild(), SP_CSS_WHITE_SPACE_PRE, and SP_TSPAN_ROLE_LINE.
|
inlineoverridevirtual |
|
overridevirtual |
The item's type name, not node tag name.
NOT translated.
Reimplemented from SPItem.
Definition at line 338 of file sp-text.cpp.
References has_inline_size(), and has_shape_inside().
|
overridevirtual |
Reimplemented from SPItem.
Definition at line 147 of file sp-text.cpp.
References _clearFlow(), attributes, child, SPObject::children, SPStyle::font_size, SPItem::geometricBounds(), has_inline_size(), Geom::GenericRect< C >::height(), SPStyle::inline_size, is_horizontal(), layout, SPObject::parent, rebuildLayout(), Inkscape::Text::Layout::show(), SP_CSS_UNIT_PERCENT, sp_object_ref(), sp_object_unref(), SPObject::style, TextTagAttributes::update(), SPItem::update(), view_style_attachments, SPItemCtx::viewport, SPItem::views, w, and Geom::GenericRect< C >::width().
|
overridevirtual |
Reimplemented from SPItem.
Definition at line 257 of file sp-text.cpp.
References Inkscape::XML::Node::addChild(), attributes, child, SPObject::children, Inkscape::XML::Document::createElement(), Inkscape::XML::Document::createTextNode(), Inkscape::GC::release(), SPObject::repr, Inkscape::XML::Node::setAttribute(), SPItem::write(), and TextTagAttributes::writeTo().
bool SPText::_optimizeTextpathText = false |
Definition at line 73 of file sp-text.h.
Referenced by optimizeTextpathText(), and set_transform().
TextTagAttributes SPText::attributes |
Definition at line 51 of file sp-text.h.
Referenced by _getFirstXLength(), _getFirstYLength(), get_frame(), set(), set_transform(), update(), and write().
|
private |
Definition at line 104 of file sp-text.h.
Referenced by build(), hide_shape_inside(), show_shape_inside(), and ~SPText().
Inkscape::Text::Layout SPText::layout |
Definition at line 52 of file sp-text.h.
Referenced by _buildLayoutInit(), _buildLayoutInput(), bbox(), description(), getBaselinePoint(), getNormalizedBpath(), insert_text_fallback(), modified(), newline_to_sodipodi(), print(), rebuildLayout(), show(), snappoints(), Inkscape::Extension::Internal::LaTeXTextRenderer::sp_text_render(), Inkscape::Extension::Internal::sp_text_render(), and update().
std::unordered_map<unsigned, Inkscape::Text::StyleAttachments> SPText::view_style_attachments |