class KCharsets

Charset font and encoder/decoder handling. More...

Definition#include <kinstance.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Protected Methods


Detailed Description

Charset font and encoder/decoder handling.

This is needed, because Qt's font matching algorithm gives the font family a higher priority than the charset. For many applications this is not acceptable, since it can totally obscure the output, in languages which use non iso-8859-1 charsets.

KCharsets ()
[protected]

protected constructor. If you need the kcharsets object, use KGlobal::charsets() instead.

~KCharsets ()
[virtual]

destructor

QChar fromEntity (const QString &str)
[const]

converts an entity to a character. The string must contain only the entity without the trailing ';'.

Returns: QChar::null if the entity could not be decoded.

QChar fromEntity (const QString &str, int &len)
[const]

Overloaded member function. Tries to find an entity in the QString str.

Parameters:
lenis a return value, that gives the length of the decoded entity.

Returns: a decoded entity if one could be found, QChar::null otherwise

QString toEntity (const QChar &ch)
[const]

converts a QChar to an entity. The returned string does already contain the leading '&' and the trailing ';'.

QList<QFont::CharSet> availableCharsets (QString family = QString::null)

lists all available charsets for a given family. if family is omitted, it will return all charsets available.

QStringList availableCharsetNames (QString family = QString::null)

as above, but returns the names of the charsets

QFont fontForChar ( const QChar &ch, const QFont &f )
[const]

Returns: a QFont, which can print the character given, and is closest to the font given. if no mathing font could be found, the returned font will have the charset QFont::Any.

void setQFont (QFont &f, QFont::CharSet charset = QFont::Unicode)
[const]

sets the QFont f to the charset given in charset. Opposed to QFont's setCharset() function, this function will do it's best to find a font which can display the given charset. It might change the font's family for this purpose, but care is taken to find a family which is as close as possible to the font given.

void setQFont (QFont &f, QString charset)
[const]

overloaded member function. Provided for convenience.

QString name (const QFont &f)

Returns: the name of the charset f is set to.

QString name (QFont::CharSet c)

Returns: the name of the Charset c.

bool isAvailable (QFont::CharSet charset)

is a font with the given charset available?

bool isAvailable (const QString &charset)

overloaded member function. Provided for convenience.

QFont::CharSet charsetForLocale ()

Returns: the charset for the locale.

bool hasUnicode (QString family)
[const]

does the given font family have a unicode encoding?

bool hasUnicode (QFont &font)
[const]

does given font exist with a unicode encoding?