Krita Source Code Documentation
Loading...
Searching...
No Matches
KoCssStylePreset.cpp File Reference
#include "KoCssStylePreset.h"
#include <KoShapePainter.h>
#include <KoSvgTextShape.h>
#include <KoDocumentResourceManager.h>
#include <KLocalizedString>
#include <SvgWriter.h>
#include <SvgParser.h>
#include <QDomDocument>
#include <QBuffer>
#include <QFileInfo>
#include <FlakeDebug.h>

Go to the source code of this file.

Classes

struct  KoCssStylePreset::Private
 

Functions

QString generateSVG (const KoSvgTextShape *shape)
 

Variables

const QString DESC = "desc"
 
const QString DESCRIPTION = "description"
 
const QString PRIMARY_FONT_FAMILY = "primary_font_family"
 
const QString SAMPLE_ALIGN = "sample_align"
 
const KLocalizedString SAMPLE_PLACEHOLDER = ki18nc("info:placeholder", "Style Sample")
 
const QString SAMPLE_SVG = "sample_svg"
 
const QString STORED_PPI = "stored_ppi"
 
const QString STYLE_TYPE = "style_type"
 
const QString STYLE_TYPE_CHARACTER = "character"
 
const QString STYLE_TYPE_PARAGRAPH = "paragraph"
 
const QString TITLE = "title"
 

Function Documentation

◆ generateSVG()

QString generateSVG ( const KoSvgTextShape * shape)

Definition at line 479 of file KoCssStylePreset.cpp.

479 {
480
481 SvgWriter writer({shape->textOutline()});
482 QBuffer buffer;
483 buffer.open(QIODevice::WriteOnly);
484 writer.save(buffer, shape->boundingRect().size());
485 buffer.close();
486
487 return QString::fromUtf8(buffer.data());
488}
QRectF boundingRect() const override
Get the bounding box of the shape.
KoShape * textOutline() const
textOutline This turns the text object into non-text KoShape(s) to the best of its abilities.
Implements exporting shapes to SVG.
Definition SvgWriter.h:33
bool save(QIODevice &outputDevice, const QSizeF &pageSize)
Writes svg to specified output device.
Definition SvgWriter.cpp:82

References KoSvgTextShape::boundingRect(), SvgWriter::save(), and KoSvgTextShape::textOutline().

Variable Documentation

◆ DESC

const QString DESC = "desc"

Definition at line 24 of file KoCssStylePreset.cpp.

◆ DESCRIPTION

const QString DESCRIPTION = "description"

Definition at line 23 of file KoCssStylePreset.cpp.

◆ PRIMARY_FONT_FAMILY

const QString PRIMARY_FONT_FAMILY = "primary_font_family"

Definition at line 29 of file KoCssStylePreset.cpp.

◆ SAMPLE_ALIGN

const QString SAMPLE_ALIGN = "sample_align"

Definition at line 26 of file KoCssStylePreset.cpp.

◆ SAMPLE_PLACEHOLDER

const KLocalizedString SAMPLE_PLACEHOLDER = ki18nc("info:placeholder", "Style Sample")

Definition at line 33 of file KoCssStylePreset.cpp.

◆ SAMPLE_SVG

const QString SAMPLE_SVG = "sample_svg"

Definition at line 25 of file KoCssStylePreset.cpp.

◆ STORED_PPI

const QString STORED_PPI = "stored_ppi"

Definition at line 28 of file KoCssStylePreset.cpp.

◆ STYLE_TYPE

const QString STYLE_TYPE = "style_type"

Definition at line 27 of file KoCssStylePreset.cpp.

◆ STYLE_TYPE_CHARACTER

const QString STYLE_TYPE_CHARACTER = "character"

Definition at line 32 of file KoCssStylePreset.cpp.

◆ STYLE_TYPE_PARAGRAPH

const QString STYLE_TYPE_PARAGRAPH = "paragraph"

Definition at line 31 of file KoCssStylePreset.cpp.

◆ TITLE

const QString TITLE = "title"

Definition at line 22 of file KoCssStylePreset.cpp.