From afbe62eede78885b1fade96085437913a7b1bc84 Mon Sep 17 00:00:00 2001 From: "minho.sun" Date: Wed, 17 Jan 2018 15:49:12 +0900 Subject: [PATCH] [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 --- text/dali/internal/text-abstraction/shaping-impl.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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 ); -- 2.7.4