86 double number = value ? g_ascii_strtod(value,
nullptr) : 0;
96 double number = value ? g_ascii_strtod(value,
nullptr) : 0;
106 double number = value ? g_ascii_strtod(value,
nullptr) :
FNT_DEFAULT_ADV;
116 double number = value ? g_ascii_strtod(value,
nullptr) :
FNT_DEFAULT_ADV / 2.0;
154 if (flags & (SP_OBJECT_MODIFIED_FLAG)) {
166#define COPY_ATTR(rd,rs,key) (rd)->setAttribute((key), rs->attribute(key));
169 if ((flags & SP_OBJECT_WRITE_BUILD) && !
repr) {
183 COPY_ATTR(
repr, this->
getRepr(),
"horiz-origin-x");
184 COPY_ATTR(
repr, this->
getRepr(),
"horiz-origin-y");
215 g_assert(g !=
nullptr);
226 std::vector<std::pair<SPGlyph*, Node*>> glyphs;
231 if (
auto g = cast<SPGlyph>(&
node)) {
232 glyphs.emplace_back(g, g->getRepr());
234 g->getRepr()->anchor();
239 std::stable_sort(begin(glyphs),
end(glyphs), [](
const std::pair<SPGlyph*, Node*>& a,
const std::pair<SPGlyph*, Node*>& b) {
242 const auto& str1 = a.first->unicode;
243 const auto& str2 = b.first->unicode;
244 return std::lexicographical_compare(str1.begin(), str1.end(), str2.begin(), str2.end());
250 for (
auto&& glyph : glyphs) {
255 for (
auto&& glyph : glyphs) {
257 glyph.second->release();
Lookup dictionary for attributes/properties.
Interface for refcounted XML nodes.
virtual void appendChild(Node *child)=0
Append a node as the last child of this node.
void setAttribute(Util::const_char_ptr key, Util::const_char_ptr value)
Change an attribute of this node.
virtual void removeChild(Node *child)=0
Remove a child of this node.
virtual unsigned childCount() const =0
Get the number of children of this node.
bool setAttributeSvgDouble(Util::const_char_ptr key, double val)
For attributes where an exponent is allowed.
Typed SVG document implementation.
bool removeResource(char const *key, SPObject *object)
bool addResource(char const *key, SPObject *object)
Inkscape::XML::Document * getReprDoc()
Our Inkscape::XML::Document.
SPObject * getObjectByRepr(Inkscape::XML::Node *repr) const
void child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) override
Callback for child_added event.
Inkscape::XML::Node * write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned int flags) override
SPGlyph * create_new_glyph(const char *name, const char *unicode)
void build(SPDocument *doc, Inkscape::XML::Node *repr) override
void update(SPCtx *ctx, unsigned int flags) override
Receives update notifications.
void remove_child(Inkscape::XML::Node *child) override
Callback for remove_child event.
void set(SPAttr key, char const *value) override
SPObject is an abstract base class of all of the document nodes at the SVG document level.
Inkscape::XML::Node * repr
void requestModified(unsigned int flags)
Requests that a modification notification signal be emitted later (e.g.
virtual void set(SPAttr key, const char *value)
virtual void remove_child(Inkscape::XML::Node *child)
virtual Inkscape::XML::Node * write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned int flags)
virtual void update(SPCtx *ctx, unsigned int flags)
void readAttr(char const *key)
Read value of key attribute from XML node into object.
Inkscape::XML::Node * getRepr()
Returns the XML representation of tree.
virtual void child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
virtual void build(SPDocument *doc, Inkscape::XML::Node *repr)
Inkscape::XML::Node * node
static R & release(R &r)
Decrements the reference count of a anchored object.
static cairo_user_data_key_t key
double FNT_DEFAULT_ASCENT
Interface for XML documents.
virtual Node * createElement(char const *name)=0
Interface for XML documents.