From: Paul Wisbey Date: Thu, 29 Jan 2015 13:11:50 +0000 (+0000) Subject: Moved TextAbstraction to use absolute paths X-Git-Tag: new_text_0.1~39 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git;a=commitdiff_plain;h=f3f682b2620cc6ddb66c6325ba86c3e11f9550e6 Moved TextAbstraction to use absolute paths Minor tweak to GlyphMetrics structure Change-Id: Ibf803bcc2dfe705974d314ccf79d451d56989c42 --- diff --git a/build/tizen/adaptor/Makefile.am b/build/tizen/adaptor/Makefile.am index 1fb2967..6494152 100644 --- a/build/tizen/adaptor/Makefile.am +++ b/build/tizen/adaptor/Makefile.am @@ -29,8 +29,8 @@ portable_platform_abstraction_src_dir = ../../../platform-abstractions/portable include ../../../platform-abstractions/slp/file.list # Text Abstraction -text_abstraction_src_dir = ../../../text-abstraction -include ../../../text-abstraction/file.list +text_src_dir = ../../../text +include ../../../text/file.list # Internal Common adaptor_common_dir = ../../../adaptors/common @@ -185,7 +185,7 @@ libdali_adaptor_la_includes = \ -I../../../adaptors/public-api \ -I../../../adaptors/public-api/adaptor-framework \ -I../../../adaptors/common \ - -I../../../text-abstraction \ + -I../../../text \ -I../../../adaptors/ if WAYLAND libdali_adaptor_la_includes += \ diff --git a/platform-abstractions/slp/data-cache/metrics-cache.cpp b/platform-abstractions/slp/data-cache/metrics-cache.cpp deleted file mode 100644 index 822bb08..0000000 --- a/platform-abstractions/slp/data-cache/metrics-cache.cpp +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include "metrics-cache.h" - -// EXTERNAL HEADERS -#include -#include -#include -#include -#include -#include - -// INTERNAL HEADERS -#include - - -namespace Dali -{ - -namespace // Anonymous namespace -{ - -const std::size_t VERSION_SIZE( sizeof(__DATE__ "-" __TIME__) ); // (date-time) -const char FILE_VERSION[ VERSION_SIZE ] = __DATE__ "-" __TIME__; // Updates with each build - -const size_t CHECKSUM_SIZE( sizeof( size_t ) ); -const size_t NUMBER_GLOBAL_METRICS( 9 ); // line height, ascender, unitsPerEM, underlinePosition, underlineThickness, maxWidth, maxHeight, padAdjustX, padAdjustY -const size_t GLOBAL_METRICS_SIZE( NUMBER_GLOBAL_METRICS * sizeof( float ) ); -const size_t GLOBAL_METRIC_HEADER_SIZE( GLOBAL_METRICS_SIZE + CHECKSUM_SIZE + VERSION_SIZE ); -const std::string DALI_DEFAULT_FONT_CACHE_PATH( DALI_USER_FONT_CACHE_DIR ); -const std::string METRICS_EXTENSION( ".metrics" ); - - -std::string CreateFileName(const std::string& fontFamily, const std::string& fontStyle) -{ - std::string cacheFileName(DALI_DEFAULT_FONT_CACHE_PATH + fontFamily + "-" + fontStyle + METRICS_EXTENSION); - - std::replace(cacheFileName.begin(), cacheFileName.end(), ' ', '-' ); - return cacheFileName; -} - -std::size_t CalculateGlobalMetricCheckSum( const Integration::GlobalMetrics& globalMetrics ) -{ - int checksum = static_cast( globalMetrics.lineHeight ) + - static_cast( globalMetrics.ascender ) + - static_cast( globalMetrics.unitsPerEM ) + - static_cast( globalMetrics.underlinePosition ) + - static_cast( globalMetrics.underlineThickness ) + - static_cast( globalMetrics.maxWidth ) + - static_cast( globalMetrics.maxHeight ) + - static_cast( globalMetrics.padAdjustX ) + - static_cast( globalMetrics.padAdjustY ); - - - return boost::hash_value( checksum ); - -} - -std::size_t CalculateGlyphCheckSum( const Integration::GlyphMetrics& metrics ) -{ - int checksum = static_cast( metrics.code ) + - static_cast( metrics.width ) + - static_cast( metrics.height ) + - static_cast( metrics.top ) + - static_cast( metrics.left ) + - static_cast( metrics.xAdvance); - - return boost::hash_value( checksum ); -} - -bool ReadGlyphMetrics( std::ifstream& file, Integration::GlyphMetrics& metrics ) -{ - std::size_t checkSumRead; - uint32_t code; - - file.read( reinterpret_cast( &code ), sizeof( uint32_t ) ); - file.read( reinterpret_cast( &metrics.width ), sizeof( float ) ); - file.read( reinterpret_cast( &metrics.height ), sizeof( float ) ); - file.read( reinterpret_cast( &metrics.top ), sizeof( float ) ); - file.read( reinterpret_cast( &metrics.left ), sizeof( float ) ); - file.read( reinterpret_cast( &metrics.xAdvance), sizeof( float ) ); - file.read( reinterpret_cast( &checkSumRead ), sizeof( std::size_t ) ); - - metrics.code = code; // code is now stored as a bit mask so we can't read directly in to it - metrics.quality = Integration::GlyphMetrics::LOW_QUALITY; - - const std::size_t calcCheckSum = CalculateGlyphCheckSum( metrics ); - - return ( calcCheckSum == checkSumRead ); -} - -void WriteGlyphMetrics( std::ofstream& file, const Integration::GlyphMetrics& metrics ) -{ - uint32_t code = metrics.code; // code is stored as a bitmask so we can't write directly from it - file.write( reinterpret_cast( &code ), sizeof( uint32_t ) ); - file.write( reinterpret_cast( &metrics.width ), sizeof( float ) ); - file.write( reinterpret_cast( &metrics.height ), sizeof( float ) ); - file.write( reinterpret_cast( &metrics.top ), sizeof( float ) ); - file.write( reinterpret_cast( &metrics.left ), sizeof( float ) ); - file.write( reinterpret_cast( &metrics.xAdvance ), sizeof( float ) ); - - const std::size_t calcCheckSum = CalculateGlyphCheckSum( metrics ); - - file.write( reinterpret_cast( &calcCheckSum ), sizeof( std::size_t ) ); -} - -bool ReadGlyphGlobalMetrics( std::ifstream& file, Integration::GlobalMetrics& globalMetrics ) -{ - char version_string[ VERSION_SIZE ]; - - // Check file version - file.read( version_string, VERSION_SIZE ); - if( strncmp( version_string, FILE_VERSION, VERSION_SIZE ) != 0 ) - { - DALI_LOG_WARNING( "Glyph metrics file version mismatch\n" ); - return false; - } - - std::size_t checkSumRead; - - file.read( reinterpret_cast( &globalMetrics.lineHeight ), sizeof( float ) ); - file.read( reinterpret_cast( &globalMetrics.ascender ), sizeof( float ) ); - file.read( reinterpret_cast( &globalMetrics.unitsPerEM ), sizeof( float ) ); - file.read( reinterpret_cast( &globalMetrics.underlinePosition ), sizeof( float ) ); - file.read( reinterpret_cast( &globalMetrics.underlineThickness), sizeof( float ) ); - file.read( reinterpret_cast( &globalMetrics.maxWidth), sizeof( float ) ); - file.read( reinterpret_cast( &globalMetrics.maxHeight), sizeof( float ) ); - file.read( reinterpret_cast( &globalMetrics.padAdjustX), sizeof( float ) ); - file.read( reinterpret_cast( &globalMetrics.padAdjustY), sizeof( float ) ); - file.read( reinterpret_cast( &checkSumRead ), sizeof( std::size_t ) ); - - const std::size_t calcCheckSum = CalculateGlobalMetricCheckSum( globalMetrics ); - - return (calcCheckSum == checkSumRead); -} - -void WriteGlyphGlobalMetrics( std::ofstream &file, const Integration::GlobalMetrics& globalMetrics ) -{ - file.write( FILE_VERSION, VERSION_SIZE ); - - file.write( reinterpret_cast( &globalMetrics.lineHeight ), sizeof( float ) ); - file.write( reinterpret_cast( &globalMetrics.ascender ), sizeof( float ) ); - file.write( reinterpret_cast( &globalMetrics.unitsPerEM ), sizeof( float ) ); - file.write( reinterpret_cast( &globalMetrics.underlinePosition ), sizeof( float ) ); - file.write( reinterpret_cast( &globalMetrics.underlineThickness), sizeof( float ) ); - file.write( reinterpret_cast( &globalMetrics.maxWidth), sizeof( float ) ); - file.write( reinterpret_cast( &globalMetrics.maxHeight), sizeof( float ) ); - file.write( reinterpret_cast( &globalMetrics.padAdjustX ), sizeof( float ) ); - file.write( reinterpret_cast( &globalMetrics.padAdjustY ), sizeof( float ) ); - - const std::size_t calcCheckSum = CalculateGlobalMetricCheckSum( globalMetrics ); - - file.write( reinterpret_cast( &calcCheckSum ), sizeof( std::size_t ) ); -} - -} // Anonymous namespace - -namespace SlpPlatform -{ -namespace MetricsCache -{ - -bool ReadGlobal( const std::string& fontFamily, const std::string& fontStyle, Integration::GlobalMetrics& globalMetrics) -{ - bool success = false; - - std::string fileName = CreateFileName( fontFamily, fontStyle ); - - std::ifstream file( fileName.c_str(), std::ios::in | std::ios::binary ); - - if( file.good() ) - { - file.seekg( std::ios::beg ); - - success = ReadGlyphGlobalMetrics( file, globalMetrics ); - - // check the metrics had the correct size. - // this is just incase the metrics file is the wrong size, but the checksum magically worked. - if( file.eof() ) - { - // file.eof is true only after an invalid read - success = false; - DALI_LOG_WARNING("Metrics file invalid read\n" ); - } - - file.close(); - } - - return success; -} - -void WriteGlobal( const std::string& fontFamily, const std::string& fontStyle, const Integration::GlobalMetrics& globalMetrics) -{ - std::string fileName = CreateFileName( fontFamily, fontStyle ); - std::ios_base::openmode mode = ( std::ios::out | std::ios::binary | std::ios::trunc ); - - std::ofstream file( fileName.c_str(), mode ); - - if( file.good() ) - { - WriteGlyphGlobalMetrics( file, globalMetrics ); - - file.close(); - } -} - -bool Read( const std::string& fontFamily, const std::string& fontStyle, std::vector& glyphMetricsContainer ) -{ - std::string fileName = CreateFileName( fontFamily, fontStyle ); - bool success( false ); - - // Read from default glyph cache only when there is any metric loaded. - std::ifstream file( fileName.c_str(), std::ios::in | std::ios::binary ); - - if( file.good() ) - { - // skip over the gobal metrics - file.seekg( GLOBAL_METRIC_HEADER_SIZE , std::ios::beg ); - - bool checkSumPassed(true); - - // file.good() is set to false if end of file is reached, or an error occurred - while( checkSumPassed && file.good() ) - { - Integration::GlyphMetrics glyphMetrics; - - checkSumPassed = ReadGlyphMetrics( file, glyphMetrics ); - - // eof only returns true after a failed read - if( file.eof() ) - { - // this will occur when we hit the end of the file. - checkSumPassed = true; - break; - } - - if( checkSumPassed ) - { - // fill the map with cached metrics. - glyphMetricsContainer.push_back(glyphMetrics); - } - else - { - DALI_LOG_WARNING("check sum failed for glyph %d in file \n", glyphMetrics.code, fileName.c_str() ); - } - } - - file.close(); - success = checkSumPassed; - } - - return success; -} - -void Write( const std::string& fontFamily, const std::string& fontStyle, const Integration::GlyphSet& glyphSet ) -{ - // append the file. - std::string fileName = CreateFileName( fontFamily, fontStyle ); - std::ofstream file( fileName.c_str(), std::ios::out | std::ios::binary | std::ios::app ); - - if( file.good() ) - { - const Integration::GlyphSet::CharacterList& characterList = glyphSet.GetCharacterList(); - - for( Integration::GlyphSet::CharacterConstIter it = characterList.begin(), endIt = characterList.end(); it != endIt; ++it ) - { - WriteGlyphMetrics( file, it->second ); - } - - file.close(); - } - else - { - DALI_LOG_WARNING( "Failed to open metric to file %s", fileName.c_str() ); - } -} - - -} // MetricsCache -} // SlpPlatform -} // Dali diff --git a/text-abstraction/file.list b/text-abstraction/file.list deleted file mode 100644 index 1ec96a3..0000000 --- a/text-abstraction/file.list +++ /dev/null @@ -1,22 +0,0 @@ -# Add local source files here - -text_abstraction_src_files = \ - $(text_abstraction_src_dir)/public-api/font-client.cpp \ - $(text_abstraction_src_dir)/public-api/font-list.cpp \ - $(text_abstraction_src_dir)/public-api/reordering.cpp \ - $(text_abstraction_src_dir)/public-api/segmentation.cpp \ - $(text_abstraction_src_dir)/public-api/shaping.cpp \ - $(text_abstraction_src_dir)/internal/font-client-impl.cpp \ - $(text_abstraction_src_dir)/internal/reordering-impl.cpp \ - $(text_abstraction_src_dir)/internal/segmentation-impl.cpp \ - $(text_abstraction_src_dir)/internal/shaping-impl.cpp - -text_abstraction_header_files = \ - $(text_abstraction_src_dir)/public-api/font-client.h \ - $(text_abstraction_src_dir)/public-api/font-list.h \ - $(text_abstraction_src_dir)/public-api/glyph-metrics.h \ - $(text_abstraction_src_dir)/public-api/reordering.h \ - $(text_abstraction_src_dir)/public-api/segmentation.h \ - $(text_abstraction_src_dir)/public-api/shaping.h \ - $(text_abstraction_src_dir)/public-api/text-abstraction.h \ - $(text_abstraction_src_dir)/public-api/text-type-definitions.h diff --git a/text-abstraction/internal/font-client-impl.cpp b/text/dali/internal/text-abstraction/font-client-impl.cpp similarity index 96% rename from text-abstraction/internal/font-client-impl.cpp rename to text/dali/internal/text-abstraction/font-client-impl.cpp index c3a1ac1..b234399 100644 --- a/text-abstraction/internal/font-client-impl.cpp +++ b/text/dali/internal/text-abstraction/font-client-impl.cpp @@ -257,17 +257,19 @@ struct FontClient::Plugin return FontId(0); } - bool CreateMetrics( FontId fontId, GlyphMetrics* array, uint32_t size, bool horizontal ) + bool GetGlyphMetrics( GlyphInfo* array, uint32_t size, bool horizontal ) { bool success( true ); - if( fontId > 0 && - fontId-1 < mFontCache.size() ) + for( unsigned int i=0; i 0 && + fontId-1 < mFontCache.size() ) { + FT_Face ftFace = mFontCache[fontId-1].mFreeTypeFace; + int error = FT_Load_Glyph( ftFace, array[i].index, FT_LOAD_DEFAULT ); if( FT_Err_Ok == error ) @@ -292,6 +294,10 @@ struct FontClient::Plugin success = false; } } + else + { + success = false; + } } return success; @@ -478,11 +484,11 @@ GlyphIndex FontClient::GetGlyphIndex( FontId fontId, Character charcode ) return mPlugin->GetGlyphIndex( fontId, charcode ); } -bool FontClient::CreateMetrics( FontId fontId, GlyphMetrics* array, uint32_t size, bool horizontal ) +bool FontClient::GetGlyphMetrics( GlyphInfo* array, uint32_t size, bool horizontal ) { CreatePlugin(); - return mPlugin->CreateMetrics( fontId, array, size, horizontal ); + return mPlugin->GetGlyphMetrics( array, size, horizontal ); } BitmapImage FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex ) diff --git a/text-abstraction/internal/font-client-impl.h b/text/dali/internal/text-abstraction/font-client-impl.h similarity index 95% rename from text-abstraction/internal/font-client-impl.h rename to text/dali/internal/text-abstraction/font-client-impl.h index 7e948ed..3624f82 100644 --- a/text-abstraction/internal/font-client-impl.h +++ b/text/dali/internal/text-abstraction/font-client-impl.h @@ -19,9 +19,11 @@ */ // EXTERNAL INCLUDES -#include #include +// INTERNAL INCLUDES +#include + namespace Dali { @@ -86,7 +88,7 @@ public: /** * @copydoc Dali::FontClient::CreateMetrics() */ - bool CreateMetrics( FontId fontId, GlyphMetrics* array, uint32_t size, bool horizontal ); + bool GetGlyphMetrics( GlyphInfo* array, uint32_t size, bool horizontal ); /** * @copydoc Dali::FontClient::CreateBitmap() diff --git a/text-abstraction/internal/reordering-impl.cpp b/text/dali/internal/text-abstraction/reordering-impl.cpp similarity index 100% rename from text-abstraction/internal/reordering-impl.cpp rename to text/dali/internal/text-abstraction/reordering-impl.cpp diff --git a/text-abstraction/internal/reordering-impl.h b/text/dali/internal/text-abstraction/reordering-impl.h similarity index 96% rename from text-abstraction/internal/reordering-impl.h rename to text/dali/internal/text-abstraction/reordering-impl.h index 3ae89e3..b1bfb56 100644 --- a/text-abstraction/internal/reordering-impl.h +++ b/text/dali/internal/text-abstraction/reordering-impl.h @@ -19,10 +19,10 @@ */ // EXTERNAL INCLUDES -#include #include - +// INTERNAL INCLUDES +#include namespace Dali { diff --git a/text-abstraction/internal/segmentation-impl.cpp b/text/dali/internal/text-abstraction/segmentation-impl.cpp similarity index 100% rename from text-abstraction/internal/segmentation-impl.cpp rename to text/dali/internal/text-abstraction/segmentation-impl.cpp diff --git a/text-abstraction/internal/segmentation-impl.h b/text/dali/internal/text-abstraction/segmentation-impl.h similarity index 96% rename from text-abstraction/internal/segmentation-impl.h rename to text/dali/internal/text-abstraction/segmentation-impl.h index fbb67ac..c87d594 100644 --- a/text-abstraction/internal/segmentation-impl.h +++ b/text/dali/internal/text-abstraction/segmentation-impl.h @@ -19,10 +19,10 @@ */ // EXTERNAL INCLUDES -#include #include - +// INTERNAL INCLUDES +#include namespace Dali { diff --git a/text-abstraction/internal/shaping-impl.cpp b/text/dali/internal/text-abstraction/shaping-impl.cpp similarity index 100% rename from text-abstraction/internal/shaping-impl.cpp rename to text/dali/internal/text-abstraction/shaping-impl.cpp diff --git a/text-abstraction/internal/shaping-impl.h b/text/dali/internal/text-abstraction/shaping-impl.h similarity index 96% rename from text-abstraction/internal/shaping-impl.h rename to text/dali/internal/text-abstraction/shaping-impl.h index 85bf4ab..cfdd625 100644 --- a/text-abstraction/internal/shaping-impl.h +++ b/text/dali/internal/text-abstraction/shaping-impl.h @@ -19,10 +19,10 @@ */ // EXTERNAL INCLUDES -#include #include - +// INTERNAL INCLUDES +#include namespace Dali { diff --git a/text-abstraction/public-api/font-client.cpp b/text/dali/public-api/text-abstraction/font-client.cpp similarity index 80% rename from text-abstraction/public-api/font-client.cpp rename to text/dali/public-api/text-abstraction/font-client.cpp index b9d59b2..49aa22e 100644 --- a/text-abstraction/public-api/font-client.cpp +++ b/text/dali/public-api/text-abstraction/font-client.cpp @@ -16,10 +16,10 @@ */ // CLASS HEADER -#include "font-client.h" +#include // INTERNAL INCLUDES -#include +#include namespace Dali { @@ -27,6 +27,11 @@ namespace Dali namespace TextAbstraction { +FontClient FontClient::Get() +{ + return Internal::FontClient::Get(); +} + FontClient::FontClient() { } @@ -35,14 +40,15 @@ FontClient::~FontClient() { } -FontClient::FontClient( Internal::FontClient* internal ) -: BaseHandle( internal ) +FontClient::FontClient( const FontClient& handle ) +: BaseHandle( handle ) { } -FontClient FontClient::Get() +FontClient& FontClient::operator=( const FontClient& handle ) { - return Internal::FontClient::Get(); + BaseHandle::operator=( handle ); + return *this; } void FontClient::SetDpi( unsigned int horizontalDpi, unsigned int verticalDpi ) @@ -75,9 +81,9 @@ GlyphIndex FontClient::GetGlyphIndex( FontId fontId, Character charcode ) return GetImplementation(*this).GetGlyphIndex( fontId, charcode ); } -bool FontClient::CreateMetrics( FontId fontId, GlyphMetrics* array, uint32_t size, bool horizontal ) +bool FontClient::GetGlyphMetrics( GlyphInfo* array, uint32_t size, bool horizontal ) { - return GetImplementation(*this).CreateMetrics( fontId, array, size, horizontal ); + return GetImplementation(*this).GetGlyphMetrics( array, size, horizontal ); } BitmapImage FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex ) @@ -85,6 +91,11 @@ BitmapImage FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex ) return GetImplementation(*this).CreateBitmap( fontId, glyphIndex ); } +FontClient::FontClient( Internal::FontClient* internal ) +: BaseHandle( internal ) +{ +} + } // namespace TextAbstraction } // namespace Dali diff --git a/text-abstraction/public-api/font-client.h b/text/dali/public-api/text-abstraction/font-client.h similarity index 84% rename from text-abstraction/public-api/font-client.h rename to text/dali/public-api/text-abstraction/font-client.h index ef0681f..64aa691 100644 --- a/text-abstraction/public-api/font-client.h +++ b/text/dali/public-api/text-abstraction/font-client.h @@ -21,9 +21,9 @@ #include #include #include -#include "text-type-definitions.h" -#include "glyph-metrics.h" -#include "font-list.h" +#include +#include +#include namespace Dali { @@ -60,6 +60,13 @@ class DALI_IMPORT_API FontClient : public BaseHandle public: /** + * @brief Retrieve a handle to the FontClient instance. + * + * @return A handle to the FontClient + */ + static FontClient Get(); + + /** * @brief Create an uninitialized TextAbstraction handle. */ FontClient(); @@ -72,11 +79,19 @@ public: ~FontClient(); /** - * @brief Retrieve a handle to the FontClient instance. + * @brief This copy constructor is required for (smart) pointer semantics. * - * @return A handle to the FontClient + * @param[in] handle A reference to the copied handle. */ - static FontClient Get(); + FontClient( const FontClient& handle ); + + /** + * @brief This assignment operator is required for (smart) pointer semantics. + * + * @param [in] handle A reference to the copied handle. + * @return A reference to this. + */ + FontClient& operator=( const FontClient& handle ); /** * @brief Set the DPI of the target window. @@ -110,7 +125,7 @@ public: * * @param[in] path The path to a font file. * @param[in] pointSize The point size in 26.6 fractional points; the default point size is 12. - * @param[in] face The index of the font face (optional). + * @param[in] faceIndex The index of the font face (optional). * @return A valid font ID, or zero if the font does not exist. */ FontId GetFontId( const FontPath& path, PointSize26Dot6 pointSize = 12*64, FaceIndex faceIndex = 0 ); @@ -137,14 +152,13 @@ public: /** * @brief Retrieve the metrics for a series of glyphs. * - * @param[in] fontId The ID of the font for these glyphs. - * @param[in,out] metrics An array of metrics with initialized glyph IDs. - * On return, the remaining values will be initialized e.g. glyph size & bearing values. + * @param[in,out] array An array of glyph-info structures with initialized FontId & GlyphIndex values. + * On return, the remaining metrics values will be initialized e.g. glyph size & bearing values. * @param[in] size The size of the array. * @param[in] horizontal True for horizontal layouts (set to false for vertical layouting). - * @return True if metrics were found. + * @return True if all of the requested metrics were found. */ - bool CreateMetrics( FontId fontId, GlyphMetrics* array, uint32_t size, bool horizontal = true ); + bool GetGlyphMetrics( GlyphInfo* array, uint32_t size, bool horizontal = true ); /** * @brief Render a bitmap representation of a glyph. diff --git a/text-abstraction/public-api/font-list.cpp b/text/dali/public-api/text-abstraction/font-list.cpp similarity index 94% rename from text-abstraction/public-api/font-list.cpp rename to text/dali/public-api/text-abstraction/font-list.cpp index 0fc7da7..bd4f986 100644 --- a/text-abstraction/public-api/font-list.cpp +++ b/text/dali/public-api/text-abstraction/font-list.cpp @@ -16,7 +16,7 @@ */ // CLASS HEADER -#include "font-list.h" +#include namespace Dali { diff --git a/text-abstraction/public-api/font-list.h b/text/dali/public-api/text-abstraction/font-list.h similarity index 100% rename from text-abstraction/public-api/font-list.h rename to text/dali/public-api/text-abstraction/font-list.h diff --git a/text-abstraction/public-api/glyph-metrics.h b/text/dali/public-api/text-abstraction/glyph-info.h similarity index 68% rename from text-abstraction/public-api/glyph-metrics.h rename to text/dali/public-api/text-abstraction/glyph-info.h index 8328ce5..8849fd0 100644 --- a/text-abstraction/public-api/glyph-metrics.h +++ b/text/dali/public-api/text-abstraction/glyph-info.h @@ -1,5 +1,5 @@ -#ifndef __DALI_TEXT_ABSTRACTION_GLYPH_METRICS_H__ -#define __DALI_TEXT_ABSTRACTION_GLYPH_METRICS_H__ +#ifndef __DALI_TEXT_ABSTRACTION_GLYPH_INFO_H__ +#define __DALI_TEXT_ABSTRACTION_GLYPH_INFO_H__ /* * Copyright (c) 2015 Samsung Electronics Co., Ltd. @@ -19,7 +19,7 @@ */ // INTERNAL INCLUDES -#include "text-type-definitions.h" +#include namespace Dali { @@ -28,13 +28,14 @@ namespace TextAbstraction { /** - * POD structure for storing glyph metric information. - * The values are expressed in 26.6 fractional pixel format. + * The information describing a glyph (font ID, index, metrics) + * The metrics are expressed in 26.6 fractional pixel format. */ -struct GlyphMetrics +struct GlyphInfo { - GlyphMetrics() - : index( 0 ), + GlyphInfo() + : fontId( 0 ), + index( 0 ), width( 0 ), height( 0 ), xBearing( 0 ), @@ -43,7 +44,8 @@ struct GlyphMetrics { } - GlyphIndex index; ///< Uniquely identifies a glyph for a given FontId + FontId fontId; ///< Identifies the font containing the glyph + GlyphIndex index; ///< Uniquely identifies a glyph for a given FontId uint32_t width; ///< The width of the glyph uint32_t height; ///< The height of the glyph uint32_t xBearing; ///< The distance from the cursor position to the leftmost border of the glyph @@ -55,4 +57,4 @@ struct GlyphMetrics } // TextAbstraction -#endif //__DALI_TEXT_ABSTRACTION_GLYPH_METRICS_H__ +#endif //__DALI_TEXT_ABSTRACTION_GLYPH_INFO_H__ diff --git a/text-abstraction/public-api/reordering.cpp b/text/dali/public-api/text-abstraction/reordering.cpp similarity index 89% rename from text-abstraction/public-api/reordering.cpp rename to text/dali/public-api/text-abstraction/reordering.cpp index 04c6a26..19cab86 100644 --- a/text-abstraction/public-api/reordering.cpp +++ b/text/dali/public-api/text-abstraction/reordering.cpp @@ -16,10 +16,10 @@ */ // CLASS HEADER -#include "reordering.h" +#include // INTERNAL INCLUDES -#include +#include namespace Dali { diff --git a/text-abstraction/public-api/reordering.h b/text/dali/public-api/text-abstraction/reordering.h similarity index 100% rename from text-abstraction/public-api/reordering.h rename to text/dali/public-api/text-abstraction/reordering.h diff --git a/text-abstraction/public-api/segmentation.cpp b/text/dali/public-api/text-abstraction/segmentation.cpp similarity index 89% rename from text-abstraction/public-api/segmentation.cpp rename to text/dali/public-api/text-abstraction/segmentation.cpp index d502f56..636f7a4 100644 --- a/text-abstraction/public-api/segmentation.cpp +++ b/text/dali/public-api/text-abstraction/segmentation.cpp @@ -16,10 +16,10 @@ */ // CLASS HEADER -#include "segmentation.h" +#include // INTERNAL INCLUDES -#include +#include namespace Dali { diff --git a/text-abstraction/public-api/segmentation.h b/text/dali/public-api/text-abstraction/segmentation.h similarity index 100% rename from text-abstraction/public-api/segmentation.h rename to text/dali/public-api/text-abstraction/segmentation.h diff --git a/text-abstraction/public-api/shaping.cpp b/text/dali/public-api/text-abstraction/shaping.cpp similarity index 89% rename from text-abstraction/public-api/shaping.cpp rename to text/dali/public-api/text-abstraction/shaping.cpp index 8d94e8b..49e3bd8 100644 --- a/text-abstraction/public-api/shaping.cpp +++ b/text/dali/public-api/text-abstraction/shaping.cpp @@ -16,10 +16,10 @@ */ // CLASS HEADER -#include "shaping.h" +#include // INTERNAL INCLUDES -#include +#include namespace Dali { diff --git a/text-abstraction/public-api/shaping.h b/text/dali/public-api/text-abstraction/shaping.h similarity index 100% rename from text-abstraction/public-api/shaping.h rename to text/dali/public-api/text-abstraction/shaping.h diff --git a/text-abstraction/public-api/text-type-definitions.h b/text/dali/public-api/text-abstraction/text-abstraction-definitions.h similarity index 87% rename from text-abstraction/public-api/text-type-definitions.h rename to text/dali/public-api/text-abstraction/text-abstraction-definitions.h index be792a6..a423e80 100644 --- a/text-abstraction/public-api/text-type-definitions.h +++ b/text/dali/public-api/text-abstraction/text-abstraction-definitions.h @@ -1,5 +1,5 @@ -#ifndef __DALI_TEXT_ABSTRACTION_TEXT_TYPE_DEFINITIONS_H__ -#define __DALI_TEXT_ABSTRACTION_TEXT_TYPE_DEFINITIONS_H__ +#ifndef __DALI_TEXT_ABSTRACTION_DEFINITIONS_H__ +#define __DALI_TEXT_ABSTRACTION_DEFINITIONS_H__ /* * Copyright (c) 2015 Samsung Electronics Co., Ltd. @@ -38,4 +38,4 @@ typedef uint32_t Character; ///< A UTF-32 representation of a character } // namespace Dali -#endif // __DALI_TEXT_ABSTRACTION_TEXT_TYPE_DEFINITIONS_H__ +#endif // __DALI_TEXT_ABSTRACTION_DEFINITIONS_H__ diff --git a/text-abstraction/public-api/text-abstraction.h b/text/dali/public-api/text-abstraction/text-abstraction.h similarity index 87% rename from text-abstraction/public-api/text-abstraction.h rename to text/dali/public-api/text-abstraction/text-abstraction.h index 9767e96..99eea3f 100644 --- a/text-abstraction/public-api/text-abstraction.h +++ b/text/dali/public-api/text-abstraction/text-abstraction.h @@ -18,11 +18,11 @@ * */ +#include #include -#include +#include #include #include #include -#include #endif //__DALI_TEXT_ABSTRACTION_H__ diff --git a/text/file.list b/text/file.list new file mode 100644 index 0000000..db5b7db --- /dev/null +++ b/text/file.list @@ -0,0 +1,22 @@ +# Add local source files here + +text_abstraction_src_files = \ + $(text_src_dir)/dali/public-api/text-abstraction/font-client.cpp \ + $(text_src_dir)/dali/public-api/text-abstraction/font-list.cpp \ + $(text_src_dir)/dali/public-api/text-abstraction/reordering.cpp \ + $(text_src_dir)/dali/public-api/text-abstraction/segmentation.cpp \ + $(text_src_dir)/dali/public-api/text-abstraction/shaping.cpp \ + $(text_src_dir)/dali/internal/text-abstraction/font-client-impl.cpp \ + $(text_src_dir)/dali/internal/text-abstraction/reordering-impl.cpp \ + $(text_src_dir)/dali/internal/text-abstraction/segmentation-impl.cpp \ + $(text_src_dir)/dali/internal/text-abstraction/shaping-impl.cpp + +text_abstraction_header_files = \ + $(text_src_dir)/dali/public-api/text-abstraction/font-client.h \ + $(text_src_dir)/dali/public-api/text-abstraction/font-list.h \ + $(text_src_dir)/dali/public-api/text-abstraction/glyph-info.h \ + $(text_src_dir)/dali/public-api/text-abstraction/reordering.h \ + $(text_src_dir)/dali/public-api/text-abstraction/segmentation.h \ + $(text_src_dir)/dali/public-api/text-abstraction/shaping.h \ + $(text_src_dir)/dali/public-api/text-abstraction/text-abstraction.h \ + $(text_src_dir)/dali/public-api/text-abstraction/text-abstraction-definitions.h