25 qRegisterMetaType<KoSvgText::CssLengthPercentage>(
"KoSvgText::CssLengthPercentage");
43#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
44 qRegisterMetaTypeStreamOperators<KoSvgText::FontFamilyAxis>(
"KoSvgText::FontFamilyAxis");
45 qRegisterMetaTypeStreamOperators<KoSvgText::FontFamilyStyleInfo>(
"KoSvgText::FontFamilyStyleInfo");
47 QMetaType::registerEqualsComparator<KoSvgText::CssLengthPercentage>();
48 QMetaType::registerDebugStreamOperator<KoSvgText::CssLengthPercentage>();
50 QMetaType::registerEqualsComparator<KoSvgText::AutoValue>();
51 QMetaType::registerDebugStreamOperator<KoSvgText::AutoValue>();
54 QMetaType::registerEqualsComparator<KoSvgText::AutoLengthPercentage>();
55 QMetaType::registerDebugStreamOperator<KoSvgText::AutoLengthPercentage>();
57 QMetaType::registerEqualsComparator<KoSvgText::CssFontStyleData>();
58 QMetaType::registerDebugStreamOperator<KoSvgText::CssFontStyleData>();
60 QMetaType::registerEqualsComparator<KoSvgText::BackgroundProperty>();
61 QMetaType::registerDebugStreamOperator<KoSvgText::BackgroundProperty>();
64 QMetaType::registerEqualsComparator<KoSvgText::StrokeProperty>();
65 QMetaType::registerDebugStreamOperator<KoSvgText::StrokeProperty>();
68 QMetaType::registerEqualsComparator<KoSvgText::TextTransformInfo>();
69 QMetaType::registerDebugStreamOperator<KoSvgText::TextTransformInfo>();
72 QMetaType::registerEqualsComparator<KoSvgText::TextIndentInfo>();
73 QMetaType::registerDebugStreamOperator<KoSvgText::TextIndentInfo>();
76 QMetaType::registerEqualsComparator<KoSvgText::TabSizeInfo>();
77 QMetaType::registerDebugStreamOperator<KoSvgText::TabSizeInfo>();
79 QMetaType::registerEqualsComparator<KoSvgText::LineHeightInfo>();
80 QMetaType::registerDebugStreamOperator<KoSvgText::LineHeightInfo>();
82 QMetaType::registerEqualsComparator<KoSvgText::FontFamilyAxis>();
83 QMetaType::registerDebugStreamOperator<KoSvgText::FontFamilyAxis>();
85 QMetaType::registerEqualsComparator<KoSvgText::FontFamilyStyleInfo>();
86 QMetaType::registerDebugStreamOperator<KoSvgText::FontFamilyStyleInfo>();
88 QMetaType::registerEqualsComparator<KoSvgText::FontFeatureLigatures>();
89 QMetaType::registerDebugStreamOperator<KoSvgText::FontFeatureLigatures>();
91 QMetaType::registerEqualsComparator<KoSvgText::FontFeatureNumeric>();
92 QMetaType::registerDebugStreamOperator<KoSvgText::FontFeatureNumeric>();
94 QMetaType::registerEqualsComparator<KoSvgText::FontFeatureEastAsian>();
95 QMetaType::registerDebugStreamOperator<KoSvgText::FontFeatureEastAsian>();
97 QMetaType::registerEqualsComparator<KoSvgText::FontMetrics>();
98 QMetaType::registerDebugStreamOperator<KoSvgText::FontMetrics>();
100 QMetaType::registerEqualsComparator<KoSvgText::TextUnderlinePosition>();
101 QMetaType::registerDebugStreamOperator<KoSvgText::TextUnderlinePosition>();
153 }
else if (
value.customValue == 0) {
155 }
else if (
value.customValue == 90) {
291 dbg.nospace() << (
value.isAuto ?
"auto" : QString::number(
value.customValue));
297 if (
value.style == QFont::StyleOblique) {
298 dbg.nospace() <<
"oblique ";
299 dbg.nospace() <<
value.slantValue;
301 dbg.nospace() << (
value.style == QFont::StyleItalic?
"italic":
"roman");
366 result.rx() = *
dxPos;
370 result.ry() = *
dyPos;
384QDebug addSeparator(QDebug dbg,
bool hasPreviousContent) {
385 return hasPreviousContent ? (dbg.nospace() <<
"; ") : dbg;
391 dbg.nospace() <<
"CharTransformation(";
393 bool hasContent =
false;
396 dbg.nospace() <<
"xPos = " << *t.
xPos;
401 dbg = addSeparator(dbg, hasContent);
402 dbg.nospace() <<
"yPos = " << *t.
yPos;
407 dbg = addSeparator(dbg, hasContent);
408 dbg.nospace() <<
"dxPos = " << *t.
dxPos;
413 dbg = addSeparator(dbg, hasContent);
414 dbg.nospace() <<
"dyPos = " << *t.
dyPos;
419 dbg = addSeparator(dbg, hasContent);
420 dbg.nospace() <<
"rotate = " << *t.
rotate;
424 dbg.nospace() <<
")";
430 dbg.nospace() <<
"TextTransformInfo(";
432 dbg.nospace() <<
")";
437 dbg.nospace() <<
"TextIndentInfo(";
439 dbg.nospace() <<
")";
445 dbg.nospace() <<
"TextIndentInfo(";
447 if (
value.isNumber) {
448 dbg.nospace() <<
"x Spaces";
450 dbg.nospace() <<
")";
456 dbg.nospace() <<
"BackgroundProperty(";
458 dbg.nospace() << prop.
property.data();
461 dbg.nospace() <<
", color, " << fill->color();
465 dbg.nospace() <<
", gradient, " << fill->gradient();
469 dbg.nospace() <<
", pattern, num shapes: " << fill->shapes().size();
472 dbg.nospace() <<
")";
478 dbg.nospace() <<
"StrokeProperty(";
480 dbg.nospace() << prop.
property.data();
483 dbg.nospace() <<
", " << stroke->resultLinePen();
486 dbg.nospace() <<
")";
523 if (
value ==
"pre") {
527 }
else if (
value ==
"nowrap") {
531 }
else if (
value ==
"pre-wrap") {
535 }
else if (
value ==
"pre-wrap") {
539 }
else if (
value ==
"pre-line") {
544 if (
value !=
"normal") {
558 if (
value ==
"preserve") {
576 if (
value !=
"default") {
587 Q_UNUSED(trimMethod);
588 if (wrapMethod !=
NoWrap) {
594 return "break-spaces";
672 Q_FOREACH (
const QString ¶m, values) {
673 if (param ==
"capitalize") {
675 }
else if (param ==
"uppercase") {
677 }
else if (param ==
"lowercase") {
679 }
else if (param ==
"full-width") {
681 }
else if (param ==
"full-size-kana") {
683 }
else if (param ==
"none") {
688 qWarning() <<
"Unknown parameter in text-transform" << param;
691 return textTransform;
698 values.append(
"none");
701 values.append(
"lowercase");
703 values.append(
"uppercase");
705 values.append(
"capitalize");
708 values.append(
"full-width");
711 values.append(
"full-size-kana");
714 return values.join(
" ");
721 Q_FOREACH (
const QString ¶m, values) {
722 if (param ==
"hanging") {
724 }
else if (param ==
"each-line") {
740 values.append(
"hanging");
743 values.append(
"each-line");
745 return values.join(
" ");
753 tabSizeInfo.
value = qMax(0.0, val);
759 tabSizeInfo.
value = 0;
781 int newStretch = 100;
783 static constexpr std::array<int, 9> fontStretches = {50, 62, 75, 87, 100, 112, 125, 150, 200};
785 if (
value ==
"wider") {
786 const auto it = std::upper_bound(fontStretches.begin(), fontStretches.end(), currentStretch);
788 newStretch = it != fontStretches.end() ? *it : fontStretches.back();
789 }
else if (
value ==
"narrower") {
791 std::upper_bound(fontStretches.rbegin(), fontStretches.rend(), currentStretch, std::greater<int>());
793 newStretch = it != fontStretches.rend() ? *it : fontStretches.front();
797 newStretch =
value.toInt(&ok, 10);
804 newStretch = fontStretches.at(
static_cast<size_t>(index));
822 static constexpr std::array<int, 9> svgFontWeights = {100, 200, 300, 400, 500, 600, 700, 800, 900};
826 else if (
value ==
"bolder") {
827 const auto it = std::upper_bound(svgFontWeights.begin(), svgFontWeights.end(), currentWeight);
829 weight = it != svgFontWeights.end() ? *it : svgFontWeights.back();
830 }
else if (
value ==
"lighter") {
832 std::upper_bound(svgFontWeights.rbegin(), svgFontWeights.rend(), currentWeight, std::greater<int>());
834 weight = it != svgFontWeights.rend() ? *it : svgFontWeights.front();
839 const int parsed =
value.toInt(&ok, 10);
841 weight = qBound(0, parsed, 1000);
854 lineHeight.
value = parsed;
863 lineHeight.
value = 0;
872 if (lineHeight.
isNormal)
return QString(
"normal");
885 dbg.nospace() <<
"LineHeightInfo(";
887 if (
value.isNormal) {
888 dbg.nospace() <<
"normal";
889 }
else if (!
value.isNumber) {
890 dbg.nospace() <<
value.value <<
"pt";
892 dbg.nospace() <<
value.value;
895 dbg.nospace() <<
")";
901 dbg.nospace() <<
"Length(";
904 dbg.nospace() <<
value.value <<
"%";
906 dbg.nospace() <<
value.value <<
"em";
908 dbg.nospace() <<
value.value <<
"ex";
910 dbg.nospace() <<
value.value <<
"cap";
912 dbg.nospace() <<
value.value <<
"ch";
914 dbg.nospace() <<
value.value <<
"ic";
916 dbg.nospace() <<
value.value <<
"lh";
918 dbg.nospace() <<
value.value <<
"(pt)";
921 dbg.nospace() <<
")";
955 const qreal ftMultiplier = fontSize / metrics.
fontSize;
958 }
else if (
u ==
Ex) {
960 }
else if (
u ==
Cap) {
962 }
else if (
u ==
Ch) {
964 }
else if (
u ==
Ic) {
966 }
else if (
u ==
Lh) {
987 dbg.nospace() <<
"auto";
989 dbg.nospace() <<
value.length;
1004 QDomElement root = doc.createElement(
"axis");
1005 root.setAttribute(
"tagName", axis.
tag);
1009 root.setAttribute(
"hidden", axis.
axisHidden?
"true":
"false");
1010 root.setAttribute(
"variable", axis.
variableAxis?
"true":
"false");
1012 QDomElement name = doc.createElement(
"name");
1013 name.setAttribute(
"lang", it.key().bcp47Name());
1014 name.setAttribute(
"value", it.value());
1015 root.appendChild(name);
1017 doc.appendChild(root);
1018 out << doc.toString(0);
1027 doc.setContent(xml);
1028 QDomElement root = doc.childNodes().at(0).toElement();
1029 axis.
tag = root.attribute(
"tagName");
1033 axis.
axisHidden = root.attribute(
"hidden") ==
"true"?
true:
false;
1034 axis.
variableAxis = root.attribute(
"variable") ==
"true"?
true:
false;
1035 QDomNodeList names = root.elementsByTagName(
"name");
1036 for(
int i = 0; i < names.size(); i++) {
1037 QDomElement name = names.at(i).toElement();
1038 QString lang = name.attribute(
"lang");
1039 QString
value = name.attribute(
"value");
1041 if (l != QLocale::c()) {
1058 QDomElement root = doc.createElement(
"style");
1059 root.setAttribute(
"italic", style.
isItalic?
"true":
"false");
1060 root.setAttribute(
"oblique", style.
isOblique?
"true":
"false");
1062 QDomElement coord = doc.createElement(
"coord");
1063 coord.setAttribute(
"tag", it.key());
1065 root.appendChild(coord);
1068 QDomElement name = doc.createElement(
"name");
1069 name.setAttribute(
"lang", it.key().bcp47Name());
1070 name.setAttribute(
"value", it.value());
1071 root.appendChild(name);
1073 doc.appendChild(root);
1074 out << doc.toString(0);
1082 doc.setContent(xml);
1083 QDomElement root = doc.childNodes().at(0).toElement();
1084 style.
isItalic = root.attribute(
"italic") ==
"true"?
true:
false;
1085 style.
isOblique = root.attribute(
"oblique") ==
"true"?
true:
false;
1086 QDomNodeList names = root.elementsByTagName(
"name");
1087 for(
int i = 0; i < names.size(); i++) {
1088 QDomElement name = names.at(i).toElement();
1089 QString lang = name.attribute(
"lang");
1090 QString
value = name.attribute(
"value");
1092 if (l != QLocale::c()) {
1096 QDomNodeList coords = root.elementsByTagName(
"coord");
1097 for(
int i = 0; i < coords.size(); i++) {
1098 QDomElement coord = coords.at(i).toElement();
1099 QString tag = coord.attribute(
"tag");
1111 if (!params.isEmpty()) {
1112 QString style = params.first();
1113 slant.
style = style ==
"italic"? QFont::StyleItalic: style ==
"oblique"? QFont::StyleOblique: QFont::StyleNormal;
1115 if (params.size() > 1) {
1116 QString angle = params.last();
1117 if (angle.endsWith(
"deg")) {
1129 value.style == QFont::StyleItalic ?
"italic" :
1130 value.style == QFont::StyleOblique ?
"oblique" :
"normal";
1131 if (
value.style == QFont::StyleOblique && !
value.slantValue.isAuto) {
1132 style.append(QString(
" ")+QString::number(
value.slantValue.customValue)+QString(
"deg"));
1139 if (
value ==
"common-ligatures") {
1141 }
else if (
value ==
"no-common-ligatures") {
1143 }
else if (
value ==
"discretionary-ligatures") {
1145 }
else if (
value ==
"no-discretionary-ligatures") {
1147 }
else if (
value ==
"historical-ligatures") {
1149 }
else if (
value ==
"no-historical-ligatures") {
1151 }
else if (
value ==
"contextual") {
1153 }
else if (
value ==
"no-contextual") {
1155 }
else if (
value ==
"none") {
1176 list <<
"no-common-ligatures";
1179 list <<
"discretionary-ligatures";
1182 list <<
"historical-ligatures";
1185 list <<
"no-contextual";
1187 return list.join(
" ");
1198 if (
value ==
"lining-nums") {
1200 }
else if (
value ==
"oldstyle-nums") {
1202 }
else if (
value ==
"proportional-nums") {
1204 }
else if (
value ==
"tabular-nums") {
1206 }
else if (
value ==
"diagonal-fractions") {
1208 }
else if (
value ==
"stacked-fractions") {
1210 }
else if (
value ==
"ordinal") {
1212 }
else if (
value ==
"slashed-zero") {
1228 list <<
"lining-nums";
1230 list <<
"oldstyle-nums";
1234 list <<
"proportional-nums";
1236 list <<
"tabular-nums";
1240 list <<
"diagonal-fractions";
1242 list <<
"stacked-fractions";
1250 list <<
"slashed-zero";
1253 return list.join(
" ");
1264 if (
value ==
"jis78") {
1266 }
else if (
value ==
"jis83") {
1268 }
else if (
value ==
"jis90") {
1270 }
else if (
value ==
"jis04") {
1272 }
else if (
value ==
"simplified") {
1274 }
else if (
value ==
"traditional") {
1276 }
else if (
value ==
"full-width") {
1278 }
else if (
value ==
"proportional-width") {
1280 }
else if (
value ==
"ruby") {
1281 features.
ruby =
true;
1304 list <<
"simplified";
1306 list <<
"traditional";
1310 list <<
"full-width";
1312 list <<
"proportional-width";
1319 return list.join(
" ");
1363 const QString
length = QString(
"[%1:%2]").arg(start).arg(end);
1365 if (!tag.isEmpty()) {
1375 const QString
length = QString(
"[%1:%2]").arg(start).arg(end);
1379 list <<
"smcp" +
length +
"=1";
1382 list <<
"smcp" +
length +
"=1";
1383 list <<
"c2sc" +
length +
"=1";
1386 list <<
"pcap" +
length +
"=1";
1389 list <<
"pcap" +
length +
"=1";
1390 list <<
"c2pc" +
length +
"=1";
1393 list <<
"unic" +
length +
"=1";
1396 list <<
"titl" +
length +
"=1";
1406 : isVertical(!isHorizontal)
1407 , fontSize(fontSizeInPt * 64.0)
1492 qint32 baselineVal = 0;
1525 if (tag ==
"romn") {
1527 }
else if (tag ==
"hang") {
1529 }
else if (tag ==
"icfb") {
1531 }
else if (tag ==
"icft") {
1533 }
else if (tag ==
"ideo") {
1535 }
else if (tag ==
"idtp") {
1537 }
else if (tag ==
"Idce") {
1539 }
else if (tag ==
"math") {
1545 if (tag ==
"xhgt") {
1547 }
else if (tag ==
"cpht") {
1549 }
else if (tag ==
"sbxo") {
1551 }
else if (tag ==
"sbyo") {
1553 }
else if (tag ==
"spxo") {
1555 }
else if (tag ==
"spyo") {
1557 }
else if (tag ==
"strs") {
1559 }
else if (tag ==
"stro") {
1561 }
else if (tag ==
"unds") {
1563 }
else if (tag ==
"undo") {
1565 }
else if (tag ==
"hcrs") {
1567 }
else if (tag ==
"hcrn") {
1569 }
else if (tag ==
"hcof") {
1571 }
else if (tag ==
"vcrs") {
1573 }
else if (tag ==
"vcrn") {
1575 }
else if (tag ==
"vcof") {
1614 if (offset == 0)
return;
1631 const double ftPixel = 1.0;
1632 dbg.nospace() <<
"FontMetrics(";
1633 dbg.nospace() <<
"Direction: " << (metrics.
isVertical?
"Top to bottom. ":
"Left to right. ");
1634 dbg.nospace() <<
"FontSize: " << QString::number(metrics.
fontSize*ftPixel) <<
"px. ";
1635 dbg.nospace() <<
"Number width: " << QString::number(metrics.
zeroAdvance*ftPixel) <<
"px. ";
1636 dbg.nospace() <<
"Space width: " << QString::number(metrics.
spaceAdvance*ftPixel) <<
"px. ";
1637 dbg.nospace() <<
"Ideographic width: " << QString::number(metrics.
ideographicAdvance*ftPixel) <<
"px. ";
1639 dbg.nospace() <<
"xHeight: " << QString::number(metrics.
xHeight*ftPixel) <<
"px. ";
1640 dbg.nospace() <<
"cap height: " << QString::number(metrics.
capHeight*ftPixel) <<
"px. ";
1641 dbg.nospace() <<
"Subscripts: " << QString::number(metrics.
subScriptOffset.second*ftPixel) <<
"px. ";
1642 dbg.nospace() <<
"Superscripts: " << QString::number(metrics.
superScriptOffset.second*ftPixel) <<
"px. ";
1643 dbg.nospace() <<
"Ascender: " << QString::number(metrics.
ascender*ftPixel) <<
"px. ";
1644 dbg.nospace() <<
"Descender: " << QString::number(metrics.
descender*ftPixel) <<
"px. ";
1645 dbg.nospace() <<
"Linegap: " << QString::number(metrics.
lineGap*ftPixel) <<
"px. ";
1647 dbg.nospace() <<
"Alphabetic: " << QString::number(metrics.
alphabeticBaseline*ftPixel) <<
"px. ";
1648 dbg.nospace() <<
"Middle: " << QString::number((metrics.
xHeight/2)*ftPixel) <<
"px. ";
1649 dbg.nospace() <<
"Mathematical: " << QString::number(metrics.
mathematicalBaseline*ftPixel) <<
"px. ";
1657 dbg.nospace() <<
"Hanging: " << QString::number(metrics.
hangingBaseline*ftPixel) <<
"px. ";
1658 dbg.nospace() <<
")";
1664 dbg.nospace() <<
"Underline position( horizontal:" <<
value.horizontalPosition <<
", vertical:" <<
value.verticalPosition <<
")";
1670 if (
value ==
"optimizeSpeed") {
1672 }
else if (
value ==
"optimizeLegibility") {
1674 }
else if (
value ==
"geometricPrecision") {
1683 return "optimizeSpeed";
1685 return "optimizeLegibility";
1687 return "geometricPrecision";
1714 pix.setX(qRound(pix.x()));
1717 pix.setY(qRound(pix.y()));
1727 pix.setX(floor(pix.x()));
1730 pix.setY(floor(pix.y()));
1740 pix.setX(ceil(pix.x()));
1743 pix.setY(ceil(pix.y()));
1751 return adjust(point+offset)-offset;
1755 return QRectF(
adjust(rect.topLeft()),
adjust(rect.bottomRight()));
qreal length(const QPointF &vec)
float value(const T *src, size_t ch)
QList< QString > QStringList
qRegisterMetaType< KoSvgText::FontFeatureLigatures >("KoSvgText::FontFeatureLigatures")
qRegisterMetaType< KoSvgText::TextTransformInfo >("KoSvgText::TextTransformInfo")
qRegisterMetaType< KoSvgText::FontFamilyStyleInfo >("KoSvgText::FontFamilyStyleInfo")
qRegisterMetaType< KoSvgText::FontMetrics >("KoSvgText::FontMetrics")
qRegisterMetaType< KoSvgText::FontFeatureNumeric >("KoSvgText::FontFeatureNumeric")
qRegisterMetaType< KoSvgText::BackgroundProperty >("KoSvgText::BackgroundProperty")
qRegisterMetaType< KoSvgText::StrokeProperty >("KoSvgText::StrokeProperty")
qRegisterMetaType< KoSvgText::FontFeatureEastAsian >("KoSvgText::FontFeatureEastAsian")
KIS_DECLARE_STATIC_INITIALIZER
qRegisterMetaType< KoSvgText::CssFontStyleData >("KoSvgText::CssSlantData")
qRegisterMetaType< KoSvgText::AutoLengthPercentage >("KoSvgText::AutoLengthPercentage")
qRegisterMetaType< KoSvgText::TextUnderlinePosition >("KoSvgText::TextUnderlinePosition")
qRegisterMetaType< KoSvgText::AutoValue >("KoSvgText::AutoValue")
qRegisterMetaType< KoSvgText::FontFamilyAxis >("KoSvgText::FontFamilyAxis")
qRegisterMetaType< KoSvgText::TabSizeInfo >("KoSvgText::TabSizeInfo")
qRegisterMetaType< KoSvgText::TextIndentInfo >("KoSvgText::TextIndentInfo")
qRegisterMetaType< KoSvgText::LineHeightInfo >("KoSvgText::LineHeightInfo")
A simple solid color shape background.
A gradient shape background.
Contains data used for loading svg.
KoSvgTextProperties resolvedProperties(bool onlyFontAndLineHeight=false) const
SvgGraphicsContext * currentGC() const
Returns the current graphics context.
static qreal parseUnitX(SvgGraphicsContext *gc, const KoSvgTextProperties &resolved, const QString &unit)
parses a length attribute in x-direction
static qreal parseUnitAngular(SvgGraphicsContext *gc, const QString &unit)
parses angle, result in radians!
static KoSvgText::CssLengthPercentage parseTextUnitStruct(SvgGraphicsContext *gc, QStringView unit)
Unit structs for text do not need the percentage to be resolved to viewport in most cases.
static qreal parseUnitXY(SvgGraphicsContext *gc, const KoSvgTextProperties &resolved, const QString &unit)
parses a length attribute in xy-direction
static KoSvgText::CssLengthPercentage parseUnitStruct(SvgGraphicsContext *gc, QStringView unit, bool horiz=false, bool vert=false, const QRectF &bbox=QRectF())
Parse length attribute into a struct, always resolving the percentage to viewport.
static qreal parseUnitY(SvgGraphicsContext *gc, const KoSvgTextProperties &resolved, const QString &unit)
parses a length attribute in y-direction
double toDouble(const QString &str, bool *ok=nullptr)
QString toString(const QString &value)
@ AlignCenter
Center text in line.
QString writeTextPathSide(TextPathSide value)
BaselineShiftMode parseBaselineShiftMode(const QString &value)
BaselineShiftMode
Mode of the baseline shift.
@ ShiftLineBottom
this handles css-inline-3 vertical-align:bottom. Not exposed to ui
@ ShiftSuper
Use parent font metric for 'superscript'.
@ ShiftLineTop
this handles css-inline-3 vertical-align:top. Not exposed to ui
@ ShiftLengthPercentage
Css Length Percentage, percentage is lh.
@ ShiftSub
Use parent font metric for 'subscript'.
FontFeatureCaps
Represents font-feature-caps.
bool xmlSpaceToLongHands(const QString &value, TextSpaceCollapse &collapseMethod)
xmlSpaceToLongHands This takes xml:space values and converts them to CSS-Text-4 properties.
AutoValue parseAutoValueY(const QString &value, const SvgLoadingContext &context, const QString &autoKeyword)
@ LineBreakStrict
Use strict method, language specific.
@ LineBreakLoose
Use loose method, language specific.
@ LineBreakAnywhere
Break between any typographic clusters.
@ LineBreakAuto
Use preferred method.
@ LineBreakNormal
Use normal method, language specific.
TextAnchor
Where the text is anchored for SVG 1.1 text and 'inline-size'.
@ AnchorEnd
Anchor right for LTR, left for RTL.
@ AnchorStart
Anchor left for LTR, right for RTL.
@ AnchorMiddle
Anchor to the middle.
QString writeWordBreak(WordBreak value)
FontFeaturePosition
The FontFeatureLigatures class This enum represents css font-variant-position.
TabSizeInfo parseTabSize(const QString &value, const SvgLoadingContext &context)
TextPathSide parseTextPathSide(const QString &value)
QDebug operator<<(QDebug dbg, const KoSvgText::AutoValue &value)
Baseline parseBaseline(const QString &value)
@ NumericFigureSpacingProportional
@ NumericFigureSpacingTabular
FontFeatureEastAsian parseFontFeatureEastAsian(const QString &value, FontFeatureEastAsian features)
TextAnchor parseTextAnchor(const QString &value)
TextOrientation parseTextOrientation(const QString &value)
TextPathSpacing parseTextPathSpacing(const QString &value)
WordBreak
Whether to break words.
@ WordBreakNormal
Set according to script. Also "break-word".
@ WordBreakBreakAll
Always break inside words.
@ WordBreakKeepAll
Never break inside words.
QString writeBaselineShiftMode(BaselineShiftMode value, CssLengthPercentage shift)
UnicodeBidi parseUnicodeBidi(const QString &value)
@ LengthAdjustSpacing
Only stretch the spaces.
@ LengthAdjustSpacingAndGlyphs
Stretches the glyphs as well.
WritingMode parseWritingMode(const QString &value)
QString writeTabSize(const TabSizeInfo tabSize)
LengthAdjust parseLengthAdjust(const QString &value)
TextWrap
Part of "white-space", in practice we only support wrap and nowrap.
@ NoWrap
Do not do any text wrapping.
AutoValue parseAutoValueX(const QString &value, const SvgLoadingContext &context, const QString &autoKeyword)
QString writeLineHeight(LineHeightInfo lineHeight)
bool whiteSpaceValueToLongHands(const QString &value, TextSpaceCollapse &collapseMethod, TextWrap &wrapMethod, TextSpaceTrims &trimMethod)
whiteSpaceValueToLongHands CSS-Text-4 takes CSS-Text-3 whitespace values and treats them as a shortha...
CssFontStyleData parseFontStyle(const QString &value)
Direction
Base direction used by Bidi algorithm.
TextRendering parseTextRendering(const QString &value)
Baseline
Baseline values used by dominant-baseline and baseline-align.
@ BaselineAlphabetic
Use 'romn' or the baseline for LCG scripts.
@ BaselineTextBottom
Bottom side of the inline line-box.
@ BaselineNoChange
Use parent baseline table.
@ BaselineTextTop
Top side of the inline line-box.
@ BaselineCentral
Use the center between the ideographic over and under.
QString writeFontFeatureLigatures(const FontFeatureLigatures &feature)
QString writeUnicodeBidi(UnicodeBidi value)
@ EastAsianProportionalWidth
AutoValue parseAutoValueAngular(const QString &value, const SvgLoadingContext &context, const QString &autoKeyword)
TextIndentInfo parseTextIndent(const QString &value, const SvgLoadingContext &context)
QString writeTextRendering(TextRendering value)
TextAlign parseTextAlign(const QString &value)
QString writeTextPathMethod(TextPathMethod value)
TextPathSide
Whether to reverse the path before laying out text.
Direction parseDirection(const QString &value)
LineHeightInfo parseLineHeight(const QString &value, const SvgLoadingContext &context)
QString writeLineBreak(LineBreak value)
QString writeLengthPercentage(const CssLengthPercentage &length, bool percentageAsEm)
@ NumericFractionsDiagonal
@ NumericFractionsStacked
QString writeAutoLengthPercentage(const AutoLengthPercentage &value, const QString &autoKeyword, bool percentageToEm)
AutoValue parseAutoValueXY(const QString &value, const SvgLoadingContext &context, const QString &autoKeyword)
@ BidiNormal
No new bidi-level is started.
@ BidiIsolate
Content is ordered as if in a separate paragraph.
@ BidiEmbed
Opens an additional Bidi-reordering level.
QString writeFontFeatureCaps(const FontFeatureCaps &value)
QDataStream & operator>>(QDataStream &in, KoSvgText::FontFamilyAxis &axis)
FontFeaturePosition parseFontFeaturePosition(const QString &value, FontFeaturePosition feature)
QString writeFontFeatureEastAsian(const FontFeatureEastAsian &feature)
QString writeFontStyle(CssFontStyleData value)
QString writeTextAlign(TextAlign value)
LineBreak parseLineBreak(const QString &value)
QStringList fontFeaturesPosition(const FontFeaturePosition &feature, const int start, const int end)
QString writeFontFeatureNumeric(const FontFeatureNumeric &feature)
QString writeLengthAdjust(LengthAdjust value)
QString writeAlignmentBaseline(Baseline value)
@ RenderingGeometricPrecision
@ RenderingOptimizeLegibility
int parseCSSFontWeight(const QString &value, int currentWeight)
TextOrientation parseTextOrientationFromGlyphOrientation(AutoValue value)
QString writeFontFeaturePosition(const FontFeaturePosition &value)
static const std::array< const char *, 9 > fontStretchNames
AutoLengthPercentage parseAutoLengthPercentageXY(const QString &value, const SvgLoadingContext &context, const QString &autoKeyword, QRectF bbox, bool percentageIsViewPort)
FontFeatureCaps parseFontFeatureCaps(const QString &value, FontFeatureCaps feature)
QString writeTextOrientation(TextOrientation orientation)
FontFeatureLigatures parseFontFeatureLigatures(const QString &value, FontFeatureLigatures features)
QString writeXmlSpace(TextSpaceCollapse collapseMethod)
QString writeTextPathSpacing(TextPathSpacing value)
TextPathMethod parseTextPathMethod(const QString &value)
int parseCSSFontStretch(const QString &value, int currentStretch)
parseCSSFontStretch For CSS3, the font-stretches were only given as keywords. In Css 4 and above,...
TextOrientation
Orientation of the glyphs, used for vertical writing modes.
@ OrientationUpright
Set all characters upright.
@ OrientationSideWays
Set all characters sideways.
@ TextTransformCapitalize
@ TextTransformUppercase
Convert all bicarmel text to upper-case, locale dependant.
@ TextTransformLowercase
Convert all bicarmel text to lower-case, locale dependant.
@ TextTransformNone
No transforms.
QString writeTextAnchor(TextAnchor value)
QString writeWritingMode(WritingMode value, bool svg1_1)
TextTransformInfo parseTextTransform(const QString &value)
QString writeAutoValue(const AutoValue &value, const QString &autoKeyword)
QString writeDominantBaseline(Baseline value)
@ NumericFigureStyleLining
@ Preserve
Do not collapse any space.
@ BreakSpaces
Same as preserve, except each white space and wordseperate is breakable.
@ Collapse
Collapse white space sequences into a single character.
@ PreserveSpaces
required for 'xml:space="preserve"' emulation.
QString writeTextTransform(const TextTransformInfo textTransform)
WordBreak parseWordBreak(const QString &value)
FontFeatureNumeric parseFontFeatureNumeric(const QString &value, FontFeatureNumeric features)
QString writeDirection(Direction value)
TextPathMethod
Whether to stretch the glyphs along a path.
@ TextPathAlign
Only align position and rotation of glyphs to the path.
QString writeWhiteSpaceValue(TextSpaceCollapse collapseMethod, TextWrap wrapMethod, TextSpaceTrims trimMethod)
QStringList fontFeaturesCaps(const FontFeatureCaps &feature, const int start, const int end)
QString writeTextIndent(const TextIndentInfo textIndent)
BackgroundProperty is a special wrapper around KoShapeBackground for managing it in KoSvgTextProperti...
QSharedPointer< KoShapeBackground > property
bool startsNewChunk() const
QPointF absolutePos() const
boost::optional< qreal > yPos
bool operator==(const CharTransformation &other) const
boost::optional< qreal > dxPos
boost::optional< qreal > dyPos
bool hasRelativeOffset() const
boost::optional< qreal > rotate
QPointF relativeOffset() const
void mergeInParentTransformation(const CharTransformation &t)
boost::optional< qreal > xPos
When style is oblique, a custom slant value can be specified for variable fonts.
KoSvgText::AutoValue slantValue
@ Cap
multiply by font-x-height.
@ Ch
multiply by font cap height
@ Absolute
Pt, everything needs to be converted to pt for this to work.
@ Lh
multiply by width of "U+6C34", represents average full width script advance.
@ Ex
multiply by Font-size
@ Ic
multiply by width of "0", represents average proportional script advance.
void convertToAbsolute(const KoSvgText::FontMetrics metrics, const qreal fontSize, const UnitType percentageUnit=Em)
QString debugInfo() const
Some variable fonts have axes that are not really supposed to be shown to the user.
QHash< QLocale, QString > localizedLabels
QHash< QString, float > instanceCoords
QHash< QLocale, QString > localizedLabels
QString debugInfo() const
The FontFeatureLigatures class This struct represents css font-variant-ligatures.
bool contextualAlternates
'calt'
bool discretionaryLigatures
'dlig'
bool commonLigatures
'clig' and 'liga'
bool historicalLigatures
'hlig'
The FontFeatureLigatures class This struct represents css font-variant-numeric.
NumericFractions fractions
NumericFigureSpacing spacing
The FontMetrics class A class to keep track of a variety of font metrics. Note that values are in Fre...
qint32 ideographicCenterBaseline
default baseline for vertical, centered between over and under.
qint32 ideographicUnderBaseline
location of ideographic under baseline from origin, may fall back to descender.
QPair< qint32, qint32 > subScriptOffset
subscript baseline height, defaults to 1/5th em below alphabetic.
qint32 xHeight
height of X, defaults to 0.5 fontsize.
void setBaselineValueByTag(const QString &tag, int32_t value)
qint32 lineThroughThickness
strikethrough thickness, from font.
qint32 underlineThickness
underline thickness from font.
qint32 lineThroughOffset
offset of strike-through from alphabetic baseline.
qint32 lineGap
additional linegap between consecutive lines.
qint32 zeroAdvance
Advance of the character '0', CSS Unit 'ch', defaults to 0.5 em in horizontal and 1....
qint32 underlineOffset
underline offset from alphabetic, positive.
qint32 ideographicAdvance
Advance of the character '水' (U+6C34), CSS Unit ic, defaults to 1 em.
qint32 ideographicFaceOverBaseline
location of ideographic face over baseline, that is, the top of the glyphs.
void scaleBaselines(const qreal multiplier)
qint32 ideographicOverBaseline
location of ideographic over baseline from origin.
void setMetricsValueByTag(const QLatin1String &tag, int32_t value)
qint32 fontSize
Currently set size, CSS unit 'em'.
int valueForBaselineValue(Baseline baseline) const
qint32 ideographicFaceUnderBaseline
location of ideographic face under baseline, that is, the bottom of the glyphs.
qint32 caretRun
These are only used to determine the caret slant proportion.
qint32 alphabeticBaseline
location of alphabetic baseline from origin.
qint32 descender
distance for origin to bottom.
qint32 ascender
distance from origin to top.
qint32 mathematicalBaseline
location of mathematical baseline from origin.
bool operator==(const FontMetrics &other) const
qint32 capHeight
Height of capital letters, defaults to ascender.
void offsetMetricsToNewOrigin(const Baseline baseline)
bool isVertical
Different fontMetrics count between vertical and horizontal.
qint32 hangingBaseline
location of the hanging baseline used in north brahmic scripts.
qint32 spaceAdvance
Advance of the character ' ', used by tabs.
QPair< qint32, qint32 > superScriptOffset
superscript baseline height, defaults to 2/3rd above alphabetic.
bool isNumber
Length or number.
CssLengthPercentage length
bool isNormal
It's a number indicating the lineHeight;.
qreal freeTypePixelToPointFactor(const bool x=true) const
qreal pointToPixelFactor(const bool x=true) const
qreal pixelToPointFactor(const bool x=true) const
const qreal freeTypePixel
bool roundToPixelVertical
bool roundToPixelHorizontal
QTransform pixelToPoint() const
QTransform pointToPixel() const
QPointF adjustCeil(const QPointF point) const
Adjusts the point to ceiled pixel values.
QTransform freeTypeToPixelTransform() const
QTransform freeTypeToPointTransform() const
QPointF adjustWithOffset(const QPointF point, const QPointF offset) const
QPointF adjustFloor(const QPointF point) const
Adjusts the point to floored pixel values.
QPointF adjust(const QPointF point) const
Adjusts the point to rounded pixel values, based on whether roundToPixelHorizontal or roundToPixelVer...
StrokeProperty is a special wrapper around KoShapeStrokeModel for managing it in KoSvgTextProperties.
QSharedPointer< KoShapeStrokeModel > property
qreal value
A length or a number. Length is currently marked 'at-risk'.
CssLengthPercentage length
bool hanging
Flip the lines to which text-indent is applied.
bool eachLine
Apply the text-indent to each line following a hardbreak.
CssLengthPercentage length
TextTransform capitals
Text transform upper/lower/capitalize.