From: Shinwoo Kim Date: Tue, 1 Jun 2021 02:09:02 +0000 (+0900) Subject: Revert "[Tizen] Fixing issue: On Text, reducing font-point-size when the Glyph-block... X-Git-Tag: accepted/tizen/unified/20210609.140314~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e69af2ea15836a722da765cafa2f5813ee4ca59d;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git Revert "[Tizen] Fixing issue: On Text, reducing font-point-size when the Glyph-block-size be larger than Atlas-block-size to fit into it." This reverts commit e6b8da56953a1a9ee3db04178b6d121ea9aa24a4. --- diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-TextEditor-internal.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextEditor-internal.cpp index bef3f33..ca724ff 100755 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-TextEditor-internal.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextEditor-internal.cpp @@ -21,7 +21,6 @@ #include #include -#include #include #include #include @@ -109,61 +108,4 @@ int UtcDaliTextEditorMarkupUnderline(void) END_TEST; -int UtcDaliTextEditorFontPointSizeLargerThanAtlas(void) -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliTextEditorFontPointSizeLargerThanAtlas "); - - // Create a text editor - TextEditor textEditor = TextEditor::New(); - //Set size to avoid automatic eliding - textEditor.SetProperty( Actor::Property::SIZE, Vector2(1025, 1025)); - //Set very large font-size using point-size - textEditor.SetProperty( TextEditor::Property::POINT_SIZE, 1000); - //Specify font-family - textEditor.SetProperty( TextEditor::Property::FONT_FAMILY, "DejaVu Sans"); - //Set text to check if appear or not - textEditor.SetProperty(TextEditor::Property::TEXT, "A"); - - application.GetScene().Add( textEditor ); - - application.SendNotification(); - application.Render(); - - //Check if Glyph is added to AtlasGlyphManger or not - int countAtlas = AtlasGlyphManager::Get().GetMetrics().mAtlasMetrics.mAtlasCount; - DALI_TEST_EQUALS( countAtlas, 1, TEST_LOCATION ); - - END_TEST; -} - - -int UtcDaliTextEditorFontPointSizeLargerThanAtlasPlaceholderCase(void) -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliTextEditorFontPointSizeLargerThanAtlasPlaceholderCase "); - - //Set Map of placeholder: text, font-family and point-size - Property::Map placeholderMapSet; - placeholderMapSet["text"] = "A"; - placeholderMapSet["fontFamily"] = "DejaVu Sans"; - placeholderMapSet["pixelSize"] = 1000.0f; - - // Create a text editor - TextEditor textEditor = TextEditor::New(); - //Set size to avoid automatic eliding - textEditor.SetProperty( Actor::Property::SIZE, Vector2(1025, 1025)); - //Set placeholder - textEditor.SetProperty( TextEditor::Property::PLACEHOLDER, placeholderMapSet) ; - - application.GetScene().Add( textEditor ); - - application.SendNotification(); - application.Render(); - - //Check if Glyph is added to AtlasGlyphManger or not - int countAtlas = AtlasGlyphManager::Get().GetMetrics().mAtlasMetrics.mAtlasCount; - DALI_TEST_EQUALS( countAtlas, 1, TEST_LOCATION ); - - END_TEST; } \ No newline at end of file diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-TextField-internal.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextField-internal.cpp index aa27455..1d899d9 100755 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-TextField-internal.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextField-internal.cpp @@ -21,7 +21,6 @@ #include #include -#include #include #include #include @@ -191,62 +190,4 @@ int UtcDaliTextFieldMarkupUnderline(void) END_TEST; -int UtcDaliTextFieldFontPointSizeLargerThanAtlas(void) -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliTextFieldFontPointSizeLargerThanAtlas "); - - // Create a Text field - TextField textField = TextField::New(); - //Set size to avoid automatic eliding - textField.SetProperty( Actor::Property::SIZE, Vector2(1025, 1025)); - //Set very large font-size using point-size - textField.SetProperty( TextField::Property::POINT_SIZE, 1000) ; - //Specify font-family - textField.SetProperty( TextField::Property::FONT_FAMILY, "DejaVu Sans"); - //Set text to check if appear or not - textField.SetProperty( TextField::Property::TEXT, "A"); - - application.GetScene().Add( textField ); - - application.SendNotification(); - application.Render(); - - //Check if Glyph is added to AtlasGlyphManger or not - int countAtlas = AtlasGlyphManager::Get().GetMetrics().mAtlasMetrics.mAtlasCount; - DALI_TEST_EQUALS( countAtlas, 1, TEST_LOCATION ); - - - END_TEST; -} - -int UtcDaliTextFieldFontPointSizeLargerThanAtlasPlaceholderCase(void) -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliTextFieldFontPointSizeLargerThanAtlasPlaceholderCase "); - - //Set Map of placeholder: text, font-family and point-size - Property::Map placeholderMapSet; - placeholderMapSet["text"] = "A"; - placeholderMapSet["fontFamily"] = "DejaVu Sans"; - placeholderMapSet["pixelSize"] = 1000.0f; - - // Create a text editor - TextField textField = TextField::New(); - //Set size to avoid automatic eliding - textField.SetProperty( Actor::Property::SIZE, Vector2(1025, 1025)); - //Set placeholder - textField.SetProperty( TextField::Property::PLACEHOLDER, placeholderMapSet) ; - - application.GetScene().Add( textField ); - - application.SendNotification(); - application.Render(); - - //Check if Glyph is added to AtlasGlyphManger or not - int countAtlas = AtlasGlyphManager::Get().GetMetrics().mAtlasMetrics.mAtlasCount; - DALI_TEST_EQUALS( countAtlas, 1, TEST_LOCATION ); - - - END_TEST; } \ No newline at end of file diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp index 3bd9ee6..62625ef 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp @@ -3570,74 +3570,4 @@ int utcDaliTextEditorGetNaturalSizeDoesNotChangeLineCountLineWrapCharCase(void) DALI_TEST_EQUALS( lineCountAfter , lineCountBefore, TEST_LOCATION ); END_TEST; -} - -int UtcDaliTextEditorAtlasLimitationIsEnabledForLargeFontPointSize(void) -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliTextEditorAtlasLimitationIsEnabledForLargeFontPointSize "); - - // +2: First one to handle the equal case. Second one to handle odd to even case of GetNaturalSize - const uint32_t lessThanWidth = TextAbstraction::FontClient::MAX_TEXT_ATLAS_WIDTH - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2; - const uint32_t lessThanHeight = TextAbstraction::FontClient::MAX_TEXT_ATLAS_HEIGHT - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2; - - // Create a text editor - TextEditor textEditor = TextEditor::New(); - - //Set size to avoid automatic eliding - textEditor.SetProperty( Actor::Property::SIZE, Vector2(1025, 1025)); - //Set very large font-size using point-size - textEditor.SetProperty( TextEditor::Property::POINT_SIZE, 1000) ; - //Specify font-family - textEditor.SetProperty( TextEditor::Property::FONT_FAMILY, "DejaVu Sans"); - //Set text to check if appear or not - textEditor.SetProperty( TextEditor::Property::TEXT, "A"); - - application.GetScene().Add( textEditor ); - - application.SendNotification(); - application.Render(); - //Use GetNaturalSize to verify that size of block does not exceed Atlas size - Vector3 naturalSize = textEditor.GetNaturalSize(); - - DALI_TEST_GREATER( lessThanWidth, static_cast(naturalSize.width), TEST_LOCATION ); - DALI_TEST_GREATER( lessThanHeight, static_cast(naturalSize.height), TEST_LOCATION ); - - END_TEST; -} - -int UtcDaliTextEditorAtlasLimitationIsEnabledPerformanceCases(void) -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliTextEditorAtlasLimitationIsEnabledPerformanceCases "); - - // +2: First one to handle the equal case. Second one to handle odd to even case of GetNaturalSize - const uint32_t lessThanWidth = TextAbstraction::FontClient::MAX_TEXT_ATLAS_WIDTH - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2; - const uint32_t lessThanHeight = TextAbstraction::FontClient::MAX_TEXT_ATLAS_HEIGHT - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2; - - Vector3 naturalSize; //Use GetNaturalSize to verify that size of block does not exceed Atlas size - // Create a text editor - TextEditor textEditor = TextEditor::New(); - //Set size to avoid automatic eliding - textEditor.SetProperty( Actor::Property::SIZE, Vector2(1025, 1025)); - textEditor.SetProperty( TextEditor::Property::FONT_FAMILY, "DejaVu Sans"); - textEditor.SetProperty( TextEditor::Property::TEXT, "A"); - - const int numberOfCases = 6; - int arrayCases[numberOfCases] = {323, 326, 330, 600, 1630, 2500}; - - for (int index=0; index < numberOfCases; index++) - { - tet_printf(" UtcDaliTextEditorAtlasLimitationIsEnabledPerformanceCases point-size= %d \n", arrayCases[index]); - textEditor.SetProperty( TextEditor::Property::POINT_SIZE, arrayCases[index]) ; - application.GetScene().Add( textEditor ); - application.SendNotification(); - application.Render(); - naturalSize = textEditor.GetNaturalSize(); - DALI_TEST_GREATER( lessThanWidth, static_cast(naturalSize.width), TEST_LOCATION ); - DALI_TEST_GREATER( lessThanHeight, static_cast(naturalSize.height), TEST_LOCATION ); - - } - - END_TEST; } \ No newline at end of file diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp index c615774..05eaeb1 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp @@ -3555,77 +3555,4 @@ int utcDaliTextFieldMaxCharactersReachedAfterSetText(void) DALI_TEST_EQUALS( field.GetProperty( TextField::Property::TEXT ).Get(), "123456789", TEST_LOCATION ); END_TEST; -} - - - -int UtcDaliTextFieldAtlasLimitationIsEnabledForLargeFontPointSize(void) -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliTextFieldAtlasLimitationIsEnabledForLargeFontPointSize "); - - // +2: First one to handle the equal case. Second one to handle odd to even case of GetNaturalSize - const uint32_t lessThanWidth = TextAbstraction::FontClient::MAX_TEXT_ATLAS_WIDTH - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2; - const uint32_t lessThanHeight = TextAbstraction::FontClient::MAX_TEXT_ATLAS_HEIGHT - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2; - - // Create a text field - TextField textField = TextField::New(); - - //Set size to avoid automatic eliding - textField.SetProperty( Actor::Property::SIZE, Vector2(1025, 1025)); - //Set very large font-size using point-size - textField.SetProperty( TextField::Property::POINT_SIZE, 1000) ; - //Specify font-family - textField.SetProperty( TextField::Property::FONT_FAMILY, "DejaVu Sans"); - //Set text to check if appear or not - textField.SetProperty( TextField::Property::TEXT, "A"); - - application.GetScene().Add( textField ); - - application.SendNotification(); - application.Render(); - //Use GetNaturalSize to verify that size of block does not exceed Atlas size - Vector3 naturalSize = textField.GetNaturalSize(); - - DALI_TEST_GREATER( lessThanWidth, static_cast(naturalSize.width), TEST_LOCATION ); - DALI_TEST_GREATER( lessThanHeight, static_cast(naturalSize.height), TEST_LOCATION ); - - END_TEST; -} - -int UtcDaliTextFieldAtlasLimitationIsEnabledPerformanceCases(void) -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliTextFieldAtlasLimitationIsEnabledPerformanceCases "); - - // +2: First one to handle the equal case. Second one to handle odd to even case of GetNaturalSize - const uint32_t lessThanWidth = TextAbstraction::FontClient::MAX_TEXT_ATLAS_WIDTH - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2; - const uint32_t lessThanHeight = TextAbstraction::FontClient::MAX_TEXT_ATLAS_HEIGHT - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2; - - Vector3 naturalSize; //Use GetNaturalSize to verify that size of block does not exceed Atlas size - // Create a text editor - TextField textField = TextField::New(); - - //Set size to avoid automatic eliding - textField.SetProperty( Actor::Property::SIZE, Vector2(1025, 1025)); - textField.SetProperty( TextField::Property::FONT_FAMILY, "DejaVu Sans"); - textField.SetProperty( TextField::Property::TEXT, "A"); - - const int numberOfCases = 6; - int arrayCases[numberOfCases] = {323, 326, 330, 600, 1630, 2500}; - - for (int index=0; index < numberOfCases; index++) - { - tet_printf(" UtcDaliTextFieldAtlasLimitationIsEnabledPerformanceCases point-size= %d \n", arrayCases[index]); - textField.SetProperty( TextField::Property::POINT_SIZE, arrayCases[index]) ; - application.GetScene().Add( textField ); - application.SendNotification(); - application.Render(); - naturalSize = textField.GetNaturalSize(); - DALI_TEST_GREATER( lessThanWidth, static_cast(naturalSize.width), TEST_LOCATION ); - DALI_TEST_GREATER( lessThanHeight, static_cast(naturalSize.height), TEST_LOCATION ); - - } - - END_TEST; } \ No newline at end of file diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp index d8a7c18..ecefef7 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp @@ -1802,38 +1802,3 @@ int UtcDaliToolkitTextlabelAnchorClicked(void) END_TEST; } - -int UtcDaliTextLabelAtlasLimitationIsEnabledForLargeFontPointSize(void) -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliTextLabelAtlasLimitationIsEnabledForLargeFontPointSize "); - - //TextLabel is not using Atlas but this is to unify font-size on text-controllers - - // +2: First one to handle the equal case. Second one to handle odd to even case of GetNaturalSize - const uint32_t lessThanWidth = TextAbstraction::FontClient::MAX_TEXT_ATLAS_WIDTH - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2; - const uint32_t lessThanHeight = TextAbstraction::FontClient::MAX_TEXT_ATLAS_HEIGHT - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2; - - // Create a text editor - TextLabel textLabel = TextLabel::New(); - //Set size to avoid automatic eliding - textLabel.SetProperty( Actor::Property::SIZE, Vector2(1025, 1025)); - //Set very large font-size using point-size - textLabel.SetProperty( TextLabel::Property::POINT_SIZE, 1000); - //Specify font-family - textLabel.SetProperty( TextLabel::Property::FONT_FAMILY, "DejaVu Sans"); - //Set text to check if appear or not - textLabel.SetProperty( TextLabel::Property::TEXT, "A"); - - application.GetScene().Add( textLabel ); - - application.SendNotification(); - application.Render(); - //Use GetNaturalSize to verify that size of block does not exceed Atlas size - Vector3 naturalSize = textLabel.GetNaturalSize(); - - DALI_TEST_GREATER( lessThanWidth, static_cast(naturalSize.width), TEST_LOCATION ); - DALI_TEST_GREATER( lessThanHeight, static_cast(naturalSize.height), TEST_LOCATION ); - - END_TEST; -} \ No newline at end of file diff --git a/dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp b/dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp index 1b1fc35..7b51d5b 100644 --- a/dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp +++ b/dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp @@ -46,6 +46,10 @@ Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT const float ZERO(0.0f); const float HALF(0.5f); const float ONE(1.0f); +const uint32_t DEFAULT_ATLAS_WIDTH = 512u; +const uint32_t DEFAULT_ATLAS_HEIGHT = 512u; +const uint32_t MAX_ATLAS_WIDTH = 1024u; +const uint32_t MAX_ATLAS_HEIGHT = 1024u; const uint32_t DOUBLE_PIXEL_PADDING = 4u;//Padding will be added twice to Atlas const uint16_t NO_OUTLINE = 0u; } // namespace @@ -173,9 +177,6 @@ struct AtlasRenderer::Impl void CacheGlyph(const GlyphInfo& glyph, FontId lastFontId, const AtlasGlyphManager::GlyphStyle& style, AtlasManager::AtlasSlot& slot) { - const Size& defaultTextAtlasSize = mFontClient.GetDefaultTextAtlasSize(); //Retrieve default size of text-atlas-block from font-client. - const Size& maximumTextAtlasSize = mFontClient.GetMaximumTextAtlasSize(); //Retrieve maximum size of text-atlas-block from font-client. - const bool glyphNotCached = !mGlyphManager.IsCached(glyph.fontId, glyph.index, style, slot); // Check FontGlyphRecord vector for entry with glyph index and fontId DALI_LOG_INFO(gLogFilter, Debug::Verbose, "AddGlyphs fontID[%u] glyphIndex[%u] [%s]\n", glyph.fontId, glyph.index, (glyphNotCached) ? "not cached" : "cached"); @@ -249,15 +250,15 @@ struct AtlasRenderer::Impl // If CheckAtlas in AtlasManager::Add can't fit the bitmap in the current atlas it will create a new atlas // Setting the block size and size of new atlas does not mean a new one will be created. An existing atlas may still surffice. - uint32_t default_width = defaultTextAtlasSize.width; - uint32_t default_height = defaultTextAtlasSize.height; + uint32_t default_width = DEFAULT_ATLAS_WIDTH; + uint32_t default_height = DEFAULT_ATLAS_HEIGHT; while ( (blockSize.mNeededBlockWidth >= (default_width - (DOUBLE_PIXEL_PADDING + 1u)) || blockSize.mNeededBlockHeight >= (default_height - (DOUBLE_PIXEL_PADDING + 1u))) && - (default_width < maximumTextAtlasSize.width && - default_height < maximumTextAtlasSize.height)) + (default_width < MAX_ATLAS_WIDTH && + default_height < MAX_ATLAS_HEIGHT)) { default_width <<= 1u; default_height <<= 1u; diff --git a/dali-toolkit/internal/text/text-controller-impl.cpp b/dali-toolkit/internal/text/text-controller-impl.cpp index 2faaee1..8140c84 100644 --- a/dali-toolkit/internal/text/text-controller-impl.cpp +++ b/dali-toolkit/internal/text/text-controller-impl.cpp @@ -697,16 +697,13 @@ bool Controller::Impl::UpdateModel(OperationsMask operationsRequired) TextAbstraction::FontDescription defaultFontDescription; TextAbstraction::PointSize26Dot6 defaultPointSize = TextAbstraction::FontClient::DEFAULT_POINT_SIZE * mFontSizeScale; - //Get the number of points per one unit of point-size - uint32_t numberOfPointsPerOneUnitOfPointSize = mFontClient.GetNumberOfPointsPerOneUnitOfPointSize(); - if(IsShowingPlaceholderText() && mEventData && (nullptr != mEventData->mPlaceholderFont)) { // If the placeholder font is set specifically, only placeholder font is changed. defaultFontDescription = mEventData->mPlaceholderFont->mFontDescription; if(mEventData->mPlaceholderFont->sizeDefined) { - defaultPointSize = mEventData->mPlaceholderFont->mDefaultPointSize * mFontSizeScale * numberOfPointsPerOneUnitOfPointSize; + defaultPointSize = mEventData->mPlaceholderFont->mDefaultPointSize * mFontSizeScale * 64u; } } else if(nullptr != mFontDefaults) @@ -716,11 +713,11 @@ bool Controller::Impl::UpdateModel(OperationsMask operationsRequired) if(mTextFitEnabled) { - defaultPointSize = mFontDefaults->mFitPointSize * numberOfPointsPerOneUnitOfPointSize; + defaultPointSize = mFontDefaults->mFitPointSize * 64u; } else { - defaultPointSize = mFontDefaults->mDefaultPointSize * mFontSizeScale * numberOfPointsPerOneUnitOfPointSize; + defaultPointSize = mFontDefaults->mDefaultPointSize * mFontSizeScale * 64u; } }