#include <dali/internal/text-abstraction/font-client-plugin-impl.h>
// INTERNAL INCLUDES
+#include <dali/devel-api/text-abstraction/font-list.h>
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/integration-api/debug.h>
const std::string FONT_FORMAT( "TrueType" );
const std::string DEFAULT_FONT_FAMILY_NAME( "Tizen" );
-const std::string DEFAULT_FONT_STYLE( "Regular" );
+const int DEFAULT_FONT_WIDTH = 100; // normal
+const int DEFAULT_FONT_WEIGHT = 80; // normal
+const int DEFAULT_FONT_SLANT = 0; // normal
const uint32_t ELLIPSIS_CHARACTER = 0x2026;
+
+const bool FONT_FIXED_SIZE_BITMAP( true );
+
+// http://www.freedesktop.org/software/fontconfig/fontconfig-user.html
+
+// ULTRA_CONDENSED 50
+// EXTRA_CONDENSED 63
+// CONDENSED 75
+// SEMI_CONDENSED 87
+// NORMAL 100
+// SEMI_EXPANDED 113
+// EXPANDED 125
+// EXTRA_EXPANDED 150
+// ULTRA_EXPANDED 200
+const int FONT_WIDTH_TYPE_TO_INT[] = { 50, 63, 75, 87, 100, 113, 125, 150, 200 };
+const unsigned int NUM_FONT_WIDTH_TYPE = sizeof( FONT_WIDTH_TYPE_TO_INT ) / sizeof( int );
+
+// THIN 0
+// ULTRA_LIGHT, EXTRA_LIGHT 40
+// LIGHT 50
+// DEMI_LIGHT, SEMI_LIGHT 55
+// BOOK 75
+// NORMAL, REGULAR 80
+// MEDIUM 100
+// DEMI_BOLD, SEMI_BOLD 180
+// BOLD 200
+// ULTRA_BOLD, EXTRA_BOLD 205
+// BLACK, HEAVY, EXTRA_BLACK 210
+const int FONT_WEIGHT_TYPE_TO_INT[] = { 0, 40, 50, 55, 75, 80, 100, 180, 200, 205, 210 };
+const unsigned int NUM_FONT_WEIGHT_TYPE = sizeof( FONT_WEIGHT_TYPE_TO_INT ) / sizeof( int );
+
+// NORMAL, ROMAN 0
+// ITALIC 100
+// OBLIQUE 110
+const int FONT_SLANT_TYPE_TO_INT[] = { 0, 100, 110 };
+const unsigned int NUM_FONT_SLANT_TYPE = sizeof( FONT_SLANT_TYPE_TO_INT ) / sizeof( int );
+
+/**
+ * @brief Retrieves a table index for a given value.
+ *
+ * @param[in] value The value.
+ * @param[in] table The table.
+ * @param[in] maxIndex The maximum valid index of the table.
+ *
+ * @return The index to the closest available value
+ */
+int ValueToIndex( int value, const int* const table, unsigned int maxIndex )
+{
+ if( ( NULL == table ) ||
+ ( value <= table[0] ) )
+ {
+ return 0;
+ }
+
+ if( value >= table[maxIndex] )
+ {
+ return maxIndex;
+ }
+
+ for( unsigned int index = 0u; index < maxIndex; )
+ {
+ const unsigned int indexPlus = ++index;
+ const int v1 = table[index];
+ const int v2 = table[indexPlus];
+ if( ( v1 < value ) && ( value <= v2 ) )
+ {
+ return ( ( value - v1 ) < ( v2 - value ) ) ? index : indexPlus;
+ }
+
+ index = indexPlus;
+ }
+
+ return 0;
+}
+
}
using Dali::Vector;
namespace Internal
{
-const bool FONT_FIXED_SIZE_BITMAP( true );
+/**
+ * @brief Returns the FontWidth's enum index for the given width value.
+ *
+ * @param[in] width The width value.
+ *
+ * @return The FontWidth's enum index.
+ */
+FontWidth::Type IntToWidthType( int width )
+{
+ return static_cast<FontWidth::Type>( ValueToIndex( width, FONT_WIDTH_TYPE_TO_INT, NUM_FONT_WIDTH_TYPE - 1u ) );
+}
+
+/**
+ * @brief Returns the FontWeight's enum index for the given weight value.
+ *
+ * @param[in] weight The weight value.
+ *
+ * @return The FontWeight's enum index.
+ */
+FontWeight::Type IntToWeightType( int weight )
+{
+ return static_cast<FontWeight::Type>( ValueToIndex( weight, FONT_WEIGHT_TYPE_TO_INT, NUM_FONT_WEIGHT_TYPE - 1u ) );
+}
-FontClient::Plugin::FontDescriptionCacheItem::FontDescriptionCacheItem( const FontFamily& fontFamily,
- const FontStyle& fontStyle,
+/**
+ * @brief Returns the FontSlant's enum index for the given slant value.
+ *
+ * @param[in] slant The slant value.
+ *
+ * @return The FontSlant's enum index.
+ */
+FontSlant::Type IntToSlantType( int slant )
+{
+ return static_cast<FontSlant::Type>( ValueToIndex( slant, FONT_SLANT_TYPE_TO_INT, NUM_FONT_SLANT_TYPE - 1u ) );
+}
+
+FontClient::Plugin::FontDescriptionCacheItem::FontDescriptionCacheItem( const FontDescription& fontDescription,
FontDescriptionId index )
-: fontFamily( fontFamily ),
- fontStyle( fontStyle ),
+: fontDescription( fontDescription ),
index( index )
{
}
mDpiVertical = verticalDpi;
}
-void FontClient::Plugin::SetDefaultFontFamily( const FontFamily& fontFamilyName,
- const FontStyle& fontStyle )
+void FontClient::Plugin::SetDefaultFont( const FontDescription& fontDescription )
{
mDefaultFonts.clear();
- FcPattern* fontFamilyPattern = CreateFontFamilyPattern( fontFamilyName,
- fontStyle );
+ FcPattern* fontFamilyPattern = CreateFontFamilyPattern( fontDescription );
FcResult result = FcResultMatch;
if( GetFcString( fontPattern, FC_FILE, path ) )
{
mDefaultFonts.push_back( FontDescription() );
- FontDescription& fontDescription = mDefaultFonts.back();
-
- fontDescription.path = path;
-
- GetFcString( fontPattern, FC_FAMILY, fontDescription.family );
- GetFcString( fontPattern, FC_STYLE, fontDescription.style );
+ FontDescription& newFontDescription = mDefaultFonts.back();
+
+ newFontDescription.path = path;
+
+ int width = 0;
+ int weight = 0;
+ int slant = 0;
+ GetFcString( fontPattern, FC_FAMILY, newFontDescription.family );
+ GetFcInt( fontPattern, FC_WIDTH, width );
+ GetFcInt( fontPattern, FC_WEIGHT, weight );
+ GetFcInt( fontPattern, FC_SLANT, slant );
+ newFontDescription.width = IntToWidthType( width );
+ newFontDescription.weight = IntToWeightType( weight );
+ newFontDescription.slant = IntToSlantType( slant );
}
}
{
if( mDefaultFonts.empty() )
{
- SetDefaultFontFamily( DEFAULT_FONT_FAMILY_NAME,
- DEFAULT_FONT_STYLE );
+ FontDescription fontDescription;
+ fontDescription.family = DEFAULT_FONT_FAMILY_NAME;
+ fontDescription.width = IntToWidthType( DEFAULT_FONT_WIDTH );
+ fontDescription.weight = IntToWeightType( DEFAULT_FONT_WEIGHT );
+ fontDescription.slant = IntToSlantType( DEFAULT_FONT_SLANT );
+ SetDefaultFont( fontDescription );
}
defaultFonts = mDefaultFonts;
// Create the list of default fonts if it has not been created.
if( mDefaultFonts.empty() )
{
- SetDefaultFontFamily( DEFAULT_FONT_FAMILY_NAME,
- DEFAULT_FONT_STYLE );
+ FontDescription fontDescription;
+ fontDescription.family = DEFAULT_FONT_FAMILY_NAME;
+ fontDescription.width = IntToWidthType( DEFAULT_FONT_WIDTH );
+ fontDescription.weight = IntToWeightType( DEFAULT_FONT_WEIGHT );
+ fontDescription.slant = IntToSlantType( DEFAULT_FONT_SLANT );
+ SetDefaultFont( fontDescription );
}
// Traverse the list of default fonts.
{
const FontDescription& description = *it;
- FcPattern* pattern = CreateFontFamilyPattern( description.family,
- description.style );
+ FcPattern* pattern = CreateFontFamilyPattern( description );
FcResult result = FcResultMatch;
FcPattern* match = FcFontMatch( NULL /* use default configure */, pattern, &result );
if( FcCharSetHasChar( charSet, charcode ) )
{
Vector< PointSize26Dot6 > fixedSizes;
- GetFixedSizes( description.family,
- description.style,
+ GetFixedSizes( description,
fixedSizes );
const Vector< PointSize26Dot6 >::SizeType count = fixedSizes.Count();
requestedSize = size;
}
- fontId = GetFontId( description.family,
- description.style,
+ fontId = GetFontId( description,
requestedSize,
0u );
return id;
}
-FontId FontClient::Plugin::GetFontId( const FontFamily& fontFamily,
- const FontStyle& fontStyle,
+FontId FontClient::Plugin::GetFontId( const FontDescription& fontDescription,
PointSize26Dot6 pointSize,
FaceIndex faceIndex )
{
// This method uses three vectors which caches:
- // * Pairs of non validated 'fontFamily, fontStyle' and an index to a vector with paths to font file names.
+ // * Pairs of non validated font descriptions and an index to a vector with paths to font file names.
// * The path to font file names.
// * The font ids of pairs 'font point size, index to the vector with paths to font file names'.
- // 1) Checks in the cache if the pair 'fontFamily, fontStyle' has been validated before.
+ // 1) Checks in the cache if the font's description has been validated before.
// If it was it gets an index to the vector with paths to font file names. Otherwise,
- // retrieves using font config a path to a font file name which matches with the pair
- // 'fontFamily, fontStyle'. The path is stored in the chache.
+ // retrieves using font config a path to a font file name which matches with the
+ // font's description. The path is stored in the chache.
//
// 2) Checks in the cache if the pair 'font point size, index to the vector with paths to
// fon file names' exists. If exists, it gets the font id. If it doesn't it calls
// The font id to be returned.
FontId fontId = 0u;
- // Check first if the pair font family and style have been validated before.
+ // Check first if the font's description have been validated before.
FontDescriptionId validatedFontId = 0u;
- if( !FindValidatedFont( fontFamily,
- fontStyle,
+ if( !FindValidatedFont( fontDescription,
validatedFontId ) )
{
- // Use font config to validate the font family name and font style.
- ValidateFont( fontFamily, fontStyle, validatedFontId );
+ // Use font config to validate the font's description.
+ ValidateFont( fontDescription,
+ validatedFontId );
}
// Check if exists a pair 'validatedFontId, pointSize' in the cache.
return fontId;
}
-void FontClient::Plugin::ValidateFont( const FontFamily& fontFamily,
- const FontStyle& fontStyle,
+void FontClient::Plugin::ValidateFont( const FontDescription& fontDescription,
FontDescriptionId& validatedFontId )
{
// Create a font pattern.
- FcPattern* fontFamilyPattern = CreateFontFamilyPattern( fontFamily,
- fontStyle );
+ FcPattern* fontFamilyPattern = CreateFontFamilyPattern( fontDescription );
FcResult result = FcResultMatch;
if( match )
{
// Get the path to the font file name.
+ int width = 0;
+ int weight = 0;
+ int slant = 0;
FontDescription description;
GetFcString( match, FC_FILE, description.path );
GetFcString( match, FC_FAMILY, description.family );
- GetFcString( match, FC_STYLE, description.style );
+ GetFcInt( match, FC_WIDTH, width );
+ GetFcInt( match, FC_WEIGHT, weight );
+ GetFcInt( match, FC_SLANT, slant );
+ description.width = IntToWidthType( width );
+ description.weight = IntToWeightType( weight );
+ description.slant = IntToSlantType( slant );
// Set the index to the vector of paths to font file names.
validatedFontId = mFontDescriptionCache.size();
// Add the path to the cache.
mFontDescriptionCache.push_back( description );
- // Cache the index and the pair font family name, font style.
- FontDescriptionCacheItem item( fontFamily, fontStyle, validatedFontId );
+ // Cache the index and the font's description.
+ FontDescriptionCacheItem item( description,
+ validatedFontId );
+
mValidatedFontCache.push_back( item );
// destroyed the matched pattern
}
else
{
- DALI_LOG_ERROR( "FontClient::Plugin::ValidateFont failed for font %s %s\n", fontFamily.c_str(), fontStyle.c_str() );
+ DALI_LOG_ERROR( "FontClient::Plugin::ValidateFont failed for font %s %d %d %d\n",
+ fontDescription.family.c_str(),
+ fontDescription.width,
+ fontDescription.weight,
+ fontDescription.slant );
}
// destroy the pattern
fontDescription.path = path;
+ int width = 0;
+ int weight = 0;
+ int slant = 0;
GetFcString( fontPattern, FC_FAMILY, fontDescription.family );
- GetFcString( fontPattern, FC_STYLE, fontDescription.style );
+ GetFcInt( fontPattern, FC_WIDTH, width );
+ GetFcInt( fontPattern, FC_WEIGHT, weight );
+ GetFcInt( fontPattern, FC_SLANT, slant );
+ fontDescription.width = IntToWidthType( width );
+ fontDescription.weight = IntToWeightType( weight );
+ fontDescription.slant = IntToSlantType( slant );
}
}
}
}
-FcPattern* FontClient::Plugin::CreateFontFamilyPattern( const FontFamily& fontFamily,
- const FontStyle& fontStyle )
+FcPattern* FontClient::Plugin::CreateFontFamilyPattern( const FontDescription& fontDescription )
{
// create the cached font family lookup pattern
// a pattern holds a set of names, each name refers to a property of the font
FcPattern* fontFamilyPattern = FcPatternCreate();
// add a property to the pattern for the font family
- FcPatternAddString( fontFamilyPattern, FC_FAMILY, reinterpret_cast<const FcChar8*>( fontFamily.c_str() ) );
+ FcPatternAddString( fontFamilyPattern, FC_FAMILY, reinterpret_cast<const FcChar8*>( fontDescription.family.c_str() ) );
- // add a property to the pattern for the font family
- FcPatternAddString( fontFamilyPattern, FC_STYLE, reinterpret_cast<const FcChar8*>( fontStyle.c_str() ) );
+ FcPatternAddInteger( fontFamilyPattern, FC_WIDTH, FONT_WIDTH_TYPE_TO_INT[fontDescription.width] );
+ FcPatternAddInteger( fontFamilyPattern, FC_WEIGHT, FONT_WEIGHT_TYPE_TO_INT[fontDescription.weight] );
+ FcPatternAddInteger( fontFamilyPattern, FC_SLANT, FONT_SLANT_TYPE_TO_INT[fontDescription.slant] );
// Add a property of the pattern, to say we want to match TrueType fonts
FcPatternAddString( fontFamilyPattern , FC_FONTFORMAT, reinterpret_cast<const FcChar8*>( FONT_FORMAT.c_str() ) );
// build an object set from a list of property names
FcObjectSetAdd( objectSet, FC_FILE );
FcObjectSetAdd( objectSet, FC_FAMILY );
- FcObjectSetAdd( objectSet, FC_STYLE );
+ FcObjectSetAdd( objectSet, FC_WIDTH );
+ FcObjectSetAdd( objectSet, FC_WEIGHT );
+ FcObjectSetAdd( objectSet, FC_SLANT );
// get a list of fonts
// creates patterns from those fonts containing only the objects in objectSet and returns the set of unique such patterns
return false;
}
+bool FontClient::Plugin::GetFcInt( const _FcPattern* const pattern, const char* const n, int& intVal )
+{
+ const FcResult retVal = FcPatternGetInteger( pattern, n, 0u, &intVal );
+
+ if( FcResultMatch == retVal )
+ {
+ return true;
+ }
+
+ return false;
+}
+
FontId FontClient::Plugin::CreateFont( const FontPath& path,
PointSize26Dot6 pointSize,
FaceIndex faceIndex,
FontDescription description;
description.path = path;
description.family = FontFamily( ftFace->family_name );
- description.style = FontStyle( ftFace->style_name );
+
+ // Note FreeType doesn't give too much info to build a proper font style.
+ if( ftFace->style_flags | FT_STYLE_FLAG_ITALIC )
+ {
+ description.slant = FontSlant::ITALIC;
+ }
+ if( ftFace->style_flags | FT_STYLE_FLAG_BOLD )
+ {
+ description.weight = FontWeight::BOLD;
+ }
mFontDescriptionCache.push_back( description );
}
FontDescription description;
description.path = path;
description.family = FontFamily( ftFace->family_name );
- description.style = FontStyle( ftFace->style_name );
+
+ // Note FreeType doesn't give too much info to build a proper font style.
+ if( ftFace->style_flags | FT_STYLE_FLAG_ITALIC )
+ {
+ description.slant = FontSlant::ITALIC;
+ }
+ if( ftFace->style_flags | FT_STYLE_FLAG_BOLD )
+ {
+ description.weight = FontWeight::BOLD;
+ }
mFontDescriptionCache.push_back( description );
}
return false;
}
-bool FontClient::Plugin::FindValidatedFont( const FontFamily& fontFamily,
- const FontStyle& fontStyle,
+bool FontClient::Plugin::FindValidatedFont( const FontDescription& fontDescription,
FontDescriptionId& validatedFontId )
{
validatedFontId = 0u;
{
const FontDescriptionCacheItem& item = *it;
- if( ( fontFamily == item.fontFamily ) &&
- ( fontStyle == item.fontStyle ) && ( fontFamily !="") )
+ if( !fontDescription.family.empty() &&
+ ( fontDescription.family == item.fontDescription.family ) &&
+ ( fontDescription.width == item.fontDescription.width ) &&
+ ( fontDescription.weight == item.fontDescription.weight ) &&
+ ( fontDescription.slant == item.fontDescription.slant ) )
{
validatedFontId = item.index;
return ( ftFace->num_fixed_sizes == 0 );
}
-bool FontClient::Plugin::IsScalable( const FontFamily& fontFamily, const FontStyle& fontStyle )
+bool FontClient::Plugin::IsScalable( const FontDescription& fontDescription )
{
// Create a font pattern.
- FcPattern* fontFamilyPattern = CreateFontFamilyPattern( fontFamily,
- fontStyle );
+ FcPattern* fontFamilyPattern = CreateFontFamilyPattern( fontDescription );
FcResult result = FcResultMatch;
}
else
{
- DALI_LOG_ERROR( "FreeType Cannot check font: %s %s\n", fontFamily.c_str(), fontStyle.c_str() );
+ DALI_LOG_ERROR( "FreeType Cannot check font: %s %d %d %d\n",
+ fontDescription.family.c_str(),
+ fontDescription.width,
+ fontDescription.weight,
+ fontDescription.slant );
}
FcPatternDestroy( fontFamilyPattern );
FcPatternDestroy( match );
}
}
-void FontClient::Plugin::GetFixedSizes( const FontFamily& fontFamily,
- const FontStyle& fontStyle,
+void FontClient::Plugin::GetFixedSizes( const FontDescription& fontDescription,
Vector< PointSize26Dot6 >& sizes )
{
// Create a font pattern.
- FcPattern* fontFamilyPattern = CreateFontFamilyPattern( fontFamily,
- fontStyle );
+ FcPattern* fontFamilyPattern = CreateFontFamilyPattern( fontDescription );
FcResult result = FcResultMatch;
}
else
{
- DALI_LOG_ERROR( "FreeType Cannot check font: %s %s\n", fontFamily.c_str(), fontStyle.c_str() );
+ DALI_LOG_ERROR( "FreeType Cannot check font: %s %d %d %d\n",
+ fontDescription.family.c_str(),
+ fontDescription.width,
+ fontDescription.weight,
+ fontDescription.slant );
}
FcPatternDestroy( match );
FcPatternDestroy( fontFamilyPattern );
{
/**
- *@brief Type used for indices addressing the vector with front descriptions of validated pairs 'font family name, font style'.
+ *@brief Type used for indices addressing the vector with front descriptions of validated fonts.
*/
typedef uint32_t FontDescriptionId;
struct FontClient::Plugin
{
/**
- * @brief Caches an index to the vector of font descriptions for a given 'font family name, font style'.
+ * @brief Caches an index to the vector of font descriptions for a given font.
*/
struct FontDescriptionCacheItem
{
- FontDescriptionCacheItem( const FontFamily& fontFamily,
- const FontStyle& fontStyle,
+ FontDescriptionCacheItem( const FontDescription& fontDescription,
FontDescriptionId index );
- FontFamily fontFamily; ///< The font family name.
- FontStyle fontStyle; ///< The font style.
- FontDescriptionId index; ///< Index to the vector of font descriptions.
+ FontDescription fontDescription; ///< The font description.
+ FontDescriptionId index; ///< Index to the vector of font descriptions.
};
/**
void SetDpi( unsigned int horizontalDpi, unsigned int verticalDpi );
/**
- * @copydoc Dali::FontClient::SetDefaultFontFamily()
+ * @copydoc Dali::FontClient::SetDefaultFont()
*/
- void SetDefaultFontFamily( const FontFamily& fontFamilyName,
- const FontStyle& fontStyle );
+ void SetDefaultFont( const FontDescription& fontDescription );
/**
* @copydoc Dali::FontClient::GetDefaultFonts()
FontId GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex, bool cacheDescription = true );
/**
- * @copydoc Dali::FontClient::GetFontId(const FontFamily& fontFamily, const FontStyle& fontStyle, PointSize26Dot6 pointSize, FaceIndex faceIndex )
+ * @copydoc Dali::FontClient::GetFontId( const FontDescription& fontDescription, PointSize26Dot6 pointSize, FaceIndex faceIndex )
*/
- FontId GetFontId( const FontFamily& fontFamily,
- const FontStyle& fontStyle,
+ FontId GetFontId( const FontDescription& fontDescription,
PointSize26Dot6 pointSize,
FaceIndex faceIndex );
/**
- * @copydoc Dali::FontClient::IsScalable(const FontPath& path )
+ * @copydoc Dali::FontClient::IsScalable( const FontPath& path )
*/
bool IsScalable( const FontPath& path );
/**
- * @copydoc Dali::FontClient::IsScalable( const FontFamily& fontFamily, const FontStyle& fontStyle )
+ * @copydoc Dali::FontClient::IsScalable( const FontDescription& fontDescription )
*/
- bool IsScalable( const FontFamily& fontFamily, const FontStyle& fontStyle );
+ bool IsScalable( const FontDescription& fontDescription );
/**
- * @copydoc Dali::FontClient::GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26Dot6>& sizes )
+ * @copydoc Dali::FontClient::GetFixedSizes()
*/
void GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26Dot6>& sizes );
/**
- * @copydoc Dali::FontClient::GetFixedSizes( const FontFamily& fontFamily, const FontStyle& fontStyle, Dali::Vector< PointSize26Dot6>& sizes )
+ * @copydoc Dali::FontClient::GetFixedSizes()
*/
- void GetFixedSizes( const FontFamily& fontFamily,
- const FontStyle& fontStyle,
+ void GetFixedSizes( const FontDescription& fontDescription,
Dali::Vector< PointSize26Dot6 >& sizes );
/**
/**
* @brief Creates a font family pattern used to match fonts.
*
- * @param[in] fontFamily The font family name.
- * @param[in] fontStyle The font style.
+ * @param[in] fontDescription The font to cache.
*
* @return The pattern.
*/
- _FcPattern* CreateFontFamilyPattern( const FontFamily& fontFamily,
- const FontStyle& fontStyle );
+ _FcPattern* CreateFontFamilyPattern( const FontDescription& fontDescription );
/**
* Retrieves the fonts present in the platform.
bool GetFcString( const _FcPattern* const pattern, const char* const n, std::string& string );
/**
+ * Retrieves a font config object's value from a pattern.
+ *
+ * @param[in] pattern The font config pattern.
+ * @param[in] n The object.
+ * @param[out] intVal The object's value.
+ *
+ * @return @e true if the operation is successful.
+ */
+ bool GetFcInt( const _FcPattern* const pattern, const char* const n, int& intVal );
+
+ /**
* @brief Creates a font.
*
* @param[in] path The path to the font file name.
bool FindFont( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex, FontId& fontId ) const;
/**
- * @brief Finds in the cahce a pair 'font family, font style'.
- * If there is one, it writes the index to the vector with font descriptions in the param @p validatedFontId.
+ * @brief Finds in the cahce a cluster 'font family, font width, font weight, font slant'
+ * If there is one, it writes the index to the vector with font descriptions in the param @p validatedFontId.
*
- * @param[in] fontFamily The font family name.
- * @param[in] fontStyle The font style.
+ * @param[in] fontDescription The font to validate.
* @param[out] validatedFontId The index to the vector with font descriptions.
*
* @return @e true if the pair is found.
*/
- bool FindValidatedFont( const FontFamily& fontFamily,
- const FontStyle& fontStyle,
+ bool FindValidatedFont( const FontDescription& fontDescription,
FontDescriptionId& validatedFontId );
/**
FontId& fontId );
/**
- * @brief Validate a font family and style
+ * @brief Validate a font description.
*
- * @param[in] fontFamily Font Family to validate
- * @param[in] fontStyle Font Style to validate
+ * @param[in] fontDescription The font to validate.
* @param[out] validatedFontId Result of validation
*/
- void ValidateFont( const FontFamily& fontFamily,
- const FontStyle& fontStyle,
+ void ValidateFont( const FontDescription& fontDescription,
FontDescriptionId& validatedFontId );
FT_Library mFreeTypeLibrary; ///< A handle to a FreeType library instance.
FontList mDefaultFonts; ///< Cached default fonts.
std::vector<CacheItem> mFontCache; ///< Caches the FreeType face and font metrics of the triplet 'path to the font file name, font point size and face index'.
- std::vector<FontDescriptionCacheItem> mValidatedFontCache; ///< Caches indices to the vector of font descriptions for a given 'font family name, font style'.
- FontList mFontDescriptionCache; ///< Caches font descriptions for the validated font family name and font style pairs.
+ std::vector<FontDescriptionCacheItem> mValidatedFontCache; ///< Caches indices to the vector of font descriptions for a given font.
+ FontList mFontDescriptionCache; ///< Caches font descriptions for the validated font.
std::vector<FontIdCacheItem> mFontIdCache; ///< Caches font ids for the pairs of font point size and the index to the vector with font descriptions of the validated fonts.
Vector<EllipsisItem> mEllipsisCache; ///< Caches ellipsis glyphs for a particular point size.