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#ifdef AEONGUI_USE_SKIA
25#include "aeongui/SkiaTextLayout.hpp"
26#else
27#include "aeongui/PangoTextLayout.hpp"
28#endif
29#include <memory>
30
31namespace AeonGUI
32{
33 namespace DOM
34 {
39 {
40 public:
46 SVGTextContentElement ( const DOMString& aTagName, AttributeMap&& aAttributes, Node* aParent );
51 const SVGAnimatedLength& textLength() const;
55
58 long getNumberOfChars() const;
61 float getComputedTextLength() const;
67 float getSubStringLength ( long start, long end ) const;
72 DOMPoint getStartPositionOfChar ( long index ) const;
77 DOMPoint getEndPositionOfChar ( long index ) const;
82 DOMRect getExtentOfChar ( long index ) const;
87 float getRotationOfChar ( long index ) const;
92 long getCharNumAtPosition ( const DOMPoint& point ) const;
93 protected:
96#ifdef AEONGUI_USE_SKIA
98#else
100#endif
104 std::string getTextContent() const;
105 private:
107 void syncTextLayout() const;
108
109 SVGAnimatedLength mTextLength;
110 SVGAnimatedEnumeration mLengthAdjust;
111#ifdef AEONGUI_USE_SKIA
112 mutable SkiaTextLayout mTextLayout;
113#else
114 mutable PangoTextLayout mTextLayout;
115#endif
116 };
117 }
118}
119#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:42
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:27
const SVGAnimatedLength & textLength() const
Get the animated text length.
Definition SVGTextContentElement.cpp:32
DOMPoint getStartPositionOfChar(long index) const
Get the start position of a character.
Definition SVGTextContentElement.cpp:132
float getSubStringLength(long start, long end) const
Get the advance width of a substring.
Definition SVGTextContentElement.cpp:104
PangoTextLayout & GetTextLayout() const
Definition SVGTextContentElement.cpp:45
DOMPoint getEndPositionOfChar(long index) const
Get the end position of a character.
Definition SVGTextContentElement.cpp:147
long getNumberOfChars() const
Get the total number of characters.
Definition SVGTextContentElement.cpp:92
DOMRect getExtentOfChar(long index) const
Get the bounding box of a character.
Definition SVGTextContentElement.cpp:162
std::string getTextContent() const
Get concatenated text content from child text nodes.
Definition SVGTextContentElement.cpp:68
long getCharNumAtPosition(const DOMPoint &point) const
Get the character index at a point.
Definition SVGTextContentElement.cpp:194
~SVGTextContentElement() override
Destructor.
SVGTextContentElement(const DOMString &aTagName, AttributeMap &&aAttributes, Node *aParent)
Construct an SVGTextContentElement.
Definition SVGTextContentElement.cpp:28
float getComputedTextLength() const
Get the computed total advance width of the text.
Definition SVGTextContentElement.cpp:98
const SVGAnimatedEnumeration & lengthAdjust() const
Get the animated length adjust enumeration.
Definition SVGTextContentElement.cpp:37
float getRotationOfChar(long index) const
Get the rotation of a character.
Definition SVGTextContentElement.cpp:181
Pango-backed text layout implementation.
Definition PangoTextLayout.hpp:39
Skia-backend text layout implementation.
Definition SkiaTextLayout.hpp:37