From f0ea50a46e5de0e9729eef73e3458bb31888575b Mon Sep 17 00:00:00 2001
From: Paul Wisbey
Date: Wed, 17 Dec 2014 13:33:34 +0000
Subject: [PATCH] Initial removal of Text features
Change-Id: Ida48061b0ee3d9ab87947154c8868cb31c0682e7
---
adaptors/common/object-profiler.cpp | 1 -
adaptors/common/style-monitor-impl.cpp | 8 +-
.../dali-test-suite-utils/dali-test-suite-utils.h | 35 -
.../test-platform-abstraction.cpp | 317 +-------
.../test-platform-abstraction.h | 116 +--
platform-abstractions/interfaces/font-controller.h | 145 ----
.../slp/data-cache/metrics-cache.h | 69 --
platform-abstractions/slp/file.list | 5 -
.../slp/font-platform/font-controller-impl.cpp | 798 ---------------------
.../slp/font-platform/font-controller-impl.h | 254 -------
.../debug/resource-loader-debug.cpp | 38 -
.../resource-loader/debug/resource-loader-debug.h | 3 -
.../slp/resource-loader/loader-font.cpp | 363 ----------
.../slp/resource-loader/loader-font.h | 127 ----
.../slp/resource-loader/resource-loader.cpp | 325 ---------
.../slp/resource-loader/resource-loader.h | 106 ---
.../resource-loader/resource-text-requester.cpp | 141 ----
.../slp/resource-loader/resource-text-requester.h | 97 ---
.../slp/resource-loader/resource-thread-text.cpp | 286 --------
.../slp/resource-loader/resource-thread-text.h | 144 ----
.../slp/slp-platform-abstraction.cpp | 219 ------
.../slp/slp-platform-abstraction.h | 104 ---
22 files changed, 7 insertions(+), 3694 deletions(-)
delete mode 100644 platform-abstractions/interfaces/font-controller.h
delete mode 100644 platform-abstractions/slp/data-cache/metrics-cache.h
delete mode 100755 platform-abstractions/slp/font-platform/font-controller-impl.cpp
delete mode 100644 platform-abstractions/slp/font-platform/font-controller-impl.h
delete mode 100644 platform-abstractions/slp/resource-loader/loader-font.cpp
delete mode 100644 platform-abstractions/slp/resource-loader/loader-font.h
delete mode 100644 platform-abstractions/slp/resource-loader/resource-text-requester.cpp
delete mode 100644 platform-abstractions/slp/resource-loader/resource-text-requester.h
delete mode 100644 platform-abstractions/slp/resource-loader/resource-thread-text.cpp
delete mode 100644 platform-abstractions/slp/resource-loader/resource-thread-text.h
diff --git a/adaptors/common/object-profiler.cpp b/adaptors/common/object-profiler.cpp
index 92eabc9..fe7c956 100644
--- a/adaptors/common/object-profiler.cpp
+++ b/adaptors/common/object-profiler.cpp
@@ -175,7 +175,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 },
diff --git a/adaptors/common/style-monitor-impl.cpp b/adaptors/common/style-monitor-impl.cpp
index 58e02e2..beafbe3 100644
--- a/adaptors/common/style-monitor-impl.cpp
+++ b/adaptors/common/style-monitor-impl.cpp
@@ -89,7 +89,7 @@ void StyleMonitor::StyleChanged(StyleChange styleChange)
{
if (styleChange.defaultFontChange || styleChange.defaultFontSizeChange)
{
- mPlatformAbstraction.UpdateDefaultsFromDevice();
+ //mPlatformAbstraction.UpdateDefaultsFromDevice();
}
EmitStyleChangeSignal(styleChange);
@@ -97,12 +97,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
diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/dali-test-suite-utils.h b/automated-tests/src/dali-adaptor/dali-test-suite-utils/dali-test-suite-utils.h
index 375fb90..44be6c4 100644
--- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/dali-test-suite-utils.h
+++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/dali-test-suite-utils.h
@@ -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& 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
diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-platform-abstraction.cpp b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-platform-abstraction.cpp
index aa1b5b2..596ecba 100644
--- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-platform-abstraction.cpp
+++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-platform-abstraction.cpp
@@ -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 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 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& 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& 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& 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& glyphMetricsContainer )
-{
- mReadMetricsResult = success;
- mReadMetrics = glyphMetricsContainer; // copy
-}
-
} // namespace Dali
diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-platform-abstraction.h b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-platform-abstraction.h
index 54cb154..63df1c8 100644
--- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-platform-abstraction.h
+++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-platform-abstraction.h
@@ -26,7 +26,6 @@
#include
#include
-#include
#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& 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& 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& 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& 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 mReadMetrics;
LoadFileResult mLoadFileResult;
bool mSaveFileResult;
- mutable FontListMode mFontListMode;
};
} // Dali
diff --git a/platform-abstractions/interfaces/font-controller.h b/platform-abstractions/interfaces/font-controller.h
deleted file mode 100644
index 83a8945..0000000
--- a/platform-abstractions/interfaces/font-controller.h
+++ /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
-
-// EXTERNAL INCLUDES
-#include
-
-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 StyledFontFamily;
-
- /**
- * Font list typedef.
- */
- typedef std::vector 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.h b/platform-abstractions/slp/data-cache/metrics-cache.h
deleted file mode 100644
index 01ec2bd..0000000
--- a/platform-abstractions/slp/data-cache/metrics-cache.h
+++ /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
-#include
-
-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& 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
diff --git a/platform-abstractions/slp/file.list b/platform-abstractions/slp/file.list
index 8f34b65..b92b160 100755
--- a/platform-abstractions/slp/file.list
+++ b/platform-abstractions/slp/file.list
@@ -4,28 +4,23 @@ 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-distance-field.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
index 80a9333..0000000
--- a/platform-abstractions/slp/font-platform/font-controller-impl.cpp
+++ /dev/null
@@ -1,798 +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
-#include
-
-// EXTERNAL HEADERS
-#include
-
-
-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( 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( 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( 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() )
- {
- CreatePreferedFontList();
- }
-
- // 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 )
-{
- // reload font configuration files
- const bool ok = FcInitReinitialize();
- DALI_ASSERT_ALWAYS( ok && "FcInitReinitialize failed");
-
- CreatePreferedFontList();
-}
-
-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( styledFontFamily.first.c_str() ) );
-
- // add a property to the pattern for the font family
- FcPatternAddString( fontFamilyPattern, FC_STYLE, reinterpret_cast( styledFontFamily.second.c_str() ) );
-
- // Add a property of the pattern, to say we want to match TrueType fonts
- FcPatternAddString( fontFamilyPattern , FC_FONTFORMAT, reinterpret_cast( 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( )
-{
- StyledFontFamily tizenFont;
- tizenFont.first = DEFAULT_FONT_FAMILY_NAME;
- tizenFont.second = DEFAULT_FONT_STYLE;
-
- // clear the current list
- ClearPreferredFontList();
-
- FcPattern* searchPattern = CreateFontFamilyPattern( tizenFont );
-
- 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::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
index 0283882..0000000
--- a/platform-abstractions/slp/font-platform/font-controller-impl.h
+++ /dev/null
@@ -1,254 +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
-#include
-
-// EXTERNAL INCLUDES
-#include
-
-
-// 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.
- */
- void CreatePreferedFontList();
-
- /**
- * 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 FontFamilyLookup; ///< lookup for font names and font cache itmes
-
- typedef std::map 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 mPreferredFonts; ///< Ordered list of preferred fonts.
- Vector mPreferredFontsValidated; ///< Stores which of the prefered fonts have been validated.
-
-};
-
-} // namespace SlpPlatform
-
-} // namespace Dali
-
-#endif // __DALI_SLP_PLATFORM_FONT_CONTROLLER_H__
diff --git a/platform-abstractions/slp/resource-loader/debug/resource-loader-debug.cpp b/platform-abstractions/slp/resource-loader/debug/resource-loader-debug.cpp
index 62dd906..6afd79c 100644
--- a/platform-abstractions/slp/resource-loader/debug/resource-loader-debug.cpp
+++ b/platform-abstractions/slp/resource-loader/debug/resource-loader-debug.cpp
@@ -19,11 +19,6 @@
#if defined(DEBUG_ENABLED)
-#include
-#include
-#include
-#include
-
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(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(partialResource.resource.Get());
- const GlyphSet::CharacterList& characterList = glyphSet->GetCharacterList();
- std::string textString;
-
- for(std::size_t i=0, length=characterList.size(); i(gm.code) << "(" << gm.xPosition << "," << gm.yPosition
- << " " << (gm.quality?"H":"L") << ") ";
- textString.append(oss.str());
- }
- return textString;
-}
-
} //SlpPlatform
} //Dali
diff --git a/platform-abstractions/slp/resource-loader/debug/resource-loader-debug.h b/platform-abstractions/slp/resource-loader/debug/resource-loader-debug.h
index 87a54c2..8d7ae61 100644
--- a/platform-abstractions/slp/resource-loader/debug/resource-loader-debug.h
+++ b/platform-abstractions/slp/resource-loader/debug/resource-loader-debug.h
@@ -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
index 3a06871..0000000
--- a/platform-abstractions/slp/resource-loader/loader-font.cpp
+++ /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
-
-#include "loader-font.h"
-#include
-
-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(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(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 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( 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
index e18f3f3..0000000
--- a/platform-abstractions/slp/resource-loader/loader-font.h
+++ /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
-
-#include
-#include
-#include
-#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__
diff --git a/platform-abstractions/slp/resource-loader/resource-loader.cpp b/platform-abstractions/slp/resource-loader/resource-loader.cpp
index 64b7912..e92eb55 100755
--- a/platform-abstractions/slp/resource-loader/resource-loader.cpp
+++ b/platform-abstractions/slp/resource-loader/resource-loader.cpp
@@ -36,10 +36,7 @@
#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(capsHeight.value) / ((slpFace->face->ascender / 64.0f) * 0.95f);
-
- result.value = static_cast(roundf(scale * (slpFace->face->height / 64.0f)));
-
- delete slpFace;
- slpFace = NULL;
- }
- }
-
- return result;
-}
-
-void ResourceLoader::GetFontList( Dali::Integration::PlatformAbstraction::FontListMode mode, std::vector& 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 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
diff --git a/platform-abstractions/slp/resource-loader/resource-loader.h b/platform-abstractions/slp/resource-loader/resource-loader.h
index dccb366..b8801e4 100644
--- a/platform-abstractions/slp/resource-loader/resource-loader.h
+++ b/platform-abstractions/slp/resource-loader/resource-loader.h
@@ -19,14 +19,10 @@
*/
#include
-#include
#include
#include
#include
-#include
-#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& 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
index d00fd7d..0000000
--- a/platform-abstractions/slp/resource-loader/resource-text-requester.cpp
+++ /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(request.GetType());
- if( textRequest )
- {
- TextResourceType::CharacterList& text(textRequest->mCharacterList);
-
- // Remove from stored request
- RemoveInvisibleCharacters( text );
- if( text.empty() )
- {
- IntrusivePtr 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
index cfd881b..0000000
--- a/platform-abstractions/slp/resource-loader/resource-text-requester.h
+++ /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
-#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
index 779420b..0000000
--- a/platform-abstractions/slp/resource-loader/resource-thread-text.cpp
+++ /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
-#include
-#include
-#include FT_FREETYPE_H
-#include FT_GLYPH_H
-
-#include
-#include
-
-
-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(*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 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(); iGetPackedPixelsProfile()->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 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
index 778f00e..0000000
--- a/platform-abstractions/slp/resource-loader/resource-thread-text.h
+++ /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
-
-
-#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__
diff --git a/platform-abstractions/slp/slp-platform-abstraction.cpp b/platform-abstractions/slp/slp-platform-abstraction.cpp
index 188aced..a674aed 100644
--- a/platform-abstractions/slp/slp-platform-abstraction.cpp
+++ b/platform-abstractions/slp/slp-platform-abstraction.cpp
@@ -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 µSeconds)
@@ -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& 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& 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& 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
diff --git a/platform-abstractions/slp/slp-platform-abstraction.h b/platform-abstractions/slp/slp-platform-abstraction.h
index e32f979..a050e23 100644
--- a/platform-abstractions/slp/slp-platform-abstraction.h
+++ b/platform-abstractions/slp/slp-platform-abstraction.h
@@ -125,66 +125,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& fontList ) const;
-
- /**
* @copydoc PlatformAbstraction::LoadFile()
*/
virtual bool LoadFile( const std::string& filename, std::vector< unsigned char >& buffer ) const;
@@ -200,61 +145,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& 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& 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;
};
--
2.7.4