Krita Source Code Documentation
Loading...
Searching...
No Matches
KoFontStorage Class Reference

#include <KoFontStorage.h>

+ Inheritance diagram for KoFontStorage:

Public Member Functions

bool isValid () const override
 
 KoFontStorage (const QString &location="fontregistry")
 
bool loadVersionedResource (KoResourceSP resource) override
 
KoResourceSP resource (const QString &url) override
 
KisResourceStorage::ResourceItem resourceItem (const QString &url) override
 
QSharedPointer< KisResourceStorage::ResourceIteratorresources (const QString &resourceType) override
 
bool supportsVersioning () const override
 
QSharedPointer< KisResourceStorage::TagIteratortags (const QString &resourceType) override
 
virtual ~KoFontStorage ()
 
- Public Member Functions inherited from KisStoragePlugin
virtual bool addResource (const QString &resourceType, KoResourceSP resource)
 
virtual bool exportResource (const QString &url, QIODevice *device)
 
virtual bool importResource (const QString &url, QIODevice *device)
 
 KisStoragePlugin (const QString &location)
 
virtual QVariant metaData (const QString &key) const
 
virtual QStringList metaDataKeys () const
 
virtual QString resourceFilePath (const QString &url)
 
virtual QString resourceMd5 (const QString &url)
 
virtual bool saveAsNewVersion (const QString &resourceType, KoResourceSP resource)
 
virtual void setMetaData (const QString &key, const QVariant &value)
 
virtual QImage thumbnail () const
 
QDateTime timestamp ()
 
virtual ~KisStoragePlugin ()
 

Additional Inherited Members

- Protected Member Functions inherited from KisStoragePlugin
QString location () const
 
void sanitizeResourceFileNameCase (KoResourceSP resource, const QDir &parentDir)
 

Detailed Description

Definition at line 13 of file KoFontStorage.h.

Constructor & Destructor Documentation

◆ KoFontStorage()

KoFontStorage::KoFontStorage ( const QString & location = "fontregistry")

Definition at line 92 of file KoFontStorage.cpp.

94{
95}
QString location() const
KisStoragePlugin(const QString &location)

◆ ~KoFontStorage()

KoFontStorage::~KoFontStorage ( )
virtual

Definition at line 97 of file KoFontStorage.cpp.

98{
99}

Member Function Documentation

◆ isValid()

bool KoFontStorage::isValid ( ) const
overridevirtual

Reimplemented from KisStoragePlugin.

Definition at line 145 of file KoFontStorage.cpp.

146{
147 return true;
148}

◆ loadVersionedResource()

bool KoFontStorage::loadVersionedResource ( KoResourceSP resource)
overridevirtual

Implements KisStoragePlugin.

Definition at line 150 of file KoFontStorage.cpp.

151{
152 //Q_UNUSED(resource);
153 resource->updateThumbnail();
154 return true;
155}
KoResourceSP resource(const QString &url) override

References resource().

◆ resource()

KoResourceSP KoFontStorage::resource ( const QString & url)
overridevirtual

Retrieve the given resource. The url is the unique identifier of the resource, for instance resourcetype plus filename.

Reimplemented from KisStoragePlugin.

Definition at line 111 of file KoFontStorage.cpp.

112{
113 KoFontFamilySP fam;
114 QString familyName = url;
115 QString prefix (ResourceType::FontFamilies+"/");
116 if (familyName.startsWith(prefix)) {
117 familyName.remove(0, prefix.size());
118 }
119
120 std::optional<KoFontFamilyWWSRepresentation> rep = KoFontRegistry::instance()->representationByFamilyName(familyName);
121 if (rep) {
122 fam.reset(new KoFontFamily(rep.value()));
123 fam->updateThumbnail();
124 }
125
126 return fam;
127}
The KoFontFamily class Abstract representation of a Weight/Width/Slant font family,...
std::optional< KoFontFamilyWWSRepresentation > representationByFamilyName(const QString &familyName) const
representationByFamilyName This simplifies retrieving the representation for a given font family.
static KoFontRegistry * instance()
const QString FontFamilies

References ResourceType::FontFamilies, KoFontRegistry::instance(), and KoFontRegistry::representationByFamilyName().

◆ resourceItem()

◆ resources()

QSharedPointer< KisResourceStorage::ResourceIterator > KoFontStorage::resources ( const QString & resourceType)
overridevirtual

Implements KisStoragePlugin.

Definition at line 135 of file KoFontStorage.cpp.

◆ supportsVersioning()

bool KoFontStorage::supportsVersioning ( ) const
overridevirtual

Reimplemented from KisStoragePlugin.

Definition at line 129 of file KoFontStorage.cpp.

130{
131 // Even though it doesn't make sense, this needs to support versioning, otherwise the thumbnail is never updated...
132 return true;
133}

◆ tags()

QSharedPointer< KisResourceStorage::TagIterator > KoFontStorage::tags ( const QString & resourceType)
overridevirtual

The documentation for this class was generated from the following files: