From: minho.sun Date: Wed, 17 Jan 2018 06:49:12 +0000 (+0900) Subject: [4.0] Set proper locale to harfbuzz X-Git-Tag: accepted/tizen/4.0/unified/20180119.060734~3^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;ds=sidebyside;h=afbe62eede78885b1fade96085437913a7b1bc84;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git [4.0] Set proper locale to harfbuzz Some countries have their own cyrillic alphabets. To draw it, DALi should set proper locale to harfbuzz. Change-Id: I84eef22342765ac98a49ee9821f7693856069125 Signed-off-by: minho.sun --- diff --git a/text/dali/internal/text-abstraction/shaping-impl.cpp b/text/dali/internal/text-abstraction/shaping-impl.cpp index 3eb3488..24c542c 100644 --- a/text/dali/internal/text-abstraction/shaping-impl.cpp +++ b/text/dali/internal/text-abstraction/shaping-impl.cpp @@ -29,6 +29,7 @@ #include #include +#include namespace Dali { @@ -194,9 +195,13 @@ struct Shaping::Plugin hb_buffer_set_script( harfBuzzBuffer, SCRIPT_TO_HARFBUZZ[ script ] ); /* see hb-unicode.h */ - hb_buffer_set_language( harfBuzzBuffer, - hb_language_from_string( DEFAULT_LANGUAGE, - DEFAULT_LANGUAGE_LENGTH ) ); + + char* currentLocale = setlocale(LC_MESSAGES,NULL); + + std::istringstream stringStream( currentLocale ); + std::string localeString; + std::getline(stringStream, localeString, '_'); + hb_buffer_set_language( harfBuzzBuffer, hb_language_from_string( localeString.c_str(), localeString.size() ) ); /* Layout the text */ hb_buffer_add_utf32( harfBuzzBuffer, text, numberOfCharacters, 0u, numberOfCharacters );