DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1, ASYNC_TEXT_THREAD_TIMEOUT), true, TEST_LOCATION);
DALI_TEST_CHECK(label.GetProperty<bool>(DevelTextLabel::Property::IS_SCROLLING));
+ END_TEST;
+}
+
+int UtcDaliToolkitTextLabelAsyncFontVariations(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextLabelAsyncFontVariations");
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
+
+ TextLabel label = TextLabel::New();
+ DALI_TEST_CHECK(label);
+
+ float expectedWidth = 300.0f;
+ float expectedHeight = 300.0f;
+
+ label.SetProperty(DevelTextLabel::Property::RENDER_MODE, DevelTextLabel::Render::ASYNC_AUTO);
+ label.SetProperty(TextLabel::Property::TEXT, "Hello world Hello world");
+ label.SetProperty(Actor::Property::SIZE, Vector2(expectedWidth, expectedHeight));
+ label.SetProperty(TextLabel::Property::POINT_SIZE, 12);
+ label.SetProperty(TextLabel::Property::MULTI_LINE, true);
+ application.GetScene().Add(label);
+
+ std::string WGHT_KEY = "wght";
+ const float WGHT_VALUE = 100.f;
+
+ auto fontVariationsIndex = DevelTextLabel::RegisterFontVariationProperty(label, WGHT_KEY.data());
+ label.SetProperty(fontVariationsIndex, WGHT_VALUE);
+
+ DALI_TEST_CHECK(label.GetProperty(fontVariationsIndex).Get<float>() == WGHT_VALUE);
+
+ // Connect to the async text rendered signal.
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ DevelTextLabel::AsyncTextRenderedSignal(label).Connect(&TestAsyncTextRendered);
+
+ bool asyncTextRendered = false;
+ label.ConnectSignal(testTracker, "asyncTextRendered", CallbackFunctor(&asyncTextRendered));
+
+ gAsyncTextRenderedCalled = false;
+ gAsyncTextRenderedWidth = 0.0f;
+ gAsyncTextRenderedHeight = 0.0f;
+
+ // Request render automatically.
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1, ASYNC_TEXT_THREAD_TIMEOUT), true, TEST_LOCATION);
+
+ DALI_TEST_CHECK(gAsyncTextRenderedCalled);
+ DALI_TEST_CHECK(asyncTextRendered);
+
+ DALI_TEST_EQUALS(expectedWidth, gAsyncTextRenderedWidth, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
+ DALI_TEST_EQUALS(expectedHeight, gAsyncTextRenderedHeight, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
+ DALI_TEST_EQUALS(false, label.GetProperty<bool>(DevelTextLabel::Property::MANUAL_RENDERED), TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+
END_TEST;
}
\ No newline at end of file
mTextModel->mLogicalModel->ClearUnderlineRuns();
mTextModel->mLogicalModel->ClearEmbeddedImages();
mTextModel->mLogicalModel->ClearAnchors();
+ mTextModel->mLogicalModel->mVariationsMap.Clear();
// Free the allocated memory used to store the conversion table in the bidirectional line info run.
for(Vector<BidirectionalLineInfoRun>::Iterator it = mTextModel->mLogicalModel->mBidirectionalLineInfo.Begin(),
mTextModel->mVerticalAlignment = parameters.verticalAlignment;
mTextModel->mVerticalLineAlignment = parameters.verticalLineAlignment;
+ mTextModel->mLogicalModel->mVariationsMap = parameters.variationsMap;
////////////////////////////////////////////////////////////////////////////////
// Update visual model.
defaultPointSize = parameters.fontSize * scale * numberOfPointsPerOneUnitOfPointSize;
+ Property::Map *variationsMapPtr = nullptr;
+ if(!mTextModel->mLogicalModel->mVariationsMap.Empty())
+ {
+ variationsMapPtr = &mTextModel->mLogicalModel->mVariationsMap;
+ }
+
// Validates the fonts. If there is a character with no assigned font it sets a default one.
// After this call, fonts are validated.
mModule.GetMultilanguageSupport().ValidateFonts(mModule.GetFontClient(),
scale,
0u,
numberOfCharacters,
- validFonts);
+ validFonts,
+ variationsMapPtr);
////////////////////////////////////////////////////////////////////////////////
const Vector<Character>& textToShape = mIsTextMirrored ? mirroredUtf32Characters : utf32Characters;
- Property::Map *variationsMapPtr = nullptr;
- if(!mTextModel->mLogicalModel->mVariationsMap.Empty())
- {
- variationsMapPtr = &mTextModel->mLogicalModel->mVariationsMap;
- }
-
// Shapes the text.
ShapeText(mModule.GetShaping(),
mModule.GetFontClient(),
isAutoScrollMaxTextureExceeded{false},
cutout{false},
backgroundWithCutoutEnabled{false},
- backgroundColorWithCutout{Color::TRANSPARENT}
+ backgroundColorWithCutout{Color::TRANSPARENT},
+ variationsMap{}
{
}
int autoScrollGap;
bool isAutoScrollMaxTextureExceeded : 1;
- bool cutout : 1; ///< Cutout enabled flag
- bool backgroundWithCutoutEnabled : 1; ///< Background with cutout enabled flag.
- Vector4 backgroundColorWithCutout; ///< Background color with cutout.
+ bool cutout : 1; ///< Cutout enabled flag
+ bool backgroundWithCutoutEnabled : 1; ///< Background with cutout enabled flag.
+ Vector4 backgroundColorWithCutout; ///< Background color with cutout.
+
+ Property::Map variationsMap; ///< The map for variable fonts. it might be replaced by variable map run.
};
struct AsyncTextRenderInfo