AeonGUI
A portable video game graphic user interface library.
Loading...
Searching...
No Matches
SVGTextContentElement.hpp
1/*
2Copyright (C) 2025,2026 Rodrigo Jose Hernandez Cordoba
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16#ifndef AEONGUI_SVGCONTENTELEMENT_H
17#define AEONGUI_SVGCONTENTELEMENT_H
18
19#include "SVGGraphicsElement.hpp"
20#include "SVGAnimatedLength.hpp"
21#include "SVGAnimatedEnumeration.hpp"
22#include "DOMPoint.hpp"
23#include "DOMRect.hpp"
24#include "aeongui/PangoTextLayout.hpp"
25#include <memory>
26
27namespace AeonGUI
28{
29 namespace DOM
30 {
35 {
36 public:
42 SVGTextContentElement ( const DOMString& aTagName, AttributeMap&& aAttributes, Node* aParent );
47 const SVGAnimatedLength& textLength() const;
51
54 long getNumberOfChars() const;
57 float getComputedTextLength() const;
63 float getSubStringLength ( long start, long end ) const;
68 DOMPoint getStartPositionOfChar ( long index ) const;
73 DOMPoint getEndPositionOfChar ( long index ) const;
78 DOMRect getExtentOfChar ( long index ) const;
83 float getRotationOfChar ( long index ) const;
88 long getCharNumAtPosition ( const DOMPoint& point ) const;
89 protected:
93 private:
95 std::string getTextContent() const;
97 void syncTextLayout() const;
98
99 SVGAnimatedLength mTextLength;
100 SVGAnimatedEnumeration mLengthAdjust;
101 mutable PangoTextLayout mTextLayout;
102 };
103 }
104}
105#endif
Mutable 3D point with a perspective component.
Definition DOMPoint.hpp:32
Mutable rectangle.
Definition DOMRect.hpp:32
Base class for all nodes in the DOM tree.
Definition Node.hpp:40
Animated enumeration attribute (SVG).
Definition SVGAnimatedEnumeration.hpp:31
Animated length attribute (SVG).
Definition SVGAnimatedLength.hpp:30
SVGGraphicsElement(const DOMString &aTagName, AttributeMap &&aAttributes, Node *aParent)
Construct an SVGGraphicsElement.
Definition SVGGraphicsElement.cpp:24
const SVGAnimatedLength & textLength() const
Get the animated text length.
Definition SVGTextContentElement.cpp:31
DOMPoint getStartPositionOfChar(long index) const
Get the start position of a character.
Definition SVGTextContentElement.cpp:208
float getSubStringLength(long start, long end) const
Get the advance width of a substring.
Definition SVGTextContentElement.cpp:180
PangoTextLayout & GetTextLayout() const
Definition SVGTextContentElement.cpp:41
DOMPoint getEndPositionOfChar(long index) const
Get the end position of a character.
Definition SVGTextContentElement.cpp:223
long getNumberOfChars() const
Get the total number of characters.
Definition SVGTextContentElement.cpp:168
DOMRect getExtentOfChar(long index) const
Get the bounding box of a character.
Definition SVGTextContentElement.cpp:238
long getCharNumAtPosition(const DOMPoint &point) const
Get the character index at a point.
Definition SVGTextContentElement.cpp:270
~SVGTextContentElement() override
Destructor.
SVGTextContentElement(const DOMString &aTagName, AttributeMap &&aAttributes, Node *aParent)
Construct an SVGTextContentElement.
Definition SVGTextContentElement.cpp:27
float getComputedTextLength() const
Get the computed total advance width of the text.
Definition SVGTextContentElement.cpp:174
const SVGAnimatedEnumeration & lengthAdjust() const
Get the animated length adjust enumeration.
Definition SVGTextContentElement.cpp:36
float getRotationOfChar(long index) const
Get the rotation of a character.
Definition SVGTextContentElement.cpp:257
Pango-backed text layout implementation.
Definition PangoTextLayout.hpp:39