END_TEST;
}
+int UtcDaliTextEditorMarkupSpanUnderline(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextEditorMarkupSpanUnderline ");
+
+ TextEditor textEditor = TextEditor::New();
+
+ application.GetScene().Add(textEditor);
+
+ std::string testText =
+ "start<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red'>ABC1</span>then"
+ "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='solid'>ABC2</span>then"
+ "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='dashed'>ABC3</span>then"
+ "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='double'>ABC4</span>then"
+ "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-color='green'>ABC5</span>then"
+ "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-height='5.0f'>ABC6</span>then"
+ "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='dashed' u-dash-gap='3.0f'>ABC7</span>then"
+ "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='dashed' u-dash-width='4.0f'>ABC8</span>then"
+ "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-color='blue' u-type='dashed' u-height='4.0f' u-dash-gap='2.0f' u-dash-width='3.0f'>ABC9</span>end"
+
+ ;
+
+ textEditor.SetProperty(TextEditor::Property::TEXT, testText);
+ textEditor.SetProperty(TextEditor ::Property::ENABLE_MARKUP, true);
+
+ application.SendNotification();
+ application.Render();
+
+ const uint32_t NUMBER_OF_CASES = 8u;
+ uint32_t expectedNumberOfUnderlinedGlyphs = 32u;
+
+ Toolkit::Internal::TextEditor& textEditorImpl = GetImpl(textEditor);
+ const Text::Length numberOfUnderlineRuns = textEditorImpl.GetTextController()->GetTextModel()->GetNumberOfUnderlineRuns();
+
+ DALI_TEST_EQUALS(numberOfUnderlineRuns, expectedNumberOfUnderlinedGlyphs, TEST_LOCATION);
+
+ Vector<UnderlinedGlyphRun> underlineRuns;
+ underlineRuns.Resize(numberOfUnderlineRuns);
+ textEditorImpl.GetTextController()->GetTextModel()->GetUnderlineRuns(underlineRuns.Begin(), 0u, numberOfUnderlineRuns);
+
+ struct DataOfCase
+ {
+ std::string title;
+ uint32_t startIndex;
+ uint32_t endIndex;
+ GlyphIndex startGlyphIndex;
+ GlyphIndex endGlyphIndex;
+ UnderlineStyleProperties properties;
+ };
+ DataOfCase data[] =
+ {
+
+ {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='solid'>ABC2</span>",
+ 0u,
+ 3u,
+ 13u,
+ 16u,
+ {
+ Text::Underline::SOLID,
+ Color::BLACK,
+ 0u,
+ 1u,
+ 2u,
+ true,
+ false,
+ false,
+ false,
+ false,
+ }},
+
+ {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='dashed'>ABC3</span>",
+ 4u,
+ 7u,
+ 21u,
+ 24u,
+ {
+ Text::Underline::DASHED,
+ Color::BLACK,
+ 0u,
+ 1u,
+ 2u,
+ true,
+ false,
+ false,
+ false,
+ false,
+ }},
+
+ {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='double'>ABC4</span>",
+ 8u,
+ 11u,
+ 29u,
+ 32u,
+ {
+ Text::Underline::DOUBLE,
+ Color::BLACK,
+ 0u,
+ 1u,
+ 2u,
+ true,
+ false,
+ false,
+ false,
+ false,
+ }},
+
+ {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-color='green'>ABC5</span>",
+ 12u,
+ 15u,
+ 37u,
+ 40u,
+ {
+ Text::Underline::SOLID,
+ Color::GREEN,
+ 0u,
+ 1u,
+ 2u,
+ false,
+ true,
+ false,
+ false,
+ false,
+ }},
+
+ {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-height='5.0f'>ABC6</span>",
+ 16u,
+ 19u,
+ 45u,
+ 48u,
+ {
+ Text::Underline::SOLID,
+ Color::BLACK,
+ 5u,
+ 1u,
+ 2u,
+ false,
+ false,
+ true,
+ false,
+ false,
+ }},
+
+ {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='dashed' u-dash-gap='3.0f'>ABC7</span>",
+ 20u,
+ 23u,
+ 53u,
+ 56u,
+ {
+ Text::Underline::DASHED,
+ Color::BLACK,
+ 0u,
+ 3u,
+ 2u,
+ true,
+ false,
+ false,
+ true,
+ false,
+ }},
+
+ {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='dashed' u-dash-width='4.0f'>ABC8</span>",
+ 24u,
+ 27u,
+ 61u,
+ 64u,
+ {
+ Text::Underline::DASHED,
+ Color::BLACK,
+ 0u,
+ 1u,
+ 4u,
+ true,
+ false,
+ false,
+ false,
+ true,
+ }},
+
+ {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-color='blue' u-type='dashed' u-height='4.0f' u-dash-gap='2.0f' u-dash-width='3.0f'>ABC9</span>",
+ 28u,
+ 31u,
+ 69u,
+ 72u,
+ {
+ Text::Underline::DASHED,
+ Color::BLUE,
+ 4u,
+ 2u,
+ 3u,
+ true,
+ true,
+ true,
+ true,
+ true,
+ }},
+
+ };
+
+ for(uint32_t i = 0; i < NUMBER_OF_CASES; i++)
+ {
+ tet_infoline(data[i].title.c_str());
+ DALI_TEST_EQUALS(underlineRuns[data[i].startIndex].glyphRun.glyphIndex, data[i].startGlyphIndex, TEST_LOCATION);
+ DALI_TEST_EQUALS(underlineRuns[data[i].endIndex].glyphRun.glyphIndex, data[i].endGlyphIndex, TEST_LOCATION);
+
+ DALI_TEST_CHECK(data[i].properties == underlineRuns[data[i].startIndex].properties);
+ DALI_TEST_CHECK(data[i].properties == underlineRuns[data[i].endIndex].properties);
+ }
+
+ END_TEST;
+}
+
int UtcDaliTextEditorFontPointSizeLargerThanAtlas(void)
{
ToolkitTestApplication application;
END_TEST;
}
+int UtcDaliTextFieldMarkupSpanUnderline(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextFieldMarkupSpanUnderline ");
+
+ TextField textField = TextField::New();
+
+ application.GetScene().Add(textField);
+
+ std::string testText =
+ "start<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red'>ABC1</span>then"
+ "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='solid'>ABC2</span>then"
+ "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='dashed'>ABC3</span>then"
+ "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='double'>ABC4</span>then"
+ "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-color='green'>ABC5</span>then"
+ "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-height='5.0f'>ABC6</span>then"
+ "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='dashed' u-dash-gap='3.0f'>ABC7</span>then"
+ "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='dashed' u-dash-width='4.0f'>ABC8</span>then"
+ "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-color='blue' u-type='dashed' u-height='4.0f' u-dash-gap='2.0f' u-dash-width='3.0f'>ABC9</span>end"
+
+ ;
+
+ textField.SetProperty(TextField::Property::TEXT, testText);
+ textField.SetProperty(TextField ::Property::ENABLE_MARKUP, true);
+
+ application.SendNotification();
+ application.Render();
+
+ const uint32_t NUMBER_OF_CASES = 8u;
+ uint32_t expectedNumberOfUnderlinedGlyphs = 32u;
+
+ Toolkit::Internal::TextField& textFieldImpl = GetImpl(textField);
+ const Text::Length numberOfUnderlineRuns = textFieldImpl.GetTextController()->GetTextModel()->GetNumberOfUnderlineRuns();
+
+ DALI_TEST_EQUALS(numberOfUnderlineRuns, expectedNumberOfUnderlinedGlyphs, TEST_LOCATION);
+
+ Vector<UnderlinedGlyphRun> underlineRuns;
+ underlineRuns.Resize(numberOfUnderlineRuns);
+ textFieldImpl.GetTextController()->GetTextModel()->GetUnderlineRuns(underlineRuns.Begin(), 0u, numberOfUnderlineRuns);
+
+ struct DataOfCase
+ {
+ std::string title;
+ uint32_t startIndex;
+ uint32_t endIndex;
+ GlyphIndex startGlyphIndex;
+ GlyphIndex endGlyphIndex;
+ UnderlineStyleProperties properties;
+ };
+ DataOfCase data[] =
+ {
+
+ {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='solid'>ABC2</span>",
+ 0u,
+ 3u,
+ 13u,
+ 16u,
+ {
+ Text::Underline::SOLID,
+ Color::BLACK,
+ 0u,
+ 1u,
+ 2u,
+ true,
+ false,
+ false,
+ false,
+ false,
+ }},
+
+ {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='dashed'>ABC3</span>",
+ 4u,
+ 7u,
+ 21u,
+ 24u,
+ {
+ Text::Underline::DASHED,
+ Color::BLACK,
+ 0u,
+ 1u,
+ 2u,
+ true,
+ false,
+ false,
+ false,
+ false,
+ }},
+
+ {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='double'>ABC4</span>",
+ 8u,
+ 11u,
+ 29u,
+ 32u,
+ {
+ Text::Underline::DOUBLE,
+ Color::BLACK,
+ 0u,
+ 1u,
+ 2u,
+ true,
+ false,
+ false,
+ false,
+ false,
+ }},
+
+ {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-color='green'>ABC5</span>",
+ 12u,
+ 15u,
+ 37u,
+ 40u,
+ {
+ Text::Underline::SOLID,
+ Color::GREEN,
+ 0u,
+ 1u,
+ 2u,
+ false,
+ true,
+ false,
+ false,
+ false,
+ }},
+
+ {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-height='5.0f'>ABC6</span>",
+ 16u,
+ 19u,
+ 45u,
+ 48u,
+ {
+ Text::Underline::SOLID,
+ Color::BLACK,
+ 5u,
+ 1u,
+ 2u,
+ false,
+ false,
+ true,
+ false,
+ false,
+ }},
+
+ {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='dashed' u-dash-gap='3.0f'>ABC7</span>",
+ 20u,
+ 23u,
+ 53u,
+ 56u,
+ {
+ Text::Underline::DASHED,
+ Color::BLACK,
+ 0u,
+ 3u,
+ 2u,
+ true,
+ false,
+ false,
+ true,
+ false,
+ }},
+
+ {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='dashed' u-dash-width='4.0f'>ABC8</span>",
+ 24u,
+ 27u,
+ 61u,
+ 64u,
+ {
+ Text::Underline::DASHED,
+ Color::BLACK,
+ 0u,
+ 1u,
+ 4u,
+ true,
+ false,
+ false,
+ false,
+ true,
+ }},
+
+ {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-color='blue' u-type='dashed' u-height='4.0f' u-dash-gap='2.0f' u-dash-width='3.0f'>ABC9</span>",
+ 28u,
+ 31u,
+ 69u,
+ 72u,
+ {
+ Text::Underline::DASHED,
+ Color::BLUE,
+ 4u,
+ 2u,
+ 3u,
+ true,
+ true,
+ true,
+ true,
+ true,
+ }},
+
+ };
+
+ for(uint32_t i = 0; i < NUMBER_OF_CASES; i++)
+ {
+ tet_infoline(data[i].title.c_str());
+ DALI_TEST_EQUALS(underlineRuns[data[i].startIndex].glyphRun.glyphIndex, data[i].startGlyphIndex, TEST_LOCATION);
+ DALI_TEST_EQUALS(underlineRuns[data[i].endIndex].glyphRun.glyphIndex, data[i].endGlyphIndex, TEST_LOCATION);
+
+ DALI_TEST_CHECK(data[i].properties == underlineRuns[data[i].startIndex].properties);
+ DALI_TEST_CHECK(data[i].properties == underlineRuns[data[i].endIndex].properties);
+ }
+
+ END_TEST;
+}
+
int UtcDaliTextFieldFontPointSizeLargerThanAtlas(void)
{
ToolkitTestApplication application;
END_TEST;
}
+int UtcDaliTextLabelMarkupSpanUnderline(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextLabelMarkupSpanUnderline ");
+
+ TextLabel textLabel = TextLabel::New();
+
+ application.GetScene().Add(textLabel);
+
+ std::string testText =
+ "start<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red'>ABC1</span>then"
+ "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='solid'>ABC2</span>then"
+ "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='dashed'>ABC3</span>then"
+ "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='double'>ABC4</span>then"
+ "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-color='green'>ABC5</span>then"
+ "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-height='5.0f'>ABC6</span>then"
+ "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='dashed' u-dash-gap='3.0f'>ABC7</span>then"
+ "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='dashed' u-dash-width='4.0f'>ABC8</span>then"
+ "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-color='blue' u-type='dashed' u-height='4.0f' u-dash-gap='2.0f' u-dash-width='3.0f'>ABC9</span>end"
+
+ ;
+
+ textLabel.SetProperty(TextLabel::Property::TEXT, testText);
+ textLabel.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true);
+
+ application.SendNotification();
+ application.Render();
+
+ const uint32_t NUMBER_OF_CASES = 8u;
+ uint32_t expectedNumberOfUnderlinedGlyphs = 32u;
+
+ Toolkit::Internal::TextLabel& textLabelImpl = GetImpl(textLabel);
+ const Text::Length numberOfUnderlineRuns = textLabelImpl.GetTextController()->GetTextModel()->GetNumberOfUnderlineRuns();
+
+ DALI_TEST_EQUALS(numberOfUnderlineRuns, expectedNumberOfUnderlinedGlyphs, TEST_LOCATION);
+
+ Vector<UnderlinedGlyphRun> underlineRuns;
+ underlineRuns.Resize(numberOfUnderlineRuns);
+ textLabelImpl.GetTextController()->GetTextModel()->GetUnderlineRuns(underlineRuns.Begin(), 0u, numberOfUnderlineRuns);
+
+ struct DataOfCase
+ {
+ std::string title;
+ uint32_t startIndex;
+ uint32_t endIndex;
+ GlyphIndex startGlyphIndex;
+ GlyphIndex endGlyphIndex;
+ UnderlineStyleProperties properties;
+ };
+ DataOfCase data[] =
+ {
+
+ {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='solid'>ABC2</span>",
+ 0u,
+ 3u,
+ 13u,
+ 16u,
+ {
+ Text::Underline::SOLID,
+ Color::BLACK,
+ 0u,
+ 1u,
+ 2u,
+ true,
+ false,
+ false,
+ false,
+ false,
+ }},
+
+ {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='dashed'>ABC3</span>",
+ 4u,
+ 7u,
+ 21u,
+ 24u,
+ {
+ Text::Underline::DASHED,
+ Color::BLACK,
+ 0u,
+ 1u,
+ 2u,
+ true,
+ false,
+ false,
+ false,
+ false,
+ }},
+
+ {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='double'>ABC4</span>",
+ 8u,
+ 11u,
+ 29u,
+ 32u,
+ {
+ Text::Underline::DOUBLE,
+ Color::BLACK,
+ 0u,
+ 1u,
+ 2u,
+ true,
+ false,
+ false,
+ false,
+ false,
+ }},
+
+ {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-color='green'>ABC5</span>",
+ 12u,
+ 15u,
+ 37u,
+ 40u,
+ {
+ Text::Underline::SOLID,
+ Color::GREEN,
+ 0u,
+ 1u,
+ 2u,
+ false,
+ true,
+ false,
+ false,
+ false,
+ }},
+
+ {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-height='5.0f'>ABC6</span>",
+ 16u,
+ 19u,
+ 45u,
+ 48u,
+ {
+ Text::Underline::SOLID,
+ Color::BLACK,
+ 5u,
+ 1u,
+ 2u,
+ false,
+ false,
+ true,
+ false,
+ false,
+ }},
+
+ {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='dashed' u-dash-gap='3.0f'>ABC7</span>",
+ 20u,
+ 23u,
+ 53u,
+ 56u,
+ {
+ Text::Underline::DASHED,
+ Color::BLACK,
+ 0u,
+ 3u,
+ 2u,
+ true,
+ false,
+ false,
+ true,
+ false,
+ }},
+
+ {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='dashed' u-dash-width='4.0f'>ABC8</span>",
+ 24u,
+ 27u,
+ 61u,
+ 64u,
+ {
+ Text::Underline::DASHED,
+ Color::BLACK,
+ 0u,
+ 1u,
+ 4u,
+ true,
+ false,
+ false,
+ false,
+ true,
+ }},
+
+ {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-color='blue' u-type='dashed' u-height='4.0f' u-dash-gap='2.0f' u-dash-width='3.0f'>ABC9</span>",
+ 28u,
+ 31u,
+ 69u,
+ 72u,
+ {
+ Text::Underline::DASHED,
+ Color::BLUE,
+ 4u,
+ 2u,
+ 3u,
+ true,
+ true,
+ true,
+ true,
+ true,
+ }},
+
+ };
+
+ for(uint32_t i = 0; i < NUMBER_OF_CASES; i++)
+ {
+ tet_infoline(data[i].title.c_str());
+ DALI_TEST_EQUALS(underlineRuns[data[i].startIndex].glyphRun.glyphIndex, data[i].startGlyphIndex, TEST_LOCATION);
+ DALI_TEST_EQUALS(underlineRuns[data[i].endIndex].glyphRun.glyphIndex, data[i].endGlyphIndex, TEST_LOCATION);
+
+ DALI_TEST_CHECK(data[i].properties == underlineRuns[data[i].startIndex].properties);
+ DALI_TEST_CHECK(data[i].properties == underlineRuns[data[i].endIndex].properties);
+ }
+
+ END_TEST;
+}
+
int UtcDaliTextLabelBackgroundTag(void)
{
ToolkitTestApplication application;
#include <dali-toolkit/internal/text/font-description-run.h>
#include <dali-toolkit/internal/text/markup-processor-font.h>
#include <dali-toolkit/internal/text/markup-processor-helper-functions.h>
+#include <dali-toolkit/internal/text/markup-processor-underline.h>
namespace Dali
{
const std::string XHTML_SLANT_ATTRIBUTE("font-slant");
const std::string XHTML_COLOR_ATTRIBUTE("text-color");
+
+//the underlined character's attributes
+const std::string XHTML_UNDERLINE_COLOR_ATTRIBUTE("u-color");
+const std::string XHTML_UNDERLINE_HEIGHT_ATTRIBUTE("u-height");
+const std::string XHTML_UNDERLINE_TYPE_ATTRIBUTE("u-type");
+const std::string XHTML_UNDERLINE_DASH_GAP_ATTRIBUTE("u-dash-gap");
+const std::string XHTML_UNDERLINE_DASH_WIDTH_ATTRIBUTE("u-dash-width");
} // namespace
-void ProcessSpanTag(const Tag& tag, ColorRun& colorRun, FontDescriptionRun& fontRun, bool& isColorDefined, bool& isFontDefined)
+void ProcessSpanTag(const Tag& tag,
+ ColorRun& colorRun,
+ FontDescriptionRun& fontRun,
+ UnderlinedCharacterRun& underlinedCharacterRun,
+ bool& isColorDefined,
+ bool& isFontDefined,
+ bool& isUnderlinedCharacterDefined)
{
for(Vector<Attribute>::ConstIterator it = tag.attributes.Begin(),
endIt = tag.attributes.End();
isFontDefined = true;
ProcessFontSlant(attribute, fontRun);
}
+ else if(TokenComparison(XHTML_UNDERLINE_COLOR_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+ {
+ isUnderlinedCharacterDefined = true;
+ ProcessColorAttribute(attribute, underlinedCharacterRun);
+ }
+ else if(TokenComparison(XHTML_UNDERLINE_HEIGHT_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+ {
+ isUnderlinedCharacterDefined = true;
+ ProcessHeightAttribute(attribute, underlinedCharacterRun);
+ }
+ else if(TokenComparison(XHTML_UNDERLINE_TYPE_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+ {
+ isUnderlinedCharacterDefined = true;
+ ProcessTypeAttribute(attribute, underlinedCharacterRun);
+ }
+ else if(TokenComparison(XHTML_UNDERLINE_DASH_GAP_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+ {
+ isUnderlinedCharacterDefined = true;
+ ProcessDashGapAttribute(attribute, underlinedCharacterRun);
+ }
+ else if(TokenComparison(XHTML_UNDERLINE_DASH_WIDTH_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+ {
+ isUnderlinedCharacterDefined = true;
+ ProcessDashWidthAttribute(attribute, underlinedCharacterRun);
+ }
}
}
* @param[in] tag The span tag and its attributes.
* @param[out] colorRun the color run to be filled.
* @param[out] fontRun the font run to be filled.
+ * @param[out] underlinedCharacterRun the underlined character run to be filled.
* @param[out] isColorDefined if the span has color defined.
* @param[out] isFontDefined if the span has font defined.
+ * @param[out] isUnderlinedCharacterDefined if the span has underlined-character defined.
*/
-void ProcessSpanTag(const Tag& tag, ColorRun& colorRun, FontDescriptionRun& fontRun, bool& isColorDefined, bool& isFontDefined);
+void ProcessSpanTag(const Tag& tag,
+ ColorRun& colorRun,
+ FontDescriptionRun& fontRun,
+ UnderlinedCharacterRun& underlinedCharacterRun,
+ bool& isColorDefined,
+ bool& isFontDefined,
+ bool& isUnderlinedCharacterDefined);
} // namespace Text
// Range 3 0x10000u < XHTML_DECIMAL_ENTITY_RANGE <= 0x10FFFFu
const unsigned long XHTML_DECIMAL_ENTITY_RANGE[] = {0x0u, 0xD7FFu, 0xE000u, 0xFFFDu, 0x10000u, 0x10FFFFu};
-const unsigned int MAX_NUM_OF_ATTRIBUTES = 5u; ///< The font tag has the 'family', 'size' 'weight', 'width' and 'slant' attrubutes.
+const unsigned int MAX_NUM_OF_ATTRIBUTES = 11u; ///< The span tag has the 'font-family', 'font-size' 'font-weight', 'font-width', 'font-slant','text-color', 'u-color', 'u-height','u-type','u-dash-gap'and 'u-dash-width' attrubutes.
const unsigned int DEFAULT_VECTOR_SIZE = 16u; ///< Default size of run vectors.
#if defined(DEBUG_ENABLED)
{
RunIndex colorRunIndex;
RunIndex fontRunIndex;
+ RunIndex underlinedCharacterRunIndex;
bool isColorDefined;
bool isFontDefined;
+ bool isUnderlinedCharacterDefined;
};
/**
*/
void Initialize(Span& span)
{
- span.colorRunIndex = 0u;
- span.isColorDefined = false;
- span.fontRunIndex = 0u;
- span.isFontDefined = false;
+ span.colorRunIndex = 0u;
+ span.isColorDefined = false;
+ span.fontRunIndex = 0u;
+ span.isFontDefined = false;
+ span.underlinedCharacterRunIndex = 0u;
+ span.isUnderlinedCharacterDefined = false;
}
/**
* @param[in] tagReference The tagReference we should increment/decrement
*/
void ProcessSpanForRun(
- const Tag& spanTag,
- StyleStack<Span>& spanStack,
- Vector<ColorRun>& colorRuns,
- Vector<FontDescriptionRun>& fontRuns,
- RunIndex& colorRunIndex,
- RunIndex& fontRunIndex,
- const CharacterIndex characterIndex,
- int& tagReference)
+ const Tag& spanTag,
+ StyleStack<Span>& spanStack,
+ Vector<ColorRun>& colorRuns,
+ Vector<FontDescriptionRun>& fontRuns,
+ Vector<UnderlinedCharacterRun>& underlinedCharacterRuns,
+ RunIndex& colorRunIndex,
+ RunIndex& fontRunIndex,
+ RunIndex& underlinedCharacterRunIndex,
+ const CharacterIndex characterIndex,
+ int& tagReference)
{
if(!spanTag.isEndTag)
{
FontDescriptionRun fontRun;
Initialize(fontRun);
+ UnderlinedCharacterRun underlinedCharacterRun;
+ Initialize(underlinedCharacterRun);
+
Span span;
Initialize(span);
// Fill the run with the parameters.
- colorRun.characterRun.characterIndex = characterIndex;
- fontRun.characterRun.characterIndex = characterIndex;
+ colorRun.characterRun.characterIndex = characterIndex;
+ fontRun.characterRun.characterIndex = characterIndex;
+ underlinedCharacterRun.characterRun.characterIndex = characterIndex;
- span.colorRunIndex = colorRunIndex;
- span.fontRunIndex = fontRunIndex;
+ span.colorRunIndex = colorRunIndex;
+ span.fontRunIndex = fontRunIndex;
+ span.underlinedCharacterRunIndex = underlinedCharacterRunIndex;
- ProcessSpanTag(spanTag, colorRun, fontRun, span.isColorDefined, span.isFontDefined);
+ ProcessSpanTag(spanTag, colorRun, fontRun, underlinedCharacterRun, span.isColorDefined, span.isFontDefined, span.isUnderlinedCharacterDefined);
// Push the span into the stack.
spanStack.Push(span);
++fontRunIndex;
}
+ if(span.isUnderlinedCharacterDefined)
+ {
+ // Push the run in the logical model.
+ underlinedCharacterRuns.PushBack(underlinedCharacterRun);
+ ++underlinedCharacterRunIndex;
+ }
+
// Increase reference
++tagReference;
}
fontRun.characterRun.numberOfCharacters = characterIndex - fontRun.characterRun.characterIndex;
}
+ if(span.isUnderlinedCharacterDefined)
+ {
+ UnderlinedCharacterRun& underlinedCharacterRun = *(underlinedCharacterRuns.Begin() + span.underlinedCharacterRunIndex);
+ underlinedCharacterRun.characterRun.numberOfCharacters = characterIndex - underlinedCharacterRun.characterRun.characterIndex;
+ }
+
--tagReference;
}
}
/* Underline */
ProcessTagForRun<UnderlinedCharacterRun>(
markupProcessData.underlinedCharacterRuns, styleStack, tag, characterIndex, underlinedCharacterRunIndex, uTagReference, [](const Tag& tag, UnderlinedCharacterRun& run) {
- run.properties.color = Color::BLUE;
+ run.properties.color = Color::BLUE;
run.properties.colorDefined = true;
ProcessUnderlineTag(tag, run);
});
}
else if(TokenComparison(XHTML_SPAN_TAG, tag.buffer, tag.length))
{
- ProcessSpanForRun(tag, spanStack, markupProcessData.colorRuns, markupProcessData.fontRuns, colorRunIndex, fontRunIndex, characterIndex, spanTagReference);
+ ProcessSpanForRun(tag, spanStack, markupProcessData.colorRuns, markupProcessData.fontRuns, markupProcessData.underlinedCharacterRuns, colorRunIndex, fontRunIndex, underlinedCharacterRunIndex, characterIndex, spanTagReference);
}
else if(TokenComparison(XHTML_STRIKETHROUGH_TAG, tag.buffer, tag.length))
{
*/
// EXTERNAL INCLUDES
+#include <dali/public-api/common/constants.h>
#include <dali/public-api/math/vector4.h>
// INTERNAL INCLUDES
-
#include <dali-toolkit/public-api/text/text-enumerations.h>
namespace Dali