From 2462a892d1cf4aa409181a07bd900bcd145d2a9f Mon Sep 17 00:00:00 2001 From: Victor Cebollada Date: Thu, 11 Jun 2015 09:19:33 +0100 Subject: [PATCH] COMMON script added. Change-Id: Ic809fdb911b4fcab2e8eec2beeb05732be603a18 Signed-off-by: Victor Cebollada --- text/dali/devel-api/text-abstraction/script.cpp | 17 +++++++++++++++++ text/dali/devel-api/text-abstraction/script.h | 13 +++++++++++++ text/dali/internal/text-abstraction/shaping-impl.cpp | 2 ++ 3 files changed, 32 insertions(+) diff --git a/text/dali/devel-api/text-abstraction/script.cpp b/text/dali/devel-api/text-abstraction/script.cpp index fe817d6..1e192f3 100644 --- a/text/dali/devel-api/text-abstraction/script.cpp +++ b/text/dali/devel-api/text-abstraction/script.cpp @@ -167,6 +167,11 @@ Script GetCharacterScript( Character character ) // 6b. Additional transport and map symbols ( 1F681 - 1F6C5 ) // 6c. Other additional symbols ( 1F30D - 1F567 ) + if( IsCommonScript( character ) ) + { + return COMMON; + } + if( character <= 0x0cff ) { if( character <= 0x09ff ) @@ -566,6 +571,18 @@ bool IsThinSpace( Character character ) return CHAR_TS == character; } +bool IsCommonScript( Character character ) +{ + return ( IsWhiteSpace( character ) || + IsZeroWidthNonJoiner( character ) || + IsZeroWidthJoiner( character ) || + IsZeroWidthSpace( character ) || + IsLeftToRightMark( character ) || + IsRightToLeftMark( character ) || + IsThinSpace( character ) || + IsNewParagraph( character ) ); +} + } // namespace TextAbstraction } // namespace Dali diff --git a/text/dali/devel-api/text-abstraction/script.h b/text/dali/devel-api/text-abstraction/script.h index 9341f98..06b1301 100644 --- a/text/dali/devel-api/text-abstraction/script.h +++ b/text/dali/devel-api/text-abstraction/script.h @@ -36,6 +36,8 @@ namespace TextAbstraction */ enum Script { + COMMON, ///< Valid for all scripts. i.e white space or '\n'. + CYRILLIC, ///< The Cyrillic script. Used by Russian, Bulgarian, Ukrainian, Macedonian, ... GREEK, ///< The Greek script. Used by Greek. LATIN, ///< The latin script. Used by many western languages and others around the world. @@ -74,6 +76,8 @@ enum Script const char* const ScriptName[] = { + "COMMON", ///< Valid for all scripts. i.e white space or '\n'. + "CYRILLIC", ///< The Cyrillic script. Used by Russian, Bulgarian, Ukrainian, Macedonian, ... "GREEK", ///< The Greek script. Used by Greek. "LATIN", ///< The latin script. Used by many western languages and others around the world. @@ -200,6 +204,15 @@ DALI_IMPORT_API bool IsRightToLeftMark( Character character ); */ DALI_IMPORT_API bool IsThinSpace( Character character ); +/** + * @brief Whether the character is common within all scripts. + * + * @param[in] character The character. + * + * @return @e true if the character is common within all scripts. + */ +DALI_IMPORT_API bool IsCommonScript( Character character ); + } // namespace TextAbstraction } // namespace Dali diff --git a/text/dali/internal/text-abstraction/shaping-impl.cpp b/text/dali/internal/text-abstraction/shaping-impl.cpp index fd6e8dc..5e33fa5 100644 --- a/text/dali/internal/text-abstraction/shaping-impl.cpp +++ b/text/dali/internal/text-abstraction/shaping-impl.cpp @@ -45,6 +45,8 @@ const float FROM_266 = 1.0f / 64.0f; const hb_script_t SCRIPT_TO_HARFBUZZ[] = { + HB_SCRIPT_COMMON, + HB_SCRIPT_CYRILLIC, HB_SCRIPT_GREEK, HB_SCRIPT_LATIN, -- 2.7.4