diff options
Diffstat (limited to 'src/corelib/tools/qchar.cpp')
-rw-r--r-- | src/corelib/tools/qchar.cpp | 63 |
1 files changed, 60 insertions, 3 deletions
diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp index f7f425d594..eb59cc719f 100644 --- a/src/corelib/tools/qchar.cpp +++ b/src/corelib/tools/qchar.cpp @@ -127,9 +127,9 @@ QT_BEGIN_NAMESPACE Separator_* or an exceptional code point from Other_Control category). QChar also provides direction(), which indicates the "natural" - writing direction of this character. The joining() function + writing direction of this character. The joiningType() function indicates how the character joins with it's neighbors (needed - mostly for Arabic) and finally hasMirrored(), which indicates + mostly for Arabic or Syriac) and finally hasMirrored(), which indicates whether the character needs to be mirrored when it is printed in it's "unnatural" writing direction. @@ -458,7 +458,29 @@ QT_BEGIN_NAMESPACE */ /*! + \enum QChar::JoiningType + since 5.3 + + This enum type defines the Unicode joining type attributes. See the + \l{http://www.unicode.org/}{Unicode Standard} for a description of the values. + + In order to conform to C/C++ naming conventions "Joining_" is prepended + to the codes used in the Unicode Standard. + + \value Joining_None + \value Joining_Causing + \value Joining_Dual + \value Joining_Right + \value Joining_Left + \value Joining_Transparent + + \sa joiningType() +*/ + +#if QT_DEPRECATED_SINCE(5, 3) +/*! \enum QChar::Joining + \deprecated in 5.3, use JoiningType instead. This enum type defines the Unicode joining attributes. See the \l{http://www.unicode.org/}{Unicode Standard} for a description @@ -471,6 +493,7 @@ QT_BEGIN_NAMESPACE \sa joining() */ +#endif /*! \enum QChar::CombiningClass @@ -1053,7 +1076,32 @@ QChar::Direction QChar::direction(uint ucs4) } /*! + \fn QChar::JoiningType QChar::joiningType() const + \since 5.3 + + Returns information about the joining type attributes of the character + (needed for certain languages such as Arabic or Syriac). +*/ + +/*! + \overload + \since 5.3 + + Returns information about the joining type attributes of the UCS-4-encoded + character specified by \a ucs4 + (needed for certain languages such as Arabic or Syriac). +*/ +QChar::JoiningType QChar::joiningType(uint ucs4) +{ + if (ucs4 > LastValidCodePoint) + return QChar::Joining_None; + return QChar::JoiningType(qGetProp(ucs4)->joining); +} + +#if QT_DEPRECATED_SINCE(5, 3) +/*! \fn QChar::Joining QChar::joining() const + \deprecated in 5.3, use joiningType() instead. Returns information about the joining properties of the character (needed for certain languages such as Arabic). @@ -1061,6 +1109,8 @@ QChar::Direction QChar::direction(uint ucs4) /*! \overload + \deprecated in 5.3, use joiningType() instead. + Returns information about the joining properties of the UCS-4-encoded character specified by \a ucs4 (needed for certain languages such as Arabic). */ @@ -1068,8 +1118,15 @@ QChar::Joining QChar::joining(uint ucs4) { if (ucs4 > LastValidCodePoint) return QChar::OtherJoining; - return (QChar::Joining) qGetProp(ucs4)->joining; + switch (qGetProp(ucs4)->joining) { + case QChar::Joining_Causing: return QChar::Center; + case QChar::Joining_Dual: return QChar::Dual; + case QChar::Joining_Right: return QChar::Right; + default: break; + } + return QChar::OtherJoining; } +#endif /*! \fn bool QChar::hasMirrored() const |