Merge remote-tracking branch 'origin/tizen' into new_text 87/35887/1
authorPaul Wisbey <p.wisbey@samsung.com>
Wed, 25 Feb 2015 13:09:19 +0000 (13:09 +0000)
committerPaul Wisbey <p.wisbey@samsung.com>
Wed, 25 Feb 2015 13:09:19 +0000 (13:09 +0000)
Conflicts:
build/tizen/configure.ac
packaging/dali-adaptor-mobile.spec
packaging/dali-adaptor-tv.spec
packaging/dali-adaptor-wearable.spec
platform-abstractions/slp/font-platform/font-controller-impl.cpp
platform-abstractions/slp/font-platform/font-controller-impl.h

Change-Id: I03f316eeadbe029c5872ee59042c4466b88430d7

72 files changed:
adaptors/common/object-profiler.cpp
adaptors/common/style-monitor-impl.cpp
adaptors/public-api/dali.h
adaptors/public-api/file.list
automated-tests/src/dali-adaptor/dali-test-suite-utils/dali-test-suite-utils.h
automated-tests/src/dali-adaptor/dali-test-suite-utils/test-platform-abstraction.cpp
automated-tests/src/dali-adaptor/dali-test-suite-utils/test-platform-abstraction.h
build/tizen/adaptor/Makefile.am
build/tizen/configure.ac
packaging/dali-adaptor-mobile.spec
packaging/dali-adaptor-tv.spec
packaging/dali-adaptor-wearable.spec
packaging/dali-adaptor.spec
platform-abstractions/interfaces/font-controller.h [deleted file]
platform-abstractions/slp/data-cache/metrics-cache.cpp [deleted file]
platform-abstractions/slp/data-cache/metrics-cache.h [deleted file]
platform-abstractions/slp/file.list
platform-abstractions/slp/font-platform/font-controller-impl.cpp [deleted file]
platform-abstractions/slp/font-platform/font-controller-impl.h [deleted file]
platform-abstractions/slp/resource-loader/debug/resource-loader-debug.cpp
platform-abstractions/slp/resource-loader/debug/resource-loader-debug.h
platform-abstractions/slp/resource-loader/loader-font.cpp [deleted file]
platform-abstractions/slp/resource-loader/loader-font.h [deleted file]
platform-abstractions/slp/resource-loader/resource-loader.cpp
platform-abstractions/slp/resource-loader/resource-loader.h
platform-abstractions/slp/resource-loader/resource-text-requester.cpp [deleted file]
platform-abstractions/slp/resource-loader/resource-text-requester.h [deleted file]
platform-abstractions/slp/resource-loader/resource-thread-text.cpp [deleted file]
platform-abstractions/slp/resource-loader/resource-thread-text.h [deleted file]
platform-abstractions/slp/slp-platform-abstraction.cpp
platform-abstractions/slp/slp-platform-abstraction.h
text/dali/internal/libunibreak/AUTHORS [new file with mode: 0644]
text/dali/internal/libunibreak/LICENCE [new file with mode: 0644]
text/dali/internal/libunibreak/README.md [new file with mode: 0644]
text/dali/internal/libunibreak/file.list [new file with mode: 0644]
text/dali/internal/libunibreak/linebreak.c [new file with mode: 0644]
text/dali/internal/libunibreak/linebreak.h [new file with mode: 0644]
text/dali/internal/libunibreak/linebreakdata.c [new file with mode: 0644]
text/dali/internal/libunibreak/linebreakdef.c [new file with mode: 0644]
text/dali/internal/libunibreak/linebreakdef.h [new file with mode: 0644]
text/dali/internal/libunibreak/wordbreak.c [new file with mode: 0644]
text/dali/internal/libunibreak/wordbreak.h [new file with mode: 0644]
text/dali/internal/libunibreak/wordbreakdata.c [new file with mode: 0644]
text/dali/internal/libunibreak/wordbreakdef.h [new file with mode: 0644]
text/dali/internal/text-abstraction/bidirectional-support-impl.cpp [new file with mode: 0644]
text/dali/internal/text-abstraction/bidirectional-support-impl.h [new file with mode: 0644]
text/dali/internal/text-abstraction/font-client-impl.cpp [new file with mode: 0644]
text/dali/internal/text-abstraction/font-client-impl.h [new file with mode: 0644]
text/dali/internal/text-abstraction/font-client-plugin-impl.cpp [new file with mode: 0644]
text/dali/internal/text-abstraction/font-client-plugin-impl.h [new file with mode: 0644]
text/dali/internal/text-abstraction/segmentation-impl.cpp [new file with mode: 0644]
text/dali/internal/text-abstraction/segmentation-impl.h [new file with mode: 0644]
text/dali/internal/text-abstraction/shaping-impl.cpp [new file with mode: 0644]
text/dali/internal/text-abstraction/shaping-impl.h [new file with mode: 0644]
text/dali/public-api/text-abstraction/bidirectional-support.cpp [new file with mode: 0644]
text/dali/public-api/text-abstraction/bidirectional-support.h [new file with mode: 0644]
text/dali/public-api/text-abstraction/font-client.cpp [new file with mode: 0644]
text/dali/public-api/text-abstraction/font-client.h [new file with mode: 0644]
text/dali/public-api/text-abstraction/font-list.cpp [new file with mode: 0644]
text/dali/public-api/text-abstraction/font-list.h [new file with mode: 0644]
text/dali/public-api/text-abstraction/font-metrics.cpp [new file with mode: 0644]
text/dali/public-api/text-abstraction/font-metrics.h [new file with mode: 0644]
text/dali/public-api/text-abstraction/glyph-info.cpp [new file with mode: 0644]
text/dali/public-api/text-abstraction/glyph-info.h [new file with mode: 0644]
text/dali/public-api/text-abstraction/script.h [new file with mode: 0644]
text/dali/public-api/text-abstraction/segmentation.cpp [new file with mode: 0644]
text/dali/public-api/text-abstraction/segmentation.h [new file with mode: 0644]
text/dali/public-api/text-abstraction/shaping.cpp [new file with mode: 0644]
text/dali/public-api/text-abstraction/shaping.h [new file with mode: 0644]
text/dali/public-api/text-abstraction/text-abstraction-definitions.h [new file with mode: 0644]
text/dali/public-api/text-abstraction/text-abstraction.h [new file with mode: 0644]
text/file.list [new file with mode: 0644]

index 464a36a..f91468a 100644 (file)
@@ -178,7 +178,6 @@ int ObjectProfiler::GetMemorySize(const std::string& name, int count)
       { "Layer", LAYER_MEMORY_SIZE },
       { "CameraActor", CAMERA_ACTOR_MEMORY_SIZE },
       { "ImageActor", IMAGE_ACTOR_MEMORY_SIZE },
-      { "TextActor", TEXT_ACTOR_MEMORY_SIZE },
       { "MeshActor", MESH_ACTOR_MEMORY_SIZE },
       { "Image", IMAGE_MEMORY_SIZE },
       { "Mesh", MESH_MEMORY_SIZE },
index 3db191b..db6757c 100644 (file)
@@ -91,7 +91,7 @@ void StyleMonitor::StyleChanged(StyleChange styleChange)
 {
   if (styleChange.defaultFontChange || styleChange.defaultFontSizeChange)
   {
-    mPlatformAbstraction.UpdateDefaultsFromDevice();
+    //mPlatformAbstraction.UpdateDefaultsFromDevice();
   }
 
   EmitStyleChangeSignal(styleChange);
@@ -99,12 +99,14 @@ void StyleMonitor::StyleChanged(StyleChange styleChange)
 
 std::string StyleMonitor::GetDefaultFontFamily() const
 {
-  return mPlatformAbstraction.GetDefaultFontFamily();
+  //return mPlatformAbstraction.GetDefaultFontFamily();
+  return std::string();
 }
 
 float StyleMonitor::GetDefaultFontSize() const
 {
-  return mPlatformAbstraction.GetDefaultFontSize();
+  //return mPlatformAbstraction.GetDefaultFontSize();
+  return float();
 }
 
 const std::string& StyleMonitor::GetTheme() const
index 4ff97d1..740aa94 100644 (file)
@@ -55,6 +55,8 @@
 #include <dali/public-api/adaptor-framework/virtual-keyboard.h>
 #include <dali/public-api/adaptor-framework/window.h>
 
+#include <dali/public-api/text-abstraction/text-abstraction.h>
+
 #include <dali/public-api/dali-adaptor-version.h>
 
 #endif //__DALI_H__
index 2d9d9fc..1b087b9 100644 (file)
@@ -3,9 +3,9 @@ public_api_src_files = \
   $(adaptor_public_api_dir)/adaptor-framework/application.cpp \
   $(adaptor_public_api_dir)/adaptor-framework/bitmap-loader.cpp \
   $(adaptor_public_api_dir)/adaptor-framework/bitmap-saver.cpp \
-  $(adaptor_public_api_dir)/adaptor-framework/color-controller.cpp \
   $(adaptor_public_api_dir)/adaptor-framework/clipboard.cpp \
   $(adaptor_public_api_dir)/adaptor-framework/clipboard-event-notifier.cpp \
+  $(adaptor_public_api_dir)/adaptor-framework/color-controller.cpp \
   $(adaptor_public_api_dir)/adaptor-framework/device-layout.cpp \
   $(adaptor_public_api_dir)/adaptor-framework/drag-and-drop-detector.cpp \
   $(adaptor_public_api_dir)/adaptor-framework/event-feeder.cpp \
index 13db421..7716f52 100644 (file)
@@ -296,41 +296,6 @@ void DALI_TEST_EQUALS( const std::string &str1, const char* str2, const char* lo
 void DALI_TEST_EQUALS( const char* str1, const std::string &str2, const char* location);
 
 /**
- * Test whether two UTF32 strings are equal.
- * @param[in] str1 The first string
- * @param[in] str2 The second string
- * @param[in] location The TEST_LOCATION macro should be used here
- */
-template<>
-inline void DALI_TEST_EQUALS<const Integration::TextArray&>( const Integration::TextArray& str1, const Integration::TextArray& str2, const char* location)
-{
-  if( !std::equal( str1.Begin(), str1.End(), str2.Begin() ) )
-  {
-    fprintf(stderr, "%s, checking '", location);
-
-    for( unsigned int i = 0; i < str1.Count(); ++i )
-    {
-      fprintf(stderr, "%c", str1[i]);
-    }
-
-    fprintf(stderr, "' == '");
-
-    for( unsigned int i = 0; i < str2.Count(); ++i )
-    {
-      fprintf(stderr, "%c", str2[i]);
-    }
-
-    fprintf(stderr, "'\n");
-
-    tet_result(TET_FAIL);
-  }
-  else
-  {
-    tet_result(TET_PASS);
-  }
-}
-
-/**
  * Test whether one unsigned integer value is greater than another.
  * Test succeeds if value1 > value2
  * @param[in] value1 The first value
index aa1b5b2..596ecba 100644 (file)
@@ -87,16 +87,7 @@ void TestPlatformAbstraction::GetClosestImageSize( Integration::ResourcePointer
 void TestPlatformAbstraction::LoadResource(const Integration::ResourceRequest& request)
 {
   std::ostringstream out;
-  out << "Type:";
-  if( request.GetType()->id == Integration::ResourceText )
-  {
-    out << "Text";
-  }
-  else
-  {
-    out << request.GetType()->id;
-  }
-  out << ", Path: " << request.GetPath() << std::endl ;
+  out << "Type:" << request.GetType()->id << ", Path: " << request.GetPath() << std::endl ;
 
   mTrace.PushCall("LoadResource", out.str());
   if(mRequest != NULL)
@@ -170,148 +161,6 @@ bool TestPlatformAbstraction::IsLoading()
 }
 
 /**
- * @copydoc PlatformAbstraction::GetDefaultFontFamily()
- */
-const std::string& TestPlatformAbstraction::GetDefaultFontFamily() const
-{
-  mTrace.PushCall("GetDefaultFontFamily", "");
-  return mGetDefaultFontFamilyResult;
-}
-
-/**
- * @copydoc PlatformAbstraction::GetDefaultFontSize()
- */
-float TestPlatformAbstraction::GetDefaultFontSize() const
-{
-  mTrace.PushCall("GetDefaultFontSize", "");
-  return mGetDefaultFontSizeResult;
-}
-
-PixelSize TestPlatformAbstraction::GetFontLineHeightFromCapsHeight(const std::string& fontFamily, const std::string& fontStyle, CapsHeight capsHeight) const
-{
-  mTrace.PushCall("GetFontLineHeightFromCapsHeight", "");
-  // LineHeight will be bigger than CapsHeight, so return capsHeight + 1
-  return PixelSize(capsHeight + 1);
-}
-
-/**
- * @copydoc PlatformAbstraction::GetGlyphData()
- */
-
-Integration::GlyphSet* TestPlatformAbstraction::GetGlyphData ( const Integration::TextResourceType& textRequest,
-                                                               const std::string& fontFamily,
-                                                               bool getBitmap) const
-{
-  if( getBitmap )
-  {
-    mTrace.PushCall("GetGlyphData", "getBitmap:true");
-  }
-  else
-  {
-    mTrace.PushCall("GetGlyphData", "getBitmap:false");
-  }
-
-  // It creates fake metrics for the received characters.
-
-  Integration::GlyphSet* set = new Dali::Integration::GlyphSet();
-  Integration::BitmapPtr bitmapData;
-
-  std::set<uint32_t> characters;
-
-  for( Integration::TextResourceType::CharacterList::const_iterator it = textRequest.mCharacterList.begin(), endIt = textRequest.mCharacterList.end(); it != endIt; ++it )
-  {
-    if( characters.find( it->character ) == characters.end() )
-    {
-      characters.insert( it->character );
-      Integration::GlyphMetrics character = {it->character, Integration::GlyphMetrics::LOW_QUALITY,  10.0f,  10.0f, 9.0f, 1.0f, 10.0f, it->xPosition, it->yPosition };
-
-      if( getBitmap )
-      {
-        bitmapData = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD);
-        bitmapData->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, 64, 64);
-        PixelBuffer* pixelBuffer = bitmapData->GetBuffer();
-        memset( pixelBuffer, it->character, 64*64 );
-      }
-
-      set->AddCharacter(bitmapData, character);
-    }
-  }
-
-  set->mLineHeight = 10.0f;
-  set->mAscender = 9.0f;
-  set->mUnitsPerEM = 2048.0f/64.0f;
-  set->SetAtlasResourceId( textRequest.mTextureAtlasId );
-  set->mFontHash = textRequest.mFontHash;
-
-  return set;
-}
-
-/**
- * @copydoc PlatformAbstraction::GetCachedGlyphData()
- */
-
-Integration::GlyphSet* TestPlatformAbstraction::GetCachedGlyphData( const Integration::TextResourceType& textRequest,
-                                                                    const std::string& fontFamily ) const
-{
-  mTrace.PushCall("GetCachedGlyphData", "");
-
-  // It creates fake metrics and bitmap for received numeric characters '0' through '9'.
-  Integration::GlyphSet* set = new Dali::Integration::GlyphSet();
-  Integration::BitmapPtr bitmapData;
-
-  std::set<uint32_t> characters;
-
-  for( Integration::TextResourceType::CharacterList::const_iterator it = textRequest.mCharacterList.begin(), endIt = textRequest.mCharacterList.end(); it != endIt; ++it )
-  {
-    if( it->character >= '0' && it->character <= '9' && characters.find( it->character ) == characters.end() )
-    {
-      characters.insert( it->character );
-      Integration::GlyphMetrics character = {it->character, Integration::GlyphMetrics::HIGH_QUALITY,  10.0f,  10.0f, 9.0f, 1.0f, 10.0f, it->xPosition, it->yPosition };
-
-      bitmapData = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD);
-      bitmapData->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, 64, 64);
-      PixelBuffer* pixelBuffer = bitmapData->GetBuffer();
-      memset( pixelBuffer, it->character, 64*64 );
-      set->AddCharacter(bitmapData, character);
-    }
-  }
-
-  set->mLineHeight = 10.0f;
-  set->mAscender = 9.0f;
-  set->mUnitsPerEM = 2048.0f/64.0f;
-  set->SetAtlasResourceId( textRequest.mTextureAtlasId );
-  set->mFontHash = textRequest.mFontHash;
-
-  return set;
-}
-
-
-/**
- * @copydoc PlatformAbstraction::GetGlobalMetrics()
- */
-void TestPlatformAbstraction::GetGlobalMetrics( const std::string& fontFamily,
-                                                const std::string& fontStyle,
-                                                Integration::GlobalMetrics& globalMetrics ) const
-{
-  globalMetrics.lineHeight = 10.0f;
-  globalMetrics.ascender = 9.0f;
-  globalMetrics.unitsPerEM = 2048.0f/64.0f;
-  globalMetrics.underlineThickness = 2.f;
-  globalMetrics.underlinePosition = 1.f;
-}
-
-/**
- * @copydoc PlatformAbstraction::GetFontPath()
- */
-std::string TestPlatformAbstraction::GetFontPath(const std::string& family, bool bold, bool italic) const
-{
-  mTrace.PushCall("GetFontPath", "");
-  return mGetFontPathResult;
-
-  // Do nothing with arguments
-}
-
-/**
  * @copydoc PlatformAbstraction::SetDpi()
  */
 void TestPlatformAbstraction::SetDpi (unsigned int dpiHorizontal, unsigned int dpiVertical)
@@ -320,42 +169,6 @@ void TestPlatformAbstraction::SetDpi (unsigned int dpiHorizontal, unsigned int d
 }
 
 /**
- * @copydoc PlatformAbstraction::GetFontFamilyForChars()
- */
-const std::string& TestPlatformAbstraction::GetFontFamilyForChars(const Integration::TextArray& charsRequested) const
-{
-  mTrace.PushCall("GetFontFamilyForChars", "");
-  return mGetDefaultFontFamilyResult;
-}
-
-/**
- * @copydoc PlatformAbstraction::AllGlyphsSupported()
- */
-bool TestPlatformAbstraction::AllGlyphsSupported(const std::string& name, const std::string& fontStyle, const Integration::TextArray& text) const
-{
-  mTrace.PushCall("AllGlyphsSupported", "");
-  return true;
-}
-
-/**
- * @copydoc PlatformAbstraction::ValidateFontFamilyName()
- */
-bool TestPlatformAbstraction::ValidateFontFamilyName(const std::string& fontFamily, const std::string& fontStyle, bool& isDefaultSystemFont, std::string& closestMatch, std::string& closestStyleMatch) const
-{
-  mTrace.PushCall("ValidateFontFamilyName", "");
-  return true;
-}
-
-/**
- * @copydoc PlatformAbstraction::GetFontList()
- */
-void TestPlatformAbstraction::GetFontList( PlatformAbstraction::FontListMode mode, std::vector<std::string>& fonstList ) const
-{
-  mFontListMode = mode;
-  mTrace.PushCall("ValidateGetFontList", "");
-}
-
-/**
  * @copydoc PlatformAbstraction::LoadFile()
  */
 bool TestPlatformAbstraction::LoadFile( const std::string& filename, std::vector< unsigned char >& buffer ) const
@@ -383,102 +196,21 @@ void TestPlatformAbstraction::JoinLoaderThreads()
   mTrace.PushCall("JoinLoaderThreads", "");
 }
 
-void TestPlatformAbstraction::UpdateDefaultsFromDevice()
-{
-  mTrace.PushCall("UpdateDefaultsFromDevice", "");
-  mGetDefaultFontFamilyResult+=1.0f;
-}
-
 Integration::DynamicsFactory* TestPlatformAbstraction::GetDynamicsFactory()
 {
   mTrace.PushCall("GetDynamicsFactory", "");
   return NULL;
 }
 
-bool TestPlatformAbstraction::ReadGlobalMetricsFromCache( const std::string& fontFamily,
-                                                          const std::string& fontStyle,
-                                                          Integration::GlobalMetrics& globalMetrics )
-{
-  mTrace.PushCall("ReadGlobalMetricsFromCacheFile", "");
-  globalMetrics = mReadGlobalMetrics; // Want to copy contents...
-  return mReadGlobalMetricsResult; // Default false (will be set to true on subsequent write)
-}
-
-void TestPlatformAbstraction::WriteGlobalMetricsToCache( const std::string& fontFamily,
-                                                         const std::string& fontStyle,
-                                                         const Integration::GlobalMetrics& globalMetrics )
-{
-  // Copy so next read uses written values. TODO: Could add method
-  // to turn this behaviour off for more extensive testing.
-  mReadGlobalMetrics = globalMetrics;
-  mReadGlobalMetricsResult = true;
-
-  mTrace.PushCall("WriteGlobalMetricsToCacheFile", "");
-}
-
-bool TestPlatformAbstraction::ReadMetricsFromCache( const std::string& fontFamily,
-                                                    const std::string& fontStyle,
-                                                    std::vector<Integration::GlyphMetrics>& glyphMetricsContainer )
-{
-  mTrace.PushCall("ReadMetricsFromCacheFile", "");
-  glyphMetricsContainer = mReadMetrics;
-  return mReadMetricsResult; // Default false (will be set to true on subsequent write)
-}
-
-void TestPlatformAbstraction::WriteMetricsToCache( const std::string& fontFamily,
-                                                   const std::string& fontStyle,
-                                                   const Integration::GlyphSet& glyphSet )
-{
-  // Copy so next read uses written values. TODO: Could add method
-  // to turn this behaviour off for more extensive testing.
-  const Integration::GlyphSet::CharacterList& charList =  glyphSet.GetCharacterList();
-  mReadMetrics.clear();
-  for(std::size_t i=0, end=charList.size(); i<end; ++i)
-  {
-    mReadMetrics.push_back(charList[i].second);
-  }
-  mReadMetricsResult = true;
-
-  mTrace.PushCall("WriteMetricsToCacheFile", "");
-}
-
-
-void TestPlatformAbstraction::GetFileNamesFromDirectory( const std::string& directoryName,
-                                                         std::vector<std::string>& fileNames )
-{
-  fileNames.push_back( std::string( "u1f004.png" ) );
-  fileNames.push_back( std::string( "u1f0cf.png" ) );
-  fileNames.push_back( std::string( "u1f170.png" ) );
-  fileNames.push_back( std::string( "u1f601.png" ) );
-}
-
-
-Integration::BitmapPtr TestPlatformAbstraction::GetGlyphImage( const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character ) const
-{
-  Integration::BitmapPtr image = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD );
-  image->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 1, 1 );
-
-  mTrace.PushCall("GetGlyphImage", "");
-
-  return image;
-}
-
-
 /** Call this every test */
 void TestPlatformAbstraction::Initialize()
 {
   mTrace.Reset();
   mTrace.Enable(true);
   memset(&mResources, 0, sizeof(Resources));
-  memset(&mReadGlobalMetrics, 0, sizeof(Integration::GlobalMetrics));
   mSeconds=0;
   mMicroSeconds=0;
   mIsLoadingResult=false;
-  mGetDefaultFontFamilyResult = "HelveticaNeue";
-  mGetDefaultFontSizeResult=12.0f;
-  mGetFontPathResult="helvetica-12";
-  mReadMetricsResult=false;
-  mReadGlobalMetricsResult=false;
 
   if(mRequest)
   {
@@ -502,24 +234,9 @@ bool TestPlatformAbstraction::WasCalled(TestFuncEnum func)
     case CancelLoadFunc:                      return mTrace.FindMethod("CancelLoad");
     case GetResourcesFunc:                    return mTrace.FindMethod("GetResources");
     case IsLoadingFunc:                       return mTrace.FindMethod("IsLoading");
-    case GetDefaultFontFamilyFunc:            return mTrace.FindMethod("GetDefaultFontFamily");
-    case GetDefaultFontSizeFunc:              return mTrace.FindMethod("GetDefaultFontSize");
-    case GetFontLineHeightFromCapsHeightFunc: return mTrace.FindMethod("GetFontLineHeightFromCapsHeight");
-    case GetGlyphDataFunc:                    return mTrace.FindMethod("GetGlyphData");
-    case GetCachedGlyphDataFunc:              return mTrace.FindMethod("GetCachedGlyphData");
-    case GetFontPathFunc:                     return mTrace.FindMethod("GetFontPath");
     case SetDpiFunc:                          return mTrace.FindMethod("SetDpi");
     case JoinLoaderThreadsFunc:               return mTrace.FindMethod("JoinLoaderThreads");
-    case GetFontFamilyForCharsFunc:           return mTrace.FindMethod("GetFontFamilyForChars");
-    case AllGlyphsSupportedFunc:              return mTrace.FindMethod("AllGlyphsSupported");
-    case ValidateFontFamilyNameFunc:          return mTrace.FindMethod("ValidateFontFamilyName");
-    case UpdateDefaultsFromDeviceFunc:        return mTrace.FindMethod("UpdateDefaultsFromDevice");
     case GetDynamicsFactoryFunc:              return mTrace.FindMethod("GetDynamicsFactory");
-    case ValidateGetFontListFunc:             return mTrace.FindMethod("ValidateGetFontList");
-    case ReadGlobalMetricsFromCacheFileFunc:  return mTrace.FindMethod("ReadGlobalMetricsFromCacheFile");
-    case WriteGlobalMetricsToCacheFileFunc:   return mTrace.FindMethod("WriteGlobalMetricsToCacheFile");
-    case ReadMetricsFromCacheFileFunc:        return mTrace.FindMethod("ReadMetricsFromCacheFile");
-    case WriteMetricsToCacheFileFunc:         return mTrace.FindMethod("WriteMetricsToCacheFile");
   }
   return false;
 }
@@ -544,21 +261,6 @@ void TestPlatformAbstraction::SetIsLoadingResult(bool result)
   mIsLoadingResult = result;
 }
 
-void TestPlatformAbstraction::SetGetDefaultFontFamilyResult(std::string result)
-{
-  mGetDefaultFontFamilyResult = result;
-}
-
-void TestPlatformAbstraction::SetGetDefaultFontSizeResult(float result)
-{
-  mGetDefaultFontSizeResult = result;
-}
-
-void TestPlatformAbstraction::SetGetFontPathResult(std::string& result)
-{
-  mGetFontPathResult = result;
-}
-
 void TestPlatformAbstraction::ClearReadyResources()
 {
   memset(&mResources, 0, sizeof(Resources));
@@ -628,21 +330,4 @@ void TestPlatformAbstraction::SetSaveFileResult( bool result )
   mSaveFileResult = result;
 }
 
-Integration::PlatformAbstraction::FontListMode TestPlatformAbstraction::GetLastFontListMode( )
-{
-  return mFontListMode;
-}
-
-void TestPlatformAbstraction::SetReadGlobalMetricsResult( bool success, Integration::GlobalMetrics& globalMetrics )
-{
-  mReadGlobalMetricsResult = success;
-  mReadGlobalMetrics = globalMetrics;
-}
-
-void TestPlatformAbstraction::SetReadMetricsResult( bool success, std::vector<Integration::GlyphMetrics>& glyphMetricsContainer )
-{
-  mReadMetricsResult = success;
-  mReadMetrics = glyphMetricsContainer; // copy
-}
-
 } // namespace Dali
index 54cb154..63df1c8 100644 (file)
@@ -26,7 +26,6 @@
 #include <dali/public-api/common/set-wrapper.h>
 #include <dali/integration-api/platform-abstraction.h>
 
-#include <dali/integration-api/glyph-set.h>
 #include "test-trace-call-stack.h"
 
 
@@ -137,72 +136,11 @@ public:
   virtual bool IsLoading();
 
   /**
-   * @copydoc PlatformAbstraction::GetDefaultFontFamily()
-   */
-  virtual const std::string& GetDefaultFontFamily() const;
-
-  /**
-   * @copydoc PlatformAbstraction::GetDefaultFontSize()
-   */
-  virtual float GetDefaultFontSize() const;
-
-  /**
-   * @copydoc PlatformAbstraction::GetFontLineHeightFromCapsHeight()
-   */
-  virtual Dali::PixelSize GetFontLineHeightFromCapsHeight(const std::string& fontFamily, const std::string& fontStyle, CapsHeight capsHeight) const;
-
-  /**
-   * @copydoc PlatformAbstraction::GetGlyphData()
-   */
-  virtual Integration::GlyphSet* GetGlyphData ( const Integration::TextResourceType& textRequest,
-                                                const std::string& fontFamily,
-                                                bool getBitmap) const;
-
-  /**
-   * @copydoc PlatformAbstraction::GetCachedGlyphData()
-   */
-  virtual Integration::GlyphSet* GetCachedGlyphData( const Integration::TextResourceType& textRequest,
-                                                     const std::string& fontFamily ) const;
-
-
-  /**
-   * @copydoc PlatformAbstraction::GetGlobalMetrics()
-   */
-  virtual void GetGlobalMetrics( const std::string& fontFamily,
-                                 const std::string& fontStyle,
-                                 Integration::GlobalMetrics& globalMetrics ) const;
-
-  /**
-   * @copydoc PlatformAbstraction::GetFontPath()
-   */
-  virtual std::string GetFontPath(const std::string& family, bool bold, bool italic) const;
-
-  /**
    * @copydoc PlatformAbstraction::SetDpi()
    */
   virtual void SetDpi (unsigned int dpiHorizontal, unsigned int dpiVertical);
 
   /**
-   * @copydoc PlatformAbstraction::GetFontFamilyForChars()
-   */
-  virtual const std::string& GetFontFamilyForChars(const Integration::TextArray& charsRequested) const;
-
-  /**
-   * @copydoc PlatformAbstraction::AllGlyphsSupported()
-   */
-  virtual bool AllGlyphsSupported(const std::string& name, const std::string& fontStyle, const Integration::TextArray& text) const;
-
-  /**
-   * @copydoc PlatformAbstraction::ValidateFontFamilyName()
-   */
-  virtual bool ValidateFontFamilyName(const std::string& fontFamily, const std::string& fontStyle, bool& isDefaultSystemFont, std::string& closestMatch, std::string& closestStyleMatch) const;
-
-  /**
-   * @copydoc PlatformAbstraction::GetFontList()
-   */
-  virtual void GetFontList( PlatformAbstraction::FontListMode mode, std::vector<std::string>& fontList ) const;
-
-  /**
    * @copydoc PlatformAbstraction::LoadFile()
    */
   virtual bool LoadFile( const std::string& filename, std::vector< unsigned char >& buffer ) const;
@@ -214,31 +152,8 @@ public:
 
   virtual void JoinLoaderThreads();
 
-  virtual void UpdateDefaultsFromDevice();
-
   virtual Integration::DynamicsFactory* GetDynamicsFactory();
 
-  virtual bool ReadGlobalMetricsFromCache( const std::string& fontFamily,
-                                           const std::string& fontStyle,
-                                           Integration::GlobalMetrics& globalMetrics );
-
-  virtual void WriteGlobalMetricsToCache( const std::string& fontFamily,
-                                          const std::string& fontStyle,
-                                          const Integration::GlobalMetrics& globalMetrics );
-
-  virtual bool ReadMetricsFromCache( const std::string& fontFamily,
-                                     const std::string& fontStyle,
-                                     std::vector<Integration::GlyphMetrics>& glyphMetricsContainer );
-  virtual void WriteMetricsToCache( const std::string& fontFamily,
-                                    const std::string& fontStyle,
-                                    const Integration::GlyphSet& glyphSet );
-
-
-  virtual void GetFileNamesFromDirectory( const std::string& directoryName,
-                                          std::vector<std::string>& fileNames );
-
-  virtual Integration::BitmapPtr GetGlyphImage( const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character ) const;
-
 public: // TEST FUNCTIONS
 
   // Enumeration of Platform Abstraction methods
@@ -254,24 +169,9 @@ public: // TEST FUNCTIONS
     CancelLoadFunc,
     GetResourcesFunc,
     IsLoadingFunc,
-    GetDefaultFontFamilyFunc,
-    GetDefaultFontSizeFunc,
-    GetFontLineHeightFromCapsHeightFunc,
-    GetGlyphDataFunc,
-    GetCachedGlyphDataFunc,
     SetDpiFunc,
-    GetFontPathFunc,
     JoinLoaderThreadsFunc,
-    GetFontFamilyForCharsFunc,
-    AllGlyphsSupportedFunc,
-    ValidateFontFamilyNameFunc,
-    UpdateDefaultsFromDeviceFunc,
-    GetDynamicsFactoryFunc,
-    ValidateGetFontListFunc,
-    ReadGlobalMetricsFromCacheFileFunc,
-    WriteGlobalMetricsToCacheFileFunc,
-    ReadMetricsFromCacheFileFunc,
-    WriteMetricsToCacheFileFunc,
+    GetDynamicsFactoryFunc
   } TestFuncEnum;
 
   /** Call this every test */
@@ -320,32 +220,18 @@ public: // TEST FUNCTIONS
 
   void SetSaveFileResult( bool result );
 
-  PlatformAbstraction::FontListMode GetLastFontListMode( );
-
-  void SetReadGlobalMetricsResult( bool success, Integration::GlobalMetrics& globalMetrics );
-
-  void SetReadMetricsResult( bool success, std::vector<Integration::GlyphMetrics>& glyphMetricsContainer );
-
 private:
   mutable TraceCallStack        mTrace;
   size_t                        mSeconds;
   size_t                        mMicroSeconds;
   bool                          mIsLoadingResult;
-  std::string                   mGetDefaultFontFamilyResult;
-  float                         mGetDefaultFontSizeResult;
-  std::string                   mGetFontPathResult;
   Resources                     mResources;
   Integration::ResourceRequest* mRequest;
   Vector2                       mSize;
   Vector2                       mClosestSize;
-  bool                          mReadGlobalMetricsResult;
-  bool                          mReadMetricsResult;
-  Integration::GlobalMetrics mReadGlobalMetrics;
-  std::vector<Integration::GlyphMetrics> mReadMetrics;
 
   LoadFileResult                mLoadFileResult;
   bool                          mSaveFileResult;
-  mutable FontListMode          mFontListMode;
 };
 
 } // Dali
index bce2054..532cd37 100644 (file)
@@ -28,6 +28,10 @@ slp_platform_abstraction_src_dir = ../../../platform-abstractions/slp
 portable_platform_abstraction_src_dir = ../../../platform-abstractions/portable
 include ../../../platform-abstractions/slp/file.list
 
+# Text Abstraction
+text_src_dir = ../../../text
+include ../../../text/file.list
+
 # Internal Common
 adaptor_common_dir = ../../../adaptors/common
 include ../../../adaptors/common/file.list
@@ -66,6 +70,9 @@ endif
 adaptor_public_api_dir = ../../../adaptors/public-api
 include ../../../adaptors/public-api/file.list
 
+# Static libraries
+static_libraries_libunibreak_src_dir = ../../../text/dali/internal/libunibreak
+include ../../../text/dali/internal/libunibreak/file.list
 
 ############# source files #############
 
@@ -80,7 +87,8 @@ if COMMON_PROFILE
 
 adaptor_internal_src_files = $(adaptor_common_internal_src_files) \
                              $(adaptor_common_internal_default_profile_src_files) \
-                             $(adaptor_tizen_internal_src_files)
+                             $(adaptor_tizen_internal_src_files) \
+                             $(static_libraries_libunibreak_src_files)
 
 if WAYLAND
 adaptor_internal_src_files += $(adaptor_wayland_tizen_internal_src_files) \
@@ -99,7 +107,8 @@ adaptor_internal_src_files = $(adaptor_common_internal_src_files) \
                              $(adaptor_common_internal_default_profile_src_files) \
                              $(adaptor_ubuntu_internal_src_files) \
                              $(adaptor_x11_ubuntu_internal_src_files) \
-                             $(adaptor_x11_internal_default_profile_src_files)
+                             $(adaptor_x11_internal_default_profile_src_files) \
+                             $(static_libraries_libunibreak_src_files)
 
 endif # UBUNTU_PROFILE
 
@@ -110,7 +119,8 @@ if MOBILE_PROFILE
 adaptor_internal_src_files = $(adaptor_common_internal_src_files) \
                              $(adaptor_common_internal_mobile_profile_src_files) \
                              $(adaptor_tizen_internal_src_files) \
-                             $(adaptor_x11_tizen_internal_src_files)
+                             $(adaptor_x11_tizen_internal_src_files) \
+                             $(static_libraries_libunibreak_src_files)
 
 endif
 
@@ -121,7 +131,8 @@ if LITE_PROFILE
 adaptor_internal_src_files = $(adaptor_common_internal_src_files) \
                              $(adaptor_common_internal_mobile_profile_src_files) \
                              $(adaptor_tizen_internal_src_files) \
-                             $(adaptor_x11_tizen_internal_src_files)
+                             $(adaptor_x11_tizen_internal_src_files) \
+                             $(static_libraries_libunibreak_src_files)
 endif
 
 
@@ -131,7 +142,8 @@ if WEARABLE_PROFILE
 adaptor_internal_src_files = $(adaptor_common_internal_src_files) \
                              $(adaptor_common_internal_mobile_profile_src_files) \
                              $(adaptor_tizen_internal_src_files) \
-                             $(adaptor_x11_tizen_internal_src_files)
+                             $(adaptor_x11_tizen_internal_src_files) \
+                             $(static_libraries_libunibreak_src_files)
 endif
 
 
@@ -141,7 +153,8 @@ if TV_PROFILE
 adaptor_internal_src_files = $(adaptor_common_internal_src_files) \
                              $(adaptor_common_internal_tv_profile_src_files) \
                              $(adaptor_tizen_internal_src_files) \
-                             $(adaptor_x11_tv_internal_src_files)
+                             $(adaptor_x11_tv_internal_src_files) \
+                             $(static_libraries_libunibreak_src_files)
 endif
 
 # Feedback Plugin
@@ -163,6 +176,7 @@ lib_LTLIBRARIES = libdali-adaptor.la
 libdali_adaptor_la_SOURCES = \
                      $(base_adaptor_src_files) \
                      $(slp_platform_abstraction_src_files) \
+                     $(text_abstraction_src_files) \
                      $(public_api_src_files) \
                      $(adaptor_internal_src_files)
 
@@ -175,10 +189,13 @@ libdali_adaptor_la_includes = \
                       -I../../../platform-abstractions/slp/resource-loader \
                       -I../../../platform-abstractions/portable \
                       -I../../../platform-abstractions/ \
+                      -I../../../adaptors/ \
                       -I../../../adaptors/public-api \
                       -I../../../adaptors/public-api/adaptor-framework \
                       -I../../../adaptors/common \
-                      -I../../../adaptors/
+                      -I../../../text \
+                      -I../../../text/dali/internal/libunibreak
+
 if WAYLAND
 libdali_adaptor_la_includes += \
                       -I../../../adaptors/wayland
@@ -258,6 +275,7 @@ libdali_adaptor_la_LIBADD = \
                       $(LIBCURL_LIBS) \
                       $(CAPI_SYSTEM_SYSTEM_SETTINGS_LIBS) \
                       $(CAPI_APPFW_APPLICATION_LIBS) \
+                      $(HARFBUZZ_LIBS) \
                       -lgif \
                       -lboost_thread
 
@@ -319,6 +337,9 @@ tizenadaptorpublicapi_HEADERS = $(public_api_header_files)
 tizenadaptorframeworkpublicapidir = $(tizenadaptorpublicapidir)/adaptor-framework
 tizenadaptorframeworkpublicapi_HEADERS = $(public_api_adaptor_framework_header_files)
 
+tizentextabstractionpublicapidir = $(tizenadaptorpublicapidir)/text-abstraction
+tizentextabstractionpublicapi_HEADERS = $(text_abstraction_header_files)
+
 tizenadaptordaliheaderdir = $(devincludepath)/dali
 tizenadaptordaliheader_HEADERS = $(adaptor_dali_header_file)
 
@@ -349,4 +370,5 @@ linker_test_LDADD = \
   $(DALICORE_LIBS) \
   $(VCONF_LIBS) \
   libdali-adaptor.la \
+  $(HARFBUZZ_LIBS) \
   -L${prefix}/lib
index 6aec94b..d7eab76 100644 (file)
@@ -45,6 +45,8 @@ PKG_CHECK_MODULES(XML, libxml-2.0)
 PKG_CHECK_MODULES(LIBEXIF, libexif)
 PKG_CHECK_MODULES(LIBDRM, libdrm)
 PKG_CHECK_MODULES(LIBCURL, libcurl)
+PKG_CHECK_MODULES(HARFBUZZ, harfbuzz)
+PKG_CHECK_MODULES(FRIBIDI, fribidi)
 
 # Check for availability of BulletPhysics
 PKG_CHECK_EXISTS(bullet, [
index 7f8de5c..6a46702 100644 (file)
@@ -45,6 +45,8 @@ BuildRequires:  pkgconfig(libpng)
 BuildRequires:  pkgconfig(opengl-es-20)
 BuildRequires:  pkgconfig(efl-assist)
 BuildRequires:  libcurl-devel
+BuildRequires:  pkgconfig(harfbuzz)
+BuildRequires:  fribidi-devel
 
 %if 0%{?dali_assimp_plugin}
 BuildRequires:  pkgconfig(assimp)
index ddf0543..33797c7 100644 (file)
@@ -42,6 +42,8 @@ BuildRequires:  pkgconfig(xdamage)
 BuildRequires:  pkgconfig(utilX)
 BuildRequires:  pkgconfig(gles20)
 BuildRequires:  libcurl-devel
+BuildRequires:  pkgconfig(harfbuzz)
+BuildRequires:  fribidi-devel
 
 %if 0%{?dali_assimp_plugin}
 BuildRequires:  pkgconfig(assimp)
index bdaa536..d1e8464 100644 (file)
@@ -44,6 +44,8 @@ BuildRequires:  pkgconfig(libpng)
 BuildRequires:  pkgconfig(gles20)
 BuildRequires:  pkgconfig(efl-assist)
 BuildRequires:  libcurl-devel
+BuildRequires:  pkgconfig(harfbuzz)
+BuildRequires:  fribidi-devel
 
 %if 0%{?dali_assimp_plugin}
 BuildRequires:  pkgconfig(assimp)
index 0596e33..588aae9 100644 (file)
@@ -78,6 +78,9 @@ BuildRequires:  pkgconfig(xdamage)
 BuildRequires:  pkgconfig(utilX)
 %endif
 
+BuildRequires:  pkgconfig(harfbuzz)
+BuildRequires:  fribidi-devel
+
 %if 0%{?dali_assimp_plugin}
 BuildRequires:  pkgconfig(assimp)
 %endif
diff --git a/platform-abstractions/interfaces/font-controller.h b/platform-abstractions/interfaces/font-controller.h
deleted file mode 100644 (file)
index 83a8945..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-#ifndef __DALI_PLATFORM_FONT_CONTROLLER_H__
-#define __DALI_PLATFORM_FONT_CONTROLLER_H__
-
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES (for TextArray)
-#include <dali/integration-api/platform-abstraction.h>
-
-// EXTERNAL INCLUDES
-#include <string>
-
-namespace Dali
-{
-
-namespace Platform
-{
-
-/**
- * Abstract interface for the font controller.
- * Hides platform specific code for managing fonts.
- */
-class FontController
-{
-public:
-
-  /**
-   * The mode for GetFontList()
-   */
-  enum FontListMode
-  {
-    LIST_SYSTEM_FONTS,                   ///< List system fonts
-    LIST_APPLICATION_FONTS,              ///< List application fonts
-    LIST_ALL_FONTS                       ///< List all fonts
-  };
-
-  /**
-   * Defines a font family with style.
-   */
-  typedef std::pair<std::string/*font family*/,std::string/*font style*/> StyledFontFamily;
-
-  /**
-   * Font list typedef.
-   */
-  typedef std::vector<StyledFontFamily> FontList;
-
-  /**
-   * Create a new font controller.
-   */
-  static FontController* New();
-
-
-  /**
-   * Destructor.
-   */
-  virtual ~FontController()
-  {
-  }
-
-  /**
-   * Given a font family return a font path.
-   * @param[in] styledFontFamily The name of the font's family and the font's style.
-   * @return font file name.
-   */
-  virtual const std::string& GetFontPath( const StyledFontFamily& styledFontFamily ) = 0;
-
-  /**
-   * Gets a list of fonts installed on the system.
-   * @param[in] fontListMode which fonts to include in the list.
-   * @param[out] fontList The list of font family names.
-   */
-  virtual void GetFontList( FontListMode fontListMode, FontList& fontList ) = 0;
-
-  /**
-   * Checks whether fontName is a valid font family name.
-   * closestMatch is always set to the best matching font or the system default font if no near match is detected.
-   * @param[in]  styledFontFamily The name of the font's family and the font's style.
-   * @param[out] isDefaultSystemFontFamily Whether this font has been created with a default system font family.
-   * @param[out] isDefaultSystemFontStyle Whether this font has been created with a default system font style.
-   * @param[out] closestStyledFontFamilyMatch The name of the font's family and the font's style found based on the given input.
-   * @return     true if styledFontFamily is valid, false otherwise.
-   */
-  virtual bool ValidateFontFamilyName( const StyledFontFamily& styledFontFamily,
-                                       bool& isDefaultSystemFontFamily,
-                                       bool& isDefaultSystemFontStyle,
-                                       StyledFontFamily& closestStyledFontFamilyMatch ) = 0;
-
-  /**
-   * Returns font family name for displayed text.
-   * If possible, the returned font name should be able to display all characters in text.
-   * Otherwise returns closest match.
-   * @param[in] charsRequested displayed text.
-   */
-  virtual const StyledFontFamily& GetFontFamilyForChars( const Integration::TextArray& charsRequested ) = 0;
-
-  /**
-   * Checks whether all characters of text could be displayed with specified font family.
-   * @param[in] styledFontFamily The name of the font's family and the font's style.
-   * @param[in] text displayed text.
-   */
-  virtual bool AllGlyphsSupported( const StyledFontFamily& styledFontFamily, const Integration::TextArray& text ) = 0;
-
-  /**
-   * Set the default font family and its style that should be used by the font controller.
-   * @param[in] styledFontFamily The default name of the font's family and the default font's style.
-   */
-  virtual void SetDefaultFontFamily( const StyledFontFamily& styledFontFamily ) = 0;
-
-protected:
-
-  /**
-   * Constructor
-   */
-  FontController()
-  {
-  }
-
-private:
-
-  // Undefined copy constructor.
-  FontController( const FontController& );
-
-  // Undefined assignment operator.
-  FontController& operator=( const FontController& );
-};
-
-} // namespace Platform
-
-} // namespace Dali
-
-#endif // __DALI_PLATFORM_FONT_CONTROLLER_H__
diff --git a/platform-abstractions/slp/data-cache/metrics-cache.cpp b/platform-abstractions/slp/data-cache/metrics-cache.cpp
deleted file mode 100644 (file)
index 822bb08..0000000
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include "metrics-cache.h"
-
-// EXTERNAL HEADERS
-#include <iostream>
-#include <fstream>
-#include <string>
-#include <algorithm>
-#include <boost/functional/hash.hpp>
-#include <string.h>
-
-// INTERNAL HEADERS
-#include <dali/integration-api/glyph-set.h>
-
-
-namespace Dali
-{
-
-namespace // Anonymous namespace
-{
-
-const std::size_t VERSION_SIZE( sizeof(__DATE__ "-" __TIME__) );  // (date-time)
-const char FILE_VERSION[ VERSION_SIZE ] =  __DATE__ "-" __TIME__; // Updates with each build
-
-const size_t CHECKSUM_SIZE( sizeof( size_t ) );
-const size_t NUMBER_GLOBAL_METRICS( 9 ); // line height, ascender, unitsPerEM, underlinePosition, underlineThickness, maxWidth, maxHeight, padAdjustX, padAdjustY
-const size_t GLOBAL_METRICS_SIZE( NUMBER_GLOBAL_METRICS * sizeof( float ) );
-const size_t GLOBAL_METRIC_HEADER_SIZE( GLOBAL_METRICS_SIZE + CHECKSUM_SIZE + VERSION_SIZE );
-const std::string DALI_DEFAULT_FONT_CACHE_PATH( DALI_USER_FONT_CACHE_DIR );
-const std::string METRICS_EXTENSION( ".metrics" );
-
-
-std::string CreateFileName(const std::string& fontFamily, const std::string& fontStyle)
-{
-  std::string cacheFileName(DALI_DEFAULT_FONT_CACHE_PATH + fontFamily + "-" + fontStyle + METRICS_EXTENSION);
-
-  std::replace(cacheFileName.begin(), cacheFileName.end(), ' ', '-' );
-  return cacheFileName;
-}
-
-std::size_t CalculateGlobalMetricCheckSum( const Integration::GlobalMetrics& globalMetrics )
-{
-  int checksum = static_cast<int>( globalMetrics.lineHeight ) +
-                 static_cast<int>( globalMetrics.ascender )   +
-                 static_cast<int>( globalMetrics.unitsPerEM ) +
-                 static_cast<int>( globalMetrics.underlinePosition ) +
-                 static_cast<int>( globalMetrics.underlineThickness ) +
-                 static_cast<int>( globalMetrics.maxWidth ) +
-                 static_cast<int>( globalMetrics.maxHeight ) +
-                 static_cast<int>( globalMetrics.padAdjustX ) +
-                 static_cast<int>( globalMetrics.padAdjustY );
-
-
-  return boost::hash_value( checksum );
-
-}
-
-std::size_t CalculateGlyphCheckSum( const Integration::GlyphMetrics& metrics )
-{
-  int checksum =  static_cast<int>( metrics.code )    +
-                  static_cast<int>( metrics.width )   +
-                  static_cast<int>( metrics.height )  +
-                  static_cast<int>( metrics.top )     +
-                  static_cast<int>( metrics.left )    +
-                  static_cast<int>( metrics.xAdvance);
-
-  return boost::hash_value( checksum );
-}
-
-bool ReadGlyphMetrics( std::ifstream& file,  Integration::GlyphMetrics& metrics )
-{
-  std::size_t checkSumRead;
-  uint32_t code;
-
-  file.read( reinterpret_cast<char*>( &code ),         sizeof( uint32_t ) );
-  file.read( reinterpret_cast<char*>( &metrics.width ),   sizeof( float ) );
-  file.read( reinterpret_cast<char*>( &metrics.height ),  sizeof( float ) );
-  file.read( reinterpret_cast<char*>( &metrics.top ),     sizeof( float ) );
-  file.read( reinterpret_cast<char*>( &metrics.left ),    sizeof( float ) );
-  file.read( reinterpret_cast<char*>( &metrics.xAdvance), sizeof( float ) );
-  file.read( reinterpret_cast<char*>( &checkSumRead ),    sizeof( std::size_t ) );
-
-  metrics.code = code;  // code is now stored as a bit mask so we can't read directly in to it
-  metrics.quality = Integration::GlyphMetrics::LOW_QUALITY;
-
-  const std::size_t calcCheckSum = CalculateGlyphCheckSum( metrics );
-
-  return ( calcCheckSum == checkSumRead );
-}
-
-void WriteGlyphMetrics( std::ofstream& file, const Integration::GlyphMetrics& metrics )
-{
-  uint32_t code = metrics.code; // code is stored as a bitmask so we can't write directly from it
-  file.write( reinterpret_cast<const char*>( &code ),     sizeof( uint32_t ) );
-  file.write( reinterpret_cast<const char*>( &metrics.width ),    sizeof( float ) );
-  file.write( reinterpret_cast<const char*>( &metrics.height ),   sizeof( float ) );
-  file.write( reinterpret_cast<const char*>( &metrics.top ),      sizeof( float ) );
-  file.write( reinterpret_cast<const char*>( &metrics.left ),     sizeof( float ) );
-  file.write( reinterpret_cast<const char*>( &metrics.xAdvance ), sizeof( float ) );
-
-  const std::size_t calcCheckSum = CalculateGlyphCheckSum( metrics );
-
-  file.write( reinterpret_cast<const char*>( &calcCheckSum ), sizeof( std::size_t ) );
-}
-
-bool ReadGlyphGlobalMetrics( std::ifstream& file, Integration::GlobalMetrics& globalMetrics )
-{
-  char version_string[ VERSION_SIZE ];
-
-  // Check file version
-  file.read( version_string, VERSION_SIZE );
-  if( strncmp( version_string, FILE_VERSION, VERSION_SIZE ) != 0 )
-  {
-    DALI_LOG_WARNING( "Glyph metrics file version mismatch\n" );
-    return false;
-  }
-
-  std::size_t checkSumRead;
-
-  file.read( reinterpret_cast<char*>( &globalMetrics.lineHeight ), sizeof( float ) );
-  file.read( reinterpret_cast<char*>( &globalMetrics.ascender ), sizeof( float ) );
-  file.read( reinterpret_cast<char*>( &globalMetrics.unitsPerEM ), sizeof( float ) );
-  file.read( reinterpret_cast<char*>( &globalMetrics.underlinePosition ), sizeof( float ) );
-  file.read( reinterpret_cast<char*>( &globalMetrics.underlineThickness), sizeof( float ) );
-  file.read( reinterpret_cast<char*>( &globalMetrics.maxWidth), sizeof( float ) );
-  file.read( reinterpret_cast<char*>( &globalMetrics.maxHeight), sizeof( float ) );
-  file.read( reinterpret_cast<char*>( &globalMetrics.padAdjustX), sizeof( float ) );
-  file.read( reinterpret_cast<char*>( &globalMetrics.padAdjustY), sizeof( float ) );
-  file.read( reinterpret_cast<char*>( &checkSumRead ), sizeof( std::size_t ) );
-
-  const std::size_t calcCheckSum = CalculateGlobalMetricCheckSum( globalMetrics );
-
-  return (calcCheckSum == checkSumRead);
-}
-
-void WriteGlyphGlobalMetrics( std::ofstream &file, const Integration::GlobalMetrics& globalMetrics )
-{
-  file.write( FILE_VERSION, VERSION_SIZE );
-
-  file.write( reinterpret_cast<const char*>( &globalMetrics.lineHeight ), sizeof( float ) );
-  file.write( reinterpret_cast<const char*>( &globalMetrics.ascender ), sizeof( float ) );
-  file.write( reinterpret_cast<const char*>( &globalMetrics.unitsPerEM ), sizeof( float ) );
-  file.write( reinterpret_cast<const char*>( &globalMetrics.underlinePosition ), sizeof( float ) );
-  file.write( reinterpret_cast<const char*>( &globalMetrics.underlineThickness), sizeof( float ) );
-  file.write( reinterpret_cast<const char*>( &globalMetrics.maxWidth), sizeof( float ) );
-  file.write( reinterpret_cast<const char*>( &globalMetrics.maxHeight), sizeof( float ) );
-  file.write( reinterpret_cast<const char*>( &globalMetrics.padAdjustX ), sizeof( float ) );
-  file.write( reinterpret_cast<const char*>( &globalMetrics.padAdjustY ), sizeof( float ) );
-
-  const std::size_t calcCheckSum = CalculateGlobalMetricCheckSum( globalMetrics );
-
-  file.write( reinterpret_cast<const char*>( &calcCheckSum ), sizeof( std::size_t ) );
-}
-
-} // Anonymous namespace
-
-namespace SlpPlatform
-{
-namespace MetricsCache
-{
-
-bool ReadGlobal( const std::string& fontFamily, const std::string& fontStyle, Integration::GlobalMetrics& globalMetrics)
-{
-  bool success = false;
-
-  std::string fileName = CreateFileName( fontFamily, fontStyle );
-
-  std::ifstream file( fileName.c_str(), std::ios::in | std::ios::binary );
-
-  if( file.good() )
-  {
-    file.seekg( std::ios::beg );
-
-    success = ReadGlyphGlobalMetrics( file, globalMetrics );
-
-    // check the metrics had the correct size.
-    // this is just incase the metrics file is the wrong size, but the checksum magically worked.
-    if( file.eof() )
-    {
-      // file.eof is true only after an invalid read
-      success = false;
-      DALI_LOG_WARNING("Metrics file invalid read\n" );
-    }
-
-    file.close();
-  }
-
-  return success;
-}
-
-void WriteGlobal( const std::string& fontFamily, const std::string& fontStyle, const Integration::GlobalMetrics& globalMetrics)
-{
-  std::string fileName = CreateFileName( fontFamily, fontStyle );
-  std::ios_base::openmode mode = ( std::ios::out | std::ios::binary | std::ios::trunc );
-
-  std::ofstream file( fileName.c_str(), mode );
-
-  if( file.good() )
-  {
-    WriteGlyphGlobalMetrics( file, globalMetrics );
-
-    file.close();
-  }
-}
-
-bool Read( const std::string& fontFamily, const std::string& fontStyle, std::vector<Integration::GlyphMetrics>& glyphMetricsContainer )
-{
-  std::string fileName = CreateFileName( fontFamily, fontStyle );
-  bool success( false );
-
-  // Read from default glyph cache only when there is any metric loaded.
-  std::ifstream file( fileName.c_str(), std::ios::in | std::ios::binary );
-
-  if( file.good() )
-  {
-    // skip over the gobal metrics
-    file.seekg( GLOBAL_METRIC_HEADER_SIZE , std::ios::beg );
-
-    bool checkSumPassed(true);
-
-    // file.good() is set to false if end of file is reached, or an error occurred
-    while( checkSumPassed && file.good() )
-    {
-      Integration::GlyphMetrics glyphMetrics;
-
-      checkSumPassed = ReadGlyphMetrics( file, glyphMetrics );
-
-      // eof only returns true after a failed read
-      if( file.eof() )
-      {
-        // this will occur when we hit the end of the file.
-        checkSumPassed = true;
-        break;
-      }
-
-      if( checkSumPassed )
-      {
-        // fill the map with cached metrics.
-        glyphMetricsContainer.push_back(glyphMetrics);
-      }
-      else
-      {
-        DALI_LOG_WARNING("check sum failed for glyph %d in file \n", glyphMetrics.code, fileName.c_str() );
-      }
-    }
-
-    file.close();
-    success = checkSumPassed;
-  }
-
-  return success;
-}
-
-void Write( const std::string& fontFamily, const std::string& fontStyle, const Integration::GlyphSet& glyphSet )
-{
-  // append the file.
-  std::string fileName = CreateFileName( fontFamily, fontStyle );
-  std::ofstream file( fileName.c_str(), std::ios::out | std::ios::binary | std::ios::app );
-
-  if( file.good() )
-  {
-    const Integration::GlyphSet::CharacterList& characterList = glyphSet.GetCharacterList();
-
-    for( Integration::GlyphSet::CharacterConstIter it = characterList.begin(), endIt = characterList.end(); it != endIt; ++it )
-    {
-      WriteGlyphMetrics( file, it->second );
-    }
-
-    file.close();
-  }
-  else
-  {
-    DALI_LOG_WARNING( "Failed to open metric to file %s", fileName.c_str() );
-  }
-}
-
-
-} // MetricsCache
-} // SlpPlatform
-} // Dali
diff --git a/platform-abstractions/slp/data-cache/metrics-cache.h b/platform-abstractions/slp/data-cache/metrics-cache.h
deleted file mode 100644 (file)
index 01ec2bd..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-#ifndef DALI_SLP_PLATFORM_METRICS_CACHE_H
-#define DALI_SLP_PLATFORM_METRICS_CACHE_H
-
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <dali/integration-api/glyph-set.h>
-#include <string>
-
-namespace Dali
-{
-namespace SlpPlatform
-{
-namespace MetricsCache
-{
-
-/**
- * Read from the metrics file into the global metrics parameter
- * @param[in] fontFamily The name of the font family
- * @param[in] fontStyle The name of the font style
- * @param[out] globalMetrics The data store to write into
- * @return true if the operation succeeded
- */
-bool ReadGlobal( const std::string& fontFamily, const std::string& fontStyle, Integration::GlobalMetrics& globalMetrics);
-
-/**
- * Write the global metrics parameter to the metrics file
- * @param[in] fontFamily The name of the font family
- * @param[in] fontStyle The name of the font style
- * @param[out] globalMetrics The data store to write
- */
-void WriteGlobal( const std::string& fontFamily, const std::string& fontStyle, const Integration::GlobalMetrics& globalMetrics);
-
-/**
- * Read the metrics from the given file into the supplied vector
- * @param[in] fontFamily The name of the font family
- * @param[in] fontStyle The name of the font style
- * @param[out] glyphMetricsContainer The vector of metrics to write
- * @return true if the operation succeeded
- */
-bool Read( const std::string& fontFamily, const std::string& fontStyle, std::vector<Integration::GlyphMetrics>& glyphMetricsContainer );
-
-/**
- * Write the metrics into the given file
- * @param[in] fontFamily The name of the font family
- * @param[in] fontStyle The name of the font style
- * @param[in] glyphSet The set of metrics to write
- */
-void Write( const std::string& fontFamily, const std::string& fontStyle, const Integration::GlyphSet& glyphSet );
-
-} // MetricsCache
-} // SlpPlatform
-} // Dali
-
-#endif //DALI_INTEGRATION_METRICS_CACHE_H
index 2dab551..d303df1 100755 (executable)
@@ -4,27 +4,22 @@ slp_platform_abstraction_src_files = \
   $(slp_platform_abstraction_src_dir)/slp-platform-abstraction.cpp \
   $(slp_platform_abstraction_src_dir)/slp-logging.cpp \
   $(slp_platform_abstraction_src_dir)/slp-font-configuration-parser.cpp \
-  $(slp_platform_abstraction_src_dir)/font-platform/font-controller-impl.cpp \
   $(slp_platform_abstraction_src_dir)/data-cache/data-cache-io.cpp \
   $(slp_platform_abstraction_src_dir)/data-cache/data-cache-impl.cpp \
   $(slp_platform_abstraction_src_dir)/data-cache/tests/data-cache-debug.cpp \
   $(slp_platform_abstraction_src_dir)/data-cache/data-compression.cpp \
-  $(slp_platform_abstraction_src_dir)/data-cache/metrics-cache.cpp \
   $(slp_platform_abstraction_src_dir)/dynamics/dynamics-factory.cpp \
   \
-  $(slp_platform_abstraction_src_dir)/resource-loader/loader-font.cpp \
   $(slp_platform_abstraction_src_dir)/resource-loader/resource-loader.cpp \
   $(slp_platform_abstraction_src_dir)/resource-loader/resource-requester-base.cpp \
   $(slp_platform_abstraction_src_dir)/resource-loader/resource-bitmap-requester.cpp \
   $(slp_platform_abstraction_src_dir)/resource-loader/resource-model-requester.cpp \
   $(slp_platform_abstraction_src_dir)/resource-loader/resource-shader-requester.cpp \
-  $(slp_platform_abstraction_src_dir)/resource-loader/resource-text-requester.cpp \
   \
   $(slp_platform_abstraction_src_dir)/resource-loader/resource-thread-base.cpp \
   $(slp_platform_abstraction_src_dir)/resource-loader/resource-thread-image.cpp \
   $(slp_platform_abstraction_src_dir)/resource-loader/resource-thread-model.cpp \
   $(slp_platform_abstraction_src_dir)/resource-loader/resource-thread-shader.cpp \
-  $(slp_platform_abstraction_src_dir)/resource-loader/resource-thread-text.cpp \
   \
   $(slp_platform_abstraction_src_dir)/resource-loader/binary-model-builder.cpp \
   \
diff --git a/platform-abstractions/slp/font-platform/font-controller-impl.cpp b/platform-abstractions/slp/font-platform/font-controller-impl.cpp
deleted file mode 100755 (executable)
index eacb39a..0000000
+++ /dev/null
@@ -1,791 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include "font-controller-impl.h"
-
-// INTERNAL HEADERS
-#include <dali/public-api/common/dali-common.h>
-#include <dali/integration-api/debug.h>
-
-// EXTERNAL HEADERS
-#include <fontconfig/fontconfig.h>
-
-
-namespace Dali
-{
-
-namespace SlpPlatform
-{
-
-#if defined(DEBUG_ENABLED)
-namespace
-{
-Dali::Integration::Log::Filter* gLogFilter = Dali::Integration::Log::Filter::New(Debug::Concise, false, "LOG_FONT_CONTROLLER");
-} // unnamed namespace
-#endif
-
-namespace
-{
-const std::string SETTING_FONT_PRELOAD_FONT_PATH( FONT_PRELOADED_PATH );
-const std::string SETTING_FONT_DOWNLOADED_FONT_PATH( FONT_DOWNLOADED_PATH );
-const std::string SETTING_FONT_APP_FONT_PATH( FONT_APPLICATION_PATH );
-
-const uint32_t UNICODE_CR_LF = 0x85;
-const uint32_t UNICODE_CHAR_START = 0x20;       // start range of unicode characters (below are control chars)
-const std::string FONT_FORMAT( "TrueType" );
-const std::string DEFAULT_FONT_FAMILY_NAME( "Tizen" );
-const std::string DEFAULT_FONT_STYLE( "Regular" );
-
-const std::string NULL_FONT_FAMILY_NAME( "" );
-const FontController::StyledFontFamily NULL_STYLED_FONT_FAMILY( std::make_pair( NULL_FONT_FAMILY_NAME, std::string( "" ) ) );
-
-/**
- * @param[in] pattern pointer to a font config pattern
- * @param[out] familyName font family name or an empty string if the font is not found.
- * @return Whether a font is found.
- */
-bool GetFontFamily( const FcPattern* pattern, std::string& familyName )
-{
-  FcChar8* family = NULL;
-  const FcResult retVal = FcPatternGetString( pattern, FC_FAMILY, 0u, &family );
-
-  if( FcResultMatch != retVal )
-  {
-    familyName.clear();
-    return false;
-  }
-
-  // Have to use reinterpret_cast because FcChar8 is unsigned char*, not a const char*.
-  familyName.assign( reinterpret_cast<const char*>( family ) );
-
-  return true;
-}
-
-/**
- * @param[in] pattern pointer to a font config pattern
- * @param[out] fontStyle font style name or an empty string if the font has no style.
- * @return Whether a font style is found.
- */
-bool GetFontStyle( const FcPattern* pattern, std::string& fontStyle )
-{
-  FcChar8* style = NULL;
-  const FcResult retVal = FcPatternGetString( pattern, FC_STYLE, 0u, &style );
-
-  if( FcResultMatch != retVal)
-  {
-    // Has no style.
-    fontStyle.clear();
-    return false;
-  }
-
-  // Have to use reinterpret_cast because FcChar8 is unsigned char*, not a const char*.
-  fontStyle.assign( reinterpret_cast<const char*>( style ) );
-
-  return true;
-}
-
-/**
- * @param[in] pattern pointer to a font config pattern
- * @param[out] fileName font file name or an empty string if the font is not found.
- * @return Whether a font is found.
- */
-bool GetFileName( const FcPattern* pattern, std::string& fileName )
-{
-  FcChar8* file = NULL;
-  const FcResult retVal = FcPatternGetString( pattern, FC_FILE, 0u, &file );
-
-  if( FcResultMatch != retVal )
-  {
-    // Has no file name.
-    fileName.clear();
-    return false;
-  }
-
-  // Have to use reinterpret_cast because FcChar8 is unsigned char*, not a const char*.
-  fileName.assign( reinterpret_cast<const char*>( file ) );
-
-  return true;
-}
-
-bool CheckFontInstallPath( FontController::FontListMode listMode, const std::string& fileName )
-{
-  switch( listMode )
-  {
-    case FontController::LIST_SYSTEM_FONTS:
-    {
-      const std::string& preloadPath( SETTING_FONT_PRELOAD_FONT_PATH );
-      const std::string& downloadPath( SETTING_FONT_DOWNLOADED_FONT_PATH );
-      const std::size_t preloadLength = preloadPath.length();
-      const std::size_t downloadLength = downloadPath.length();
-
-      if( ( 0u == preloadPath.compare( 0u, preloadLength, fileName, 0u, preloadLength ) ) ||
-          ( 0u == downloadPath.compare( 0u, downloadLength, fileName, 0u, downloadLength ) ) )
-      {
-        return true;
-      }
-      return false;
-    }
-    case FontController::LIST_APPLICATION_FONTS:
-    {
-      const std::string& appPath( SETTING_FONT_APP_FONT_PATH );
-      const std::size_t appLength = appPath.length();
-
-      if( 0u == appPath.compare( 0u, appLength, fileName, 0u, appLength ) )
-      {
-        return true;
-      }
-      return false;
-    }
-    default:
-    {
-      DALI_ASSERT_DEBUG( false && "unhandled FontListMode" );
-      return false;
-    }
-  }
-}
-
-} // unnamed namespace
-
-FontController::FontController()
-{
-  FcInit();
-  FcConfigEnableHome(true);
-}
-
-FontController::~FontController()
-{
-  // clear the font family cache
-  ClearFontFamilyCache();
-
-  // Clear the preferred font list.
-  ClearPreferredFontList();
-}
-
-const std::string& FontController::GetFontPath( const StyledFontFamily& styledFontFamily )
-{
-  DALI_ASSERT_DEBUG( !styledFontFamily.first.empty() && !styledFontFamily.second.empty() && "FontController::GetFontPath(): The font name or the font style is empty. Probably they have not been validated." );
-
-  // lock the mFontFamilyCacheMutex and don't release it until the function finishes.
-  // If we release it then another thread may try to create the same duplicate data.
-  boost::mutex::scoped_lock lock( mFontFamilyCacheMutex );
-
-  StyledFontFamily closestStyledFontFamilyMatch;
-
-  // first check to see if the font has been matched before.
-  closestStyledFontFamilyMatch = GetMatchedFont( styledFontFamily );
-
-  if( closestStyledFontFamilyMatch.first.empty() )
-  {
-    // The font is not in the matches font cache. Use the given one.
-    closestStyledFontFamilyMatch = styledFontFamily;
-  }
-
-  return GetCachedFontPath( closestStyledFontFamilyMatch );
-}
-
-void FontController::GetFontList( FontListMode fontListMode, FontList& fontList )
-{
-  // protect the mFontList from access by multiple threads
-  // this is locked for the entire function, because we don't want two functions
-  // trying to fill the cache with duplicate data.
-  boost::mutex::scoped_lock sharedDatalock( mFontListMutex );
-
-  // if we have already scanned for fonts, return the cached values
-  if ( !mFontSystemList.empty() )
-  {
-    GetCachedFontList( fontListMode, fontList );
-
-    return;
-  }
-
-  // font list needs to be cached
-
-  // font config isn't thread safe
-  boost::mutex::scoped_lock lock( mFontConfigMutex );
-
-  // use font config to get the font set which contains a list of fonts
-  FcFontSet* fontSet = GetFontSet();
-
-  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "number of fonts found: %d\n", fontSet->nfont );
-
-  if( fontSet )
-  {
-    std::string preload_path(SETTING_FONT_PRELOAD_FONT_PATH);
-    std::string download_path(SETTING_FONT_DOWNLOADED_FONT_PATH);
-    std::string application_path(SETTING_FONT_APP_FONT_PATH);
-
-    for( int i = 0u; i < fontSet->nfont; ++i )
-    {
-      FcPattern* fontPattern = fontSet->fonts[i];
-      std::string fileName;
-
-      if( !GetFileName( fontPattern, fileName ) )
-      {
-        continue;  // Has no file name. Jump to the next iteration.
-      }
-
-      // this is checking to make sure the font is in either the normal font path, or download path
-      if( 0u == preload_path.compare( 0u, preload_path.length(), fileName, 0u, preload_path.length() ) ||
-          0u == download_path.compare( 0u, download_path.length(), fileName, 0u, download_path.length() ) ||
-          0u == application_path.compare( 0u, application_path.length(), fileName, 0u, application_path.length() ) )
-      {
-        StyledFontFamily styledFontFamily;
-
-        if( !GetFontFamily( fontPattern, styledFontFamily.first ) )
-        {
-          continue;  // Has no font name. Jump to the next iteration.
-        }
-
-        GetFontStyle( fontPattern, styledFontFamily.second );
-
-        // Add the font to the either the system or application font list
-        AddToFontList( fileName, styledFontFamily );
-      }
-    }
-     // delete the font set
-    FcFontSetDestroy( fontSet );
-  }
-  else
-  {
-     DALI_ASSERT_ALWAYS( false && "No valid fonts found on system." );
-  }
-
-  // return the font list for the specified mode
-  GetCachedFontList( fontListMode, fontList );
-}
-
-bool FontController::ValidateFontFamilyName( const StyledFontFamily& styledFontFamily,
-                                             bool& isDefaultSystemFontFamily,
-                                             bool& isDefaultSystemFontStyle,
-                                             StyledFontFamily& closestStyledFontFamilyMatch )
-{
-  // Initialize the defaults to false as the validation process supposes the given font is correct.
-  isDefaultSystemFontFamily = false;
-  isDefaultSystemFontStyle = false;
-
-  // default the closest Match to empty
-  closestStyledFontFamilyMatch.first.clear();
-  closestStyledFontFamilyMatch.second.clear();
-
-  // lock the mFontFamilyCacheMutex and don't release it until the function finishes.
-  // If we release it then another thread may try to create the same duplicate data.
-  boost::mutex::scoped_lock lock( mFontFamilyCacheMutex );
-
-  StyledFontFamily styledFontFamilyToCheck = styledFontFamily;
-
-  // if the font is blank, then use the default font if it has been cached
-  if( styledFontFamilyToCheck.first.empty() && ( !mDefaultStyledFont.first.empty() ) )
-  {
-    styledFontFamilyToCheck.first = mDefaultStyledFont.first;
-
-    // No font family is given, default system font is used.
-    isDefaultSystemFontFamily = true;
-  }
-
-  if( styledFontFamilyToCheck.second.empty() &&  ( !mDefaultStyledFont.second.empty() ) )
-  {
-    styledFontFamilyToCheck.second = mDefaultStyledFont.second;
-
-    // No font style is given, default system font is used.
-    isDefaultSystemFontStyle = true;
-  }
-
-  // first check to see if the font has been matched before.
-  closestStyledFontFamilyMatch = GetMatchedFont( styledFontFamilyToCheck );
-
-  if( !closestStyledFontFamilyMatch.first.empty() )
-  {
-    // The font has been cached before.
-    return true;
-  }
-
-  // check the cache
-  const std::string& fontFileName = GetCachedFontPath( styledFontFamilyToCheck );
-
-  if( !fontFileName.empty() )
-  {
-    // The font has been cached before.
-
-    closestStyledFontFamilyMatch = styledFontFamilyToCheck;
-
-    return true;
-  }
-
-  DALI_LOG_INFO( gLogFilter, Debug::Verbose,"Failed to find %s %s in cache, querying FontConfig for a match\n", styledFontFamily.first.c_str(), styledFontFamily.second.c_str() );
-
-  // it's not in the cache, find a match using font config and add it to the cache
-  boost::mutex::scoped_lock fcLock( mFontConfigMutex );
-
-  // create the pattern
-  FcPattern* fontFamilyPattern = CreateFontFamilyPattern( styledFontFamilyToCheck );
-
-  FcResult result(FcResultMatch);
-
-  // match the pattern
-  FcPattern* match = FcFontMatch( NULL /* use default configure */, fontFamilyPattern, &result );
-
-  bool validFont = false;
-
-  if( match )
-  {
-    validFont = true;
-
-    CacheFontInfo( match, styledFontFamilyToCheck, closestStyledFontFamilyMatch );
-
-    // destroyed the matched pattern
-    FcPatternDestroy( match );
-  }
-  else
-  {
-    DALI_LOG_ERROR( "FcFontMatch failed for font %s %s\n", styledFontFamilyToCheck.first.c_str(), styledFontFamilyToCheck.second.c_str() );
-  }
-
-  // destroy the pattern
-  FcPatternDestroy( fontFamilyPattern );
-
-  return validFont;
-}
-
-const FontController::StyledFontFamily& FontController::GetFontFamilyForChars( const Integration::TextArray& charsRequested )
-{
-  if( 0u == mPreferredFonts.Count() )
-  {
-    StyledFontFamily tizenFont( DEFAULT_FONT_FAMILY_NAME, DEFAULT_FONT_STYLE );
-    CreatePreferedFontList( tizenFont );
-  }
-
-  // Cycle through the preferred list of fonts on the system for 'Tizen'.
-  for( std::size_t n = 0u; n < mPreferredFonts.Count(); ++n )
-  {
-    const StyledFontFamily& font = *mPreferredFonts[n];
-
-    if( !mPreferredFontsValidated[n] )
-    {
-      // First make sure it is validated and cached so we can access it's character set object
-      bool isDefaultSystemFontFamily = false;
-      bool isDefaultSystemFontStyle = false;
-      StyledFontFamily closestStyledFontFamilyMatch;
-      ValidateFontFamilyName( font,
-                              isDefaultSystemFontFamily,
-                              isDefaultSystemFontStyle,
-                              closestStyledFontFamilyMatch );
-
-      mPreferredFontsValidated[n] = true;
-    }
-
-    const std::string& filePath = GetFontPath( font );
-
-    if( filePath.empty() )
-    {
-      continue;
-    }
-
-    const bool matched = FontFamilySupportsText( font, charsRequested );
-    if( matched )
-    {
-      return font;
-    }
-  }
-
-  // return empty string
-  return NULL_STYLED_FONT_FAMILY;
-}
-
-void FontController::CacheFontInfo( FcPattern* pattern, const StyledFontFamily& inputStyledFontFamily, StyledFontFamily& closestStyledFontFamilyMatch )
-{
-  // Check we can get the following data from the pattern
-
-  if( !GetFontFamily( pattern, closestStyledFontFamilyMatch.first ) )
-  {
-    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "CacheFontInfo failed to get family information from pattern %s %s\n", inputStyledFontFamily.first.c_str(), inputStyledFontFamily.second.c_str() );
-    return;
-  }
-
-  std::string fileName;
-  if( !GetFileName( pattern, fileName ) )
-  {
-    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "CacheFontInfo failed to get file information from pattern %s %s\n", inputStyledFontFamily.first.c_str(), inputStyledFontFamily.second.c_str() );
-    return;
-  }
-
-  FcCharSet* matchedCharSet = NULL;
-  const FcResult retVal = FcPatternGetCharSet( pattern, FC_CHARSET, 0u, &matchedCharSet );
-  if( retVal != FcResultMatch )
-  {
-    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "CacheFontInfo failed to get character set from pattern %s %s\n", inputStyledFontFamily.first.c_str(), inputStyledFontFamily.second.c_str() );
-    return;
-  }
-
-  GetFontStyle( pattern, closestStyledFontFamilyMatch.second );
-
-  // Add the match to the font cache
-  AddCachedFont( closestStyledFontFamilyMatch, fileName, matchedCharSet );
-
-  if( ( !inputStyledFontFamily.first.empty() &&
-        ( inputStyledFontFamily.first != closestStyledFontFamilyMatch.first ) ) &&
-      ( !inputStyledFontFamily.second.empty() &&
-        ( inputStyledFontFamily.second != closestStyledFontFamilyMatch.second ) ) )
-  {
-    // if the font family used to create the pattern was not found in the match then
-    // store it in the MissingFont container
-    AddMatchedFont( inputStyledFontFamily, closestStyledFontFamilyMatch );
-  }
-}
-
-bool FontController::AllGlyphsSupported( const StyledFontFamily& styledFontFamily, const Integration::TextArray& text )
-{
-  // The font has already been validated by the font implementation.
-
-  return FontFamilySupportsText( styledFontFamily, text );
-}
-
-void FontController::SetDefaultFontFamily( const StyledFontFamily& styledFontFamily )
-{
-  CreatePreferedFontList(styledFontFamily);
-}
-
-void FontController::AddCachedFont( const StyledFontFamily& styledFontFamily, const std::string& fontPath, _FcCharSet *characterSet )
-{
-  FontFamilyLookup::const_iterator iter = mFontFamilyCache.find( styledFontFamily );
-  if( iter == mFontFamilyCache.end() )
-  {
-    // store the path and chacter set
-    FontCacheItem item;
-    item.FontFileName = fontPath;
-    item.FcCharSet = FcCharSetCopy( characterSet );  // increase the ref count on the char set
-    mFontFamilyCache[ styledFontFamily ] = item;
-
-    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Caching font %s %s\n", styledFontFamily.first.c_str(), styledFontFamily.second.c_str() );
-  }
-}
-
-void FontController::GetCachedFontList( FontListMode fontListMode, FontList& fontList ) const
-{
-  // return a list of fonts, for the FontListMode
-  switch( fontListMode )
-  {
-    case LIST_SYSTEM_FONTS:
-    {
-      fontList.insert( fontList.end(), mFontSystemList.begin(), mFontSystemList.end() );
-      return;
-    }
-    case LIST_APPLICATION_FONTS:
-    {
-      fontList.insert( fontList.end(), mFontApplicationList.begin(), mFontApplicationList.end() );
-      return;
-    }
-    case LIST_ALL_FONTS:
-    {
-      // add both system and application fonts together
-      fontList.insert( fontList.end(), mFontSystemList.begin(), mFontSystemList.end() );
-      fontList.insert( fontList.end(), mFontApplicationList.begin(), mFontApplicationList.end() );
-      return;
-    }
-  }
-  DALI_ASSERT_ALWAYS( false && "GetCachedFontList called with invalid value." );
-}
-
-const std::string& FontController::GetCachedFontPath( const StyledFontFamily& styledFontFamily ) const
-{
-  if( !mFontFamilyCache.empty() )
-  {
-    FontFamilyLookup::const_iterator iter = mFontFamilyCache.find( styledFontFamily );
-    if( iter != mFontFamilyCache.end() )
-    {
-      return (*iter).second.FontFileName;
-    }
-  }
-
-  return NULL_FONT_FAMILY_NAME;
-}
-
-FcCharSet* FontController::GetCachedFontCharacterSet( const StyledFontFamily& styledFontFamily ) const
-{
-  if( !mFontFamilyCache.empty() )
-  {
-    FontFamilyLookup::const_iterator iter = mFontFamilyCache.find( styledFontFamily );
-    if( iter != mFontFamilyCache.end() )
-    {
-      return (*iter).second.FcCharSet;
-    }
-  }
-  return NULL;
-}
-
-_FcPattern* FontController::CreateFontFamilyPattern( const StyledFontFamily& styledFontFamily )
-{
-  // create the cached font family lookup pattern
-  // a pattern holds a set of names, each name refers to a property of the font
-  FcPattern* fontFamilyPattern = FcPatternCreate();
-
-  // add a property to the pattern for the font family
-  FcPatternAddString( fontFamilyPattern, FC_FAMILY, reinterpret_cast<const FcChar8*>( styledFontFamily.first.c_str() ) );
-
-  // add a property to the pattern for the font family
-  FcPatternAddString( fontFamilyPattern, FC_STYLE, reinterpret_cast<const FcChar8*>( styledFontFamily.second.c_str() ) );
-
-  // Add a property of the pattern, to say we want to match TrueType fonts
-  FcPatternAddString( fontFamilyPattern , FC_FONTFORMAT, reinterpret_cast<const FcChar8*>( FONT_FORMAT.c_str() ) );
-
-  // modify the config, with the mFontFamilyPatterm
-  FcConfigSubstitute( NULL /* use default configure */, fontFamilyPattern, FcMatchPattern );
-
-  // provide default values for unspecified properties in the font pattern
-  // e.g. patterns without a specified style or weight are set to Medium
-  FcDefaultSubstitute( fontFamilyPattern );
-
-  return fontFamilyPattern;
-}
-
-bool FontController::IsAControlCharacter( uint32_t character ) const
-{
-  // UNICODE_CHAR_START is the space character
-  // below it are the control characters that we want to ignore.
-
-  return( ( character < UNICODE_CHAR_START ) ||
-          ( character == UNICODE_CR_LF ) );
-}
-
-bool FontController::FontFamilySupportsText( const StyledFontFamily& styledFontFamily, const Integration::TextArray& text )
-{
-  FcCharSet* charSet = GetCachedFontCharacterSet( styledFontFamily );
-
-  DALI_ASSERT_ALWAYS( charSet && "No cached character set for font family" );
-
-  const size_t textLength = text.Count();
-
-  // quick early exit before accessing font config for text arrays which are just a single control character
-  if( textLength == 1u )
-  {
-    if( IsAControlCharacter( *text.Begin() ) )
-    {
-      return true;
-    }
-  }
-
-  // protect font config
-  boost::mutex::scoped_lock fcLock( mFontConfigMutex );
-
-  for( Integration::TextArray::ConstIterator iter = text.Begin(), endIter = text.End(); iter != endIter; ++iter )
-  {
-    const uint32_t character = (*iter);
-
-    // if it's a control character then don't test it
-    if( IsAControlCharacter( character ) )
-    {
-      continue;
-    }
-
-    // test to see if the character set supports the character
-    if( !FcCharSetHasChar( charSet, character ) )
-    {
-      return false;
-    }
-  }
-  return true;
-}
-
-void FontController::ClearFontFamilyCache()
-{
-  // should be called by the destructor only
-
-  for( FontFamilyLookup::iterator iter = mFontFamilyCache.begin(), enditer = mFontFamilyCache.end(); iter != enditer; ++iter )
-  {
-    FontCacheItem& cacheItem = (*iter).second;
-
-    // this reduces the character sets ref count by 1.
-    FcCharSetDestroy( cacheItem.FcCharSet );
-  }
-
-  mFontFamilyCache.clear();
-}
-
-void FontController::AddToFontList( const std::string& fileName, const StyledFontFamily& styledFontFamily )
-{
-  const bool systemFont = CheckFontInstallPath( LIST_SYSTEM_FONTS, fileName );
-
-  FontList* fontList(NULL);
-
-  if( systemFont )
-  {
-    fontList = &mFontSystemList;
-  }
-  else
-  {
-    fontList = &mFontApplicationList;
-  }
-
-  // check the font family doesn't already exist in the vector, then add it
-  if( fontList->end() == std::find( fontList->begin(), fontList->end(), styledFontFamily ) )
-  {
-    fontList->push_back( styledFontFamily );
-  }
-}
-
-_FcFontSet* FontController::GetFontSet() const
-{
-  // create a new pattern.
-  // a pattern holds a set of names, each name refers to a property of the font
-  FcPattern* pattern = FcPatternCreate();
-
-  // create an object set used to define which properties are to be returned in the patterns from FcFontList.
-  FcObjectSet* objectSet = FcObjectSetCreate();
-
-  // build an object set from a list of property names
-  FcObjectSetAdd( objectSet, FC_FAMILY );
-  FcObjectSetAdd( objectSet, FC_STYLE );
-  FcObjectSetAdd( objectSet, FC_FILE );
-
-  // get a list of fonts
-  // creates patterns from those fonts containing only the objects in objectSet and returns the set of unique such patterns
-  FcFontSet* fontset = FcFontList( NULL /* the default configuration is checked to be up to date, and used */, pattern, objectSet );
-
-  // clear up the object set
-  if( objectSet )
-  {
-    FcObjectSetDestroy( objectSet );
-  }
-  // clear up the pattern
-  if( pattern )
-  {
-    FcPatternDestroy( pattern );
-  }
-
-  return fontset;
-}
-
-_FcCharSet* FontController::CreateCharacterSet( const Integration::TextArray& charsRequested )
-{
-  // create the character set object
-  FcCharSet* charSet = FcCharSetCreate();
-
-  bool validCharAdded(false);
-
-  // add valid characters to the character set.
-  for( Integration::TextArray::ConstIterator iter = charsRequested.Begin(), endIter = charsRequested.End(); iter != endIter; ++iter )
-  {
-    const uint32_t character = (*iter);
-
-    // if it's not a control character then add it
-    if( !IsAControlCharacter( character ) )
-    {
-      FcBool ok = FcCharSetAddChar( charSet, character );
-      if( ok )
-      {
-        validCharAdded = true;
-      }
-    }
-  }
-  // if no characters have been added to the character set, then return null
-  if( !validCharAdded )
-  {
-    FcCharSetDestroy(charSet);
-    return NULL;
-  }
-  return charSet;
-}
-
-void FontController::AddMatchedFont( const StyledFontFamily& missingStyledFontFamily, StyledFontFamily& closestStyledFontFamilyMatch )
-{
-  // we store the missing font, and the name of the font that font config found as the closet match
-  mMatchedFontsFound[ missingStyledFontFamily ] = closestStyledFontFamilyMatch;
-}
-
-const FontController::StyledFontFamily& FontController::GetMatchedFont( const StyledFontFamily& styledFontFamily ) const
-{
-  if( mMatchedFontsFound.empty() )
-  {
-    return NULL_STYLED_FONT_FAMILY;
-  }
-
-  MatchedFontLookup::const_iterator iter = mMatchedFontsFound.find( styledFontFamily );
-  if( iter != mMatchedFontsFound.end() )
-  {
-    return iter->second;
-  }
-
-  return NULL_STYLED_FONT_FAMILY;
-}
-
-void FontController::CreatePreferedFontList( const StyledFontFamily& styledFontFamily )
-{
-  // clear the current list
-  ClearPreferredFontList();
-
-  FcPattern* searchPattern = CreateFontFamilyPattern( styledFontFamily );
-
-  FcResult result(FcResultMatch);
-
-  // Match the pattern.
-  StyledFontFamily previousFont;
-
-  FcFontSet* fontSet = FcFontSort( NULL /* use default configure */, searchPattern, false /* don't trim */, NULL, &result );
-
-  for( int i = 0u; i < fontSet->nfont; ++i )
-  {
-      // we have already filled in the first entry with the default font
-    FcPattern* pattern = fontSet->fonts[i];
-
-    StyledFontFamily* styledFont = new StyledFontFamily();
-
-    GetFontFamily( pattern, styledFont->first );
-    GetFontStyle( pattern, styledFont->second );
-
-    bool releaseMemory = true;
-    if( *styledFont != previousFont )
-    {
-      mPreferredFonts.PushBack( styledFont );
-      releaseMemory = false;
-    }
-    if( i == 0u )
-    {
-      mDefaultStyledFont = *styledFont;
-    }
-    previousFont = *styledFont;
-
-    if( releaseMemory )
-    {
-       delete styledFont;
-    }
-  }
-
-  // Set all fonts to non validated.
-  mPreferredFontsValidated.Resize( fontSet->nfont, false );
-
-  FcPatternDestroy( searchPattern );
-  FcFontSetDestroy( fontSet );
-}
-
-void FontController::ClearPreferredFontList()
-{
-  for( Vector<StyledFontFamily*>::Iterator it = mPreferredFonts.Begin(), endIt = mPreferredFonts.End(); it != endIt; ++it )
-  {
-    delete *it;
-  }
-  mPreferredFonts.Clear();
-}
-
-} // namespace SlpPlatform
-
-} // namespace Dali
-
-// Implementation of Dali::Platform::FontController::New()
-Dali::Platform::FontController* Dali::Platform::FontController::New()
-{
-  return new Dali::SlpPlatform::FontController();
-}
diff --git a/platform-abstractions/slp/font-platform/font-controller-impl.h b/platform-abstractions/slp/font-platform/font-controller-impl.h
deleted file mode 100644 (file)
index fd09a20..0000000
+++ /dev/null
@@ -1,255 +0,0 @@
-#ifndef __DALI_SLP_PLATFORM_FONT_CONTROLLER_H__
-#define __DALI_SLP_PLATFORM_FONT_CONTROLLER_H__
-
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include "../../interfaces/font-controller.h"
-#include <dali/public-api/common/dali-vector.h>
-#include <dali/public-api/common/map-wrapper.h>
-
-// EXTERNAL INCLUDES
-#include <boost/thread.hpp>
-
-
-// forward declarations of font config types
-struct _FcConfig;
-struct _FcPattern;
-struct _FcCharSet;
-struct _FcFontSet;
-
-namespace Dali
-{
-
-namespace SlpPlatform
-{
-
-typedef Dali::Platform::FontController::FontList FontList;
-
-/**
- * concrete interface for the SLP font controller.
- *
- * Font controller currently caches the following:
- * - List of fonts on the system, if the user calls GetFontList()
- * - List of fonts used by the application with both its filename and character set
- *
- * When searching for a font that can display a string of text, the follow occurs:
- *
- * - 1. Check the last used font to see if it supports the text
- * - 2. If 1 fails, check all other Fonts in the cache to see if they support the text
- * - 3. If 2 fails, use FontConfig to find a font which supports the text, then cache that font.
- *
- * Suggested future improvements:
- * Stop using FontConfig library, instead use FreeType directly to query and cache font family names and
- * character sets. Then parse the font config configuration file directly to get the system preferred fonts etc.
- */
-class FontController : public Platform::FontController
-{
-public:
-
-  /**
-   * Constructor
-   */
-  FontController();
-
- /**
-   * Destructor
-   */
-  virtual ~FontController();
-
-  /**
-   * Internally caches the font file name for every font family passed in
-   * @copydoc Dali::Platform::FontController::GetFontPath()
-   */
-  virtual const std::string& GetFontPath( const StyledFontFamily& styledFontFamily );
-
-  /**
-   * Internally caches the font list the first time it is called.
-   * @copydoc Dali::Platform::FontController::GetFontList()
-   */
-  virtual void GetFontList( FontListMode fontListMode, FontList& fontList );
-
-  /**
-   * @copydoc Dali::Platform::FontController::ValidateFontFamilyName()
-   */
-  virtual bool ValidateFontFamilyName( const StyledFontFamily& styledFontFamily,
-                                       bool& isDefaultSystemFontFamily,
-                                       bool& isDefaultSystemFontStyle,
-                                       StyledFontFamily& closestStyledFontFamilyMatch );
-
-  /**
-   * @copydoc Dali::Platform::FontController::GetFontFamilyForChars()
-   */
-  virtual const StyledFontFamily& GetFontFamilyForChars( const Integration::TextArray& charsRequested);
-
-  /**
-   * @copydoc Dali::Platform::FontController::AllGlyphsSupported()
-   */
-  virtual bool AllGlyphsSupported( const StyledFontFamily& styledFontFamily, const Integration::TextArray& text );
-
-  /**
-   * @copydoc Dali::Platform::FontController::SetDefaultFontFamily()
-   */
-  virtual void SetDefaultFontFamily( const StyledFontFamily& styledFontFamily );
-
-private:
-
-  /**
-   * Gets a cached font list
-   * @param[in] fontListMode the font list mode
-   * @return font list
-   */
-  void GetCachedFontList( FontListMode fontListMode, FontList& fontList ) const;
-
-  /**
-   * returns the font path given a font family.
-   * @param[in] styledFontFamily The name of the font's family and the font's style.
-   * @return The font's file name path.
-   */
-  const std::string& GetCachedFontPath( const StyledFontFamily& styledFontFamily ) const;
-
-  /**
-   * returns the cached character set for a font family.
-   * @param[in] styledFontFamily The name of the font's family and the font's style.
-   * @return pointer to font configs character set object.
-   *
-   */
-  _FcCharSet* GetCachedFontCharacterSet( const StyledFontFamily& styledFontFamily ) const;
-
-  /**
-   * Add a font path to the font path cache.
-   * @param[in] styledFontFamily The name of the font's family and the font's style.
-   * @param[in] fontPath font path.
-   * @param[in] characterSet font config character set object (not const because it's ref count is increased).
-   */
-  void AddCachedFont( const StyledFontFamily& styledFontFamily, const std::string& fontPath, _FcCharSet *characterSet );
-
-  /**
-   * Store information held in a fontconfig pattern, into the font cache.
-   * Stores font name, filename and character set.
-   * @param[in] pattern pointer to a font config pattern.
-   * @param[in] inputStyledFontFamily font family name with its style used to perform the pattern match.
-   * @param[out] closestStyledFontFamilyMatch matched family name and style.
-   */
-  void CacheFontInfo( _FcPattern* pattern, const StyledFontFamily& inputStyledFontFamily, StyledFontFamily& closestStyledFontFamilyMatch );
-
-  /**
-   * Create a pattern for font lookups.
-   * @param[in] styledFontFamily The name of the font's family and the font's style.
-   */
-  _FcPattern* CreateFontFamilyPattern( const StyledFontFamily& styledFontFamily );
-
-  /**
-   * Checks whether a character is a control character.
-   */
-  bool IsAControlCharacter( uint32_t character ) const;
-
-  /**
-   * Checks cached fonts to see if they support the text.
-   * @param styledFontFamily The name of the font's family and the font's style.
-   * @param text text array.
-   * @return true if the font family supports the text false if not.
-   */
-  bool FontFamilySupportsText( const StyledFontFamily& styledFontFamily, const Integration::TextArray& text );
-
-  /**
-   * Clear the font family cache.
-   * Should only be called by the destructor.
-   */
-  void ClearFontFamilyCache();
-
-  /**
-   * Adds a font to the cached font list.
-   * Checks for duplicates.
-   * @param fileName the font full filename with path
-   * @param styledFontFamily The name of the font's family and the font's style.
-   */
-  void AddToFontList( const std::string& fileName, const StyledFontFamily& styledFontFamily );
-
-  /**
-   * Returns a FontConfig font set, which has a list of fonts.
-   * @return pointer to _FcFontSet struct.
-   */
-  _FcFontSet* GetFontSet() const;
-
-  /**
-   * Create a font config character set object, using the text string.
-   * @param charsRequested array of characters.
-   * @return a pointer to _FcCharSet object on success, NULL on failure.
-   */
-  _FcCharSet* CreateCharacterSet( const Integration::TextArray& charsRequested );
-
-  /**
-   * Add a font that has not been found on the system but a match has been found.
-   * @param[in] missingStyledFontFamily the missing font and its style to add.
-   * @param[in] closestStyledFontFamilyMatch it's nearest font and its style match.
-   */
-  void AddMatchedFont( const StyledFontFamily& missingStyledFontFamily, StyledFontFamily& closestStyledFontFamilyMatch );
-
-  /**
-   * Check the cache to see if a font and its style has been added to the missing fonts list.
-   * @param styledFontFamily the font and its style to check.
-   * @return the closest styled font that the missing styled font has been matched with by font-config.
-   */
-   const StyledFontFamily& GetMatchedFont( const StyledFontFamily& styledFontFamily ) const;
-
-   /**
-    * Create a preferred list of fonts to use for when GetFontFamilyForChars() is called.
-    * @param[in] styledFontFamily The name of the font's family and the font's style.
-    */
-  void CreatePreferedFontList( const StyledFontFamily& styleFontFamily );
-
-  /**
-   * Deletes all preferred fonts.
-   */
-  void ClearPreferredFontList();
-
-  /**
-   * Font cache item.
-   */
-  struct FontCacheItem
-  {
-    std::string FontFileName;     ///< font file name
-    _FcCharSet* FcCharSet;        ///< font config character set, used to test if a character is supported
-  };
-
-  typedef std::map<StyledFontFamily, FontCacheItem> FontFamilyLookup;     ///<  lookup for font names and font cache itmes
-
-  typedef std::map<StyledFontFamily, StyledFontFamily> MatchedFontLookup; ///< lookup for fonts that don't exist, and their nearest match return by FontConfig
-
-  boost::mutex      mFontConfigMutex;       ///< FontConfig needs serializing because it isn't thread safe
-  boost::mutex      mFontFamilyCacheMutex;  ///< to protect the FontFamilyCache data
-  boost::mutex      mFontListMutex;         ///< to prevent more than one thread creating the font list data
-
-  StyledFontFamily  mDefaultStyledFont;     ///< default font
-
-  FontList          mFontSystemList;        ///< cached list of system fonts
-  FontList          mFontApplicationList;   ///< cached list of application fonts
-
-  FontFamilyLookup  mFontFamilyCache;       ///< cache of font names and corresponding font cache items
-  MatchedFontLookup mMatchedFontsFound;     ///< lookup for fonts that haven't been found on the sytem, and the nearest matching font.
-  Vector<StyledFontFamily*> mPreferredFonts;          ///< Ordered list of preferred fonts.
-  Vector<bool>              mPreferredFontsValidated; ///< Stores which of the prefered fonts have been validated.
-
-};
-
-} // namespace SlpPlatform
-
-} // namespace Dali
-
-#endif // __DALI_SLP_PLATFORM_FONT_CONTROLLER_H__
index 62dd906..6afd79c 100644 (file)
 
 #if defined(DEBUG_ENABLED)
 
-#include <iostream>
-#include <sstream>
-#include <string>
-#include <dali/integration-api/glyph-set.h>
-
 namespace Dali
 {
 namespace SlpPlatform
@@ -35,39 +30,6 @@ using namespace Dali::Integration;
  */
 Debug::Filter* gLoaderFilter = Debug::Filter::New(Debug::Concise, false, "LOG_RESOURCE_LOADER");
 
-
-std::string DebugRequestList(TextResourceType::CharacterList& chars)
-{
-  std::string textString;
-
-  for(std::size_t i=0, length=chars.size(); i<length; i++)
-  {
-    std::ostringstream oss;
-    const TextResourceType::GlyphPosition& glyph = chars[i];
-    oss << static_cast<char>(glyph.character) << "(" << glyph.xPosition << "," << glyph.yPosition
-        << " " << (glyph.quality?"Hg":"Lw") << " " << (glyph.loaded?"LD":"UN") << ") ";
-    textString.append(oss.str());
-  }
-  return textString;
-}
-
-std::string DebugResourceList(LoadedResource& partialResource)
-{
-  GlyphSetPointer glyphSet = static_cast<GlyphSet*>(partialResource.resource.Get());
-  const GlyphSet::CharacterList& characterList = glyphSet->GetCharacterList();
-  std::string textString;
-
-  for(std::size_t i=0, length=characterList.size(); i<length; i++)
-  {
-    std::ostringstream oss;
-    const GlyphMetrics& gm = characterList[i].second;
-    oss << static_cast<char>(gm.code) << "(" << gm.xPosition << "," << gm.yPosition
-        << " " << (gm.quality?"H":"L") << ") ";
-    textString.append(oss.str());
-  }
-  return textString;
-}
-
 } //SlpPlatform
 } //Dali
 
index 87a54c2..8d7ae61 100644 (file)
@@ -32,9 +32,6 @@ namespace SlpPlatform
 
 extern Debug::Filter* gLoaderFilter;
 
-std::string DebugRequestList(Integration::TextResourceType::CharacterList& chars);
-std::string DebugResourceList(LoadedResource& partialResource);
-
 } // SlpPlatform
 } // Dali
 
diff --git a/platform-abstractions/slp/resource-loader/loader-font.cpp b/platform-abstractions/slp/resource-loader/loader-font.cpp
deleted file mode 100644 (file)
index 3a06871..0000000
+++ /dev/null
@@ -1,363 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <cmath>
-
-#include "loader-font.h"
-#include <dali/public-api/images/distance-field.h>
-
-namespace Dali
-{
-namespace SlpPlatform
-{
-using namespace Dali::Integration;
-
-#if defined(DEBUG_ENABLED)
-namespace
-{
-static Integration::Log::Filter* gLogFilter = Log::Filter::New(Log::General, false, "LOG_LOADER_FONT");
-} // unnamed namespace
-#endif
-
-static SlpFace* LoadFontFile(const std::string &fileName, FT_Library freeType)
-{
-  SlpFace* slpFace = NULL;
-
-  // Open freetype font file
-  FILE* fontFile = fopen(fileName.c_str(), "rb");
-  if(fontFile != NULL)
-  {
-    // determine file size
-    unsigned int fileSize( 0u );
-    if( fseek(fontFile, 0, SEEK_END) )
-    {
-      DALI_LOG_ERROR("Error seeking to end of file\n");
-    }
-    else
-    {
-      long positionIndicator = ftell(fontFile);
-      if( positionIndicator > -1L )
-      {
-        fileSize = static_cast<unsigned int>(positionIndicator);
-      }
-    }
-
-    if( fileSize > 0u )
-    {
-      if( fseek(fontFile, 0, SEEK_SET) )
-      {
-        DALI_LOG_ERROR("Error seeking to start of file\n");
-      }
-
-      // allocate a buffer for the file (throws a memory exception on failure)
-      slpFace = new SlpFace;
-      slpFace->buffer = new FT_Byte[fileSize];
-
-      // read the file
-      unsigned int bytes = fread(slpFace->buffer, 1, fileSize, fontFile);
-      if (bytes != fileSize)
-      {
-        DALI_LOG_WARNING("Number of bytes read (%d) does not match the file's size (%d)\n", bytes, fileSize);
-      }
-
-      // create a freetype face from the memory buffer
-      FT_Error retVal = FT_New_Memory_Face(freeType, slpFace->buffer, fileSize, 0, &slpFace->face);
-      if (retVal != FT_Err_Ok)
-      {
-        DALI_LOG_WARNING("FT_New_Face failed on %s\n", fileName.c_str());
-        delete slpFace;
-        slpFace = NULL;
-      }
-    }
-
-    // finished with file, so close the handle
-    fclose(fontFile);
-  }
-
-  return slpFace;
-}
-
-SlpFace* LoadFontFace(const std::string &fileName,
-                      const PointSize pointSize,
-                      const unsigned int dpiHor, const unsigned int dpiVer,
-                      FT_Library freeType)
-{
-  SlpFace* slpFace = LoadFontFile(fileName, freeType);
-
-  if (NULL != slpFace)
-  {
-    FT_Face face = slpFace->face;
-
-    // set the char size for glyph scaling
-    FT_Error retVal = FT_Set_Char_Size(face, 0, static_cast<unsigned int>(roundf(pointSize.value))<<6, dpiHor, dpiVer);
-    if (retVal != FT_Err_Ok)
-    {
-      DALI_LOG_WARNING("FT_Set_Char_Size failed on %s\n", fileName.c_str());
-      delete slpFace;
-      slpFace = NULL;
-    }
-    else
-    {
-      DALI_LOG_INFO (gLogFilter, Log::Verbose, "Loading font %s Glyphs(%d) Points(%f) DPI(%d %d) Units/EM(%d) PPEM(%d %d) Scale(%f %f)\n",
-                     fileName.c_str(), face->num_glyphs,
-                     roundf(pointSize.value), dpiHor, dpiVer, face->units_per_EM,
-                     face->size->metrics.x_ppem, face->size->metrics.y_ppem,
-                     face->size->metrics.x_scale / 65536.0f,
-                     face->size->metrics.y_scale / 65536.0f);
-    }
-  }
-
-  return slpFace;
-}
-
-
-SlpFace* LoadFontFace(const std::string &fileName,
-                      const PixelSize pixelSize,
-                      FT_Library freeType)
-{
-  SlpFace* slpFace = LoadFontFile(fileName, freeType);
-
-  if (NULL != slpFace)
-  {
-    FT_Face face = slpFace->face;
-
-    // set the pixel size for glyph scaling
-    FT_Error retVal = FT_Set_Pixel_Sizes(face, pixelSize, pixelSize);
-    if (retVal != FT_Err_Ok)
-    {
-      DALI_LOG_WARNING("FT_Set_Pixel_Sizes failed on %s\n", fileName.c_str());
-      delete slpFace;
-      slpFace = NULL;
-    }
-    else
-    {
-      DALI_LOG_INFO (gLogFilter, Log::Verbose, "Loading font %s Glyphs(%d) Pixels(%d) Units/EM(%d) PPEM(%d %d) Scale(%f %f)\n",
-                     fileName.c_str(), face->num_glyphs,
-                     pixelSize.value, face->units_per_EM,
-                     face->size->metrics.x_ppem, face->size->metrics.y_ppem,
-                     face->size->metrics.x_scale / 65536.0f,
-                     face->size->metrics.y_scale / 65536.0f);
-    }
-  }
-
-  return slpFace;
-}
-
-// charcode must be UTF-32 representation
-FT_Glyph GetGlyph(FT_Face face, FT_ULong charcode, FT_Int32 load_flags)
-{
-  if (face == NULL)
-  {
-    DALI_LOG_WARNING("face == NULL\n");
-    return NULL;
-  }
-
-  // FT_Load_Char is always succeeds providing the face is valid. So if the character code is not
-  // found it will just return a default glyph
-  FT_Error retVal = FT_Load_Char(face, charcode , load_flags);
-  if(retVal != FT_Err_Ok)
-  {
-    DALI_LOG_WARNING("FT_Load_Char failed %d\n", retVal);
-    return NULL;
-  }
-
-  // get the glyph
-  FT_Glyph glyph;
-  retVal = FT_Get_Glyph(face->glyph, &glyph);
-  if(retVal != FT_Err_Ok)
-  {
-    DALI_LOG_WARNING("FT_Get_Glyph failed %d\n", retVal);
-    return NULL;
-  }
-
-  return glyph;
-}
-
-// use getBitmap = false to find out glyph x-advance without copying/rendering bitmap
-GlyphSet::Character* GetCharacter(FT_Face face, FT_ULong charcode,
-                                  const unsigned int fieldSize, const unsigned int fieldPadding,
-                                  const Vector2& maxGlyphCell,
-                                  const bool renderBitmap, const bool highQuality)
-{
-  FT_Glyph glyph = GetGlyph(face, charcode, FT_LOAD_DEFAULT|FT_LOAD_NO_AUTOHINT);
-  if(glyph == NULL)
-  {
-    // early out, if glyph is NULL
-    return NULL;
-  }
-
-  // scale factor for unit scaled glyphs
-  const float xScale = 1.0f / (face->size->metrics.x_scale / 65536.0f);
-  const float yScale = 1.0f / (face->size->metrics.y_scale / 65536.0f);
-
-  // create a new glyph-metric for the letter
-  GlyphMetrics glyphMetrics;
-  glyphMetrics.code     = charcode;
-  glyphMetrics.quality  = (highQuality ? 1 : 0);
-  glyphMetrics.xPosition = 0;
-  glyphMetrics.yPosition = 0;
-
-  // Set correct glyph size for underline
-  const uint32_t UNDERLINE_CHARACTER( 0x0332 );
-  if(charcode == UNDERLINE_CHARACTER)
-  {
-    float underlineBitmapWidth(64.f);
-    float underlineBitmapHeight( 8.f );
-    glyphMetrics.left     = 0.f;
-    glyphMetrics.top      = 0.f;
-    glyphMetrics.width    = xScale * underlineBitmapWidth;
-    glyphMetrics.height   = yScale * underlineBitmapHeight;
-    glyphMetrics.xAdvance = glyphMetrics.width;
-  }
-  else
-  {
-    // Regular glyphs
-    glyphMetrics.left     = xScale * face->glyph->metrics.horiBearingX / 64.0f;
-    glyphMetrics.top      = yScale * face->glyph->metrics.horiBearingY / 64.0f;
-    glyphMetrics.width    = xScale * face->glyph->metrics.width / 64.0f;
-    glyphMetrics.height   = yScale * face->glyph->metrics.height / 64.0f;
-    glyphMetrics.xAdvance = xScale * face->glyph->metrics.horiAdvance / 64.0f;
-  }
-
-  // TODO: Look at generating the distance field directly from the glyph vector outline
-  //       instead of FreeType's scaled bitmap
-  BitmapPtr bitmapData = NULL;
-  // bitmap required?
-  if (renderBitmap)
-  {
-    // convert glyph to bitmap
-    if (glyph->format != FT_GLYPH_FORMAT_BITMAP)
-    {
-      FT_Error retVal = FT_Glyph_To_Bitmap(&glyph, FT_RENDER_MODE_NORMAL, 0, 1);
-      if(retVal != FT_Err_Ok)
-      {
-        DALI_LOG_WARNING("FT_Glyph_To_Bitmap failed %d\n", retVal);
-        FT_Done_Glyph(glyph);
-        return NULL;
-      }
-    }
-    // cast the FT_Glyph to a FT_BitmapGlyph
-    FT_BitmapGlyph bitmapGlyph = (FT_BitmapGlyph) glyph;
-
-    // access the underlying bitmap data
-    FT_Bitmap bitmap = bitmapGlyph->bitmap;
-
-    DALI_LOG_INFO(gLogFilter, Log::Verbose, "%s(%c %f %f %f %f %f %f) [%.2f %.2f %.2f %.2f %f %f]\n",
-                  __FUNCTION__, (int)charcode,
-                  glyphMetrics.left, glyphMetrics.top, glyphMetrics.width, glyphMetrics.height,
-                  glyphMetrics.xAdvance, face->height/64.0f,
-                  xScale * bitmapGlyph->left, yScale * bitmapGlyph->top, xScale * bitmap.width, yScale * bitmap.rows,
-                  glyph->advance.x / 65536.0f * xScale, face->ascender / 64.0f);
-
-    // create a new bitmap for the glyph
-    if(charcode == UNDERLINE_CHARACTER)
-    {
-      float underlineBitmapWidth( glyphMetrics.width / xScale );
-      float underlineBitmapHeight( glyphMetrics.height / yScale );
-
-      const unsigned int underlineBitmapSize(underlineBitmapWidth*underlineBitmapHeight);
-      std::vector<unsigned char> underlineAlphaMap(underlineBitmapSize);
-      std::fill(underlineAlphaMap.begin(), underlineAlphaMap.end(), 0xff);
-
-      bitmapData = Integration::Bitmap::New(Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD);
-      bitmapData->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, fieldSize, fieldSize);
-      GenerateDistanceFieldMap( &(*underlineAlphaMap.begin()), Vector2(underlineBitmapWidth, underlineBitmapHeight),
-                               bitmapData->GetBuffer(), Vector2(fieldSize, fieldSize),
-                               fieldPadding, Vector2( maxGlyphCell.width / xScale, maxGlyphCell.height / yScale ),
-                               highQuality );
-    }
-    else
-    {
-      if (0 != (bitmap.width * bitmap.rows))
-      {
-        bitmapData = Integration::Bitmap::New(Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD);
-        bitmapData->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, fieldSize, fieldSize);
-
-        GenerateDistanceFieldMap(bitmap.buffer, Vector2(bitmap.width, bitmap.rows),
-            bitmapData->GetBuffer(), Vector2(fieldSize, fieldSize),
-            fieldPadding, Vector2( maxGlyphCell.width / xScale, maxGlyphCell.height / yScale ),
-            highQuality );
-      }
-      else
-      {
-        // FreeType has rendered a zero width / height bitmap.
-        // This will only happen with a few characters like no break space (nbsp)
-        // @todo filter out known, non-visible characters in Dali-core.
-        // However we will still need this code for characters like OGHAM SPACE MARK
-        // which will be blank with some fonts, and visible with others.
-        // Create a dummy bitmap of size 64,64
-        bitmapData = Integration::Bitmap::New(Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD);
-        bitmapData->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, fieldSize, fieldSize);
-        PixelBuffer* pixelBuffer = bitmapData->GetBuffer();
-        memset( pixelBuffer, 0x0, fieldSize * fieldSize );
-      }
-    }
-  }
-
-  // finished with glyph, so, release it
-  FT_Done_Glyph(glyph);
-
-  return new GlyphSet::Character(bitmapData, glyphMetrics);
-}
-
-Integration::BitmapPtr GetGlyphBitmap( FT_Face face, FT_ULong charCode )
-{
-  Integration::BitmapPtr image;
-
-  FT_Glyph ftGlyph = GetGlyph( face, charCode, FT_LOAD_RENDER );
-  if( NULL != ftGlyph )
-  {
-    FT_Error ftError = FT_Err_Ok;
-
-    // convert glyph to bitmap
-    if( ftGlyph->format != FT_GLYPH_FORMAT_BITMAP )
-    {
-      ftError = FT_Glyph_To_Bitmap( &ftGlyph, FT_RENDER_MODE_NORMAL, 0, 1 );
-
-      if( ftError != FT_Err_Ok)
-      {
-        DALI_LOG_WARNING( "FT_Glyph_To_Bitmap failed %d\n", ftError );
-        FT_Done_Glyph( ftGlyph );
-        return image;
-      }
-    }
-
-    // cast the FT_Glyph to a FT_BitmapGlyph
-    FT_BitmapGlyph ftBitmapGlyph = (FT_BitmapGlyph)ftGlyph;
-
-    // access the underlying bitmap data
-    FT_Bitmap ftBitmap = ftBitmapGlyph->bitmap;
-
-    const std::size_t size = ftBitmap.width * ftBitmap.rows;
-    if( 0 < size )
-    {
-      image = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD );
-      image->GetPackedPixelsProfile()->ReserveBuffer( Pixel::A8, ftBitmap.width, ftBitmap.rows );
-
-      memcpy( static_cast<unsigned char*>( image->GetBuffer() ), ftBitmap.buffer, size );
-    }
-
-    // finished with glyph, so, release it
-    FT_Done_Glyph( ftGlyph );
-  }
-
-  return image;
-}
-
-} // namespace SlpPlatform
-
-} // namespace Dali
diff --git a/platform-abstractions/slp/resource-loader/loader-font.h b/platform-abstractions/slp/resource-loader/loader-font.h
deleted file mode 100644 (file)
index e18f3f3..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-#ifndef __DALI_SLP_PLATFORM_LOADER_FONT_H__
-#define __DALI_SLP_PLATFORM_LOADER_FONT_H__
-
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <string>
-
-#include <ft2build.h>
-#include <dali/integration-api/glyph-set.h>
-#include <dali/public-api/text/font.h>
-#include FT_FREETYPE_H
-#include FT_GLYPH_H
-#include FT_OUTLINE_H
-
-namespace Dali
-{
-namespace Integration
-{
-class GlyphSet;
-}
-
-namespace SlpPlatform
-{
-struct SlpFace
-{
-  SlpFace()
-  {
-    face = NULL;
-    buffer = NULL;
-  }
-
-  ~SlpFace()
-  {
-    if (face)
-    {
-      FT_Done_Face(face);
-      face = NULL;
-    }
-    if (buffer)
-    {
-      delete [] buffer;
-      buffer = NULL;
-    }
-  }
-
-  FT_Face   face;       ///< FT_Face object
-  FT_Byte*  buffer;     ///< A buffer used by the face.
-};
-
-/**
- * Loads a freetype font face
- * @param [in]    fileName  Font file name
- * @param [in]    pointSize Point size for freetype source glyph scaling
- * @param [in]    dpiHor    Horizontal dpi
- * @param [in]    dpiVer    Vertical dpi
- * @param [inout] freeType  A handle to the FreeType library resource
- * @return A SlpFace pointer on success, NULL on failure
- */
-SlpFace* LoadFontFace(const std::string &fileName,
-                      const PointSize pointSize,
-                      const unsigned int dpiHor, const unsigned int dpiVer,
-                      FT_Library freeType);
-/**
- * Loads a freetype font face
- * @param [in]    fileName  Font file name
- * @param [in]    pixelSize Pixel size for freetype source glyph scaling
- * @param [inout] freeType  A handle to the FreeType library resource
- * @return A SlpFace pointer on success, NULL on failure
- */
-SlpFace* LoadFontFace(const std::string &fileName,
-                      const PixelSize pixelSize,
-                      FT_Library freeType);
-
-/**
- * Gets a glyph (character) from a font face.
- * @param [in] face       Freetype face object
- * @param [in] charcode   Character code (unicode)
- * @param [in] load_flags How the glyph should be loaded
- * @return FT_Glyph object on success, NULL on failure
- */
-FT_Glyph GetGlyph(FT_Face face, FT_ULong charcode, FT_Int32 load_flags);
-
-/**
- * Gets a glyph (character) from a font face.
- * @param [in] face          Freetype face object
- * @param [in] charcode      UCS4 character code (UTF32)
- * @param [in] fieldSize     size (w and h) of generated distance field cells
- * @param [in] fieldPadding  number of border pixels to add around source glyph bitmap
- * @param [in] maxGlyphCell  The maximum pixel area of a single glyph (in font units)
- * @param [in] renderBitmap  whether to load/render bitmap data as well
- * @return Character pointer on success, NULL on failure
- */
-Integration::GlyphSet::Character* GetCharacter(FT_Face face, const FT_ULong charcode,
-                                               const unsigned int fieldSize, const unsigned int fieldPadding,
-                                               const Vector2& maxGlyphCell,
-                                               const bool renderBitmap, const bool highQuality );
-
-/**
- * Retrieves a glyph's image from the given Freetype face object.
- *
- * @param[in] face Freetype face object.
- * @param[in] charCode UCS4 character code (UTF32).
- *
- * @return The glyph's image for the given character.
- */
-Integration::BitmapPtr GetGlyphBitmap( FT_Face face, FT_ULong charCode );
-
-} // namespace SlpPlatform
-
-} // namespace Dali
-
-#endif // __DALI_SLP_PLATFORM_LOADER_FONT_H__
index 64b7912..e92eb55 100755 (executable)
 #include "resource-bitmap-requester.h"
 #include "resource-model-requester.h"
 #include "resource-shader-requester.h"
-#include "resource-text-requester.h"
 #include "debug/resource-loader-debug.h"
-#include "loader-font.h"
-#include "../interfaces/font-controller.h"
 #include "../interfaces/data-cache.h"
 
 
@@ -66,13 +63,6 @@ namespace SlpPlatform
 namespace
 {
 
-const char * const DALI_USER_FONT_CACHE_PATH( DALI_USER_FONT_CACHE_DIR );
-const unsigned int MAX_NUMBER_CHARS_TO_CACHE( 60000 );  ///< support up to 60,000 glyphs
-const unsigned int DISTANCE_FIELD_SIZE = 64;       // doesn't need to be power of two (the atlas may for performance)
-const unsigned int DISTANCE_FIELD_PADDING = 30;    // Number of pixels of padding around the source FreeType bitmap
-const unsigned int HIGH_QUALITY_PIXEL_SIZE = 200;  // Pixel size sent to FreeType2 FT_Set_Char_Size() for high quality glyphs
-const float ONE_OVER_64 = 1.0f/64.0f;
-
 #ifdef DEBUG_ENABLED
 // For DEBUG_ENABLED profiling of distance field glyph generation
 double GetTimeMicroseconds()
@@ -109,19 +99,14 @@ struct ResourceLoader::ResourceLoaderImpl
   FailedQueue  mFailedLoads;            ///< Failed load request notifications are stored here until fetched by core
   FailedQueue  mFailedSaves;            ///< Failed save request notifications are stored here until fetched by core
 
-  Dali::Platform::FontController* mFontController;       ///< Interface for accessing font information
-
   RequestHandlers mRequestHandlers;
   RequestStore mStoredRequests;         ///< Used to store load requests until loading is completed
 
   ResourceLoaderImpl( ResourceLoader* loader )
   {
-    mFontController = Dali::Platform::FontController::New();
-
     mRequestHandlers.insert(std::make_pair(ResourceBitmap, new ResourceBitmapRequester(*loader)));
     mRequestHandlers.insert(std::make_pair(ResourceShader, new ResourceShaderRequester(*loader)));
     mRequestHandlers.insert(std::make_pair(ResourceModel, new ResourceModelRequester(*loader)));
-    mRequestHandlers.insert(std::make_pair(ResourceText, new ResourceTextRequester(*loader)));
   }
 
   ~ResourceLoaderImpl()
@@ -132,8 +117,6 @@ struct ResourceLoader::ResourceLoaderImpl
       ResourceRequesterBase* requestBase = it->second;
       delete requestBase;
     }
-
-    delete mFontController;
   }
 
   void Pause()
@@ -455,285 +438,6 @@ bool ResourceLoader::IsLoading()
   return mImpl->IsLoading();
 }
 
-const std::string& ResourceLoader::GetFontFamilyForChars( const Integration::TextArray& charsRequested )
-{
-  return mImpl->mFontController->GetFontFamilyForChars( charsRequested ).first;
-}
-
-bool ResourceLoader::AllGlyphsSupported( const std::string& fontFamily, const std::string& fontStyle, const Integration::TextArray& charsRequested )
-{
-  // At this point fontFamily and fontStyle must have been validated.
-
-  return mImpl->mFontController->AllGlyphsSupported( Platform::FontController::StyledFontFamily( fontFamily, fontStyle ), charsRequested );
-}
-
-bool ResourceLoader::ValidateFontFamilyName( const std::string& fontFamily,
-                                             const std::string& fontStyle,
-                                             bool& isDefaultSystemFontFamily,
-                                             bool& isDefaultSystemFontStyle,
-                                             std::string& closestFontFamilyMatch,
-                                             std::string& closestFontStyleMatch )
-{
-  Platform::FontController::StyledFontFamily closestMatch;
-
-  bool result = mImpl->mFontController->ValidateFontFamilyName( Platform::FontController::StyledFontFamily( fontFamily, fontStyle ),
-                                                                isDefaultSystemFontFamily,
-                                                                isDefaultSystemFontStyle,
-                                                                closestMatch );
-
-  closestFontFamilyMatch = closestMatch.first;
-  closestFontStyleMatch = closestMatch.second;
-
-  return result;
-}
-
-PixelSize ResourceLoader::GetFontLineHeightFromCapsHeight( const std::string& fontFamily, const std::string& fontStyle, CapsHeight capsHeight, FT_Library freeType )
-{
-  // At this point fontFamily and fontStyle must have been validated.
-
-  PixelSize result(0);
-
-  if (!fontFamily.empty())
-  {
-    const std::string& fontFileName = GetFontPath( fontFamily, fontStyle );
-    SlpFace* slpFace = LoadFontFace(fontFileName, PixelSize(capsHeight), freeType);
-
-    if (slpFace)
-    {
-      const float scale = static_cast<float>(capsHeight.value) / ((slpFace->face->ascender / 64.0f) * 0.95f);
-
-      result.value = static_cast<unsigned int>(roundf(scale * (slpFace->face->height / 64.0f)));
-
-      delete slpFace;
-      slpFace = NULL;
-    }
-  }
-
-  return result;
-}
-
-void ResourceLoader::GetFontList( Dali::Integration::PlatformAbstraction::FontListMode mode, std::vector<std::string>& fontList )
-{
-  // VCC TODO: A GetStyles() method which returns a list of styles for a given font family is needed.
-
-  Platform::FontController::FontListMode listMode = Platform::FontController::LIST_SYSTEM_FONTS;
-
-  switch( mode )
-  {
-    case Dali::Integration::PlatformAbstraction::LIST_ALL_FONTS:
-    {
-      listMode =  Platform::FontController::LIST_ALL_FONTS;
-      break;
-    }
-    case Dali::Integration::PlatformAbstraction::LIST_SYSTEM_FONTS:
-    {
-      listMode =  Platform::FontController::LIST_SYSTEM_FONTS;
-      break;
-    }
-    case Dali::Integration::PlatformAbstraction::LIST_APPLICATION_FONTS:
-    {
-      listMode =  Platform::FontController::LIST_APPLICATION_FONTS;
-      break;
-    }
-    default:
-    {
-      DALI_ASSERT_DEBUG( false && "invalid mode" );
-    }
-  }
-
-  Platform::FontController::FontList styledFontList;
-  mImpl->mFontController->GetFontList( listMode, styledFontList );
-
-  std::set<std::string> uniqueFontNames;
-  for( Platform::FontController::FontList::const_iterator it = styledFontList.begin(), endIt = styledFontList.end(); it != endIt; ++it )
-  {
-    uniqueFontNames.insert( it->first );
-  }
-
-  // copy into a vector
-  std::copy( uniqueFontNames.begin(), uniqueFontNames.end(), std::back_inserter( fontList ) );
-}
-
-
-/**
- * Note, called from both platform abstraction & from text loader threads
- **/
-GlyphSet* ResourceLoader::GetGlyphData (const TextResourceType& textRequest,
-                                        FT_Library freeType,
-                                        const std::string& fontFamily,
-                                        bool getBitmap)
-{
-  // At this point fontFamily and the font style stored in the textRequest must have been validated.
-
-  GlyphSet* glyphSet = NULL;
-
-  size_t fontHash = textRequest.mFontHash;
-
-  DALI_LOG_INFO(gLoaderFilter, Debug::Verbose, "LoadGlyphSet - requested string is %d characters long\n", textRequest.mCharacterList.size());
-
-  // path holds the font name
-  if( !fontFamily.empty() )
-  {
-    const std::string& fontFileName = GetFontPath( fontFamily, textRequest.mStyle );
-
-    const bool highQuality(textRequest.mQuality == TextResourceType::TextQualityHigh);
-    const unsigned int glyphQuality( highQuality ? GlyphMetrics::HIGH_QUALITY : GlyphMetrics::LOW_QUALITY );
-
-    SlpFace* slpFace = LoadFontFace( fontFileName, PixelSize( HIGH_QUALITY_PIXEL_SIZE), freeType );
-    if (slpFace)
-    {
-      glyphSet = new GlyphSet();
-      glyphSet->mFontHash = fontHash;
-      glyphSet->SetAtlasResourceId( textRequest.mTextureAtlasId );
-
-      for( TextResourceType::CharacterList::const_iterator it = textRequest.mCharacterList.begin(), endIt = textRequest.mCharacterList.end(); it != endIt; ++it )
-      {
-        uint32_t charCode( it->character );
-
-        if (!glyphSet->HasCharacter(charCode))        // ignore duplicate glyphs in the request
-        {
-#ifdef DEBUG_ENABLED
-          // DEBUG_ENABLED profiling of distance field glyph generation
-          double then( 0.0 );
-          if( getBitmap )
-          {
-            then = GetTimeMicroseconds();
-          }
-#endif
-          ScopedPointer< GlyphSet::Character > character( GetCharacter(slpFace->face, charCode,
-                                                                    DISTANCE_FIELD_SIZE, DISTANCE_FIELD_PADDING, textRequest.mMaxGlyphSize,
-                                                                    getBitmap, highQuality ) );
-
-#ifdef DEBUG_ENABLED
-          // DEBUG_ENABLED profiling of distance field glyph generation
-          if( getBitmap )
-          {
-            double now( GetTimeMicroseconds() );
-
-            DALI_LOG_INFO( gLoaderFilter, Log::Verbose, "Generating (%c) in %s quality took %.3f ms\n", charCode, highQuality ? "high" : "low",  1e-3 * ( now - then ) );
-          }
-#endif
-          if (character.Get() != 0 )
-          {
-            GlyphSet::Character& glyphCharacter( *character );
-
-            glyphCharacter.second.quality = glyphQuality;
-            glyphCharacter.second.xPosition = it->xPosition;
-            glyphCharacter.second.yPosition = it->yPosition;
-            // copy character to GlyphSet
-            glyphSet->AddCharacter( glyphCharacter );
-          }
-        }
-      }
-
-      delete slpFace;
-    }
-  }
-
-  return glyphSet;
-}
-
-GlyphSet* ResourceLoader::GetCachedGlyphData(const TextResourceType& textRequest, const std::string& fontFamily)
-{
-  GlyphSet* glyphSet( new GlyphSet() );
-  glyphSet->mFontHash = textRequest.mFontHash;
-  glyphSet->SetAtlasResourceId(textRequest.mTextureAtlasId);
-
-  std::string cachePath(DALI_USER_FONT_CACHE_PATH);
-  cachePath.append(fontFamily + "-" + textRequest.mStyle);
-  std::replace(cachePath.begin(), cachePath.end(), ' ', '-');
-
-  DALI_LOG_INFO(gLoaderFilter, Debug::Verbose, "ResourceLoader::GetCachedGlyphData() - cachefile: %s\n", cachePath.c_str() );
-
-  Platform::DataCache* dataCache = Platform::DataCache::New( Platform::DataCache::READ_ONLY,
-                                                             Platform::DataCache::RUN_LENGTH_ENCODING,
-                                                             cachePath,
-                                                             DISTANCE_FIELD_SIZE * DISTANCE_FIELD_SIZE,
-                                                             MAX_NUMBER_CHARS_TO_CACHE);
-
-  Platform::DataCache::KeyVector keyVector;
-  Platform::DataCache::DataVector dataVector;
-
-  const TextResourceType::CharacterList& requestedCharacters = textRequest.mCharacterList;
-  for( std::size_t i=0, length = requestedCharacters.size(); i < length; ++i )
-  {
-    keyVector.push_back( requestedCharacters[i].character );
-  }
-
-  // load the glyphs from file
-  dataCache->Find( keyVector, dataVector );
-
-  // for each glyph found, add to the glyph set
-  for( std::size_t n = 0, arraySize = keyVector.size(); n < arraySize ; n++ )
-  {
-    Platform::DataCache::Data& data( dataVector[n]);
-
-    if( data.exists )
-    {
-      GlyphMetrics glyphMetrics;
-      glyphMetrics.code = keyVector[ n ];
-      glyphMetrics.quality = GlyphMetrics::HIGH_QUALITY;
-      glyphMetrics.xPosition = requestedCharacters[n].xPosition;
-      glyphMetrics.yPosition = requestedCharacters[n].yPosition;
-
-      // create a new bitmap, and copy in the data
-      BitmapPtr bitmapData ( Integration::Bitmap::New(Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD) );
-
-      // assign the data
-      bitmapData->GetPackedPixelsProfile()->AssignBuffer( Pixel::A8, data.data, DISTANCE_FIELD_SIZE * DISTANCE_FIELD_SIZE, DISTANCE_FIELD_SIZE, DISTANCE_FIELD_SIZE );
-
-      data.data = NULL;
-
-      // add to the glyphset
-      glyphSet->AddCharacter( bitmapData, glyphMetrics );
-    }
-  }
-  DALI_LOG_INFO( gLoaderFilter, Debug::Verbose, "ResourceLoader::GetCachedGlyphData() - requestedGlyphs:%u, cachedGlyphs:%u\n",
-                 requestedCharacters.size(), glyphSet->GetCharacterList().size() );
-
-  delete dataCache;
-
-  return glyphSet;
-}
-
-void ResourceLoader::GetGlobalMetrics( FT_Library freeType,
-                                       const std::string& fontFamily,
-                                       const std::string& fontStyle,
-                                       GlobalMetrics& globalMetrics )
-{
-  // At this point fontFamily and fontStyle must have been validated.
-
-  if( !fontFamily.empty() )
-  {
-    const std::string& fontFileName = GetFontPath( fontFamily, fontStyle );
-
-    SlpFace* slpFace = LoadFontFace( fontFileName, PixelSize( HIGH_QUALITY_PIXEL_SIZE), freeType );
-    if( slpFace )
-    {
-      // scale factor for unit scaled glyphs
-      const float xScale = 1.0f / (slpFace->face->size->metrics.x_scale / 65536.0f);
-      const float yScale = 1.0f / (slpFace->face->size->metrics.y_scale / 65536.0f);
-
-      globalMetrics.lineHeight = slpFace->face->height * ONE_OVER_64;
-      globalMetrics.ascender = slpFace->face->ascender * ONE_OVER_64;
-      globalMetrics.unitsPerEM = slpFace->face->units_per_EM * ONE_OVER_64;
-
-      globalMetrics.underlinePosition = -4.f;
-      globalMetrics.underlineThickness = 5.f * yScale;
-      if( 1.f > globalMetrics.underlineThickness )
-      {
-        globalMetrics.underlineThickness = 1.f;
-      }
-      globalMetrics.maxWidth = DISTANCE_FIELD_SIZE * xScale;
-      globalMetrics.maxHeight = DISTANCE_FIELD_SIZE * yScale;
-      globalMetrics.padAdjustX = DISTANCE_FIELD_PADDING * xScale;
-      globalMetrics.padAdjustY = DISTANCE_FIELD_PADDING * yScale;
-
-      delete slpFace;
-    }
-  }
-}
-
 void ResourceLoader::SetDpi(unsigned int dpiHor, unsigned int dpiVer)
 {
   // Unused
@@ -847,35 +551,6 @@ bool ResourceLoader::SaveFile(const std::string& filename, std::vector< unsigned
   return result;
 }
 
-Integration::BitmapPtr ResourceLoader::GetGlyphImage( FT_Library freeType, const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character )
-{
-  // At this point fontFamily and fontStyle must have been validated.
-
-  Integration::BitmapPtr image;
-
-  const std::string& fontFileName = GetFontPath( fontFamily, fontStyle );
-  SlpFace* slpFace = LoadFontFace( fontFileName, PixelSize( Font::PointsToPixels( fontSize ) ), freeType );
-
-  if( NULL != slpFace )
-  {
-    image = GetGlyphBitmap( slpFace->face, character );
-    delete slpFace;
-  }
-
-  return image;
-}
-
-void ResourceLoader::SetDefaultFontFamily( const std::string& fontFamily, const std::string& fontStyle )
-{
-  mImpl->mFontController->SetDefaultFontFamily( Platform::FontController::StyledFontFamily( fontFamily, fontStyle ) );
-}
-
-const std::string& ResourceLoader::GetFontPath(const std::string& fontFamily, const std::string& fontStyle)
-{
-  // At this point fontFamily and fontStyle must have been validated.
-  return mImpl->mFontController->GetFontPath(std::make_pair(fontFamily,fontStyle));
-}
-
 } // namespace SlpPlatform
 
 } // namespace Dali
index dccb366..b8801e4 100644 (file)
  */
 
 #include <dali/integration-api/platform-abstraction.h>
-#include <dali/integration-api/glyph-set.h>
 #include <dali/integration-api/resource-cache.h>
 #include <dali/public-api/common/dali-vector.h>
 
 #include <string>
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_GLYPH_H
 
 namespace Dali
 {
@@ -39,11 +35,6 @@ class Filter;
 }
 }
 
-namespace Platform
-{
-class FontController;
-}
-
 namespace SlpPlatform
 {
 
@@ -262,75 +253,11 @@ public:
   void GetResources(Integration::ResourceCache& cache);
 
   /**
-   * Called by Font objects to synchronously query glyph data.
-   * @param[in] textRequest     resource request
-   * @param[in] freeType        handle to the FreeType library
-   * @param[in] fontFamily      name of the font's family
-   * @param[in] getBitmap       whether to load bitmaps for the symbols as well
-   * @return A GlyphSet pointer with a list of the requested glyph metrics.
-   */
-  Integration::GlyphSet* GetGlyphData ( const Integration::TextResourceType& textRequest,
-                                        FT_Library freeType,
-                                        const std::string& fontFamily,
-                                        bool getBitmap);
-
-  /**
-   * Called by Font objects to synchronously load glyph data.
-   * @param[in] textRequest     resource request
-   * @param[in] fontFamily      name of the font's family
-   * @return A GlyphSet pointer containing the requested glyph bitmaps.
-   */
-  Integration::GlyphSet* GetCachedGlyphData( const Integration::TextResourceType& textRequest,
-                                             const std::string& fontFamily );
-
-  /**
-   * Called by Font objects to synchronously query global font metrics.
-   * @param[in] freeType       handle to the FreeType library
-   * @param[in] fontFamily     name of the font's family
-   * @param[in] fontStyle      name of the font's style
-   * @param[out] globalMetrics font requested global metrics.
-   */
-  void GetGlobalMetrics( FT_Library freeType,
-                         const std::string& fontFamily,
-                         const std::string& fontStyle,
-                         Integration::GlobalMetrics& globalMetrics );
-
-  /**
    * @copydoc PlatformAbstraction::SetDpi()
    */
   void SetDpi(unsigned int dpiHor, unsigned int dpiVer);
 
   /**
-   * @copydoc PlatformAbstraction::GetFontFamilyForChars()
-   */
-  const std::string& GetFontFamilyForChars(const Integration::TextArray& charsRequested);
-
-  /**
-   * @copydoc PlatformAbstraction::AllGlyphsSupported()
-   */
-  bool AllGlyphsSupported(const std::string& fontFamily, const std::string& fontStyle, const Integration::TextArray& charsRequested);
-
-  /**
-   * @copydoc PlatformAbstraction::ValidateFontFamilyName()
-   */
-  bool ValidateFontFamilyName( const std::string& fontFamily,
-                               const std::string& fontStyle,
-                               bool& isDefaultSystemFontFamily,
-                               bool& isDefaultSystemFontStyle,
-                               std::string& closestFontFamilyMatch,
-                               std::string& closestFontStyleMatch );
-
-  /**
-   * @copydoc SlpPlatformAbstraction::GetFontLineHeightFromCapsHeight
-   */
-  PixelSize GetFontLineHeightFromCapsHeight(const std::string& fontFamily, const std::string& fontStyle, CapsHeight capsHeight, FT_Library freeType);
-
-  /**
-   * @copydoc SlpPlatformAbstraction::GetFontList
-   */
-  void GetFontList( Dali::Integration::PlatformAbstraction::FontListMode mode, std::vector<std::string>& fontList );
-
-  /**
    * @copydoc SlpPlatformAbstraction::LoadFile()
    */
   bool LoadFile( const std::string& filename, std::vector< unsigned char >& buffer ) const;
@@ -345,39 +272,6 @@ public:
    */
   static bool SaveFile(const std::string& filename, std::vector< unsigned char >& buffer);
 
-  /**
-   * Sets the default font family that should be used by the font resources.
-   * @param[in] fontFamily The default font family.
-   * @param[in] fontStyle The default font style.
-   */
-  void SetDefaultFontFamily( const std::string& fontFamily, const std::string& fontStyle );
-
-  /**
-   * Retrieves the glyp's image representing the given character.
-   *
-   * @param[in] freeType Handle to the FreeType library.
-   * @param[in] fontFamily The font's family name.
-   * @param[in] fontStyle The font's style.
-   * @param[in] fontSize The font's size.
-   * @param[in] character The given character.
-   *
-   * @return The bitmap image.
-   */
-  Integration::BitmapPtr GetGlyphImage( FT_Library freeType, const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character );
-
-private:
-
-  /**
-   * Find the path of a platform-specific font resource.
-   * Multi-threading note: this method will be called from the main thread only i.e. not
-   * from within the Core::Render() method.
-   * @note   Italics and boldness are applied by transforming the outline.
-   * @param[in] fontFamily The font family e.g. Arial, Courier.
-   * @param[in] fontStyle The font's style.
-   * @return The path to a font resource; the closest available match for the family parameter.
-   */
-  const std::string& GetFontPath(const std::string& fontFamily, const std::string& fontStyle); // not const because of mutex
-
 private:
   struct ResourceLoaderImpl;
   ResourceLoaderImpl* mImpl;
diff --git a/platform-abstractions/slp/resource-loader/resource-text-requester.cpp b/platform-abstractions/slp/resource-loader/resource-text-requester.cpp
deleted file mode 100644 (file)
index d00fd7d..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "resource-text-requester.h"
-
-#include "debug/resource-loader-debug.h"
-
-using namespace Dali::Integration;
-
-namespace Dali
-{
-
-namespace SlpPlatform
-{
-
-namespace
-{
-const uint32_t FIRST_VISIBLE_CHAR( 0x21 ); // 0x20 is the white space
-
-bool IsVisible(uint32_t code)
-{
-  return !(code < FIRST_VISIBLE_CHAR);
-}
-
-// helper to remove invisible characters
-void RemoveInvisibleCharacters( Integration::TextResourceType::CharacterList& text )
-{
-  Integration::TextResourceType::CharacterList temp;
-  temp.reserve(text.size());
-  for(std::size_t i=0, length= text.size(); i< length; i++)
-  {
-    if (IsVisible( text[i].character ))
-    {
-      temp.push_back(text[i]);
-    }
-  }
-  text = temp;
-}
-
-} // Anonymous namespace
-
-ResourceTextRequester::ResourceTextRequester( ResourceLoader& resourceLoader )
-: ResourceRequesterBase( resourceLoader ),
-  mThreadText( NULL )
-{
-}
-
-ResourceTextRequester::~ResourceTextRequester()
-{
-  delete mThreadText;
-}
-
-void ResourceTextRequester::Pause()
-{
-  if( mThreadText )
-  {
-    mThreadText->Pause();
-  }
-}
-
-void ResourceTextRequester::Resume()
-{
-  if( mThreadText )
-  {
-    mThreadText->Resume();
-  }
-}
-
-void ResourceTextRequester::LoadResource( Integration::ResourceRequest& request )
-{
-  TextResourceType* textRequest = dynamic_cast<TextResourceType*>(request.GetType());
-  if( textRequest )
-  {
-    TextResourceType::CharacterList& text(textRequest->mCharacterList);
-
-    // Remove from stored request
-    RemoveInvisibleCharacters( text );
-    if( text.empty() )
-    {
-      IntrusivePtr<GlyphSet> cachedGlyphs(  new GlyphSet() );
-      LoadedResource resource( request.GetId(), request.GetType()->id, cachedGlyphs );
-      mResourceLoader.AddLoadedResource(resource);
-    }
-    else
-    {
-      CreateThread();
-      mThreadText->AddRequest( request, ResourceThreadBase::RequestLoad );
-    }
-  }
-}
-
-ResourcePointer ResourceTextRequester::LoadResourceSynchronously( const Integration::ResourceType& type, const std::string& path )
-{
-  DALI_ASSERT_ALWAYS( false && "Cannot load text synchronously" );
-}
-
-LoadStatus ResourceTextRequester::LoadFurtherResources( ResourceRequest& request, LoadedResource partialResource )
-{
-  // nothing to do
-
-  return RESOURCE_COMPLETELY_LOADED;
-}
-
-void ResourceTextRequester::SaveResource(const Integration::ResourceRequest& request )
-{
-  // Nothing to do
-}
-
-void ResourceTextRequester::CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId)
-{
-  if( mThreadText )
-  {
-    mThreadText->CancelRequest(id);
-  }
-}
-
-void ResourceTextRequester::CreateThread()
-{
-  if( ! mThreadText )
-  {
-    mThreadText = new ResourceThreadText(  mResourceLoader , TextResourceType::TextQualityHigh );
-  }
-}
-
-} // SlpPlatform
-
-} // Dali
diff --git a/platform-abstractions/slp/resource-loader/resource-text-requester.h b/platform-abstractions/slp/resource-loader/resource-text-requester.h
deleted file mode 100644 (file)
index cfd881b..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-#ifndef __DALI_SLP_PLATFORM_RESOURCE_TEXT_REQUESTER_H__
-#define __DALI_SLP_PLATFORM_RESOURCE_TEXT_REQUESTER_H__
-
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <platform-abstractions/slp/resource-loader/resource-requester-base.h>
-#include "resource-thread-text.h"
-
-namespace Dali
-{
-namespace Integration
-{
-class ResourceRequest;
-}
-
-namespace SlpPlatform
-{
-
-class ResourceTextRequester : public ResourceRequesterBase
-{
-public:
-  /**
-   * Constructor
-   * @param[in] resourceLoader The resource loader with which to communicate results
-   */
-  ResourceTextRequester( ResourceLoader& resourceLoader );
-
-  /**
-   * Destructor
-   */
-  virtual ~ResourceTextRequester();
-
-  /**
-   * @copydoc ResourceRequester::Pause()
-   */
-  virtual void Pause();
-
-  /**
-   * @copydoc ResourceRequester::Resume()
-   */
-  virtual void Resume();
-
-  /**
-   * @copydoc ResourceRequester::LoadResource()
-   */
-  virtual void LoadResource( Integration::ResourceRequest& request );
-
-  /**
-   * @copydoc ResourceRequester::LoadResourceSynchronously()
-   */
-  virtual Integration::ResourcePointer LoadResourceSynchronously( const Integration::ResourceType& type, const std::string& path );
-
-  /**
-   * @copydoc ResourceRequester::LoadFurtherResources()
-   */
-  virtual Integration::LoadStatus LoadFurtherResources( Integration::ResourceRequest& request, LoadedResource partialResource );
-
-  /**
-   * @copydoc ResourceRequester::SaveResource()
-   */
-  virtual void SaveResource(const Integration::ResourceRequest& request );
-
-  /**
-   * @copydoc ResourceRequester::CancelLoad()
-   */
-  virtual void CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId);
-
-private:
-
-  /**
-   * Create thread if it doesn't exist
-   */
-  void CreateThread();
-
-protected:
-  ResourceThreadText* mThreadText; ///< Loader thread
-};
-
-} // SlpPlatform
-} // Dali
-
-#endif // __DALI_SLP_PLATFORM_RESOURCE_TEXT_REQUESTER_H__
diff --git a/platform-abstractions/slp/resource-loader/resource-thread-text.cpp b/platform-abstractions/slp/resource-loader/resource-thread-text.cpp
deleted file mode 100644 (file)
index 779420b..0000000
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include "resource-thread-text.h"
-
-// INTERNAL INCLUDES
-#include "loader-font.h"
-#include "../interfaces/data-cache.h"
-#include "../data-cache/tests/data-cache-debug.h"
-
-// EXTERNAL INCLUDES
-#include <boost/functional/hash.hpp>
-#include <ft2build.h>
-#include <iostream>
-#include FT_FREETYPE_H
-#include FT_GLYPH_H
-
-#include <dali/integration-api/glyph-set.h>
-#include <dali/integration-api/platform-abstraction.h>
-
-
-using namespace Dali::Integration;
-
-namespace Dali
-{
-namespace SlpPlatform
-{
-
-namespace
-{
-
-const char * const DALI_USER_FONT_CACHE_PATH( DALI_USER_FONT_CACHE_DIR );
-const unsigned int DISTANCE_FIELD_WIDTH( 64 );
-const unsigned int DISTANCE_FIELD_HEIGHT( 64 );
-const unsigned int DISTANCE_FIELD_SIZE(DISTANCE_FIELD_WIDTH * DISTANCE_FIELD_HEIGHT);
-const unsigned int MAX_NUMBER_CHARS_TO_CACHE( 60000 );  ///< support up to 60,000 glyphs
-
-boost::mutex mFileCheckMutex;             ///< used to ensure only one thread checks the files for corruption on startup
-
-
-}; // unnamed namespace
-
-ResourceThreadText::ResourceThreadText(ResourceLoader& resourceLoader, const TextResourceType::TextQuality quality)
-: ResourceThreadBase(resourceLoader),
-  mQuality(quality),
-  mFreeTypeHandle( NULL )
-{
-
-#ifdef DATA_CACHE_DEBUG
-  DataCacheIo::ThreadedStressTest();
-#endif
-}
-
-ResourceThreadText::~ResourceThreadText()
-{
-  TerminateThread();
-
-  DeleteDataCaches();
-
-  if( mFreeTypeHandle )
-  {
-    FT_Done_FreeType(mFreeTypeHandle);
-  }
-}
-
-void ResourceThreadText::Load(const ResourceRequest& request)
-{
-  // 1: Check if glyphs are in the data cache
-  // 2: For any missing glyphs, load from FreeType and save to cache file.
-  //
-  // Important Note: FreeType will never fail to load a character, if the character code
-  // is not part of the font it will render a 'default glyph'.
-  //
-  // This means we never call mResourceLoader.AddFailedLoad( ...)
-
-  const TextResourceType& textRequest = dynamic_cast<const TextResourceType&>(*request.GetType());
-  TextResourceType::CharacterList text(textRequest.mCharacterList);
-
-  std::string cachePath(DALI_USER_FONT_CACHE_PATH);
-  cachePath.append(request.GetPath() + "-" + textRequest.mStyle);
-  std::replace(cachePath.begin(), cachePath.end(), ' ', '-');
-
-  Platform::DataCache* dataCache = GetDataCache( cachePath );
-
-  GlyphSet *glyphSet( new GlyphSet() );
-  glyphSet->mFontHash = textRequest.mFontHash;
-  glyphSet->SetAtlasResourceId(textRequest.mTextureAtlasId);
-
-  if( textRequest.mCache == TextResourceType::GLYPH_CACHE_READ )
-  {
-    LoadCharactersFromCache( *dataCache, *glyphSet, text );
-  }
-  else
-  {
-    LoadCharacters( *dataCache, *glyphSet, textRequest, request.GetPath(), text );
-  }
-
-  IntrusivePtr<GlyphSet> glyphResource( glyphSet );
-  LoadedResource resource( request.GetId(), request.GetType()->id, glyphResource );
-  mResourceLoader.AddPartiallyLoadedResource(resource);
-}
-
-void ResourceThreadText::Save(const ResourceRequest& request)
-{
-}
-
-void ResourceThreadText::LoadCharactersFromCache(
-  Platform::DataCache& dataCache,
-  GlyphSet& glyphSet,
-  const TextResourceType::CharacterList& requestedCharacters )
-{
-  Platform::DataCache::KeyVector keyVector;
-  for( std::size_t i=0, length=requestedCharacters.size(); i<length; i++ )
-  {
-    keyVector.push_back(requestedCharacters[i].character);
-  }
-  Platform::DataCache::DataVector dataVector;
-
-  // load the glyphs from file
-  dataCache.Find( keyVector, dataVector );
-
-
-  // for each glyph found, add to the glyph set
-  for( std::size_t n = 0, arraySize = keyVector.size(); n < arraySize ; n++ )
-  {
-    Platform::DataCache::Data& data( dataVector[n]);
-
-    if( data.exists )
-    {
-      GlyphMetrics glyphMetrics;
-      glyphMetrics.code = keyVector[ n ];
-      glyphMetrics.quality = GlyphMetrics::HIGH_QUALITY;
-      glyphMetrics.xPosition = requestedCharacters[n].xPosition;
-      glyphMetrics.yPosition = requestedCharacters[n].yPosition;
-
-      // create a new bitmap, and copy in the data
-      BitmapPtr bitmapData ( Integration::Bitmap::New(Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD) );
-      DALI_ASSERT_ALWAYS( data.length == DISTANCE_FIELD_SIZE );
-
-      // assign the data
-      bitmapData->GetPackedPixelsProfile()->AssignBuffer( Pixel::A8, data.data, DISTANCE_FIELD_SIZE, DISTANCE_FIELD_WIDTH, DISTANCE_FIELD_HEIGHT );
-
-      data.data = NULL;
-
-      // add to the glyphset
-      glyphSet.AddCharacter( bitmapData, glyphMetrics );
-    }
-  }
-}
-
-void ResourceThreadText::SaveCharacters( Platform::DataCache& dataCache, const GlyphSet& glyphSet )
-{
-  const GlyphSet::CharacterList& chars = glyphSet.GetCharacterList();
-
-  Platform::DataCache::KeyVector keyVector;
-  Platform::DataCache::DataVector dataVector;
-
-  keyVector.reserve( chars.size() );
-  dataVector.reserve( chars.size() );
-
-  for( GlyphSet::CharacterList::const_iterator it = chars.begin(), endIt = chars.end(); it != endIt; ++it )
-  {
-    const BitmapPtr& bitmap( it->first );
-    if ( bitmap )
-    {
-      const GlyphMetrics& metrics( it->second );
-
-      Platform::DataCache::DataKey key( metrics.code );
-      Platform::DataCache::Data data;
-      data.SetData( bitmap->GetBuffer(), DISTANCE_FIELD_SIZE );
-
-      keyVector.push_back( key );
-      dataVector.push_back( data );
-    }
-  }
-
-  // this will save the distance fields to file
-  dataCache.Add( keyVector, dataVector );
-
-}
-
-void ResourceThreadText::LoadCharacters( Platform::DataCache& dataCache,
-                                         GlyphSet& glyphSet,
-                                         const TextResourceType& textRequest,
-                                         const std::string& path,
-                                         const TextResourceType::CharacterList& charCodes )
-{
-  // we need to use freetype, ensure the library has been initialised
-  LoadFreeType();
-
-  // baseline and other general info still queried from FreeType even if all characters were found in cache
-  GlyphSet* missingGlyphSet = mResourceLoader.GetGlyphData(textRequest, mFreeTypeHandle, path, true);
-
-  const GlyphSet::CharacterList& cachedChars = missingGlyphSet->GetCharacterList();
-  for( GlyphSet::CharacterList::const_iterator it = cachedChars.begin(), endIt = cachedChars.end(); it != endIt; ++it )
-  {
-    glyphSet.AddCharacter( *it );
-  }
-
-  // save to cache if high quality
-  if( ( mQuality == TextResourceType::TextQualityHigh ) && ( TextResourceType::GLYPH_CACHE_WRITE == textRequest.mCache ) )
-  {
-    SaveCharacters( dataCache, glyphSet );
-  }
-
-  // all the information in missingGlyphSet has been copied, so delete it.
-  delete missingGlyphSet;
-}
-
-void ResourceThreadText::LoadFreeType()
-{
-  if( mFreeTypeHandle )
-  {
-    return;
-  }
-
-  if( FT_Init_FreeType( &mFreeTypeHandle ) != 0 )
-  {
-    DALI_ASSERT_ALWAYS( 0 && "FT_Init_FreeType failed\n");
-  }
-}
-
-Platform::DataCache* ResourceThreadText::CreateDataCache( const std::string& fileName )
-{
-  // low quality text thread just reads from the cache
-  Platform::DataCache::ReadWriteMode readWriteMode( Platform::DataCache::READ_ONLY);
-
-  // allow high quality distance fields to be written to the cache
-  if( mQuality == TextResourceType::TextQualityHigh )
-  {
-    readWriteMode = Platform::DataCache::READ_WRITE;
-  }
-
-  return Platform::DataCache::New( readWriteMode,
-                                          Platform::DataCache::RUN_LENGTH_ENCODING,
-                                          fileName,
-                                          DISTANCE_FIELD_SIZE,
-                                          MAX_NUMBER_CHARS_TO_CACHE);
-}
-
-Platform::DataCache* ResourceThreadText::GetDataCache( const std::string& fileName )
-{
-  boost::hash<const std::string> hasher;
-  std::size_t hashValue = hasher( fileName );
-
-  // most applications use under 3 fonts, so a simple vector to do the lookup is fine
-  for( unsigned int i = 0; i< mDataCaches.size() ; i++ )
-  {
-    if( mDataCaches[i].second == hashValue)
-    {
-      return mDataCaches[i].first;
-    }
-  }
-  // not found in lookup, create a new data cache
-
-  Platform::DataCache* newCache = CreateDataCache( fileName );
-  mDataCaches.push_back( TDataCachePair( newCache, hashValue ) );
-  return newCache;
-}
-
-void ResourceThreadText::DeleteDataCaches()
-{
-  for( unsigned int i = 0; i< mDataCaches.size() ; i++ )
-  {
-    delete mDataCaches[i].first;
-  }
-  mDataCaches.clear();
-}
-
-} // namespace SlpPlatform
-} // namespace Dali
diff --git a/platform-abstractions/slp/resource-loader/resource-thread-text.h b/platform-abstractions/slp/resource-loader/resource-thread-text.h
deleted file mode 100644 (file)
index 778f00e..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-#ifndef __DALI_SLP_PLATFORM_RESOURCE_THREAD_TEXT_H__
-#define __DALI_SLP_PLATFORM_RESOURCE_THREAD_TEXT_H__
-
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <dali/integration-api/resource-cache.h>
-
-
-#include "resource-thread-base.h"
-
-struct FT_LibraryRec_; // forward declaration of freetype library handle
-
-namespace Dali
-{
-
-namespace Integration
-{
-class GlyphSet;
-class TextResourceType;
-}
-namespace Platform
-{
-class DataCache;
-}
-
-namespace SlpPlatform
-{
-/**
- * Resource loader for glyph distance fields.
- * Uses FreeType and a distance field generator to create distance fields.
- * The distance fields are then cached to file for future use.
- */
-class ResourceThreadText : public ResourceThreadBase
-{
-public:
-  /**
-   * Constructor
-   * @param[in] resourceLoader A reference to the ResourceLoader
-   * @param[in] quality        The quality at which to render the glyph bitmaps
-   */
-  ResourceThreadText(ResourceLoader& resourceLoader, const Integration::TextResourceType::TextQuality quality);
-
-  /**
-   * Destructor
-   */
-  virtual ~ResourceThreadText();
-
-private:
-  /**
-   * @copydoc ResourceThreadBase::Load
-   */
-  virtual void Load(const Integration::ResourceRequest& request);
-
-  /**
-   * @copydoc ResourceThreadBase::Save
-   */
-  virtual void Save(const Integration::ResourceRequest& request);
-
-  /**
-   * Load characters from the data cache.
-   * @param[in] dataCache reference to a data cache
-   * @param[in] glyphset reference to a glyph set
-   * @param[in] requestedCharacters the characters to load from the cache
-   */
-  void LoadCharactersFromCache( Platform::DataCache& dataCache,
-                                Integration::GlyphSet& glyphSet,
-                                const Integration::TextResourceType::CharacterList& requestedCharacters);
-
-  /**
-   * Save characters to the data cache.
-   * @param[in] dataCache reference to a data cache
-   * @param[in] glyphset reference to a glyph set
-   */
-  void SaveCharacters( Platform::DataCache& dataCache,
-                       const Integration::GlyphSet& glyphSet);
-
-  /**
-   * Loading characters using Freetype and write to data cache
-   * @param[in] dataCache reference to a data cache
-   * @param[in] glyphset reference to a glyph set
-   * @param[in] textRequest the text request
-   * @param[in] path font filename
-   * @param[in] characterCodes the characters to load
-    */
-  void LoadCharacters( Platform::DataCache& dataCache,
-                       Integration::GlyphSet& glyphSet,
-                       const Integration::TextResourceType& textRequest,
-                       const std::string& path,
-                       const Integration::TextResourceType::CharacterList& characterCodes );
-
-  /**
-   * Initialize the freetype library.
-   * Called if a glyph is required that isn't cached.
-   */
-  void LoadFreeType();
-
-  /**
-   * Creates a data cache
-   * @param[in] fileName font name
-   * @return pointer to a data cache
-   */
-  Platform::DataCache* CreateDataCache( const std::string& fileName );
-
-  /**
-   * Deletes all data cache objects
-   */
-  void DeleteDataCaches();
-
-  /**
-   * Returns a data cache for a font and creates one if it doesn't exist
-   * @param[in] fileName font name
-   * @return a data cache for a given font filename
-   */
-  Platform::DataCache* GetDataCache( const std::string& fileName );
-
-private:
-
-  typedef std::pair< Platform::DataCache*, std::size_t /* hash value*/ >  TDataCachePair;
-  std::vector< TDataCachePair >mDataCaches;               ///< Vector of data caches, hash value
-  Integration::TextResourceType::TextQuality mQuality;    ///< The quality at which to render the glyph bitmaps
-  FT_LibraryRec_* mFreeTypeHandle;                        ///< Handle to the FreeType2 library
-
-}; // class ResourceThreadText
-
-} // namespace SlpPlatform
-
-} // namespace Dali
-
-#endif // __DALI_SLP_PLATFORM_RESOURCE_THREAD_TEXT_H__
index 188aced..a674aed 100644 (file)
@@ -29,8 +29,6 @@
 #include "resource-loader/resource-loader.h"
 #include "dynamics/dynamics-factory.h"
 
-#include "slp-font-configuration-parser.h"
-#include "data-cache/metrics-cache.h"
 #include "image-loaders/image-loader.h"
 
 namespace Dali
@@ -47,43 +45,19 @@ namespace SlpPlatform
 
 namespace
 {
-const std::string FONT_CONFIGURATION_FILE( FONT_CONFIGURATION_FILE_PATH ); ///< Default font configuration file
-const std::string DEFAULT_FONT_FAMILY( "HelveticaNeue" );                  ///< Default font family when unable to retrieve from font configuration file
-const std::string DEFAULT_FONT_STYLE( "Book" );                            ///< Default font style when unable to retrieve from font configuration file
-const std::string NULL_FONT_FAMILY_NAME( "" );
 const unsigned int NANOSECS_TO_MICROSECS( 1000 );                          ///< 1000 nanoseconds = 1 microsecond
-
-/// Settings to float point conversion table
-const float FONT_SIZE_TABLE[5] =
-{
-  8.0f,  ///< Small
-  10.0f, ///< Normal
-  15.0f, ///< Large
-  19.0f, ///< Huge
-  25.0f  ///< Giant
-};
 }
 
 SlpPlatformAbstraction::SlpPlatformAbstraction()
 : mResourceLoader(new ResourceLoader),
-  mDefaultFontSize(FONT_SIZE_TABLE[1]),
   mDynamicsFactory(NULL)
 {
-  int error = FT_Init_FreeType(&mFreeTypeHandle);
-  DALI_ASSERT_ALWAYS( error == 0 && "Freetype initialization failed" );
-
-  UpdateDefaultsFromDevice();
 }
 
 SlpPlatformAbstraction::~SlpPlatformAbstraction()
 {
   delete mResourceLoader;
   delete mDynamicsFactory;
-
-  if (mFreeTypeHandle)
-  {
-    FT_Done_FreeType(mFreeTypeHandle);
-  }
 }
 
 void SlpPlatformAbstraction::GetTimeMicroseconds(unsigned int &seconds, unsigned int &microSeconds)
@@ -110,65 +84,6 @@ void SlpPlatformAbstraction::Resume()
   }
 }
 
-const std::string& SlpPlatformAbstraction::GetDefaultFontFamily() const
-{
-  // VCC TODO: return default font style as well.
-  return mDefaultFontFamily;
-}
-
-float SlpPlatformAbstraction::GetDefaultFontSize() const
-{
-  return mDefaultFontSize;
-}
-
-PixelSize SlpPlatformAbstraction::GetFontLineHeightFromCapsHeight(const std::string& fontFamily, const std::string& fontStyle, CapsHeight capsHeight) const
-{
-  PixelSize result(0);
-
-  if (mResourceLoader)
-  {
-    result = mResourceLoader->GetFontLineHeightFromCapsHeight(fontFamily, fontStyle, capsHeight, mFreeTypeHandle);
-  }
-
-  return result;
-}
-
-Integration::GlyphSet* SlpPlatformAbstraction::GetGlyphData ( const Dali::Integration::TextResourceType& textRequest,
-                                                              const std::string& fontFamily,
-                                                              bool getBitmap) const
-{
-  if (mResourceLoader)
-  {
-    return mResourceLoader->GetGlyphData(textRequest,
-                                         mFreeTypeHandle,
-                                         fontFamily,
-                                         getBitmap);
-  }
-  return NULL;
-}
-
-Integration::GlyphSet* SlpPlatformAbstraction::GetCachedGlyphData( const Integration::TextResourceType& textRequest,
-                                                                   const std::string& fontFamily ) const
-{
-  if (mResourceLoader)
-  {
-    return mResourceLoader->GetCachedGlyphData( textRequest, fontFamily );
-  }
-  return NULL;
-}
-
-
-void SlpPlatformAbstraction::GetGlobalMetrics( const std::string& fontFamily, const std::string& fontStyle, Integration::GlobalMetrics& globalMetrics ) const
-{
-  if( mResourceLoader )
-  {
-    mResourceLoader->GetGlobalMetrics( mFreeTypeHandle,
-                                       fontFamily,
-                                       fontStyle,
-                                       globalMetrics );
-  }
-}
-
 void SlpPlatformAbstraction::GetClosestImageSize( const std::string& filename,
                                                   const ImageAttributes& attributes,
                                                   Vector2& closestSize )
@@ -242,48 +157,6 @@ void SlpPlatformAbstraction::SetDpi(unsigned int dpiHor, unsigned int dpiVer)
   }
 }
 
-const std::string& SlpPlatformAbstraction::GetFontFamilyForChars(const Integration::TextArray& charsRequested) const
-{
-  if( mResourceLoader )
-  {
-    return mResourceLoader->GetFontFamilyForChars(charsRequested);
-  }
-
-  return NULL_FONT_FAMILY_NAME;
-}
-
-bool SlpPlatformAbstraction::AllGlyphsSupported(const std::string &fontFamily, const std::string& fontStyle, const Integration::TextArray& charsRequested) const
-{
-  bool ret = false;
-  if (mResourceLoader)
-  {
-    ret = mResourceLoader->AllGlyphsSupported(fontFamily, fontStyle, charsRequested);
-  }
-  return ret;
-}
-
-bool SlpPlatformAbstraction::ValidateFontFamilyName(const std::string& fontFamily, const std::string& fontStyle, bool& isDefaultSystemFont, std::string& closestMatch, std::string& closestStyleMatch) const
-{
-  bool ret = false;
-  if( mResourceLoader )
-  {
-    // TODO: Consider retrieve both isDefaultSystemFontFamily and isDefaultSystemFontStyle.
-    bool isDefaultFamily = false;
-    bool isDefaultStyle = false;
-    ret = mResourceLoader->ValidateFontFamilyName( fontFamily, fontStyle, isDefaultFamily, isDefaultStyle, closestMatch, closestStyleMatch );
-    isDefaultSystemFont = isDefaultFamily && isDefaultStyle;
-  }
-  return ret;
-}
-
-void SlpPlatformAbstraction::GetFontList(  Dali::Integration::PlatformAbstraction::FontListMode mode, std::vector<std::string>& fontList ) const
-{
-  if( mResourceLoader )
-  {
-    mResourceLoader->GetFontList( mode, fontList );
-  }
-}
-
 bool SlpPlatformAbstraction::LoadFile( const std::string& filename, std::vector< unsigned char >& buffer ) const
 {
   bool result = false;
@@ -325,30 +198,6 @@ void SlpPlatformAbstraction::JoinLoaderThreads()
   mResourceLoader = NULL;
 }
 
-void SlpPlatformAbstraction::UpdateDefaultsFromDevice()
-{
-  // FontConfigurationParser::Parse sets the default font family and the default font style.
-  // If the isn't a configuration file or is invalid, or it doesn't have any tag with the default
-  // font family nor font style then default values set by the application are used.
-  mDefaultFontFamily = DEFAULT_FONT_FAMILY;
-  mDefaultFontStyle = DEFAULT_FONT_STYLE;
-
-  // The initialized values above are not used to parse the configuration file. These values
-  // are set just in case FontConfigurationParser::Parse is not able to set default values.
-  FontConfigurationParser::Parse(FONT_CONFIGURATION_FILE, mDefaultFontFamily, mDefaultFontStyle);
-
-  if ( mResourceLoader )
-  {
-    mResourceLoader->SetDefaultFontFamily( mDefaultFontFamily, mDefaultFontStyle );
-  }
-
-  int fontSize(0);
-#ifndef DALI_PROFILE_UBUNTU
-  vconf_get_int( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &fontSize );
-#endif // DALI_PROFILE_UBUNTU
-  mDefaultFontSize = FONT_SIZE_TABLE[fontSize];
-}
-
 Integration::DynamicsFactory* SlpPlatformAbstraction::GetDynamicsFactory()
 {
   if( NULL == mDynamicsFactory )
@@ -359,74 +208,6 @@ Integration::DynamicsFactory* SlpPlatformAbstraction::GetDynamicsFactory()
   return mDynamicsFactory;
 }
 
-bool SlpPlatformAbstraction::ReadGlobalMetricsFromCache( const std::string& fontFamily,
-                                                         const std::string& fontStyle,
-                                                         Integration::GlobalMetrics& globalMetrics )
-{
-  return MetricsCache::ReadGlobal( fontFamily, fontStyle, globalMetrics );
-}
-
-void SlpPlatformAbstraction::WriteGlobalMetricsToCache( const std::string& fontFamily,
-                                                        const std::string& fontStyle,
-                                                        const Integration::GlobalMetrics& globalMetrics )
-{
-  MetricsCache::WriteGlobal( fontFamily, fontStyle, globalMetrics);
-}
-
-bool SlpPlatformAbstraction::ReadMetricsFromCache( const std::string& fontFamily,
-                                                   const std::string& fontStyle,
-                                                   std::vector<Integration::GlyphMetrics>& glyphMetricsContainer )
-{
-  return MetricsCache::Read( fontFamily, fontStyle, glyphMetricsContainer );
-}
-
-void SlpPlatformAbstraction::WriteMetricsToCache( const std::string& fontFamily,
-                                                  const std::string& fontStyle,
-                                                  const Integration::GlyphSet& glyphSet )
-{
-  MetricsCache::Write( fontFamily, fontStyle, glyphSet );
-}
-
-void SlpPlatformAbstraction::GetFileNamesFromDirectory( const std::string& directoryName,
-                                                        std::vector<std::string>& fileNames )
-{
-  dirent* de = NULL;
-  DIR* dp;
-  dp = opendir( directoryName.c_str() );
-  if( dp )
-  {
-    const std::string dot( "." );
-    const std::string dotDot( ".." );
-    while( true )
-    {
-      de = readdir( dp );
-      if( de == NULL )
-      {
-        break;
-      }
-      const std::string fileName( de->d_name );
-      if( ( fileName != dot ) &&
-          ( fileName != dotDot ) )
-      {
-        fileNames.push_back( fileName );
-      }
-    }
-    closedir( dp );
-  }
-}
-
-Integration::BitmapPtr SlpPlatformAbstraction::GetGlyphImage( const std::string& fontFamily, const std::string& fontStyle, const float fontSize, const uint32_t character ) const
-{
-  Integration::BitmapPtr glyphImage;
-
-  if( mResourceLoader )
-  {
-    glyphImage = mResourceLoader->GetGlyphImage( mFreeTypeHandle, fontFamily, fontStyle, fontSize, character );
-  }
-
-  return glyphImage;
-}
-
 }  // namespace SlpPlatform
 
 }  // namespace Dali
index e32f979..3b1cea8 100644 (file)
@@ -22,8 +22,6 @@
 #include <dali/integration-api/resource-cache.h>
 #include <dali/public-api/common/dali-common.h>
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
 #include <string>
 
 namespace Dali
@@ -125,66 +123,11 @@ public: // PlatformAbstraction overrides
   virtual void JoinLoaderThreads();
 
   /**
-   *@copydoc PlatformAbstraction::GetDefaultFontFamily()
-   */
-  virtual const std::string& GetDefaultFontFamily() const;
-
-  /**
-   *@copydoc PlatformAbstraction::GetDefaultFontSize()
-   */
-  virtual float GetDefaultFontSize() const;
-
-  /**
-   *@copydoc PlatformAbstraction::GetFontLineHeightFromCapsHeight()
-   */
-  virtual PixelSize GetFontLineHeightFromCapsHeight(const std::string& fontFamily, const std::string& fontStyle, CapsHeight capsHeight) const;
-
-  /**
-   * @copydoc PlatformAbstraction::GetGlyphData()
-   */
-  virtual Integration::GlyphSet* GetGlyphData ( const Dali::Integration::TextResourceType& textRequest,
-                                                const std::string& fontFamily,
-                                                bool getBitmap) const;
-
-  /**
-   * @copydoc PlatformAbstraction::GetCachedGlyphData()
-   */
-  virtual Integration::GlyphSet* GetCachedGlyphData( const Integration::TextResourceType& textRequest,
-                                                     const std::string& fontFamily ) const;
-
-  /**
-   * @copydoc PlatformAbstraction::GetGlobalMetrics()
-   */
-  virtual void GetGlobalMetrics( const std::string& fontFamily,
-                                 const std::string& fontStyle,
-                                 Integration::GlobalMetrics& globalMetrics ) const;
-
-  /**
    * @copydoc PlatformAbstraction::SetDpi()
    */
   virtual void SetDpi (unsigned int DpiHorizontal, unsigned int DpiVertical);
 
   /**
-   * @copydoc PlatformAbstraction::GetFontFamilyForChars()
-   */
-  const std::string& GetFontFamilyForChars(const Integration::TextArray& charsRequested) const;
-
-  /**
-   * @copydoc PlatformAbstraction::AllGlyphsSupported()
-   */
-  bool AllGlyphsSupported(const std::string &fontFamily, const std::string& fontStyle, const Integration::TextArray& charsRequested) const;
-
-  /**
-   * @copydoc PlatformAbstraction::ValidateFontFamilyName()
-   */
-  virtual bool ValidateFontFamilyName( const std::string& fontFamily, const std::string& fontStyle, bool& isDefaultSystemFont, std::string& closestMatch, std::string& closestStyleMatch) const;
-
-  /**
-   * @copydoc PlatformAbstraction::GetFontList()
-   */
-  virtual void GetFontList ( Dali::Integration::PlatformAbstraction::FontListMode mode, std::vector<std::string>& fontList ) const;
-
-  /**
    * @copydoc PlatformAbstraction::LoadFile()
    */
   virtual bool LoadFile( const std::string& filename, std::vector< unsigned char >& buffer ) const;
@@ -200,61 +143,12 @@ public: // PlatformAbstraction overrides
   virtual bool SaveFile(const std::string& filename, std::vector< unsigned char >& buffer) const;
 
   /**
-   * @copydoc PlatformAbstraction::UpdateDefaultsFromDevice();
-   */
-  virtual void UpdateDefaultsFromDevice();
-
-  /**
    * @copydoc PlatformAbstraction::GetDynamicsFactory();
    */
   virtual Integration::DynamicsFactory* GetDynamicsFactory();
 
-  /**
-   * @copydoc PlatformAbstraction::ReadGlobalMetricsFromCacheFile
-   */
-  virtual bool ReadGlobalMetricsFromCache( const std::string& fontFamily,
-                                           const std::string& fontStyle,
-                                           Integration::GlobalMetrics& globalMetrics );
-
-  /**
-   * @copydoc PlatformAbstraction::WriteGlobalMetricsToCacheFile
-   */
-  virtual void WriteGlobalMetricsToCache( const std::string& fontFamily,
-                                          const std::string& fontStyle,
-                                          const Integration::GlobalMetrics& globalMetrics );
-
-  /**
-   * @copydoc PlatformAbstraction::ReadMetricsFromCacheFile
-   */
-  virtual bool ReadMetricsFromCache( const std::string& fontFamily,
-                                     const std::string& fontStyle,
-                                     std::vector<Integration::GlyphMetrics>& glyphMetricsContainer );
-
-  /**
-   * @copydoc PlatformAbstraction::WriteMetricsToCacheFile
-   */
-  virtual void WriteMetricsToCache( const std::string& fontFamily,
-                                    const std::string& fontStyle,
-                                    const Integration::GlyphSet& glyphSet );
-
-  /**
-   * @copydoc PlatformAbstraction::GetFileNamesFromDirectory()
-   */
-  virtual void GetFileNamesFromDirectory( const std::string& directoryName,
-                                          std::vector<std::string>& fileNames );
-
-  /**
-   * @copydoc PlatformAbstraction::GetGlyphImage()
-   */
-  virtual Integration::BitmapPtr GetGlyphImage( const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character ) const;
-
 private:
   ResourceLoader* mResourceLoader;
-  FT_Library mFreeTypeHandle;       ///< Freetype library
-  std::string mDefaultFontFamily;
-  std::string mDefaultFontStyle;
-  float mDefaultFontSize;
-  std::string mDefaultThemeFile;
   DynamicsFactory* mDynamicsFactory;
 };
 
diff --git a/text/dali/internal/libunibreak/AUTHORS b/text/dali/internal/libunibreak/AUTHORS
new file mode 100644 (file)
index 0000000..1b4f4b4
--- /dev/null
@@ -0,0 +1,11 @@
+Wu Yongwei.  Designed and implemented the original liblinebreak.
+Current maintainer of libunibreak.
+
+Nikolay Pultsin.  Put forward the original requirements on liblinebreak,
+performed tests, and made a lot of suggestions on the initial versions.
+
+Thomas Klausner.  Autoconfiscated and libtoolized liblinebreak.
+
+Tom Hacohen.  Added word boundaries support.
+
+Petr Filipsky.  Added incremental processing for line-breaking.
diff --git a/text/dali/internal/libunibreak/LICENCE b/text/dali/internal/libunibreak/LICENCE
new file mode 100644 (file)
index 0000000..ceec155
--- /dev/null
@@ -0,0 +1,19 @@
+Copyright (C) 2008-2012 Wu Yongwei <wuyongwei at gmail dot com>
+Copyright (C) 2012 Tom Hacohen <tom dot hacohen at samsung dot com>
+
+This software is provided 'as-is', without any express or implied
+warranty.  In no event will the author be held liable for any damages
+arising from the use of this software.
+
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it
+freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must not
+   claim that you wrote the original software.  If you use this software
+   in a product, an acknowledgement in the product documentation would
+   be appreciated but is not required.
+2. Altered source versions must be plainly marked as such, and must not
+   be misrepresented as being the original software.
+3. This notice may not be removed or altered from any source
+   distribution.
diff --git a/text/dali/internal/libunibreak/README.md b/text/dali/internal/libunibreak/README.md
new file mode 100644 (file)
index 0000000..52cd738
--- /dev/null
@@ -0,0 +1,87 @@
+LIBUNIBREAK
+===========
+
+Overview
+--------
+
+This is the README file for libunibreak, an implementation of the line
+breaking and word breaking algorithms as described in [Unicode Standard
+Annex 14] [1] and [Unicode Standard Annex 29] [2].  Check the project's
+[home page] [3] for up-to-date information.
+
+  [1]: http://www.unicode.org/reports/tr14/tr14-30.html
+  [2]: http://www.unicode.org/reports/tr29/tr29-21.html
+  [3]: https://github.com/adah1972/libunibreak
+
+
+Licence
+-------
+
+This library is released under an open-source licence, the zlib/libpng
+licence.  Please check the file *LICENCE* for details.
+
+Apart from using the algorithm, part of the code is derived from the
+[Unicode Public Data] [4], and the [Unicode Terms of Use] [5] may apply.
+
+  [4]: http://www.unicode.org/Public/
+  [5]: http://www.unicode.org/copyright.html
+
+
+Installation
+------------
+
+There are three ways to build the library:
+
+1. On \*NIX systems supported by the autoconfiscation tools, do the
+   normal
+
+        ./configure
+        make
+        sudo make install
+
+   to build and install both the dynamic and static libraries.  In
+   addition, one may
+   - type `make doc` to generate the doxygen documentation; or
+   - type `make linebreakdata` to regenerate *linebreakdata.c* from
+     *LineBreak.txt*.
+   - type `make wordbreakdata` to regenerate *wordbreakdata.c* from
+     *WordBreakProperty.txt*.
+
+2. On systems where GCC and Binutils are supported, one can type
+
+        cd src
+        cp -p Makefile.gcc Makefile
+        make
+
+   to build the static library.  In addition, one may
+   - type `make debug` or `make release` to explicitly generate the
+     debug or release build;
+   - type `make doc` to generate the doxygen documentation; or
+   - type `make linebreakdata` to regenerate *linebreakdata.c* from
+     *LineBreak.txt*.
+   - type `make wordbreakdata` to regenerate *wordbreakdata.c* from
+     *WordBreakProperty.txt*.
+
+3. On Windows, apart from using method 1 (Cygwin/MSYS) and method 2
+   (MinGW), MSVC can also be used.  Type
+
+        cd src
+        nmake -f Makefile.msvc
+
+   to build the static library.  By default the debug release is built.
+   To build the release version
+
+        nmake -f Makefile.msvc CFG="libunibreak - Win32 Release"
+
+
+Documentation
+-------------
+
+Check the generated document *doc/html/linebreak\_8h.html* and
+*doc/html/wordbreak\_8h.html* in the downloaded file for the public
+interfaces exposed to applications.
+
+
+<!--
+vim:autoindent:expandtab:formatoptions=tcqlmn:textwidth=72:
+-->
diff --git a/text/dali/internal/libunibreak/file.list b/text/dali/internal/libunibreak/file.list
new file mode 100644 (file)
index 0000000..d6b28ad
--- /dev/null
@@ -0,0 +1,7 @@
+# Add local source files here:
+
+static_libraries_libunibreak_src_files = \
+  $(static_libraries_libunibreak_src_dir)/linebreak.c \
+  $(static_libraries_libunibreak_src_dir)/linebreakdata.c \
+  $(static_libraries_libunibreak_src_dir)/linebreakdef.c \
+  $(static_libraries_libunibreak_src_dir)/wordbreak.c
diff --git a/text/dali/internal/libunibreak/linebreak.c b/text/dali/internal/libunibreak/linebreak.c
new file mode 100644 (file)
index 0000000..4e13247
--- /dev/null
@@ -0,0 +1,848 @@
+/* vim: set tabstop=4 shiftwidth=4: */
+
+/*
+ * Line breaking in a Unicode sequence.  Designed to be used in a
+ * generic text renderer.
+ *
+ * Copyright (C) 2008-2010 Wu Yongwei <wuyongwei at gmail dot com>
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty.  In no event will the author be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute
+ * it freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must
+ *    not claim that you wrote the original software.  If you use this
+ *    software in a product, an acknowledgement in the product
+ *    documentation would be appreciated but is not required.
+ * 2. Altered source versions must be plainly marked as such, and must
+ *    not be misrepresented as being the original software.
+ * 3. This notice may not be removed or altered from any source
+ *    distribution.
+ *
+ * The main reference is Unicode Standard Annex 14 (UAX #14):
+ *             <URL:http://www.unicode.org/reports/tr14/>
+ *
+ * When this library was designed, this annex was at Revision 19, for
+ * Unicode 5.0.0:
+ *             <URL:http://www.unicode.org/reports/tr14/tr14-19.html>
+ *
+ * This library has been updated according to Revision 24, for
+ * Unicode 5.2.0:
+ *             <URL:http://www.unicode.org/reports/tr14/tr14-24.html>
+ *
+ * The Unicode Terms of Use are available at
+ *             <URL:http://www.unicode.org/copyright.html>
+ */
+
+/**
+ * @file       linebreak.c
+ *
+ * Implementation of the line breaking algorithm as described in Unicode
+ * Standard Annex 14.
+ *
+ * @version    2.0, 2010/01/03
+ * @author     Wu Yongwei
+ */
+
+#include <assert.h>
+#include <stddef.h>
+#include <string.h>
+#include "linebreak.h"
+#include "linebreakdef.h"
+
+/**
+ * Size of the second-level index to the line breaking properties.
+ */
+#define LINEBREAK_INDEX_SIZE 40
+
+/**
+ * Version number of the library.
+ */
+const int linebreak_version = LINEBREAK_VERSION;
+
+/**
+ * Enumeration of break actions.  They are used in the break action
+ * pair table below.
+ */
+enum BreakAction
+{
+       DIR_BRK,                /**< Direct break opportunity */
+       IND_BRK,                /**< Indirect break opportunity */
+       CMI_BRK,                /**< Indirect break opportunity for combining marks */
+       CMP_BRK,                /**< Prohibited break for combining marks */
+       PRH_BRK                 /**< Prohibited break */
+};
+
+/**
+ * Break action pair table.  This is a direct mapping of Table 2 of
+ * Unicode Standard Annex 14, Revision 24.
+ */
+static enum BreakAction baTable[LBP_JT][LBP_JT] = {
+       {       /* OP */
+               PRH_BRK, PRH_BRK, PRH_BRK, PRH_BRK, PRH_BRK, PRH_BRK, PRH_BRK,
+               PRH_BRK, PRH_BRK, PRH_BRK, PRH_BRK, PRH_BRK, PRH_BRK, PRH_BRK,
+               PRH_BRK, PRH_BRK, PRH_BRK, PRH_BRK, PRH_BRK, PRH_BRK, CMP_BRK,
+               PRH_BRK, PRH_BRK, PRH_BRK, PRH_BRK, PRH_BRK, PRH_BRK },
+       {       /* CL */
+               DIR_BRK, PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, PRH_BRK, PRH_BRK,
+               PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, DIR_BRK, DIR_BRK, DIR_BRK,
+               DIR_BRK, IND_BRK, IND_BRK, DIR_BRK, DIR_BRK, PRH_BRK, CMI_BRK,
+               PRH_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK },
+       {       /* CP */
+               DIR_BRK, PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, PRH_BRK, PRH_BRK,
+               PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, IND_BRK, IND_BRK, DIR_BRK,
+               DIR_BRK, IND_BRK, IND_BRK, DIR_BRK, DIR_BRK, PRH_BRK, CMI_BRK,
+               PRH_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK },
+       {       /* QU */
+               PRH_BRK, PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, IND_BRK, PRH_BRK,
+               PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, IND_BRK, IND_BRK, IND_BRK,
+               IND_BRK, IND_BRK, IND_BRK, IND_BRK, IND_BRK, PRH_BRK, CMI_BRK,
+               PRH_BRK, IND_BRK, IND_BRK, IND_BRK, IND_BRK, IND_BRK },
+       {       /* GL */
+               IND_BRK, PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, IND_BRK, PRH_BRK,
+               PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, IND_BRK, IND_BRK, IND_BRK,
+               IND_BRK, IND_BRK, IND_BRK, IND_BRK, IND_BRK, PRH_BRK, CMI_BRK,
+               PRH_BRK, IND_BRK, IND_BRK, IND_BRK, IND_BRK, IND_BRK },
+       {       /* NS */
+               DIR_BRK, PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, IND_BRK, PRH_BRK,
+               PRH_BRK, PRH_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK,
+               DIR_BRK, IND_BRK, IND_BRK, DIR_BRK, DIR_BRK, PRH_BRK, CMI_BRK,
+               PRH_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK },
+       {       /* EX */
+               DIR_BRK, PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, IND_BRK, PRH_BRK,
+               PRH_BRK, PRH_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK,
+               DIR_BRK, IND_BRK, IND_BRK, DIR_BRK, DIR_BRK, PRH_BRK, CMI_BRK,
+               PRH_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK },
+       {       /* SY */
+               DIR_BRK, PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, IND_BRK, PRH_BRK,
+               PRH_BRK, PRH_BRK, DIR_BRK, DIR_BRK, IND_BRK, DIR_BRK, DIR_BRK,
+               DIR_BRK, IND_BRK, IND_BRK, DIR_BRK, DIR_BRK, PRH_BRK, CMI_BRK,
+               PRH_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK },
+       {       /* IS */
+               DIR_BRK, PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, IND_BRK, PRH_BRK,
+               PRH_BRK, PRH_BRK, DIR_BRK, DIR_BRK, IND_BRK, IND_BRK, DIR_BRK,
+               DIR_BRK, IND_BRK, IND_BRK, DIR_BRK, DIR_BRK, PRH_BRK, CMI_BRK,
+               PRH_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK },
+       {       /* PR */
+               IND_BRK, PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, IND_BRK, PRH_BRK,
+               PRH_BRK, PRH_BRK, DIR_BRK, DIR_BRK, IND_BRK, IND_BRK, IND_BRK,
+               DIR_BRK, IND_BRK, IND_BRK, DIR_BRK, DIR_BRK, PRH_BRK, CMI_BRK,
+               PRH_BRK, IND_BRK, IND_BRK, IND_BRK, IND_BRK, IND_BRK },
+       {       /* PO */
+               IND_BRK, PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, IND_BRK, PRH_BRK,
+               PRH_BRK, PRH_BRK, DIR_BRK, DIR_BRK, IND_BRK, IND_BRK, DIR_BRK,
+               DIR_BRK, IND_BRK, IND_BRK, DIR_BRK, DIR_BRK, PRH_BRK, CMI_BRK,
+               PRH_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK },
+       {       /* NU */
+               IND_BRK, PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, IND_BRK, PRH_BRK,
+               PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, IND_BRK, IND_BRK, DIR_BRK,
+               IND_BRK, IND_BRK, IND_BRK, DIR_BRK, DIR_BRK, PRH_BRK, CMI_BRK,
+               PRH_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK },
+       {       /* AL */
+               IND_BRK, PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, IND_BRK, PRH_BRK,
+               PRH_BRK, PRH_BRK, DIR_BRK, DIR_BRK, IND_BRK, IND_BRK, DIR_BRK,
+               IND_BRK, IND_BRK, IND_BRK, DIR_BRK, DIR_BRK, PRH_BRK, CMI_BRK,
+               PRH_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK },
+       {       /* ID */
+               DIR_BRK, PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, IND_BRK, PRH_BRK,
+               PRH_BRK, PRH_BRK, DIR_BRK, IND_BRK, DIR_BRK, DIR_BRK, DIR_BRK,
+               IND_BRK, IND_BRK, IND_BRK, DIR_BRK, DIR_BRK, PRH_BRK, CMI_BRK,
+               PRH_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK },
+       {       /* IN */
+               DIR_BRK, PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, IND_BRK, PRH_BRK,
+               PRH_BRK, PRH_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK,
+               IND_BRK, IND_BRK, IND_BRK, DIR_BRK, DIR_BRK, PRH_BRK, CMI_BRK,
+               PRH_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK },
+       {       /* HY */
+               DIR_BRK, PRH_BRK, PRH_BRK, IND_BRK, DIR_BRK, IND_BRK, PRH_BRK,
+               PRH_BRK, PRH_BRK, DIR_BRK, DIR_BRK, IND_BRK, DIR_BRK, DIR_BRK,
+               DIR_BRK, IND_BRK, IND_BRK, DIR_BRK, DIR_BRK, PRH_BRK, CMI_BRK,
+               PRH_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK },
+       {       /* BA */
+               DIR_BRK, PRH_BRK, PRH_BRK, IND_BRK, DIR_BRK, IND_BRK, PRH_BRK,
+               PRH_BRK, PRH_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK,
+               DIR_BRK, IND_BRK, IND_BRK, DIR_BRK, DIR_BRK, PRH_BRK, CMI_BRK,
+               PRH_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK },
+       {       /* BB */
+               IND_BRK, PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, IND_BRK, PRH_BRK,
+               PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, IND_BRK, IND_BRK, IND_BRK,
+               IND_BRK, IND_BRK, IND_BRK, IND_BRK, IND_BRK, PRH_BRK, CMI_BRK,
+               PRH_BRK, IND_BRK, IND_BRK, IND_BRK, IND_BRK, IND_BRK },
+       {       /* B2 */
+               DIR_BRK, PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, IND_BRK, PRH_BRK,
+               PRH_BRK, PRH_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK,
+               DIR_BRK, IND_BRK, IND_BRK, DIR_BRK, PRH_BRK, PRH_BRK, CMI_BRK,
+               PRH_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK },
+       {       /* ZW */
+               DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK,
+               DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK,
+               DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, PRH_BRK, DIR_BRK,
+               DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK },
+       {       /* CM */
+               IND_BRK, PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, IND_BRK, PRH_BRK,
+               PRH_BRK, PRH_BRK, DIR_BRK, DIR_BRK, IND_BRK, IND_BRK, DIR_BRK,
+               IND_BRK, IND_BRK, IND_BRK, DIR_BRK, DIR_BRK, PRH_BRK, CMI_BRK,
+               PRH_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK },
+       {       /* WJ */
+               IND_BRK, PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, IND_BRK, PRH_BRK,
+               PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, IND_BRK, IND_BRK, IND_BRK,
+               IND_BRK, IND_BRK, IND_BRK, IND_BRK, IND_BRK, PRH_BRK, CMI_BRK,
+               PRH_BRK, IND_BRK, IND_BRK, IND_BRK, IND_BRK, IND_BRK },
+       {       /* H2 */
+               DIR_BRK, PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, IND_BRK, PRH_BRK,
+               PRH_BRK, PRH_BRK, DIR_BRK, IND_BRK, DIR_BRK, DIR_BRK, DIR_BRK,
+               IND_BRK, IND_BRK, IND_BRK, DIR_BRK, DIR_BRK, PRH_BRK, CMI_BRK,
+               PRH_BRK, DIR_BRK, DIR_BRK, DIR_BRK, IND_BRK, IND_BRK },
+       {       /* H3 */
+               DIR_BRK, PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, IND_BRK, PRH_BRK,
+               PRH_BRK, PRH_BRK, DIR_BRK, IND_BRK, DIR_BRK, DIR_BRK, DIR_BRK,
+               IND_BRK, IND_BRK, IND_BRK, DIR_BRK, DIR_BRK, PRH_BRK, CMI_BRK,
+               PRH_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, IND_BRK },
+       {       /* JL */
+               DIR_BRK, PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, IND_BRK, PRH_BRK,
+               PRH_BRK, PRH_BRK, DIR_BRK, IND_BRK, DIR_BRK, DIR_BRK, DIR_BRK,
+               IND_BRK, IND_BRK, IND_BRK, DIR_BRK, DIR_BRK, PRH_BRK, CMI_BRK,
+               PRH_BRK, IND_BRK, IND_BRK, IND_BRK, IND_BRK, DIR_BRK },
+       {       /* JV */
+               DIR_BRK, PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, IND_BRK, PRH_BRK,
+               PRH_BRK, PRH_BRK, DIR_BRK, IND_BRK, DIR_BRK, DIR_BRK, DIR_BRK,
+               IND_BRK, IND_BRK, IND_BRK, DIR_BRK, DIR_BRK, PRH_BRK, CMI_BRK,
+               PRH_BRK, DIR_BRK, DIR_BRK, DIR_BRK, IND_BRK, IND_BRK },
+       {       /* JT */
+               DIR_BRK, PRH_BRK, PRH_BRK, IND_BRK, IND_BRK, IND_BRK, PRH_BRK,
+               PRH_BRK, PRH_BRK, DIR_BRK, IND_BRK, DIR_BRK, DIR_BRK, DIR_BRK,
+               IND_BRK, IND_BRK, IND_BRK, DIR_BRK, DIR_BRK, PRH_BRK, CMI_BRK,
+               PRH_BRK, DIR_BRK, DIR_BRK, DIR_BRK, DIR_BRK, IND_BRK }
+};
+
+/**
+ * Struct for the second-level index to the line breaking properties.
+ */
+struct LineBreakPropertiesIndex
+{
+       utf32_t end;                                    /**< End coding point */
+       struct LineBreakProperties *lbp;/**< Pointer to line breaking properties */
+};
+
+/**
+ * Second-level index to the line breaking properties.
+ */
+static struct LineBreakPropertiesIndex lb_prop_index[LINEBREAK_INDEX_SIZE] =
+{
+       { 0xFFFFFFFF, lb_prop_default }
+};
+
+/**
+ * Initializes the second-level index to the line breaking properties.
+ * If it is not called, the performance of #get_char_lb_class_lang (and
+ * thus the main functionality) can be pretty bad, especially for big
+ * code points like those of Chinese.
+ */
+void init_linebreak(void)
+{
+       size_t i;
+       size_t iPropDefault;
+       size_t len;
+       size_t step;
+
+       len = 0;
+       while (lb_prop_default[len].prop != LBP_Undefined)
+               ++len;
+       step = len / LINEBREAK_INDEX_SIZE;
+       iPropDefault = 0;
+       for (i = 0; i < LINEBREAK_INDEX_SIZE; ++i)
+       {
+               lb_prop_index[i].lbp = lb_prop_default + iPropDefault;
+               iPropDefault += step;
+               lb_prop_index[i].end = lb_prop_default[iPropDefault].start - 1;
+       }
+       lb_prop_index[--i].end = 0xFFFFFFFF;
+}
+
+/**
+ * Gets the language-specific line breaking properties.
+ *
+ * @param lang language of the text
+ * @return             pointer to the language-specific line breaking
+ *                             properties array if found; \c NULL otherwise
+ */
+static struct LineBreakProperties *get_lb_prop_lang(const char *lang)
+{
+       struct LineBreakPropertiesLang *lbplIter;
+       if (lang != NULL)
+       {
+               for (lbplIter = lb_prop_lang_map; lbplIter->lang != NULL; ++lbplIter)
+               {
+                       if (strncmp(lang, lbplIter->lang, lbplIter->namelen) == 0)
+                       {
+                               return lbplIter->lbp;
+                       }
+               }
+       }
+       return NULL;
+}
+
+/**
+ * Gets the line breaking class of a character from a line breaking
+ * properties array.
+ *
+ * @param ch   character to check
+ * @param lbp  pointer to the line breaking properties array
+ * @return             the line breaking class if found; \c LBP_XX otherwise
+ */
+static enum LineBreakClass get_char_lb_class(
+               utf32_t ch,
+               struct LineBreakProperties *lbp)
+{
+       while (lbp->prop != LBP_Undefined && ch >= lbp->start)
+       {
+               if (ch <= lbp->end)
+                       return lbp->prop;
+               ++lbp;
+       }
+       return LBP_XX;
+}
+
+/**
+ * Gets the line breaking class of a character from the default line
+ * breaking properties array.
+ *
+ * @param ch   character to check
+ * @return             the line breaking class if found; \c LBP_XX otherwise
+ */
+static enum LineBreakClass get_char_lb_class_default(
+               utf32_t ch)
+{
+       size_t i = 0;
+       while (ch > lb_prop_index[i].end)
+               ++i;
+       assert(i < LINEBREAK_INDEX_SIZE);
+       return get_char_lb_class(ch, lb_prop_index[i].lbp);
+}
+
+/**
+ * Gets the line breaking class of a character for a specific
+ * language.  This function will check the language-specific data first,
+ * and then the default data if there is no language-specific property
+ * available for the character.
+ *
+ * @param ch           character to check
+ * @param lbpLang      pointer to the language-specific line breaking
+ *                                     properties array
+ * @return                     the line breaking class if found; \c LBP_XX
+ *                                     otherwise
+ */
+static enum LineBreakClass get_char_lb_class_lang(
+               utf32_t ch,
+               struct LineBreakProperties *lbpLang)
+{
+       enum LineBreakClass lbcResult;
+
+       /* Find the language-specific line breaking class for a character */
+       if (lbpLang)
+       {
+               lbcResult = get_char_lb_class(ch, lbpLang);
+               if (lbcResult != LBP_XX)
+                       return lbcResult;
+       }
+
+       /* Find the generic language-specific line breaking class, if no
+        * language context is provided, or language-specific data are not
+        * available for the specific character in the specified language */
+       return get_char_lb_class_default(ch);
+}
+
+/**
+ * Resolves the line breaking class for certain ambiguous or complicated
+ * characters.  They are treated in a simplistic way in this
+ * implementation.
+ *
+ * @param lbc  line breaking class to resolve
+ * @param lang language of the text
+ * @return             the resolved line breaking class
+ */
+static enum LineBreakClass resolve_lb_class(
+               enum LineBreakClass lbc,
+               const char *lang)
+{
+       switch (lbc)
+       {
+       case LBP_AI:
+               if (lang != NULL &&
+                               (strncmp(lang, "zh", 2) == 0 || /* Chinese */
+                                strncmp(lang, "ja", 2) == 0 || /* Japanese */
+                                strncmp(lang, "ko", 2) == 0))  /* Korean */
+               {
+                       return LBP_ID;
+               }
+               /* Fall through */
+       case LBP_SA:
+       case LBP_SG:
+       case LBP_XX:
+               return LBP_AL;
+       default:
+               return lbc;
+       }
+}
+
+/**
+ * Gets the next Unicode character in a UTF-8 sequence.  The index will
+ * be advanced to the next complete character, unless the end of string
+ * is reached in the middle of a UTF-8 sequence.
+ *
+ * @param[in]     s            input UTF-8 string
+ * @param[in]     len  length of the string in bytes
+ * @param[in,out] ip   pointer to the index
+ * @return                             the Unicode character beginning at the index; or
+ *                                             #EOS if end of input is encountered
+ */
+utf32_t lb_get_next_char_utf8(
+               const utf8_t *s,
+               size_t len,
+               size_t *ip)
+{
+       utf8_t ch;
+       utf32_t res;
+
+       assert(*ip <= len);
+       if (*ip == len)
+               return EOS;
+       ch = s[*ip];
+
+       if (ch < 0xC2 || ch > 0xF4)
+       {       /* One-byte sequence, tail (should not occur), or invalid */
+               *ip += 1;
+               return ch;
+       }
+       else if (ch < 0xE0)
+       {       /* Two-byte sequence */
+               if (*ip + 2 > len)
+                       return EOS;
+               res = ((ch & 0x1F) << 6) + (s[*ip + 1] & 0x3F);
+               *ip += 2;
+               return res;
+       }
+       else if (ch < 0xF0)
+       {       /* Three-byte sequence */
+               if (*ip + 3 > len)
+                       return EOS;
+               res = ((ch & 0x0F) << 12) +
+                         ((s[*ip + 1] & 0x3F) << 6) +
+                         ((s[*ip + 2] & 0x3F));
+               *ip += 3;
+               return res;
+       }
+       else
+       {       /* Four-byte sequence */
+               if (*ip + 4 > len)
+                       return EOS;
+               res = ((ch & 0x07) << 18) +
+                         ((s[*ip + 1] & 0x3F) << 12) +
+                         ((s[*ip + 2] & 0x3F) << 6) +
+                         ((s[*ip + 3] & 0x3F));
+               *ip += 4;
+               return res;
+       }
+}
+
+/**
+ * Gets the next Unicode character in a UTF-16 sequence.  The index will
+ * be advanced to the next complete character, unless the end of string
+ * is reached in the middle of a UTF-16 surrogate pair.
+ *
+ * @param[in]     s            input UTF-16 string
+ * @param[in]     len  length of the string in words
+ * @param[in,out] ip   pointer to the index
+ * @return                             the Unicode character beginning at the index; or
+ *                                             #EOS if end of input is encountered
+ */
+utf32_t lb_get_next_char_utf16(
+               const utf16_t *s,
+               size_t len,
+               size_t *ip)
+{
+       utf16_t ch;
+
+       assert(*ip <= len);
+       if (*ip == len)
+               return EOS;
+       ch = s[(*ip)++];
+
+       if (ch < 0xD800 || ch > 0xDBFF)
+       {       /* If the character is not a high surrogate */
+               return ch;
+       }
+       if (*ip == len)
+       {       /* If the input ends here (an error) */
+               --(*ip);
+               return EOS;
+       }
+       if (s[*ip] < 0xDC00 || s[*ip] > 0xDFFF)
+       {       /* If the next character is not the low surrogate (an error) */
+               return ch;
+       }
+       /* Return the constructed character and advance the index again */
+       return (((utf32_t)ch & 0x3FF) << 10) + (s[(*ip)++] & 0x3FF) + 0x10000;
+}
+
+/**
+ * Gets the next Unicode character in a UTF-32 sequence.  The index will
+ * be advanced to the next character.
+ *
+ * @param[in]     s            input UTF-32 string
+ * @param[in]     len  length of the string in dwords
+ * @param[in,out] ip   pointer to the index
+ * @return                             the Unicode character beginning at the index; or
+ *                                             #EOS if end of input is encountered
+ */
+utf32_t lb_get_next_char_utf32(
+               const utf32_t *s,
+               size_t len,
+               size_t *ip)
+{
+       assert(*ip <= len);
+       if (*ip == len)
+               return EOS;
+       return s[(*ip)++];
+}
+
+/**
+ * Sets the line breaking information for a generic input string.
+ *
+ * @param[in]  s                       input string
+ * @param[in]  len                     length of the input
+ * @param[in]  lang                    language of the input
+ * @param[out] brks                    pointer to the output breaking data,
+ *                                                     containing #LINEBREAK_MUSTBREAK,
+ *                                                     #LINEBREAK_ALLOWBREAK, #LINEBREAK_NOBREAK,
+ *                                                     or #LINEBREAK_INSIDEACHAR
+ * @param[in] get_next_char    function to get the next UTF-32 character
+ */
+void set_linebreaks(
+               const void *s,
+               size_t len,
+               const char *lang,
+               char *brks,
+               get_next_char_t get_next_char)
+{
+       utf32_t ch;
+       enum LineBreakClass lbcCur;
+       enum LineBreakClass lbcNew;
+       enum LineBreakClass lbcLast;
+       struct LineBreakProperties *lbpLang;
+       size_t posCur = 0;
+       size_t posLast = 0;
+       // TIZEN ONLY : (2013.08.19) for special processing at Zero-width space character
+       int zw_flag = 0;
+       //
+
+       --posLast;      /* To be ++'d later */
+       ch = get_next_char(s, len, &posCur);
+       if (ch == EOS)
+               return;
+       lbpLang = get_lb_prop_lang(lang);
+       lbcCur = resolve_lb_class(get_char_lb_class_lang(ch, lbpLang), lang);
+       lbcNew = LBP_Undefined;
+
+nextline:
+
+       /* Special treatment for the first character */
+       switch (lbcCur)
+       {
+       case LBP_LF:
+       case LBP_NL:
+               lbcCur = LBP_BK;
+               break;
+       case LBP_CB:
+               lbcCur = LBP_BA;
+               break;
+       case LBP_SP:
+               lbcCur = LBP_WJ;
+               break;
+       default:
+               break;
+       }
+
+       /* Process a line till an explicit break or end of string */
+       for (;;)
+       {
+               for (++posLast; posLast < posCur - 1; ++posLast)
+               {
+                       brks[posLast] = LINEBREAK_INSIDEACHAR;
+               }
+               assert(posLast == posCur - 1);
+               lbcLast = lbcNew;
+               ch = get_next_char(s, len, &posCur);
+               if (ch == EOS)
+                       break;
+               lbcNew = get_char_lb_class_lang(ch, lbpLang);
+               if (lbcCur == LBP_BK || (lbcCur == LBP_CR && lbcNew != LBP_LF))
+               {
+                       brks[posLast] = LINEBREAK_MUSTBREAK;
+                       lbcCur = resolve_lb_class(lbcNew, lang);
+                       goto nextline;
+               }
+
+               // TIZEN ONLY : (2013.08.19) for special processing at Zero-width space character
+               /*
+               switch (lbcNew)
+               {
+               case LBP_SP:
+                       brks[posLast] = LINEBREAK_NOBREAK;
+                       continue;
+               case LBP_BK:
+               case LBP_LF:
+               case LBP_NL:
+                       brks[posLast] = LINEBREAK_NOBREAK;
+                       lbcCur = LBP_BK;
+                       continue;
+               case LBP_CR:
+                       brks[posLast] = LINEBREAK_NOBREAK;
+                       lbcCur = LBP_CR;
+                       continue;
+               case LBP_CB:
+                       brks[posLast] = LINEBREAK_ALLOWBREAK;
+                       lbcCur = LBP_BA;
+                       continue;
+               default:
+                       break;
+               }
+
+               lbcNew = resolve_lb_class(lbcNew, lang);
+
+               assert(lbcCur <= LBP_JT);
+               assert(lbcNew <= LBP_JT);
+               switch (baTable[lbcCur - 1][lbcNew - 1])
+               {
+               case DIR_BRK:
+                       brks[posLast] = LINEBREAK_ALLOWBREAK;
+                       break;
+               case CMI_BRK:
+               case IND_BRK:
+                       if (lbcLast == LBP_SP)
+                       {
+                               brks[posLast] = LINEBREAK_ALLOWBREAK;
+                       }
+                       else
+                       {
+                               brks[posLast] = LINEBREAK_NOBREAK;
+                       }
+                       break;
+               case CMP_BRK:
+                       brks[posLast] = LINEBREAK_NOBREAK;
+                       if (lbcLast != LBP_SP)
+                               continue;
+                       break;
+               case PRH_BRK:
+                       brks[posLast] = LINEBREAK_NOBREAK;
+                       break;
+               }
+
+               lbcCur = lbcNew;
+               */
+
+               // TIZEN ONLY - START
+               if (lbcCur == LBP_ZW && !zw_flag)
+               {
+                       zw_flag = 1;
+                       posLast = -1;
+                       posCur = 0;
+                       ch = get_next_char(s, len, &posCur);
+                       lbcCur = resolve_lb_class(get_char_lb_class_lang(ch, lbpLang), lang);
+                       lbcNew = LBP_Undefined;
+                       goto nextline;
+               }
+               else if (zw_flag)
+               {
+                       if (lbcCur == LBP_ZW)
+                               brks[posLast] = LINEBREAK_ALLOWBREAK;
+                       else
+                               brks[posLast] = LINEBREAK_NOBREAK;
+                       lbcCur = lbcNew;
+               }
+               else
+               {
+                       // TIZEN ONLY(20131106): For Hangul word wrap
+                       switch (lbcCur)
+                       {
+                               case LBP_H2:                    /**< Hangul LV */
+                               case LBP_H3:                    /**< Hangul LVT */
+                               case LBP_JL:                    /**< Hangul L Jamo */
+                               case LBP_JV:                    /**< Hangul V Jamo */
+                               case LBP_JT:                    /**< Hangul T Jamo */
+                                       lbcCur = LBP_AL;
+                                       break;
+                               default:
+                                       break;
+                       }
+
+                       switch (lbcNew)
+                       {
+                               case LBP_H2:                    /**< Hangul LV */
+                               case LBP_H3:                    /**< Hangul LVT */
+                               case LBP_JL:                    /**< Hangul L Jamo */
+                               case LBP_JV:                    /**< Hangul V Jamo */
+                               case LBP_JT:                    /**< Hangul T Jamo */
+                                       lbcNew = LBP_AL;
+                                       break;
+                               default:
+                                       break;
+                       }
+                       //
+
+                       switch (lbcNew)
+                       {
+                               case LBP_SP:
+                                       brks[posLast] = LINEBREAK_NOBREAK;
+                                       continue;
+                               case LBP_BK:
+                               case LBP_LF:
+                               case LBP_NL:
+                                       brks[posLast] = LINEBREAK_NOBREAK;
+                                       lbcCur = LBP_BK;
+                                       continue;
+                               case LBP_CR:
+                                       brks[posLast] = LINEBREAK_NOBREAK;
+                                       lbcCur = LBP_CR;
+                                       continue;
+                               case LBP_CB:
+                                       brks[posLast] = LINEBREAK_ALLOWBREAK;
+                                       lbcCur = LBP_BA;
+                                       continue;
+                               default:
+                                       break;
+                       }
+
+                       lbcNew = resolve_lb_class(lbcNew, lang);
+
+                       assert(lbcCur <= LBP_JT);
+                       assert(lbcNew <= LBP_JT);
+                       switch (baTable[lbcCur - 1][lbcNew - 1])
+                       {
+                               case DIR_BRK:
+                                       brks[posLast] = LINEBREAK_ALLOWBREAK;
+                                       break;
+                               case CMI_BRK:
+                               case IND_BRK:
+                                       if (lbcLast == LBP_SP)
+                                       {
+                                               brks[posLast] = LINEBREAK_ALLOWBREAK;
+                                       }
+                                       else
+                                       {
+                                               brks[posLast] = LINEBREAK_NOBREAK;
+                                       }
+                                       break;
+                               case CMP_BRK:
+                                       brks[posLast] = LINEBREAK_NOBREAK;
+                                       if (lbcLast != LBP_SP)
+                                               continue;
+                                       break;
+                               case PRH_BRK:
+                                       brks[posLast] = LINEBREAK_NOBREAK;
+                                       break;
+                       }
+                       lbcCur = lbcNew;
+               }
+               // TIZEN ONLY - END
+       }
+
+       assert(posLast == posCur - 1 && posCur <= len);
+       /* Break after the last character */
+       brks[posLast] = LINEBREAK_MUSTBREAK;
+       /* When the input contains incomplete sequences */
+       while (posCur < len)
+       {
+               brks[posCur++] = LINEBREAK_INSIDEACHAR;
+       }
+}
+
+/**
+ * Sets the line breaking information for a UTF-8 input string.
+ *
+ * @param[in]  s       input UTF-8 string
+ * @param[in]  len     length of the input
+ * @param[in]  lang    language of the input
+ * @param[out] brks    pointer to the output breaking data, containing
+ *                                     #LINEBREAK_MUSTBREAK, #LINEBREAK_ALLOWBREAK,
+ *                                     #LINEBREAK_NOBREAK, or #LINEBREAK_INSIDEACHAR
+ */
+void set_linebreaks_utf8(
+               const utf8_t *s,
+               size_t len,
+               const char *lang,
+               char *brks)
+{
+       set_linebreaks(s, len, lang, brks,
+                                  (get_next_char_t)lb_get_next_char_utf8);
+}
+
+/**
+ * Sets the line breaking information for a UTF-16 input string.
+ *
+ * @param[in]  s       input UTF-16 string
+ * @param[in]  len     length of the input
+ * @param[in]  lang    language of the input
+ * @param[out] brks    pointer to the output breaking data, containing
+ *                                     #LINEBREAK_MUSTBREAK, #LINEBREAK_ALLOWBREAK,
+ *                                     #LINEBREAK_NOBREAK, or #LINEBREAK_INSIDEACHAR
+ */
+void set_linebreaks_utf16(
+               const utf16_t *s,
+               size_t len,
+               const char *lang,
+               char *brks)
+{
+       set_linebreaks(s, len, lang, brks,
+                                  (get_next_char_t)lb_get_next_char_utf16);
+}
+
+/**
+ * Sets the line breaking information for a UTF-32 input string.
+ *
+ * @param[in]  s       input UTF-32 string
+ * @param[in]  len     length of the input
+ * @param[in]  lang    language of the input
+ * @param[out] brks    pointer to the output breaking data, containing
+ *                                     #LINEBREAK_MUSTBREAK, #LINEBREAK_ALLOWBREAK,
+ *                                     #LINEBREAK_NOBREAK, or #LINEBREAK_INSIDEACHAR
+ */
+void set_linebreaks_utf32(
+               const utf32_t *s,
+               size_t len,
+               const char *lang,
+               char *brks)
+{
+       set_linebreaks(s, len, lang, brks,
+                                  (get_next_char_t)lb_get_next_char_utf32);
+}
+
+/**
+ * Tells whether a line break can occur between two Unicode characters.
+ * This is a wrapper function to expose a simple interface.  Generally
+ * speaking, it is better to use #set_linebreaks_utf32 instead, since
+ * complicated cases involving combining marks, spaces, etc. cannot be
+ * correctly processed.
+ *
+ * @param char1 the first Unicode character
+ * @param char2 the second Unicode character
+ * @param lang  language of the input
+ * @return      one of #LINEBREAK_MUSTBREAK, #LINEBREAK_ALLOWBREAK,
+ *                             #LINEBREAK_NOBREAK, or #LINEBREAK_INSIDEACHAR
+ */
+int is_line_breakable(
+               utf32_t char1,
+               utf32_t char2,
+               const char* lang)
+{
+       utf32_t s[2];
+       char brks[2];
+       s[0] = char1;
+       s[1] = char2;
+       set_linebreaks_utf32(s, 2, lang, brks);
+       return brks[0];
+}
diff --git a/text/dali/internal/libunibreak/linebreak.h b/text/dali/internal/libunibreak/linebreak.h
new file mode 100644 (file)
index 0000000..abc1ae9
--- /dev/null
@@ -0,0 +1,87 @@
+/* vim: set tabstop=4 shiftwidth=4: */
+
+/*
+ * Line breaking in a Unicode sequence.  Designed to be used in a
+ * generic text renderer.
+ *
+ * Copyright (C) 2008-2010 Wu Yongwei <wuyongwei at gmail dot com>
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty.  In no event will the author be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute
+ * it freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must
+ *    not claim that you wrote the original software.  If you use this
+ *    software in a product, an acknowledgement in the product
+ *    documentation would be appreciated but is not required.
+ * 2. Altered source versions must be plainly marked as such, and must
+ *    not be misrepresented as being the original software.
+ * 3. This notice may not be removed or altered from any source
+ *    distribution.
+ *
+ * The main reference is Unicode Standard Annex 14 (UAX #14):
+ *             <URL:http://www.unicode.org/reports/tr14/>
+ *
+ * When this library was designed, this annex was at Revision 19, for
+ * Unicode 5.0.0:
+ *             <URL:http://www.unicode.org/reports/tr14/tr14-19.html>
+ *
+ * This library has been updated according to Revision 24, for
+ * Unicode 5.2.0:
+ *             <URL:http://www.unicode.org/reports/tr14/tr14-24.html>
+ *
+ * The Unicode Terms of Use are available at
+ *             <URL:http://www.unicode.org/copyright.html>
+ */
+
+/**
+ * @file       linebreak.h
+ *
+ * Header file for the line breaking algorithm.
+ *
+ * @version    2.0, 2010/01/03
+ * @author     Wu Yongwei
+ */
+
+#ifndef LINEBREAK_H
+#define LINEBREAK_H
+
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define LINEBREAK_VERSION      0x0200  /**< Version of the library linebreak */
+extern const int linebreak_version;
+
+#ifndef LINEBREAK_UTF_TYPES_DEFINED
+#define LINEBREAK_UTF_TYPES_DEFINED
+typedef unsigned char  utf8_t;         /**< Type for UTF-8 data points */
+typedef unsigned short utf16_t;        /**< Type for UTF-16 data points */
+typedef unsigned int   utf32_t;        /**< Type for UTF-32 data points */
+#endif
+
+#define LINEBREAK_MUSTBREAK            0       /**< Break is mandatory */
+#define LINEBREAK_ALLOWBREAK   1       /**< Break is allowed */
+#define LINEBREAK_NOBREAK              2       /**< No break is possible */
+#define LINEBREAK_INSIDEACHAR  3       /**< A UTF-8/16 sequence is unfinished */
+
+void init_linebreak(void);
+void set_linebreaks_utf8(
+               const utf8_t *s, size_t len, const char* lang, char *brks);
+void set_linebreaks_utf16(
+               const utf16_t *s, size_t len, const char* lang, char *brks);
+void set_linebreaks_utf32(
+               const utf32_t *s, size_t len, const char* lang, char *brks);
+int is_line_breakable(utf32_t char1, utf32_t char2, const char* lang);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LINEBREAK_H */
diff --git a/text/dali/internal/libunibreak/linebreakdata.c b/text/dali/internal/libunibreak/linebreakdata.c
new file mode 100644 (file)
index 0000000..0021479
--- /dev/null
@@ -0,0 +1,1868 @@
+/* The content of this file is generated from:
+# LineBreak-6.0.0.txt
+# Date: 2010-08-18, 17:25:00 PDT [KW]
+*/
+
+#include "linebreak.h"
+#include "linebreakdef.h"
+
+/** Default line breaking properties as from the Unicode Web site. */
+struct LineBreakProperties lb_prop_default[] = {
+       { 0x0000, 0x0008, LBP_CM },
+       { 0x0009, 0x0009, LBP_BA },
+       { 0x000A, 0x000A, LBP_LF },
+       { 0x000B, 0x000C, LBP_BK },
+       { 0x000D, 0x000D, LBP_CR },
+       { 0x000E, 0x001F, LBP_CM },
+       { 0x0020, 0x0020, LBP_SP },
+       { 0x0021, 0x0021, LBP_EX },
+       { 0x0022, 0x0022, LBP_QU },
+       { 0x0023, 0x0023, LBP_AL },
+       { 0x0024, 0x0024, LBP_PR },
+       { 0x0025, 0x0025, LBP_PO },
+       { 0x0026, 0x0026, LBP_AL },
+       { 0x0027, 0x0027, LBP_QU },
+       { 0x0028, 0x0028, LBP_OP },
+       { 0x0029, 0x0029, LBP_CP },
+       { 0x002A, 0x002A, LBP_AL },
+       { 0x002B, 0x002B, LBP_PR },
+       { 0x002C, 0x002C, LBP_IS },
+       { 0x002D, 0x002D, LBP_HY },
+       { 0x002E, 0x002E, LBP_IS },
+       { 0x002F, 0x002F, LBP_SY },
+       { 0x0030, 0x0039, LBP_NU },
+       { 0x003A, 0x003B, LBP_IS },
+       { 0x003C, 0x003E, LBP_AL },
+       { 0x003F, 0x003F, LBP_EX },
+       { 0x0040, 0x005A, LBP_AL },
+       { 0x005B, 0x005B, LBP_OP },
+       { 0x005C, 0x005C, LBP_PR },
+       { 0x005D, 0x005D, LBP_CP },
+       { 0x005E, 0x007A, LBP_AL },
+       { 0x007B, 0x007B, LBP_OP },
+       { 0x007C, 0x007C, LBP_BA },
+       { 0x007D, 0x007D, LBP_CL },
+       { 0x007E, 0x007E, LBP_AL },
+       { 0x007F, 0x0084, LBP_CM },
+       { 0x0085, 0x0085, LBP_NL },
+       { 0x0086, 0x009F, LBP_CM },
+       { 0x00A0, 0x00A0, LBP_GL },
+       { 0x00A1, 0x00A1, LBP_OP },
+       { 0x00A2, 0x00A2, LBP_PO },
+       { 0x00A3, 0x00A5, LBP_PR },
+       { 0x00A6, 0x00A6, LBP_AL },
+       { 0x00A7, 0x00A8, LBP_AI },
+       { 0x00A9, 0x00A9, LBP_AL },
+       { 0x00AA, 0x00AA, LBP_AI },
+       { 0x00AB, 0x00AB, LBP_QU },
+       { 0x00AC, 0x00AC, LBP_AL },
+       { 0x00AD, 0x00AD, LBP_BA },
+       { 0x00AE, 0x00AF, LBP_AL },
+       { 0x00B0, 0x00B0, LBP_PO },
+       { 0x00B1, 0x00B1, LBP_PR },
+       { 0x00B2, 0x00B3, LBP_AI },
+       { 0x00B4, 0x00B4, LBP_BB },
+       { 0x00B5, 0x00B5, LBP_AL },
+       { 0x00B6, 0x00BA, LBP_AI },
+       { 0x00BB, 0x00BB, LBP_QU },
+       { 0x00BC, 0x00BE, LBP_AI },
+       { 0x00BF, 0x00BF, LBP_OP },
+       { 0x00C0, 0x00D6, LBP_AL },
+       { 0x00D7, 0x00D7, LBP_AI },
+       { 0x00D8, 0x00F6, LBP_AL },
+       { 0x00F7, 0x00F7, LBP_AI },
+       { 0x00F8, 0x02C6, LBP_AL },
+       { 0x02C7, 0x02C7, LBP_AI },
+       { 0x02C8, 0x02C8, LBP_BB },
+       { 0x02C9, 0x02CB, LBP_AI },
+       { 0x02CC, 0x02CC, LBP_BB },
+       { 0x02CD, 0x02CD, LBP_AI },
+       { 0x02CE, 0x02CF, LBP_AL },
+       { 0x02D0, 0x02D0, LBP_AI },
+       { 0x02D1, 0x02D7, LBP_AL },
+       { 0x02D8, 0x02DB, LBP_AI },
+       { 0x02DC, 0x02DC, LBP_AL },
+       { 0x02DD, 0x02DD, LBP_AI },
+       { 0x02DE, 0x02DE, LBP_AL },
+       { 0x02DF, 0x02DF, LBP_BB },
+       { 0x02E0, 0x02FF, LBP_AL },
+       { 0x0300, 0x034E, LBP_CM },
+       { 0x034F, 0x034F, LBP_GL },
+       { 0x0350, 0x035B, LBP_CM },
+       { 0x035C, 0x0362, LBP_GL },
+       { 0x0363, 0x036F, LBP_CM },
+       { 0x0370, 0x037D, LBP_AL },
+       { 0x037E, 0x037E, LBP_IS },
+       { 0x0384, 0x0482, LBP_AL },
+       { 0x0483, 0x0489, LBP_CM },
+       { 0x048A, 0x0587, LBP_AL },
+       { 0x0589, 0x0589, LBP_IS },
+       { 0x058A, 0x058A, LBP_BA },
+       { 0x0591, 0x05BD, LBP_CM },
+       { 0x05BE, 0x05BE, LBP_BA },
+       { 0x05BF, 0x05BF, LBP_CM },
+       { 0x05C0, 0x05C0, LBP_AL },
+       { 0x05C1, 0x05C2, LBP_CM },
+       { 0x05C3, 0x05C3, LBP_AL },
+       { 0x05C4, 0x05C5, LBP_CM },
+       { 0x05C6, 0x05C6, LBP_EX },
+       { 0x05C7, 0x05C7, LBP_CM },
+       { 0x05D0, 0x0608, LBP_AL },
+       { 0x0609, 0x060B, LBP_PO },
+       { 0x060C, 0x060D, LBP_IS },
+       { 0x060E, 0x060F, LBP_AL },
+       { 0x0610, 0x061A, LBP_CM },
+       { 0x061B, 0x061F, LBP_EX },
+       { 0x0620, 0x064A, LBP_AL },
+       { 0x064B, 0x065F, LBP_CM },
+       { 0x0660, 0x0669, LBP_NU },
+       { 0x066A, 0x066A, LBP_PO },
+       { 0x066B, 0x066C, LBP_NU },
+       { 0x066D, 0x066F, LBP_AL },
+       { 0x0670, 0x0670, LBP_CM },
+       { 0x0671, 0x06D3, LBP_AL },
+       { 0x06D4, 0x06D4, LBP_EX },
+       { 0x06D5, 0x06D5, LBP_AL },
+       { 0x06D6, 0x06DC, LBP_CM },
+       { 0x06DD, 0x06DE, LBP_AL },
+       { 0x06DF, 0x06E4, LBP_CM },
+       { 0x06E5, 0x06E6, LBP_AL },
+       { 0x06E7, 0x06E8, LBP_CM },
+       { 0x06E9, 0x06E9, LBP_AL },
+       { 0x06EA, 0x06ED, LBP_CM },
+       { 0x06EE, 0x06EF, LBP_AL },
+       { 0x06F0, 0x06F9, LBP_NU },
+       { 0x06FA, 0x0710, LBP_AL },
+       { 0x0711, 0x0711, LBP_CM },
+       { 0x0712, 0x072F, LBP_AL },
+       { 0x0730, 0x074A, LBP_CM },
+       { 0x074D, 0x07A5, LBP_AL },
+       { 0x07A6, 0x07B0, LBP_CM },
+       { 0x07B1, 0x07B1, LBP_AL },
+       { 0x07C0, 0x07C9, LBP_NU },
+       { 0x07CA, 0x07EA, LBP_AL },
+       { 0x07EB, 0x07F3, LBP_CM },
+       { 0x07F4, 0x07F7, LBP_AL },
+       { 0x07F8, 0x07F8, LBP_IS },
+       { 0x07F9, 0x07F9, LBP_EX },
+       { 0x07FA, 0x0815, LBP_AL },
+       { 0x0816, 0x0819, LBP_CM },
+       { 0x081A, 0x081A, LBP_AL },
+       { 0x081B, 0x0823, LBP_CM },
+       { 0x0824, 0x0824, LBP_AL },
+       { 0x0825, 0x0827, LBP_CM },
+       { 0x0828, 0x0828, LBP_AL },
+       { 0x0829, 0x082D, LBP_CM },
+       { 0x0830, 0x0858, LBP_AL },
+       { 0x0859, 0x085B, LBP_CM },
+       { 0x085E, 0x085E, LBP_AL },
+       { 0x0900, 0x0903, LBP_CM },
+       { 0x0904, 0x0939, LBP_AL },
+       { 0x093A, 0x093C, LBP_CM },
+       { 0x093D, 0x093D, LBP_AL },
+       { 0x093E, 0x094F, LBP_CM },
+       { 0x0950, 0x0950, LBP_AL },
+       { 0x0951, 0x0957, LBP_CM },
+       { 0x0958, 0x0961, LBP_AL },
+       { 0x0962, 0x0963, LBP_CM },
+       { 0x0964, 0x0965, LBP_BA },
+       { 0x0966, 0x096F, LBP_NU },
+       { 0x0970, 0x097F, LBP_AL },
+       { 0x0981, 0x0983, LBP_CM },
+       { 0x0985, 0x09B9, LBP_AL },
+       { 0x09BC, 0x09BC, LBP_CM },
+       { 0x09BD, 0x09BD, LBP_AL },
+       { 0x09BE, 0x09CD, LBP_CM },
+       { 0x09CE, 0x09CE, LBP_AL },
+       { 0x09D7, 0x09D7, LBP_CM },
+       { 0x09DC, 0x09E1, LBP_AL },
+       { 0x09E2, 0x09E3, LBP_CM },
+       { 0x09E6, 0x09EF, LBP_NU },
+       { 0x09F0, 0x09F1, LBP_AL },
+       { 0x09F2, 0x09F3, LBP_PO },
+       { 0x09F4, 0x09F8, LBP_AL },
+       { 0x09F9, 0x09F9, LBP_PO },
+       { 0x09FA, 0x09FA, LBP_AL },
+       { 0x09FB, 0x09FB, LBP_PR },
+       { 0x0A01, 0x0A03, LBP_CM },
+       { 0x0A05, 0x0A39, LBP_AL },
+       { 0x0A3C, 0x0A51, LBP_CM },
+       { 0x0A59, 0x0A5E, LBP_AL },
+       { 0x0A66, 0x0A6F, LBP_NU },
+       { 0x0A70, 0x0A71, LBP_CM },
+       { 0x0A72, 0x0A74, LBP_AL },
+       { 0x0A75, 0x0A83, LBP_CM },
+       { 0x0A85, 0x0AB9, LBP_AL },
+       { 0x0ABC, 0x0ABC, LBP_CM },
+       { 0x0ABD, 0x0ABD, LBP_AL },
+       { 0x0ABE, 0x0ACD, LBP_CM },
+       { 0x0AD0, 0x0AE1, LBP_AL },
+       { 0x0AE2, 0x0AE3, LBP_CM },
+       { 0x0AE6, 0x0AEF, LBP_NU },
+       { 0x0AF1, 0x0AF1, LBP_PR },
+       { 0x0B01, 0x0B03, LBP_CM },
+       { 0x0B05, 0x0B39, LBP_AL },
+       { 0x0B3C, 0x0B3C, LBP_CM },
+       { 0x0B3D, 0x0B3D, LBP_AL },
+       { 0x0B3E, 0x0B57, LBP_CM },
+       { 0x0B5C, 0x0B61, LBP_AL },
+       { 0x0B62, 0x0B63, LBP_CM },
+       { 0x0B66, 0x0B6F, LBP_NU },
+       { 0x0B70, 0x0B77, LBP_AL },
+       { 0x0B82, 0x0B82, LBP_CM },
+       { 0x0B83, 0x0BB9, LBP_AL },
+       { 0x0BBE, 0x0BCD, LBP_CM },
+       { 0x0BD0, 0x0BD0, LBP_AL },
+       { 0x0BD7, 0x0BD7, LBP_CM },
+       { 0x0BE6, 0x0BEF, LBP_NU },
+       { 0x0BF0, 0x0BF8, LBP_AL },
+       { 0x0BF9, 0x0BF9, LBP_PR },
+       { 0x0BFA, 0x0BFA, LBP_AL },
+       { 0x0C01, 0x0C03, LBP_CM },
+       { 0x0C05, 0x0C3D, LBP_AL },
+       { 0x0C3E, 0x0C56, LBP_CM },
+       { 0x0C58, 0x0C61, LBP_AL },
+       { 0x0C62, 0x0C63, LBP_CM },
+       { 0x0C66, 0x0C6F, LBP_NU },
+       { 0x0C78, 0x0C7F, LBP_AL },
+       { 0x0C82, 0x0C83, LBP_CM },
+       { 0x0C85, 0x0CB9, LBP_AL },
+       { 0x0CBC, 0x0CBC, LBP_CM },
+       { 0x0CBD, 0x0CBD, LBP_AL },
+       { 0x0CBE, 0x0CD6, LBP_CM },
+       { 0x0CDE, 0x0CE1, LBP_AL },
+       { 0x0CE2, 0x0CE3, LBP_CM },
+       { 0x0CE6, 0x0CEF, LBP_NU },
+       { 0x0CF1, 0x0CF2, LBP_AL },
+       { 0x0D02, 0x0D03, LBP_CM },
+       { 0x0D05, 0x0D3D, LBP_AL },
+       { 0x0D3E, 0x0D4D, LBP_CM },
+       { 0x0D4E, 0x0D4E, LBP_AL },
+       { 0x0D57, 0x0D57, LBP_CM },
+       { 0x0D60, 0x0D61, LBP_AL },
+       { 0x0D62, 0x0D63, LBP_CM },
+       { 0x0D66, 0x0D6F, LBP_NU },
+       { 0x0D70, 0x0D75, LBP_AL },
+       { 0x0D79, 0x0D79, LBP_PO },
+       { 0x0D7A, 0x0D7F, LBP_AL },
+       { 0x0D82, 0x0D83, LBP_CM },
+       { 0x0D85, 0x0DC6, LBP_AL },
+       { 0x0DCA, 0x0DF3, LBP_CM },
+       { 0x0DF4, 0x0DF4, LBP_AL },
+       { 0x0E01, 0x0E3A, LBP_SA },
+       { 0x0E3F, 0x0E3F, LBP_PR },
+       { 0x0E40, 0x0E4E, LBP_SA },
+       { 0x0E4F, 0x0E4F, LBP_AL },
+       { 0x0E50, 0x0E59, LBP_NU },
+       { 0x0E5A, 0x0E5B, LBP_BA },
+       { 0x0E81, 0x0ECD, LBP_SA },
+       { 0x0ED0, 0x0ED9, LBP_NU },
+       { 0x0EDC, 0x0EDD, LBP_SA },
+       { 0x0F00, 0x0F00, LBP_AL },
+       { 0x0F01, 0x0F04, LBP_BB },
+       { 0x0F05, 0x0F05, LBP_AL },
+       { 0x0F06, 0x0F07, LBP_BB },
+       { 0x0F08, 0x0F08, LBP_GL },
+       { 0x0F09, 0x0F0A, LBP_BB },
+       { 0x0F0B, 0x0F0B, LBP_BA },
+       { 0x0F0C, 0x0F0C, LBP_GL },
+       { 0x0F0D, 0x0F11, LBP_EX },
+       { 0x0F12, 0x0F12, LBP_GL },
+       { 0x0F13, 0x0F13, LBP_AL },
+       { 0x0F14, 0x0F14, LBP_EX },
+       { 0x0F15, 0x0F17, LBP_AL },
+       { 0x0F18, 0x0F19, LBP_CM },
+       { 0x0F1A, 0x0F1F, LBP_AL },
+       { 0x0F20, 0x0F29, LBP_NU },
+       { 0x0F2A, 0x0F33, LBP_AL },
+       { 0x0F34, 0x0F34, LBP_BA },
+       { 0x0F35, 0x0F35, LBP_CM },
+       { 0x0F36, 0x0F36, LBP_AL },
+       { 0x0F37, 0x0F37, LBP_CM },
+       { 0x0F38, 0x0F38, LBP_AL },
+       { 0x0F39, 0x0F39, LBP_CM },
+       { 0x0F3A, 0x0F3A, LBP_OP },
+       { 0x0F3B, 0x0F3B, LBP_CL },
+       { 0x0F3C, 0x0F3C, LBP_OP },
+       { 0x0F3D, 0x0F3D, LBP_CL },
+       { 0x0F3E, 0x0F3F, LBP_CM },
+       { 0x0F40, 0x0F6C, LBP_AL },
+       { 0x0F71, 0x0F7E, LBP_CM },
+       { 0x0F7F, 0x0F7F, LBP_BA },
+       { 0x0F80, 0x0F84, LBP_CM },
+       { 0x0F85, 0x0F85, LBP_BA },
+       { 0x0F86, 0x0F87, LBP_CM },
+       { 0x0F88, 0x0F8C, LBP_AL },
+       { 0x0F8D, 0x0FBC, LBP_CM },
+       { 0x0FBE, 0x0FBF, LBP_BA },
+       { 0x0FC0, 0x0FC5, LBP_AL },
+       { 0x0FC6, 0x0FC6, LBP_CM },
+       { 0x0FC7, 0x0FCF, LBP_AL },
+       { 0x0FD0, 0x0FD1, LBP_BB },
+       { 0x0FD2, 0x0FD2, LBP_BA },
+       { 0x0FD3, 0x0FD3, LBP_BB },
+       { 0x0FD4, 0x0FD8, LBP_AL },
+       { 0x0FD9, 0x0FDA, LBP_GL },
+       { 0x1000, 0x103F, LBP_SA },
+       { 0x1040, 0x1049, LBP_NU },
+       { 0x104A, 0x104B, LBP_BA },
+       { 0x104C, 0x104F, LBP_AL },
+       { 0x1050, 0x108F, LBP_SA },
+       { 0x1090, 0x1099, LBP_NU },
+       { 0x109A, 0x109F, LBP_SA },
+       { 0x10A0, 0x10FC, LBP_AL },
+       { 0x1100, 0x115F, LBP_JL },
+       { 0x1160, 0x11A7, LBP_JV },
+       { 0x11A8, 0x11FF, LBP_JT },
+       { 0x1200, 0x135A, LBP_AL },
+       { 0x135D, 0x135F, LBP_CM },
+       { 0x1360, 0x1360, LBP_AL },
+       { 0x1361, 0x1361, LBP_BA },
+       { 0x1362, 0x13F4, LBP_AL },
+       { 0x1400, 0x1400, LBP_BA },
+       { 0x1401, 0x167F, LBP_AL },
+       { 0x1680, 0x1680, LBP_BA },
+       { 0x1681, 0x169A, LBP_AL },
+       { 0x169B, 0x169B, LBP_OP },
+       { 0x169C, 0x169C, LBP_CL },
+       { 0x16A0, 0x16EA, LBP_AL },
+       { 0x16EB, 0x16ED, LBP_BA },
+       { 0x16EE, 0x1711, LBP_AL },
+       { 0x1712, 0x1714, LBP_CM },
+       { 0x1720, 0x1731, LBP_AL },
+       { 0x1732, 0x1734, LBP_CM },
+       { 0x1735, 0x1736, LBP_BA },
+       { 0x1740, 0x1751, LBP_AL },
+       { 0x1752, 0x1753, LBP_CM },
+       { 0x1760, 0x1770, LBP_AL },
+       { 0x1772, 0x1773, LBP_CM },
+       { 0x1780, 0x17D3, LBP_SA },
+       { 0x17D4, 0x17D5, LBP_BA },
+       { 0x17D6, 0x17D6, LBP_NS },
+       { 0x17D7, 0x17D7, LBP_SA },
+       { 0x17D8, 0x17D8, LBP_BA },
+       { 0x17D9, 0x17D9, LBP_AL },
+       { 0x17DA, 0x17DA, LBP_BA },
+       { 0x17DB, 0x17DB, LBP_PR },
+       { 0x17DC, 0x17DD, LBP_SA },
+       { 0x17E0, 0x17E9, LBP_NU },
+       { 0x17F0, 0x1801, LBP_AL },
+       { 0x1802, 0x1803, LBP_EX },
+       { 0x1804, 0x1805, LBP_BA },
+       { 0x1806, 0x1806, LBP_BB },
+       { 0x1807, 0x1807, LBP_AL },
+       { 0x1808, 0x1809, LBP_EX },
+       { 0x180A, 0x180A, LBP_AL },
+       { 0x180B, 0x180D, LBP_CM },
+       { 0x180E, 0x180E, LBP_GL },
+       { 0x1810, 0x1819, LBP_NU },
+       { 0x1820, 0x18A8, LBP_AL },
+       { 0x18A9, 0x18A9, LBP_CM },
+       { 0x18AA, 0x191C, LBP_AL },
+       { 0x1920, 0x193B, LBP_CM },
+       { 0x1940, 0x1940, LBP_AL },
+       { 0x1944, 0x1945, LBP_EX },
+       { 0x1946, 0x194F, LBP_NU },
+       { 0x1950, 0x19C9, LBP_SA },
+       { 0x19D0, 0x19D9, LBP_NU },
+       { 0x19DA, 0x19DF, LBP_SA },
+       { 0x19E0, 0x1A16, LBP_AL },
+       { 0x1A17, 0x1A1B, LBP_CM },
+       { 0x1A1E, 0x1A1F, LBP_AL },
+       { 0x1A20, 0x1A7C, LBP_SA },
+       { 0x1A7F, 0x1A7F, LBP_CM },
+       { 0x1A80, 0x1A99, LBP_NU },
+       { 0x1AA0, 0x1AAD, LBP_SA },
+       { 0x1B00, 0x1B04, LBP_CM },
+       { 0x1B05, 0x1B33, LBP_AL },
+       { 0x1B34, 0x1B44, LBP_CM },
+       { 0x1B45, 0x1B4B, LBP_AL },
+       { 0x1B50, 0x1B59, LBP_NU },
+       { 0x1B5A, 0x1B5B, LBP_BA },
+       { 0x1B5C, 0x1B5C, LBP_AL },
+       { 0x1B5D, 0x1B60, LBP_BA },
+       { 0x1B61, 0x1B6A, LBP_AL },
+       { 0x1B6B, 0x1B73, LBP_CM },
+       { 0x1B74, 0x1B7C, LBP_AL },
+       { 0x1B80, 0x1B82, LBP_CM },
+       { 0x1B83, 0x1BA0, LBP_AL },
+       { 0x1BA1, 0x1BAA, LBP_CM },
+       { 0x1BAE, 0x1BAF, LBP_AL },
+       { 0x1BB0, 0x1BB9, LBP_NU },
+       { 0x1BC0, 0x1BE5, LBP_AL },
+       { 0x1BE6, 0x1BF3, LBP_CM },
+       { 0x1BFC, 0x1C23, LBP_AL },
+       { 0x1C24, 0x1C37, LBP_CM },
+       { 0x1C3B, 0x1C3F, LBP_BA },
+       { 0x1C40, 0x1C49, LBP_NU },
+       { 0x1C4D, 0x1C4F, LBP_AL },
+       { 0x1C50, 0x1C59, LBP_NU },
+       { 0x1C5A, 0x1C7D, LBP_AL },
+       { 0x1C7E, 0x1C7F, LBP_BA },
+       { 0x1CD0, 0x1CD2, LBP_CM },
+       { 0x1CD3, 0x1CD3, LBP_AL },
+       { 0x1CD4, 0x1CE8, LBP_CM },
+       { 0x1CE9, 0x1CEC, LBP_AL },
+       { 0x1CED, 0x1CED, LBP_CM },
+       { 0x1CEE, 0x1CF1, LBP_AL },
+       { 0x1CF2, 0x1CF2, LBP_CM },
+       { 0x1D00, 0x1DBF, LBP_AL },
+       { 0x1DC0, 0x1DFF, LBP_CM },
+       { 0x1E00, 0x1FFC, LBP_AL },
+       { 0x1FFD, 0x1FFD, LBP_BB },
+       { 0x1FFE, 0x1FFE, LBP_AL },
+       { 0x2000, 0x2006, LBP_BA },
+       { 0x2007, 0x2007, LBP_GL },
+       { 0x2008, 0x200A, LBP_BA },
+       { 0x200B, 0x200B, LBP_ZW },
+       { 0x200C, 0x200F, LBP_CM },
+       { 0x2010, 0x2010, LBP_BA },
+       { 0x2011, 0x2011, LBP_GL },
+       { 0x2012, 0x2013, LBP_BA },
+       { 0x2014, 0x2014, LBP_B2 },
+       { 0x2015, 0x2016, LBP_AI },
+       { 0x2017, 0x2017, LBP_AL },
+       { 0x2018, 0x2019, LBP_QU },
+       { 0x201A, 0x201A, LBP_OP },
+       { 0x201B, 0x201D, LBP_QU },
+       { 0x201E, 0x201E, LBP_OP },
+       { 0x201F, 0x201F, LBP_QU },
+       { 0x2020, 0x2021, LBP_AI },
+       { 0x2022, 0x2023, LBP_AL },
+       { 0x2024, 0x2026, LBP_IN },
+       { 0x2027, 0x2027, LBP_BA },
+       { 0x2028, 0x2029, LBP_BK },
+       { 0x202A, 0x202E, LBP_CM },
+       { 0x202F, 0x202F, LBP_GL },
+       { 0x2030, 0x2037, LBP_PO },
+       { 0x2038, 0x2038, LBP_AL },
+       { 0x2039, 0x203A, LBP_QU },
+       { 0x203B, 0x203B, LBP_AI },
+       { 0x203C, 0x203D, LBP_NS },
+       { 0x203E, 0x2043, LBP_AL },
+       { 0x2044, 0x2044, LBP_IS },
+       { 0x2045, 0x2045, LBP_OP },
+       { 0x2046, 0x2046, LBP_CL },
+       { 0x2047, 0x2049, LBP_NS },
+       { 0x204A, 0x2055, LBP_AL },
+       { 0x2056, 0x2056, LBP_BA },
+       { 0x2057, 0x2057, LBP_AL },
+       { 0x2058, 0x205B, LBP_BA },
+       { 0x205C, 0x205C, LBP_AL },
+       { 0x205D, 0x205F, LBP_BA },
+       { 0x2060, 0x2060, LBP_WJ },
+       { 0x2061, 0x2064, LBP_AL },
+       { 0x206A, 0x206F, LBP_CM },
+       { 0x2070, 0x2071, LBP_AL },
+       { 0x2074, 0x2074, LBP_AI },
+       { 0x2075, 0x207C, LBP_AL },
+       { 0x207D, 0x207D, LBP_OP },
+       { 0x207E, 0x207E, LBP_CL },
+       { 0x207F, 0x207F, LBP_AI },
+       { 0x2080, 0x2080, LBP_AL },
+       { 0x2081, 0x2084, LBP_AI },
+       { 0x2085, 0x208C, LBP_AL },
+       { 0x208D, 0x208D, LBP_OP },
+       { 0x208E, 0x208E, LBP_CL },
+       { 0x2090, 0x209C, LBP_AL },
+       { 0x20A0, 0x20A6, LBP_PR },
+       { 0x20A7, 0x20A7, LBP_PO },
+       { 0x20A8, 0x20B5, LBP_PR },
+       { 0x20B6, 0x20B6, LBP_PO },
+       { 0x20B7, 0x20B9, LBP_PR },
+       { 0x20D0, 0x20F0, LBP_CM },
+       { 0x2100, 0x2102, LBP_AL },
+       { 0x2103, 0x2103, LBP_PO },
+       { 0x2104, 0x2104, LBP_AL },
+       { 0x2105, 0x2105, LBP_AI },
+       { 0x2106, 0x2108, LBP_AL },
+       { 0x2109, 0x2109, LBP_PO },
+       { 0x210A, 0x2112, LBP_AL },
+       { 0x2113, 0x2113, LBP_AI },
+       { 0x2114, 0x2115, LBP_AL },
+       { 0x2116, 0x2116, LBP_PR },
+       { 0x2117, 0x2120, LBP_AL },
+       { 0x2121, 0x2122, LBP_AI },
+       { 0x2123, 0x212A, LBP_AL },
+       { 0x212B, 0x212B, LBP_AI },
+       { 0x212C, 0x2153, LBP_AL },
+       { 0x2154, 0x2155, LBP_AI },
+       { 0x2156, 0x215A, LBP_AL },
+       { 0x215B, 0x215B, LBP_AI },
+       { 0x215C, 0x215D, LBP_AL },
+       { 0x215E, 0x215E, LBP_AI },
+       { 0x215F, 0x215F, LBP_AL },
+       { 0x2160, 0x216B, LBP_AI },
+       { 0x216C, 0x216F, LBP_AL },
+       { 0x2170, 0x2179, LBP_AI },
+       { 0x217A, 0x2188, LBP_AL },
+       { 0x2189, 0x2199, LBP_AI },
+       { 0x219A, 0x21D1, LBP_AL },
+       { 0x21D2, 0x21D2, LBP_AI },
+       { 0x21D3, 0x21D3, LBP_AL },
+       { 0x21D4, 0x21D4, LBP_AI },
+       { 0x21D5, 0x21FF, LBP_AL },
+       { 0x2200, 0x2200, LBP_AI },
+       { 0x2201, 0x2201, LBP_AL },
+       { 0x2202, 0x2203, LBP_AI },
+       { 0x2204, 0x2206, LBP_AL },
+       { 0x2207, 0x2208, LBP_AI },
+       { 0x2209, 0x220A, LBP_AL },
+       { 0x220B, 0x220B, LBP_AI },
+       { 0x220C, 0x220E, LBP_AL },
+       { 0x220F, 0x220F, LBP_AI },
+       { 0x2210, 0x2210, LBP_AL },
+       { 0x2211, 0x2211, LBP_AI },
+       { 0x2212, 0x2213, LBP_PR },
+       { 0x2214, 0x2214, LBP_AL },
+       { 0x2215, 0x2215, LBP_AI },
+       { 0x2216, 0x2219, LBP_AL },
+       { 0x221A, 0x221A, LBP_AI },
+       { 0x221B, 0x221C, LBP_AL },
+       { 0x221D, 0x2220, LBP_AI },
+       { 0x2221, 0x2222, LBP_AL },
+       { 0x2223, 0x2223, LBP_AI },
+       { 0x2224, 0x2224, LBP_AL },
+       { 0x2225, 0x2225, LBP_AI },
+       { 0x2226, 0x2226, LBP_AL },
+       { 0x2227, 0x222C, LBP_AI },
+       { 0x222D, 0x222D, LBP_AL },
+       { 0x222E, 0x222E, LBP_AI },
+       { 0x222F, 0x2233, LBP_AL },
+       { 0x2234, 0x2237, LBP_AI },
+       { 0x2238, 0x223B, LBP_AL },
+       { 0x223C, 0x223D, LBP_AI },
+       { 0x223E, 0x2247, LBP_AL },
+       { 0x2248, 0x2248, LBP_AI },
+       { 0x2249, 0x224B, LBP_AL },
+       { 0x224C, 0x224C, LBP_AI },
+       { 0x224D, 0x2251, LBP_AL },
+       { 0x2252, 0x2252, LBP_AI },
+       { 0x2253, 0x225F, LBP_AL },
+       { 0x2260, 0x2261, LBP_AI },
+       { 0x2262, 0x2263, LBP_AL },
+       { 0x2264, 0x2267, LBP_AI },
+       { 0x2268, 0x2269, LBP_AL },
+       { 0x226A, 0x226B, LBP_AI },
+       { 0x226C, 0x226D, LBP_AL },
+       { 0x226E, 0x226F, LBP_AI },
+       { 0x2270, 0x2281, LBP_AL },
+       { 0x2282, 0x2283, LBP_AI },
+       { 0x2284, 0x2285, LBP_AL },
+       { 0x2286, 0x2287, LBP_AI },
+       { 0x2288, 0x2294, LBP_AL },
+       { 0x2295, 0x2295, LBP_AI },
+       { 0x2296, 0x2298, LBP_AL },
+       { 0x2299, 0x2299, LBP_AI },
+       { 0x229A, 0x22A4, LBP_AL },
+       { 0x22A5, 0x22A5, LBP_AI },
+       { 0x22A6, 0x22BE, LBP_AL },
+       { 0x22BF, 0x22BF, LBP_AI },
+       { 0x22C0, 0x2311, LBP_AL },
+       { 0x2312, 0x2312, LBP_AI },
+       { 0x2313, 0x2328, LBP_AL },
+       { 0x2329, 0x2329, LBP_OP },
+       { 0x232A, 0x232A, LBP_CL },
+       { 0x232B, 0x244A, LBP_AL },
+       { 0x2460, 0x24FE, LBP_AI },
+       { 0x24FF, 0x24FF, LBP_AL },
+       { 0x2500, 0x254B, LBP_AI },
+       { 0x254C, 0x254F, LBP_AL },
+       { 0x2550, 0x2574, LBP_AI },
+       { 0x2575, 0x257F, LBP_AL },
+       { 0x2580, 0x258F, LBP_AI },
+       { 0x2590, 0x2591, LBP_AL },
+       { 0x2592, 0x2595, LBP_AI },
+       { 0x2596, 0x259F, LBP_AL },
+       { 0x25A0, 0x25A1, LBP_AI },
+       { 0x25A2, 0x25A2, LBP_AL },
+       { 0x25A3, 0x25A9, LBP_AI },
+       { 0x25AA, 0x25B1, LBP_AL },
+       { 0x25B2, 0x25B3, LBP_AI },
+       { 0x25B4, 0x25B5, LBP_AL },
+       { 0x25B6, 0x25B7, LBP_AI },
+       { 0x25B8, 0x25BB, LBP_AL },
+       { 0x25BC, 0x25BD, LBP_AI },
+       { 0x25BE, 0x25BF, LBP_AL },
+       { 0x25C0, 0x25C1, LBP_AI },
+       { 0x25C2, 0x25C5, LBP_AL },
+       { 0x25C6, 0x25C8, LBP_AI },
+       { 0x25C9, 0x25CA, LBP_AL },
+       { 0x25CB, 0x25CB, LBP_AI },
+       { 0x25CC, 0x25CD, LBP_AL },
+       { 0x25CE, 0x25D1, LBP_AI },
+       { 0x25D2, 0x25E1, LBP_AL },
+       { 0x25E2, 0x25E5, LBP_AI },
+       { 0x25E6, 0x25EE, LBP_AL },
+       { 0x25EF, 0x25EF, LBP_AI },
+       { 0x25F0, 0x2604, LBP_AL },
+       { 0x2605, 0x2606, LBP_AI },
+       { 0x2607, 0x2608, LBP_AL },
+       { 0x2609, 0x2609, LBP_AI },
+       { 0x260A, 0x260D, LBP_AL },
+       { 0x260E, 0x260F, LBP_AI },
+       { 0x2610, 0x2613, LBP_AL },
+       { 0x2614, 0x2617, LBP_AI },
+       { 0x2618, 0x261B, LBP_AL },
+       { 0x261C, 0x261C, LBP_AI },
+       { 0x261D, 0x261D, LBP_AL },
+       { 0x261E, 0x261E, LBP_AI },
+       { 0x261F, 0x263F, LBP_AL },
+       { 0x2640, 0x2640, LBP_AI },
+       { 0x2641, 0x2641, LBP_AL },
+       { 0x2642, 0x2642, LBP_AI },
+       { 0x2643, 0x265F, LBP_AL },
+       { 0x2660, 0x2661, LBP_AI },
+       { 0x2662, 0x2662, LBP_AL },
+       { 0x2663, 0x2665, LBP_AI },
+       { 0x2666, 0x2666, LBP_AL },
+       { 0x2667, 0x266A, LBP_AI },
+       { 0x266B, 0x266B, LBP_AL },
+       { 0x266C, 0x266D, LBP_AI },
+       { 0x266E, 0x266E, LBP_AL },
+       { 0x266F, 0x266F, LBP_AI },
+       { 0x2670, 0x269D, LBP_AL },
+       { 0x269E, 0x269F, LBP_AI },
+       { 0x26A0, 0x26BD, LBP_AL },
+       { 0x26BE, 0x26BF, LBP_AI },
+       { 0x26C0, 0x26C3, LBP_AL },
+       { 0x26C4, 0x26CD, LBP_AI },
+       { 0x26CE, 0x26CE, LBP_AL },
+       { 0x26CF, 0x26E1, LBP_AI },
+       { 0x26E2, 0x26E2, LBP_AL },
+       { 0x26E3, 0x26E3, LBP_AI },
+       { 0x26E4, 0x26E7, LBP_AL },
+       { 0x26E8, 0x26FF, LBP_AI },
+       { 0x2701, 0x2756, LBP_AL },
+       { 0x2757, 0x2757, LBP_AI },
+       { 0x2758, 0x275A, LBP_AL },
+       { 0x275B, 0x275E, LBP_QU },
+       { 0x275F, 0x2761, LBP_AL },
+       { 0x2762, 0x2763, LBP_EX },
+       { 0x2764, 0x2767, LBP_AL },
+       { 0x2768, 0x2768, LBP_OP },
+       { 0x2769, 0x2769, LBP_CL },
+       { 0x276A, 0x276A, LBP_OP },
+       { 0x276B, 0x276B, LBP_CL },
+       { 0x276C, 0x276C, LBP_OP },
+       { 0x276D, 0x276D, LBP_CL },
+       { 0x276E, 0x276E, LBP_OP },
+       { 0x276F, 0x276F, LBP_CL },
+       { 0x2770, 0x2770, LBP_OP },
+       { 0x2771, 0x2771, LBP_CL },
+       { 0x2772, 0x2772, LBP_OP },
+       { 0x2773, 0x2773, LBP_CL },
+       { 0x2774, 0x2774, LBP_OP },
+       { 0x2775, 0x2775, LBP_CL },
+       { 0x2776, 0x2793, LBP_AI },
+       { 0x2794, 0x27C4, LBP_AL },
+       { 0x27C5, 0x27C5, LBP_OP },
+       { 0x27C6, 0x27C6, LBP_CL },
+       { 0x27C7, 0x27E5, LBP_AL },
+       { 0x27E6, 0x27E6, LBP_OP },
+       { 0x27E7, 0x27E7, LBP_CL },
+       { 0x27E8, 0x27E8, LBP_OP },
+       { 0x27E9, 0x27E9, LBP_CL },
+       { 0x27EA, 0x27EA, LBP_OP },
+       { 0x27EB, 0x27EB, LBP_CL },
+       { 0x27EC, 0x27EC, LBP_OP },
+       { 0x27ED, 0x27ED, LBP_CL },
+       { 0x27EE, 0x27EE, LBP_OP },
+       { 0x27EF, 0x27EF, LBP_CL },
+       { 0x27F0, 0x2982, LBP_AL },
+       { 0x2983, 0x2983, LBP_OP },
+       { 0x2984, 0x2984, LBP_CL },
+       { 0x2985, 0x2985, LBP_OP },
+       { 0x2986, 0x2986, LBP_CL },
+       { 0x2987, 0x2987, LBP_OP },
+       { 0x2988, 0x2988, LBP_CL },
+       { 0x2989, 0x2989, LBP_OP },
+       { 0x298A, 0x298A, LBP_CL },
+       { 0x298B, 0x298B, LBP_OP },
+       { 0x298C, 0x298C, LBP_CL },
+       { 0x298D, 0x298D, LBP_OP },
+       { 0x298E, 0x298E, LBP_CL },
+       { 0x298F, 0x298F, LBP_OP },
+       { 0x2990, 0x2990, LBP_CL },
+       { 0x2991, 0x2991, LBP_OP },
+       { 0x2992, 0x2992, LBP_CL },
+       { 0x2993, 0x2993, LBP_OP },
+       { 0x2994, 0x2994, LBP_CL },
+       { 0x2995, 0x2995, LBP_OP },
+       { 0x2996, 0x2996, LBP_CL },
+       { 0x2997, 0x2997, LBP_OP },
+       { 0x2998, 0x2998, LBP_CL },
+       { 0x2999, 0x29D7, LBP_AL },
+       { 0x29D8, 0x29D8, LBP_OP },
+       { 0x29D9, 0x29D9, LBP_CL },
+       { 0x29DA, 0x29DA, LBP_OP },
+       { 0x29DB, 0x29DB, LBP_CL },
+       { 0x29DC, 0x29FB, LBP_AL },
+       { 0x29FC, 0x29FC, LBP_OP },
+       { 0x29FD, 0x29FD, LBP_CL },
+       { 0x29FE, 0x2B54, LBP_AL },
+       { 0x2B55, 0x2B59, LBP_AI },
+       { 0x2C00, 0x2CEE, LBP_AL },
+       { 0x2CEF, 0x2CF1, LBP_CM },
+       { 0x2CF9, 0x2CF9, LBP_EX },
+       { 0x2CFA, 0x2CFC, LBP_BA },
+       { 0x2CFD, 0x2CFD, LBP_AL },
+       { 0x2CFE, 0x2CFE, LBP_EX },
+       { 0x2CFF, 0x2CFF, LBP_BA },
+       { 0x2D00, 0x2D6F, LBP_AL },
+       { 0x2D70, 0x2D70, LBP_BA },
+       { 0x2D7F, 0x2D7F, LBP_CM },
+       { 0x2D80, 0x2DDE, LBP_AL },
+       { 0x2DE0, 0x2DFF, LBP_CM },
+       { 0x2E00, 0x2E0D, LBP_QU },
+       { 0x2E0E, 0x2E15, LBP_BA },
+       { 0x2E16, 0x2E16, LBP_AL },
+       { 0x2E17, 0x2E17, LBP_BA },
+       { 0x2E18, 0x2E18, LBP_OP },
+       { 0x2E19, 0x2E19, LBP_BA },
+       { 0x2E1A, 0x2E1B, LBP_AL },
+       { 0x2E1C, 0x2E1D, LBP_QU },
+       { 0x2E1E, 0x2E1F, LBP_AL },
+       { 0x2E20, 0x2E21, LBP_QU },
+       { 0x2E22, 0x2E22, LBP_OP },
+       { 0x2E23, 0x2E23, LBP_CL },
+       { 0x2E24, 0x2E24, LBP_OP },
+       { 0x2E25, 0x2E25, LBP_CL },
+       { 0x2E26, 0x2E26, LBP_OP },
+       { 0x2E27, 0x2E27, LBP_CL },
+       { 0x2E28, 0x2E28, LBP_OP },
+       { 0x2E29, 0x2E29, LBP_CL },
+       { 0x2E2A, 0x2E2D, LBP_BA },
+       { 0x2E2E, 0x2E2E, LBP_EX },
+       { 0x2E2F, 0x2E2F, LBP_AL },
+       { 0x2E30, 0x2E31, LBP_BA },
+       { 0x2E80, 0x3000, LBP_ID },
+       { 0x3001, 0x3002, LBP_CL },
+       { 0x3003, 0x3004, LBP_ID },
+       { 0x3005, 0x3005, LBP_NS },
+       { 0x3006, 0x3007, LBP_ID },
+       { 0x3008, 0x3008, LBP_OP },
+       { 0x3009, 0x3009, LBP_CL },
+       { 0x300A, 0x300A, LBP_OP },
+       { 0x300B, 0x300B, LBP_CL },
+       { 0x300C, 0x300C, LBP_OP },
+       { 0x300D, 0x300D, LBP_CL },
+       { 0x300E, 0x300E, LBP_OP },
+       { 0x300F, 0x300F, LBP_CL },
+       { 0x3010, 0x3010, LBP_OP },
+       { 0x3011, 0x3011, LBP_CL },
+       { 0x3012, 0x3013, LBP_ID },
+       { 0x3014, 0x3014, LBP_OP },
+       { 0x3015, 0x3015, LBP_CL },
+       { 0x3016, 0x3016, LBP_OP },
+       { 0x3017, 0x3017, LBP_CL },
+       { 0x3018, 0x3018, LBP_OP },
+       { 0x3019, 0x3019, LBP_CL },
+       { 0x301A, 0x301A, LBP_OP },
+       { 0x301B, 0x301B, LBP_CL },
+       { 0x301C, 0x301C, LBP_NS },
+       { 0x301D, 0x301D, LBP_OP },
+       { 0x301E, 0x301F, LBP_CL },
+       { 0x3020, 0x3029, LBP_ID },
+       { 0x302A, 0x302F, LBP_CM },
+       { 0x3030, 0x303A, LBP_ID },
+       { 0x303B, 0x303C, LBP_NS },
+       { 0x303D, 0x303F, LBP_ID },
+       { 0x3041, 0x3041, LBP_NS },
+       { 0x3042, 0x3042, LBP_ID },
+       { 0x3043, 0x3043, LBP_NS },
+       { 0x3044, 0x3044, LBP_ID },
+       { 0x3045, 0x3045, LBP_NS },
+       { 0x3046, 0x3046, LBP_ID },
+       { 0x3047, 0x3047, LBP_NS },
+       { 0x3048, 0x3048, LBP_ID },
+       { 0x3049, 0x3049, LBP_NS },
+       { 0x304A, 0x3062, LBP_ID },
+       { 0x3063, 0x3063, LBP_NS },
+       { 0x3064, 0x3082, LBP_ID },
+       { 0x3083, 0x3083, LBP_NS },
+       { 0x3084, 0x3084, LBP_ID },
+       { 0x3085, 0x3085, LBP_NS },
+       { 0x3086, 0x3086, LBP_ID },
+       { 0x3087, 0x3087, LBP_NS },
+       { 0x3088, 0x308D, LBP_ID },
+       { 0x308E, 0x308E, LBP_NS },
+       { 0x308F, 0x3094, LBP_ID },
+       { 0x3095, 0x3096, LBP_NS },
+       { 0x3099, 0x309A, LBP_CM },
+       { 0x309B, 0x309E, LBP_NS },
+       { 0x309F, 0x309F, LBP_ID },
+       { 0x30A0, 0x30A1, LBP_NS },
+       { 0x30A2, 0x30A2, LBP_ID },
+       { 0x30A3, 0x30A3, LBP_NS },
+       { 0x30A4, 0x30A4, LBP_ID },
+       { 0x30A5, 0x30A5, LBP_NS },
+       { 0x30A6, 0x30A6, LBP_ID },
+       { 0x30A7, 0x30A7, LBP_NS },
+       { 0x30A8, 0x30A8, LBP_ID },
+       { 0x30A9, 0x30A9, LBP_NS },
+       { 0x30AA, 0x30C2, LBP_ID },
+       { 0x30C3, 0x30C3, LBP_NS },
+       { 0x30C4, 0x30E2, LBP_ID },
+       { 0x30E3, 0x30E3, LBP_NS },
+       { 0x30E4, 0x30E4, LBP_ID },
+       { 0x30E5, 0x30E5, LBP_NS },
+       { 0x30E6, 0x30E6, LBP_ID },
+       { 0x30E7, 0x30E7, LBP_NS },
+       { 0x30E8, 0x30ED, LBP_ID },
+       { 0x30EE, 0x30EE, LBP_NS },
+       { 0x30EF, 0x30F4, LBP_ID },
+       { 0x30F5, 0x30F6, LBP_NS },
+       { 0x30F7, 0x30FA, LBP_ID },
+       { 0x30FB, 0x30FE, LBP_NS },
+       { 0x30FF, 0x31E3, LBP_ID },
+       { 0x31F0, 0x31FF, LBP_NS },
+       { 0x3200, 0x3247, LBP_ID },
+       { 0x3248, 0x324F, LBP_AI },
+       { 0x3250, 0x4DBF, LBP_ID },
+       { 0x4DC0, 0x4DFF, LBP_AL },
+       { 0x4E00, 0xA014, LBP_ID },
+       { 0xA015, 0xA015, LBP_NS },
+       { 0xA016, 0xA4C6, LBP_ID },
+       { 0xA4D0, 0xA4FD, LBP_AL },
+       { 0xA4FE, 0xA4FF, LBP_BA },
+       { 0xA500, 0xA60C, LBP_AL },
+       { 0xA60D, 0xA60D, LBP_BA },
+       { 0xA60E, 0xA60E, LBP_EX },
+       { 0xA60F, 0xA60F, LBP_BA },
+       { 0xA610, 0xA61F, LBP_AL },
+       { 0xA620, 0xA629, LBP_NU },
+       { 0xA62A, 0xA66E, LBP_AL },
+       { 0xA66F, 0xA672, LBP_CM },
+       { 0xA673, 0xA673, LBP_AL },
+       { 0xA67C, 0xA67D, LBP_CM },
+       { 0xA67E, 0xA6EF, LBP_AL },
+       { 0xA6F0, 0xA6F1, LBP_CM },
+       { 0xA6F2, 0xA6F2, LBP_AL },
+       { 0xA6F3, 0xA6F7, LBP_BA },
+       { 0xA700, 0xA801, LBP_AL },
+       { 0xA802, 0xA802, LBP_CM },
+       { 0xA803, 0xA805, LBP_AL },
+       { 0xA806, 0xA806, LBP_CM },
+       { 0xA807, 0xA80A, LBP_AL },
+       { 0xA80B, 0xA80B, LBP_CM },
+       { 0xA80C, 0xA822, LBP_AL },
+       { 0xA823, 0xA827, LBP_CM },
+       { 0xA828, 0xA837, LBP_AL },
+       { 0xA838, 0xA838, LBP_PO },
+       { 0xA839, 0xA873, LBP_AL },
+       { 0xA874, 0xA875, LBP_BB },
+       { 0xA876, 0xA877, LBP_EX },
+       { 0xA880, 0xA881, LBP_CM },
+       { 0xA882, 0xA8B3, LBP_AL },
+       { 0xA8B4, 0xA8C4, LBP_CM },
+       { 0xA8CE, 0xA8CF, LBP_BA },
+       { 0xA8D0, 0xA8D9, LBP_NU },
+       { 0xA8E0, 0xA8F1, LBP_CM },
+       { 0xA8F2, 0xA8FB, LBP_AL },
+       { 0xA900, 0xA909, LBP_NU },
+       { 0xA90A, 0xA925, LBP_AL },
+       { 0xA926, 0xA92D, LBP_CM },
+       { 0xA92E, 0xA92F, LBP_BA },
+       { 0xA930, 0xA946, LBP_AL },
+       { 0xA947, 0xA953, LBP_CM },
+       { 0xA95F, 0xA95F, LBP_AL },
+       { 0xA960, 0xA97C, LBP_JL },
+       { 0xA980, 0xA983, LBP_CM },
+       { 0xA984, 0xA9B2, LBP_AL },
+       { 0xA9B3, 0xA9C0, LBP_CM },
+       { 0xA9C1, 0xA9C6, LBP_AL },
+       { 0xA9C7, 0xA9C9, LBP_BA },
+       { 0xA9CA, 0xA9CF, LBP_AL },
+       { 0xA9D0, 0xA9D9, LBP_NU },
+       { 0xA9DE, 0xAA28, LBP_AL },
+       { 0xAA29, 0xAA36, LBP_CM },
+       { 0xAA40, 0xAA42, LBP_AL },
+       { 0xAA43, 0xAA43, LBP_CM },
+       { 0xAA44, 0xAA4B, LBP_AL },
+       { 0xAA4C, 0xAA4D, LBP_CM },
+       { 0xAA50, 0xAA59, LBP_NU },
+       { 0xAA5C, 0xAA5C, LBP_AL },
+       { 0xAA5D, 0xAA5F, LBP_BA },
+       { 0xAA60, 0xAADF, LBP_SA },
+       { 0xAB01, 0xABE2, LBP_AL },
+       { 0xABE3, 0xABEA, LBP_CM },
+       { 0xABEB, 0xABEB, LBP_BA },
+       { 0xABEC, 0xABED, LBP_CM },
+       { 0xABF0, 0xABF9, LBP_NU },
+       { 0xAC00, 0xAC00, LBP_H2 },
+       { 0xAC01, 0xAC1B, LBP_H3 },
+       { 0xAC1C, 0xAC1C, LBP_H2 },
+       { 0xAC1D, 0xAC37, LBP_H3 },
+       { 0xAC38, 0xAC38, LBP_H2 },
+       { 0xAC39, 0xAC53, LBP_H3 },
+       { 0xAC54, 0xAC54, LBP_H2 },
+       { 0xAC55, 0xAC6F, LBP_H3 },
+       { 0xAC70, 0xAC70, LBP_H2 },
+       { 0xAC71, 0xAC8B, LBP_H3 },
+       { 0xAC8C, 0xAC8C, LBP_H2 },
+       { 0xAC8D, 0xACA7, LBP_H3 },
+       { 0xACA8, 0xACA8, LBP_H2 },
+       { 0xACA9, 0xACC3, LBP_H3 },
+       { 0xACC4, 0xACC4, LBP_H2 },
+       { 0xACC5, 0xACDF, LBP_H3 },
+       { 0xACE0, 0xACE0, LBP_H2 },
+       { 0xACE1, 0xACFB, LBP_H3 },
+       { 0xACFC, 0xACFC, LBP_H2 },
+       { 0xACFD, 0xAD17, LBP_H3 },
+       { 0xAD18, 0xAD18, LBP_H2 },
+       { 0xAD19, 0xAD33, LBP_H3 },
+       { 0xAD34, 0xAD34, LBP_H2 },
+       { 0xAD35, 0xAD4F, LBP_H3 },
+       { 0xAD50, 0xAD50, LBP_H2 },
+       { 0xAD51, 0xAD6B, LBP_H3 },
+       { 0xAD6C, 0xAD6C, LBP_H2 },
+       { 0xAD6D, 0xAD87, LBP_H3 },
+       { 0xAD88, 0xAD88, LBP_H2 },
+       { 0xAD89, 0xADA3, LBP_H3 },
+       { 0xADA4, 0xADA4, LBP_H2 },
+       { 0xADA5, 0xADBF, LBP_H3 },
+       { 0xADC0, 0xADC0, LBP_H2 },
+       { 0xADC1, 0xADDB, LBP_H3 },
+       { 0xADDC, 0xADDC, LBP_H2 },
+       { 0xADDD, 0xADF7, LBP_H3 },
+       { 0xADF8, 0xADF8, LBP_H2 },
+       { 0xADF9, 0xAE13, LBP_H3 },
+       { 0xAE14, 0xAE14, LBP_H2 },
+       { 0xAE15, 0xAE2F, LBP_H3 },
+       { 0xAE30, 0xAE30, LBP_H2 },
+       { 0xAE31, 0xAE4B, LBP_H3 },
+       { 0xAE4C, 0xAE4C, LBP_H2 },
+       { 0xAE4D, 0xAE67, LBP_H3 },
+       { 0xAE68, 0xAE68, LBP_H2 },
+       { 0xAE69, 0xAE83, LBP_H3 },
+       { 0xAE84, 0xAE84, LBP_H2 },
+       { 0xAE85, 0xAE9F, LBP_H3 },
+       { 0xAEA0, 0xAEA0, LBP_H2 },
+       { 0xAEA1, 0xAEBB, LBP_H3 },
+       { 0xAEBC, 0xAEBC, LBP_H2 },
+       { 0xAEBD, 0xAED7, LBP_H3 },
+       { 0xAED8, 0xAED8, LBP_H2 },
+       { 0xAED9, 0xAEF3, LBP_H3 },
+       { 0xAEF4, 0xAEF4, LBP_H2 },
+       { 0xAEF5, 0xAF0F, LBP_H3 },
+       { 0xAF10, 0xAF10, LBP_H2 },
+       { 0xAF11, 0xAF2B, LBP_H3 },
+       { 0xAF2C, 0xAF2C, LBP_H2 },
+       { 0xAF2D, 0xAF47, LBP_H3 },
+       { 0xAF48, 0xAF48, LBP_H2 },
+       { 0xAF49, 0xAF63, LBP_H3 },
+       { 0xAF64, 0xAF64, LBP_H2 },
+       { 0xAF65, 0xAF7F, LBP_H3 },
+       { 0xAF80, 0xAF80, LBP_H2 },
+       { 0xAF81, 0xAF9B, LBP_H3 },
+       { 0xAF9C, 0xAF9C, LBP_H2 },
+       { 0xAF9D, 0xAFB7, LBP_H3 },
+       { 0xAFB8, 0xAFB8, LBP_H2 },
+       { 0xAFB9, 0xAFD3, LBP_H3 },
+       { 0xAFD4, 0xAFD4, LBP_H2 },
+       { 0xAFD5, 0xAFEF, LBP_H3 },
+       { 0xAFF0, 0xAFF0, LBP_H2 },
+       { 0xAFF1, 0xB00B, LBP_H3 },
+       { 0xB00C, 0xB00C, LBP_H2 },
+       { 0xB00D, 0xB027, LBP_H3 },
+       { 0xB028, 0xB028, LBP_H2 },
+       { 0xB029, 0xB043, LBP_H3 },
+       { 0xB044, 0xB044, LBP_H2 },
+       { 0xB045, 0xB05F, LBP_H3 },
+       { 0xB060, 0xB060, LBP_H2 },
+       { 0xB061, 0xB07B, LBP_H3 },
+       { 0xB07C, 0xB07C, LBP_H2 },
+       { 0xB07D, 0xB097, LBP_H3 },
+       { 0xB098, 0xB098, LBP_H2 },
+       { 0xB099, 0xB0B3, LBP_H3 },
+       { 0xB0B4, 0xB0B4, LBP_H2 },
+       { 0xB0B5, 0xB0CF, LBP_H3 },
+       { 0xB0D0, 0xB0D0, LBP_H2 },
+       { 0xB0D1, 0xB0EB, LBP_H3 },
+       { 0xB0EC, 0xB0EC, LBP_H2 },
+       { 0xB0ED, 0xB107, LBP_H3 },
+       { 0xB108, 0xB108, LBP_H2 },
+       { 0xB109, 0xB123, LBP_H3 },
+       { 0xB124, 0xB124, LBP_H2 },
+       { 0xB125, 0xB13F, LBP_H3 },
+       { 0xB140, 0xB140, LBP_H2 },
+       { 0xB141, 0xB15B, LBP_H3 },
+       { 0xB15C, 0xB15C, LBP_H2 },
+       { 0xB15D, 0xB177, LBP_H3 },
+       { 0xB178, 0xB178, LBP_H2 },
+       { 0xB179, 0xB193, LBP_H3 },
+       { 0xB194, 0xB194, LBP_H2 },
+       { 0xB195, 0xB1AF, LBP_H3 },
+       { 0xB1B0, 0xB1B0, LBP_H2 },
+       { 0xB1B1, 0xB1CB, LBP_H3 },
+       { 0xB1CC, 0xB1CC, LBP_H2 },
+       { 0xB1CD, 0xB1E7, LBP_H3 },
+       { 0xB1E8, 0xB1E8, LBP_H2 },
+       { 0xB1E9, 0xB203, LBP_H3 },
+       { 0xB204, 0xB204, LBP_H2 },
+       { 0xB205, 0xB21F, LBP_H3 },
+       { 0xB220, 0xB220, LBP_H2 },
+       { 0xB221, 0xB23B, LBP_H3 },
+       { 0xB23C, 0xB23C, LBP_H2 },
+       { 0xB23D, 0xB257, LBP_H3 },
+       { 0xB258, 0xB258, LBP_H2 },
+       { 0xB259, 0xB273, LBP_H3 },
+       { 0xB274, 0xB274, LBP_H2 },
+       { 0xB275, 0xB28F, LBP_H3 },
+       { 0xB290, 0xB290, LBP_H2 },
+       { 0xB291, 0xB2AB, LBP_H3 },
+       { 0xB2AC, 0xB2AC, LBP_H2 },
+       { 0xB2AD, 0xB2C7, LBP_H3 },
+       { 0xB2C8, 0xB2C8, LBP_H2 },
+       { 0xB2C9, 0xB2E3, LBP_H3 },
+       { 0xB2E4, 0xB2E4, LBP_H2 },
+       { 0xB2E5, 0xB2FF, LBP_H3 },
+       { 0xB300, 0xB300, LBP_H2 },
+       { 0xB301, 0xB31B, LBP_H3 },
+       { 0xB31C, 0xB31C, LBP_H2 },
+       { 0xB31D, 0xB337, LBP_H3 },
+       { 0xB338, 0xB338, LBP_H2 },
+       { 0xB339, 0xB353, LBP_H3 },
+       { 0xB354, 0xB354, LBP_H2 },
+       { 0xB355, 0xB36F, LBP_H3 },
+       { 0xB370, 0xB370, LBP_H2 },
+       { 0xB371, 0xB38B, LBP_H3 },
+       { 0xB38C, 0xB38C, LBP_H2 },
+       { 0xB38D, 0xB3A7, LBP_H3 },
+       { 0xB3A8, 0xB3A8, LBP_H2 },
+       { 0xB3A9, 0xB3C3, LBP_H3 },
+       { 0xB3C4, 0xB3C4, LBP_H2 },
+       { 0xB3C5, 0xB3DF, LBP_H3 },
+       { 0xB3E0, 0xB3E0, LBP_H2 },
+       { 0xB3E1, 0xB3FB, LBP_H3 },
+       { 0xB3FC, 0xB3FC, LBP_H2 },
+       { 0xB3FD, 0xB417, LBP_H3 },
+       { 0xB418, 0xB418, LBP_H2 },
+       { 0xB419, 0xB433, LBP_H3 },
+       { 0xB434, 0xB434, LBP_H2 },
+       { 0xB435, 0xB44F, LBP_H3 },
+       { 0xB450, 0xB450, LBP_H2 },
+       { 0xB451, 0xB46B, LBP_H3 },
+       { 0xB46C, 0xB46C, LBP_H2 },
+       { 0xB46D, 0xB487, LBP_H3 },
+       { 0xB488, 0xB488, LBP_H2 },
+       { 0xB489, 0xB4A3, LBP_H3 },
+       { 0xB4A4, 0xB4A4, LBP_H2 },
+       { 0xB4A5, 0xB4BF, LBP_H3 },
+       { 0xB4C0, 0xB4C0, LBP_H2 },
+       { 0xB4C1, 0xB4DB, LBP_H3 },
+       { 0xB4DC, 0xB4DC, LBP_H2 },
+       { 0xB4DD, 0xB4F7, LBP_H3 },
+       { 0xB4F8, 0xB4F8, LBP_H2 },
+       { 0xB4F9, 0xB513, LBP_H3 },
+       { 0xB514, 0xB514, LBP_H2 },
+       { 0xB515, 0xB52F, LBP_H3 },
+       { 0xB530, 0xB530, LBP_H2 },
+       { 0xB531, 0xB54B, LBP_H3 },
+       { 0xB54C, 0xB54C, LBP_H2 },
+       { 0xB54D, 0xB567, LBP_H3 },
+       { 0xB568, 0xB568, LBP_H2 },
+       { 0xB569, 0xB583, LBP_H3 },
+       { 0xB584, 0xB584, LBP_H2 },
+       { 0xB585, 0xB59F, LBP_H3 },
+       { 0xB5A0, 0xB5A0, LBP_H2 },
+       { 0xB5A1, 0xB5BB, LBP_H3 },
+       { 0xB5BC, 0xB5BC, LBP_H2 },
+       { 0xB5BD, 0xB5D7, LBP_H3 },
+       { 0xB5D8, 0xB5D8, LBP_H2 },
+       { 0xB5D9, 0xB5F3, LBP_H3 },
+       { 0xB5F4, 0xB5F4, LBP_H2 },
+       { 0xB5F5, 0xB60F, LBP_H3 },
+       { 0xB610, 0xB610, LBP_H2 },
+       { 0xB611, 0xB62B, LBP_H3 },
+       { 0xB62C, 0xB62C, LBP_H2 },
+       { 0xB62D, 0xB647, LBP_H3 },
+       { 0xB648, 0xB648, LBP_H2 },
+       { 0xB649, 0xB663, LBP_H3 },
+       { 0xB664, 0xB664, LBP_H2 },
+       { 0xB665, 0xB67F, LBP_H3 },
+       { 0xB680, 0xB680, LBP_H2 },
+       { 0xB681, 0xB69B, LBP_H3 },
+       { 0xB69C, 0xB69C, LBP_H2 },
+       { 0xB69D, 0xB6B7, LBP_H3 },
+       { 0xB6B8, 0xB6B8, LBP_H2 },
+       { 0xB6B9, 0xB6D3, LBP_H3 },
+       { 0xB6D4, 0xB6D4, LBP_H2 },
+       { 0xB6D5, 0xB6EF, LBP_H3 },
+       { 0xB6F0, 0xB6F0, LBP_H2 },
+       { 0xB6F1, 0xB70B, LBP_H3 },
+       { 0xB70C, 0xB70C, LBP_H2 },
+       { 0xB70D, 0xB727, LBP_H3 },
+       { 0xB728, 0xB728, LBP_H2 },
+       { 0xB729, 0xB743, LBP_H3 },
+       { 0xB744, 0xB744, LBP_H2 },
+       { 0xB745, 0xB75F, LBP_H3 },
+       { 0xB760, 0xB760, LBP_H2 },
+       { 0xB761, 0xB77B, LBP_H3 },
+       { 0xB77C, 0xB77C, LBP_H2 },
+       { 0xB77D, 0xB797, LBP_H3 },
+       { 0xB798, 0xB798, LBP_H2 },
+       { 0xB799, 0xB7B3, LBP_H3 },
+       { 0xB7B4, 0xB7B4, LBP_H2 },
+       { 0xB7B5, 0xB7CF, LBP_H3 },
+       { 0xB7D0, 0xB7D0, LBP_H2 },
+       { 0xB7D1, 0xB7EB, LBP_H3 },
+       { 0xB7EC, 0xB7EC, LBP_H2 },
+       { 0xB7ED, 0xB807, LBP_H3 },
+       { 0xB808, 0xB808, LBP_H2 },
+       { 0xB809, 0xB823, LBP_H3 },
+       { 0xB824, 0xB824, LBP_H2 },
+       { 0xB825, 0xB83F, LBP_H3 },
+       { 0xB840, 0xB840, LBP_H2 },
+       { 0xB841, 0xB85B, LBP_H3 },
+       { 0xB85C, 0xB85C, LBP_H2 },
+       { 0xB85D, 0xB877, LBP_H3 },
+       { 0xB878, 0xB878, LBP_H2 },
+       { 0xB879, 0xB893, LBP_H3 },
+       { 0xB894, 0xB894, LBP_H2 },
+       { 0xB895, 0xB8AF, LBP_H3 },
+       { 0xB8B0, 0xB8B0, LBP_H2 },
+       { 0xB8B1, 0xB8CB, LBP_H3 },
+       { 0xB8CC, 0xB8CC, LBP_H2 },
+       { 0xB8CD, 0xB8E7, LBP_H3 },
+       { 0xB8E8, 0xB8E8, LBP_H2 },
+       { 0xB8E9, 0xB903, LBP_H3 },
+       { 0xB904, 0xB904, LBP_H2 },
+       { 0xB905, 0xB91F, LBP_H3 },
+       { 0xB920, 0xB920, LBP_H2 },
+       { 0xB921, 0xB93B, LBP_H3 },
+       { 0xB93C, 0xB93C, LBP_H2 },
+       { 0xB93D, 0xB957, LBP_H3 },
+       { 0xB958, 0xB958, LBP_H2 },
+       { 0xB959, 0xB973, LBP_H3 },
+       { 0xB974, 0xB974, LBP_H2 },
+       { 0xB975, 0xB98F, LBP_H3 },
+       { 0xB990, 0xB990, LBP_H2 },
+       { 0xB991, 0xB9AB, LBP_H3 },
+       { 0xB9AC, 0xB9AC, LBP_H2 },
+       { 0xB9AD, 0xB9C7, LBP_H3 },
+       { 0xB9C8, 0xB9C8, LBP_H2 },
+       { 0xB9C9, 0xB9E3, LBP_H3 },
+       { 0xB9E4, 0xB9E4, LBP_H2 },
+       { 0xB9E5, 0xB9FF, LBP_H3 },
+       { 0xBA00, 0xBA00, LBP_H2 },
+       { 0xBA01, 0xBA1B, LBP_H3 },
+       { 0xBA1C, 0xBA1C, LBP_H2 },
+       { 0xBA1D, 0xBA37, LBP_H3 },
+       { 0xBA38, 0xBA38, LBP_H2 },
+       { 0xBA39, 0xBA53, LBP_H3 },
+       { 0xBA54, 0xBA54, LBP_H2 },
+       { 0xBA55, 0xBA6F, LBP_H3 },
+       { 0xBA70, 0xBA70, LBP_H2 },
+       { 0xBA71, 0xBA8B, LBP_H3 },
+       { 0xBA8C, 0xBA8C, LBP_H2 },
+       { 0xBA8D, 0xBAA7, LBP_H3 },
+       { 0xBAA8, 0xBAA8, LBP_H2 },
+       { 0xBAA9, 0xBAC3, LBP_H3 },
+       { 0xBAC4, 0xBAC4, LBP_H2 },
+       { 0xBAC5, 0xBADF, LBP_H3 },
+       { 0xBAE0, 0xBAE0, LBP_H2 },
+       { 0xBAE1, 0xBAFB, LBP_H3 },
+       { 0xBAFC, 0xBAFC, LBP_H2 },
+       { 0xBAFD, 0xBB17, LBP_H3 },
+       { 0xBB18, 0xBB18, LBP_H2 },
+       { 0xBB19, 0xBB33, LBP_H3 },
+       { 0xBB34, 0xBB34, LBP_H2 },
+       { 0xBB35, 0xBB4F, LBP_H3 },
+       { 0xBB50, 0xBB50, LBP_H2 },
+       { 0xBB51, 0xBB6B, LBP_H3 },
+       { 0xBB6C, 0xBB6C, LBP_H2 },
+       { 0xBB6D, 0xBB87, LBP_H3 },
+       { 0xBB88, 0xBB88, LBP_H2 },
+       { 0xBB89, 0xBBA3, LBP_H3 },
+       { 0xBBA4, 0xBBA4, LBP_H2 },
+       { 0xBBA5, 0xBBBF, LBP_H3 },
+       { 0xBBC0, 0xBBC0, LBP_H2 },
+       { 0xBBC1, 0xBBDB, LBP_H3 },
+       { 0xBBDC, 0xBBDC, LBP_H2 },
+       { 0xBBDD, 0xBBF7, LBP_H3 },
+       { 0xBBF8, 0xBBF8, LBP_H2 },
+       { 0xBBF9, 0xBC13, LBP_H3 },
+       { 0xBC14, 0xBC14, LBP_H2 },
+       { 0xBC15, 0xBC2F, LBP_H3 },
+       { 0xBC30, 0xBC30, LBP_H2 },
+       { 0xBC31, 0xBC4B, LBP_H3 },
+       { 0xBC4C, 0xBC4C, LBP_H2 },
+       { 0xBC4D, 0xBC67, LBP_H3 },
+       { 0xBC68, 0xBC68, LBP_H2 },
+       { 0xBC69, 0xBC83, LBP_H3 },
+       { 0xBC84, 0xBC84, LBP_H2 },
+       { 0xBC85, 0xBC9F, LBP_H3 },
+       { 0xBCA0, 0xBCA0, LBP_H2 },
+       { 0xBCA1, 0xBCBB, LBP_H3 },
+       { 0xBCBC, 0xBCBC, LBP_H2 },
+       { 0xBCBD, 0xBCD7, LBP_H3 },
+       { 0xBCD8, 0xBCD8, LBP_H2 },
+       { 0xBCD9, 0xBCF3, LBP_H3 },
+       { 0xBCF4, 0xBCF4, LBP_H2 },
+       { 0xBCF5, 0xBD0F, LBP_H3 },
+       { 0xBD10, 0xBD10, LBP_H2 },
+       { 0xBD11, 0xBD2B, LBP_H3 },
+       { 0xBD2C, 0xBD2C, LBP_H2 },
+       { 0xBD2D, 0xBD47, LBP_H3 },
+       { 0xBD48, 0xBD48, LBP_H2 },
+       { 0xBD49, 0xBD63, LBP_H3 },
+       { 0xBD64, 0xBD64, LBP_H2 },
+       { 0xBD65, 0xBD7F, LBP_H3 },
+       { 0xBD80, 0xBD80, LBP_H2 },
+       { 0xBD81, 0xBD9B, LBP_H3 },
+       { 0xBD9C, 0xBD9C, LBP_H2 },
+       { 0xBD9D, 0xBDB7, LBP_H3 },
+       { 0xBDB8, 0xBDB8, LBP_H2 },
+       { 0xBDB9, 0xBDD3, LBP_H3 },
+       { 0xBDD4, 0xBDD4, LBP_H2 },
+       { 0xBDD5, 0xBDEF, LBP_H3 },
+       { 0xBDF0, 0xBDF0, LBP_H2 },
+       { 0xBDF1, 0xBE0B, LBP_H3 },
+       { 0xBE0C, 0xBE0C, LBP_H2 },
+       { 0xBE0D, 0xBE27, LBP_H3 },
+       { 0xBE28, 0xBE28, LBP_H2 },
+       { 0xBE29, 0xBE43, LBP_H3 },
+       { 0xBE44, 0xBE44, LBP_H2 },
+       { 0xBE45, 0xBE5F, LBP_H3 },
+       { 0xBE60, 0xBE60, LBP_H2 },
+       { 0xBE61, 0xBE7B, LBP_H3 },
+       { 0xBE7C, 0xBE7C, LBP_H2 },
+       { 0xBE7D, 0xBE97, LBP_H3 },
+       { 0xBE98, 0xBE98, LBP_H2 },
+       { 0xBE99, 0xBEB3, LBP_H3 },
+       { 0xBEB4, 0xBEB4, LBP_H2 },
+       { 0xBEB5, 0xBECF, LBP_H3 },
+       { 0xBED0, 0xBED0, LBP_H2 },
+       { 0xBED1, 0xBEEB, LBP_H3 },
+       { 0xBEEC, 0xBEEC, LBP_H2 },
+       { 0xBEED, 0xBF07, LBP_H3 },
+       { 0xBF08, 0xBF08, LBP_H2 },
+       { 0xBF09, 0xBF23, LBP_H3 },
+       { 0xBF24, 0xBF24, LBP_H2 },
+       { 0xBF25, 0xBF3F, LBP_H3 },
+       { 0xBF40, 0xBF40, LBP_H2 },
+       { 0xBF41, 0xBF5B, LBP_H3 },
+       { 0xBF5C, 0xBF5C, LBP_H2 },
+       { 0xBF5D, 0xBF77, LBP_H3 },
+       { 0xBF78, 0xBF78, LBP_H2 },
+       { 0xBF79, 0xBF93, LBP_H3 },
+       { 0xBF94, 0xBF94, LBP_H2 },
+       { 0xBF95, 0xBFAF, LBP_H3 },
+       { 0xBFB0, 0xBFB0, LBP_H2 },
+       { 0xBFB1, 0xBFCB, LBP_H3 },
+       { 0xBFCC, 0xBFCC, LBP_H2 },
+       { 0xBFCD, 0xBFE7, LBP_H3 },
+       { 0xBFE8, 0xBFE8, LBP_H2 },
+       { 0xBFE9, 0xC003, LBP_H3 },
+       { 0xC004, 0xC004, LBP_H2 },
+       { 0xC005, 0xC01F, LBP_H3 },
+       { 0xC020, 0xC020, LBP_H2 },
+       { 0xC021, 0xC03B, LBP_H3 },
+       { 0xC03C, 0xC03C, LBP_H2 },
+       { 0xC03D, 0xC057, LBP_H3 },
+       { 0xC058, 0xC058, LBP_H2 },
+       { 0xC059, 0xC073, LBP_H3 },
+       { 0xC074, 0xC074, LBP_H2 },
+       { 0xC075, 0xC08F, LBP_H3 },
+       { 0xC090, 0xC090, LBP_H2 },
+       { 0xC091, 0xC0AB, LBP_H3 },
+       { 0xC0AC, 0xC0AC, LBP_H2 },
+       { 0xC0AD, 0xC0C7, LBP_H3 },
+       { 0xC0C8, 0xC0C8, LBP_H2 },
+       { 0xC0C9, 0xC0E3, LBP_H3 },
+       { 0xC0E4, 0xC0E4, LBP_H2 },
+       { 0xC0E5, 0xC0FF, LBP_H3 },
+       { 0xC100, 0xC100, LBP_H2 },
+       { 0xC101, 0xC11B, LBP_H3 },
+       { 0xC11C, 0xC11C, LBP_H2 },
+       { 0xC11D, 0xC137, LBP_H3 },
+       { 0xC138, 0xC138, LBP_H2 },
+       { 0xC139, 0xC153, LBP_H3 },
+       { 0xC154, 0xC154, LBP_H2 },
+       { 0xC155, 0xC16F, LBP_H3 },
+       { 0xC170, 0xC170, LBP_H2 },
+       { 0xC171, 0xC18B, LBP_H3 },
+       { 0xC18C, 0xC18C, LBP_H2 },
+       { 0xC18D, 0xC1A7, LBP_H3 },
+       { 0xC1A8, 0xC1A8, LBP_H2 },
+       { 0xC1A9, 0xC1C3, LBP_H3 },
+       { 0xC1C4, 0xC1C4, LBP_H2 },
+       { 0xC1C5, 0xC1DF, LBP_H3 },
+       { 0xC1E0, 0xC1E0, LBP_H2 },
+       { 0xC1E1, 0xC1FB, LBP_H3 },
+       { 0xC1FC, 0xC1FC, LBP_H2 },
+       { 0xC1FD, 0xC217, LBP_H3 },
+       { 0xC218, 0xC218, LBP_H2 },
+       { 0xC219, 0xC233, LBP_H3 },
+       { 0xC234, 0xC234, LBP_H2 },
+       { 0xC235, 0xC24F, LBP_H3 },
+       { 0xC250, 0xC250, LBP_H2 },
+       { 0xC251, 0xC26B, LBP_H3 },
+       { 0xC26C, 0xC26C, LBP_H2 },
+       { 0xC26D, 0xC287, LBP_H3 },
+       { 0xC288, 0xC288, LBP_H2 },
+       { 0xC289, 0xC2A3, LBP_H3 },
+       { 0xC2A4, 0xC2A4, LBP_H2 },
+       { 0xC2A5, 0xC2BF, LBP_H3 },
+       { 0xC2C0, 0xC2C0, LBP_H2 },
+       { 0xC2C1, 0xC2DB, LBP_H3 },
+       { 0xC2DC, 0xC2DC, LBP_H2 },
+       { 0xC2DD, 0xC2F7, LBP_H3 },
+       { 0xC2F8, 0xC2F8, LBP_H2 },
+       { 0xC2F9, 0xC313, LBP_H3 },
+       { 0xC314, 0xC314, LBP_H2 },
+       { 0xC315, 0xC32F, LBP_H3 },
+       { 0xC330, 0xC330, LBP_H2 },
+       { 0xC331, 0xC34B, LBP_H3 },
+       { 0xC34C, 0xC34C, LBP_H2 },
+       { 0xC34D, 0xC367, LBP_H3 },
+       { 0xC368, 0xC368, LBP_H2 },
+       { 0xC369, 0xC383, LBP_H3 },
+       { 0xC384, 0xC384, LBP_H2 },
+       { 0xC385, 0xC39F, LBP_H3 },
+       { 0xC3A0, 0xC3A0, LBP_H2 },
+       { 0xC3A1, 0xC3BB, LBP_H3 },
+       { 0xC3BC, 0xC3BC, LBP_H2 },
+       { 0xC3BD, 0xC3D7, LBP_H3 },
+       { 0xC3D8, 0xC3D8, LBP_H2 },
+       { 0xC3D9, 0xC3F3, LBP_H3 },
+       { 0xC3F4, 0xC3F4, LBP_H2 },
+       { 0xC3F5, 0xC40F, LBP_H3 },
+       { 0xC410, 0xC410, LBP_H2 },
+       { 0xC411, 0xC42B, LBP_H3 },
+       { 0xC42C, 0xC42C, LBP_H2 },
+       { 0xC42D, 0xC447, LBP_H3 },
+       { 0xC448, 0xC448, LBP_H2 },
+       { 0xC449, 0xC463, LBP_H3 },
+       { 0xC464, 0xC464, LBP_H2 },
+       { 0xC465, 0xC47F, LBP_H3 },
+       { 0xC480, 0xC480, LBP_H2 },
+       { 0xC481, 0xC49B, LBP_H3 },
+       { 0xC49C, 0xC49C, LBP_H2 },
+       { 0xC49D, 0xC4B7, LBP_H3 },
+       { 0xC4B8, 0xC4B8, LBP_H2 },
+       { 0xC4B9, 0xC4D3, LBP_H3 },
+       { 0xC4D4, 0xC4D4, LBP_H2 },
+       { 0xC4D5, 0xC4EF, LBP_H3 },
+       { 0xC4F0, 0xC4F0, LBP_H2 },
+       { 0xC4F1, 0xC50B, LBP_H3 },
+       { 0xC50C, 0xC50C, LBP_H2 },
+       { 0xC50D, 0xC527, LBP_H3 },
+       { 0xC528, 0xC528, LBP_H2 },
+       { 0xC529, 0xC543, LBP_H3 },
+       { 0xC544, 0xC544, LBP_H2 },
+       { 0xC545, 0xC55F, LBP_H3 },
+       { 0xC560, 0xC560, LBP_H2 },
+       { 0xC561, 0xC57B, LBP_H3 },
+       { 0xC57C, 0xC57C, LBP_H2 },
+       { 0xC57D, 0xC597, LBP_H3 },
+       { 0xC598, 0xC598, LBP_H2 },
+       { 0xC599, 0xC5B3, LBP_H3 },
+       { 0xC5B4, 0xC5B4, LBP_H2 },
+       { 0xC5B5, 0xC5CF, LBP_H3 },
+       { 0xC5D0, 0xC5D0, LBP_H2 },
+       { 0xC5D1, 0xC5EB, LBP_H3 },
+       { 0xC5EC, 0xC5EC, LBP_H2 },
+       { 0xC5ED, 0xC607, LBP_H3 },
+       { 0xC608, 0xC608, LBP_H2 },
+       { 0xC609, 0xC623, LBP_H3 },
+       { 0xC624, 0xC624, LBP_H2 },
+       { 0xC625, 0xC63F, LBP_H3 },
+       { 0xC640, 0xC640, LBP_H2 },
+       { 0xC641, 0xC65B, LBP_H3 },
+       { 0xC65C, 0xC65C, LBP_H2 },
+       { 0xC65D, 0xC677, LBP_H3 },
+       { 0xC678, 0xC678, LBP_H2 },
+       { 0xC679, 0xC693, LBP_H3 },
+       { 0xC694, 0xC694, LBP_H2 },
+       { 0xC695, 0xC6AF, LBP_H3 },
+       { 0xC6B0, 0xC6B0, LBP_H2 },
+       { 0xC6B1, 0xC6CB, LBP_H3 },
+       { 0xC6CC, 0xC6CC, LBP_H2 },
+       { 0xC6CD, 0xC6E7, LBP_H3 },
+       { 0xC6E8, 0xC6E8, LBP_H2 },
+       { 0xC6E9, 0xC703, LBP_H3 },
+       { 0xC704, 0xC704, LBP_H2 },
+       { 0xC705, 0xC71F, LBP_H3 },
+       { 0xC720, 0xC720, LBP_H2 },
+       { 0xC721, 0xC73B, LBP_H3 },
+       { 0xC73C, 0xC73C, LBP_H2 },
+       { 0xC73D, 0xC757, LBP_H3 },
+       { 0xC758, 0xC758, LBP_H2 },
+       { 0xC759, 0xC773, LBP_H3 },
+       { 0xC774, 0xC774, LBP_H2 },
+       { 0xC775, 0xC78F, LBP_H3 },
+       { 0xC790, 0xC790, LBP_H2 },
+       { 0xC791, 0xC7AB, LBP_H3 },
+       { 0xC7AC, 0xC7AC, LBP_H2 },
+       { 0xC7AD, 0xC7C7, LBP_H3 },
+       { 0xC7C8, 0xC7C8, LBP_H2 },
+       { 0xC7C9, 0xC7E3, LBP_H3 },
+       { 0xC7E4, 0xC7E4, LBP_H2 },
+       { 0xC7E5, 0xC7FF, LBP_H3 },
+       { 0xC800, 0xC800, LBP_H2 },
+       { 0xC801, 0xC81B, LBP_H3 },
+       { 0xC81C, 0xC81C, LBP_H2 },
+       { 0xC81D, 0xC837, LBP_H3 },
+       { 0xC838, 0xC838, LBP_H2 },
+       { 0xC839, 0xC853, LBP_H3 },
+       { 0xC854, 0xC854, LBP_H2 },
+       { 0xC855, 0xC86F, LBP_H3 },
+       { 0xC870, 0xC870, LBP_H2 },
+       { 0xC871, 0xC88B, LBP_H3 },
+       { 0xC88C, 0xC88C, LBP_H2 },
+       { 0xC88D, 0xC8A7, LBP_H3 },
+       { 0xC8A8, 0xC8A8, LBP_H2 },
+       { 0xC8A9, 0xC8C3, LBP_H3 },
+       { 0xC8C4, 0xC8C4, LBP_H2 },
+       { 0xC8C5, 0xC8DF, LBP_H3 },
+       { 0xC8E0, 0xC8E0, LBP_H2 },
+       { 0xC8E1, 0xC8FB, LBP_H3 },
+       { 0xC8FC, 0xC8FC, LBP_H2 },
+       { 0xC8FD, 0xC917, LBP_H3 },
+       { 0xC918, 0xC918, LBP_H2 },
+       { 0xC919, 0xC933, LBP_H3 },
+       { 0xC934, 0xC934, LBP_H2 },
+       { 0xC935, 0xC94F, LBP_H3 },
+       { 0xC950, 0xC950, LBP_H2 },
+       { 0xC951, 0xC96B, LBP_H3 },
+       { 0xC96C, 0xC96C, LBP_H2 },
+       { 0xC96D, 0xC987, LBP_H3 },
+       { 0xC988, 0xC988, LBP_H2 },
+       { 0xC989, 0xC9A3, LBP_H3 },
+       { 0xC9A4, 0xC9A4, LBP_H2 },
+       { 0xC9A5, 0xC9BF, LBP_H3 },
+       { 0xC9C0, 0xC9C0, LBP_H2 },
+       { 0xC9C1, 0xC9DB, LBP_H3 },
+       { 0xC9DC, 0xC9DC, LBP_H2 },
+       { 0xC9DD, 0xC9F7, LBP_H3 },
+       { 0xC9F8, 0xC9F8, LBP_H2 },
+       { 0xC9F9, 0xCA13, LBP_H3 },
+       { 0xCA14, 0xCA14, LBP_H2 },
+       { 0xCA15, 0xCA2F, LBP_H3 },
+       { 0xCA30, 0xCA30, LBP_H2 },
+       { 0xCA31, 0xCA4B, LBP_H3 },
+       { 0xCA4C, 0xCA4C, LBP_H2 },
+       { 0xCA4D, 0xCA67, LBP_H3 },
+       { 0xCA68, 0xCA68, LBP_H2 },
+       { 0xCA69, 0xCA83, LBP_H3 },
+       { 0xCA84, 0xCA84, LBP_H2 },
+       { 0xCA85, 0xCA9F, LBP_H3 },
+       { 0xCAA0, 0xCAA0, LBP_H2 },
+       { 0xCAA1, 0xCABB, LBP_H3 },
+       { 0xCABC, 0xCABC, LBP_H2 },
+       { 0xCABD, 0xCAD7, LBP_H3 },
+       { 0xCAD8, 0xCAD8, LBP_H2 },
+       { 0xCAD9, 0xCAF3, LBP_H3 },
+       { 0xCAF4, 0xCAF4, LBP_H2 },
+       { 0xCAF5, 0xCB0F, LBP_H3 },
+       { 0xCB10, 0xCB10, LBP_H2 },
+       { 0xCB11, 0xCB2B, LBP_H3 },
+       { 0xCB2C, 0xCB2C, LBP_H2 },
+       { 0xCB2D, 0xCB47, LBP_H3 },
+       { 0xCB48, 0xCB48, LBP_H2 },
+       { 0xCB49, 0xCB63, LBP_H3 },
+       { 0xCB64, 0xCB64, LBP_H2 },
+       { 0xCB65, 0xCB7F, LBP_H3 },
+       { 0xCB80, 0xCB80, LBP_H2 },
+       { 0xCB81, 0xCB9B, LBP_H3 },
+       { 0xCB9C, 0xCB9C, LBP_H2 },
+       { 0xCB9D, 0xCBB7, LBP_H3 },
+       { 0xCBB8, 0xCBB8, LBP_H2 },
+       { 0xCBB9, 0xCBD3, LBP_H3 },
+       { 0xCBD4, 0xCBD4, LBP_H2 },
+       { 0xCBD5, 0xCBEF, LBP_H3 },
+       { 0xCBF0, 0xCBF0, LBP_H2 },
+       { 0xCBF1, 0xCC0B, LBP_H3 },
+       { 0xCC0C, 0xCC0C, LBP_H2 },
+       { 0xCC0D, 0xCC27, LBP_H3 },
+       { 0xCC28, 0xCC28, LBP_H2 },
+       { 0xCC29, 0xCC43, LBP_H3 },
+       { 0xCC44, 0xCC44, LBP_H2 },
+       { 0xCC45, 0xCC5F, LBP_H3 },
+       { 0xCC60, 0xCC60, LBP_H2 },
+       { 0xCC61, 0xCC7B, LBP_H3 },
+       { 0xCC7C, 0xCC7C, LBP_H2 },
+       { 0xCC7D, 0xCC97, LBP_H3 },
+       { 0xCC98, 0xCC98, LBP_H2 },
+       { 0xCC99, 0xCCB3, LBP_H3 },
+       { 0xCCB4, 0xCCB4, LBP_H2 },
+       { 0xCCB5, 0xCCCF, LBP_H3 },
+       { 0xCCD0, 0xCCD0, LBP_H2 },
+       { 0xCCD1, 0xCCEB, LBP_H3 },
+       { 0xCCEC, 0xCCEC, LBP_H2 },
+       { 0xCCED, 0xCD07, LBP_H3 },
+       { 0xCD08, 0xCD08, LBP_H2 },
+       { 0xCD09, 0xCD23, LBP_H3 },
+       { 0xCD24, 0xCD24, LBP_H2 },
+       { 0xCD25, 0xCD3F, LBP_H3 },
+       { 0xCD40, 0xCD40, LBP_H2 },
+       { 0xCD41, 0xCD5B, LBP_H3 },
+       { 0xCD5C, 0xCD5C, LBP_H2 },
+       { 0xCD5D, 0xCD77, LBP_H3 },
+       { 0xCD78, 0xCD78, LBP_H2 },
+       { 0xCD79, 0xCD93, LBP_H3 },
+       { 0xCD94, 0xCD94, LBP_H2 },
+       { 0xCD95, 0xCDAF, LBP_H3 },
+       { 0xCDB0, 0xCDB0, LBP_H2 },
+       { 0xCDB1, 0xCDCB, LBP_H3 },
+       { 0xCDCC, 0xCDCC, LBP_H2 },
+       { 0xCDCD, 0xCDE7, LBP_H3 },
+       { 0xCDE8, 0xCDE8, LBP_H2 },
+       { 0xCDE9, 0xCE03, LBP_H3 },
+       { 0xCE04, 0xCE04, LBP_H2 },
+       { 0xCE05, 0xCE1F, LBP_H3 },
+       { 0xCE20, 0xCE20, LBP_H2 },
+       { 0xCE21, 0xCE3B, LBP_H3 },
+       { 0xCE3C, 0xCE3C, LBP_H2 },
+       { 0xCE3D, 0xCE57, LBP_H3 },
+       { 0xCE58, 0xCE58, LBP_H2 },
+       { 0xCE59, 0xCE73, LBP_H3 },
+       { 0xCE74, 0xCE74, LBP_H2 },
+       { 0xCE75, 0xCE8F, LBP_H3 },
+       { 0xCE90, 0xCE90, LBP_H2 },
+       { 0xCE91, 0xCEAB, LBP_H3 },
+       { 0xCEAC, 0xCEAC, LBP_H2 },
+       { 0xCEAD, 0xCEC7, LBP_H3 },
+       { 0xCEC8, 0xCEC8, LBP_H2 },
+       { 0xCEC9, 0xCEE3, LBP_H3 },
+       { 0xCEE4, 0xCEE4, LBP_H2 },
+       { 0xCEE5, 0xCEFF, LBP_H3 },
+       { 0xCF00, 0xCF00, LBP_H2 },
+       { 0xCF01, 0xCF1B, LBP_H3 },
+       { 0xCF1C, 0xCF1C, LBP_H2 },
+       { 0xCF1D, 0xCF37, LBP_H3 },
+       { 0xCF38, 0xCF38, LBP_H2 },
+       { 0xCF39, 0xCF53, LBP_H3 },
+       { 0xCF54, 0xCF54, LBP_H2 },
+       { 0xCF55, 0xCF6F, LBP_H3 },
+       { 0xCF70, 0xCF70, LBP_H2 },
+       { 0xCF71, 0xCF8B, LBP_H3 },
+       { 0xCF8C, 0xCF8C, LBP_H2 },
+       { 0xCF8D, 0xCFA7, LBP_H3 },
+       { 0xCFA8, 0xCFA8, LBP_H2 },
+       { 0xCFA9, 0xCFC3, LBP_H3 },
+       { 0xCFC4, 0xCFC4, LBP_H2 },
+       { 0xCFC5, 0xCFDF, LBP_H3 },
+       { 0xCFE0, 0xCFE0, LBP_H2 },
+       { 0xCFE1, 0xCFFB, LBP_H3 },
+       { 0xCFFC, 0xCFFC, LBP_H2 },
+       { 0xCFFD, 0xD017, LBP_H3 },
+       { 0xD018, 0xD018, LBP_H2 },
+       { 0xD019, 0xD033, LBP_H3 },
+       { 0xD034, 0xD034, LBP_H2 },
+       { 0xD035, 0xD04F, LBP_H3 },
+       { 0xD050, 0xD050, LBP_H2 },
+       { 0xD051, 0xD06B, LBP_H3 },
+       { 0xD06C, 0xD06C, LBP_H2 },
+       { 0xD06D, 0xD087, LBP_H3 },
+       { 0xD088, 0xD088, LBP_H2 },
+       { 0xD089, 0xD0A3, LBP_H3 },
+       { 0xD0A4, 0xD0A4, LBP_H2 },
+       { 0xD0A5, 0xD0BF, LBP_H3 },
+       { 0xD0C0, 0xD0C0, LBP_H2 },
+       { 0xD0C1, 0xD0DB, LBP_H3 },
+       { 0xD0DC, 0xD0DC, LBP_H2 },
+       { 0xD0DD, 0xD0F7, LBP_H3 },
+       { 0xD0F8, 0xD0F8, LBP_H2 },
+       { 0xD0F9, 0xD113, LBP_H3 },
+       { 0xD114, 0xD114, LBP_H2 },
+       { 0xD115, 0xD12F, LBP_H3 },
+       { 0xD130, 0xD130, LBP_H2 },
+       { 0xD131, 0xD14B, LBP_H3 },
+       { 0xD14C, 0xD14C, LBP_H2 },
+       { 0xD14D, 0xD167, LBP_H3 },
+       { 0xD168, 0xD168, LBP_H2 },
+       { 0xD169, 0xD183, LBP_H3 },
+       { 0xD184, 0xD184, LBP_H2 },
+       { 0xD185, 0xD19F, LBP_H3 },
+       { 0xD1A0, 0xD1A0, LBP_H2 },
+       { 0xD1A1, 0xD1BB, LBP_H3 },
+       { 0xD1BC, 0xD1BC, LBP_H2 },
+       { 0xD1BD, 0xD1D7, LBP_H3 },
+       { 0xD1D8, 0xD1D8, LBP_H2 },
+       { 0xD1D9, 0xD1F3, LBP_H3 },
+       { 0xD1F4, 0xD1F4, LBP_H2 },
+       { 0xD1F5, 0xD20F, LBP_H3 },
+       { 0xD210, 0xD210, LBP_H2 },
+       { 0xD211, 0xD22B, LBP_H3 },
+       { 0xD22C, 0xD22C, LBP_H2 },
+       { 0xD22D, 0xD247, LBP_H3 },
+       { 0xD248, 0xD248, LBP_H2 },
+       { 0xD249, 0xD263, LBP_H3 },
+       { 0xD264, 0xD264, LBP_H2 },
+       { 0xD265, 0xD27F, LBP_H3 },
+       { 0xD280, 0xD280, LBP_H2 },
+       { 0xD281, 0xD29B, LBP_H3 },
+       { 0xD29C, 0xD29C, LBP_H2 },
+       { 0xD29D, 0xD2B7, LBP_H3 },
+       { 0xD2B8, 0xD2B8, LBP_H2 },
+       { 0xD2B9, 0xD2D3, LBP_H3 },
+       { 0xD2D4, 0xD2D4, LBP_H2 },
+       { 0xD2D5, 0xD2EF, LBP_H3 },
+       { 0xD2F0, 0xD2F0, LBP_H2 },
+       { 0xD2F1, 0xD30B, LBP_H3 },
+       { 0xD30C, 0xD30C, LBP_H2 },
+       { 0xD30D, 0xD327, LBP_H3 },
+       { 0xD328, 0xD328, LBP_H2 },
+       { 0xD329, 0xD343, LBP_H3 },
+       { 0xD344, 0xD344, LBP_H2 },
+       { 0xD345, 0xD35F, LBP_H3 },
+       { 0xD360, 0xD360, LBP_H2 },
+       { 0xD361, 0xD37B, LBP_H3 },
+       { 0xD37C, 0xD37C, LBP_H2 },
+       { 0xD37D, 0xD397, LBP_H3 },
+       { 0xD398, 0xD398, LBP_H2 },
+       { 0xD399, 0xD3B3, LBP_H3 },
+       { 0xD3B4, 0xD3B4, LBP_H2 },
+       { 0xD3B5, 0xD3CF, LBP_H3 },
+       { 0xD3D0, 0xD3D0, LBP_H2 },
+       { 0xD3D1, 0xD3EB, LBP_H3 },
+       { 0xD3EC, 0xD3EC, LBP_H2 },
+       { 0xD3ED, 0xD407, LBP_H3 },
+       { 0xD408, 0xD408, LBP_H2 },
+       { 0xD409, 0xD423, LBP_H3 },
+       { 0xD424, 0xD424, LBP_H2 },
+       { 0xD425, 0xD43F, LBP_H3 },
+       { 0xD440, 0xD440, LBP_H2 },
+       { 0xD441, 0xD45B, LBP_H3 },
+       { 0xD45C, 0xD45C, LBP_H2 },
+       { 0xD45D, 0xD477, LBP_H3 },
+       { 0xD478, 0xD478, LBP_H2 },
+       { 0xD479, 0xD493, LBP_H3 },
+       { 0xD494, 0xD494, LBP_H2 },
+       { 0xD495, 0xD4AF, LBP_H3 },
+       { 0xD4B0, 0xD4B0, LBP_H2 },
+       { 0xD4B1, 0xD4CB, LBP_H3 },
+       { 0xD4CC, 0xD4CC, LBP_H2 },
+       { 0xD4CD, 0xD4E7, LBP_H3 },
+       { 0xD4E8, 0xD4E8, LBP_H2 },
+       { 0xD4E9, 0xD503, LBP_H3 },
+       { 0xD504, 0xD504, LBP_H2 },
+       { 0xD505, 0xD51F, LBP_H3 },
+       { 0xD520, 0xD520, LBP_H2 },
+       { 0xD521, 0xD53B, LBP_H3 },
+       { 0xD53C, 0xD53C, LBP_H2 },
+       { 0xD53D, 0xD557, LBP_H3 },
+       { 0xD558, 0xD558, LBP_H2 },
+       { 0xD559, 0xD573, LBP_H3 },
+       { 0xD574, 0xD574, LBP_H2 },
+       { 0xD575, 0xD58F, LBP_H3 },
+       { 0xD590, 0xD590, LBP_H2 },
+       { 0xD591, 0xD5AB, LBP_H3 },
+       { 0xD5AC, 0xD5AC, LBP_H2 },
+       { 0xD5AD, 0xD5C7, LBP_H3 },
+       { 0xD5C8, 0xD5C8, LBP_H2 },
+       { 0xD5C9, 0xD5E3, LBP_H3 },
+       { 0xD5E4, 0xD5E4, LBP_H2 },
+       { 0xD5E5, 0xD5FF, LBP_H3 },
+       { 0xD600, 0xD600, LBP_H2 },
+       { 0xD601, 0xD61B, LBP_H3 },
+       { 0xD61C, 0xD61C, LBP_H2 },
+       { 0xD61D, 0xD637, LBP_H3 },
+       { 0xD638, 0xD638, LBP_H2 },
+       { 0xD639, 0xD653, LBP_H3 },
+       { 0xD654, 0xD654, LBP_H2 },
+       { 0xD655, 0xD66F, LBP_H3 },
+       { 0xD670, 0xD670, LBP_H2 },
+       { 0xD671, 0xD68B, LBP_H3 },
+       { 0xD68C, 0xD68C, LBP_H2 },
+       { 0xD68D, 0xD6A7, LBP_H3 },
+       { 0xD6A8, 0xD6A8, LBP_H2 },
+       { 0xD6A9, 0xD6C3, LBP_H3 },
+       { 0xD6C4, 0xD6C4, LBP_H2 },
+       { 0xD6C5, 0xD6DF, LBP_H3 },
+       { 0xD6E0, 0xD6E0, LBP_H2 },
+       { 0xD6E1, 0xD6FB, LBP_H3 },
+       { 0xD6FC, 0xD6FC, LBP_H2 },
+       { 0xD6FD, 0xD717, LBP_H3 },
+       { 0xD718, 0xD718, LBP_H2 },
+       { 0xD719, 0xD733, LBP_H3 },
+       { 0xD734, 0xD734, LBP_H2 },
+       { 0xD735, 0xD74F, LBP_H3 },
+       { 0xD750, 0xD750, LBP_H2 },
+       { 0xD751, 0xD76B, LBP_H3 },
+       { 0xD76C, 0xD76C, LBP_H2 },
+       { 0xD76D, 0xD787, LBP_H3 },
+       { 0xD788, 0xD788, LBP_H2 },
+       { 0xD789, 0xD7A3, LBP_H3 },
+       { 0xD7B0, 0xD7C6, LBP_JV },
+       { 0xD7CB, 0xD7FB, LBP_JT },
+       { 0xD800, 0xDFFF, LBP_SG },
+       { 0xE000, 0xF8FF, LBP_XX },
+       { 0xF900, 0xFAFF, LBP_ID },
+       { 0xFB00, 0xFB1D, LBP_AL },
+       { 0xFB1E, 0xFB1E, LBP_CM },
+       { 0xFB1F, 0xFD3D, LBP_AL },
+       { 0xFD3E, 0xFD3E, LBP_OP },
+       { 0xFD3F, 0xFD3F, LBP_CL },
+       { 0xFD50, 0xFDFB, LBP_AL },
+       { 0xFDFC, 0xFDFC, LBP_PO },
+       { 0xFDFD, 0xFDFD, LBP_AL },
+       { 0xFE00, 0xFE0F, LBP_CM },
+       { 0xFE10, 0xFE10, LBP_IS },
+       { 0xFE11, 0xFE12, LBP_CL },
+       { 0xFE13, 0xFE14, LBP_IS },
+       { 0xFE15, 0xFE16, LBP_EX },
+       { 0xFE17, 0xFE17, LBP_OP },
+       { 0xFE18, 0xFE18, LBP_CL },
+       { 0xFE19, 0xFE19, LBP_IN },
+       { 0xFE20, 0xFE26, LBP_CM },
+       { 0xFE30, 0xFE34, LBP_ID },
+       { 0xFE35, 0xFE35, LBP_OP },
+       { 0xFE36, 0xFE36, LBP_CL },
+       { 0xFE37, 0xFE37, LBP_OP },
+       { 0xFE38, 0xFE38, LBP_CL },
+       { 0xFE39, 0xFE39, LBP_OP },
+       { 0xFE3A, 0xFE3A, LBP_CL },
+       { 0xFE3B, 0xFE3B, LBP_OP },
+       { 0xFE3C, 0xFE3C, LBP_CL },
+       { 0xFE3D, 0xFE3D, LBP_OP },
+       { 0xFE3E, 0xFE3E, LBP_CL },
+       { 0xFE3F, 0xFE3F, LBP_OP },
+       { 0xFE40, 0xFE40, LBP_CL },
+       { 0xFE41, 0xFE41, LBP_OP },
+       { 0xFE42, 0xFE42, LBP_CL },
+       { 0xFE43, 0xFE43, LBP_OP },
+       { 0xFE44, 0xFE44, LBP_CL },
+       { 0xFE45, 0xFE46, LBP_ID },
+       { 0xFE47, 0xFE47, LBP_OP },
+       { 0xFE48, 0xFE48, LBP_CL },
+       { 0xFE49, 0xFE4F, LBP_ID },
+       { 0xFE50, 0xFE50, LBP_CL },
+       { 0xFE51, 0xFE51, LBP_ID },
+       { 0xFE52, 0xFE52, LBP_CL },
+       { 0xFE54, 0xFE55, LBP_NS },
+       { 0xFE56, 0xFE57, LBP_EX },
+       { 0xFE58, 0xFE58, LBP_ID },
+       { 0xFE59, 0xFE59, LBP_OP },
+       { 0xFE5A, 0xFE5A, LBP_CL },
+       { 0xFE5B, 0xFE5B, LBP_OP },
+       { 0xFE5C, 0xFE5C, LBP_CL },
+       { 0xFE5D, 0xFE5D, LBP_OP },
+       { 0xFE5E, 0xFE5E, LBP_CL },
+       { 0xFE5F, 0xFE68, LBP_ID },
+       { 0xFE69, 0xFE69, LBP_PR },
+       { 0xFE6A, 0xFE6A, LBP_PO },
+       { 0xFE6B, 0xFE6B, LBP_ID },
+       { 0xFE70, 0xFEFC, LBP_AL },
+       { 0xFEFF, 0xFEFF, LBP_WJ },
+       { 0xFF01, 0xFF01, LBP_EX },
+       { 0xFF02, 0xFF03, LBP_ID },
+       { 0xFF04, 0xFF04, LBP_PR },
+       { 0xFF05, 0xFF05, LBP_PO },
+       { 0xFF06, 0xFF07, LBP_ID },
+       { 0xFF08, 0xFF08, LBP_OP },
+       { 0xFF09, 0xFF09, LBP_CL },
+       { 0xFF0A, 0xFF0B, LBP_ID },
+       { 0xFF0C, 0xFF0C, LBP_CL },
+       { 0xFF0D, 0xFF0D, LBP_ID },
+       { 0xFF0E, 0xFF0E, LBP_CL },
+       { 0xFF0F, 0xFF19, LBP_ID },
+       { 0xFF1A, 0xFF1B, LBP_NS },
+       { 0xFF1C, 0xFF1E, LBP_ID },
+       { 0xFF1F, 0xFF1F, LBP_EX },
+       { 0xFF20, 0xFF3A, LBP_ID },
+       { 0xFF3B, 0xFF3B, LBP_OP },
+       { 0xFF3C, 0xFF3C, LBP_ID },
+       { 0xFF3D, 0xFF3D, LBP_CL },
+       { 0xFF3E, 0xFF5A, LBP_ID },
+       { 0xFF5B, 0xFF5B, LBP_OP },
+       { 0xFF5C, 0xFF5C, LBP_ID },
+       { 0xFF5D, 0xFF5D, LBP_CL },
+       { 0xFF5E, 0xFF5E, LBP_ID },
+       { 0xFF5F, 0xFF5F, LBP_OP },
+       { 0xFF60, 0xFF61, LBP_CL },
+       { 0xFF62, 0xFF62, LBP_OP },
+       { 0xFF63, 0xFF64, LBP_CL },
+       { 0xFF65, 0xFF65, LBP_NS },
+       { 0xFF66, 0xFF66, LBP_AL },
+       { 0xFF67, 0xFF70, LBP_NS },
+       { 0xFF71, 0xFF9D, LBP_AL },
+       { 0xFF9E, 0xFF9F, LBP_NS },
+       { 0xFFA0, 0xFFDC, LBP_AL },
+       { 0xFFE0, 0xFFE0, LBP_PO },
+       { 0xFFE1, 0xFFE1, LBP_PR },
+       { 0xFFE2, 0xFFE4, LBP_ID },
+       { 0xFFE5, 0xFFE6, LBP_PR },
+       { 0xFFE8, 0xFFEE, LBP_AL },
+       { 0xFFF9, 0xFFFB, LBP_CM },
+       { 0xFFFC, 0xFFFC, LBP_CB },
+       { 0xFFFD, 0xFFFD, LBP_AI },
+       { 0x10000, 0x100FA, LBP_AL },
+       { 0x10100, 0x10102, LBP_BA },
+       { 0x10107, 0x101FC, LBP_AL },
+       { 0x101FD, 0x101FD, LBP_CM },
+       { 0x10280, 0x1039D, LBP_AL },
+       { 0x1039F, 0x1039F, LBP_BA },
+       { 0x103A0, 0x103CF, LBP_AL },
+       { 0x103D0, 0x103D0, LBP_BA },
+       { 0x103D1, 0x1049D, LBP_AL },
+       { 0x104A0, 0x104A9, LBP_NU },
+       { 0x10800, 0x10855, LBP_AL },
+       { 0x10857, 0x10857, LBP_BA },
+       { 0x10858, 0x1091B, LBP_AL },
+       { 0x1091F, 0x1091F, LBP_BA },
+       { 0x10920, 0x10A00, LBP_AL },
+       { 0x10A01, 0x10A0F, LBP_CM },
+       { 0x10A10, 0x10A33, LBP_AL },
+       { 0x10A38, 0x10A3F, LBP_CM },
+       { 0x10A40, 0x10A47, LBP_AL },
+       { 0x10A50, 0x10A57, LBP_BA },
+       { 0x10A58, 0x10B35, LBP_AL },
+       { 0x10B39, 0x10B3F, LBP_BA },
+       { 0x10B40, 0x10E7E, LBP_AL },
+       { 0x11000, 0x11002, LBP_CM },
+       { 0x11003, 0x11037, LBP_AL },
+       { 0x11038, 0x11046, LBP_CM },
+       { 0x11047, 0x11048, LBP_BA },
+       { 0x11049, 0x11065, LBP_AL },
+       { 0x11066, 0x1106F, LBP_NU },
+       { 0x11080, 0x11082, LBP_CM },
+       { 0x11083, 0x110AF, LBP_AL },
+       { 0x110B0, 0x110BA, LBP_CM },
+       { 0x110BB, 0x110BD, LBP_AL },
+       { 0x110BE, 0x110C1, LBP_BA },
+       { 0x12000, 0x12462, LBP_AL },
+       { 0x12470, 0x12473, LBP_BA },
+       { 0x13000, 0x13257, LBP_AL },
+       { 0x13258, 0x1325A, LBP_OP },
+       { 0x1325B, 0x1325D, LBP_CL },
+       { 0x1325E, 0x13281, LBP_AL },
+       { 0x13282, 0x13282, LBP_CL },
+       { 0x13283, 0x13285, LBP_AL },
+       { 0x13286, 0x13286, LBP_OP },
+       { 0x13287, 0x13287, LBP_CL },
+       { 0x13288, 0x13288, LBP_OP },
+       { 0x13289, 0x13289, LBP_CL },
+       { 0x1328A, 0x13378, LBP_AL },
+       { 0x13379, 0x13379, LBP_OP },
+       { 0x1337A, 0x1337B, LBP_CL },
+       { 0x1337C, 0x16A38, LBP_AL },
+       { 0x1B000, 0x1B001, LBP_ID },
+       { 0x1D000, 0x1D164, LBP_AL },
+       { 0x1D165, 0x1D169, LBP_CM },
+       { 0x1D16A, 0x1D16C, LBP_AL },
+       { 0x1D16D, 0x1D182, LBP_CM },
+       { 0x1D183, 0x1D184, LBP_AL },
+       { 0x1D185, 0x1D18B, LBP_CM },
+       { 0x1D18C, 0x1D1A9, LBP_AL },
+       { 0x1D1AA, 0x1D1AD, LBP_CM },
+       { 0x1D1AE, 0x1D241, LBP_AL },
+       { 0x1D242, 0x1D244, LBP_CM },
+       { 0x1D245, 0x1D7CB, LBP_AL },
+       { 0x1D7CE, 0x1D7FF, LBP_NU },
+       { 0x1F000, 0x1F0DF, LBP_AL },
+       { 0x1F100, 0x1F12D, LBP_AI },
+       { 0x1F12E, 0x1F12E, LBP_AL },
+       { 0x1F130, 0x1F19A, LBP_AI },
+       { 0x1F1E6, 0x1F1FF, LBP_AL },
+       { 0x1F200, 0x1F251, LBP_ID },
+       { 0x1F300, 0x1F773, LBP_AL },
+       { 0x20000, 0x3FFFD, LBP_ID },
+       { 0xE0001, 0xE01EF, LBP_CM },
+       { 0xF0000, 0x10FFFD, LBP_XX },
+       { 0xFFFFFFFF, 0xFFFFFFFF, LBP_Undefined }
+};
diff --git a/text/dali/internal/libunibreak/linebreakdef.c b/text/dali/internal/libunibreak/linebreakdef.c
new file mode 100644 (file)
index 0000000..9ddb4d9
--- /dev/null
@@ -0,0 +1,139 @@
+/* vim: set tabstop=4 shiftwidth=4: */
+
+/*
+ * Line breaking in a Unicode sequence.  Designed to be used in a
+ * generic text renderer.
+ *
+ * Copyright (C) 2008-2010 Wu Yongwei <wuyongwei at gmail dot com>
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty.  In no event will the author be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute
+ * it freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must
+ *    not claim that you wrote the original software.  If you use this
+ *    software in a product, an acknowledgement in the product
+ *    documentation would be appreciated but is not required.
+ * 2. Altered source versions must be plainly marked as such, and must
+ *    not be misrepresented as being the original software.
+ * 3. This notice may not be removed or altered from any source
+ *    distribution.
+ *
+ * The main reference is Unicode Standard Annex 14 (UAX #14):
+ *             <URL:http://www.unicode.org/reports/tr14/>
+ *
+ * When this library was designed, this annex was at Revision 19, for
+ * Unicode 5.0.0:
+ *             <URL:http://www.unicode.org/reports/tr14/tr14-19.html>
+ *
+ * This library has been updated according to Revision 24, for
+ * Unicode 5.2.0:
+ *             <URL:http://www.unicode.org/reports/tr14/tr14-24.html>
+ *
+ * The Unicode Terms of Use are available at
+ *             <URL:http://www.unicode.org/copyright.html>
+ */
+
+/**
+ * @file       linebreakdef.c
+ *
+ * Definition of language-specific data.
+ *
+ * @version    2.0, 2010/01/03
+ * @author     Wu Yongwei
+ */
+
+#include "linebreak.h"
+#include "linebreakdef.h"
+
+/**
+ * English-specifc data over the default Unicode rules.
+ */
+static struct LineBreakProperties lb_prop_English[] = {
+       { 0x2018, 0x2018, LBP_OP },     /* Left single quotation mark: opening */
+       { 0x201C, 0x201C, LBP_OP },     /* Left double quotation mark: opening */
+       { 0x201D, 0x201D, LBP_CL },     /* Right double quotation mark: closing */
+       { 0, 0, LBP_Undefined }
+};
+
+/**
+ * German-specifc data over the default Unicode rules.
+ */
+static struct LineBreakProperties lb_prop_German[] = {
+       { 0x00AB, 0x00AB, LBP_CL },     /* Left double angle quotation mark: closing */
+       { 0x00BB, 0x00BB, LBP_OP },     /* Right double angle quotation mark: opening */
+       { 0x2018, 0x2018, LBP_CL },     /* Left single quotation mark: closing */
+       { 0x201C, 0x201C, LBP_CL },     /* Left double quotation mark: closing */
+       { 0x2039, 0x2039, LBP_CL },     /* Left single angle quotation mark: closing */
+       { 0x203A, 0x203A, LBP_OP },     /* Right single angle quotation mark: opening */
+       { 0, 0, LBP_Undefined }
+};
+
+/**
+ * Spanish-specifc data over the default Unicode rules.
+ */
+static struct LineBreakProperties lb_prop_Spanish[] = {
+       { 0x00AB, 0x00AB, LBP_OP },     /* Left double angle quotation mark: opening */
+       { 0x00BB, 0x00BB, LBP_CL },     /* Right double angle quotation mark: closing */
+       { 0x2018, 0x2018, LBP_OP },     /* Left single quotation mark: opening */
+       { 0x201C, 0x201C, LBP_OP },     /* Left double quotation mark: opening */
+       { 0x201D, 0x201D, LBP_CL },     /* Right double quotation mark: closing */
+       { 0x2039, 0x2039, LBP_OP },     /* Left single angle quotation mark: opening */
+       { 0x203A, 0x203A, LBP_CL },     /* Right single angle quotation mark: closing */
+       { 0, 0, LBP_Undefined }
+};
+
+/**
+ * French-specifc data over the default Unicode rules.
+ */
+static struct LineBreakProperties lb_prop_French[] = {
+       { 0x00AB, 0x00AB, LBP_OP },     /* Left double angle quotation mark: opening */
+       { 0x00BB, 0x00BB, LBP_CL },     /* Right double angle quotation mark: closing */
+       { 0x2018, 0x2018, LBP_OP },     /* Left single quotation mark: opening */
+       { 0x201C, 0x201C, LBP_OP },     /* Left double quotation mark: opening */
+       { 0x201D, 0x201D, LBP_CL },     /* Right double quotation mark: closing */
+       { 0x2039, 0x2039, LBP_OP },     /* Left single angle quotation mark: opening */
+       { 0x203A, 0x203A, LBP_CL },     /* Right single angle quotation mark: closing */
+       { 0, 0, LBP_Undefined }
+};
+
+/**
+ * Russian-specifc data over the default Unicode rules.
+ */
+static struct LineBreakProperties lb_prop_Russian[] = {
+       { 0x00AB, 0x00AB, LBP_OP },     /* Left double angle quotation mark: opening */
+       { 0x00BB, 0x00BB, LBP_CL },     /* Right double angle quotation mark: closing */
+       { 0x201C, 0x201C, LBP_CL },     /* Left double quotation mark: closing */
+       { 0, 0, LBP_Undefined }
+};
+
+/**
+ * Chinese-specifc data over the default Unicode rules.
+ */
+static struct LineBreakProperties lb_prop_Chinese[] = {
+       { 0x2018, 0x2018, LBP_OP },     /* Left single quotation mark: opening */
+       { 0x2019, 0x2019, LBP_CL },     /* Right single quotation mark: closing */
+       { 0x201C, 0x201C, LBP_OP },     /* Left double quotation mark: opening */
+       { 0x201D, 0x201D, LBP_CL },     /* Right double quotation mark: closing */
+       { 0, 0, LBP_Undefined }
+};
+
+/**
+ * Association data of language-specific line breaking properties with
+ * language names.  This is the definition for the static data in this
+ * file.  If you want more flexibility, or do not need the data here,
+ * you may want to redefine \e lb_prop_lang_map in your C source file.
+ */
+struct LineBreakPropertiesLang lb_prop_lang_map[] = {
+       { "en", 2, lb_prop_English },
+       { "de", 2, lb_prop_German },
+       { "es", 2, lb_prop_Spanish },
+       { "fr", 2, lb_prop_French },
+       { "ru", 2, lb_prop_Russian },
+       { "zh", 2, lb_prop_Chinese },
+       { NULL, 0, NULL }
+};
diff --git a/text/dali/internal/libunibreak/linebreakdef.h b/text/dali/internal/libunibreak/linebreakdef.h
new file mode 100644 (file)
index 0000000..bc4eee2
--- /dev/null
@@ -0,0 +1,149 @@
+/* vim: set tabstop=4 shiftwidth=4: */
+
+/*
+ * Line breaking in a Unicode sequence.  Designed to be used in a
+ * generic text renderer.
+ *
+ * Copyright (C) 2008-2010 Wu Yongwei <wuyongwei at gmail dot com>
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty.  In no event will the author be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute
+ * it freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must
+ *    not claim that you wrote the original software.  If you use this
+ *    software in a product, an acknowledgement in the product
+ *    documentation would be appreciated but is not required.
+ * 2. Altered source versions must be plainly marked as such, and must
+ *    not be misrepresented as being the original software.
+ * 3. This notice may not be removed or altered from any source
+ *    distribution.
+ *
+ * The main reference is Unicode Standard Annex 14 (UAX #14):
+ *             <URL:http://www.unicode.org/reports/tr14/>
+ *
+ * When this library was designed, this annex was at Revision 19, for
+ * Unicode 5.0.0:
+ *             <URL:http://www.unicode.org/reports/tr14/tr14-19.html>
+ *
+ * This library has been updated according to Revision 24, for
+ * Unicode 5.2.0:
+ *             <URL:http://www.unicode.org/reports/tr14/tr14-24.html>
+ *
+ * The Unicode Terms of Use are available at
+ *             <URL:http://www.unicode.org/copyright.html>
+ */
+
+/**
+ * @file       linebreakdef.h
+ *
+ * Definitions of internal data structures, declarations of global
+ * variables, and function prototypes for the line breaking algorithm.
+ *
+ * @version    2.0, 2010/01/03
+ * @author     Wu Yongwei
+ */
+
+/**
+ * Constant value to mark the end of string.  It is not a valid Unicode
+ * character.
+ */
+#define EOS 0xFFFF
+
+/**
+ * Line break classes.  This is a direct mapping of Table 1 of Unicode
+ * Standard Annex 14, Revision 19.
+ */
+enum LineBreakClass
+{
+       /* This is used to signal an error condition. */
+       LBP_Undefined,  /**< Undefined */
+
+       /* The following break classes are treated in the pair table. */
+       LBP_OP,                 /**< Opening punctuation */
+       LBP_CL,                 /**< Closing punctuation */
+       LBP_CP,                 /**< Closing parenthesis */
+       LBP_QU,                 /**< Ambiguous quotation */
+       LBP_GL,                 /**< Glue */
+       LBP_NS,                 /**< Non-starters */
+       LBP_EX,                 /**< Exclamation/Interrogation */
+       LBP_SY,                 /**< Symbols allowing break after */
+       LBP_IS,                 /**< Infix separator */
+       LBP_PR,                 /**< Prefix */
+       LBP_PO,                 /**< Postfix */
+       LBP_NU,                 /**< Numeric */
+       LBP_AL,                 /**< Alphabetic */
+       LBP_ID,                 /**< Ideographic */
+       LBP_IN,                 /**< Inseparable characters */
+       LBP_HY,                 /**< Hyphen */
+       LBP_BA,                 /**< Break after */
+       LBP_BB,                 /**< Break before */
+       LBP_B2,                 /**< Break on either side (but not pair) */
+       LBP_ZW,                 /**< Zero-width space */
+       LBP_CM,                 /**< Combining marks */
+       LBP_WJ,                 /**< Word joiner */
+       LBP_H2,                 /**< Hangul LV */
+       LBP_H3,                 /**< Hangul LVT */
+       LBP_JL,                 /**< Hangul L Jamo */
+       LBP_JV,                 /**< Hangul V Jamo */
+       LBP_JT,                 /**< Hangul T Jamo */
+
+       /* The following break classes are not treated in the pair table */
+       LBP_AI,                 /**< Ambiguous (alphabetic or ideograph) */
+       LBP_BK,                 /**< Break (mandatory) */
+       LBP_CB,                 /**< Contingent break */
+       LBP_CR,                 /**< Carriage return */
+       LBP_LF,                 /**< Line feed */
+       LBP_NL,                 /**< Next line */
+       LBP_SA,                 /**< South-East Asian */
+       LBP_SG,                 /**< Surrogates */
+       LBP_SP,                 /**< Space */
+       LBP_XX                  /**< Unknown */
+};
+
+/**
+ * Struct for entries of line break properties.  The array of the
+ * entries \e must be sorted.
+ */
+struct LineBreakProperties
+{
+       utf32_t start;                          /**< Starting coding point */
+       utf32_t end;                            /**< End coding point */
+       enum LineBreakClass prop;       /**< The line breaking property */
+};
+
+/**
+ * Struct for association of language-specific line breaking properties
+ * with language names.
+ */
+struct LineBreakPropertiesLang
+{
+       const char *lang;                                       /**< Language name */
+       size_t namelen;                                         /**< Length of name to match */
+       struct LineBreakProperties *lbp;        /**< Pointer to associated data */
+};
+
+/**
+ * Abstract function interface for #lb_get_next_char_utf8,
+ * #lb_get_next_char_utf16, and #lb_get_next_char_utf32.
+ */
+typedef utf32_t (*get_next_char_t)(const void *, size_t, size_t *);
+
+/* Declarations */
+extern struct LineBreakProperties lb_prop_default[];
+extern struct LineBreakPropertiesLang lb_prop_lang_map[];
+
+/* Function Prototype */
+utf32_t lb_get_next_char_utf8(const utf8_t *s, size_t len, size_t *ip);
+utf32_t lb_get_next_char_utf16(const utf16_t *s, size_t len, size_t *ip);
+utf32_t lb_get_next_char_utf32(const utf32_t *s, size_t len, size_t *ip);
+void set_linebreaks(
+               const void *s,
+               size_t len,
+               const char *lang,
+               char *brks,
+               get_next_char_t get_next_char);
diff --git a/text/dali/internal/libunibreak/wordbreak.c b/text/dali/internal/libunibreak/wordbreak.c
new file mode 100644 (file)
index 0000000..e67a1f8
--- /dev/null
@@ -0,0 +1,452 @@
+/* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */
+
+/*
+ * Word breaking in a Unicode sequence.  Designed to be used in a
+ * generic text renderer.
+ *
+ * Copyright (C) 2013 Tom Hacohen <tom at stosb dot com>
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty.  In no event will the author be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute
+ * it freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must
+ *    not claim that you wrote the original software.  If you use this
+ *    software in a product, an acknowledgement in the product
+ *    documentation would be appreciated but is not required.
+ * 2. Altered source versions must be plainly marked as such, and must
+ *    not be misrepresented as being the original software.
+ * 3. This notice may not be removed or altered from any source
+ *    distribution.
+ *
+ * The main reference is Unicode Standard Annex 29 (UAX #29):
+ *      <URL:http://unicode.org/reports/tr29>
+ *
+ * When this library was designed, this annex was at Revision 17, for
+ * Unicode 6.0.0:
+ *      <URL:http://www.unicode.org/reports/tr29/tr29-17.html>
+ *
+ * This library has been updated according to Revision 21, for
+ * Unicode 6.2.0:
+ *      <URL:http://www.unicode.org/reports/tr29/tr29-21.html>
+ *
+ * The Unicode Terms of Use are available at
+ *      <URL:http://www.unicode.org/copyright.html>
+ */
+
+/**
+ * @file    wordbreak.c
+ *
+ * Implementation of the word breaking algorithm as described in Unicode
+ * Standard Annex 29.
+ *
+ * @version 2.4, 2013/09/28
+ * @author  Tom Hacohen
+ */
+
+#include <assert.h>
+#include <stddef.h>
+#include <string.h>
+#include "linebreak.h"
+#include "linebreakdef.h"
+
+#include "wordbreak.h"
+#include "wordbreakdata.c"
+
+#define ARRAY_LEN(x) (sizeof(x) / sizeof(x[0]))
+
+/**
+ * Initializes the wordbreak internals.  It currently does nothing, but
+ * it may in the future.
+ */
+void init_wordbreak(void)
+{
+}
+
+/**
+ * Gets the word breaking class of a character.
+ *
+ * @param ch   character to check
+ * @param wbp  pointer to the wbp breaking properties array
+ * @param len  size of the wbp array in number of items
+ * @return     the word breaking class if found; \c WBP_Any otherwise
+ */
+static enum WordBreakClass get_char_wb_class(
+        utf32_t ch,
+        struct WordBreakProperties *wbp,
+        size_t len)
+{
+    int min = 0;
+    int max = len - 1;
+    int mid;
+
+    do
+    {
+        mid = (min + max) / 2;
+
+        if (ch < wbp[mid].start)
+            max = mid - 1;
+        else if (ch > wbp[mid].end)
+            min = mid + 1;
+        else
+            return wbp[mid].prop;
+    }
+    while (min <= max);
+
+    return WBP_Any;
+}
+
+/**
+ * Sets the word break types to a specific value in a range.
+ *
+ * It sets the inside chars to #WORDBREAK_INSIDEACHAR and the rest to brkType.
+ * Assumes \a brks is initialized - all the cells with #WORDBREAK_NOBREAK are
+ * cells that we really don't want to break after.
+ *
+ * @param[in]  s             input string
+ * @param[out] brks          breaks array to fill
+ * @param[in]  posStart      start position
+ * @param[in]  posEnd        end position (exclusive)
+ * @param[in]  len           length of the string
+ * @param[in]  brkType       breaks type to use
+ * @param[in] get_next_char  function to get the next UTF-32 character
+ */
+static void set_brks_to(
+        const void *s,
+        char *brks,
+        size_t posStart,
+        size_t posEnd,
+        size_t len,
+        char brkType,
+        get_next_char_t get_next_char)
+{
+    size_t posNext = posStart;
+    while (posNext < posEnd)
+    {
+        utf32_t ch;
+        ch = get_next_char(s, len, &posNext);
+        assert(ch != EOS);
+        for (; posStart < posNext - 1; ++posStart)
+            brks[posStart] = WORDBREAK_INSIDEACHAR;
+        assert(posStart == posNext - 1);
+
+        /* Only set it if we haven't set it not to break before. */
+        if (brks[posStart] != WORDBREAK_NOBREAK)
+            brks[posStart] = brkType;
+        posStart = posNext;
+    }
+}
+
+/* Checks to see if the class is newline, CR, or LF (rules WB3a and b). */
+#define IS_WB3ab(cls) ((cls == WBP_Newline) || (cls == WBP_CR) || \
+                       (cls == WBP_LF))
+
+/**
+ * Sets the word breaking information for a generic input string.
+ *
+ * @param[in]  s             input string
+ * @param[in]  len           length of the input
+ * @param[in]  lang          language of the input
+ * @param[out] brks          pointer to the output breaking data, containing
+ *                           #WORDBREAK_BREAK, #WORDBREAK_NOBREAK, or
+ *                           #WORDBREAK_INSIDEACHAR
+ * @param[in] get_next_char  function to get the next UTF-32 character
+ */
+static void set_wordbreaks(
+        const void *s,
+        size_t len,
+        const char *lang,
+        char *brks,
+        get_next_char_t get_next_char)
+{
+    enum WordBreakClass wbcLast = WBP_Undefined;
+    /* wbcSeqStart is the class that started the current sequence.
+     * WBP_Undefined is a special case that means "sot".
+     * This value is the class that is at the start of the current rule
+     * matching sequence. For example, in case of Numeric+MidNum+Numeric
+     * it'll be Numeric all the way.
+     */
+    enum WordBreakClass wbcSeqStart = WBP_Undefined;
+    utf32_t ch;
+    size_t posNext = 0;
+    size_t posCur = 0;
+    size_t posLast = 0;
+
+    /* TODO: Language-specific specialization. */
+    (void) lang;
+
+    /* Init brks. */
+    memset(brks, WORDBREAK_BREAK, len);
+
+    ch = get_next_char(s, len, &posNext);
+
+    while (ch != EOS)
+    {
+        enum WordBreakClass wbcCur;
+        wbcCur = get_char_wb_class(ch, wb_prop_default,
+                                   ARRAY_LEN(wb_prop_default));
+
+        switch (wbcCur)
+        {
+        case WBP_CR:
+            /* WB3b */
+            set_brks_to(s, brks, posLast, posCur, len,
+                        WORDBREAK_BREAK, get_next_char);
+            wbcSeqStart = wbcCur;
+            posLast = posCur;
+            break;
+
+        case WBP_LF:
+            if (wbcSeqStart == WBP_CR) /* WB3 */
+            {
+                set_brks_to(s, brks, posLast, posCur, len,
+                            WORDBREAK_NOBREAK, get_next_char);
+                wbcSeqStart = wbcCur;
+                posLast = posCur;
+                break;
+            }
+            /* Fall off */
+
+        case WBP_Newline:
+            /* WB3a,3b */
+            set_brks_to(s, brks, posLast, posCur, len,
+                        WORDBREAK_BREAK, get_next_char);
+            wbcSeqStart = wbcCur;
+            posLast = posCur;
+            break;
+
+        case WBP_Extend:
+        case WBP_Format:
+            /* WB4 - If not the first char/after a newline (WB3a,3b), skip
+             * this class, set it to be the same as the prev, and mark
+             * brks not to break before them. */
+            if ((wbcSeqStart == WBP_Undefined) || IS_WB3ab(wbcSeqStart))
+            {
+                set_brks_to(s, brks, posLast, posCur, len,
+                            WORDBREAK_BREAK, get_next_char);
+                wbcSeqStart = wbcCur;
+            }
+            else
+            {
+                /* It's surely not the first */
+                brks[posCur - 1] = WORDBREAK_NOBREAK;
+                /* "inherit" the previous class. */
+                wbcCur = wbcLast;
+            }
+            break;
+
+        case WBP_Katakana:
+            if ((wbcSeqStart == WBP_Katakana) || /* WB13 */
+                    (wbcSeqStart == WBP_ExtendNumLet)) /* WB13b */
+            {
+                set_brks_to(s, brks, posLast, posCur, len,
+                            WORDBREAK_NOBREAK, get_next_char);
+            }
+            /* No rule found, reset */
+            else
+            {
+                set_brks_to(s, brks, posLast, posCur, len,
+                            WORDBREAK_BREAK, get_next_char);
+            }
+            wbcSeqStart = wbcCur;
+            posLast = posCur;
+            break;
+
+        case WBP_ALetter:
+            if ((wbcSeqStart == WBP_ALetter) || /* WB5,6,7 */
+                    (wbcLast == WBP_Numeric) || /* WB10 */
+                    (wbcSeqStart == WBP_ExtendNumLet)) /* WB13b */
+            {
+                set_brks_to(s, brks, posLast, posCur, len,
+                            WORDBREAK_NOBREAK, get_next_char);
+            }
+            /* No rule found, reset */
+            else
+            {
+                set_brks_to(s, brks, posLast, posCur, len,
+                            WORDBREAK_BREAK, get_next_char);
+            }
+            wbcSeqStart = wbcCur;
+            posLast = posCur;
+            break;
+
+        case WBP_MidNumLet:
+            if ((wbcLast == WBP_ALetter) || /* WB6,7 */
+                    (wbcLast == WBP_Numeric)) /* WB11,12 */
+            {
+                /* Go on */
+            }
+            else
+            {
+                set_brks_to(s, brks, posLast, posCur, len,
+                            WORDBREAK_BREAK, get_next_char);
+                wbcSeqStart = wbcCur;
+                posLast = posCur;
+            }
+            break;
+
+        case WBP_MidLetter:
+            if (wbcLast == WBP_ALetter) /* WB6,7 */
+            {
+                /* Go on */
+            }
+            else
+            {
+                set_brks_to(s, brks, posLast, posCur, len,
+                            WORDBREAK_BREAK, get_next_char);
+                wbcSeqStart = wbcCur;
+                posLast = posCur;
+            }
+            break;
+
+        case WBP_MidNum:
+            if (wbcLast == WBP_Numeric) /* WB11,12 */
+            {
+                /* Go on */
+            }
+            else
+            {
+                set_brks_to(s, brks, posLast, posCur, len,
+                            WORDBREAK_BREAK, get_next_char);
+                wbcSeqStart = wbcCur;
+                posLast = posCur;
+            }
+            break;
+
+        case WBP_Numeric:
+            if ((wbcSeqStart == WBP_Numeric) || /* WB8,11,12 */
+                    (wbcLast == WBP_ALetter) || /* WB9 */
+                    (wbcSeqStart == WBP_ExtendNumLet)) /* WB13b */
+            {
+                set_brks_to(s, brks, posLast, posCur, len,
+                            WORDBREAK_NOBREAK, get_next_char);
+            }
+            /* No rule found, reset */
+            else
+            {
+                set_brks_to(s, brks, posLast, posCur, len,
+                            WORDBREAK_BREAK, get_next_char);
+            }
+            wbcSeqStart = wbcCur;
+            posLast = posCur;
+            break;
+
+        case WBP_ExtendNumLet:
+            /* WB13a,13b */
+            if ((wbcSeqStart == wbcLast) &&
+                ((wbcLast == WBP_ALetter) ||
+                 (wbcLast == WBP_Numeric) ||
+                 (wbcLast == WBP_Katakana) ||
+                 (wbcLast == WBP_ExtendNumLet)))
+            {
+                set_brks_to(s, brks, posLast, posCur, len,
+                            WORDBREAK_NOBREAK, get_next_char);
+            }
+            /* No rule found, reset */
+            else
+            {
+                set_brks_to(s, brks, posLast, posCur, len,
+                            WORDBREAK_BREAK, get_next_char);
+            }
+            wbcSeqStart = wbcCur;
+            posLast = posCur;
+            break;
+
+        case WBP_Regional:
+            /* WB13c */
+            if (wbcSeqStart == WBP_Regional)
+            {
+                set_brks_to(s, brks, posLast, posCur, len,
+                            WORDBREAK_NOBREAK, get_next_char);
+            }
+            wbcSeqStart = wbcCur;
+            posLast = posCur;
+            break;
+
+        case WBP_Any:
+            /* Allow breaks and reset */
+            set_brks_to(s, brks, posLast, posCur, len,
+                        WORDBREAK_BREAK, get_next_char);
+            wbcSeqStart = wbcCur;
+            posLast = posCur;
+            break;
+
+        default:
+            /* Error, should never get here! */
+            assert(0);
+            break;
+        }
+
+        wbcLast = wbcCur;
+        posCur = posNext;
+        ch = get_next_char(s, len, &posNext);
+    }
+
+    /* WB2 */
+    set_brks_to(s, brks, posLast, posNext, len,
+                WORDBREAK_BREAK, get_next_char);
+}
+
+/**
+ * Sets the word breaking information for a UTF-8 input string.
+ *
+ * @param[in]  s     input UTF-8 string
+ * @param[in]  len   length of the input
+ * @param[in]  lang  language of the input
+ * @param[out] brks  pointer to the output breaking data, containing
+ *                   #WORDBREAK_BREAK, #WORDBREAK_NOBREAK, or
+ *                   #WORDBREAK_INSIDEACHAR
+ */
+void set_wordbreaks_utf8(
+        const utf8_t *s,
+        size_t len,
+        const char *lang,
+        char *brks)
+{
+    set_wordbreaks(s, len, lang, brks,
+                   (get_next_char_t)lb_get_next_char_utf8);
+}
+
+/**
+ * Sets the word breaking information for a UTF-16 input string.
+ *
+ * @param[in]  s     input UTF-16 string
+ * @param[in]  len   length of the input
+ * @param[in]  lang  language of the input
+ * @param[out] brks  pointer to the output breaking data, containing
+ *                   #WORDBREAK_BREAK, #WORDBREAK_NOBREAK, or
+ *                   #WORDBREAK_INSIDEACHAR
+ */
+void set_wordbreaks_utf16(
+        const utf16_t *s,
+        size_t len,
+        const char *lang,
+        char *brks)
+{
+    set_wordbreaks(s, len, lang, brks,
+                   (get_next_char_t)lb_get_next_char_utf16);
+}
+
+/**
+ * Sets the word breaking information for a UTF-32 input string.
+ *
+ * @param[in]  s     input UTF-32 string
+ * @param[in]  len   length of the input
+ * @param[in]  lang  language of the input
+ * @param[out] brks  pointer to the output breaking data, containing
+ *                   #WORDBREAK_BREAK, #WORDBREAK_NOBREAK, or
+ *                   #WORDBREAK_INSIDEACHAR
+ */
+void set_wordbreaks_utf32(
+        const utf32_t *s,
+        size_t len,
+        const char *lang,
+        char *brks)
+{
+    set_wordbreaks(s, len, lang, brks,
+                   (get_next_char_t)lb_get_next_char_utf32);
+}
diff --git a/text/dali/internal/libunibreak/wordbreak.h b/text/dali/internal/libunibreak/wordbreak.h
new file mode 100644 (file)
index 0000000..cd2bf2c
--- /dev/null
@@ -0,0 +1,76 @@
+/* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */
+
+/*
+ * Word breaking in a Unicode sequence.  Designed to be used in a
+ * generic text renderer.
+ *
+ * Copyright (C) 2013 Tom Hacohen <tom at stosb dot com>
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty.  In no event will the author be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute
+ * it freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must
+ *    not claim that you wrote the original software.  If you use this
+ *    software in a product, an acknowledgement in the product
+ *    documentation would be appreciated but is not required.
+ * 2. Altered source versions must be plainly marked as such, and must
+ *    not be misrepresented as being the original software.
+ * 3. This notice may not be removed or altered from any source
+ *    distribution.
+ *
+ * The main reference is Unicode Standard Annex 29 (UAX #29):
+ *      <URL:http://unicode.org/reports/tr29>
+ *
+ * When this library was designed, this annex was at Revision 17, for
+ * Unicode 6.0.0:
+ *      <URL:http://www.unicode.org/reports/tr29/tr29-17.html>
+ *
+ * This library has been updated according to Revision 21, for
+ * Unicode 6.2.0:
+ *      <URL:http://www.unicode.org/reports/tr29/tr29-21.html>
+ *
+ * The Unicode Terms of Use are available at
+ *      <URL:http://www.unicode.org/copyright.html>
+ */
+
+/**
+ * @file    wordbreak.h
+ *
+ * Header file for the word breaking (segmentation) algorithm.
+ *
+ * @version 2.3, 2013/09/28
+ * @author  Tom Hacohen
+ */
+
+#ifndef WORDBREAK_H
+#define WORDBREAK_H
+
+#include <stddef.h>
+#include "linebreak.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define WORDBREAK_BREAK         0   /**< Break is allowed */
+#define WORDBREAK_NOBREAK       1   /**< No break is allowed */
+#define WORDBREAK_INSIDEACHAR   2   /**< A UTF-8/16 sequence is unfinished */
+
+void init_wordbreak(void);
+void set_wordbreaks_utf8(
+        const utf8_t *s, size_t len, const char* lang, char *brks);
+void set_wordbreaks_utf16(
+        const utf16_t *s, size_t len, const char* lang, char *brks);
+void set_wordbreaks_utf32(
+        const utf32_t *s, size_t len, const char* lang, char *brks);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/text/dali/internal/libunibreak/wordbreakdata.c b/text/dali/internal/libunibreak/wordbreakdata.c
new file mode 100644 (file)
index 0000000..d0d0585
--- /dev/null
@@ -0,0 +1,1073 @@
+/* The content of this file is generated from:
+# WordBreakProperty-7.0.0.txt
+# Date: 2014-02-19, 15:51:39 GMT [MD]
+*/
+
+#include "linebreak.h"
+#include "wordbreakdef.h"
+
+static struct WordBreakProperties wb_prop_default[] = {
+       {0x000A, 0x000A, WBP_LF},
+       {0x000B, 0x000C, WBP_Newline},
+       {0x000D, 0x000D, WBP_CR},
+       {0x0022, 0x0022, WBP_Double},
+       {0x0027, 0x0027, WBP_Single},
+       {0x002C, 0x002C, WBP_MidNum},
+       {0x002E, 0x002E, WBP_MidNumLet},
+       {0x0030, 0x0039, WBP_Numeric},
+       {0x003A, 0x003A, WBP_MidLetter},
+       {0x003B, 0x003B, WBP_MidNum},
+       {0x0041, 0x005A, WBP_ALetter},
+       {0x005F, 0x005F, WBP_ExtendNumLet},
+       {0x0061, 0x007A, WBP_ALetter},
+       {0x0085, 0x0085, WBP_Newline},
+       {0x00AA, 0x00AA, WBP_ALetter},
+       {0x00AD, 0x00AD, WBP_Format},
+       {0x00B5, 0x00B5, WBP_ALetter},
+       {0x00B7, 0x00B7, WBP_MidLetter},
+       {0x00BA, 0x00BA, WBP_ALetter},
+       {0x00C0, 0x00D6, WBP_ALetter},
+       {0x00D8, 0x00F6, WBP_ALetter},
+       {0x00F8, 0x01BA, WBP_ALetter},
+       {0x01BB, 0x01BB, WBP_ALetter},
+       {0x01BC, 0x01BF, WBP_ALetter},
+       {0x01C0, 0x01C3, WBP_ALetter},
+       {0x01C4, 0x0293, WBP_ALetter},
+       {0x0294, 0x0294, WBP_ALetter},
+       {0x0295, 0x02AF, WBP_ALetter},
+       {0x02B0, 0x02C1, WBP_ALetter},
+       {0x02C6, 0x02D1, WBP_ALetter},
+       {0x02D7, 0x02D7, WBP_MidLetter},
+       {0x02E0, 0x02E4, WBP_ALetter},
+       {0x02EC, 0x02EC, WBP_ALetter},
+       {0x02EE, 0x02EE, WBP_ALetter},
+       {0x0300, 0x036F, WBP_Extend},
+       {0x0370, 0x0373, WBP_ALetter},
+       {0x0374, 0x0374, WBP_ALetter},
+       {0x0376, 0x0377, WBP_ALetter},
+       {0x037A, 0x037A, WBP_ALetter},
+       {0x037B, 0x037D, WBP_ALetter},
+       {0x037E, 0x037E, WBP_MidNum},
+       {0x037F, 0x037F, WBP_ALetter},
+       {0x0386, 0x0386, WBP_ALetter},
+       {0x0387, 0x0387, WBP_MidLetter},
+       {0x0388, 0x038A, WBP_ALetter},
+       {0x038C, 0x038C, WBP_ALetter},
+       {0x038E, 0x03A1, WBP_ALetter},
+       {0x03A3, 0x03F5, WBP_ALetter},
+       {0x03F7, 0x0481, WBP_ALetter},
+       {0x0483, 0x0487, WBP_Extend},
+       {0x0488, 0x0489, WBP_Extend},
+       {0x048A, 0x052F, WBP_ALetter},
+       {0x0531, 0x0556, WBP_ALetter},
+       {0x0559, 0x0559, WBP_ALetter},
+       {0x0561, 0x0587, WBP_ALetter},
+       {0x0589, 0x0589, WBP_MidNum},
+       {0x0591, 0x05BD, WBP_Extend},
+       {0x05BF, 0x05BF, WBP_Extend},
+       {0x05C1, 0x05C2, WBP_Extend},
+       {0x05C4, 0x05C5, WBP_Extend},
+       {0x05C7, 0x05C7, WBP_Extend},
+       {0x05D0, 0x05EA, WBP_Hebrew},
+       {0x05F0, 0x05F2, WBP_Hebrew},
+       {0x05F3, 0x05F3, WBP_ALetter},
+       {0x05F4, 0x05F4, WBP_MidLetter},
+       {0x0600, 0x0605, WBP_Format},
+       {0x060C, 0x060D, WBP_MidNum},
+       {0x0610, 0x061A, WBP_Extend},
+       {0x061C, 0x061C, WBP_Format},
+       {0x0620, 0x063F, WBP_ALetter},
+       {0x0640, 0x0640, WBP_ALetter},
+       {0x0641, 0x064A, WBP_ALetter},
+       {0x064B, 0x065F, WBP_Extend},
+       {0x0660, 0x0669, WBP_Numeric},
+       {0x066B, 0x066B, WBP_Numeric},
+       {0x066C, 0x066C, WBP_MidNum},
+       {0x066E, 0x066F, WBP_ALetter},
+       {0x0670, 0x0670, WBP_Extend},
+       {0x0671, 0x06D3, WBP_ALetter},
+       {0x06D5, 0x06D5, WBP_ALetter},
+       {0x06D6, 0x06DC, WBP_Extend},
+       {0x06DD, 0x06DD, WBP_Format},
+       {0x06DF, 0x06E4, WBP_Extend},
+       {0x06E5, 0x06E6, WBP_ALetter},
+       {0x06E7, 0x06E8, WBP_Extend},
+       {0x06EA, 0x06ED, WBP_Extend},
+       {0x06EE, 0x06EF, WBP_ALetter},
+       {0x06F0, 0x06F9, WBP_Numeric},
+       {0x06FA, 0x06FC, WBP_ALetter},
+       {0x06FF, 0x06FF, WBP_ALetter},
+       {0x070F, 0x070F, WBP_Format},
+       {0x0710, 0x0710, WBP_ALetter},
+       {0x0711, 0x0711, WBP_Extend},
+       {0x0712, 0x072F, WBP_ALetter},
+       {0x0730, 0x074A, WBP_Extend},
+       {0x074D, 0x07A5, WBP_ALetter},
+       {0x07A6, 0x07B0, WBP_Extend},
+       {0x07B1, 0x07B1, WBP_ALetter},
+       {0x07C0, 0x07C9, WBP_Numeric},
+       {0x07CA, 0x07EA, WBP_ALetter},
+       {0x07EB, 0x07F3, WBP_Extend},
+       {0x07F4, 0x07F5, WBP_ALetter},
+       {0x07F8, 0x07F8, WBP_MidNum},
+       {0x07FA, 0x07FA, WBP_ALetter},
+       {0x0800, 0x0815, WBP_ALetter},
+       {0x0816, 0x0819, WBP_Extend},
+       {0x081A, 0x081A, WBP_ALetter},
+       {0x081B, 0x0823, WBP_Extend},
+       {0x0824, 0x0824, WBP_ALetter},
+       {0x0825, 0x0827, WBP_Extend},
+       {0x0828, 0x0828, WBP_ALetter},
+       {0x0829, 0x082D, WBP_Extend},
+       {0x0840, 0x0858, WBP_ALetter},
+       {0x0859, 0x085B, WBP_Extend},
+       {0x08A0, 0x08B2, WBP_ALetter},
+       {0x08E4, 0x0902, WBP_Extend},
+       {0x0903, 0x0903, WBP_Extend},
+       {0x0904, 0x0939, WBP_ALetter},
+       {0x093A, 0x093A, WBP_Extend},
+       {0x093B, 0x093B, WBP_Extend},
+       {0x093C, 0x093C, WBP_Extend},
+       {0x093D, 0x093D, WBP_ALetter},
+       {0x093E, 0x0940, WBP_Extend},
+       {0x0941, 0x0948, WBP_Extend},
+       {0x0949, 0x094C, WBP_Extend},
+       {0x094D, 0x094D, WBP_Extend},
+       {0x094E, 0x094F, WBP_Extend},
+       {0x0950, 0x0950, WBP_ALetter},
+       {0x0951, 0x0957, WBP_Extend},
+       {0x0958, 0x0961, WBP_ALetter},
+       {0x0962, 0x0963, WBP_Extend},
+       {0x0966, 0x096F, WBP_Numeric},
+       {0x0971, 0x0971, WBP_ALetter},
+       {0x0972, 0x0980, WBP_ALetter},
+       {0x0981, 0x0981, WBP_Extend},
+       {0x0982, 0x0983, WBP_Extend},
+       {0x0985, 0x098C, WBP_ALetter},
+       {0x098F, 0x0990, WBP_ALetter},
+       {0x0993, 0x09A8, WBP_ALetter},
+       {0x09AA, 0x09B0, WBP_ALetter},
+       {0x09B2, 0x09B2, WBP_ALetter},
+       {0x09B6, 0x09B9, WBP_ALetter},
+       {0x09BC, 0x09BC, WBP_Extend},
+       {0x09BD, 0x09BD, WBP_ALetter},
+       {0x09BE, 0x09C0, WBP_Extend},
+       {0x09C1, 0x09C4, WBP_Extend},
+       {0x09C7, 0x09C8, WBP_Extend},
+       {0x09CB, 0x09CC, WBP_Extend},
+       {0x09CD, 0x09CD, WBP_Extend},
+       {0x09CE, 0x09CE, WBP_ALetter},
+       {0x09D7, 0x09D7, WBP_Extend},
+       {0x09DC, 0x09DD, WBP_ALetter},
+       {0x09DF, 0x09E1, WBP_ALetter},
+       {0x09E2, 0x09E3, WBP_Extend},
+       {0x09E6, 0x09EF, WBP_Numeric},
+       {0x09F0, 0x09F1, WBP_ALetter},
+       {0x0A01, 0x0A02, WBP_Extend},
+       {0x0A03, 0x0A03, WBP_Extend},
+       {0x0A05, 0x0A0A, WBP_ALetter},
+       {0x0A0F, 0x0A10, WBP_ALetter},
+       {0x0A13, 0x0A28, WBP_ALetter},
+       {0x0A2A, 0x0A30, WBP_ALetter},
+       {0x0A32, 0x0A33, WBP_ALetter},
+       {0x0A35, 0x0A36, WBP_ALetter},
+       {0x0A38, 0x0A39, WBP_ALetter},
+       {0x0A3C, 0x0A3C, WBP_Extend},
+       {0x0A3E, 0x0A40, WBP_Extend},
+       {0x0A41, 0x0A42, WBP_Extend},
+       {0x0A47, 0x0A48, WBP_Extend},
+       {0x0A4B, 0x0A4D, WBP_Extend},
+       {0x0A51, 0x0A51, WBP_Extend},
+       {0x0A59, 0x0A5C, WBP_ALetter},
+       {0x0A5E, 0x0A5E, WBP_ALetter},
+       {0x0A66, 0x0A6F, WBP_Numeric},
+       {0x0A70, 0x0A71, WBP_Extend},
+       {0x0A72, 0x0A74, WBP_ALetter},
+       {0x0A75, 0x0A75, WBP_Extend},
+       {0x0A81, 0x0A82, WBP_Extend},
+       {0x0A83, 0x0A83, WBP_Extend},
+       {0x0A85, 0x0A8D, WBP_ALetter},
+       {0x0A8F, 0x0A91, WBP_ALetter},
+       {0x0A93, 0x0AA8, WBP_ALetter},
+       {0x0AAA, 0x0AB0, WBP_ALetter},
+       {0x0AB2, 0x0AB3, WBP_ALetter},
+       {0x0AB5, 0x0AB9, WBP_ALetter},
+       {0x0ABC, 0x0ABC, WBP_Extend},
+       {0x0ABD, 0x0ABD, WBP_ALetter},
+       {0x0ABE, 0x0AC0, WBP_Extend},
+       {0x0AC1, 0x0AC5, WBP_Extend},
+       {0x0AC7, 0x0AC8, WBP_Extend},
+       {0x0AC9, 0x0AC9, WBP_Extend},
+       {0x0ACB, 0x0ACC, WBP_Extend},
+       {0x0ACD, 0x0ACD, WBP_Extend},
+       {0x0AD0, 0x0AD0, WBP_ALetter},
+       {0x0AE0, 0x0AE1, WBP_ALetter},
+       {0x0AE2, 0x0AE3, WBP_Extend},
+       {0x0AE6, 0x0AEF, WBP_Numeric},
+       {0x0B01, 0x0B01, WBP_Extend},
+       {0x0B02, 0x0B03, WBP_Extend},
+       {0x0B05, 0x0B0C, WBP_ALetter},
+       {0x0B0F, 0x0B10, WBP_ALetter},
+       {0x0B13, 0x0B28, WBP_ALetter},
+       {0x0B2A, 0x0B30, WBP_ALetter},
+       {0x0B32, 0x0B33, WBP_ALetter},
+       {0x0B35, 0x0B39, WBP_ALetter},
+       {0x0B3C, 0x0B3C, WBP_Extend},
+       {0x0B3D, 0x0B3D, WBP_ALetter},
+       {0x0B3E, 0x0B3E, WBP_Extend},
+       {0x0B3F, 0x0B3F, WBP_Extend},
+       {0x0B40, 0x0B40, WBP_Extend},
+       {0x0B41, 0x0B44, WBP_Extend},
+       {0x0B47, 0x0B48, WBP_Extend},
+       {0x0B4B, 0x0B4C, WBP_Extend},
+       {0x0B4D, 0x0B4D, WBP_Extend},
+       {0x0B56, 0x0B56, WBP_Extend},
+       {0x0B57, 0x0B57, WBP_Extend},
+       {0x0B5C, 0x0B5D, WBP_ALetter},
+       {0x0B5F, 0x0B61, WBP_ALetter},
+       {0x0B62, 0x0B63, WBP_Extend},
+       {0x0B66, 0x0B6F, WBP_Numeric},
+       {0x0B71, 0x0B71, WBP_ALetter},
+       {0x0B82, 0x0B82, WBP_Extend},
+       {0x0B83, 0x0B83, WBP_ALetter},
+       {0x0B85, 0x0B8A, WBP_ALetter},
+       {0x0B8E, 0x0B90, WBP_ALetter},
+       {0x0B92, 0x0B95, WBP_ALetter},
+       {0x0B99, 0x0B9A, WBP_ALetter},
+       {0x0B9C, 0x0B9C, WBP_ALetter},
+       {0x0B9E, 0x0B9F, WBP_ALetter},
+       {0x0BA3, 0x0BA4, WBP_ALetter},
+       {0x0BA8, 0x0BAA, WBP_ALetter},
+       {0x0BAE, 0x0BB9, WBP_ALetter},
+       {0x0BBE, 0x0BBF, WBP_Extend},
+       {0x0BC0, 0x0BC0, WBP_Extend},
+       {0x0BC1, 0x0BC2, WBP_Extend},
+       {0x0BC6, 0x0BC8, WBP_Extend},
+       {0x0BCA, 0x0BCC, WBP_Extend},
+       {0x0BCD, 0x0BCD, WBP_Extend},
+       {0x0BD0, 0x0BD0, WBP_ALetter},
+       {0x0BD7, 0x0BD7, WBP_Extend},
+       {0x0BE6, 0x0BEF, WBP_Numeric},
+       {0x0C00, 0x0C00, WBP_Extend},
+       {0x0C01, 0x0C03, WBP_Extend},
+       {0x0C05, 0x0C0C, WBP_ALetter},
+       {0x0C0E, 0x0C10, WBP_ALetter},
+       {0x0C12, 0x0C28, WBP_ALetter},
+       {0x0C2A, 0x0C39, WBP_ALetter},
+       {0x0C3D, 0x0C3D, WBP_ALetter},
+       {0x0C3E, 0x0C40, WBP_Extend},
+       {0x0C41, 0x0C44, WBP_Extend},
+       {0x0C46, 0x0C48, WBP_Extend},
+       {0x0C4A, 0x0C4D, WBP_Extend},
+       {0x0C55, 0x0C56, WBP_Extend},
+       {0x0C58, 0x0C59, WBP_ALetter},
+       {0x0C60, 0x0C61, WBP_ALetter},
+       {0x0C62, 0x0C63, WBP_Extend},
+       {0x0C66, 0x0C6F, WBP_Numeric},
+       {0x0C81, 0x0C81, WBP_Extend},
+       {0x0C82, 0x0C83, WBP_Extend},
+       {0x0C85, 0x0C8C, WBP_ALetter},
+       {0x0C8E, 0x0C90, WBP_ALetter},
+       {0x0C92, 0x0CA8, WBP_ALetter},
+       {0x0CAA, 0x0CB3, WBP_ALetter},
+       {0x0CB5, 0x0CB9, WBP_ALetter},
+       {0x0CBC, 0x0CBC, WBP_Extend},
+       {0x0CBD, 0x0CBD, WBP_ALetter},
+       {0x0CBE, 0x0CBE, WBP_Extend},
+       {0x0CBF, 0x0CBF, WBP_Extend},
+       {0x0CC0, 0x0CC4, WBP_Extend},
+       {0x0CC6, 0x0CC6, WBP_Extend},
+       {0x0CC7, 0x0CC8, WBP_Extend},
+       {0x0CCA, 0x0CCB, WBP_Extend},
+       {0x0CCC, 0x0CCD, WBP_Extend},
+       {0x0CD5, 0x0CD6, WBP_Extend},
+       {0x0CDE, 0x0CDE, WBP_ALetter},
+       {0x0CE0, 0x0CE1, WBP_ALetter},
+       {0x0CE2, 0x0CE3, WBP_Extend},
+       {0x0CE6, 0x0CEF, WBP_Numeric},
+       {0x0CF1, 0x0CF2, WBP_ALetter},
+       {0x0D01, 0x0D01, WBP_Extend},
+       {0x0D02, 0x0D03, WBP_Extend},
+       {0x0D05, 0x0D0C, WBP_ALetter},
+       {0x0D0E, 0x0D10, WBP_ALetter},
+       {0x0D12, 0x0D3A, WBP_ALetter},
+       {0x0D3D, 0x0D3D, WBP_ALetter},
+       {0x0D3E, 0x0D40, WBP_Extend},
+       {0x0D41, 0x0D44, WBP_Extend},
+       {0x0D46, 0x0D48, WBP_Extend},
+       {0x0D4A, 0x0D4C, WBP_Extend},
+       {0x0D4D, 0x0D4D, WBP_Extend},
+       {0x0D4E, 0x0D4E, WBP_ALetter},
+       {0x0D57, 0x0D57, WBP_Extend},
+       {0x0D60, 0x0D61, WBP_ALetter},
+       {0x0D62, 0x0D63, WBP_Extend},
+       {0x0D66, 0x0D6F, WBP_Numeric},
+       {0x0D7A, 0x0D7F, WBP_ALetter},
+       {0x0D82, 0x0D83, WBP_Extend},
+       {0x0D85, 0x0D96, WBP_ALetter},
+       {0x0D9A, 0x0DB1, WBP_ALetter},
+       {0x0DB3, 0x0DBB, WBP_ALetter},
+       {0x0DBD, 0x0DBD, WBP_ALetter},
+       {0x0DC0, 0x0DC6, WBP_ALetter},
+       {0x0DCA, 0x0DCA, WBP_Extend},
+       {0x0DCF, 0x0DD1, WBP_Extend},
+       {0x0DD2, 0x0DD4, WBP_Extend},
+       {0x0DD6, 0x0DD6, WBP_Extend},
+       {0x0DD8, 0x0DDF, WBP_Extend},
+       {0x0DE6, 0x0DEF, WBP_Numeric},
+       {0x0DF2, 0x0DF3, WBP_Extend},
+       {0x0E31, 0x0E31, WBP_Extend},
+       {0x0E34, 0x0E3A, WBP_Extend},
+       {0x0E47, 0x0E4E, WBP_Extend},
+       {0x0E50, 0x0E59, WBP_Numeric},
+       {0x0EB1, 0x0EB1, WBP_Extend},
+       {0x0EB4, 0x0EB9, WBP_Extend},
+       {0x0EBB, 0x0EBC, WBP_Extend},
+       {0x0EC8, 0x0ECD, WBP_Extend},
+       {0x0ED0, 0x0ED9, WBP_Numeric},
+       {0x0F00, 0x0F00, WBP_ALetter},
+       {0x0F18, 0x0F19, WBP_Extend},
+       {0x0F20, 0x0F29, WBP_Numeric},
+       {0x0F35, 0x0F35, WBP_Extend},
+       {0x0F37, 0x0F37, WBP_Extend},
+       {0x0F39, 0x0F39, WBP_Extend},
+       {0x0F3E, 0x0F3F, WBP_Extend},
+       {0x0F40, 0x0F47, WBP_ALetter},
+       {0x0F49, 0x0F6C, WBP_ALetter},
+       {0x0F71, 0x0F7E, WBP_Extend},
+       {0x0F7F, 0x0F7F, WBP_Extend},
+       {0x0F80, 0x0F84, WBP_Extend},
+       {0x0F86, 0x0F87, WBP_Extend},
+       {0x0F88, 0x0F8C, WBP_ALetter},
+       {0x0F8D, 0x0F97, WBP_Extend},
+       {0x0F99, 0x0FBC, WBP_Extend},
+       {0x0FC6, 0x0FC6, WBP_Extend},
+       {0x102B, 0x102C, WBP_Extend},
+       {0x102D, 0x1030, WBP_Extend},
+       {0x1031, 0x1031, WBP_Extend},
+       {0x1032, 0x1037, WBP_Extend},
+       {0x1038, 0x1038, WBP_Extend},
+       {0x1039, 0x103A, WBP_Extend},
+       {0x103B, 0x103C, WBP_Extend},
+       {0x103D, 0x103E, WBP_Extend},
+       {0x1040, 0x1049, WBP_Numeric},
+       {0x1056, 0x1057, WBP_Extend},
+       {0x1058, 0x1059, WBP_Extend},
+       {0x105E, 0x1060, WBP_Extend},
+       {0x1062, 0x1064, WBP_Extend},
+       {0x1067, 0x106D, WBP_Extend},
+       {0x1071, 0x1074, WBP_Extend},
+       {0x1082, 0x1082, WBP_Extend},
+       {0x1083, 0x1084, WBP_Extend},
+       {0x1085, 0x1086, WBP_Extend},
+       {0x1087, 0x108C, WBP_Extend},
+       {0x108D, 0x108D, WBP_Extend},
+       {0x108F, 0x108F, WBP_Extend},
+       {0x1090, 0x1099, WBP_Numeric},
+       {0x109A, 0x109C, WBP_Extend},
+       {0x109D, 0x109D, WBP_Extend},
+       {0x10A0, 0x10C5, WBP_ALetter},
+       {0x10C7, 0x10C7, WBP_ALetter},
+       {0x10CD, 0x10CD, WBP_ALetter},
+       {0x10D0, 0x10FA, WBP_ALetter},
+       {0x10FC, 0x10FC, WBP_ALetter},
+       {0x10FD, 0x1248, WBP_ALetter},
+       {0x124A, 0x124D, WBP_ALetter},
+       {0x1250, 0x1256, WBP_ALetter},
+       {0x1258, 0x1258, WBP_ALetter},
+       {0x125A, 0x125D, WBP_ALetter},
+       {0x1260, 0x1288, WBP_ALetter},
+       {0x128A, 0x128D, WBP_ALetter},
+       {0x1290, 0x12B0, WBP_ALetter},
+       {0x12B2, 0x12B5, WBP_ALetter},
+       {0x12B8, 0x12BE, WBP_ALetter},
+       {0x12C0, 0x12C0, WBP_ALetter},
+       {0x12C2, 0x12C5, WBP_ALetter},
+       {0x12C8, 0x12D6, WBP_ALetter},
+       {0x12D8, 0x1310, WBP_ALetter},
+       {0x1312, 0x1315, WBP_ALetter},
+       {0x1318, 0x135A, WBP_ALetter},
+       {0x135D, 0x135F, WBP_Extend},
+       {0x1380, 0x138F, WBP_ALetter},
+       {0x13A0, 0x13F4, WBP_ALetter},
+       {0x1401, 0x166C, WBP_ALetter},
+       {0x166F, 0x167F, WBP_ALetter},
+       {0x1681, 0x169A, WBP_ALetter},
+       {0x16A0, 0x16EA, WBP_ALetter},
+       {0x16EE, 0x16F0, WBP_ALetter},
+       {0x16F1, 0x16F8, WBP_ALetter},
+       {0x1700, 0x170C, WBP_ALetter},
+       {0x170E, 0x1711, WBP_ALetter},
+       {0x1712, 0x1714, WBP_Extend},
+       {0x1720, 0x1731, WBP_ALetter},
+       {0x1732, 0x1734, WBP_Extend},
+       {0x1740, 0x1751, WBP_ALetter},
+       {0x1752, 0x1753, WBP_Extend},
+       {0x1760, 0x176C, WBP_ALetter},
+       {0x176E, 0x1770, WBP_ALetter},
+       {0x1772, 0x1773, WBP_Extend},
+       {0x17B4, 0x17B5, WBP_Extend},
+       {0x17B6, 0x17B6, WBP_Extend},
+       {0x17B7, 0x17BD, WBP_Extend},
+       {0x17BE, 0x17C5, WBP_Extend},
+       {0x17C6, 0x17C6, WBP_Extend},
+       {0x17C7, 0x17C8, WBP_Extend},
+       {0x17C9, 0x17D3, WBP_Extend},
+       {0x17DD, 0x17DD, WBP_Extend},
+       {0x17E0, 0x17E9, WBP_Numeric},
+       {0x180B, 0x180D, WBP_Extend},
+       {0x180E, 0x180E, WBP_Format},
+       {0x1810, 0x1819, WBP_Numeric},
+       {0x1820, 0x1842, WBP_ALetter},
+       {0x1843, 0x1843, WBP_ALetter},
+       {0x1844, 0x1877, WBP_ALetter},
+       {0x1880, 0x18A8, WBP_ALetter},
+       {0x18A9, 0x18A9, WBP_Extend},
+       {0x18AA, 0x18AA, WBP_ALetter},
+       {0x18B0, 0x18F5, WBP_ALetter},
+       {0x1900, 0x191E, WBP_ALetter},
+       {0x1920, 0x1922, WBP_Extend},
+       {0x1923, 0x1926, WBP_Extend},
+       {0x1927, 0x1928, WBP_Extend},
+       {0x1929, 0x192B, WBP_Extend},
+       {0x1930, 0x1931, WBP_Extend},
+       {0x1932, 0x1932, WBP_Extend},
+       {0x1933, 0x1938, WBP_Extend},
+       {0x1939, 0x193B, WBP_Extend},
+       {0x1946, 0x194F, WBP_Numeric},
+       {0x19B0, 0x19C0, WBP_Extend},
+       {0x19C8, 0x19C9, WBP_Extend},
+       {0x19D0, 0x19D9, WBP_Numeric},
+       {0x1A00, 0x1A16, WBP_ALetter},
+       {0x1A17, 0x1A18, WBP_Extend},
+       {0x1A19, 0x1A1A, WBP_Extend},
+       {0x1A1B, 0x1A1B, WBP_Extend},
+       {0x1A55, 0x1A55, WBP_Extend},
+       {0x1A56, 0x1A56, WBP_Extend},
+       {0x1A57, 0x1A57, WBP_Extend},
+       {0x1A58, 0x1A5E, WBP_Extend},
+       {0x1A60, 0x1A60, WBP_Extend},
+       {0x1A61, 0x1A61, WBP_Extend},
+       {0x1A62, 0x1A62, WBP_Extend},
+       {0x1A63, 0x1A64, WBP_Extend},
+       {0x1A65, 0x1A6C, WBP_Extend},
+       {0x1A6D, 0x1A72, WBP_Extend},
+       {0x1A73, 0x1A7C, WBP_Extend},
+       {0x1A7F, 0x1A7F, WBP_Extend},
+       {0x1A80, 0x1A89, WBP_Numeric},
+       {0x1A90, 0x1A99, WBP_Numeric},
+       {0x1AB0, 0x1ABD, WBP_Extend},
+       {0x1ABE, 0x1ABE, WBP_Extend},
+       {0x1B00, 0x1B03, WBP_Extend},
+       {0x1B04, 0x1B04, WBP_Extend},
+       {0x1B05, 0x1B33, WBP_ALetter},
+       {0x1B34, 0x1B34, WBP_Extend},
+       {0x1B35, 0x1B35, WBP_Extend},
+       {0x1B36, 0x1B3A, WBP_Extend},
+       {0x1B3B, 0x1B3B, WBP_Extend},
+       {0x1B3C, 0x1B3C, WBP_Extend},
+       {0x1B3D, 0x1B41, WBP_Extend},
+       {0x1B42, 0x1B42, WBP_Extend},
+       {0x1B43, 0x1B44, WBP_Extend},
+       {0x1B45, 0x1B4B, WBP_ALetter},
+       {0x1B50, 0x1B59, WBP_Numeric},
+       {0x1B6B, 0x1B73, WBP_Extend},
+       {0x1B80, 0x1B81, WBP_Extend},
+       {0x1B82, 0x1B82, WBP_Extend},
+       {0x1B83, 0x1BA0, WBP_ALetter},
+       {0x1BA1, 0x1BA1, WBP_Extend},
+       {0x1BA2, 0x1BA5, WBP_Extend},
+       {0x1BA6, 0x1BA7, WBP_Extend},
+       {0x1BA8, 0x1BA9, WBP_Extend},
+       {0x1BAA, 0x1BAA, WBP_Extend},
+       {0x1BAB, 0x1BAD, WBP_Extend},
+       {0x1BAE, 0x1BAF, WBP_ALetter},
+       {0x1BB0, 0x1BB9, WBP_Numeric},
+       {0x1BBA, 0x1BE5, WBP_ALetter},
+       {0x1BE6, 0x1BE6, WBP_Extend},
+       {0x1BE7, 0x1BE7, WBP_Extend},
+       {0x1BE8, 0x1BE9, WBP_Extend},
+       {0x1BEA, 0x1BEC, WBP_Extend},
+       {0x1BED, 0x1BED, WBP_Extend},
+       {0x1BEE, 0x1BEE, WBP_Extend},
+       {0x1BEF, 0x1BF1, WBP_Extend},
+       {0x1BF2, 0x1BF3, WBP_Extend},
+       {0x1C00, 0x1C23, WBP_ALetter},
+       {0x1C24, 0x1C2B, WBP_Extend},
+       {0x1C2C, 0x1C33, WBP_Extend},
+       {0x1C34, 0x1C35, WBP_Extend},
+       {0x1C36, 0x1C37, WBP_Extend},
+       {0x1C40, 0x1C49, WBP_Numeric},
+       {0x1C4D, 0x1C4F, WBP_ALetter},
+       {0x1C50, 0x1C59, WBP_Numeric},
+       {0x1C5A, 0x1C77, WBP_ALetter},
+       {0x1C78, 0x1C7D, WBP_ALetter},
+       {0x1CD0, 0x1CD2, WBP_Extend},
+       {0x1CD4, 0x1CE0, WBP_Extend},
+       {0x1CE1, 0x1CE1, WBP_Extend},
+       {0x1CE2, 0x1CE8, WBP_Extend},
+       {0x1CE9, 0x1CEC, WBP_ALetter},
+       {0x1CED, 0x1CED, WBP_Extend},
+       {0x1CEE, 0x1CF1, WBP_ALetter},
+       {0x1CF2, 0x1CF3, WBP_Extend},
+       {0x1CF4, 0x1CF4, WBP_Extend},
+       {0x1CF5, 0x1CF6, WBP_ALetter},
+       {0x1CF8, 0x1CF9, WBP_Extend},
+       {0x1D00, 0x1D2B, WBP_ALetter},
+       {0x1D2C, 0x1D6A, WBP_ALetter},
+       {0x1D6B, 0x1D77, WBP_ALetter},
+       {0x1D78, 0x1D78, WBP_ALetter},
+       {0x1D79, 0x1D9A, WBP_ALetter},
+       {0x1D9B, 0x1DBF, WBP_ALetter},
+       {0x1DC0, 0x1DF5, WBP_Extend},
+       {0x1DFC, 0x1DFF, WBP_Extend},
+       {0x1E00, 0x1F15, WBP_ALetter},
+       {0x1F18, 0x1F1D, WBP_ALetter},
+       {0x1F20, 0x1F45, WBP_ALetter},
+       {0x1F48, 0x1F4D, WBP_ALetter},
+       {0x1F50, 0x1F57, WBP_ALetter},
+       {0x1F59, 0x1F59, WBP_ALetter},
+       {0x1F5B, 0x1F5B, WBP_ALetter},
+       {0x1F5D, 0x1F5D, WBP_ALetter},
+       {0x1F5F, 0x1F7D, WBP_ALetter},
+       {0x1F80, 0x1FB4, WBP_ALetter},
+       {0x1FB6, 0x1FBC, WBP_ALetter},
+       {0x1FBE, 0x1FBE, WBP_ALetter},
+       {0x1FC2, 0x1FC4, WBP_ALetter},
+       {0x1FC6, 0x1FCC, WBP_ALetter},
+       {0x1FD0, 0x1FD3, WBP_ALetter},
+       {0x1FD6, 0x1FDB, WBP_ALetter},
+       {0x1FE0, 0x1FEC, WBP_ALetter},
+       {0x1FF2, 0x1FF4, WBP_ALetter},
+       {0x1FF6, 0x1FFC, WBP_ALetter},
+       {0x200C, 0x200D, WBP_Extend},
+       {0x200E, 0x200F, WBP_Format},
+       {0x2018, 0x2018, WBP_MidNumLet},
+       {0x2019, 0x2019, WBP_MidNumLet},
+       {0x2024, 0x2024, WBP_MidNumLet},
+       {0x2027, 0x2027, WBP_MidLetter},
+       {0x2028, 0x2028, WBP_Newline},
+       {0x2029, 0x2029, WBP_Newline},
+       {0x202A, 0x202E, WBP_Format},
+       {0x203F, 0x2040, WBP_ExtendNumLet},
+       {0x2044, 0x2044, WBP_MidNum},
+       {0x2054, 0x2054, WBP_ExtendNumLet},
+       {0x2060, 0x2064, WBP_Format},
+       {0x2066, 0x206F, WBP_Format},
+       {0x2071, 0x2071, WBP_ALetter},
+       {0x207F, 0x207F, WBP_ALetter},
+       {0x2090, 0x209C, WBP_ALetter},
+       {0x20D0, 0x20DC, WBP_Extend},
+       {0x20DD, 0x20E0, WBP_Extend},
+       {0x20E1, 0x20E1, WBP_Extend},
+       {0x20E2, 0x20E4, WBP_Extend},
+       {0x20E5, 0x20F0, WBP_Extend},
+       {0x2102, 0x2102, WBP_ALetter},
+       {0x2107, 0x2107, WBP_ALetter},
+       {0x210A, 0x2113, WBP_ALetter},
+       {0x2115, 0x2115, WBP_ALetter},
+       {0x2119, 0x211D, WBP_ALetter},
+       {0x2124, 0x2124, WBP_ALetter},
+       {0x2126, 0x2126, WBP_ALetter},
+       {0x2128, 0x2128, WBP_ALetter},
+       {0x212A, 0x212D, WBP_ALetter},
+       {0x212F, 0x2134, WBP_ALetter},
+       {0x2135, 0x2138, WBP_ALetter},
+       {0x2139, 0x2139, WBP_ALetter},
+       {0x213C, 0x213F, WBP_ALetter},
+       {0x2145, 0x2149, WBP_ALetter},
+       {0x214E, 0x214E, WBP_ALetter},
+       {0x2160, 0x2182, WBP_ALetter},
+       {0x2183, 0x2184, WBP_ALetter},
+       {0x2185, 0x2188, WBP_ALetter},
+       {0x24B6, 0x24E9, WBP_ALetter},
+       {0x2C00, 0x2C2E, WBP_ALetter},
+       {0x2C30, 0x2C5E, WBP_ALetter},
+       {0x2C60, 0x2C7B, WBP_ALetter},
+       {0x2C7C, 0x2C7D, WBP_ALetter},
+       {0x2C7E, 0x2CE4, WBP_ALetter},
+       {0x2CEB, 0x2CEE, WBP_ALetter},
+       {0x2CEF, 0x2CF1, WBP_Extend},
+       {0x2CF2, 0x2CF3, WBP_ALetter},
+       {0x2D00, 0x2D25, WBP_ALetter},
+       {0x2D27, 0x2D27, WBP_ALetter},
+       {0x2D2D, 0x2D2D, WBP_ALetter},
+       {0x2D30, 0x2D67, WBP_ALetter},
+       {0x2D6F, 0x2D6F, WBP_ALetter},
+       {0x2D7F, 0x2D7F, WBP_Extend},
+       {0x2D80, 0x2D96, WBP_ALetter},
+       {0x2DA0, 0x2DA6, WBP_ALetter},
+       {0x2DA8, 0x2DAE, WBP_ALetter},
+       {0x2DB0, 0x2DB6, WBP_ALetter},
+       {0x2DB8, 0x2DBE, WBP_ALetter},
+       {0x2DC0, 0x2DC6, WBP_ALetter},
+       {0x2DC8, 0x2DCE, WBP_ALetter},
+       {0x2DD0, 0x2DD6, WBP_ALetter},
+       {0x2DD8, 0x2DDE, WBP_ALetter},
+       {0x2DE0, 0x2DFF, WBP_Extend},
+       {0x2E2F, 0x2E2F, WBP_ALetter},
+       {0x3005, 0x3005, WBP_ALetter},
+       {0x302A, 0x302D, WBP_Extend},
+       {0x302E, 0x302F, WBP_Extend},
+       {0x3031, 0x3035, WBP_Katakana},
+       {0x303B, 0x303B, WBP_ALetter},
+       {0x303C, 0x303C, WBP_ALetter},
+       {0x3099, 0x309A, WBP_Extend},
+       {0x309B, 0x309C, WBP_Katakana},
+       {0x30A0, 0x30A0, WBP_Katakana},
+       {0x30A1, 0x30FA, WBP_Katakana},
+       {0x30FC, 0x30FE, WBP_Katakana},
+       {0x30FF, 0x30FF, WBP_Katakana},
+       {0x3105, 0x312D, WBP_ALetter},
+       {0x3131, 0x318E, WBP_ALetter},
+       {0x31A0, 0x31BA, WBP_ALetter},
+       {0x31F0, 0x31FF, WBP_Katakana},
+       {0x32D0, 0x32FE, WBP_Katakana},
+       {0x3300, 0x3357, WBP_Katakana},
+       {0xA000, 0xA014, WBP_ALetter},
+       {0xA015, 0xA015, WBP_ALetter},
+       {0xA016, 0xA48C, WBP_ALetter},
+       {0xA4D0, 0xA4F7, WBP_ALetter},
+       {0xA4F8, 0xA4FD, WBP_ALetter},
+       {0xA500, 0xA60B, WBP_ALetter},
+       {0xA60C, 0xA60C, WBP_ALetter},
+       {0xA610, 0xA61F, WBP_ALetter},
+       {0xA620, 0xA629, WBP_Numeric},
+       {0xA62A, 0xA62B, WBP_ALetter},
+       {0xA640, 0xA66D, WBP_ALetter},
+       {0xA66E, 0xA66E, WBP_ALetter},
+       {0xA66F, 0xA66F, WBP_Extend},
+       {0xA670, 0xA672, WBP_Extend},
+       {0xA674, 0xA67D, WBP_Extend},
+       {0xA67F, 0xA67F, WBP_ALetter},
+       {0xA680, 0xA69B, WBP_ALetter},
+       {0xA69C, 0xA69D, WBP_ALetter},
+       {0xA69F, 0xA69F, WBP_Extend},
+       {0xA6A0, 0xA6E5, WBP_ALetter},
+       {0xA6E6, 0xA6EF, WBP_ALetter},
+       {0xA6F0, 0xA6F1, WBP_Extend},
+       {0xA717, 0xA71F, WBP_ALetter},
+       {0xA722, 0xA76F, WBP_ALetter},
+       {0xA770, 0xA770, WBP_ALetter},
+       {0xA771, 0xA787, WBP_ALetter},
+       {0xA788, 0xA788, WBP_ALetter},
+       {0xA78B, 0xA78E, WBP_ALetter},
+       {0xA790, 0xA7AD, WBP_ALetter},
+       {0xA7B0, 0xA7B1, WBP_ALetter},
+       {0xA7F7, 0xA7F7, WBP_ALetter},
+       {0xA7F8, 0xA7F9, WBP_ALetter},
+       {0xA7FA, 0xA7FA, WBP_ALetter},
+       {0xA7FB, 0xA801, WBP_ALetter},
+       {0xA802, 0xA802, WBP_Extend},
+       {0xA803, 0xA805, WBP_ALetter},
+       {0xA806, 0xA806, WBP_Extend},
+       {0xA807, 0xA80A, WBP_ALetter},
+       {0xA80B, 0xA80B, WBP_Extend},
+       {0xA80C, 0xA822, WBP_ALetter},
+       {0xA823, 0xA824, WBP_Extend},
+       {0xA825, 0xA826, WBP_Extend},
+       {0xA827, 0xA827, WBP_Extend},
+       {0xA840, 0xA873, WBP_ALetter},
+       {0xA880, 0xA881, WBP_Extend},
+       {0xA882, 0xA8B3, WBP_ALetter},
+       {0xA8B4, 0xA8C3, WBP_Extend},
+       {0xA8C4, 0xA8C4, WBP_Extend},
+       {0xA8D0, 0xA8D9, WBP_Numeric},
+       {0xA8E0, 0xA8F1, WBP_Extend},
+       {0xA8F2, 0xA8F7, WBP_ALetter},
+       {0xA8FB, 0xA8FB, WBP_ALetter},
+       {0xA900, 0xA909, WBP_Numeric},
+       {0xA90A, 0xA925, WBP_ALetter},
+       {0xA926, 0xA92D, WBP_Extend},
+       {0xA930, 0xA946, WBP_ALetter},
+       {0xA947, 0xA951, WBP_Extend},
+       {0xA952, 0xA953, WBP_Extend},
+       {0xA960, 0xA97C, WBP_ALetter},
+       {0xA980, 0xA982, WBP_Extend},
+       {0xA983, 0xA983, WBP_Extend},
+       {0xA984, 0xA9B2, WBP_ALetter},
+       {0xA9B3, 0xA9B3, WBP_Extend},
+       {0xA9B4, 0xA9B5, WBP_Extend},
+       {0xA9B6, 0xA9B9, WBP_Extend},
+       {0xA9BA, 0xA9BB, WBP_Extend},
+       {0xA9BC, 0xA9BC, WBP_Extend},
+       {0xA9BD, 0xA9C0, WBP_Extend},
+       {0xA9CF, 0xA9CF, WBP_ALetter},
+       {0xA9D0, 0xA9D9, WBP_Numeric},
+       {0xA9E5, 0xA9E5, WBP_Extend},
+       {0xA9F0, 0xA9F9, WBP_Numeric},
+       {0xAA00, 0xAA28, WBP_ALetter},
+       {0xAA29, 0xAA2E, WBP_Extend},
+       {0xAA2F, 0xAA30, WBP_Extend},
+       {0xAA31, 0xAA32, WBP_Extend},
+       {0xAA33, 0xAA34, WBP_Extend},
+       {0xAA35, 0xAA36, WBP_Extend},
+       {0xAA40, 0xAA42, WBP_ALetter},
+       {0xAA43, 0xAA43, WBP_Extend},
+       {0xAA44, 0xAA4B, WBP_ALetter},
+       {0xAA4C, 0xAA4C, WBP_Extend},
+       {0xAA4D, 0xAA4D, WBP_Extend},
+       {0xAA50, 0xAA59, WBP_Numeric},
+       {0xAA7B, 0xAA7B, WBP_Extend},
+       {0xAA7C, 0xAA7C, WBP_Extend},
+       {0xAA7D, 0xAA7D, WBP_Extend},
+       {0xAAB0, 0xAAB0, WBP_Extend},
+       {0xAAB2, 0xAAB4, WBP_Extend},
+       {0xAAB7, 0xAAB8, WBP_Extend},
+       {0xAABE, 0xAABF, WBP_Extend},
+       {0xAAC1, 0xAAC1, WBP_Extend},
+       {0xAAE0, 0xAAEA, WBP_ALetter},
+       {0xAAEB, 0xAAEB, WBP_Extend},
+       {0xAAEC, 0xAAED, WBP_Extend},
+       {0xAAEE, 0xAAEF, WBP_Extend},
+       {0xAAF2, 0xAAF2, WBP_ALetter},
+       {0xAAF3, 0xAAF4, WBP_ALetter},
+       {0xAAF5, 0xAAF5, WBP_Extend},
+       {0xAAF6, 0xAAF6, WBP_Extend},
+       {0xAB01, 0xAB06, WBP_ALetter},
+       {0xAB09, 0xAB0E, WBP_ALetter},
+       {0xAB11, 0xAB16, WBP_ALetter},
+       {0xAB20, 0xAB26, WBP_ALetter},
+       {0xAB28, 0xAB2E, WBP_ALetter},
+       {0xAB30, 0xAB5A, WBP_ALetter},
+       {0xAB5C, 0xAB5F, WBP_ALetter},
+       {0xAB64, 0xAB65, WBP_ALetter},
+       {0xABC0, 0xABE2, WBP_ALetter},
+       {0xABE3, 0xABE4, WBP_Extend},
+       {0xABE5, 0xABE5, WBP_Extend},
+       {0xABE6, 0xABE7, WBP_Extend},
+       {0xABE8, 0xABE8, WBP_Extend},
+       {0xABE9, 0xABEA, WBP_Extend},
+       {0xABEC, 0xABEC, WBP_Extend},
+       {0xABED, 0xABED, WBP_Extend},
+       {0xABF0, 0xABF9, WBP_Numeric},
+       {0xAC00, 0xD7A3, WBP_ALetter},
+       {0xD7B0, 0xD7C6, WBP_ALetter},
+       {0xD7CB, 0xD7FB, WBP_ALetter},
+       {0xFB00, 0xFB06, WBP_ALetter},
+       {0xFB13, 0xFB17, WBP_ALetter},
+       {0xFB1D, 0xFB1D, WBP_Hebrew},
+       {0xFB1E, 0xFB1E, WBP_Extend},
+       {0xFB1F, 0xFB28, WBP_Hebrew},
+       {0xFB2A, 0xFB36, WBP_Hebrew},
+       {0xFB38, 0xFB3C, WBP_Hebrew},
+       {0xFB3E, 0xFB3E, WBP_Hebrew},
+       {0xFB40, 0xFB41, WBP_Hebrew},
+       {0xFB43, 0xFB44, WBP_Hebrew},
+       {0xFB46, 0xFB4F, WBP_Hebrew},
+       {0xFB50, 0xFBB1, WBP_ALetter},
+       {0xFBD3, 0xFD3D, WBP_ALetter},
+       {0xFD50, 0xFD8F, WBP_ALetter},
+       {0xFD92, 0xFDC7, WBP_ALetter},
+       {0xFDF0, 0xFDFB, WBP_ALetter},
+       {0xFE00, 0xFE0F, WBP_Extend},
+       {0xFE10, 0xFE10, WBP_MidNum},
+       {0xFE13, 0xFE13, WBP_MidLetter},
+       {0xFE14, 0xFE14, WBP_MidNum},
+       {0xFE20, 0xFE2D, WBP_Extend},
+       {0xFE33, 0xFE34, WBP_ExtendNumLet},
+       {0xFE4D, 0xFE4F, WBP_ExtendNumLet},
+       {0xFE50, 0xFE50, WBP_MidNum},
+       {0xFE52, 0xFE52, WBP_MidNumLet},
+       {0xFE54, 0xFE54, WBP_MidNum},
+       {0xFE55, 0xFE55, WBP_MidLetter},
+       {0xFE70, 0xFE74, WBP_ALetter},
+       {0xFE76, 0xFEFC, WBP_ALetter},
+       {0xFEFF, 0xFEFF, WBP_Format},
+       {0xFF07, 0xFF07, WBP_MidNumLet},
+       {0xFF0C, 0xFF0C, WBP_MidNum},
+       {0xFF0E, 0xFF0E, WBP_MidNumLet},
+       {0xFF1A, 0xFF1A, WBP_MidLetter},
+       {0xFF1B, 0xFF1B, WBP_MidNum},
+       {0xFF21, 0xFF3A, WBP_ALetter},
+       {0xFF3F, 0xFF3F, WBP_ExtendNumLet},
+       {0xFF41, 0xFF5A, WBP_ALetter},
+       {0xFF66, 0xFF6F, WBP_Katakana},
+       {0xFF70, 0xFF70, WBP_Katakana},
+       {0xFF71, 0xFF9D, WBP_Katakana},
+       {0xFF9E, 0xFF9F, WBP_Extend},
+       {0xFFA0, 0xFFBE, WBP_ALetter},
+       {0xFFC2, 0xFFC7, WBP_ALetter},
+       {0xFFCA, 0xFFCF, WBP_ALetter},
+       {0xFFD2, 0xFFD7, WBP_ALetter},
+       {0xFFDA, 0xFFDC, WBP_ALetter},
+       {0xFFF9, 0xFFFB, WBP_Format},
+       {0x10000, 0x1000B, WBP_ALetter},
+       {0x1000D, 0x10026, WBP_ALetter},
+       {0x10028, 0x1003A, WBP_ALetter},
+       {0x1003C, 0x1003D, WBP_ALetter},
+       {0x1003F, 0x1004D, WBP_ALetter},
+       {0x10050, 0x1005D, WBP_ALetter},
+       {0x10080, 0x100FA, WBP_ALetter},
+       {0x10140, 0x10174, WBP_ALetter},
+       {0x101FD, 0x101FD, WBP_Extend},
+       {0x10280, 0x1029C, WBP_ALetter},
+       {0x102A0, 0x102D0, WBP_ALetter},
+       {0x102E0, 0x102E0, WBP_Extend},
+       {0x10300, 0x1031F, WBP_ALetter},
+       {0x10330, 0x10340, WBP_ALetter},
+       {0x10341, 0x10341, WBP_ALetter},
+       {0x10342, 0x10349, WBP_ALetter},
+       {0x1034A, 0x1034A, WBP_ALetter},
+       {0x10350, 0x10375, WBP_ALetter},
+       {0x10376, 0x1037A, WBP_Extend},
+       {0x10380, 0x1039D, WBP_ALetter},
+       {0x103A0, 0x103C3, WBP_ALetter},
+       {0x103C8, 0x103CF, WBP_ALetter},
+       {0x103D1, 0x103D5, WBP_ALetter},
+       {0x10400, 0x1044F, WBP_ALetter},
+       {0x10450, 0x1049D, WBP_ALetter},
+       {0x104A0, 0x104A9, WBP_Numeric},
+       {0x10500, 0x10527, WBP_ALetter},
+       {0x10530, 0x10563, WBP_ALetter},
+       {0x10600, 0x10736, WBP_ALetter},
+       {0x10740, 0x10755, WBP_ALetter},
+       {0x10760, 0x10767, WBP_ALetter},
+       {0x10800, 0x10805, WBP_ALetter},
+       {0x10808, 0x10808, WBP_ALetter},
+       {0x1080A, 0x10835, WBP_ALetter},
+       {0x10837, 0x10838, WBP_ALetter},
+       {0x1083C, 0x1083C, WBP_ALetter},
+       {0x1083F, 0x10855, WBP_ALetter},
+       {0x10860, 0x10876, WBP_ALetter},
+       {0x10880, 0x1089E, WBP_ALetter},
+       {0x10900, 0x10915, WBP_ALetter},
+       {0x10920, 0x10939, WBP_ALetter},
+       {0x10980, 0x109B7, WBP_ALetter},
+       {0x109BE, 0x109BF, WBP_ALetter},
+       {0x10A00, 0x10A00, WBP_ALetter},
+       {0x10A01, 0x10A03, WBP_Extend},
+       {0x10A05, 0x10A06, WBP_Extend},
+       {0x10A0C, 0x10A0F, WBP_Extend},
+       {0x10A10, 0x10A13, WBP_ALetter},
+       {0x10A15, 0x10A17, WBP_ALetter},
+       {0x10A19, 0x10A33, WBP_ALetter},
+       {0x10A38, 0x10A3A, WBP_Extend},
+       {0x10A3F, 0x10A3F, WBP_Extend},
+       {0x10A60, 0x10A7C, WBP_ALetter},
+       {0x10A80, 0x10A9C, WBP_ALetter},
+       {0x10AC0, 0x10AC7, WBP_ALetter},
+       {0x10AC9, 0x10AE4, WBP_ALetter},
+       {0x10AE5, 0x10AE6, WBP_Extend},
+       {0x10B00, 0x10B35, WBP_ALetter},
+       {0x10B40, 0x10B55, WBP_ALetter},
+       {0x10B60, 0x10B72, WBP_ALetter},
+       {0x10B80, 0x10B91, WBP_ALetter},
+       {0x10C00, 0x10C48, WBP_ALetter},
+       {0x11000, 0x11000, WBP_Extend},
+       {0x11001, 0x11001, WBP_Extend},
+       {0x11002, 0x11002, WBP_Extend},
+       {0x11003, 0x11037, WBP_ALetter},
+       {0x11038, 0x11046, WBP_Extend},
+       {0x11066, 0x1106F, WBP_Numeric},
+       {0x1107F, 0x11081, WBP_Extend},
+       {0x11082, 0x11082, WBP_Extend},
+       {0x11083, 0x110AF, WBP_ALetter},
+       {0x110B0, 0x110B2, WBP_Extend},
+       {0x110B3, 0x110B6, WBP_Extend},
+       {0x110B7, 0x110B8, WBP_Extend},
+       {0x110B9, 0x110BA, WBP_Extend},
+       {0x110BD, 0x110BD, WBP_Format},
+       {0x110D0, 0x110E8, WBP_ALetter},
+       {0x110F0, 0x110F9, WBP_Numeric},
+       {0x11100, 0x11102, WBP_Extend},
+       {0x11103, 0x11126, WBP_ALetter},
+       {0x11127, 0x1112B, WBP_Extend},
+       {0x1112C, 0x1112C, WBP_Extend},
+       {0x1112D, 0x11134, WBP_Extend},
+       {0x11136, 0x1113F, WBP_Numeric},
+       {0x11150, 0x11172, WBP_ALetter},
+       {0x11173, 0x11173, WBP_Extend},
+       {0x11176, 0x11176, WBP_ALetter},
+       {0x11180, 0x11181, WBP_Extend},
+       {0x11182, 0x11182, WBP_Extend},
+       {0x11183, 0x111B2, WBP_ALetter},
+       {0x111B3, 0x111B5, WBP_Extend},
+       {0x111B6, 0x111BE, WBP_Extend},
+       {0x111BF, 0x111C0, WBP_Extend},
+       {0x111C1, 0x111C4, WBP_ALetter},
+       {0x111D0, 0x111D9, WBP_Numeric},
+       {0x111DA, 0x111DA, WBP_ALetter},
+       {0x11200, 0x11211, WBP_ALetter},
+       {0x11213, 0x1122B, WBP_ALetter},
+       {0x1122C, 0x1122E, WBP_Extend},
+       {0x1122F, 0x11231, WBP_Extend},
+       {0x11232, 0x11233, WBP_Extend},
+       {0x11234, 0x11234, WBP_Extend},
+       {0x11235, 0x11235, WBP_Extend},
+       {0x11236, 0x11237, WBP_Extend},
+       {0x112B0, 0x112DE, WBP_ALetter},
+       {0x112DF, 0x112DF, WBP_Extend},
+       {0x112E0, 0x112E2, WBP_Extend},
+       {0x112E3, 0x112EA, WBP_Extend},
+       {0x112F0, 0x112F9, WBP_Numeric},
+       {0x11301, 0x11301, WBP_Extend},
+       {0x11302, 0x11303, WBP_Extend},
+       {0x11305, 0x1130C, WBP_ALetter},
+       {0x1130F, 0x11310, WBP_ALetter},
+       {0x11313, 0x11328, WBP_ALetter},
+       {0x1132A, 0x11330, WBP_ALetter},
+       {0x11332, 0x11333, WBP_ALetter},
+       {0x11335, 0x11339, WBP_ALetter},
+       {0x1133C, 0x1133C, WBP_Extend},
+       {0x1133D, 0x1133D, WBP_ALetter},
+       {0x1133E, 0x1133F, WBP_Extend},
+       {0x11340, 0x11340, WBP_Extend},
+       {0x11341, 0x11344, WBP_Extend},
+       {0x11347, 0x11348, WBP_Extend},
+       {0x1134B, 0x1134D, WBP_Extend},
+       {0x11357, 0x11357, WBP_Extend},
+       {0x1135D, 0x11361, WBP_ALetter},
+       {0x11362, 0x11363, WBP_Extend},
+       {0x11366, 0x1136C, WBP_Extend},
+       {0x11370, 0x11374, WBP_Extend},
+       {0x11480, 0x114AF, WBP_ALetter},
+       {0x114B0, 0x114B2, WBP_Extend},
+       {0x114B3, 0x114B8, WBP_Extend},
+       {0x114B9, 0x114B9, WBP_Extend},
+       {0x114BA, 0x114BA, WBP_Extend},
+       {0x114BB, 0x114BE, WBP_Extend},
+       {0x114BF, 0x114C0, WBP_Extend},
+       {0x114C1, 0x114C1, WBP_Extend},
+       {0x114C2, 0x114C3, WBP_Extend},
+       {0x114C4, 0x114C5, WBP_ALetter},
+       {0x114C7, 0x114C7, WBP_ALetter},
+       {0x114D0, 0x114D9, WBP_Numeric},
+       {0x11580, 0x115AE, WBP_ALetter},
+       {0x115AF, 0x115B1, WBP_Extend},
+       {0x115B2, 0x115B5, WBP_Extend},
+       {0x115B8, 0x115BB, WBP_Extend},
+       {0x115BC, 0x115BD, WBP_Extend},
+       {0x115BE, 0x115BE, WBP_Extend},
+       {0x115BF, 0x115C0, WBP_Extend},
+       {0x11600, 0x1162F, WBP_ALetter},
+       {0x11630, 0x11632, WBP_Extend},
+       {0x11633, 0x1163A, WBP_Extend},
+       {0x1163B, 0x1163C, WBP_Extend},
+       {0x1163D, 0x1163D, WBP_Extend},
+       {0x1163E, 0x1163E, WBP_Extend},
+       {0x1163F, 0x11640, WBP_Extend},
+       {0x11644, 0x11644, WBP_ALetter},
+       {0x11650, 0x11659, WBP_Numeric},
+       {0x11680, 0x116AA, WBP_ALetter},
+       {0x116AB, 0x116AB, WBP_Extend},
+       {0x116AC, 0x116AC, WBP_Extend},
+       {0x116AD, 0x116AD, WBP_Extend},
+       {0x116AE, 0x116AF, WBP_Extend},
+       {0x116B0, 0x116B5, WBP_Extend},
+       {0x116B6, 0x116B6, WBP_Extend},
+       {0x116B7, 0x116B7, WBP_Extend},
+       {0x116C0, 0x116C9, WBP_Numeric},
+       {0x118A0, 0x118DF, WBP_ALetter},
+       {0x118E0, 0x118E9, WBP_Numeric},
+       {0x118FF, 0x118FF, WBP_ALetter},
+       {0x11AC0, 0x11AF8, WBP_ALetter},
+       {0x12000, 0x12398, WBP_ALetter},
+       {0x12400, 0x1246E, WBP_ALetter},
+       {0x13000, 0x1342E, WBP_ALetter},
+       {0x16800, 0x16A38, WBP_ALetter},
+       {0x16A40, 0x16A5E, WBP_ALetter},
+       {0x16A60, 0x16A69, WBP_Numeric},
+       {0x16AD0, 0x16AED, WBP_ALetter},
+       {0x16AF0, 0x16AF4, WBP_Extend},
+       {0x16B00, 0x16B2F, WBP_ALetter},
+       {0x16B30, 0x16B36, WBP_Extend},
+       {0x16B40, 0x16B43, WBP_ALetter},
+       {0x16B50, 0x16B59, WBP_Numeric},
+       {0x16B63, 0x16B77, WBP_ALetter},
+       {0x16B7D, 0x16B8F, WBP_ALetter},
+       {0x16F00, 0x16F44, WBP_ALetter},
+       {0x16F50, 0x16F50, WBP_ALetter},
+       {0x16F51, 0x16F7E, WBP_Extend},
+       {0x16F8F, 0x16F92, WBP_Extend},
+       {0x16F93, 0x16F9F, WBP_ALetter},
+       {0x1B000, 0x1B000, WBP_Katakana},
+       {0x1BC00, 0x1BC6A, WBP_ALetter},
+       {0x1BC70, 0x1BC7C, WBP_ALetter},
+       {0x1BC80, 0x1BC88, WBP_ALetter},
+       {0x1BC90, 0x1BC99, WBP_ALetter},
+       {0x1BC9D, 0x1BC9E, WBP_Extend},
+       {0x1BCA0, 0x1BCA3, WBP_Format},
+       {0x1D165, 0x1D166, WBP_Extend},
+       {0x1D167, 0x1D169, WBP_Extend},
+       {0x1D16D, 0x1D172, WBP_Extend},
+       {0x1D173, 0x1D17A, WBP_Format},
+       {0x1D17B, 0x1D182, WBP_Extend},
+       {0x1D185, 0x1D18B, WBP_Extend},
+       {0x1D1AA, 0x1D1AD, WBP_Extend},
+       {0x1D242, 0x1D244, WBP_Extend},
+       {0x1D400, 0x1D454, WBP_ALetter},
+       {0x1D456, 0x1D49C, WBP_ALetter},
+       {0x1D49E, 0x1D49F, WBP_ALetter},
+       {0x1D4A2, 0x1D4A2, WBP_ALetter},
+       {0x1D4A5, 0x1D4A6, WBP_ALetter},
+       {0x1D4A9, 0x1D4AC, WBP_ALetter},
+       {0x1D4AE, 0x1D4B9, WBP_ALetter},
+       {0x1D4BB, 0x1D4BB, WBP_ALetter},
+       {0x1D4BD, 0x1D4C3, WBP_ALetter},
+       {0x1D4C5, 0x1D505, WBP_ALetter},
+       {0x1D507, 0x1D50A, WBP_ALetter},
+       {0x1D50D, 0x1D514, WBP_ALetter},
+       {0x1D516, 0x1D51C, WBP_ALetter},
+       {0x1D51E, 0x1D539, WBP_ALetter},
+       {0x1D53B, 0x1D53E, WBP_ALetter},
+       {0x1D540, 0x1D544, WBP_ALetter},
+       {0x1D546, 0x1D546, WBP_ALetter},
+       {0x1D54A, 0x1D550, WBP_ALetter},
+       {0x1D552, 0x1D6A5, WBP_ALetter},
+       {0x1D6A8, 0x1D6C0, WBP_ALetter},
+       {0x1D6C2, 0x1D6DA, WBP_ALetter},
+       {0x1D6DC, 0x1D6FA, WBP_ALetter},
+       {0x1D6FC, 0x1D714, WBP_ALetter},
+       {0x1D716, 0x1D734, WBP_ALetter},
+       {0x1D736, 0x1D74E, WBP_ALetter},
+       {0x1D750, 0x1D76E, WBP_ALetter},
+       {0x1D770, 0x1D788, WBP_ALetter},
+       {0x1D78A, 0x1D7A8, WBP_ALetter},
+       {0x1D7AA, 0x1D7C2, WBP_ALetter},
+       {0x1D7C4, 0x1D7CB, WBP_ALetter},
+       {0x1D7CE, 0x1D7FF, WBP_Numeric},
+       {0x1E800, 0x1E8C4, WBP_ALetter},
+       {0x1E8D0, 0x1E8D6, WBP_Extend},
+       {0x1EE00, 0x1EE03, WBP_ALetter},
+       {0x1EE05, 0x1EE1F, WBP_ALetter},
+       {0x1EE21, 0x1EE22, WBP_ALetter},
+       {0x1EE24, 0x1EE24, WBP_ALetter},
+       {0x1EE27, 0x1EE27, WBP_ALetter},
+       {0x1EE29, 0x1EE32, WBP_ALetter},
+       {0x1EE34, 0x1EE37, WBP_ALetter},
+       {0x1EE39, 0x1EE39, WBP_ALetter},
+       {0x1EE3B, 0x1EE3B, WBP_ALetter},
+       {0x1EE42, 0x1EE42, WBP_ALetter},
+       {0x1EE47, 0x1EE47, WBP_ALetter},
+       {0x1EE49, 0x1EE49, WBP_ALetter},
+       {0x1EE4B, 0x1EE4B, WBP_ALetter},
+       {0x1EE4D, 0x1EE4F, WBP_ALetter},
+       {0x1EE51, 0x1EE52, WBP_ALetter},
+       {0x1EE54, 0x1EE54, WBP_ALetter},
+       {0x1EE57, 0x1EE57, WBP_ALetter},
+       {0x1EE59, 0x1EE59, WBP_ALetter},
+       {0x1EE5B, 0x1EE5B, WBP_ALetter},
+       {0x1EE5D, 0x1EE5D, WBP_ALetter},
+       {0x1EE5F, 0x1EE5F, WBP_ALetter},
+       {0x1EE61, 0x1EE62, WBP_ALetter},
+       {0x1EE64, 0x1EE64, WBP_ALetter},
+       {0x1EE67, 0x1EE6A, WBP_ALetter},
+       {0x1EE6C, 0x1EE72, WBP_ALetter},
+       {0x1EE74, 0x1EE77, WBP_ALetter},
+       {0x1EE79, 0x1EE7C, WBP_ALetter},
+       {0x1EE7E, 0x1EE7E, WBP_ALetter},
+       {0x1EE80, 0x1EE89, WBP_ALetter},
+       {0x1EE8B, 0x1EE9B, WBP_ALetter},
+       {0x1EEA1, 0x1EEA3, WBP_ALetter},
+       {0x1EEA5, 0x1EEA9, WBP_ALetter},
+       {0x1EEAB, 0x1EEBB, WBP_ALetter},
+       {0x1F130, 0x1F149, WBP_ALetter},
+       {0x1F150, 0x1F169, WBP_ALetter},
+       {0x1F170, 0x1F189, WBP_ALetter},
+       {0x1F1E6, 0x1F1FF, WBP_Regional},
+       {0xE0001, 0xE0001, WBP_Format},
+       {0xE0020, 0xE007F, WBP_Format},
+       {0xE0100, 0xE01EF, WBP_Extend},
+       {0xFFFFFFFF, 0xFFFFFFFF, WBP_Undefined}
+};
diff --git a/text/dali/internal/libunibreak/wordbreakdef.h b/text/dali/internal/libunibreak/wordbreakdef.h
new file mode 100644 (file)
index 0000000..72816f9
--- /dev/null
@@ -0,0 +1,88 @@
+/* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */
+
+/*
+ * Word breaking in a Unicode sequence.  Designed to be used in a
+ * generic text renderer.
+ *
+ * Copyright (C) 2013 Tom Hacohen <tom at stosb dot com>
+ * Copyright (C) 2013 Petr Filipsky <philodej at gmail dot com>
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty.  In no event will the author be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute
+ * it freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must
+ *    not claim that you wrote the original software.  If you use this
+ *    software in a product, an acknowledgement in the product
+ *    documentation would be appreciated but is not required.
+ * 2. Altered source versions must be plainly marked as such, and must
+ *    not be misrepresented as being the original software.
+ * 3. This notice may not be removed or altered from any source
+ *    distribution.
+ *
+ * The main reference is Unicode Standard Annex 29 (UAX #29):
+ *      <URL:http://unicode.org/reports/tr29>
+ *
+ * When this library was designed, this annex was at Revision 17, for
+ * Unicode 6.0.0:
+ *      <URL:http://www.unicode.org/reports/tr29/tr29-17.html>
+ *
+ * This library has been updated according to Revision 21, for
+ * Unicode 6.2.0:
+ *      <URL:http://www.unicode.org/reports/tr29/tr29-21.html>
+ *
+ * The Unicode Terms of Use are available at
+ *      <URL:http://www.unicode.org/copyright.html>
+ */
+
+/**
+ * @file    wordbreakdef.h
+ *
+ * Definitions of internal data structures, declarations of global
+ * variables, and function prototypes for the word breaking algorithm.
+ *
+ * @version 2.4, 2013/11/10
+ * @author  Tom Hacohen
+ * @author  Petr Filipsky
+ */
+
+/**
+ * Word break classes.  This is a direct mapping of Table 3 of Unicode
+ * Standard Annex 29, Revision 23.
+ */
+enum WordBreakClass
+{
+    WBP_Undefined,
+    WBP_CR,
+    WBP_LF,
+    WBP_Newline,
+    WBP_Extend,
+    WBP_Format,
+    WBP_Katakana,
+    WBP_ALetter,
+    WBP_MidNumLet,
+    WBP_MidLetter,
+    WBP_MidNum,
+    WBP_Numeric,
+    WBP_ExtendNumLet,
+    WBP_Regional,
+    WBP_Hebrew,
+    WBP_Single,
+    WBP_Double,
+    WBP_Any
+};
+
+/**
+ * Struct for entries of word break properties.  The array of the
+ * entries \e must be sorted.
+ */
+struct WordBreakProperties
+{
+    utf32_t start;              /**< Starting coding point */
+    utf32_t end;                /**< End coding point */
+    enum WordBreakClass prop;   /**< The word breaking property */
+};
diff --git a/text/dali/internal/text-abstraction/bidirectional-support-impl.cpp b/text/dali/internal/text-abstraction/bidirectional-support-impl.cpp
new file mode 100644 (file)
index 0000000..a03d721
--- /dev/null
@@ -0,0 +1,250 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS  HEADER
+#include "bidirectional-support-impl.h"
+
+// INTERNAL INCLUDES
+#include <singleton-service-impl.h>
+
+// EXTERNAL INCLUDES
+#include <memory.h>
+#include <fribidi/fribidi.h>
+
+namespace Dali
+{
+
+namespace TextAbstraction
+{
+
+namespace Internal
+{
+
+struct BidirectionalSupport::Plugin
+{
+  /**
+   * Stores bidirectional info per paragraph.
+   */
+  struct BidirectionalInfo
+  {
+    FriBidiCharType* characterTypes;      ///< The type of each character (right, left, neutral, ...)
+    FriBidiLevel*    embeddedLevels;      ///< Embedded levels.
+    FriBidiParType   paragraphDirection;  ///< The paragraph's direction.
+  };
+
+  Plugin()
+  : mParagraphBidirectionalInfo(),
+    mFreeIndices()
+  {}
+
+  ~Plugin()
+  {
+    // free all resources.
+    for( Vector<BidirectionalInfo*>::Iterator it = mParagraphBidirectionalInfo.Begin(),
+           endIt = mParagraphBidirectionalInfo.End();
+         it != endIt;
+         ++it )
+    {
+      BidirectionalInfo* info = *it;
+
+      free( info->embeddedLevels );
+      free( info->characterTypes );
+      delete info;
+    }
+  }
+
+  BidiInfoIndex CreateInfo( const Character* const paragraph,
+                            Length numberOfCharacters )
+  {
+    // Reserve memory for the paragraph's bidirectional info.
+    BidirectionalInfo* bidirectionalInfo = new BidirectionalInfo();
+
+    bidirectionalInfo->characterTypes = reinterpret_cast<FriBidiCharType*>( malloc( numberOfCharacters * sizeof( FriBidiCharType ) ) );
+    bidirectionalInfo->embeddedLevels = reinterpret_cast<FriBidiLevel*>( malloc( numberOfCharacters * sizeof( FriBidiLevel ) ) );
+
+    // Retrieve the type of each character..
+    fribidi_get_bidi_types( paragraph, numberOfCharacters, bidirectionalInfo->characterTypes );
+
+    // Retrieve the paragraph's direction.
+    bidirectionalInfo->paragraphDirection = fribidi_get_par_direction( paragraph, numberOfCharacters );
+
+    // Retrieve the embedding levels.
+    fribidi_get_par_embedding_levels( paragraph, numberOfCharacters, &bidirectionalInfo->paragraphDirection, bidirectionalInfo->embeddedLevels );
+
+    // Store the bidirectional info and return the index.
+    BidiInfoIndex index = 0u;
+    if( 0u != mFreeIndices.Count() )
+    {
+      Vector<BidiInfoIndex>::Iterator it = mFreeIndices.End() - 1u;
+
+      index = *it;
+
+      mFreeIndices.Remove( it );
+
+      *( mParagraphBidirectionalInfo.Begin() + index ) = bidirectionalInfo;
+    }
+    else
+    {
+      index = static_cast<BidiInfoIndex>( mParagraphBidirectionalInfo.Count() );
+
+      mParagraphBidirectionalInfo.PushBack( bidirectionalInfo );
+    }
+
+    return index;
+  }
+
+  void DestroyInfo( BidiInfoIndex bidiInfoIndex )
+  {
+    if( bidiInfoIndex >= mParagraphBidirectionalInfo.Count() )
+    {
+      return;
+    }
+
+    // Retrieve the paragraph's bidirectional info.
+    Vector<BidirectionalInfo*>::Iterator it = mParagraphBidirectionalInfo.Begin() + bidiInfoIndex;
+    BidirectionalInfo* bidirectionalInfo = *it;
+
+    if( NULL != bidirectionalInfo )
+    {
+      // Free resources and destroy the container.
+      free( bidirectionalInfo->embeddedLevels );
+      free( bidirectionalInfo->characterTypes );
+      delete bidirectionalInfo;
+
+      *it = NULL;
+    }
+
+    // Add the index to the free indices vector.
+    mFreeIndices.PushBack( bidiInfoIndex );
+  }
+
+  void Reorder( BidiInfoIndex bidiInfoIndex,
+                CharacterIndex firstCharacterIndex,
+                Length numberOfCharacters,
+                CharacterIndex* visualToLogicalMap )
+  {
+    const FriBidiFlags flags = FRIBIDI_FLAGS_DEFAULT | FRIBIDI_FLAGS_ARABIC;
+
+    // Retrieve the paragraph's bidirectional info.
+    const BidirectionalInfo* const bidirectionalInfo = *( mParagraphBidirectionalInfo.Begin() + bidiInfoIndex );
+
+    // Initialize the visual to logical mapping table to the identity. Otherwise fribidi_reorder_line fails to retrieve a valid mapping table.
+    for( CharacterIndex index = 0u; index < numberOfCharacters; ++index )
+    {
+      visualToLogicalMap[ index ] = index;
+    }
+
+    // Copy embedded levels as fribidi_reorder_line() may change them.
+    const uint32_t embeddedLevelsSize = numberOfCharacters * sizeof( FriBidiLevel );
+    FriBidiLevel* embeddedLevels = reinterpret_cast<FriBidiLevel*>( malloc( embeddedLevelsSize ) );
+    memcpy( embeddedLevels, bidirectionalInfo->embeddedLevels + firstCharacterIndex,  embeddedLevelsSize );
+
+    // Reorder the line.
+    fribidi_reorder_line( flags,
+                          bidirectionalInfo->characterTypes + firstCharacterIndex,
+                          numberOfCharacters,
+                          0u,
+                          bidirectionalInfo->paragraphDirection,
+                          embeddedLevels,
+                          NULL,
+                          reinterpret_cast<FriBidiStrIndex*>( visualToLogicalMap ) );
+
+    // Free resources.
+    free( embeddedLevels );
+  }
+
+  Vector<BidirectionalInfo*> mParagraphBidirectionalInfo; ///< Stores the bidirectional info per paragraph.
+  Vector<BidiInfoIndex>      mFreeIndices;                ///< Stores indices of free positions in the bidirectional info vector.
+};
+
+BidirectionalSupport::BidirectionalSupport()
+: mPlugin( NULL )
+{
+}
+
+BidirectionalSupport::~BidirectionalSupport()
+{
+  delete mPlugin;
+}
+
+TextAbstraction::BidirectionalSupport BidirectionalSupport::Get()
+{
+  TextAbstraction::BidirectionalSupport bidirectionalSupportHandle;
+
+  SingletonService service( SingletonService::Get() );
+  if( service )
+  {
+    // Check whether the singleton is already created
+    BaseHandle handle = service.GetSingleton( typeid( TextAbstraction::BidirectionalSupport ) );
+    if(handle)
+    {
+      // If so, downcast the handle
+      BidirectionalSupport* impl = dynamic_cast< Internal::BidirectionalSupport* >( handle.GetObjectPtr() );
+      bidirectionalSupportHandle = TextAbstraction::BidirectionalSupport( impl );
+    }
+    else // create and register the object
+    {
+      bidirectionalSupportHandle = TextAbstraction::BidirectionalSupport( new BidirectionalSupport );
+      service.Register( typeid( bidirectionalSupportHandle ), bidirectionalSupportHandle );
+    }
+  }
+
+  return bidirectionalSupportHandle;
+}
+
+BidiInfoIndex BidirectionalSupport::CreateInfo( const Character* const paragraph,
+                                                Length numberOfCharacters )
+{
+  CreatePlugin();
+
+  return mPlugin->CreateInfo( paragraph,
+                              numberOfCharacters );
+}
+
+void BidirectionalSupport::DestroyInfo( BidiInfoIndex bidiInfoIndex )
+{
+  CreatePlugin();
+
+  mPlugin->DestroyInfo( bidiInfoIndex );
+}
+
+void BidirectionalSupport::Reorder( BidiInfoIndex bidiInfoIndex,
+                                    CharacterIndex firstCharacterIndex,
+                                    Length numberOfCharacters,
+                                    CharacterIndex* visualToLogicalMap )
+{
+  CreatePlugin();
+
+  mPlugin->Reorder( bidiInfoIndex,
+                    firstCharacterIndex,
+                    numberOfCharacters,
+                    visualToLogicalMap );
+}
+
+void BidirectionalSupport::CreatePlugin()
+{
+  if( !mPlugin )
+  {
+    mPlugin = new Plugin();
+  }
+}
+
+} // namespace Internal
+
+} // namespace TextAbstraction
+
+} // namespace Dali
diff --git a/text/dali/internal/text-abstraction/bidirectional-support-impl.h b/text/dali/internal/text-abstraction/bidirectional-support-impl.h
new file mode 100644 (file)
index 0000000..33b1984
--- /dev/null
@@ -0,0 +1,120 @@
+#ifndef __DALI_INTERNAL_TEXT_ABSTRACTION_BIDIRECTIONAL_SUPPORT_IMPL_H__
+#define __DALI_INTERNAL_TEXT_ABSTRACTION_BIDIRECTIONAL_SUPPORT_IMPL_H__
+
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/common/dali-vector.h>
+#include <dali/public-api/object/base-object.h>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/text-abstraction/bidirectional-support.h>
+
+namespace Dali
+{
+
+namespace TextAbstraction
+{
+
+namespace Internal
+{
+
+/**
+ * Implementation of the BidirectionalSupport
+ */
+class BidirectionalSupport : public BaseObject
+{
+public:
+
+  /**
+   * Constructor
+   */
+  BidirectionalSupport();
+
+  /**
+   * Destructor
+   */
+  ~BidirectionalSupport();
+
+  /**
+   * @copydoc Dali::BidirectionalSupport::Get()
+   */
+  static TextAbstraction::BidirectionalSupport Get();
+
+  /**
+   * @copydoc Dali::BidirectionalSupport::CreateInfo()
+   */
+  BidiInfoIndex CreateInfo( const Character* const paragraph,
+                            Length numberOfCharacters );
+
+  /**
+   * @copydoc Dali::BidirectionalSupport::DestroyInfo()
+   */
+  void DestroyInfo( BidiInfoIndex bidiInfoIndex );
+
+  /**
+   * @copydoc Dali::BidirectionalSupport::Reorder()
+   */
+  void Reorder( BidiInfoIndex bidiInfoIndex,
+                CharacterIndex firstCharacterIndex,
+                Length numberOfCharacters,
+                CharacterIndex* visualToLogicalMap );
+
+private:
+
+  /**
+   * Helper for lazy initialization.
+   */
+  void CreatePlugin();
+
+private:
+
+  // Undefined copy constructor.
+  BidirectionalSupport( const BidirectionalSupport& );
+
+  // Undefined assignment constructor.
+  BidirectionalSupport& operator=( BidirectionalSupport& );
+
+private:
+
+  struct Plugin;
+  Plugin* mPlugin;
+
+}; // class BidirectionalSupport
+
+} // namespace Internal
+
+} // namespace TextAbstraction
+
+inline static TextAbstraction::Internal::BidirectionalSupport& GetImplementation( TextAbstraction::BidirectionalSupport& bidirectionalSupport )
+{
+  DALI_ASSERT_ALWAYS( bidirectionalSupport && "bidirectional support handle is empty" );
+  BaseObject& handle = bidirectionalSupport.GetBaseObject();
+  return static_cast<TextAbstraction::Internal::BidirectionalSupport&>(handle);
+}
+
+inline static const TextAbstraction::Internal::BidirectionalSupport& GetImplementation( const TextAbstraction::BidirectionalSupport& bidirectionalSupport )
+{
+  DALI_ASSERT_ALWAYS( bidirectionalSupport && "bidirectional support handle is empty" );
+  const BaseObject& handle = bidirectionalSupport.GetBaseObject();
+  return static_cast<const TextAbstraction::Internal::BidirectionalSupport&>(handle);
+}
+
+} // namespace Dali
+
+#endif // __DALI_INTERNAL_TEXT_ABSTRACTION_BIDIRECTIONAL_SUPPORT_IMPL_H__
diff --git a/text/dali/internal/text-abstraction/font-client-impl.cpp b/text/dali/internal/text-abstraction/font-client-impl.cpp
new file mode 100644 (file)
index 0000000..d069949
--- /dev/null
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/text-abstraction/font-client-impl.h>
+
+// INTERNAL INCLUDES
+#include <singleton-service.h>
+#include <dali/internal/text-abstraction/font-client-plugin-impl.h>
+
+namespace Dali
+{
+
+namespace TextAbstraction
+{
+
+namespace Internal
+{
+
+FontClient::FontClient()
+: mPlugin( NULL ),
+  mDpiHorizontal( 0 ),
+  mDpiVertical( 0 )
+{
+}
+
+FontClient::~FontClient()
+{
+  delete mPlugin;
+}
+
+Dali::TextAbstraction::FontClient FontClient::Get()
+{
+  Dali::TextAbstraction::FontClient fontClientHandle;
+
+  Dali::SingletonService service( SingletonService::Get() );
+  if ( service )
+  {
+    // Check whether the singleton is already created
+    Dali::BaseHandle handle = service.GetSingleton( typeid( Dali::TextAbstraction::FontClient ) );
+    if(handle)
+    {
+      // If so, downcast the handle
+      FontClient* impl = dynamic_cast< Dali::TextAbstraction::Internal::FontClient* >( handle.GetObjectPtr() );
+      fontClientHandle = Dali::TextAbstraction::FontClient( impl );
+    }
+    else // create and register the object
+    {
+      fontClientHandle = Dali::TextAbstraction::FontClient( new FontClient );
+      service.Register( typeid( fontClientHandle ), fontClientHandle );
+    }
+  }
+
+  return fontClientHandle;
+}
+
+void FontClient::SetDpi( unsigned int horizontalDpi, unsigned int verticalDpi  )
+{
+  mDpiHorizontal = horizontalDpi;
+  mDpiVertical = verticalDpi;
+
+  // Allow DPI to be set without loading plugin
+  if( mPlugin )
+  {
+    mPlugin->SetDpi( horizontalDpi, verticalDpi  );
+  }
+}
+
+void FontClient::SetDefaultFontFamily( const std::string& fontFamilyName,
+                                       const std::string& fontStyle )
+{
+  CreatePlugin();
+
+  mPlugin->SetDefaultFontFamily( fontFamilyName, fontStyle );
+}
+
+void FontClient::GetDefaultFonts( FontList& defaultFonts )
+{
+  CreatePlugin();
+
+  mPlugin->GetDefaultFonts( defaultFonts );
+}
+
+void FontClient::GetDescription( FontId id, FontDescription& fontDescription )
+{
+  CreatePlugin();
+
+  mPlugin->GetDescription( id, fontDescription );
+}
+
+PointSize26Dot6 FontClient::GetPointSize( FontId id )
+{
+  CreatePlugin();
+
+  return mPlugin->GetPointSize( id );
+}
+
+void FontClient::GetSystemFonts( FontList& systemFonts )
+{
+  CreatePlugin();
+
+  mPlugin->GetSystemFonts( systemFonts );
+}
+
+FontId FontClient::FindDefaultFont( Character charcode, PointSize26Dot6 pointSize )
+{
+  CreatePlugin();
+
+  return mPlugin->FindDefaultFont( charcode, pointSize );
+}
+
+FontId FontClient::GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex )
+{
+  CreatePlugin();
+
+  return mPlugin->GetFontId( path, pointSize, faceIndex );
+}
+
+FontId FontClient::GetFontId( const FontFamily& fontFamily,
+                              const FontStyle& fontStyle,
+                              PointSize26Dot6 pointSize,
+                              FaceIndex faceIndex )
+{
+  CreatePlugin();
+
+  return mPlugin->GetFontId( fontFamily,
+                             fontStyle,
+                             pointSize,
+                             faceIndex );
+}
+
+void FontClient::GetFontMetrics( FontId fontId, FontMetrics& metrics )
+{
+  CreatePlugin();
+
+  return mPlugin->GetFontMetrics( fontId, metrics );
+}
+
+GlyphIndex FontClient::GetGlyphIndex( FontId fontId, Character charcode )
+{
+  CreatePlugin();
+
+  return mPlugin->GetGlyphIndex( fontId, charcode );
+}
+
+bool FontClient::GetGlyphMetrics( GlyphInfo* array, uint32_t size, bool horizontal )
+{
+  CreatePlugin();
+
+  return mPlugin->GetGlyphMetrics( array, size, horizontal );
+}
+
+BitmapImage FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex )
+{
+  CreatePlugin();
+
+  return mPlugin->CreateBitmap( fontId, glyphIndex );
+}
+
+void FontClient::CreatePlugin()
+{
+  if( !mPlugin )
+  {
+    mPlugin = new Plugin( mDpiHorizontal, mDpiVertical );
+  }
+}
+
+} // namespace Internal
+
+} // namespace TextAbstraction
+
+} // namespace Dali
diff --git a/text/dali/internal/text-abstraction/font-client-impl.h b/text/dali/internal/text-abstraction/font-client-impl.h
new file mode 100644 (file)
index 0000000..8965607
--- /dev/null
@@ -0,0 +1,171 @@
+#ifndef __DALI_INTERNAL_TEXT_ABSTRACTION_FONT_CLIENT_IMPL_H__
+#define __DALI_INTERNAL_TEXT_ABSTRACTION_FONT_CLIENT_IMPL_H__
+
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/base-object.h>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/text-abstraction/font-client.h>
+
+namespace Dali
+{
+
+namespace TextAbstraction
+{
+
+namespace Internal
+{
+
+/**
+ * Implementation of the FontClient
+ */
+class FontClient : public BaseObject
+{
+public:
+
+  /**
+   * Constructor
+   */
+  FontClient();
+
+  /**
+   * Destructor
+   */
+  ~FontClient();
+
+  /**
+   * @copydoc Dali::FontClient::Get()
+   */
+  static Dali::TextAbstraction::FontClient Get();
+
+  /**
+   * @copydoc Dali::FontClient::SetDpi()
+   */
+  void SetDpi( unsigned int horizontalDpi, unsigned int verticalDpi );
+
+  /**
+   * @copydoc Dali::FontClient::SetDefaultFontFamily()
+   */
+  void SetDefaultFontFamily( const std::string& fontFamilyName,
+                             const std::string& fontStyle );
+
+  /**
+   * @copydoc Dali::FontClient::GetDefaultFonts()
+   */
+  void GetDefaultFonts( FontList& defaultFonts );
+
+  /**
+   * @copydoc Dali::FontClient::GetSystemFonts()
+   */
+  void GetSystemFonts( FontList& systemFonts );
+
+  /**
+   * @copydoc Dali::FontClient::GetDescription()
+   */
+  void GetDescription( FontId id, FontDescription& fontDescription );
+
+  /**
+   * @copydoc Dali::FontClient::GetPointSize()
+   */
+  PointSize26Dot6 GetPointSize( FontId id );
+
+  /**
+   * @copydoc Dali::FontClient::FindDefaultFont()
+   */
+  FontId FindDefaultFont( Character charcode, PointSize26Dot6 pointSize );
+
+  /**
+   * @copydoc Dali::FontClient::GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex )
+   */
+  FontId GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex );
+
+  /**
+   * @copydoc Dali::FontClient::GetFontId(const FontFamily& fontFamily, const FontStyle& fontStyle, PointSize26Dot6 pointSize, FaceIndex faceIndex )
+   */
+  FontId GetFontId( const FontFamily& fontFamily,
+                    const FontStyle& fontStyle,
+                    PointSize26Dot6 pointSize,
+                    FaceIndex faceIndex );
+
+  /**
+   * @copydoc Dali::FontClient::GetFontMetrics()
+   */
+  void GetFontMetrics( FontId fontId, FontMetrics& metrics );
+
+  /**
+   * @copydoc Dali::FontClient::GetGlyphIndex()
+   */
+  GlyphIndex GetGlyphIndex( FontId fontId, Character charcode );
+
+  /**
+   * @copydoc Dali::FontClient::CreateMetrics()
+   */
+  bool GetGlyphMetrics( GlyphInfo* array, uint32_t size, bool horizontal );
+
+  /**
+   * @copydoc Dali::FontClient::CreateBitmap()
+   */
+  BitmapImage CreateBitmap( FontId fontId, GlyphIndex glyphIndex );
+
+private:
+
+  /**
+   * Helper for lazy initialization.
+   */
+  void CreatePlugin();
+
+  // Undefined copy constructor.
+  FontClient( const FontClient& );
+
+  // Undefined assignment constructor.
+  FontClient& operator=( FontClient& );
+
+private:
+
+  struct Plugin;
+  Plugin* mPlugin;
+
+  // Allows DPI to be set without loading plugin
+  unsigned int mDpiHorizontal;
+  unsigned int mDpiVertical;
+
+}; // class FontClient
+
+} // namespace Internal
+
+inline static Internal::FontClient& GetImplementation(FontClient& fontClient)
+{
+  DALI_ASSERT_ALWAYS( fontClient && "fontClient handle is empty" );
+  BaseObject& handle = fontClient.GetBaseObject();
+  return static_cast<Internal::FontClient&>(handle);
+}
+
+inline static const Internal::FontClient& GetImplementation(const FontClient& fontClient)
+{
+  DALI_ASSERT_ALWAYS( fontClient && "fontClient handle is empty" );
+  const BaseObject& handle = fontClient.GetBaseObject();
+  return static_cast<const Internal::FontClient&>(handle);
+}
+
+} // namespace TextAbstraction
+
+} // namespace Dali
+
+#endif // __DALI_INTERNAL_TEXT_ABSTRACTION_FONT_CLIENT_IMPL_H__
diff --git a/text/dali/internal/text-abstraction/font-client-plugin-impl.cpp b/text/dali/internal/text-abstraction/font-client-plugin-impl.cpp
new file mode 100644 (file)
index 0000000..0f1598f
--- /dev/null
@@ -0,0 +1,762 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/text-abstraction/font-client-plugin-impl.h>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/text-abstraction/glyph-info.h>
+#include <dali/integration-api/debug.h>
+
+// EXTERNAL INCLUDES
+#include <fontconfig/fontconfig.h>
+
+/**
+ * Conversion from Fractional26.6 to float
+ */
+namespace
+{
+const float FROM_266 = 1.0f / 64.0f;
+
+const std::string FONT_FORMAT( "TrueType" );
+const std::string DEFAULT_FONT_FAMILY_NAME( "Tizen" );
+const std::string DEFAULT_FONT_STYLE( "Regular" );
+}
+
+namespace Dali
+{
+
+namespace TextAbstraction
+{
+
+namespace Internal
+{
+
+FontClient::Plugin::FontDescriptionCacheItem::FontDescriptionCacheItem( const FontFamily& fontFamily,
+                                                                        const FontStyle& fontStyle,
+                                                                        FontDescriptionId index )
+: fontFamily( fontFamily ),
+  fontStyle( fontStyle ),
+  index( index )
+{}
+
+FontClient::Plugin::FontIdCacheItem::FontIdCacheItem( FontDescriptionId validatedFontId,
+                                                      PointSize26Dot6 pointSize,
+                                                      FontId fontId )
+: validatedFontId( validatedFontId ),
+  pointSize( pointSize ),
+  fontId( fontId )
+{}
+
+FontClient::Plugin::CacheItem::CacheItem( FT_Face ftFace,
+                                          const FontPath& path,
+                                          PointSize26Dot6 pointSize,
+                                          FaceIndex face,
+                                          const FontMetrics& metrics )
+: mFreeTypeFace( ftFace ),
+  mPath( path ),
+  mPointSize( pointSize ),
+  mFaceIndex( face ),
+  mMetrics( metrics )
+{}
+
+FontClient::Plugin::Plugin( unsigned int horizontalDpi,
+                            unsigned int verticalDpi )
+: mFreeTypeLibrary( NULL ),
+  mDpiHorizontal( horizontalDpi ),
+  mDpiVertical( verticalDpi ),
+  mSystemFonts(),
+  mDefaultFonts(),
+  mFontCache(),
+  mValidatedFontCache(),
+  mFontDescriptionCache( 1u ),
+  mFontIdCache()
+{
+  int error = FT_Init_FreeType( &mFreeTypeLibrary );
+  if( FT_Err_Ok != error )
+  {
+    DALI_LOG_ERROR( "FreeType Init error: %d\n", error );
+  }
+}
+
+FontClient::Plugin::~Plugin()
+{
+  FT_Done_FreeType( mFreeTypeLibrary );
+}
+
+void FontClient::Plugin::SetDpi( unsigned int horizontalDpi,
+                                 unsigned int verticalDpi )
+{
+  mDpiHorizontal = horizontalDpi;
+  mDpiVertical = verticalDpi;
+}
+
+void FontClient::Plugin::SetDefaultFontFamily( const FontFamily& fontFamilyName,
+                                               const FontStyle& fontStyle )
+{
+  mDefaultFonts.clear();
+
+  FcPattern* fontFamilyPattern = CreateFontFamilyPattern( fontFamilyName,
+                                                          fontStyle );
+
+  FcResult result = FcResultMatch;
+
+  // Match the pattern.
+  FcFontSet* fontSet = FcFontSort( NULL /* use default configure */,
+                                   fontFamilyPattern,
+                                   false /* don't trim */,
+                                   NULL,
+                                   &result );
+
+  if( NULL != fontSet )
+  {
+    // Reserve some space to avoid reallocations.
+    mDefaultFonts.reserve( fontSet->nfont );
+
+    for( int i = 0u; i < fontSet->nfont; ++i )
+    {
+      FcPattern* fontPattern = fontSet->fonts[i];
+
+      FontPath path;
+
+      // Skip fonts with no path
+      if( GetFcString( fontPattern, FC_FILE, path ) )
+      {
+        mDefaultFonts.push_back( FontDescription() );
+        FontDescription& fontDescription = mDefaultFonts.back();
+
+        fontDescription.path = path;
+
+        GetFcString( fontPattern, FC_FAMILY, fontDescription.family );
+        GetFcString( fontPattern, FC_STYLE, fontDescription.style );
+      }
+    }
+
+    FcFontSetDestroy( fontSet );
+  }
+
+  FcPatternDestroy( fontFamilyPattern );
+}
+
+void FontClient::Plugin::GetDefaultFonts( FontList& defaultFonts )
+{
+  if( mDefaultFonts.empty() )
+  {
+    SetDefaultFontFamily( DEFAULT_FONT_FAMILY_NAME,
+                          DEFAULT_FONT_STYLE );
+  }
+
+  defaultFonts = mDefaultFonts;
+}
+
+void FontClient::Plugin::GetSystemFonts( FontList& systemFonts )
+{
+  if( mSystemFonts.empty() )
+  {
+    InitSystemFonts();
+  }
+
+  systemFonts = mSystemFonts;
+}
+
+void FontClient::Plugin::GetDescription( FontId id,
+                                         FontDescription& fontDescription ) const
+{
+  for( std::vector<FontIdCacheItem>::const_iterator it = mFontIdCache.begin(),
+         endIt = mFontIdCache.end();
+       it != endIt;
+       ++it )
+  {
+    const FontIdCacheItem& item = *it;
+
+    if( item.fontId == id )
+    {
+      fontDescription = *( mFontDescriptionCache.begin() + item.validatedFontId );
+      return;
+    }
+  }
+
+  DALI_LOG_ERROR( "FontClient::Plugin::GetDescription. No description found for the font ID %d\n", id );
+}
+
+PointSize26Dot6 FontClient::Plugin::GetPointSize( FontId id )
+{
+  const FontId index = id - 1u;
+
+  if( id > 0u &&
+      index < mFontCache.size() )
+  {
+    return ( *( mFontCache.begin() + index ) ).mPointSize;
+  }
+  else
+  {
+    DALI_LOG_ERROR( "FontClient::Plugin::GetPointSize. Invalid font ID %d\n", id );
+  }
+
+  return TextAbstraction::FontClient::DEFAULT_POINT_SIZE;
+}
+
+FontId FontClient::Plugin::FindDefaultFont( Character charcode,
+                                            PointSize26Dot6 pointSize )
+{
+  // Create the list of default fonts if it has not been created.
+  if( mDefaultFonts.empty() )
+  {
+    SetDefaultFontFamily( DEFAULT_FONT_FAMILY_NAME,
+                          DEFAULT_FONT_STYLE );
+  }
+
+  // Traverse the list of default fonts.
+  // Check for each default font if supports the character.
+
+  for( FontList::const_iterator it = mDefaultFonts.begin(),
+         endIt = mDefaultFonts.end();
+       it != endIt;
+       ++it )
+  {
+    const FontDescription& description = *it;
+
+    FcPattern* pattern = CreateFontFamilyPattern( description.family,
+                                                  description.style );
+
+    FcResult result = FcResultMatch;
+    FcPattern* match = FcFontMatch( NULL /* use default configure */, pattern, &result );
+
+    FcCharSet* charSet = NULL;
+    FcPatternGetCharSet( match, FC_CHARSET, 0u, &charSet );
+
+    if( FcCharSetHasChar( charSet, charcode ) )
+    {
+      return GetFontId( description.family,
+                        description.style,
+                        pointSize,
+                        0u );
+    }
+  }
+
+  return 0u;
+}
+
+FontId FontClient::Plugin::GetFontId( const FontPath& path,
+                                      PointSize26Dot6 pointSize,
+                                      FaceIndex faceIndex,
+                                      bool cacheDescription )
+{
+  FontId id( 0 );
+
+  if( NULL != mFreeTypeLibrary )
+  {
+    FontId foundId(0);
+    if( FindFont( path, pointSize, faceIndex, foundId ) )
+    {
+      id = foundId;
+    }
+    else
+    {
+      id = CreateFont( path, pointSize, faceIndex, cacheDescription );
+    }
+  }
+
+  return id;
+}
+
+FontId FontClient::Plugin::GetFontId( const FontFamily& fontFamily,
+                                      const FontStyle& fontStyle,
+                                      PointSize26Dot6 pointSize,
+                                      FaceIndex faceIndex )
+{
+  // This method uses three vectors which caches:
+  // * Pairs of non validated 'fontFamily, fontStyle' and an index to a vector with paths to font file names.
+  // * The path to font file names.
+  // * The font ids of pairs 'font point size, index to the vector with paths to font file names'.
+
+  // 1) Checks in the cache if the pair 'fontFamily, fontStyle' has been validated before.
+  //    If it was it gets an index to the vector with paths to font file names. Otherwise,
+  //    retrieves using font config a path to a font file name which matches with the pair
+  //    'fontFamily, fontStyle'. The path is stored in the chache.
+  //
+  // 2) Checks in the cache if the pair 'font point size, index to the vector with paths to
+  //    fon file names' exists. If exists, it gets the font id. If it doesn't it calls
+  //    the GetFontId() method with the path to the font file name and the point size to
+  //    get the font id.
+
+  // The font id to be returned.
+  FontId fontId = 0u;
+
+  // Check first if the pair font family and style have been validated before.
+  FontDescriptionId validatedFontId = 0u;
+
+  if( !FindValidatedFont( fontFamily,
+                          fontStyle,
+                          validatedFontId ) )
+  {
+    // Use font config to validate the font family name and font style.
+
+    // Create a font pattern.
+    FcPattern* fontFamilyPattern = CreateFontFamilyPattern( fontFamily,
+                                                            fontStyle );
+
+    FcResult result = FcResultMatch;
+
+    // match the pattern
+    FcPattern* match = FcFontMatch( NULL /* use default configure */, fontFamilyPattern, &result );
+
+    if( match )
+    {
+      // Get the path to the font file name.
+      FontDescription description;
+      GetFcString( match, FC_FILE, description.path );
+      GetFcString( match, FC_FAMILY, description.family );
+      GetFcString( match, FC_STYLE, description.style );
+
+      // Set the index to the vector of paths to font file names.
+      validatedFontId = mFontDescriptionCache.size();
+
+      // Add the path to the cache.
+      mFontDescriptionCache.push_back( description );
+
+      // Cache the index and the pair font family name, font style.
+      FontDescriptionCacheItem item( fontFamily, fontStyle, validatedFontId );
+      mValidatedFontCache.push_back( item );
+
+      // destroyed the matched pattern
+      FcPatternDestroy( match );
+    }
+    else
+    {
+      DALI_LOG_ERROR( "FontClient::Plugin::GetFontId failed for font %s %s\n", fontFamily.c_str(), fontStyle.c_str() );
+    }
+
+    // destroy the pattern
+    FcPatternDestroy( fontFamilyPattern );
+  }
+
+  // Check if exists a pair 'validatedFontId, pointSize' in the cache.
+  if( !FindFont( validatedFontId, pointSize, fontId ) )
+  {
+    // Retrieve the font file name path.
+    const FontDescription& description = *( mFontDescriptionCache.begin() + validatedFontId );
+
+    // Retrieve the font id. Do not cache the description as it has been already cached.
+    fontId = GetFontId( description.path,
+                        pointSize,
+                        faceIndex,
+                        false );
+
+    // Cache the pair 'validatedFontId, pointSize' to improve the following queries.
+    mFontIdCache.push_back( FontIdCacheItem( validatedFontId,
+                                             pointSize,
+                                             fontId ) );
+  }
+
+  return fontId;
+}
+
+void FontClient::Plugin::GetFontMetrics( FontId fontId,
+                                         FontMetrics& metrics )
+{
+  if( fontId > 0 &&
+      fontId-1 < mFontCache.size() )
+  {
+    metrics = mFontCache[fontId-1].mMetrics;
+  }
+  else
+  {
+    DALI_LOG_ERROR( "Invalid font ID %d\n", fontId );
+  }
+}
+
+GlyphIndex FontClient::Plugin::GetGlyphIndex( FontId fontId,
+                                              Character charcode )
+{
+  GlyphIndex index( 0 );
+
+  if( fontId > 0 &&
+      fontId-1 < mFontCache.size() )
+  {
+    FT_Face ftFace = mFontCache[fontId-1].mFreeTypeFace;
+
+    index = FT_Get_Char_Index( ftFace, charcode );
+  }
+
+  return index;
+}
+
+bool FontClient::Plugin::GetGlyphMetrics( GlyphInfo* array,
+                                          uint32_t size,
+                                          bool horizontal )
+{
+  bool success( true );
+
+  for( unsigned int i=0; i<size; ++i )
+  {
+    FontId fontId = array[i].fontId;
+
+    if( fontId > 0 &&
+        fontId-1 < mFontCache.size() )
+    {
+      FT_Face ftFace = mFontCache[fontId-1].mFreeTypeFace;
+
+      int error = FT_Load_Glyph( ftFace, array[i].index, FT_LOAD_DEFAULT );
+
+      if( FT_Err_Ok == error )
+      {
+        array[i].width  = static_cast< float >( ftFace->glyph->metrics.width ) * FROM_266;
+        array[i].height = static_cast< float >( ftFace->glyph->metrics.height ) * FROM_266 ;
+        if( horizontal )
+        {
+          array[i].xBearing = static_cast< float >( ftFace->glyph->metrics.horiBearingX ) * FROM_266;
+          array[i].yBearing = static_cast< float >( ftFace->glyph->metrics.horiBearingY ) * FROM_266;
+          array[i].advance  = static_cast< float >( ftFace->glyph->metrics.horiAdvance ) * FROM_266;
+        }
+        else
+        {
+          array[i].xBearing = static_cast< float >( ftFace->glyph->metrics.vertBearingX ) * FROM_266;
+          array[i].yBearing = static_cast< float >( ftFace->glyph->metrics.vertBearingY ) * FROM_266;
+          array[i].advance  = static_cast< float >( ftFace->glyph->metrics.vertAdvance ) * FROM_266;
+        }
+      }
+      else
+      {
+        success = false;
+      }
+    }
+    else
+    {
+      success = false;
+    }
+  }
+
+  return success;
+}
+
+BitmapImage FontClient::Plugin::CreateBitmap( FontId fontId,
+                                              GlyphIndex glyphIndex )
+{
+  BitmapImage bitmap;
+
+  if( fontId > 0 &&
+      fontId-1 < mFontCache.size() )
+  {
+    FT_Face ftFace = mFontCache[fontId-1].mFreeTypeFace;
+
+    FT_Error error = FT_Load_Glyph( ftFace, glyphIndex, FT_LOAD_DEFAULT );
+    if( FT_Err_Ok == error )
+    {
+      FT_Glyph glyph;
+      error = FT_Get_Glyph( ftFace->glyph, &glyph );
+
+      // Convert to bitmap if necessary
+      if ( FT_Err_Ok == error )
+      {
+        if( glyph->format != FT_GLYPH_FORMAT_BITMAP )
+        {
+          error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL, 0, 1 );
+        }
+        else
+        {
+          DALI_LOG_ERROR( "FT_Glyph_To_Bitmap Failed with error: %d\n", error );
+        }
+      }
+      else
+      {
+        DALI_LOG_ERROR( "FT_Get_Glyph Failed with error: %d\n", error );
+      }
+
+      if( FT_Err_Ok == error )
+      {
+        // Access the underlying bitmap data
+        FT_BitmapGlyph bitmapGlyph = (FT_BitmapGlyph)glyph;
+        ConvertBitmap( bitmap, bitmapGlyph->bitmap );
+      }
+
+      // Created FT_Glyph object must be released with FT_Done_Glyph
+      FT_Done_Glyph( glyph );
+    }
+    else
+    {
+      DALI_LOG_ERROR( "FT_Load_Glyph Failed with error: %d\n", error );
+    }
+  }
+
+  return bitmap;
+}
+
+void FontClient::Plugin::InitSystemFonts()
+{
+  FcFontSet* fontSet = GetFcFontSet();
+
+  if( fontSet )
+  {
+    // Reserve some space to avoid reallocations.
+    mSystemFonts.reserve( fontSet->nfont );
+
+    for( int i = 0u; i < fontSet->nfont; ++i )
+    {
+      FcPattern* fontPattern = fontSet->fonts[i];
+
+      FontPath path;
+
+      // Skip fonts with no path
+      if( GetFcString( fontPattern, FC_FILE, path ) )
+      {
+        mSystemFonts.push_back( FontDescription() );
+        FontDescription& fontDescription = mSystemFonts.back();
+
+        fontDescription.path = path;
+
+        GetFcString( fontPattern, FC_FAMILY, fontDescription.family );
+        GetFcString( fontPattern, FC_STYLE, fontDescription.style );
+      }
+    }
+
+    FcFontSetDestroy( fontSet );
+  }
+}
+
+FcPattern* FontClient::Plugin::CreateFontFamilyPattern( const FontFamily& fontFamily,
+                                                        const FontStyle& fontStyle )
+{
+  // create the cached font family lookup pattern
+  // a pattern holds a set of names, each name refers to a property of the font
+  FcPattern* fontFamilyPattern = FcPatternCreate();
+
+  // add a property to the pattern for the font family
+  FcPatternAddString( fontFamilyPattern, FC_FAMILY, reinterpret_cast<const FcChar8*>( fontFamily.c_str() ) );
+
+  // add a property to the pattern for the font family
+  FcPatternAddString( fontFamilyPattern, FC_STYLE, reinterpret_cast<const FcChar8*>( fontStyle.c_str() ) );
+
+  // Add a property of the pattern, to say we want to match TrueType fonts
+  FcPatternAddString( fontFamilyPattern , FC_FONTFORMAT, reinterpret_cast<const FcChar8*>( FONT_FORMAT.c_str() ) );
+
+  // modify the config, with the mFontFamilyPatterm
+  FcConfigSubstitute( NULL /* use default configure */, fontFamilyPattern, FcMatchPattern );
+
+  // provide default values for unspecified properties in the font pattern
+  // e.g. patterns without a specified style or weight are set to Medium
+  FcDefaultSubstitute( fontFamilyPattern );
+
+  return fontFamilyPattern;
+}
+
+_FcFontSet* FontClient::Plugin::GetFcFontSet() const
+{
+  // create a new pattern.
+  // a pattern holds a set of names, each name refers to a property of the font
+  FcPattern* pattern = FcPatternCreate();
+
+  // create an object set used to define which properties are to be returned in the patterns from FcFontList.
+  FcObjectSet* objectSet = FcObjectSetCreate();
+
+  // build an object set from a list of property names
+  FcObjectSetAdd( objectSet, FC_FILE );
+  FcObjectSetAdd( objectSet, FC_FAMILY );
+  FcObjectSetAdd( objectSet, FC_STYLE );
+
+  // get a list of fonts
+  // creates patterns from those fonts containing only the objects in objectSet and returns the set of unique such patterns
+  FcFontSet* fontset = FcFontList( NULL /* the default configuration is checked to be up to date, and used */, pattern, objectSet );
+
+  // clear up the object set
+  if( objectSet )
+  {
+    FcObjectSetDestroy( objectSet );
+  }
+  // clear up the pattern
+  if( pattern )
+  {
+    FcPatternDestroy( pattern );
+  }
+
+  return fontset;
+}
+
+bool FontClient::Plugin::GetFcString( const FcPattern* const pattern,
+                                      const char* const n,
+                                      std::string& string )
+{
+  FcChar8* file = NULL;
+  const FcResult retVal = FcPatternGetString( pattern, n, 0u, &file );
+
+  if( FcResultMatch == retVal )
+  {
+    // Have to use reinterpret_cast because FcChar8 is unsigned char*, not a const char*.
+    string.assign( reinterpret_cast<const char*>( file ) );
+
+    return true;
+  }
+
+  return false;
+}
+
+FontId FontClient::Plugin::CreateFont( const FontPath& path,
+                                       PointSize26Dot6 pointSize,
+                                       FaceIndex faceIndex,
+                                       bool cacheDescription )
+{
+  FontId id( 0 );
+
+  // Create & cache new font face
+  FT_Face ftFace;
+  int error = FT_New_Face( mFreeTypeLibrary,
+                           path.c_str(),
+                           0,
+                           &ftFace );
+
+  if( FT_Err_Ok == error )
+  {
+    error = FT_Set_Char_Size( ftFace,
+                              0,
+                              pointSize,
+                              mDpiHorizontal,
+                              mDpiVertical );
+
+    if( FT_Err_Ok == error )
+    {
+      id = mFontCache.size() + 1;
+
+      FT_Size_Metrics& ftMetrics = ftFace->size->metrics;
+
+      FontMetrics metrics( static_cast< float >( ftMetrics.ascender  ) * FROM_266,
+                           static_cast< float >( ftMetrics.descender ) * FROM_266,
+                           static_cast< float >( ftMetrics.height    ) * FROM_266 );
+
+      mFontCache.push_back( CacheItem( ftFace, path, pointSize, faceIndex, metrics ) );
+
+      if( cacheDescription )
+      {
+        FontDescription description;
+        description.path = path;
+        description.family = FontFamily( ftFace->family_name );
+        description.style = FontStyle( ftFace->style_name );
+
+        mFontDescriptionCache.push_back( description );
+      }
+    }
+    else
+    {
+      DALI_LOG_ERROR( "FreeType Set_Char_Size error: %d for pointSize %d\n", pointSize );
+    }
+  }
+  else
+  {
+    DALI_LOG_ERROR( "FreeType New_Face error: %d for %s\n", error, path.c_str() );
+  }
+
+  return id;
+}
+
+void FontClient::Plugin::ConvertBitmap( BitmapImage& destBitmap,
+                                        FT_Bitmap srcBitmap )
+{
+  if( srcBitmap.width*srcBitmap.rows > 0 )
+  {
+    // TODO - Support all pixel modes
+    if( FT_PIXEL_MODE_GRAY == srcBitmap.pixel_mode )
+    {
+      if( srcBitmap.pitch == srcBitmap.width )
+      {
+        destBitmap = BitmapImage::New( srcBitmap.width, srcBitmap.rows, Pixel::L8 );
+
+        PixelBuffer* destBuffer = destBitmap.GetBuffer();
+        memcpy( destBuffer, srcBitmap.buffer, srcBitmap.width*srcBitmap.rows );
+      }
+    }
+  }
+}
+
+bool FontClient::Plugin::FindFont( const FontPath& path,
+                                   PointSize26Dot6 pointSize,
+                                   FaceIndex faceIndex,
+                                   FontId& fontId ) const
+{
+  fontId = 0u;
+  for( std::vector<CacheItem>::const_iterator it = mFontCache.begin(),
+         endIt = mFontCache.end();
+       it != endIt;
+       ++it, ++fontId )
+  {
+    const CacheItem& cacheItem = *it;
+
+    if( cacheItem.mPointSize == pointSize &&
+        cacheItem.mFaceIndex == faceIndex &&
+        cacheItem.mPath == path )
+    {
+      ++fontId;
+      return true;
+    }
+  }
+
+  return false;
+}
+
+bool FontClient::Plugin::FindValidatedFont( const FontFamily& fontFamily,
+                                            const FontStyle& fontStyle,
+                                            FontDescriptionId& validatedFontId )
+{
+  validatedFontId = 0u;
+
+  for( std::vector<FontDescriptionCacheItem>::const_iterator it = mValidatedFontCache.begin(),
+         endIt = mValidatedFontCache.end();
+       it != endIt;
+       ++it )
+  {
+    const FontDescriptionCacheItem& item = *it;
+
+    if( ( fontFamily == item.fontFamily ) &&
+        ( fontStyle == item.fontStyle ) )
+    {
+      validatedFontId = item.index;
+
+      return true;
+    }
+  }
+
+  return false;
+}
+
+bool FontClient::Plugin::FindFont( FontDescriptionId validatedFontId,
+                                   PointSize26Dot6 pointSize,
+                                   FontId& fontId )
+{
+  fontId = 0u;
+
+  for( std::vector<FontIdCacheItem>::const_iterator it = mFontIdCache.begin(),
+         endIt = mFontIdCache.end();
+       it != endIt;
+       ++it )
+  {
+    const FontIdCacheItem& item = *it;
+
+    if( ( validatedFontId == item.validatedFontId ) &&
+        ( pointSize == item.pointSize ) )
+    {
+      fontId = item.fontId;
+      return true;
+    }
+  }
+
+  return false;
+}
+
+} // namespace Internal
+
+} // namespace TextAbstraction
+
+} // namespace Dali
diff --git a/text/dali/internal/text-abstraction/font-client-plugin-impl.h b/text/dali/internal/text-abstraction/font-client-plugin-impl.h
new file mode 100644 (file)
index 0000000..e4995a7
--- /dev/null
@@ -0,0 +1,306 @@
+#ifndef __DALI_INTERNAL_TEXT_ABSTRACTION_FONT_CLIENT_PLUGIN_IMPL_H__
+#define __DALI_INTERNAL_TEXT_ABSTRACTION_FONT_CLIENT_PLUGIN_IMPL_H__
+
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/text-abstraction/font-metrics.h>
+#include <dali/internal/text-abstraction/font-client-impl.h>
+
+// EXTERNAL INCLUDES
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_GLYPH_H
+
+// forward declarations of font config types.
+struct _FcFontSet;
+struct _FcPattern;
+
+namespace Dali
+{
+
+namespace TextAbstraction
+{
+
+namespace Internal
+{
+
+/**
+ *@brief Type used for indices addressing the vector with front descriptions of validated pairs 'font family name, font style'.
+ */
+typedef uint32_t FontDescriptionId;
+
+/**
+ * @brief FontClient implementation.
+ */
+struct FontClient::Plugin
+{
+  /**
+   * @brief Caches an index to the vector of font descriptions for a given 'font family name, font style'.
+   */
+  struct FontDescriptionCacheItem
+  {
+    FontDescriptionCacheItem( const FontFamily& fontFamily,
+                              const FontStyle& fontStyle,
+                              FontDescriptionId index );
+
+    FontFamily        fontFamily; ///< The font family name.
+    FontStyle         fontStyle;  ///< The font style.
+    FontDescriptionId index;      ///< Index to the vector of font descriptions.
+  };
+
+  /**
+   * @brief Caches the font id of the pair font point size and the index to the vector of font descriptions of validated fonts.
+   */
+  struct FontIdCacheItem
+  {
+    FontIdCacheItem( FontDescriptionId validatedFontId,
+                     PointSize26Dot6 pointSize,
+                     FontId fontId );
+
+    FontDescriptionId validatedFontId; ///< Index to the vector with font descriptions.
+    PointSize26Dot6   pointSize;       ///< The font point size.
+    FontId            fontId;          ///< The font id.
+  };
+
+  /**
+   * @brief Caches the FreeType face and font metrics of the triplet 'path to the font file name, font point size and face index'.
+   */
+  struct CacheItem
+  {
+    CacheItem( FT_Face ftFace,
+               const FontPath& path,
+               PointSize26Dot6 pointSize,
+               FaceIndex face,
+               const FontMetrics& metrics );
+
+    FT_Face mFreeTypeFace;      ///< The FreeType fance.
+    FontPath mPath;             ///< The path to the font file name.
+    PointSize26Dot6 mPointSize; ///< The font point size.
+    FaceIndex mFaceIndex;       ///< The face index.
+    FontMetrics mMetrics;       ///< The font metrics.
+  };
+
+  /**
+   * Constructor.
+   *
+   * Initializes the FreeType library.
+   * Initializes the dpi values.
+   *
+   * @param[in] horizontalDpi The horizontal dpi.
+   * @param[in] verticalDpi The vertical dpi.
+   */
+  Plugin( unsigned int horizontalDpi, unsigned int verticalDpi );
+
+  /**
+   * Default destructor.
+   *
+   * Frees any allocated resource.
+   */
+  ~Plugin();
+
+  /**
+   * @copydoc Dali::FontClient::SetDpi()
+   */
+  void SetDpi( unsigned int horizontalDpi, unsigned int verticalDpi );
+
+  /**
+   * @copydoc Dali::FontClient::SetDefaultFontFamily()
+   */
+  void SetDefaultFontFamily( const FontFamily& fontFamilyName,
+                             const FontStyle& fontStyle );
+
+  /**
+   * @copydoc Dali::FontClient::GetDefaultFonts()
+   */
+  void GetDefaultFonts( FontList& defaultFonts );
+
+  /**
+   * @copydoc Dali::FontClient::GetSystemFonts()
+   */
+  void GetSystemFonts( FontList& systemFonts );
+
+  /**
+   * @copydoc Dali::FontClient::GetDescription()
+   */
+  void GetDescription( FontId id, FontDescription& fontDescription ) const;
+
+  /**
+   * @copydoc Dali::FontClient::GetPointSize()
+   */
+  PointSize26Dot6 GetPointSize( FontId id );
+
+  /**
+   * @copydoc Dali::FontClient::FindDefaultFont()
+   */
+  FontId FindDefaultFont( Character charcode, PointSize26Dot6 pointSize );
+
+  /**
+   * @see Dali::FontClient::GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex )
+   *
+   * @param[in] cacheDescription Whether to cache the font description.
+   */
+  FontId GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex, bool cacheDescription = true );
+
+  /**
+   * @copydoc Dali::FontClient::GetFontId(const FontFamily& fontFamily, const FontStyle& fontStyle, PointSize26Dot6 pointSize, FaceIndex faceIndex )
+   */
+  FontId GetFontId( const FontFamily& fontFamily,
+                    const FontStyle& fontStyle,
+                    PointSize26Dot6 pointSize,
+                    FaceIndex faceIndex );
+
+  /**
+   * @copydoc Dali::FontClient::GetFontMetrics()
+   */
+  void GetFontMetrics( FontId fontId, FontMetrics& metrics );
+
+  /**
+   * @copydoc Dali::FontClient::GetGlyphIndex()
+   */
+  GlyphIndex GetGlyphIndex( FontId fontId, Character charcode );
+
+  /**
+   * @copydoc Dali::FontClient::CreateMetrics()
+   */
+  bool GetGlyphMetrics( GlyphInfo* array, uint32_t size, bool horizontal );
+
+  /**
+   * @copydoc Dali::FontClient::CreateBitmap()
+   */
+  BitmapImage CreateBitmap( FontId fontId, GlyphIndex glyphIndex );
+
+private:
+
+  /**
+   * Caches the fonts present in the platform.
+   *
+   * Calls GetFcFontSet() to retrieve the fonts.
+   */
+  void InitSystemFonts();
+
+  /**
+   * @brief Creates a font family pattern used to match fonts.
+   *
+   * @param[in] fontFamily The font family name.
+   * @param[in] fontStyle The font style.
+   *
+   * @return The pattern.
+   */
+  _FcPattern* CreateFontFamilyPattern( const FontFamily& fontFamily,
+                                       const FontStyle& fontStyle );
+
+  /**
+   * Retrieves the fonts present in the platform.
+   *
+   * @return A font fonfig data structure with the platform's fonts.
+   */
+  _FcFontSet* GetFcFontSet() const;
+
+  /**
+   * Retrieves a font config object's value from a pattern.
+   *
+   * @param[in] pattern The font config pattern.
+   * @param[in] n The object.
+   * @param[out] string The object's value.
+   *
+   * @return @e true if the operation is successful.
+   */
+  bool GetFcString( const _FcPattern* const pattern, const char* const n, std::string& string );
+
+  /**
+   * @brief Creates a font.
+   *
+   * @param[in] path The path to the font file name.
+   * @param[in] pointSize The font point size.
+   * @param[in] faceIndex A face index.
+   * @param[in] cacheDescription Whether to cache the font description.
+   *
+   * @return The font id.
+   */
+  FontId CreateFont( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex, bool cacheDescription );
+
+  /**
+   *
+   * @param[in] destBitmap
+   * @param[in] srcBitmap
+   */
+  void ConvertBitmap( BitmapImage& destBitmap, FT_Bitmap srcBitmap );
+
+  /**
+   * @brief Finds in the cache if there is a triplet with the path to the font file name, the font point size and the face index.
+   * If there is one , if writes the font id in the param @p fontId.
+   *
+   * @param[in] path Path to the font file name.
+   * @param[in] pointSize The font point size.
+   * @param[in] faceIndex The face index.
+   * @param[out] fontId The font id.
+   *
+   * @return @e true if there triplet is found.
+   */
+  bool FindFont( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex, FontId& fontId ) const;
+
+  /**
+   * @brief Finds in the cahce a pair 'font family, font style'.
+   * If there is one, it writes the index to the vector with font descriptions in the param @p  validatedFontId.
+   *
+   * @param[in] fontFamily The font family name.
+   * @param[in] fontStyle The font style.
+   * @param[out] validatedFontId The index to the vector with font descriptions.
+   *
+   * @return @e true if the pair is found.
+   */
+  bool FindValidatedFont( const FontFamily& fontFamily,
+                          const FontStyle& fontStyle,
+                          FontDescriptionId& validatedFontId );
+
+  /**
+   * @brief Finds in the cache a pair 'validated font id and font point size'.
+   * If there is one it writes the font id in the param @p fontId.
+   *
+   * @param[in] validatedFontId Index to the vector with font descriptions.
+   * @param[in] pointSize The font point size.
+   * @param[out] fontId The font id.
+   *
+   * @return @e true if the pair is found.
+   */
+  bool FindFont( FontDescriptionId validatedFontId,
+                 PointSize26Dot6 pointSize,
+                 FontId& fontId );
+
+  FT_Library mFreeTypeLibrary; ///< A handle to a FreeType library instance.
+
+  unsigned int mDpiHorizontal; ///< Horizontal dpi.
+  unsigned int mDpiVertical;   ///< Vertical dpi.
+
+  FontList mSystemFonts;       ///< Cached system fonts.
+  FontList mDefaultFonts;      ///< Cached default fonts.
+
+  std::vector<CacheItem>                mFontCache;            ///< Caches the FreeType face and font metrics of the triplet 'path to the font file name, font point size and face index'.
+  std::vector<FontDescriptionCacheItem> mValidatedFontCache;   ///< Caches indices to the vector of font descriptions for a given 'font family name, font style'.
+  FontList                              mFontDescriptionCache; ///< Caches font descriptions for the validated font family name and font style pairs.
+  std::vector<FontIdCacheItem>          mFontIdCache;          ///< Caches font ids for the pairs of font point size and the index to the vector with font descriptions of the validated fonts.
+};
+
+} // namespace Internal
+
+} // namespace TextAbstraction
+
+} // namespace Dali
+
+#endif // __DALI_INTERNAL_TEXT_ABSTRACTION_FONT_CLIENT_PLUGIN_IMPL_H__
diff --git a/text/dali/internal/text-abstraction/segmentation-impl.cpp b/text/dali/internal/text-abstraction/segmentation-impl.cpp
new file mode 100644 (file)
index 0000000..a517a42
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS  HEADER
+#include "segmentation-impl.h"
+
+// INTERNAL INCLUDES
+#include <singleton-service-impl.h>
+
+// EXTERNAL INCLUDES
+#include <linebreak.h>
+#include <wordbreak.h>
+
+namespace Dali
+{
+
+namespace TextAbstraction
+{
+
+namespace Internal
+{
+
+struct Segmentation::Plugin
+{
+  void GetLineBreakPositions( const Character* const text,
+                              Length numberOfCharacters,
+                              LineBreakInfo* breakInfo )
+  {
+    set_linebreaks_utf32( text, numberOfCharacters, NULL, breakInfo );
+  }
+
+  void GetWordBreakPositions( const Character* const text,
+                              Length numberOfCharacters,
+                              WordBreakInfo* breakInfo )
+  {
+    set_wordbreaks_utf32( text, numberOfCharacters, NULL, breakInfo );
+  }
+};
+
+Segmentation::Segmentation()
+: mPlugin( NULL )
+{}
+
+Segmentation::~Segmentation()
+{
+  delete mPlugin;
+}
+
+TextAbstraction::Segmentation Segmentation::Get()
+{
+  TextAbstraction::Segmentation segmentationHandle;
+
+  SingletonService service( SingletonService::Get() );
+  if( service )
+  {
+    // Check whether the singleton is already created
+    Dali::BaseHandle handle = service.GetSingleton( typeid( TextAbstraction::Segmentation ) );
+    if( handle )
+    {
+      // If so, downcast the handle
+      Segmentation* impl = dynamic_cast< Internal::Segmentation* >( handle.GetObjectPtr() );
+      segmentationHandle = TextAbstraction::Segmentation( impl );
+    }
+    else // create and register the object
+    {
+      segmentationHandle = TextAbstraction::Segmentation( new Segmentation );
+      service.Register( typeid( segmentationHandle ), segmentationHandle );
+    }
+  }
+
+  return segmentationHandle;
+}
+
+void Segmentation::GetLineBreakPositions( const Character* const text,
+                                          Length numberOfCharacters,
+                                          LineBreakInfo* breakInfo )
+{
+  CreatePlugin();
+
+  mPlugin->GetLineBreakPositions( text, numberOfCharacters, breakInfo );
+}
+
+void Segmentation::GetWordBreakPositions( const Character* const text,
+                                          Length numberOfCharacters,
+                                          WordBreakInfo* breakInfo )
+{
+  CreatePlugin();
+
+  mPlugin->GetWordBreakPositions( text, numberOfCharacters, breakInfo );
+}
+
+void Segmentation::CreatePlugin()
+{
+  if( !mPlugin )
+  {
+    mPlugin = new Plugin();
+  }
+}
+
+} // namespace Internal
+
+} // namespace TextAbstraction
+
+} // namespace Dali
diff --git a/text/dali/internal/text-abstraction/segmentation-impl.h b/text/dali/internal/text-abstraction/segmentation-impl.h
new file mode 100644 (file)
index 0000000..ca2dc7d
--- /dev/null
@@ -0,0 +1,116 @@
+#ifndef __DALI_INTERNAL_TEXT_ABSTRACTION_SEGMENTATION_IMPL_H__
+#define __DALI_INTERNAL_TEXT_ABSTRACTION_SEGMENTATION_IMPL_H__
+
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/base-object.h>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/text-abstraction/segmentation.h>
+
+namespace Dali
+{
+
+namespace TextAbstraction
+{
+
+namespace Internal
+{
+
+/**
+ * Implementation of the Segmentation
+ */
+
+class Segmentation : public BaseObject
+{
+public:
+
+  /**
+   * Constructor
+   */
+  Segmentation();
+
+  /**
+   * Destructor
+   */
+  ~Segmentation();
+
+  /**
+   * @copydoc Dali::Segmentation::Get()
+   */
+  static TextAbstraction::Segmentation Get();
+
+  /**
+   * @copydoc Dali::Segmentation::GetLineBreakPositions()
+   */
+  void GetLineBreakPositions( const Character* const text,
+                              Length numberOfCharacters,
+                              LineBreakInfo* breakInfo );
+
+
+  /**
+   * @copydoc Dali::Segmentation::GetWordBreakPositions()
+   */
+  void GetWordBreakPositions( const Character* const text,
+                              Length numberOfCharacters,
+                              WordBreakInfo* breakInfo );
+
+private:
+
+  /**
+   * Helper for lazy initialization.
+   */
+  void CreatePlugin();
+
+private:
+
+  // Undefined copy constructor.
+  Segmentation( const Segmentation& );
+
+  // Undefined assignment constructor.
+  Segmentation& operator=( Segmentation& );
+
+private:
+
+  struct Plugin;
+  Plugin* mPlugin;
+
+}; // class Segmentation
+
+} // namespace Internal
+
+} // namespace TextAbstraction
+
+inline static TextAbstraction::Internal::Segmentation& GetImplementation( TextAbstraction::Segmentation& segmentation )
+{
+  DALI_ASSERT_ALWAYS( segmentation && "segmentation handle is empty" );
+  BaseObject& handle = segmentation.GetBaseObject();
+  return static_cast<TextAbstraction::Internal::Segmentation&>( handle );
+}
+
+inline static const TextAbstraction::Internal::Segmentation& GetImplementation( const TextAbstraction::Segmentation& segmentation )
+{
+  DALI_ASSERT_ALWAYS( segmentation && "segmentation handle is empty" );
+  const BaseObject& handle = segmentation.GetBaseObject();
+  return static_cast<const TextAbstraction::Internal::Segmentation&>( handle );
+}
+
+} // namespace Dali
+
+#endif // __DALI_INTERNAL_TEXT_ABSTRACTION_SEGMENTATION_IMPL_H__
diff --git a/text/dali/internal/text-abstraction/shaping-impl.cpp b/text/dali/internal/text-abstraction/shaping-impl.cpp
new file mode 100644 (file)
index 0000000..49c93b2
--- /dev/null
@@ -0,0 +1,263 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS  HEADER
+#include "shaping-impl.h"
+
+// INTERNAL INCLUDES
+#include <singleton-service-impl.h>
+#include <dali/public-api/text-abstraction/font-client.h>
+#include <dali/public-api/text-abstraction/glyph-info.h>
+#include <dali/integration-api/debug.h>
+
+// EXTERNAL INCLUDES
+#include <harfbuzz/hb.h>
+#include <harfbuzz/hb-ft.h>
+
+#include <ft2build.h>
+
+namespace Dali
+{
+
+namespace TextAbstraction
+{
+
+namespace Internal
+{
+
+const unsigned int HIGH_QUALITY_PIXEL_SIZE = 200u;  // Pixel size sent to FreeType2 FT_Set_Char_Size() for high quality glyphs.
+const char*        DEFAULT_LANGUAGE = "en";
+const unsigned int DEFAULT_LANGUAGE_LENGTH = 2u;
+const float        TO_PIXELS = 64.f;
+
+const hb_script_t SCRIPT_TO_HARFBUZZ[] =
+{
+  HB_SCRIPT_LATIN,
+  HB_SCRIPT_ARABIC,
+  HB_SCRIPT_DEVANAGARI,
+  HB_SCRIPT_BENGALI,
+  HB_SCRIPT_GURMUKHI,
+  HB_SCRIPT_GUJARATI,
+  HB_SCRIPT_ORIYA,
+  HB_SCRIPT_TAMIL,
+  HB_SCRIPT_TELUGU,
+  HB_SCRIPT_KANNADA,
+  HB_SCRIPT_MALAYALAM,
+  HB_SCRIPT_SINHALA,
+  HB_SCRIPT_HAN,
+  HB_SCRIPT_HANGUL,
+  HB_SCRIPT_KHMER,
+  HB_SCRIPT_LAO,
+  HB_SCRIPT_THAI,
+  HB_SCRIPT_MYANMAR,
+  HB_SCRIPT_UNKNOWN
+};
+
+struct Shaping::Plugin
+{
+  Plugin()
+  : mFreeTypeLibrary( NULL ),
+    mIndices(),
+    mAdvance(),
+    mCharacterMap(),
+    mFontId( 0u )
+  {
+  }
+
+  ~Plugin()
+  {
+    FT_Done_FreeType( mFreeTypeLibrary );
+  }
+
+  void Initialize()
+  {
+    int error = FT_Init_FreeType( &mFreeTypeLibrary );
+    if( FT_Err_Ok != error )
+    {
+      DALI_LOG_ERROR( "FreeType Init error: %d\n", error );
+    }
+  }
+
+  Length Shape( const Character* const text,
+                Length numberOfCharacters,
+                FontId fontId,
+                Script script )
+  {
+    // Clear previoursly shaped texts.
+    mIndices.Clear();
+    mAdvance.Clear();
+    mCharacterMap.Clear();
+    mFontId = fontId;
+
+    TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+
+    // Get the font's path file name from the font Id.
+    FontDescription fontDescription;
+    fontClient.GetDescription( fontId, fontDescription );
+
+    // Create a FreeType font's face.
+    FT_Face face;
+    FT_Error retVal = FT_New_Face( mFreeTypeLibrary, fontDescription.path.c_str(), 0u, &face );
+    if( FT_Err_Ok != retVal )
+    {
+      DALI_LOG_ERROR( "Failed to open face: %s\n", fontDescription.path.c_str() );
+      return 0u;
+    }
+
+    FT_Set_Pixel_Sizes( face, HIGH_QUALITY_PIXEL_SIZE, HIGH_QUALITY_PIXEL_SIZE );
+
+    /* Get our harfbuzz font struct */
+    hb_font_t* harfBuzzFont;
+    harfBuzzFont = hb_ft_font_create( face, NULL );
+
+    /* Create a buffer for harfbuzz to use */
+    hb_buffer_t* harfBuzzBuffer = hb_buffer_create();
+
+    hb_buffer_set_direction( harfBuzzBuffer,
+                             ( ARABIC == script ) ? HB_DIRECTION_RTL : HB_DIRECTION_LTR ); /* or LTR */
+
+    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 ) );
+
+    /* Layout the text */
+    hb_buffer_add_utf32( harfBuzzBuffer, text, numberOfCharacters, 0u, numberOfCharacters );
+
+    hb_shape( harfBuzzFont, harfBuzzBuffer, NULL, 0u );
+
+    /* Get glyph data */
+    unsigned int glyphCount;
+    hb_glyph_info_t* glyphInfo = hb_buffer_get_glyph_infos( harfBuzzBuffer, &glyphCount );
+    hb_glyph_position_t *glyphPositions = hb_buffer_get_glyph_positions( harfBuzzBuffer, &glyphCount );
+
+    for( Length i = 0u; i < glyphCount; ++i )
+    {
+      mIndices.PushBack( glyphInfo[i].codepoint );
+      mAdvance.PushBack( glyphPositions[i].x_advance / TO_PIXELS );
+      mCharacterMap.PushBack( glyphInfo[i].cluster );
+    }
+
+    /* Cleanup */
+    hb_buffer_destroy( harfBuzzBuffer );
+    hb_font_destroy( harfBuzzFont );
+    FT_Done_Face( face );
+
+    return mIndices.Count();
+  }
+
+  void GetGlyphs( GlyphInfo* glyphInfo,
+                  CharacterIndex* glyphToCharacterMap )
+  {
+    Vector<CharacterIndex>::ConstIterator indicesIt = mIndices.Begin();
+    Vector<float>::ConstIterator advanceIt = mAdvance.Begin();
+    Vector<CharacterIndex>::ConstIterator characterMapIt = mCharacterMap.Begin();
+
+    for( Length index = 0u, size = mIndices.Count(); index < size; ++index )
+    {
+      GlyphInfo& glyph = *( glyphInfo + index );
+      CharacterIndex& glyphToCharacter = *( glyphToCharacterMap + index );
+
+      glyph.fontId = mFontId;
+      glyph.index = *( indicesIt + index );
+      glyph.advance = *( advanceIt + index );
+
+      glyphToCharacter = *( characterMapIt + index );
+    }
+  }
+
+  FT_Library             mFreeTypeLibrary;
+
+  Vector<CharacterIndex> mIndices;
+  Vector<float>          mAdvance;
+  Vector<CharacterIndex> mCharacterMap;
+  FontId                 mFontId;
+};
+
+Shaping::Shaping()
+: mPlugin( NULL )
+{
+}
+
+Shaping::~Shaping()
+{
+  delete mPlugin;
+}
+
+TextAbstraction::Shaping Shaping::Get()
+{
+  TextAbstraction::Shaping shapingHandle;
+
+  SingletonService service( SingletonService::Get() );
+  if( service )
+  {
+    // Check whether the singleton is already created
+    Dali::BaseHandle handle = service.GetSingleton( typeid( TextAbstraction::Shaping ) );
+    if( handle )
+    {
+      // If so, downcast the handle
+      Shaping* impl = dynamic_cast< Internal::Shaping* >( handle.GetObjectPtr() );
+      shapingHandle = TextAbstraction::Shaping( impl );
+    }
+    else // create and register the object
+    {
+      shapingHandle = TextAbstraction::Shaping( new Shaping );
+      service.Register( typeid( shapingHandle ), shapingHandle );
+    }
+  }
+
+  return shapingHandle;
+}
+
+Length Shaping::Shape( const Character* const text,
+                       Length numberOfCharacters,
+                       FontId fontId,
+                       Script script )
+{
+  CreatePlugin();
+
+  return mPlugin->Shape( text,
+                         numberOfCharacters,
+                         fontId,
+                         script );
+}
+
+void Shaping::GetGlyphs( GlyphInfo* glyphInfo,
+                         CharacterIndex* glyphToCharacterMap )
+{
+  CreatePlugin();
+
+  mPlugin->GetGlyphs( glyphInfo,
+                      glyphToCharacterMap );
+}
+
+void Shaping::CreatePlugin()
+{
+  if( !mPlugin )
+  {
+    mPlugin = new Plugin();
+    mPlugin->Initialize();
+  }
+}
+
+} // namespace Internal
+
+} // namespace TextAbstraction
+
+} // namespace Dali
diff --git a/text/dali/internal/text-abstraction/shaping-impl.h b/text/dali/internal/text-abstraction/shaping-impl.h
new file mode 100644 (file)
index 0000000..3d20306
--- /dev/null
@@ -0,0 +1,113 @@
+#ifndef __DALI_INTERNAL_TEXT_ABSTRACTION_SHAPING_IMPL_H__
+#define __DALI_INTERNAL_TEXT_ABSTRACTION_SHAPING_IMPL_H__
+
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/base-object.h>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/common/dali-vector.h>
+#include <dali/public-api/text-abstraction/shaping.h>
+
+namespace Dali
+{
+
+namespace TextAbstraction
+{
+
+namespace Internal
+{
+
+/**
+ * Implementation of the Shaping
+ */
+class Shaping : public BaseObject
+{
+public:
+
+  /**
+   * Constructor
+   */
+  Shaping();
+
+  /**
+   * Destructor
+   */
+  ~Shaping();
+
+  /**
+   * @copydoc Dali::Shaping::Get()
+   */
+  static TextAbstraction::Shaping Get();
+
+  /**
+   * @copydoc Dali::Shaping::Shape()
+   */
+  Length Shape( const Character* const text,
+                Length numberOfCharacters,
+                FontId fontId,
+                Script script );
+
+  /**
+   * @copydoc Dali::Shaping::GetGlyphs()
+   */
+  void GetGlyphs( GlyphInfo* glyphInfo,
+                  CharacterIndex* glyphToCharacterMap );
+
+private:
+
+  /**
+   * Helper for lazy initialization.
+   */
+  void CreatePlugin();
+
+private:
+
+  // Undefined copy constructor.
+  Shaping( const Shaping& );
+
+  // Undefined assignment constructor.
+  Shaping& operator=( Shaping& );
+
+  struct Plugin;
+  Plugin* mPlugin;
+
+}; // class Shaping
+
+} // namespace Internal
+
+} // namespace TextAbstraction
+
+inline static TextAbstraction::Internal::Shaping& GetImplementation( TextAbstraction::Shaping& shaping )
+{
+  DALI_ASSERT_ALWAYS( shaping && "shaping handle is empty" );
+  BaseObject& handle = shaping.GetBaseObject();
+  return static_cast<TextAbstraction::Internal::Shaping&>( handle );
+}
+
+inline static const TextAbstraction::Internal::Shaping& GetImplementation( const TextAbstraction::Shaping& shaping )
+{
+  DALI_ASSERT_ALWAYS( shaping && "shaping handle is empty" );
+  const BaseObject& handle = shaping.GetBaseObject();
+  return static_cast<const TextAbstraction::Internal::Shaping&>( handle );
+}
+
+} // namespace Dali
+
+#endif // __DALI_INTERNAL_TEXT_ABSTRACTION_SHAPING_IMPL_H__
diff --git a/text/dali/public-api/text-abstraction/bidirectional-support.cpp b/text/dali/public-api/text-abstraction/bidirectional-support.cpp
new file mode 100644 (file)
index 0000000..40a7d78
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/public-api/text-abstraction/bidirectional-support.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/text-abstraction/bidirectional-support-impl.h>
+
+namespace Dali
+{
+
+namespace TextAbstraction
+{
+
+BidirectionalSupport::BidirectionalSupport()
+{
+}
+
+BidirectionalSupport::~BidirectionalSupport()
+{
+}
+
+BidirectionalSupport::BidirectionalSupport( Internal::BidirectionalSupport* implementation )
+: BaseHandle( implementation )
+{
+}
+
+BidirectionalSupport BidirectionalSupport::Get()
+{
+  return Internal::BidirectionalSupport::Get();
+}
+
+BidiInfoIndex BidirectionalSupport::CreateInfo( const Character* const paragraph,
+                                                Length numberOfCharacters )
+{
+  return GetImplementation( *this ).CreateInfo( paragraph,
+                                                numberOfCharacters );
+}
+
+void BidirectionalSupport::DestroyInfo( BidiInfoIndex bidiInfoIndex )
+{
+  GetImplementation( *this ).DestroyInfo( bidiInfoIndex );
+}
+
+void BidirectionalSupport::Reorder( BidiInfoIndex bidiInfoIndex,
+                                    CharacterIndex firstCharacterIndex,
+                                    Length numberOfCharacters,
+                                    CharacterIndex* visualToLogicalMap )
+{
+  GetImplementation( *this ).Reorder( bidiInfoIndex,
+                                      firstCharacterIndex,
+                                      numberOfCharacters,
+                                      visualToLogicalMap );
+}
+
+} // namespace TextAbstraction
+
+} // namespace Dali
diff --git a/text/dali/public-api/text-abstraction/bidirectional-support.h b/text/dali/public-api/text-abstraction/bidirectional-support.h
new file mode 100644 (file)
index 0000000..f18a9c7
--- /dev/null
@@ -0,0 +1,114 @@
+#ifndef __DALI_PLATFORM_TEXT_ABSTRACTION_BIDIRECTIONAL_SUPPORT_H__
+#define __DALI_PLATFORM_TEXT_ABSTRACTION_BIDIRECTIONAL_SUPPORT_H__
+
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/text-abstraction/text-abstraction-definitions.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/base-handle.h>
+
+namespace Dali
+{
+
+namespace TextAbstraction
+{
+
+namespace Internal DALI_INTERNAL
+{
+
+class BidirectionalSupport;
+
+} // Internal
+
+/**
+ * BidirectionalSupport API
+ *
+ */
+class DALI_IMPORT_API BidirectionalSupport : public BaseHandle
+{
+
+public:
+
+  /**
+   * @brief Create an uninitialized TextAbstraction handle.
+   *
+   */
+  BidirectionalSupport();
+
+  /**
+   * @brief Destructor
+   *
+   * This is non-virtual since derived Handle types must not contain data or virtual methods.
+   */
+  ~BidirectionalSupport();
+
+  /**
+   * @brief This constructor is used by BidirectionalSupport::Get().
+   *
+   * @param[in] implementation a pointer to the internal bidirectional support object.
+   */
+  explicit DALI_INTERNAL BidirectionalSupport( Internal::BidirectionalSupport* implementation );
+
+  /**
+   * @brief Retrieve a handle to the BidirectionalSupport instance.
+   *
+   * @return A handle to the BidirectionalSupport
+   */
+  static BidirectionalSupport Get();
+
+  /**
+   * @brief Creates bidirectional data for the whole paragraph.
+   *
+   * @param[in] paragraph Pointer to the first character of the paragraph coded in UTF32.
+   * @param[in] numberOfCharacters The number of characters of the paragraph.
+   *
+   * @return An index of an object inside a table storing the bidirectional data.
+   */
+  BidiInfoIndex CreateInfo( const Character* const paragraph,
+                            Length numberOfCharacters );
+
+  /**
+   * @brief Destroys the bidirectional data.
+   *
+   * @param[in] bidiInfoIndex The index to the of the object inside the table storing the bidirectional data for the current paragraph.
+   */
+  void DestroyInfo( BidiInfoIndex bidiInfoIndex );
+
+  /**
+   * @brief Reorders a line of a paragraph.
+   *
+   * @pre visualToLogicalMap must have enough space allocated for @p numberOfCharacters.
+   *
+   * @param[in] bidiInfoIndex The index to the of the object inside the table storing the bidirectional data for the current paragraph.
+   * @param[in] firstCharacterIndex The first character of the line within the whole paragraph.
+   * @param[in] numberOfCharacters The number of characters of the line.
+   * @param[out] visualToLogicalMap The visual to logical conversion map.
+   */
+  void Reorder( BidiInfoIndex bidiInfoIndex,
+                CharacterIndex firstCharacterIndex,
+                Length numberOfCharacters,
+                CharacterIndex* visualToLogicalMap );
+};
+
+} // namespace TextAbstraction
+
+} // namespace Dali
+
+#endif // __DALI_PLATFORM_TEXT_ABSTRACTION_BIDIRECTIONAL_SUPPORT_H__
diff --git a/text/dali/public-api/text-abstraction/font-client.cpp b/text/dali/public-api/text-abstraction/font-client.cpp
new file mode 100644 (file)
index 0000000..90aa49a
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/public-api/text-abstraction/font-client.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/text-abstraction/font-client-impl.h>
+
+namespace Dali
+{
+
+namespace TextAbstraction
+{
+
+const PointSize26Dot6 FontClient::DEFAULT_POINT_SIZE = 768u; // 12*64
+
+FontClient FontClient::Get()
+{
+  return Internal::FontClient::Get();
+}
+
+FontClient::FontClient()
+{
+}
+
+FontClient::~FontClient()
+{
+}
+
+FontClient::FontClient( const FontClient& handle )
+: BaseHandle( handle )
+{
+}
+
+FontClient& FontClient::operator=( const FontClient& handle )
+{
+  BaseHandle::operator=( handle );
+  return *this;
+}
+
+void FontClient::SetDpi( unsigned int horizontalDpi, unsigned int verticalDpi  )
+{
+  GetImplementation(*this).SetDpi( horizontalDpi, verticalDpi );
+}
+
+void FontClient::SetDefaultFontFamily( const std::string& fontFamilyName,
+                                       const std::string& fontStyle )
+{
+  GetImplementation(*this).SetDefaultFontFamily( fontFamilyName, fontStyle );
+}
+
+void FontClient::GetDefaultFonts( FontList& defaultFonts )
+{
+  GetImplementation(*this).GetDefaultFonts( defaultFonts );
+}
+
+void FontClient::GetSystemFonts( FontList& systemFonts )
+{
+  GetImplementation(*this).GetSystemFonts( systemFonts );
+}
+
+void FontClient::GetDescription( FontId id, FontDescription& fontDescription )
+{
+  GetImplementation(*this).GetDescription( id, fontDescription );
+}
+
+PointSize26Dot6 FontClient::GetPointSize( FontId id )
+{
+  return GetImplementation(*this).GetPointSize( id );
+}
+
+FontId FontClient::FindDefaultFont( Character charcode, PointSize26Dot6 pointSize )
+{
+  return GetImplementation(*this).FindDefaultFont( charcode, pointSize );
+}
+
+FontId FontClient::GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex )
+{
+  return GetImplementation(*this).GetFontId( path, pointSize, faceIndex );
+}
+
+FontId FontClient::GetFontId( const FontFamily& fontFamily,
+                              const FontStyle& fontStyle,
+                              PointSize26Dot6 pointSize,
+                              FaceIndex faceIndex )
+{
+  return GetImplementation(*this).GetFontId( fontFamily,
+                                             fontStyle,
+                                             pointSize,
+                                             faceIndex );
+}
+
+void FontClient::GetFontMetrics( FontId fontId, FontMetrics& metrics )
+{
+  GetImplementation(*this).GetFontMetrics( fontId, metrics );
+}
+
+GlyphIndex FontClient::GetGlyphIndex( FontId fontId, Character charcode )
+{
+  return GetImplementation(*this).GetGlyphIndex( fontId, charcode );
+}
+
+bool FontClient::GetGlyphMetrics( GlyphInfo* array, uint32_t size, bool horizontal )
+{
+  return GetImplementation(*this).GetGlyphMetrics( array, size, horizontal );
+}
+
+BitmapImage FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex )
+{
+  return GetImplementation(*this).CreateBitmap( fontId, glyphIndex );
+}
+
+FontClient::FontClient( Internal::FontClient* internal )
+: BaseHandle( internal )
+{
+}
+
+} // namespace TextAbstraction
+
+} // namespace Dali
diff --git a/text/dali/public-api/text-abstraction/font-client.h b/text/dali/public-api/text-abstraction/font-client.h
new file mode 100644 (file)
index 0000000..aa63353
--- /dev/null
@@ -0,0 +1,244 @@
+#ifndef __DALI_PLATFORM_TEXT_ABSTRACTION_FONT_CLIENT_H__
+#define __DALI_PLATFORM_TEXT_ABSTRACTION_FONT_CLIENT_H__
+
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/images/bitmap-image.h>
+#include <dali/public-api/object/base-handle.h>
+#include <dali/public-api/text-abstraction/font-list.h>
+#include <dali/public-api/text-abstraction/text-abstraction-definitions.h>
+
+namespace Dali
+{
+
+namespace TextAbstraction
+{
+
+struct FontMetrics;
+struct GlyphInfo;
+
+namespace Internal DALI_INTERNAL
+{
+class FontClient;
+}
+
+/**
+ * @brief FontClient provides access to font information and resources.
+ *
+ * <h3>Querying the System Fonts</h3>
+ *
+ * A "system font" is described by a "path" to a font file on the native filesystem, along with a "family" and "style".
+ * For example on the Ubuntu system a "Regular" style font from the "Ubuntu Mono" family can be accessed from "/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-R.ttf".
+ *
+ * <h3>Accessing Fonts</h3>
+ *
+ * A "font" is created from the system for a specific point size in 26.6 fractional points. A "FontId" is used to identify each font.
+ * For example two different fonts with point sizes 10 & 12 can be created from the "Ubuntu Mono" family:
+ * @code
+ * FontClient fontClient   = FontClient::Get();
+ * FontId ubuntuMonoTen    = fontClient.GetFontId( "/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-R.ttf", 10*64 );
+ * FontId ubuntuMonoTwelve = fontClient.GetFontId( "/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-R.ttf", 12*64 );
+ * @endcode
+ * Glyph metrics and bitmap resources can then be retrieved using the FontId.
+ */
+class DALI_IMPORT_API FontClient : public BaseHandle
+{
+public:
+  static const PointSize26Dot6 DEFAULT_POINT_SIZE; ///< The default point size.
+
+public:
+
+  /**
+   * @brief Retrieve a handle to the FontClient instance.
+   *
+   * @return A handle to the FontClient
+   */
+  static FontClient Get();
+
+  /**
+   * @brief Create an uninitialized TextAbstraction handle.
+   */
+  FontClient();
+
+  /**
+   * @brief Destructor
+   *
+   * This is non-virtual since derived Handle types must not contain data or virtual methods.
+   */
+  ~FontClient();
+
+  /**
+   * @brief This copy constructor is required for (smart) pointer semantics.
+   *
+   * @param[in] handle A reference to the copied handle.
+   */
+  FontClient( const FontClient& handle );
+
+  /**
+   * @brief This assignment operator is required for (smart) pointer semantics.
+   *
+   * @param [in] handle  A reference to the copied handle.
+   * @return A reference to this.
+   */
+  FontClient& operator=( const FontClient& handle );
+
+  ////////////////////////////////////////
+  // Font management and validation.
+  ////////////////////////////////////////
+
+  /**
+   * @brief Set the DPI of the target window.
+   *
+   * @note Multiple windows are not currently supported.
+   * @param[in] horizontalDpi The horizontal resolution in DPI.
+   * @param[in] verticalDpi The vertical resolution in DPI.
+   */
+  void SetDpi( unsigned int horizontalDpi, unsigned int verticalDpi );
+
+  /**
+   * Set the default font family and its style that should be used by the font client.
+   *
+   * @param[in] fontFamilyName The default name of the font's family.
+   * @param[in] fontStyle The default font's style.
+   */
+  void SetDefaultFontFamily( const std::string& fontFamilyName,
+                             const std::string& fontStyle );
+
+  /**
+   * @brief Retrieve the list of default fonts supported by the system.
+   *
+   * @param[out] defaultFonts A list of default font paths, family & style strings.
+   */
+  void GetDefaultFonts( FontList& defaultFonts );
+
+  /**
+   * @brief Retrieve the list of fonts supported by the system.
+   *
+   * @param[out] systemFonts A list of font paths, family & style strings.
+   */
+  void GetSystemFonts( FontList& systemFonts );
+
+  /**
+   * @brief Retrieves the font description of a given font @p id.
+   *
+   * @param[in] id The font id.
+   * @param[out] fontDescription The path, family & style describing the font.
+   */
+  void GetDescription( FontId id, FontDescription& fontDescription );
+
+  /**
+   * @brief Retrieves the font point size of a given font @p id.
+   *
+   * @param[in] id The font id.
+   *
+   * @return The point size in 26.6 fractional points.
+   */
+  PointSize26Dot6 GetPointSize( FontId id );
+
+  /**
+   * @brief Find an appropriate font for displaying a UTF-32 character.
+   *
+   * This is useful when localised strings are provided for multiple languages
+   * i.e. when a single default font does not work for all languages.
+   * @param[in] charcode The character for which a font is needed.
+   * @param[in] pointSize The point size in 26.6 fractional points; the default point size is 12*64.
+   * @return A valid font ID, or zero if the font does not exist.
+   */
+  FontId FindDefaultFont( Character charcode,
+                          PointSize26Dot6 pointSize = DEFAULT_POINT_SIZE );
+
+  /**
+   * @brief Retrieve the unique identifier for a font.
+   *
+   * @param[in] path The path to a font file.
+   * @param[in] pointSize The point size in 26.6 fractional points; the default point size is 12*64.
+   * @param[in] faceIndex The index of the font face (optional).
+   * @return A valid font ID, or zero if the font does not exist.
+   */
+  FontId GetFontId( const FontPath& path, PointSize26Dot6 pointSize = DEFAULT_POINT_SIZE, FaceIndex faceIndex = 0 );
+
+  /**
+   * @brief Retrieve the unique identifier for a font.
+   *
+   * @param[in] fontFamily The font family name.
+   * @param[in] fontStyle  The font style.
+   * @param[in] pointSize The point size in 26.6 fractional points; the default point size is 12*64.
+   * @param[in] faceIndex The index of the font face (optional).
+   * @return A valid font ID, or zero if the font does not exist.
+   */
+  FontId GetFontId( const FontFamily& fontFamily,
+                    const FontStyle& fontStyle,
+                    PointSize26Dot6 pointSize = DEFAULT_POINT_SIZE,
+                    FaceIndex faceIndex = 0 );
+
+  ////////////////////////////////////////
+  // Font metrics, glyphs and bitmaps.
+  ////////////////////////////////////////
+
+  /**
+   * @brief Query the metrics for a font.
+   *
+   * @param[in] fontId The ID of the font for the required glyph.
+   * @param[out] metrics The font metrics.
+   */
+  void GetFontMetrics( FontId fontId, FontMetrics& metrics );
+
+  /**
+   * @brief Retrieve the glyph index for a UTF-32 character code.
+   *
+   * @param[in] fontId The ID of the font for the required glyph.
+   * @param[in] charcode The UTF-32 character code.
+   * @return The glyph index, or zero if the character code is undefined.
+   */
+  GlyphIndex GetGlyphIndex( FontId fontId, Character charcode );
+
+  /**
+   * @brief Retrieve the metrics for a series of glyphs.
+   *
+   * @param[in,out] array An array of glyph-info structures with initialized FontId & GlyphIndex values.
+   * On return, the remaining metrics values will be initialized e.g. glyph size & bearing values.
+   * @param[in] size The size of the array.
+   * @param[in] horizontal True for horizontal layouts (set to false for vertical layouting).
+   * @return True if all of the requested metrics were found.
+   */
+  bool GetGlyphMetrics( GlyphInfo* array, uint32_t size, bool horizontal = true );
+
+  /**
+   * @brief Render a bitmap representation of a glyph.
+   *
+   * @param[in] fontId The ID of the font.
+   * @param[in] glyphIndex The index of a glyph within the specified font.
+   * @return A valid BitmapImage, or an empty handle if the glyph could not be rendered.
+   */
+  BitmapImage CreateBitmap( FontId fontId, GlyphIndex glyphIndex );
+
+public: // Not intended for application developers
+  /**
+   * @brief This constructor is used by FontClient::Get().
+   *
+   * @param[in] fontClient  A pointer to the internal fontClient object.
+   */
+  explicit DALI_INTERNAL FontClient( Internal::FontClient* fontClient );
+};
+
+} // namespace TextAbstraction
+
+} // namespace Dali
+
+#endif // __DALI_PLATFORM_TEXT_ABSTRACTION_FONT_CLIENT_H__
diff --git a/text/dali/public-api/text-abstraction/font-list.cpp b/text/dali/public-api/text-abstraction/font-list.cpp
new file mode 100644 (file)
index 0000000..bd4f986
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/public-api/text-abstraction/font-list.h>
+
+namespace Dali
+{
+
+namespace TextAbstraction
+{
+
+DALI_IMPORT_API std::ostream& operator<<( std::ostream& o, const FontList& fontList )
+{
+  for( unsigned int i=0; i<fontList.size(); ++i )
+  {
+    o << "Font " << i << ") path: " << fontList[i].path << " family: " << fontList[i].family << " style: " << fontList[i].style << std::endl;
+  }
+
+  return o;
+}
+
+} // namespace TextAbstraction
+
+} // namespace Dali
diff --git a/text/dali/public-api/text-abstraction/font-list.h b/text/dali/public-api/text-abstraction/font-list.h
new file mode 100644 (file)
index 0000000..75549eb
--- /dev/null
@@ -0,0 +1,51 @@
+#ifndef __DALI_TEXT_ABSTRACTION_FONT_LIST_H__
+#define __DALI_TEXT_ABSTRACTION_FONT_LIST_H__
+
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+#include <iostream>
+#include <dali/public-api/common/vector-wrapper.h>
+
+namespace Dali
+{
+
+namespace TextAbstraction
+{
+
+typedef std::string FontPath;
+typedef std::string FontFamily;
+typedef std::string FontStyle;
+
+struct FontDescription
+{
+  FontPath   path;
+  FontFamily family;
+  FontStyle  style;
+};
+
+typedef std::vector<FontDescription> FontList;
+
+DALI_IMPORT_API std::ostream& operator<<( std::ostream& o, const FontList& fontList );
+
+} // namespace TextAbstraction
+
+} // namespace Dali
+
+#endif // __DALI_TEXT_ABSTRACTION_FONT_LIST_H__
diff --git a/text/dali/public-api/text-abstraction/font-metrics.cpp b/text/dali/public-api/text-abstraction/font-metrics.cpp
new file mode 100644 (file)
index 0000000..f1a172c
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/public-api/text-abstraction/font-metrics.h>
+
+namespace Dali
+{
+
+namespace TextAbstraction
+{
+
+FontMetrics::FontMetrics()
+: ascender( 0 ),
+  descender( 0 ),
+  height( 0 )
+{
+}
+
+FontMetrics::FontMetrics( float ascenderPixels,
+                          float descenderPixels,
+                          float heightPixels )
+: ascender( ascenderPixels ),
+  descender( descenderPixels ),
+  height( heightPixels )
+{
+}
+
+} // namespace TextAbstraction
+
+} // namespace Dali
diff --git a/text/dali/public-api/text-abstraction/font-metrics.h b/text/dali/public-api/text-abstraction/font-metrics.h
new file mode 100644 (file)
index 0000000..4472525
--- /dev/null
@@ -0,0 +1,53 @@
+#ifndef __DALI_TEXT_ABSTRACTION_FONT_METRICS_H__
+#define __DALI_TEXT_ABSTRACTION_FONT_METRICS_H__
+
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+namespace Dali
+{
+
+namespace TextAbstraction
+{
+
+/**
+ * The metrics for a Font expressed in pixels.
+ */
+struct FontMetrics
+{
+  /**
+   * @brief Default constructor.
+   */
+  FontMetrics();
+
+  /**
+   * @brief Create the font metrics in pixels.
+   */
+  FontMetrics( float ascenderPixels,
+               float descenderPixels,
+               float heightPixels );
+
+  float ascender;   ///< The ascender in pixels.
+  float descender;  ///< The descender in pixels.
+  float height;     ///< The height in pixels.
+};
+
+} // Dali
+
+} // TextAbstraction
+
+#endif //__DALI_TEXT_ABSTRACTION_FONT_METRICS_H__
diff --git a/text/dali/public-api/text-abstraction/glyph-info.cpp b/text/dali/public-api/text-abstraction/glyph-info.cpp
new file mode 100644 (file)
index 0000000..cafcffb
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/public-api/text-abstraction/glyph-info.h>
+
+namespace Dali
+{
+
+namespace TextAbstraction
+{
+
+GlyphInfo::GlyphInfo()
+: fontId( 0 ),
+  index( 0 ),
+  width( 0 ),
+  height( 0 ),
+  xBearing( 0 ),
+  yBearing( 0 ),
+  advance( 0 )
+{
+}
+
+GlyphInfo::GlyphInfo( FontId font, GlyphIndex i )
+: fontId( font ),
+  index( i ),
+  width( 0 ),
+  height( 0 ),
+  xBearing( 0 ),
+  yBearing( 0 ),
+  advance( 0 )
+{
+}
+
+} // namespace TextAbstraction
+
+} // namespace Dali
diff --git a/text/dali/public-api/text-abstraction/glyph-info.h b/text/dali/public-api/text-abstraction/glyph-info.h
new file mode 100644 (file)
index 0000000..f0521e4
--- /dev/null
@@ -0,0 +1,59 @@
+#ifndef __DALI_TEXT_ABSTRACTION_GLYPH_INFO_H__
+#define __DALI_TEXT_ABSTRACTION_GLYPH_INFO_H__
+
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/text-abstraction/text-abstraction-definitions.h>
+
+namespace Dali
+{
+
+namespace TextAbstraction
+{
+
+/**
+ * The information describing a glyph (font ID, index, metrics)
+ * The metrics are in pixels.
+ */
+struct GlyphInfo
+{
+  /**
+   * @brief Default constructor.
+   */
+  GlyphInfo();
+
+  /**
+   * @brief Creates the GlyphInfo without metrics.
+   */
+  GlyphInfo( FontId font, GlyphIndex i );
+
+  FontId fontId;    ///< Identifies the font containing the glyph
+  GlyphIndex index; ///< Uniquely identifies a glyph for a given FontId
+  float width;      ///< The width of the glyph
+  float height;     ///< The height of the glyph
+  float xBearing;   ///< The distance from the cursor position to the leftmost border of the glyph
+  float yBearing;   ///< The distance from the baseline to the topmost border of the glyph
+  float advance;    ///< The distance to move the cursor for this glyph
+};
+
+} // Dali
+
+} // TextAbstraction
+
+#endif //__DALI_TEXT_ABSTRACTION_GLYPH_INFO_H__
diff --git a/text/dali/public-api/text-abstraction/script.h b/text/dali/public-api/text-abstraction/script.h
new file mode 100644 (file)
index 0000000..e2a3b1f
--- /dev/null
@@ -0,0 +1,61 @@
+#ifndef __DALI_TOOLKIT_TEXT_ABSTRACTION_SCRIPT_H__
+#define __DALI_TOOLKIT_TEXT_ABSTRACTION_SCRIPT_H__
+
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/text-abstraction/text-abstraction-definitions.h>
+
+namespace Dali
+{
+
+namespace TextAbstraction
+{
+
+/**
+ * @brief 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.
+ */
+enum Script
+{
+  LATIN,      ///< The latin script. Used by many western languages and others around the world.
+  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 (Odia), 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.
+  CJK,        ///< The CJK script. Used by Chinese, Japanese, Korean and Vietnamese(old writing system).
+  HANGUL,     ///< The Hangul jamo script. Used by Korean.
+  KHMER,      ///< The Khmer script. Used by the Khmer language.
+  LAO,        ///< The Lao script. Used by the Lao language.
+  THAI,       ///< The Thai script. Used by the Thai language
+  BURMESE,    ///< The Burmese script. Used by the Burmese (Myanmar) language.
+  UNKNOWN     ///< The script is unknown.
+};
+
+} // namespace TextAbstraction
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEXT_ABSTRACTION_SCRIPT_H__
diff --git a/text/dali/public-api/text-abstraction/segmentation.cpp b/text/dali/public-api/text-abstraction/segmentation.cpp
new file mode 100644 (file)
index 0000000..68b469d
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/public-api/text-abstraction/segmentation.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/text-abstraction/segmentation-impl.h>
+
+namespace Dali
+{
+
+namespace TextAbstraction
+{
+
+Segmentation::Segmentation()
+{
+}
+
+Segmentation::~Segmentation()
+{
+}
+
+Segmentation::Segmentation( Internal::Segmentation* implementation )
+: BaseHandle( implementation )
+{
+}
+
+Segmentation Segmentation::Get()
+{
+  return Internal::Segmentation::Get();
+}
+
+void Segmentation::GetLineBreakPositions( const Character* const text,
+                                          Length numberOfCharacters,
+                                          LineBreakInfo* breakInfo )
+{
+  GetImplementation( *this ).GetLineBreakPositions( text,
+                                                    numberOfCharacters,
+                                                    breakInfo );
+}
+
+void Segmentation::GetWordBreakPositions( const Character* const text,
+                                          Length numberOfCharacters,
+                                          WordBreakInfo* breakInfo )
+{
+  GetImplementation( *this ).GetWordBreakPositions( text,
+                                                    numberOfCharacters,
+                                                    breakInfo );
+}
+
+} // namespace TextAbstraction
+
+} // namespace Dali
diff --git a/text/dali/public-api/text-abstraction/segmentation.h b/text/dali/public-api/text-abstraction/segmentation.h
new file mode 100644 (file)
index 0000000..746e155
--- /dev/null
@@ -0,0 +1,133 @@
+#ifndef __DALI_PLATFORM_TEXT_ABSTRACTION_SEGMENTATION_H__
+#define __DALI_PLATFORM_TEXT_ABSTRACTION_SEGMENTATION_H__
+
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/text-abstraction/text-abstraction-definitions.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/base-handle.h>
+
+namespace Dali
+{
+
+namespace TextAbstraction
+{
+
+namespace Internal DALI_INTERNAL
+{
+
+class Segmentation;
+
+} // Internal
+
+} // TextAbstraction
+
+namespace TextAbstraction
+{
+
+/**
+ *   Segmentation API
+ *
+ */
+class DALI_IMPORT_API Segmentation : public BaseHandle
+{
+
+public:
+
+  /**
+   * @brief Create an uninitialized TextAbstraction handle.
+   *
+   */
+  Segmentation();
+
+  /**
+   * @brief Destructor
+   *
+   * This is non-virtual since derived Handle types must not contain data or virtual methods.
+   */
+  ~Segmentation();
+
+  /**
+   * @brief This constructor is used by Segmentation::Get().
+   *
+   * @param[in] implementation A pointer to the internal segmentation object.
+   */
+  explicit DALI_INTERNAL Segmentation( Internal::Segmentation* implementation );
+
+  /**
+   * @brief Retrieve a handle to the Segmentation instance.
+   *
+   * @return A handle to the Segmentation
+   */
+  static Segmentation Get();
+
+  /**
+   * @brief Retrieves the line break info.
+   *
+   * @pre @p breakInfo must have enough space allocated for @p numberOfCharacters.
+   *
+   * Possible values for LineBreakInfo are:
+   *
+   *  - 0 is a LINE_MUST_BREAK.  Text must be broken into a new line.
+   *  - 1 is a LINE_ALLOW_BREAK. Is possible to break the text into a new line.
+   *  - 2 is a LINE_NO_BREAK.    Text can't be broken into a new line.
+   *
+     @verbatim
+     i.e. Hello big\nworld produces:
+          2222212220 22220
+     @endverbatim
+   *
+   * @param[in] text Pointer to the first character of the text coded in UTF32.
+   * @param[in] numberOfCharacters The number of characters.
+   * @param[out] breakInfo The line break info.
+   */
+  void GetLineBreakPositions( const Character* const text,
+                              Length numberOfCharacters,
+                              LineBreakInfo* breakInfo );
+
+  /**
+   * @brief Retrieves the word break info.
+   *
+   * @pre @p breakInfo must have enough space allocated for @p numberOfCharacters.
+   *
+   * Possible values for WordBreakInfo are:
+   *
+   * - 0 is a WORD_BREAK.    Text can be broken into a new word.
+   * - 1 is a WORD_NO_BREAK. Text can't be broken into a new word.
+   *
+     @verbatim
+     i.e. Hello big\nworld produces:
+          1111001100 11110
+     @endverbatim
+   *
+   * @param[in] text Pointer to the first character of the text coded in UTF32.
+   * @param[in] numberOfCharacters The number of characters.
+   * @param[out] breakInfo The word break info.
+   */
+  void GetWordBreakPositions( const Character* const text,
+                              Length numberOfCharacters,
+                              WordBreakInfo* breakInfo );
+};
+
+} // namespace TextAbstraction
+
+} // namespace Dali
+
+#endif // __DALI_PLATFORM_TEXT_ABSTRACTION_SEGMENTATION_H__
diff --git a/text/dali/public-api/text-abstraction/shaping.cpp b/text/dali/public-api/text-abstraction/shaping.cpp
new file mode 100644 (file)
index 0000000..2336797
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/public-api/text-abstraction/shaping.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/text-abstraction/shaping-impl.h>
+
+namespace Dali
+{
+
+namespace TextAbstraction
+{
+
+Shaping::Shaping()
+{
+}
+
+Shaping::~Shaping()
+{
+}
+
+Shaping::Shaping( Internal::Shaping *impl )
+: BaseHandle( impl )
+{
+}
+
+Shaping Shaping::Get()
+{
+  return Internal::Shaping::Get();
+}
+
+Length Shaping::Shape( const Character* const text,
+                       Length numberOfCharacters,
+                       FontId fontId,
+                       Script script )
+{
+  return GetImplementation( *this ).Shape( text,
+                                           numberOfCharacters,
+                                           fontId,
+                                           script );
+}
+
+void Shaping::GetGlyphs( GlyphInfo* glyphInfo,
+                         CharacterIndex* glyphToCharacterMap )
+{
+  GetImplementation( *this ).GetGlyphs( glyphInfo,
+                                        glyphToCharacterMap );
+}
+
+} // namespace TextAbstraction
+
+} // namespace Dali
diff --git a/text/dali/public-api/text-abstraction/shaping.h b/text/dali/public-api/text-abstraction/shaping.h
new file mode 100644 (file)
index 0000000..825dc31
--- /dev/null
@@ -0,0 +1,129 @@
+#ifndef __DALI_PLATFORM_TEXT_ABSTRACTION_SHAPING_H__
+#define __DALI_PLATFORM_TEXT_ABSTRACTION_SHAPING_H__
+
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/text-abstraction/script.h>
+#include <dali/public-api/text-abstraction/text-abstraction-definitions.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/base-handle.h>
+
+namespace Dali
+{
+
+namespace TextAbstraction
+{
+
+struct GlyphInfo;
+
+namespace Internal DALI_INTERNAL
+{
+
+class Shaping;
+
+} // Internal
+
+/**
+ * @brief Shaping provides an interface to retrieve glyphs from complex text.
+ *
+ * This module shapes text for a unique font id and script. If the text contains different fonts and scripts
+ * it needs to be split in runs of consecutive characters with the same font id and script.
+ *
+ * @code
+ * Shaping shaping = Shaping::Get();
+ *
+ * // Shapes a number of characters with the given font id and script.
+ * const Length numberOfGlyphs = shaping.Shape( text, numberOfCharacters, fontId, script );
+ *
+ * // Allocate memory to retrieve the glyphs and the character to glyph conversion map.
+ * GlyphInfo* glyphInfo = reinterpret_cast<GlyphInfo*>( malloc( numberOfGlyphs * sizeof( GlyphInfo ) ) );
+ * CharacterIndex* glyphToCharacterMap = reinterpret_cast<CharacterIndex*>( malloc( numberOfGlyphs * sizeof( CharacterIndex ) ) );
+ *
+ * // Retrieve the glyphs and the conversion map.
+ * shaping.GetGlyphs( glyphInfo, glyphToCharacterMap );
+ * @endcode
+ */
+class DALI_IMPORT_API Shaping : public BaseHandle
+{
+
+public:
+
+  /**
+   * @brief Create an uninitialized Shaping handle.
+   *
+   */
+  Shaping();
+
+  /**
+   * @brief Destructor
+   *
+   * This is non-virtual since derived Handle types must not contain data or virtual methods.
+   */
+  ~Shaping();
+
+  /**
+   * @brief This constructor is used by Shaping::Get().
+   *
+   * @param[in] implementation A pointer to the internal shaping object.
+   */
+  explicit DALI_INTERNAL Shaping( Internal::Shaping* implementation );
+
+  /**
+   * @brief Retrieve a handle to the Shaping instance.
+   *
+   * @return A handle to the Shaping.
+   */
+  static Shaping Get();
+
+  /**
+   * Shapes the text.
+   *
+   * Call GetGlyphs() to retrieve the glyphs.
+   *
+   * @param[in] text Pointer to the first character of the text coded in UTF32.
+   * @param[in] numberOfCharacters The number of characters to be shaped
+   * @param[in] fontId The font to be used to shape the text.
+   * @param[in] script The text's script.
+   *
+   * @return The size of the buffer required to get the shaped text.
+   */
+  Length Shape( const Character* const text,
+                Length numberOfCharacters,
+                FontId fontId,
+                Script script );
+
+  /**
+   * Gets the shaped text data.
+   *
+   * @pre @p glyphInfo and @p glyphToCharacterMap must have enough space allocated for the number of glyphs.
+   * Call first Shape() to shape the text and get the number of glyphs.
+   *
+   * @param[out] glyphInfo Vector with indices to the glyph within the font, glyph's metrics and advance.
+   * @param[out] glyphToCharacterMap The glyph to character conversion map.
+   */
+  void GetGlyphs( GlyphInfo* glyphInfo,
+                  CharacterIndex* glyphToCharacterMap );
+};
+
+} // namespace TextAbstraction
+
+} // namespace Dali
+
+#endif // __DALI_PLATFORM_TEXT_ABSTRACTION_SHAPING_H__
diff --git a/text/dali/public-api/text-abstraction/text-abstraction-definitions.h b/text/dali/public-api/text-abstraction/text-abstraction-definitions.h
new file mode 100644 (file)
index 0000000..b4e48ab
--- /dev/null
@@ -0,0 +1,64 @@
+#ifndef __DALI_TEXT_ABSTRACTION_DEFINITIONS_H__
+#define __DALI_TEXT_ABSTRACTION_DEFINITIONS_H__
+
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <stdint.h>
+
+namespace Dali
+{
+
+namespace TextAbstraction
+{
+
+typedef uint32_t FontId;          ///< The unique identifier for a font face (generated by FontClient)
+typedef uint32_t PointSize26Dot6; ///< The point size in 26.6 fractional points
+typedef uint32_t FaceIndex;       ///< Used with fonts which allow several font faces
+typedef uint32_t GlyphIndex;      ///< Uniquely identifies a glyph within a particular font
+typedef uint32_t Character;       ///< A UTF-32 representation of a character
+typedef uint32_t CharacterIndex;  ///< An index into an array of characters
+typedef uint32_t Length;          ///< The length of an array
+typedef uint32_t BidiInfoIndex;   ///< Index to the bidirectional info for a paragraph.
+typedef char     LineBreakInfo;   ///< Line break info (must break, allow break, no break).
+typedef char     WordBreakInfo;   ///< Word break info (break, no break).
+
+/**
+ * @brief Enumerates the possible line break info values.
+ */
+enum
+{
+  LINE_MUST_BREAK  = 0u, ///< Text must be broken into a new line.
+  LINE_ALLOW_BREAK = 1u, ///< Is possible to break the text into a new line.
+  LINE_NO_BREAK    = 2u  ///< Text can't be broken into a new line.
+};
+
+/**
+ * @brief Enumerates the possible word break info values.
+ */
+enum
+{
+  WORD_BREAK    = 0u, ///< Text can be broken into a new word.
+  WORD_NO_BREAK = 1u, ///< Text can't be broken into a new word.
+};
+
+} // namespace TextAbstraction
+
+} // namespace Dali
+
+#endif // __DALI_TEXT_ABSTRACTION_DEFINITIONS_H__
diff --git a/text/dali/public-api/text-abstraction/text-abstraction.h b/text/dali/public-api/text-abstraction/text-abstraction.h
new file mode 100644 (file)
index 0000000..470e176
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef __DALI_TEXT_ABSTRACTION_H__
+#define __DALI_TEXT_ABSTRACTION_H__
+
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dali/public-api/text-abstraction/bidirectional-support.h>
+#include <dali/public-api/text-abstraction/font-client.h>
+#include <dali/public-api/text-abstraction/font-metrics.h>
+#include <dali/public-api/text-abstraction/glyph-info.h>
+#include <dali/public-api/text-abstraction/script.h>
+#include <dali/public-api/text-abstraction/segmentation.h>
+#include <dali/public-api/text-abstraction/shaping.h>
+
+#endif //__DALI_TEXT_ABSTRACTION_H__
diff --git a/text/file.list b/text/file.list
new file mode 100644 (file)
index 0000000..bd8a3ce
--- /dev/null
@@ -0,0 +1,27 @@
+# Add local source files here
+
+text_abstraction_src_files = \
+   $(text_src_dir)/dali/public-api/text-abstraction/bidirectional-support.cpp \
+   $(text_src_dir)/dali/public-api/text-abstraction/font-client.cpp \
+   $(text_src_dir)/dali/public-api/text-abstraction/font-list.cpp \
+   $(text_src_dir)/dali/public-api/text-abstraction/font-metrics.cpp \
+   $(text_src_dir)/dali/public-api/text-abstraction/glyph-info.cpp \
+   $(text_src_dir)/dali/public-api/text-abstraction/segmentation.cpp \
+   $(text_src_dir)/dali/public-api/text-abstraction/shaping.cpp \
+   $(text_src_dir)/dali/internal/text-abstraction/bidirectional-support-impl.cpp \
+   $(text_src_dir)/dali/internal/text-abstraction/font-client-impl.cpp \
+   $(text_src_dir)/dali/internal/text-abstraction/font-client-plugin-impl.cpp \
+   $(text_src_dir)/dali/internal/text-abstraction/segmentation-impl.cpp \
+   $(text_src_dir)/dali/internal/text-abstraction/shaping-impl.cpp
+
+text_abstraction_header_files = \
+   $(text_src_dir)/dali/public-api/text-abstraction/bidirectional-support.h \
+   $(text_src_dir)/dali/public-api/text-abstraction/font-client.h \
+   $(text_src_dir)/dali/public-api/text-abstraction/font-list.h \
+   $(text_src_dir)/dali/public-api/text-abstraction/font-metrics.h \
+   $(text_src_dir)/dali/public-api/text-abstraction/glyph-info.h \
+   $(text_src_dir)/dali/public-api/text-abstraction/script.h \
+   $(text_src_dir)/dali/public-api/text-abstraction/segmentation.h \
+   $(text_src_dir)/dali/public-api/text-abstraction/shaping.h \
+   $(text_src_dir)/dali/public-api/text-abstraction/text-abstraction.h \
+   $(text_src_dir)/dali/public-api/text-abstraction/text-abstraction-definitions.h