|
Krita Source Code Documentation
|
#include "KoSvgTextShapeMarkupConverter.h"#include "klocalizedstring.h"#include "kis_assert.h"#include "kis_debug.h"#include <ft2build.h>#include <QXmlStreamReader>#include <QXmlStreamWriter>#include <QBuffer>#include <QTextCodec>#include <QtMath>#include <QTextBlock>#include <QTextLayout>#include <QTextLine>#include <QFont>#include <QStack>#include <QStringView>#include <KoSvgTextShape.h>#include <KoXmlWriter.h>#include <KoDocumentResourceManager.h>#include <KoColor.h>#include <SvgParser.h>#include <SvgWriter.h>#include <SvgUtil.h>#include <SvgSavingContext.h>#include <SvgGraphicContext.h>#include <html/HtmlSavingContext.h>#include <html/HtmlWriter.h>#include "kis_dom_utils.h"#include <boost/optional.hpp>#include <FlakeDebug.h>Go to the source code of this file.
Classes | |
| struct | KoSvgTextShapeMarkupConverter::ExtraStyles |
| struct | KoSvgTextShapeMarkupConverter::Private |
Functions | |
| qreal | calcLineWidth (const QTextBlock &block) |
| bool | compareFormatUnderlineWithMostCommon (QTextCharFormat format, QTextCharFormat mostCommon) |
| QString | convertFormatUnderlineToSvg (QTextCharFormat format) |
| QTextFormat | findMostCommonFormat (const QList< QTextFormat > &allFormats) |
| qreal | fixFromQtDpi (qreal value) |
| qreal | fixToQtDpi (qreal value) |
| static bool | guessIsRightToLeft (QStringView text) |
| void | parseTextAttributes (const QXmlStreamAttributes &elementAttributes, QTextCharFormat &charFormat, QTextBlockFormat &blockFormat, KoSvgTextShapeMarkupConverter::ExtraStyles &extraStyles) |
| void | postCorrectBlockHeight (QTextDocument *doc, qreal currLineAscent, qreal prevLineAscent, qreal prevLineDescent, int prevBlockCursorPosition, qreal currentBlockAbsoluteLineOffset) |
| Q_GUI_EXPORT int | qt_defaultDpi () |
| qreal calcLineWidth | ( | const QTextBlock & | block | ) |
Definition at line 535 of file KoSvgTextShapeMarkupConverter.cpp.
References fixFromQtDpi().
| bool compareFormatUnderlineWithMostCommon | ( | QTextCharFormat | format, |
| QTextCharFormat | mostCommon ) |
Definition at line 1131 of file KoSvgTextShapeMarkupConverter.cpp.
| QString convertFormatUnderlineToSvg | ( | QTextCharFormat | format | ) |
Definition at line 1140 of file KoSvgTextShapeMarkupConverter.cpp.
References warnFile.
| QTextFormat findMostCommonFormat | ( | const QList< QTextFormat > & | allFormats | ) |
Get all existing property ids
Filter out properties that do not exist in some formats. Otherwise, the global format may override the default value used in these formats (and yes, we do not have access to the default values to use them in difference calculation algorithm
Calculate the frequency of values used in all the formats
Add the most popular property value to the set of most common properties
Definition at line 434 of file KoSvgTextShapeMarkupConverter.cpp.
References KIS_SAFE_ASSERT_RECOVER_BREAK.
| qreal fixFromQtDpi | ( | qreal | value | ) |
Definition at line 523 of file KoSvgTextShapeMarkupConverter.cpp.
References qt_defaultDpi(), and value().
| qreal fixToQtDpi | ( | qreal | value | ) |
Definition at line 529 of file KoSvgTextShapeMarkupConverter.cpp.
References qt_defaultDpi(), and value().
|
static |
Mind blowing part: QTextEdit uses a hi-end algorithm for auto-estimation for the text directionality, so the user expects his text being saved to SVG with the same directionality. Just emulate behavior of direction="auto", which is not supported by SVG 1.1
BUG: 392064
Definition at line 563 of file KoSvgTextShapeMarkupConverter.cpp.
| void parseTextAttributes | ( | const QXmlStreamAttributes & | elementAttributes, |
| QTextCharFormat & | charFormat, | ||
| QTextBlockFormat & | blockFormat, | ||
| KoSvgTextShapeMarkupConverter::ExtraStyles & | extraStyles ) |
Definition at line 865 of file KoSvgTextShapeMarkupConverter.cpp.
References KoSvgTextShapeMarkupConverter::stylesFromString().
| void postCorrectBlockHeight | ( | QTextDocument * | doc, |
| qreal | currLineAscent, | ||
| qreal | prevLineAscent, | ||
| qreal | prevLineDescent, | ||
| int | prevBlockCursorPosition, | ||
| qreal | currentBlockAbsoluteLineOffset ) |
Definition at line 411 of file KoSvgTextShapeMarkupConverter.cpp.
References KIS_SAFE_ASSERT_RECOVER_RETURN.
| Q_GUI_EXPORT int qt_defaultDpi | ( | ) |