#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control-depth-index-ranges.h>
#include <dali-toolkit/public-api/text/rendering-backend.h>
-#include <dali-toolkit/internal/controls/text-controls/text-font-style.h>
+#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
#include <dali-toolkit/internal/text/rendering/text-backend.h>
+#include <dali-toolkit/internal/text/text-font-style.h>
#include <dali-toolkit/internal/text/text-view.h>
#include <dali-toolkit/internal/styling/style-manager-impl.h>
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "underlineEnabled", BOOLEAN, UNDERLINE_ENABLED )
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "underlineColor", VECTOR4, UNDERLINE_COLOR )
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "underlineHeight", FLOAT, UNDERLINE_HEIGHT )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "enableMarkup", BOOLEAN, ENABLE_MARKUP )
DALI_TYPE_REGISTRATION_END()
{
case Toolkit::TextLabel::Property::RENDERING_BACKEND:
{
- const int backend = value.Get< int >();
+ int backend = value.Get< int >();
+#ifndef ENABLE_VECTOR_BASED_TEXT_RENDERING
+ if( Text::RENDERING_VECTOR_BASED == backend )
+ {
+ backend = TextAbstraction::BITMAP_GLYPH; // Fallback to bitmap-based rendering
+ }
+#endif
if( impl.mRenderingBackend != backend )
{
impl.mRenderingBackend = backend;
impl.mRenderer.Reset();
- impl.RequestTextRelayout();
+
+ if( impl.mController )
+ {
+ // When using the vector-based rendering, the size of the GLyphs are different
+ TextAbstraction::GlyphType glyphType = (Text::RENDERING_VECTOR_BASED == impl.mRenderingBackend) ? TextAbstraction::VECTOR_GLYPH : TextAbstraction::BITMAP_GLYPH;
+ impl.mController->SetGlyphType( glyphType );
+ }
}
break;
}
}
case Toolkit::TextLabel::Property::FONT_STYLE:
{
- SetFontStyleProperty( impl.mController, value );
+ SetFontStyleProperty( impl.mController, value, Text::FontStyle::DEFAULT );
break;
}
case Toolkit::TextLabel::Property::POINT_SIZE:
}
break;
}
+ case Toolkit::TextLabel::Property::ENABLE_MARKUP:
+ {
+ if( impl.mController )
+ {
+ const bool enableMarkup = value.Get<bool>();
+ impl.mController->SetMarkupProcessorEnabled( enableMarkup );
+ }
+ break;
+ }
}
}
}
}
case Toolkit::TextLabel::Property::FONT_STYLE:
{
- GetFontStyleProperty( impl.mController, value );
+ GetFontStyleProperty( impl.mController, value, Text::FontStyle::DEFAULT );
break;
}
case Toolkit::TextLabel::Property::POINT_SIZE:
}
break;
}
+ case Toolkit::TextLabel::Property::ENABLE_MARKUP:
+ {
+ if( impl.mController )
+ {
+ value = impl.mController->IsMarkupProcessorEnabled();
+ }
+ break;
+ }
}
}
mController = Text::Controller::New( *this );
+ // When using the vector-based rendering, the size of the GLyphs are different
+ TextAbstraction::GlyphType glyphType = (Text::RENDERING_VECTOR_BASED == mRenderingBackend) ? TextAbstraction::VECTOR_GLYPH : TextAbstraction::BITMAP_GLYPH;
+ mController->SetGlyphType( glyphType );
+
// Use height-for-width negotiation by default
self.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
self.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
void TextLabel::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change )
{
-
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextLabel::OnStyleChange\n");
switch ( change )
case StyleChange::DEFAULT_FONT_CHANGE:
{
// Property system did not set the font so should update it.
- std::string newFont = styleManager.GetDefaultFontFamily();
+ const std::string& newFont = GetImpl( styleManager ).GetDefaultFontFamily();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel::OnStyleChange StyleChange::DEFAULT_FONT_CHANGE newFont(%s)\n", newFont.c_str() );
mController->UpdateAfterFontChange( newFont );
break;
Actor renderableActor;
if( mRenderer )
{
- renderableActor = mRenderer->Render( mController->GetView(), TEXT_DEPTH_INDEX );
+ renderableActor = mRenderer->Render( mController->GetView(), DepthIndex::TEXT );
}
if( renderableActor != mRenderableActor )
if( renderableActor )
{
+ // TODO: Scroll and alignment needs to be refactored.
const Vector2& alignmentOffset = mController->GetAlignmentOffset();
- renderableActor.SetPosition( alignmentOffset.x, alignmentOffset.y );
+ renderableActor.SetPosition( 0.f, alignmentOffset.y );
self.Add( renderableActor );
}