mPlugin->GetSystemFonts( systemFonts );
}
-FontId FontClient::FindDefaultFont( Character charcode, PointSize26Dot6 pointSize )
+FontId FontClient::FindDefaultFont( Character charcode, PointSize26Dot6 pointSize, bool preferColor )
{
CreatePlugin();
- return mPlugin->FindDefaultFont( charcode, pointSize );
+ return mPlugin->FindDefaultFont( charcode, pointSize, preferColor );
}
bool FontClient::IsScalable( const FontPath& path )
/**
* @copydoc Dali::FontClient::FindDefaultFont()
*/
- FontId FindDefaultFont( Character charcode, PointSize26Dot6 pointSize );
+ FontId FindDefaultFont( Character charcode, PointSize26Dot6 pointSize, bool preferColor );
/**
* @copydoc Dali::FontClient::GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex )
}
FontId FontClient::Plugin::FindDefaultFont( Character charcode,
- PointSize26Dot6 requestedSize )
+ PointSize26Dot6 requestedSize,
+ bool preferColor )
{
+ FontId fontId(0);
+ bool foundColor(false);
+
// Create the list of default fonts if it has not been created.
if( mDefaultFonts.empty() )
{
// Traverse the list of default fonts.
// Check for each default font if supports the character.
- for( FontList::const_iterator it = mDefaultFonts.begin(),
- endIt = mDefaultFonts.end();
+ for( FontList::const_iterator it = mDefaultFonts.begin(), endIt = mDefaultFonts.end();
it != endIt;
++it )
{
requestedSize = size;
}
- return GetFontId( description.family,
- description.style,
- requestedSize,
- 0u );
+ fontId = GetFontId( description.family,
+ description.style,
+ requestedSize,
+ 0u );
+
+ if( preferColor )
+ {
+ BufferImage bitmap = CreateBitmap( fontId, GetGlyphIndex(fontId,charcode) );
+ if( bitmap &&
+ Pixel::BGRA8888 == bitmap.GetPixelFormat() )
+ {
+ foundColor = true;
+ }
+ }
+
+ // Keep going unless we prefer a different (color) font
+ if( !preferColor || foundColor )
+ {
+ break;
+ }
}
}
- return 0u;
+ return fontId;
}
FontId FontClient::Plugin::GetFontId( const FontPath& path,
/**
* @copydoc Dali::FontClient::FindDefaultFont()
*/
- FontId FindDefaultFont( Character charcode, PointSize26Dot6 pointSize );
+ FontId FindDefaultFont( Character charcode, PointSize26Dot6 pointSize, bool preferColor );
/**
* @see Dali::FontClient::GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex )
return GetImplementation(*this).GetPointSize( id );
}
-FontId FontClient::FindDefaultFont( Character charcode, PointSize26Dot6 pointSize )
+FontId FontClient::FindDefaultFont( Character charcode, PointSize26Dot6 pointSize, bool preferColor )
{
- return GetImplementation(*this).FindDefaultFont( charcode, pointSize );
+ return GetImplementation(*this).FindDefaultFont( charcode, pointSize, preferColor );
}
FontId FontClient::GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex )
* i.e. when a single default font does not work for all languages.
* @param[in] charcode The character for which a font is needed.
* @param[in] pointSize The point size in 26.6 fractional points; the default point size is 12*64.
+ * @param[in] preferColor True if a color font is preferred.
* @return A valid font ID, or zero if the font does not exist.
*/
FontId FindDefaultFont( Character charcode,
- PointSize26Dot6 pointSize = DEFAULT_POINT_SIZE );
+ PointSize26Dot6 pointSize = DEFAULT_POINT_SIZE,
+ bool preferColor = false );
/**
* @brief Retrieve the unique identifier for a font.