|
NovaSVG 0.10.0
A header-only SVG library
|
#include <string>#include <forward_list>#include <list>#include <map>#include <unordered_map>#include <optional>#include <vector>#include <cmath>#include <cctype>#include <set>#include <cassert>#include "svgparserutils.h"

Go to the source code of this file.
Namespaces | |
| namespace | novasvg |
| Main namespace for the NovaSVG library. | |
| namespace | novasvg::Specificity |
Typedefs | |
| template<typename Enum > | |
| using | novasvg::SVGEnumerationEntry = std::pair< Enum, std::string_view > |
| using | novasvg::LengthList = std::vector< Length > |
| using | novasvg::NumberList = std::vector< float > |
| using | novasvg::PointList = std::vector< Point > |
| using | novasvg::AttributeList = std::forward_list< Attribute > |
| using | novasvg::SVGNodeList = std::list< std::unique_ptr< SVGNode > > |
| using | novasvg::SVGPropertyList = std::forward_list< SVGProperty * > |
| using | novasvg::SVGMarkerPositionList = std::vector< SVGMarkerPosition > |
| using | novasvg::SVGCharacterPositions = std::map< size_t, SVGCharacterPosition > |
| using | novasvg::SVGTextPositionList = std::vector< SVGTextPosition > |
| using | novasvg::SVGTextFragmentList = std::vector< SVGTextFragment > |
| using | novasvg::SVGTextFragmentIterator = SVGTextFragmentList::iterator |
Functions | |
| PropertyID | novasvg::propertyid (std::string_view name) |
| PropertyID | novasvg::csspropertyid (std::string_view name) |
| ElementID | novasvg::elementid (std::string_view name) |
| const SVGElement * | novasvg::toSVGElement (const SVGNode *node) |
| SVGElement * | novasvg::toSVGElement (SVGNode *node) |
| SVGElement * | novasvg::toSVGElement (const std::unique_ptr< SVGNode > &node) |
| NOVASVG_INLINE GradientStops | novasvg::buildGradientStops (const SVGGradientElement *element, float opacity) |
| const SVGTextNode * | novasvg::toSVGTextNode (const SVGNode *node) |
| const SVGTextPositioningElement * | novasvg::toSVGTextPositioningElement (const SVGNode *node) |
| NOVASVG_INLINE AlignmentBaseline | novasvg::resolveDominantBaseline (const SVGTextPositioningElement *element) |
| NOVASVG_INLINE float | novasvg::calculateBaselineOffset (const SVGTextPositioningElement *element) |
| NOVASVG_INLINE bool | novasvg::needsTextAnchorAdjustment (const SVGTextPositioningElement *element) |
| NOVASVG_INLINE float | novasvg::calculateTextAnchorOffset (const SVGTextPositioningElement *element, float width) |
| NOVASVG_INLINE float | novasvg::calculateTextChunkLength (SVGTextFragmentIterator begin, SVGTextFragmentIterator end, bool isVerticalText) |
| NOVASVG_INLINE void | novasvg::handleTextChunk (SVGTextFragmentIterator begin, SVGTextFragmentIterator end) |
| NOVASVG_INLINE std::optional< Color > | novasvg::parseColorValue (std::string_view &input, const SVGLayoutState *state) |
| NOVASVG_INLINE Color | novasvg::parseColor (std::string_view input, const SVGLayoutState *state, const Color &defaultValue) |
| NOVASVG_INLINE Color | novasvg::parseColorOrNone (std::string_view input, const SVGLayoutState *state, const Color &defaultValue) |
| NOVASVG_INLINE bool | novasvg::parseUrlValue (std::string_view &input, std::string &value) |
| NOVASVG_INLINE std::string | novasvg::parseUrl (std::string_view input) |
| NOVASVG_INLINE Paint | novasvg::parsePaint (std::string_view input, const SVGLayoutState *state, const Color &defaultValue) |
| NOVASVG_INLINE float | novasvg::parseNumberOrPercentage (std::string_view input, bool allowPercentage, float defaultValue) |
| NOVASVG_INLINE Length | novasvg::parseLength (std::string_view input, LengthNegativeMode mode, const Length &defaultValue) |
| NOVASVG_INLINE BaselineShift | novasvg::parseBaselineShift (std::string_view input) |
| NOVASVG_INLINE LengthList | novasvg::parseDashArray (std::string_view input) |
| NOVASVG_INLINE Length | novasvg::parseLengthOrNormal (std::string_view input) |
| NOVASVG_INLINE float | novasvg::parseFontSize (std::string_view input, const SVGLayoutState *state) |
| template<typename Enum , unsigned int N> | |
| NOVASVG_INLINE Enum | novasvg::parseEnumValue (std::string_view input, const SVGEnumerationEntry< Enum >(&entries)[N], Enum defaultValue) |
| NOVASVG_INLINE Display | novasvg::parseDisplay (std::string_view input) |
| NOVASVG_INLINE Visibility | novasvg::parseVisibility (std::string_view input) |
| NOVASVG_INLINE Overflow | novasvg::parseOverflow (std::string_view input) |
| NOVASVG_INLINE PointerEvents | novasvg::parsePointerEvents (std::string_view input) |
| NOVASVG_INLINE FontWeight | novasvg::parseFontWeight (std::string_view input) |
| NOVASVG_INLINE FontStyle | novasvg::parseFontStyle (std::string_view input) |
| NOVASVG_INLINE AlignmentBaseline | novasvg::parseAlignmentBaseline (std::string_view input) |
| NOVASVG_INLINE DominantBaseline | novasvg::parseDominantBaseline (std::string_view input) |
| NOVASVG_INLINE Direction | novasvg::parseDirection (std::string_view input) |
| NOVASVG_INLINE WritingMode | novasvg::parseWritingMode (std::string_view input) |
| NOVASVG_INLINE TextOrientation | novasvg::parseTextOrientation (std::string_view input) |
| NOVASVG_INLINE TextAnchor | novasvg::parseTextAnchor (std::string_view input) |
| NOVASVG_INLINE WhiteSpace | novasvg::parseWhiteSpace (std::string_view input) |
| NOVASVG_INLINE MixBlendMode | novasvg::parseMixBlendMode (std::string_view input) |
| NOVASVG_INLINE MaskType | novasvg::parseMaskType (std::string_view input) |
| NOVASVG_INLINE FillRule | novasvg::parseFillRule (std::string_view input) |
| NOVASVG_INLINE LineCap | novasvg::parseLineCap (std::string_view input) |
| NOVASVG_INLINE LineJoin | novasvg::parseLineJoin (std::string_view input) |
| NOVASVG_INLINE Font | novasvg::makeFont (const std::string &family, float size, bool bold, bool italic) |
| bool | novasvg::isDisallowedElement (const SVGElement *element) |
| NOVASVG_INLINE Bitmap | novasvg::loadImageResource (const std::string &href) |
| ForeignObjectMetrics | novasvg::measureForeignObjectSegments (std::string_view rawHtml, const std::vector< ForeignObjectSegment > &segments, const ForeignObjectFonts &fonts, unsigned char baseStyle, float maxWidth) |
Measures what ForeignObjectMetrics::height (etc.) will be for rawHtml painted with font, using the exact same foreignObjectPlainText() / wrapForeignObjectText() / foreignObjectLineHeight() logic ForeignObjectSimple::render() itself calls – so a value computed here and a box later painted by novasvg with the same (rawHtml, font) can never disagree, short of a bug in this shared logic itself. | |
| ForeignObjectMetrics | novasvg::measureForeignObjectContent (std::string_view rawHtml, const ForeignObjectFonts &fonts, float maxWidth=-1.f, unsigned char baseStyle=0) |
measureForeignObjectContent() for text that may carry bold and italic: fonts supplies the face for each style (see ForeignObjectFonts; SVGForeignObjectElement::fontsFor() builds it the way painting does), baseStyle is the style the foreignObject itself has. This is exactly what painting does, so the metrics and the painted box cannot disagree about a bold label being wider than a regular one. | |
| ForeignObjectMetrics | novasvg::measureForeignObjectContent (std::string_view rawHtml, const Font &font, float maxWidth=-1.f) |
measureForeignObjectContent() with a single face: every style is measured with font, i.e. as if the text had no bold or italic in it. Line breaks and heights are unaffected by bold or italic; only the widths of styled stretches can differ from what painting produces, by however much the real bold/italic faces differ from font. Use the ForeignObjectFonts overload when that matters. | |
| bool | novasvg::switchChildPasses (const SVGElement *child) |
| const SVGGeometryElement * | novasvg::toSVGGeometryElement (const SVGNode *node) |
Variables | |
| const std::string | novasvg::emptyString |
| bool isPixels |
Definition at line 6257 of file svgelement.h.
| float raw |
Definition at line 6256 of file svgelement.h.
| unsigned char style = 0 |
Definition at line 6312 of file svgelement.h.
Referenced by novasvg::render::font_face_cache_load_file(), novasvg::SVGForeignObjectElement::fontsFor(), and novasvg::ForeignObjectFonts::get().
| std::u32string text |
UTF-8; '
' marks a forced line break (
,.
,
Definition at line 6311 of file svgelement.h.
Referenced by novasvg::SVGRootElement::addStyleSheet(), novasvg::SVGTextFragmentsBuilder::build(), novasvg::render::canvas_add_text(), novasvg::render::canvas_clip_text(), novasvg::render::canvas_fill_text(), novasvg::render::canvas_stroke_text(), novasvg::render::canvas_text_extents(), novasvg::render::font_face_text_extents(), novasvg::Font::glyphBoxes(), novasvg::Font::measureText(), novasvg::SVGTextElement::render(), novasvg::SVGForeignObjectElement::setHtmlStyle(), novasvg::render::text_iterator_init(), and novasvg::render::text_iterator_next().