#endif
const float MAX_FLOAT = std::numeric_limits<float>::max();
+const unsigned int POINTS_PER_INCH = 72;
const std::string EMPTY_STRING("");
void Controller::SetText( const std::string& text )
{
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::SetText\n" );
+
// Remove the previously set text
ResetText();
return mImpl->mMaximumNumberOfCharacters;
}
-void Controller::SetDefaultFontFamily( const std::string& defaultFontFamily )
+void Controller::SetDefaultFontFamily( const std::string& defaultFontFamily, bool userDefined )
{
if( !mImpl->mFontDefaults )
{
}
mImpl->mFontDefaults->mDefaultFontFamily = defaultFontFamily;
-
+ mImpl->mUserDefinedFontFamily = userDefined;
// Clear the font-specific data
ClearFontData();
mImpl->mFontDefaults->mDefaultPointSize = pointSize;
+ unsigned int horizontalDpi( 0u );
+ unsigned int verticalDpi( 0u );
+ mImpl->mFontClient.GetDpi( horizontalDpi, verticalDpi );
+
+ // Adjust the metrics if the fixed-size font should be down-scaled
+ int maxEmojiSize( pointSize/POINTS_PER_INCH * verticalDpi );
+ DALI_LOG_INFO( gLogFilter, Debug::General, "Controller::SetDefaultPointSize %p setting MaxEmojiSize %d\n", this, maxEmojiSize );
+ mImpl->mMetrics->SetMaxEmojiSize( maxEmojiSize );
+
// Clear the font-specific data
ClearFontData();
return 0.0f;
}
+void Controller::UpdateAfterFontChange( std::string& newDefaultFont )
+{
+ DALI_LOG_INFO( gLogFilter, Debug::Concise, "Controller::UpdateAfterFontChange");
+
+ ClearFontData();
+
+ if ( !mImpl->mUserDefinedFontFamily ) // If user defined font then should not update when system font changes
+ {
+ DALI_LOG_INFO( gLogFilter, Debug::Concise, "Controller::UpdateAfterFontChange newDefaultFont(%s)\n", newDefaultFont.c_str() );
+ mImpl->mFontDefaults->mDefaultFontFamily=newDefaultFont;
+ mImpl->UpdateModel( ALL_OPERATIONS );
+ mImpl->QueueModifyEvent( ModifyEvent::TEXT_REPLACED );
+ mImpl->mRecalculateNaturalSize = true;
+ mImpl->RequestRelayout();
+ }
+}
+
void Controller::SetTextColor( const Vector4& textColor )
{
mImpl->mTextColor = textColor;
// Do not re-do any operation until something changes.
mImpl->mOperationsPending = NO_OPERATION;
+ // Keep the current offset and alignment as it will be used to update the decorator's positions.
+ Vector2 offset;
+ if( mImpl->mEventData )
+ {
+ offset = mImpl->mAlignmentOffset + mImpl->mEventData->mScrollPosition;
+ }
+
// After doing the text layout, the alignment offset to place the actor in the desired position can be calculated.
CalculateTextAlignment( size );
if( mImpl->mEventData )
{
+ // If there is a nex size, the scroll position needs to be clamped.
+ mImpl->ClampHorizontalScroll( layoutSize );
+
+ // Update the decorator's positions.
+ mImpl->mEventData->mDecorator->UpdatePositions( mImpl->mAlignmentOffset + mImpl->mEventData->mScrollPosition - offset );
+
// Move the cursor, grab handle etc.
updated = mImpl->ProcessInputEvents() || updated;
}