END_TEST;
}
+int UtcDaliGetScript(void)
+{
+ tet_infoline("UtcDaliGetScript ");
+ TestApplication application;
+
+ Text text( std::string("aᴆₘऄঅਅઅଅஅఅಅഅඅض") );
+
+ Character c0 = text[0];
+ Character c1 = text[1];
+ Character c2 = text[2];
+
+ DALI_TEST_EQUALS( c0.GetScript(), Character::LATIN, TEST_LOCATION );
+ DALI_TEST_EQUALS( c1.GetScript(), Character::LATIN, TEST_LOCATION );
+ DALI_TEST_EQUALS( c2.GetScript(), Character::LATIN, TEST_LOCATION );
+
+
+ Character c3 = text[3];
+ DALI_TEST_EQUALS( c3.GetScript(), Character::DEVANAGARI, TEST_LOCATION );
+
+ Character c4 = text[4];
+ DALI_TEST_EQUALS( c4.GetScript(), Character::BENGALI, TEST_LOCATION );
+
+ Character c5 = text[5];
+ DALI_TEST_EQUALS( c5.GetScript(), Character::GURMUKHI, TEST_LOCATION );
+
+ Character c6 = text[6];
+ DALI_TEST_EQUALS( c6.GetScript(), Character::GUJARATI, TEST_LOCATION );
+
+ Character c7 = text[7];
+ DALI_TEST_EQUALS( c7.GetScript(), Character::ORIYA, TEST_LOCATION );
+
+ Character c8 = text[8];
+ DALI_TEST_EQUALS( c8.GetScript(), Character::TAMIL, TEST_LOCATION );
+
+ Character c9 = text[9];
+ DALI_TEST_EQUALS( c9.GetScript(), Character::TELUGU, TEST_LOCATION );
+
+ Character c10 = text[10];
+ DALI_TEST_EQUALS( c10.GetScript(), Character::KANNADA, TEST_LOCATION );
+
+ Character c11 = text[11];
+ DALI_TEST_EQUALS( c11.GetScript(), Character::MALAYALAM, TEST_LOCATION );
+
+ Character c12 = text[12];
+ DALI_TEST_EQUALS( c12.GetScript(), Character::SINHALA, TEST_LOCATION );
+
+ Character c13 = text[13];
+ DALI_TEST_EQUALS( c13.GetScript(), Character::ARABIC, TEST_LOCATION );
+
+ // TODO : add more characters to cover all ranges.
+ END_TEST;
+}
+
int UtcDaliCharacterIsWhiteSpace(void)
{
tet_infoline("UtcDaliCharacterIsWhiteSpace ");
return true;
}
+Dali::Character::Script GetCharacterScript( uint32_t character )
+{
+ // Latin script:
+ // 0x0000 - 0x007f C0 Controls and Basic Latin
+ // 0x0080 - 0x00ff C1 Controls and Latin-1 Supplement
+ // 0x0100 - 0x017f Latin Extended-A
+ // 0x0180 - 0x024f Latin Extended-B
+ // 0x0250 - 0x02af IPA Extensions
+ // 0x02b0 - 0x02ff Spacing Modifier Letters
+ // 0x1d00 - 0x1d7f Phonetic Extensions
+ // 0x1d80 - 0x1dbf Phonetic Extensions Supplement
+ // 0x1e00 - 0x1eff Latin Extended Additional
+ // 0x2070 - 0x209f Superscripts and Subscripts
+ // 0x2100 - 0x214f Letterlike symbols
+ // 0x2150 - 0x218f Number Forms
+ // 0x2c60 - 0x2c7f Latin Extended-C
+ // 0xa720 - 0xa7ff Latin Extended-D
+ // 0xab30 - 0xab6f Latin Extended-E
+ // 0xfb00 - 0xfb4f Alphabetic Presentation Forms
+ // 0xff00 - 0xffef Halfwidth and Fullwidth Forms
+
+ // Brahmic scripts:
+ // 0x0900 - 0x097f Devanagari
+ // 0x0980 - 0x09ff Bengali
+ // 0x0a00 - 0x0a7f Gurmukhi
+ // 0x0a80 - 0x0aff Gujarati
+ // 0x0b00 - 0x0b7f Oriya
+ // 0x0b80 - 0x0bff Tamil
+ // 0x0c00 - 0x0c7f Telugu
+ // 0x0c80 - 0x0cff Kannada
+ // 0x0d00 - 0x0d7f Malayalam
+
+ // Sinhala script.
+ // 0x0d80 - 0x0dff Sinhala
+
+ // Arabic script.
+ // 0x0600 - 0x06ff
+ // 0x0750 - 0x077f
+ // 0x08A0 - 0x08ff
+ // 0xfb50 - 0xfdff
+ // 0xfe70 - 0xfeff
+ // 0x1ee00 - 0x1eeff
+
+
+ if( character <= 0x0cff )
+ {
+ if( character <= 0x09ff )
+ {
+ if( character <= 0x077f )
+ {
+ if( character <= 0x02ff )
+ {
+ return Dali::Character::LATIN;
+ }
+ if( ( 0x0600 <= character ) && ( character <= 0x06ff ) )
+ {
+ return Dali::Character::ARABIC;
+ }
+ if( ( 0x0750 <= character ) && ( character <= 0x077f ) )
+ {
+ return Dali::Character::ARABIC;
+ }
+ }
+ else
+ {
+ if( ( 0x08A0 <= character ) && ( character <= 0x08ff ) )
+ {
+ return Dali::Character::ARABIC;
+ }
+ if( ( 0x0900 <= character ) && ( character <= 0x097f ) )
+ {
+ return Dali::Character::DEVANAGARI;
+ }
+ if( ( 0x0980 <= character ) && ( character <= 0x09ff ) )
+ {
+ return Dali::Character::BENGALI;
+ }
+ }
+ }
+ else
+ {
+ if( character <= 0x0b7f )
+ {
+ if( ( 0x0a00 <= character ) && ( character <= 0x0a7f ) )
+ {
+ return Dali::Character::GURMUKHI;
+ }
+ if( ( 0x0a80 <= character ) && ( character <= 0x0aff ) )
+ {
+ return Dali::Character::GUJARATI;
+ }
+ if( ( 0x0b00 <= character ) && ( character <= 0x0b7f ) )
+ {
+ return Dali::Character::ORIYA;
+ }
+ }
+ else
+ {
+ if( ( 0x0b80 <= character ) && ( character <= 0x0bff ) )
+ {
+ return Dali::Character::TAMIL;
+ }
+ if( ( 0x0c00 <= character ) && ( character <= 0x0c7f ) )
+ {
+ return Dali::Character::TELUGU;
+ }
+ if( ( 0x0c80 <= character ) && ( character <= 0x0cff ) )
+ {
+ return Dali::Character::KANNADA;
+ }
+ }
+ }
+ }
+ else
+ {
+ if( character <= 0x2c7f )
+ {
+ if( character <= 0x1eff )
+ {
+ if( ( 0x0d00 <= character ) && ( character <= 0x0d7f ) )
+ {
+ return Dali::Character::MALAYALAM;
+ }
+ if( ( 0x0d80 <= character ) && ( character <= 0x0dff ) )
+ {
+ return Dali::Character::SINHALA;
+ }
+ if( ( 0x1d00 <= character ) && ( character <= 0x1eff ) )
+ {
+ return Dali::Character::LATIN;
+ }
+ }
+ else
+ {
+ if( ( 0x2070 <= character ) && ( character <= 0x209f ) )
+ {
+ return Dali::Character::LATIN;
+ }
+ if( ( 0x2100 <= character ) && ( character <= 0x218f ) )
+ {
+ return Dali::Character::LATIN;
+ }
+ if( ( 0x2c60 <= character ) && ( character <= 0x2c7f ) )
+ {
+ return Dali::Character::LATIN;
+ }
+ }
+ }
+ else
+ {
+ if( character <= 0xfdff )
+ {
+ if( ( 0xa720 <= character ) && ( character <= 0xa7ff ) )
+ {
+ return Dali::Character::LATIN;
+ }
+ if( ( 0xab30 <= character ) && ( character <= 0xab6f ) )
+ {
+ return Dali::Character::LATIN;
+ }
+ if( ( 0xfb00 <= character ) && ( character <= 0xfb4f ) )
+ {
+ return Dali::Character::LATIN;
+ }
+ if( ( 0xfb50 <= character ) && ( character <= 0xfdff ) )
+ {
+ return Dali::Character::ARABIC;
+ }
+ }
+ else
+ {
+ if( ( 0xfe70 <= character ) && ( character <= 0xfeff ) )
+ {
+ return Dali::Character::ARABIC;
+ }
+ if( ( 0xff00 <= character ) && ( character <= 0xffef ) )
+ {
+ return Dali::Character::LATIN;
+ }
+ if( ( 0x1ee00 <= character ) && ( character <= 0x1eeff ) )
+ {
+ return Dali::Character::ARABIC;
+ }
+ }
+ }
+ }
+
+ return Dali::Character::UNKNOWN;
+}
+
} // unnamed namespace
namespace Dali
return GetCharacterDirection( mCharacter );
}
+Dali::Character::Script Character::GetScript( uint32_t character )
+{
+ return GetCharacterScript( character );
+}
+
+Dali::Character::Script Character::GetScript() const
+{
+ return GetCharacterScript( mCharacter );
+}
+
bool Character::IsLeftToRight() const
{
return GetCharacterDirection() != Dali::Character::RightToLeft;
*/
CharacterDirection GetCharacterDirection() const;
+ /**
+ * Returns the character's script.
+ *
+ * @param[in] character The unicode value of the character.
+ *
+ * @return The script of the character.
+ */
+ static Dali::Character::Script GetScript( uint32_t character );
+
+ /**
+ * @copydoc Dali::Character::GetScript()
+ */
+ Dali::Character::Script GetScript() const;
+
/**
* @copydoc Dali::Character::IsLeftToRight()
*/
return mImpl->GetCharacterDirection();
}
+Character::Script Character::GetScript() const
+{
+ return mImpl->GetScript();
+}
+
bool Character::IsWhiteSpace() const
{
return mImpl->IsWhiteSpace();
Neutral ///< Neutral characters follow the direction of characters surrounding them (e.g. whitespace ' ')
};
+ /**
+ * @brief Script
+ *
+ * Script is the writing system used by a language.
+ * Typically one script can be used to write different languages although one language could be written in different scrips.
+ *
+ * i.e Many of the western languages like English, latin languages, etc use the latin script. Japanese uses the kanji, hiragana, katakana and latin scrips.
+ */
+ enum Script
+ {
+ LATIN, ///< The latin script. Used by many western languages.
+ ARABIC, ///< The arabic script. Used by Arab and Urdu among others.
+ DEVANAGARI, ///< The devanagari script. Used by Hindi, Marathi, Sindhi, Nepali and Sanskrit.
+ BENGALI, ///< The Bengali script. Used by Bangla, Assamese, Bishnupriya Manipuri, Daphla, Garo, Hallam, Khasi, Mizo, Munda, Naga, Rian, and Santali.
+ GURMUKHI, ///< The Gurmukhi script. Used by Punjabi.
+ GUJARATI, ///< The Gujarati script. Used by Gujarati.
+ ORIYA, ///< The Oriya script. Used by Oriya, Khondi, and Santali.
+ TAMIL, ///< The Tamil script. Used by Tamil, Badaga, and Saurashtra.
+ TELUGU, ///< The Telugu script. Used by Telugu, Gondi, and Lambadi.
+ KANNADA, ///< The Kannada script. Used by Kannada and Tulu.
+ MALAYALAM, ///< The Malayalam script. Used by Malayalam.
+ SINHALA, ///< The Sinhala script. Used by Sinhala and Pali.
+ UNKNOWN ///< The script is unknown.
+ };
+
public:
/**
*/
CharacterDirection GetCharacterDirection() const;
+
+ /**
+ * @brief Returs the script of this character.
+ */
+ Script GetScript() const;
+
/**
* @brief Returns whether this character is white space (true)
* or not (false).