fontStyleMapSet.Insert( "weight", "thin" );
fontStyleMapSet.Insert( "width", "expanded" );
fontStyleMapSet.Insert( "slant", "oblique" );
+ const std::string strFontStyle = "{\"weight\":\"thin\",\"width\":\"expanded\",\"slant\":\"oblique\"}";
label.SetProperty( TextLabel::Property::FONT_STYLE, "{\"weight\":\"thin\",\"width\":\"expanded\",\"slant\":\"oblique\"}" );
- fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
- DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+ std::string getFontStyle = label.GetProperty<std::string>( TextLabel::Property::FONT_STYLE );
+ DALI_TEST_EQUALS( getFontStyle, strFontStyle, TEST_LOCATION );
label.SetProperty( TextLabel::Property::POINT_SIZE, 10.f );
DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::POINT_SIZE ), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
const std::string& fontStyleProperties = value.Get<std::string>();
ParsePropertyString( fontStyleProperties, map );
+ controller->FontStyleSetByString( true );
+
}
else
{
map = value.Get<Property::Map>();
+ controller->FontStyleSetByString( false );
}
if( !map.Empty() )
if( controller )
{
const bool isDefaultStyle = FontStyle::DEFAULT == type;
+ const bool isSetbyString = controller->IsFontStyleSetByString();
bool weightDefined = false;
bool widthDefined = false;
}
}
- Property::Map map;
-
- if( weightDefined )
+ if( !isSetbyString )
{
- if( TextAbstraction::FontWeight::NONE != weight )
+ Property::Map map;
+
+ if( weightDefined )
{
- const std::string weightStr( GetEnumerationName( weight,
- FONT_WEIGHT_STRING_TABLE,
- FONT_WEIGHT_STRING_TABLE_COUNT ) );
+ if( TextAbstraction::FontWeight::NONE != weight )
+ {
+ const std::string weightStr( GetEnumerationName( weight,
+ FONT_WEIGHT_STRING_TABLE,
+ FONT_WEIGHT_STRING_TABLE_COUNT ) );
- map.Insert( WEIGHT_KEY, weightStr );
+ map.Insert( WEIGHT_KEY, weightStr );
+ }
}
- }
- if( widthDefined )
- {
- if( TextAbstraction::FontWidth::NONE != width )
+ if( widthDefined )
+ {
+ if( TextAbstraction::FontWidth::NONE != width )
+ {
+ const std::string widthStr( GetEnumerationName( width,
+ FONT_WIDTH_STRING_TABLE,
+ FONT_WIDTH_STRING_TABLE_COUNT ) );
+
+ map.Insert( WIDTH_KEY, widthStr );
+ }
+ }
+
+ if( slantDefined )
{
- const std::string widthStr( GetEnumerationName( width,
- FONT_WIDTH_STRING_TABLE,
- FONT_WIDTH_STRING_TABLE_COUNT ) );
+ if( TextAbstraction::FontSlant::NONE != slant )
+ {
+ const std::string slantStr( GetEnumerationName( slant,
+ FONT_SLANT_STRING_TABLE,
+ FONT_SLANT_STRING_TABLE_COUNT ) );
- map.Insert( WIDTH_KEY, widthStr );
+ map.Insert( SLANT_KEY, slantStr );
+ }
}
- }
- if( slantDefined )
+ value = map;
+ } // SetbyMAP
+ else
{
- if( TextAbstraction::FontSlant::NONE != slant )
+ std::string fontStyleProperties = "{";
+
+ if( weightDefined )
{
- const std::string slantStr( GetEnumerationName( slant,
- FONT_SLANT_STRING_TABLE,
- FONT_SLANT_STRING_TABLE_COUNT ) );
+ if( TextAbstraction::FontWeight::NONE != weight )
+ {
+ const std::string weightStr( GetEnumerationName( weight,
+ FONT_WEIGHT_STRING_TABLE,
+ FONT_WEIGHT_STRING_TABLE_COUNT ) );
- map.Insert( SLANT_KEY, slantStr );
+ fontStyleProperties += "\"weight\":\"" + weightStr + "\",";
+ }
}
- }
- value = map;
- }
+ if( widthDefined )
+ {
+ if( TextAbstraction::FontWidth::NONE != width )
+ {
+ const std::string widthStr( GetEnumerationName( width,
+ FONT_WIDTH_STRING_TABLE,
+ FONT_WIDTH_STRING_TABLE_COUNT ) );
+ fontStyleProperties += "\"width\":\"" + widthStr + "\",";
+ }
+ }
+
+ if( slantDefined )
+ {
+ if( TextAbstraction::FontSlant::NONE != slant )
+ {
+ const std::string slantStr( GetEnumerationName( slant,
+ FONT_SLANT_STRING_TABLE,
+ FONT_SLANT_STRING_TABLE_COUNT ) );
+
+ fontStyleProperties += "\"slant\":\"" + slantStr + "\"";
+ }
+ }
+
+ // If last character is comma, it will be removed.
+ if((*fontStyleProperties.rbegin()) == ',' )
+ {
+ fontStyleProperties = fontStyleProperties.substr( 0, fontStyleProperties.size()-1 );
+ }
+ fontStyleProperties += "}";
+
+ value = fontStyleProperties;
+ } // SetbyString
+ }// controller
}
FontWeight StringToWeight( const char* const weightStr )