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);
1006 root.setAttribute(
"min", axis.
min);
1007 root.setAttribute(
"max", axis.
max);
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");
1030 axis.
min = root.attribute(
"min").toDouble();
1031 axis.
max = root.attribute(
"max").toDouble();
1032 axis.
defaultValue = root.attribute(
"default").toDouble();
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");
1055 QDomElement root = doc.createElement(
"style");
1056 root.setAttribute(
"italic", style.
isItalic?
"true":
"false");
1057 root.setAttribute(
"oblique", style.
isOblique?
"true":
"false");
1059 QDomElement coord = doc.createElement(
"coord");
1060 coord.setAttribute(
"tag", it.key());
1061 coord.setAttribute(
"value", it.value());
1062 root.appendChild(coord);
1065 QDomElement name = doc.createElement(
"name");
1066 name.setAttribute(
"lang", it.key().bcp47Name());
1067 name.setAttribute(
"value", it.value());
1068 root.appendChild(name);
1070 doc.appendChild(root);
1071 out << doc.toString(0);
1079 doc.setContent(xml);
1080 QDomElement root = doc.childNodes().at(0).toElement();
1081 style.
isItalic = root.attribute(
"italic") ==
"true"?
true:
false;
1082 style.
isOblique = root.attribute(
"oblique") ==
"true"?
true:
false;
1083 QDomNodeList names = root.elementsByTagName(
"name");
1084 for(
int i = 0; i < names.size(); i++) {
1085 QDomElement name = names.at(i).toElement();
1086 QString lang = name.attribute(
"lang");
1087 QString
value = name.attribute(
"value");
1090 QDomNodeList coords = root.elementsByTagName(
"coord");
1091 for(
int i = 0; i < coords.size(); i++) {
1092 QDomElement coord = coords.at(i).toElement();
1093 QString tag = coord.attribute(
"tag");
1094 double value = coord.attribute(
"value").toDouble();
1105 if (!params.isEmpty()) {
1106 QString style = params.first();
1107 slant.
style = style ==
"italic"? QFont::StyleItalic: style ==
"oblique"? QFont::StyleOblique: QFont::StyleNormal;
1109 if (params.size() > 1) {
1110 QString angle = params.last();
1111 if (angle.endsWith(
"deg")) {
1123 value.style == QFont::StyleItalic ?
"italic" :
1124 value.style == QFont::StyleOblique ?
"oblique" :
"normal";
1125 if (
value.style == QFont::StyleOblique && !
value.slantValue.isAuto) {
1126 style.append(QString(
" ")+QString::number(
value.slantValue.customValue)+QString(
"deg"));
1133 if (
value ==
"common-ligatures") {
1135 }
else if (
value ==
"no-common-ligatures") {
1137 }
else if (
value ==
"discretionary-ligatures") {
1139 }
else if (
value ==
"no-discretionary-ligatures") {
1141 }
else if (
value ==
"historical-ligatures") {
1143 }
else if (
value ==
"no-historical-ligatures") {
1145 }
else if (
value ==
"contextual") {
1147 }
else if (
value ==
"no-contextual") {
1149 }
else if (
value ==
"none") {
1170 list <<
"no-common-ligatures";
1173 list <<
"discretionary-ligatures";
1176 list <<
"historical-ligatures";
1179 list <<
"no-contextual";
1181 return list.join(
" ");
1192 if (
value ==
"lining-nums") {
1194 }
else if (
value ==
"oldstyle-nums") {
1196 }
else if (
value ==
"proportional-nums") {
1198 }
else if (
value ==
"tabular-nums") {
1200 }
else if (
value ==
"diagonal-fractions") {
1202 }
else if (
value ==
"stacked-fractions") {
1204 }
else if (
value ==
"ordinal") {
1206 }
else if (
value ==
"slashed-zero") {
1222 list <<
"lining-nums";
1224 list <<
"oldstyle-nums";
1228 list <<
"proportional-nums";
1230 list <<
"tabular-nums";
1234 list <<
"diagonal-fractions";
1236 list <<
"stacked-fractions";
1244 list <<
"slashed-zero";
1247 return list.join(
" ");
1258 if (
value ==
"jis78") {
1260 }
else if (
value ==
"jis83") {
1262 }
else if (
value ==
"jis90") {
1264 }
else if (
value ==
"jis04") {
1266 }
else if (
value ==
"simplified") {
1268 }
else if (
value ==
"traditional") {
1270 }
else if (
value ==
"full-width") {
1272 }
else if (
value ==
"proportional-width") {
1274 }
else if (
value ==
"ruby") {
1275 features.
ruby =
true;
1298 list <<
"simplified";
1300 list <<
"traditional";
1304 list <<
"full-width";
1306 list <<
"proportional-width";
1313 return list.join(
" ");
1357 const QString
length = QString(
"[%1:%2]").arg(start).arg(end);
1359 if (!tag.isEmpty()) {
1369 const QString
length = QString(
"[%1:%2]").arg(start).arg(end);
1373 list <<
"smcp" +
length +
"=1";
1376 list <<
"smcp" +
length +
"=1";
1377 list <<
"c2sc" +
length +
"=1";
1380 list <<
"pcap" +
length +
"=1";
1383 list <<
"pcap" +
length +
"=1";
1384 list <<
"c2pc" +
length +
"=1";
1387 list <<
"unic" +
length +
"=1";
1390 list <<
"titl" +
length +
"=1";
1400 : isVertical(!isHorizontal)
1401 , fontSize(fontSizeInPt * 64.0)
1486 qint32 baselineVal = 0;
1519 if (tag ==
"romn") {
1521 }
else if (tag ==
"hang") {
1523 }
else if (tag ==
"icfb") {
1525 }
else if (tag ==
"icft") {
1527 }
else if (tag ==
"ideo") {
1529 }
else if (tag ==
"idtp") {
1531 }
else if (tag ==
"Idce") {
1533 }
else if (tag ==
"math") {
1539 if (tag ==
"xhgt") {
1541 }
else if (tag ==
"cpht") {
1543 }
else if (tag ==
"sbxo") {
1545 }
else if (tag ==
"sbyo") {
1547 }
else if (tag ==
"spxo") {
1549 }
else if (tag ==
"spyo") {
1551 }
else if (tag ==
"strs") {
1553 }
else if (tag ==
"stro") {
1555 }
else if (tag ==
"unds") {
1557 }
else if (tag ==
"undo") {
1559 }
else if (tag ==
"hcrs") {
1561 }
else if (tag ==
"hcrn") {
1563 }
else if (tag ==
"hcof") {
1565 }
else if (tag ==
"vcrs") {
1567 }
else if (tag ==
"vcrn") {
1569 }
else if (tag ==
"vcof") {
1608 if (offset == 0)
return;
1625 const double ftPixel = 1.0;
1626 dbg.nospace() <<
"FontMetrics(";
1627 dbg.nospace() <<
"Direction: " << (metrics.
isVertical?
"Top to bottom. ":
"Left to right. ");
1628 dbg.nospace() <<
"FontSize: " << QString::number(metrics.
fontSize*ftPixel) <<
"px. ";
1629 dbg.nospace() <<
"Number width: " << QString::number(metrics.
zeroAdvance*ftPixel) <<
"px. ";
1630 dbg.nospace() <<
"Space width: " << QString::number(metrics.
spaceAdvance*ftPixel) <<
"px. ";
1631 dbg.nospace() <<
"Ideographic width: " << QString::number(metrics.
ideographicAdvance*ftPixel) <<
"px. ";
1633 dbg.nospace() <<
"xHeight: " << QString::number(metrics.
xHeight*ftPixel) <<
"px. ";
1634 dbg.nospace() <<
"cap height: " << QString::number(metrics.
capHeight*ftPixel) <<
"px. ";
1635 dbg.nospace() <<
"Subscripts: " << QString::number(metrics.
subScriptOffset.second*ftPixel) <<
"px. ";
1636 dbg.nospace() <<
"Superscripts: " << QString::number(metrics.
superScriptOffset.second*ftPixel) <<
"px. ";
1637 dbg.nospace() <<
"Ascender: " << QString::number(metrics.
ascender*ftPixel) <<
"px. ";
1638 dbg.nospace() <<
"Descender: " << QString::number(metrics.
descender*ftPixel) <<
"px. ";
1639 dbg.nospace() <<
"Linegap: " << QString::number(metrics.
lineGap*ftPixel) <<
"px. ";
1641 dbg.nospace() <<
"Alphabetic: " << QString::number(metrics.
alphabeticBaseline*ftPixel) <<
"px. ";
1642 dbg.nospace() <<
"Middle: " << QString::number((metrics.
xHeight/2)*ftPixel) <<
"px. ";
1643 dbg.nospace() <<
"Mathematical: " << QString::number(metrics.
mathematicalBaseline*ftPixel) <<
"px. ";
1651 dbg.nospace() <<
"Hanging: " << QString::number(metrics.
hangingBaseline*ftPixel) <<
"px. ";
1652 dbg.nospace() <<
")";
1658 dbg.nospace() <<
"Underline position( horizontal:" <<
value.horizontalPosition <<
", vertical:" <<
value.verticalPosition <<
")";
1664 if (
value ==
"optimizeSpeed") {
1666 }
else if (
value ==
"optimizeLegibility") {
1668 }
else if (
value ==
"geometricPrecision") {
1677 return "optimizeSpeed";
1679 return "optimizeLegibility";
1681 return "geometricPrecision";
1708 pix.setX(qRound(pix.x()));
1711 pix.setY(qRound(pix.y()));
1721 pix.setX(floor(pix.x()));
1724 pix.setY(floor(pix.y()));
1734 pix.setX(ceil(pix.x()));
1737 pix.setY(ceil(pix.y()));
1745 return adjust(point+offset)-offset;
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.
SvgGraphicsContext * currentGC() const
Returns the current graphics context.
KoSvgTextProperties resolvedProperties() const
These are the text properties, completely resolved, ensuring that everything is inherited and the siz...
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.