From: ssabah Date: Sun, 27 Mar 2022 21:23:46 +0000 (+0300) Subject: Refactoring and documenting the markup tags and attributes X-Git-Tag: dali_2.1.17~4 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=8e129c82c96ccd93fa92d64cc1deddfe6eb3cfbb Refactoring and documenting the markup tags and attributes Moved all tags and attributes to separate file. Added doxygen description for each tag and attribute. To check doxygen documentation: 1) Build dali-toolkit 2)Generate the internal documentation for DALi Toolkit https://github.com/dalihub/dali-toolkit/tree/master/docs/generated-internal 3) Goto: Files > File List > dali-toolkit > internal > text > markup-tags-and-attributes.h Change-Id: I42693d0c1ce1169614ccad9391ef4f60a04b3f66 --- diff --git a/dali-toolkit/internal/text/markup-processor-anchor.cpp b/dali-toolkit/internal/text/markup-processor-anchor.cpp index 4c4bb29..771ff4e 100644 --- a/dali-toolkit/internal/text/markup-processor-anchor.cpp +++ b/dali-toolkit/internal/text/markup-processor-anchor.cpp @@ -25,6 +25,7 @@ // INTERNAL INCLUDES #include #include +#include namespace Dali { @@ -32,18 +33,13 @@ namespace Toolkit { namespace Text { -namespace -{ -const std::string XHTML_HREF_ATTRIBUTE("href"); -} // namespace - void ProcessAnchor(const Tag& tag, Anchor& anchor) { anchor.href = nullptr; for(auto&& attribute : tag.attributes) { - if(TokenComparison(XHTML_HREF_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + if(TokenComparison(MARKUP::ANCHOR_ATTRIBUTES::HREF, attribute.nameBuffer, attribute.nameLength)) { Length hrefLength = attribute.valueLength + 1; anchor.href = new char[hrefLength]; diff --git a/dali-toolkit/internal/text/markup-processor-background.cpp b/dali-toolkit/internal/text/markup-processor-background.cpp index 8a9910e..7f0e8ae 100644 --- a/dali-toolkit/internal/text/markup-processor-background.cpp +++ b/dali-toolkit/internal/text/markup-processor-background.cpp @@ -25,6 +25,7 @@ // INTERNAL INCLUDES #include #include +#include namespace Dali { @@ -32,16 +33,11 @@ namespace Toolkit { namespace Text { -namespace -{ -const std::string XHTML_COLOR_ATTRIBUTE("color"); -} // namespace - void ProcessBackground(const Tag& tag, ColorRun& colorRun) { for(auto&& attribute : tag.attributes) { - if(TokenComparison(XHTML_COLOR_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + if(TokenComparison(MARKUP::BACKGROUND_ATTRIBUTES::COLOR, attribute.nameBuffer, attribute.nameLength)) { ColorStringToVector4(attribute.valueBuffer, attribute.valueLength, colorRun.color); } diff --git a/dali-toolkit/internal/text/markup-processor-character-spacing.cpp b/dali-toolkit/internal/text/markup-processor-character-spacing.cpp index f0ef362..cce30dd 100644 --- a/dali-toolkit/internal/text/markup-processor-character-spacing.cpp +++ b/dali-toolkit/internal/text/markup-processor-character-spacing.cpp @@ -25,6 +25,7 @@ #include #include #include +#include namespace Dali { @@ -32,12 +33,6 @@ namespace Toolkit { namespace Text { -namespace -{ -const std::string XHTML_VALUE_ATTRIBUTE("value"); - -} // namespace - void ProcessValueAttribute(const Attribute& attribute, CharacterSpacingCharacterRun& characterSpacingCharacterRun) { characterSpacingCharacterRun.value = ProcessFloatAttribute(attribute); @@ -52,7 +47,7 @@ void ProcessCharacterSpacingTag(const Tag& tag, CharacterSpacingCharacterRun& ch { const Attribute& attribute(*it); - if(TokenComparison(XHTML_VALUE_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + if(TokenComparison(MARKUP::CHARACTER_SPACING_ATTRIBUTES::VALUE, attribute.nameBuffer, attribute.nameLength)) { ProcessValueAttribute(attribute, characterSpacingCharacterRun); } diff --git a/dali-toolkit/internal/text/markup-processor-color.cpp b/dali-toolkit/internal/text/markup-processor-color.cpp index d5fce04..4fb95ef 100644 --- a/dali-toolkit/internal/text/markup-processor-color.cpp +++ b/dali-toolkit/internal/text/markup-processor-color.cpp @@ -24,6 +24,7 @@ // INTERNAL INCLUDES #include #include +#include namespace Dali { @@ -31,11 +32,6 @@ namespace Toolkit { namespace Text { -namespace -{ -const std::string XHTML_VALUE_ATTRIBUTE("value"); -} - void ProcessColor(const Attribute& attribute, ColorRun& colorRun) { ColorStringToVector4(attribute.valueBuffer, attribute.valueLength, colorRun.color); @@ -49,7 +45,7 @@ void ProcessColorTag(const Tag& tag, ColorRun& colorRun) ++it) { const Attribute& attribute(*it); - if(TokenComparison(XHTML_VALUE_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + if(TokenComparison(MARKUP::COLOR_ATTRIBUTES::VALUE, attribute.nameBuffer, attribute.nameLength)) { ProcessColor(attribute, colorRun); } diff --git a/dali-toolkit/internal/text/markup-processor-embedded-item.cpp b/dali-toolkit/internal/text/markup-processor-embedded-item.cpp index 1bfa3f4..94d6fd4 100644 --- a/dali-toolkit/internal/text/markup-processor-embedded-item.cpp +++ b/dali-toolkit/internal/text/markup-processor-embedded-item.cpp @@ -25,6 +25,7 @@ // INTERNAL INCLUDES #include #include +#include namespace Dali { @@ -34,11 +35,6 @@ namespace Text { namespace { -const std::string XHTML_URL_ATTRIBUTE("url"); -const std::string XHTML_WIDTH_ATTRIBUTE("width"); -const std::string XHTML_HEIGHT_ATTRIBUTE("height"); -const std::string XHTML_COLOR_BLENDING_ATTRIBUTE("color-blending"); - const std::string NONE("none"); const std::string MULTIPLY("multiply"); } // namespace @@ -57,22 +53,22 @@ void ProcessEmbeddedItem(const Tag& tag, EmbeddedItem& embeddedItem) ++it) { const Attribute& attribute(*it); - if(TokenComparison(XHTML_URL_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + if(TokenComparison(MARKUP::EMBEDDED_ITEM_ATTRIBUTES::URL, attribute.nameBuffer, attribute.nameLength)) { embeddedItem.urlLength = attribute.valueLength; embeddedItem.url = new char[embeddedItem.urlLength]; memcpy(embeddedItem.url, attribute.valueBuffer, embeddedItem.urlLength); // The memory is freed when the font run is removed from the logical model. } - else if(TokenComparison(XHTML_WIDTH_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + else if(TokenComparison(MARKUP::EMBEDDED_ITEM_ATTRIBUTES::WIDTH, attribute.nameBuffer, attribute.nameLength)) { embeddedItem.width = StringToUint(attribute.valueBuffer); } - else if(TokenComparison(XHTML_HEIGHT_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + else if(TokenComparison(MARKUP::EMBEDDED_ITEM_ATTRIBUTES::HEIGHT, attribute.nameBuffer, attribute.nameLength)) { embeddedItem.height = StringToUint(attribute.valueBuffer); } - else if(TokenComparison(XHTML_COLOR_BLENDING_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + else if(TokenComparison(MARKUP::EMBEDDED_ITEM_ATTRIBUTES::COLOR_BLENDING, attribute.nameBuffer, attribute.nameLength)) { if(TokenComparison(MULTIPLY, attribute.valueBuffer, attribute.valueLength)) { diff --git a/dali-toolkit/internal/text/markup-processor-font.cpp b/dali-toolkit/internal/text/markup-processor-font.cpp index 0c469b8..802f9e9 100644 --- a/dali-toolkit/internal/text/markup-processor-font.cpp +++ b/dali-toolkit/internal/text/markup-processor-font.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include namespace Dali @@ -36,12 +37,6 @@ namespace Text { namespace { -const std::string XHTML_FAMILY_ATTRIBUTE("family"); -const std::string XHTML_SIZE_ATTRIBUTE("size"); -const std::string XHTML_WEIGHT_ATTRIBUTE("weight"); -const std::string XHTML_WIDTH_ATTRIBUTE("width"); -const std::string XHTML_SLANT_ATTRIBUTE("slant"); - const std::string FONT_PREFIX("font-"); const unsigned int FONT_PREFIX_LENGTH = 5u; const unsigned int MIN_FONT_ATTRIBUTE_SIZE = 4u; ///< The minimum length of any of the possible 'weight', 'width' , 'slant' or 'size' values. @@ -97,23 +92,23 @@ void ProcessFontTag(const Tag& tag, FontDescriptionRun& fontRun) { const Attribute& attribute(*it); - if(TokenComparison(XHTML_FAMILY_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + if(TokenComparison(MARKUP::FONT_ATTRIBUTES::FAMILY, attribute.nameBuffer, attribute.nameLength)) { ProcessFontFamily(attribute, fontRun); } - else if(TokenComparison(XHTML_SIZE_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + else if(TokenComparison(MARKUP::FONT_ATTRIBUTES::SIZE, attribute.nameBuffer, attribute.nameLength)) { ProcessFontSize(attribute, fontRun); } - else if(TokenComparison(XHTML_WEIGHT_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + else if(TokenComparison(MARKUP::FONT_ATTRIBUTES::WEIGHT, attribute.nameBuffer, attribute.nameLength)) { ProcessFontWeight(attribute, fontRun); } - else if(TokenComparison(XHTML_WIDTH_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + else if(TokenComparison(MARKUP::FONT_ATTRIBUTES::WIDTH, attribute.nameBuffer, attribute.nameLength)) { ProcessFontWidth(attribute, fontRun); } - else if(TokenComparison(XHTML_SLANT_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + else if(TokenComparison(MARKUP::FONT_ATTRIBUTES::SLANT, attribute.nameBuffer, attribute.nameLength)) { ProcessFontSlant(attribute, fontRun); } diff --git a/dali-toolkit/internal/text/markup-processor-paragraph.cpp b/dali-toolkit/internal/text/markup-processor-paragraph.cpp index 859547e..e470bec 100644 --- a/dali-toolkit/internal/text/markup-processor-paragraph.cpp +++ b/dali-toolkit/internal/text/markup-processor-paragraph.cpp @@ -24,6 +24,7 @@ // INTERNAL INCLUDES #include #include +#include namespace Dali { @@ -31,12 +32,6 @@ namespace Toolkit { namespace Text { -namespace -{ -const std::string XHTML_ALIGN_ATTRIBUTE("align"); -const std::string XHTML_RELATIVE_LINE_HEIGHT_ATTRIBUTE("rel-line-height"); -} // namespace - void ProcessHorizontalAlignment(const Attribute& attribute, BoundedParagraphRun& boundedParagraphRun) { boundedParagraphRun.horizontalAlignmentDefined = HorizontalAlignmentTypeStringToTypeValue(attribute.valueBuffer, @@ -61,11 +56,11 @@ void ProcessAttributesOfParagraphTag(const Tag& tag, BoundedParagraphRun& bounde ++it) { const Attribute& attribute(*it); - if(TokenComparison(XHTML_ALIGN_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + if(TokenComparison(MARKUP::PARAGRAPH_ATTRIBUTES::ALIGN, attribute.nameBuffer, attribute.nameLength)) { ProcessHorizontalAlignment(attribute, boundedParagraphRun); } - else if(TokenComparison(XHTML_RELATIVE_LINE_HEIGHT_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + else if(TokenComparison(MARKUP::PARAGRAPH_ATTRIBUTES::RELATIVE_LINE_HEIGHT, attribute.nameBuffer, attribute.nameLength)) { ProcessRelativeLineHeight(attribute, boundedParagraphRun); } diff --git a/dali-toolkit/internal/text/markup-processor-span.cpp b/dali-toolkit/internal/text/markup-processor-span.cpp index 19810ee..3e20c6f 100644 --- a/dali-toolkit/internal/text/markup-processor-span.cpp +++ b/dali-toolkit/internal/text/markup-processor-span.cpp @@ -29,6 +29,7 @@ #include #include #include +#include namespace Dali { @@ -36,35 +37,6 @@ namespace Toolkit { namespace Text { -namespace -{ -const std::string XHTML_FAMILY_ATTRIBUTE("font-family"); -const std::string XHTML_SIZE_ATTRIBUTE("font-size"); -const std::string XHTML_WEIGHT_ATTRIBUTE("font-weight"); -const std::string XHTML_WIDTH_ATTRIBUTE("font-width"); -const std::string XHTML_SLANT_ATTRIBUTE("font-slant"); - -const std::string XHTML_COLOR_ATTRIBUTE("text-color"); -const std::string XHTML_BACKGROUND_COLOR_ATTRIBUTE("background-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"); - -//the strikethroughed character's attributes -const std::string XHTML_STRIKETHROUGH_COLOR_ATTRIBUTE("s-color"); -const std::string XHTML_STRIKETHROUGH_HEIGHT_ATTRIBUTE("s-height"); - -//the character-spacing character's attributes -const std::string XHTML_CHARACTER_SPACING_VALUE_ATTRIBUTE("char-space-value"); - -//NOTE: the MAX_NUM_OF_ATTRIBUTES in "markup-processor.cpp" should be updated when add a new attribute for span tag. - -} // namespace - void ProcessSpanTag(const Tag& tag, ColorRun& colorRun, FontDescriptionRun& fontRun, @@ -86,77 +58,77 @@ void ProcessSpanTag(const Tag& tag, { const Attribute& attribute(*it); - if(TokenComparison(XHTML_COLOR_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::TEXT_COLOR, attribute.nameBuffer, attribute.nameLength)) { isColorDefined = true; ProcessColor(attribute, colorRun); } - else if(TokenComparison(XHTML_BACKGROUND_COLOR_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + else if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::BACKGROUND_COLOR, attribute.nameBuffer, attribute.nameLength)) { isBackgroundColorDefined = true; ProcessColor(attribute, backgroundColorRun); } - else if(TokenComparison(XHTML_FAMILY_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + else if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::FONT_FAMILY, attribute.nameBuffer, attribute.nameLength)) { isFontDefined = true; ProcessFontFamily(attribute, fontRun); } - else if(TokenComparison(XHTML_SIZE_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + else if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::FONT_SIZE, attribute.nameBuffer, attribute.nameLength)) { isFontDefined = true; ProcessFontSize(attribute, fontRun); } - else if(TokenComparison(XHTML_WEIGHT_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + else if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::FONT_WEIGHT, attribute.nameBuffer, attribute.nameLength)) { isFontDefined = true; ProcessFontWeight(attribute, fontRun); } - else if(TokenComparison(XHTML_WIDTH_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + else if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::FONT_WIDTH, attribute.nameBuffer, attribute.nameLength)) { isFontDefined = true; ProcessFontWidth(attribute, fontRun); } - else if(TokenComparison(XHTML_SLANT_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + else if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::FONT_SLANT, attribute.nameBuffer, attribute.nameLength)) { isFontDefined = true; ProcessFontSlant(attribute, fontRun); } - else if(TokenComparison(XHTML_UNDERLINE_COLOR_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + else if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::UNDERLINE_COLOR, attribute.nameBuffer, attribute.nameLength)) { isUnderlinedCharacterDefined = true; ProcessColorAttribute(attribute, underlinedCharacterRun); } - else if(TokenComparison(XHTML_UNDERLINE_HEIGHT_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + else if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::UNDERLINE_HEIGHT, attribute.nameBuffer, attribute.nameLength)) { isUnderlinedCharacterDefined = true; ProcessHeightAttribute(attribute, underlinedCharacterRun); } - else if(TokenComparison(XHTML_UNDERLINE_TYPE_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + else if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::UNDERLINE_TYPE, attribute.nameBuffer, attribute.nameLength)) { isUnderlinedCharacterDefined = true; ProcessTypeAttribute(attribute, underlinedCharacterRun); } - else if(TokenComparison(XHTML_UNDERLINE_DASH_GAP_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + else if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::UNDERLINE_DASH_GAP, attribute.nameBuffer, attribute.nameLength)) { isUnderlinedCharacterDefined = true; ProcessDashGapAttribute(attribute, underlinedCharacterRun); } - else if(TokenComparison(XHTML_UNDERLINE_DASH_WIDTH_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + else if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::UNDERLINE_DASH_WIDTH, attribute.nameBuffer, attribute.nameLength)) { isUnderlinedCharacterDefined = true; ProcessDashWidthAttribute(attribute, underlinedCharacterRun); } - else if(TokenComparison(XHTML_STRIKETHROUGH_COLOR_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + else if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::STRIKETHROUGH_COLOR, attribute.nameBuffer, attribute.nameLength)) { isStrikethroughDefined = true; ProcessColorAttribute(attribute, strikethroughRun); } - else if(TokenComparison(XHTML_STRIKETHROUGH_HEIGHT_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + else if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::STRIKETHROUGH_HEIGHT, attribute.nameBuffer, attribute.nameLength)) { isStrikethroughDefined = true; ProcessHeightAttribute(attribute, strikethroughRun); } - else if(TokenComparison(XHTML_CHARACTER_SPACING_VALUE_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + else if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::CHARACTER_SPACING_VALUE, attribute.nameBuffer, attribute.nameLength)) { isCharacterSpacingDefined = true; ProcessValueAttribute(attribute, characterSpacingCharacterRun); diff --git a/dali-toolkit/internal/text/markup-processor-strikethrough.cpp b/dali-toolkit/internal/text/markup-processor-strikethrough.cpp index 2f0ea5d..10e104c 100644 --- a/dali-toolkit/internal/text/markup-processor-strikethrough.cpp +++ b/dali-toolkit/internal/text/markup-processor-strikethrough.cpp @@ -24,6 +24,7 @@ // INTERNAL INCLUDES #include #include +#include #include namespace Dali @@ -32,12 +33,6 @@ namespace Toolkit { namespace Text { -namespace -{ -const std::string XHTML_COLOR_ATTRIBUTE("color"); -const std::string XHTML_HEIGHT_ATTRIBUTE("height"); -} // namespace - void ProcessColorAttribute(const Attribute& attribute, StrikethroughCharacterRun& strikethroughRun) { @@ -60,11 +55,11 @@ void ProcessStrikethroughTag(const Tag& tag, StrikethroughCharacterRun& striketh { const Attribute& attribute(*it); - if(TokenComparison(XHTML_COLOR_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + if(TokenComparison(MARKUP::STRIKETHROUGH_ATTRIBUTES::COLOR, attribute.nameBuffer, attribute.nameLength)) { ProcessColorAttribute(attribute, strikethroughRun); } - else if(TokenComparison(XHTML_HEIGHT_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + else if(TokenComparison(MARKUP::STRIKETHROUGH_ATTRIBUTES::HEIGHT, attribute.nameBuffer, attribute.nameLength)) { ProcessHeightAttribute(attribute, strikethroughRun); } diff --git a/dali-toolkit/internal/text/markup-processor-underline.cpp b/dali-toolkit/internal/text/markup-processor-underline.cpp index 8f19b5a..08b9f1e 100644 --- a/dali-toolkit/internal/text/markup-processor-underline.cpp +++ b/dali-toolkit/internal/text/markup-processor-underline.cpp @@ -24,6 +24,7 @@ // INTERNAL INCLUDES #include #include +#include #include #include @@ -35,12 +36,6 @@ namespace Text { namespace { -const std::string XHTML_COLOR_ATTRIBUTE("color"); -const std::string XHTML_HEIGHT_ATTRIBUTE("height"); -const std::string XHTML_TYPE_ATTRIBUTE("type"); -const std::string XHTML_DASH_GAP_ATTRIBUTE("dash-gap"); -const std::string XHTML_DASH_WIDTH_ATTRIBUTE("dash-width"); - const unsigned int MAX_TYPE_ATTRIBUTE_SIZE = 7u; ///< The maximum length of any of the possible 'type' values. } // namespace @@ -85,23 +80,23 @@ void ProcessUnderlineTag(const Tag& tag, UnderlinedCharacterRun& underlinedChara { const Attribute& attribute(*it); - if(TokenComparison(XHTML_COLOR_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + if(TokenComparison(MARKUP::UNDERLINE_ATTRIBUTES::COLOR, attribute.nameBuffer, attribute.nameLength)) { ProcessColorAttribute(attribute, underlinedCharacterRun); } - else if(TokenComparison(XHTML_HEIGHT_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + else if(TokenComparison(MARKUP::UNDERLINE_ATTRIBUTES::HEIGHT, attribute.nameBuffer, attribute.nameLength)) { ProcessHeightAttribute(attribute, underlinedCharacterRun); } - else if(TokenComparison(XHTML_TYPE_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + else if(TokenComparison(MARKUP::UNDERLINE_ATTRIBUTES::TYPE, attribute.nameBuffer, attribute.nameLength)) { ProcessTypeAttribute(attribute, underlinedCharacterRun); } - else if(TokenComparison(XHTML_DASH_GAP_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + else if(TokenComparison(MARKUP::UNDERLINE_ATTRIBUTES::DASH_GAP, attribute.nameBuffer, attribute.nameLength)) { ProcessDashGapAttribute(attribute, underlinedCharacterRun); } - else if(TokenComparison(XHTML_DASH_WIDTH_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength)) + else if(TokenComparison(MARKUP::UNDERLINE_ATTRIBUTES::DASH_WIDTH, attribute.nameBuffer, attribute.nameLength)) { ProcessDashWidthAttribute(attribute, underlinedCharacterRun); } diff --git a/dali-toolkit/internal/text/markup-processor.cpp b/dali-toolkit/internal/text/markup-processor.cpp index 1df19ca..60eb03b 100644 --- a/dali-toolkit/internal/text/markup-processor.cpp +++ b/dali-toolkit/internal/text/markup-processor.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include namespace Dali @@ -46,25 +47,6 @@ namespace Text { namespace { -// HTML-ISH tag and attribute constants. -// Note they must be lower case in order to make the comparison to work -// as the parser converts all the read tags to lower case. -const std::string XHTML_COLOR_TAG("color"); -const std::string XHTML_FONT_TAG("font"); -const std::string XHTML_B_TAG("b"); -const std::string XHTML_I_TAG("i"); -const std::string XHTML_U_TAG("u"); -const std::string XHTML_SHADOW_TAG("shadow"); -const std::string XHTML_GLOW_TAG("glow"); -const std::string XHTML_OUTLINE_TAG("outline"); -const std::string XHTML_ITEM_TAG("item"); -const std::string XHTML_ANCHOR_TAG("a"); -const std::string XHTML_BACKGROUND_TAG("background"); -const std::string XHTML_SPAN_TAG("span"); -const std::string XHTML_STRIKETHROUGH_TAG("s"); -const std::string XHTML_PARAGRAPH_TAG("p"); -const std::string XHTML_CHARACTER_SPACING_TAG("char-spacing"); - const char LESS_THAN = '<'; const char GREATER_THAN = '>'; const char EQUAL = '='; @@ -1117,12 +1099,12 @@ void ProcessMarkupString(const std::string& markupString, MarkupProcessData& mar markupStringEndBuffer, tag)) { - if(TokenComparison(XHTML_COLOR_TAG, tag.buffer, tag.length)) + if(TokenComparison(MARKUP::TAG::COLOR, tag.buffer, tag.length)) { ProcessTagForRun( markupProcessData.colorRuns, styleStack, tag, characterIndex, colorRunIndex, colorTagReference, [](const Tag& tag, ColorRun& run) { ProcessColorTag(tag, run); }); } // - else if(TokenComparison(XHTML_I_TAG, tag.buffer, tag.length)) + else if(TokenComparison(MARKUP::TAG::ITALIC, tag.buffer, tag.length)) { ProcessTagForRun( markupProcessData.fontRuns, styleStack, tag, characterIndex, fontRunIndex, iTagReference, [](const Tag&, FontDescriptionRun& fontRun) { @@ -1130,12 +1112,12 @@ void ProcessMarkupString(const std::string& markupString, MarkupProcessData& mar fontRun.slantDefined = true; }); } // - else if(TokenComparison(XHTML_U_TAG, tag.buffer, tag.length)) + else if(TokenComparison(MARKUP::TAG::UNDERLINE, tag.buffer, tag.length)) { ProcessTagForRun( markupProcessData.underlinedCharacterRuns, styleStack, tag, characterIndex, underlinedCharacterRunIndex, uTagReference, [](const Tag& tag, UnderlinedCharacterRun& run) { ProcessUnderlineTag(tag, run); }); } // - else if(TokenComparison(XHTML_B_TAG, tag.buffer, tag.length)) + else if(TokenComparison(MARKUP::TAG::BOLD, tag.buffer, tag.length)) { ProcessTagForRun( markupProcessData.fontRuns, styleStack, tag, characterIndex, fontRunIndex, bTagReference, [](const Tag&, FontDescriptionRun& fontRun) { @@ -1143,12 +1125,12 @@ void ProcessMarkupString(const std::string& markupString, MarkupProcessData& mar fontRun.weightDefined = true; }); } // - else if(TokenComparison(XHTML_FONT_TAG, tag.buffer, tag.length)) + else if(TokenComparison(MARKUP::TAG::FONT, tag.buffer, tag.length)) { ProcessTagForRun( markupProcessData.fontRuns, styleStack, tag, characterIndex, fontRunIndex, fontTagReference, [](const Tag& tag, FontDescriptionRun& fontRun) { ProcessFontTag(tag, fontRun); }); } // - else if(TokenComparison(XHTML_ANCHOR_TAG, tag.buffer, tag.length)) + else if(TokenComparison(MARKUP::TAG::ANCHOR, tag.buffer, tag.length)) { /* Anchor */ ProcessAnchorTag(markupProcessData, tag, characterIndex); @@ -1166,31 +1148,31 @@ void ProcessMarkupString(const std::string& markupString, MarkupProcessData& mar ProcessUnderlineTag(tag, run); }); } // tizen - else if(TokenComparison(XHTML_SHADOW_TAG, tag.buffer, tag.length)) + else if(TokenComparison(MARKUP::TAG::SHADOW, tag.buffer, tag.length)) { // TODO: If !tag.isEndTag, then create a new shadow run. // else Pop the top of the stack and set the number of characters of the run. } // - else if(TokenComparison(XHTML_GLOW_TAG, tag.buffer, tag.length)) + else if(TokenComparison(MARKUP::TAG::GLOW, tag.buffer, tag.length)) { // TODO: If !tag.isEndTag, then create a new glow run. // else Pop the top of the stack and set the number of characters of the run. } // - else if(TokenComparison(XHTML_OUTLINE_TAG, tag.buffer, tag.length)) + else if(TokenComparison(MARKUP::TAG::OUTLINE, tag.buffer, tag.length)) { // TODO: If !tag.isEndTag, then create a new outline run. // else Pop the top of the stack and set the number of characters of the run. } // - else if(TokenComparison(XHTML_ITEM_TAG, tag.buffer, tag.length)) + else if(TokenComparison(MARKUP::TAG::EMBEDDED_ITEM, tag.buffer, tag.length)) { ProcessItemTag(markupProcessData, tag, characterIndex); } - else if(TokenComparison(XHTML_BACKGROUND_TAG, tag.buffer, tag.length)) + else if(TokenComparison(MARKUP::TAG::BACKGROUND, tag.buffer, tag.length)) { ProcessTagForRun( markupProcessData.backgroundColorRuns, styleStack, tag, characterIndex, backgroundRunIndex, backgroundTagReference, [](const Tag& tag, ColorRun& run) { ProcessBackground(tag, run); }); } - else if(TokenComparison(XHTML_SPAN_TAG, tag.buffer, tag.length)) + else if(TokenComparison(MARKUP::TAG::SPAN, tag.buffer, tag.length)) { ProcessSpanForRun(tag, spanStack, @@ -1209,18 +1191,18 @@ void ProcessMarkupString(const std::string& markupString, MarkupProcessData& mar characterIndex, spanTagReference); } - else if(TokenComparison(XHTML_STRIKETHROUGH_TAG, tag.buffer, tag.length)) + else if(TokenComparison(MARKUP::TAG::STRIKETHROUGH, tag.buffer, tag.length)) { ProcessTagForRun( markupProcessData.strikethroughCharacterRuns, styleStack, tag, characterIndex, strikethroughCharacterRunIndex, sTagReference, [](const Tag& tag, StrikethroughCharacterRun& run) { ProcessStrikethroughTag(tag, run); }); } // - else if(TokenComparison(XHTML_PARAGRAPH_TAG, tag.buffer, tag.length)) + else if(TokenComparison(MARKUP::TAG::PARAGRAPH, tag.buffer, tag.length)) { ProcessParagraphTag(markupProcessData, tag, (markupStringBuffer == markupStringEndBuffer), characterIndex); ProcessTagForRun( markupProcessData.boundedParagraphRuns, styleStack, tag, characterIndex, boundedParagraphRunIndex, pTagReference, [](const Tag& tag, BoundedParagraphRun& run) { ProcessAttributesOfParagraphTag(tag, run); }); } //

- else if(TokenComparison(XHTML_CHARACTER_SPACING_TAG, tag.buffer, tag.length)) + else if(TokenComparison(MARKUP::TAG::CHARACTER_SPACING, tag.buffer, tag.length)) { ProcessTagForRun( markupProcessData.characterSpacingCharacterRuns, styleStack, tag, characterIndex, characterSpacingCharacterRunIndex, characterSpacingTagReference, [](const Tag& tag, CharacterSpacingCharacterRun& run) { ProcessCharacterSpacingTag(tag, run); }); diff --git a/dali-toolkit/internal/text/markup-tags-and-attributes.h b/dali-toolkit/internal/text/markup-tags-and-attributes.h new file mode 100644 index 0000000..0f75d6a --- /dev/null +++ b/dali-toolkit/internal/text/markup-tags-and-attributes.h @@ -0,0 +1,719 @@ +#ifndef DALI_TOOLKIT_TEXT_MARKUPS_AND_ATTRIBUTES_H +#define DALI_TOOLKIT_TEXT_MARKUPS_AND_ATTRIBUTES_H + +/* + * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include + +namespace Dali +{ +namespace Toolkit +{ +namespace Text +{ +/** + * @brief Use markup styling to style Text-Controller. + * The markup tag is opend by <> and closed by + * + * @details You can use markup elements to change the style of the text. + * Since the text controls do not process markup elements by default, you must first set the EnableMarkup property of the Text-Controller to true: + * + * @note The markup processor does not check for markup validity, and styles are rendered in priority order. + * Incorrect or incompatible elements can cause the text to be rendered incorrectly. + */ +namespace MARKUP +{ +namespace TAG +{ +// HTML-ISH tag and attribute constants. +// Note they must be lower case in order to make the comparison to work +// as the parser converts all the read tags to lower case. + +/** + * @brief Sets the color for the characters inside the element. + * + * The following example explains how to apply it: + * @code + * + * textController.Text = "Hello world"; + * + * @endcode + * + * @see COLOR_ATTRIBUTES + * + */ +static const std::string COLOR("color"); + +/** + * @brief Sets the font values for the characters inside the element. + * + * The following example explains how to apply it: + * @code + * + * textController.Text = "Hello world"; + * + * @endcode + * + * @see FONT_ATTRIBUTES + */ +static const std::string FONT("font"); + +/** + * @brief Sets Bold decoration for the characters inside the element. + * + * The following example explains how to apply it: + * @code + * + * textController.Text = "Hello world"; + * + * @endcode + * + * @see + */ +static const std::string BOLD("b"); + +/** + * @brief Sets Italic decoration for the characters inside the element. + * + * The following example explains how to apply it: + * @code + * + * textController.Text = "Hello world"; + * + * @endcode + * + */ +static const std::string ITALIC("i"); + +/** + * @brief Sets the underlined values for the characters inside the element. + * + * The following example explains how to apply it: + * @code + * + * textController.Text = "Hello world"; + * + * @endcode + * + * @see UNDERLINE_ATTRIBUTES + */ +static const std::string UNDERLINE("u"); + +/** + * @todo Sets the shadow for the characters inside the element. + * + */ +static const std::string SHADOW("shadow"); ///< This tag under construction. + +/** + * @todo Sets the glow for the characters inside the element. + * + */ +static const std::string GLOW("glow"); ///< This tag under construction. + +/** + * @todo Sets the outline for the characters inside the element. + * + */ +static const std::string OUTLINE("outline"); ///< This tag under construction. + +/** + * @brief Defines an embedded item within the text. + * + * The following example explains how to apply it: + * @code + * + * textController.Text = ""; + * + * @endcode + * + * @see EMBEDDED_ITEM_ATTRIBUTES + */ +static const std::string EMBEDDED_ITEM("item"); + +/** + * @brief Defines a hyperlink for the text inside the element. + * + * The following example explains how to apply it: + * @code + * + * textController.Text = "TIZEN"; + * + * @endcode + * + * @see ANCHOR_ATTRIBUTES + */ +static const std::string ANCHOR("a"); + +/** + * @brief Sets the background color for the characters inside the element. + * + * The following example explains how to apply it: + * @code + * + * textController.Text = "Hello world"; + * + * @endcode + * + * @see BACKGROUND_ATTRIBUTES + */ +static const std::string BACKGROUND("background"); + +/** + * @brief Use span tag to set many styles on character's level for the characters inside the element. + * + * The following example explains how to apply it: + * @code + * + * textController.Text = "Hello world"; + * + * @endcode + * + * @see SPAN_ATTRIBUTES + */ +static const std::string SPAN("span"); + +/** + * @brief Sets the strikethrough values for the characters inside the element. + * + * The following example explains how to apply it: + * @code + * + * textController.Text = "Hello world"; + * + * @endcode + * + * @see STRIKETHROUGH_ATTRIBUTES + */ +static const std::string STRIKETHROUGH("s"); + +/** + * @brief Use paragraph tag to set many styles on paragraph's level for the lines inside the element. + * + * The following example explains how to apply it: + * @code + * + * textController.Text = "test before paragraph tag

test paragraph tag

test after paragraph tag "; + * + * @endcode + * + * @see PARAGRAPH_ATTRIBUTES + */ +static const std::string PARAGRAPH("p"); + +/** + * @brief Sets the character spacing values for the characters inside the element. + * + * The following example explains how to apply it: + * @code + * + * textController.Text = "Hello world"; + * + * @endcode + * + * @see CHARACTER_SPACING_ATTRIBUTES + */ +static const std::string CHARACTER_SPACING("char-spacing"); +} // namespace TAG + +namespace COLOR_ATTRIBUTES +{ +/** + * @brief Use the value attribute to define the color. + * The supported attribute values are red, green, blue, yellow, magenta, cyan, white, black, and transparent. + * Web colors and colors represented in 32-bit hexadecimal 0xAARRGGBB format are also supported. + * + * The following examples show text in red color: + * @code + * + * textController.Text = "Hello world"; /// Color coded with a text constant + * + * @endcode + * + * @code + * + * textController.Text = "Hello world"); /// Color packed inside an ARGB hexadecimal value + * + * @endcode + */ +static const std::string VALUE("value"); +} // namespace COLOR_ATTRIBUTES + +namespace FONT_ATTRIBUTES +{ +/** + * @brief Use the family attribute to define the font name. + * + * Example: + * @code + * + * textController.Text = "Hello world"; + * + * @endcode + * + */ +static const std::string FAMILY("family"); + +/** + * @brief Use the size attribute to define the font size in points. + * + * Example: + * @code + * + * textController.Text = "Hello world"; + * + * @endcode + * + */ +static const std::string SIZE("size"); + +/** + * @brief Use the weight attribute to define the font weight. + * + * Example: + * @code + * + * textController.Text = "Hello world"; + * + * @endcode + * + */ +static const std::string WEIGHT("weight"); + +/** + * @brief Use the width attribute to define the font width. + * + * Example: + * @code + * + * textController.Text = "Hello world"; + * + * @endcode + * + */ +static const std::string WIDTH("width"); + +/** + * @brief Use the slant attribute to define the font slant. + * + * Example: + * @code + * + * textController.Text = "Hello world"; + * + * @endcode + * + */ +static const std::string SLANT("slant"); +} // namespace FONT_ATTRIBUTES + +namespace UNDERLINE_ATTRIBUTES +{ +/** + * @brief Use the color attribute to define the color of underline. + * The supported attribute values are red, green, blue, yellow, magenta, cyan, white, black, and transparent. + * Web colors and colors represented in 32-bit hexadecimal 0xAARRGGBB format are also supported. + * + * The following example explains how to apply it: + * @code + * + * textController.Text = "Hello world"; + * + * @endcode + */ +static const std::string COLOR("color"); + +/** + * @brief Use the height attribute to define the height of underline. + * It is float value. + * + * The following example explains how to apply it: + * @code + * + * textController.Text = "Hello world"; + * + * @endcode + */ +static const std::string HEIGHT("height"); + +/** + * @brief Use the type attribute to define the type of underline. + * The supported attribute values are solid, dashed and double + * The default value is solid + * + * The following example explains how to apply it: + * @code + * + * textController.Text = "Hello world"; + * + * @endcode + */ +static const std::string TYPE("type"); + +/** + * @brief Use the dash-gap attribute to define the dash-gap of underline. + * The gap in pixels between the dashes of the dashed underline. Only valid when "DASHED" underline type is used. + * + * It is float value. + * @note If not provided then the default gap is used (1 pixel). + * + * The following example explains how to apply it: + * @code + * + * textController.Text = "Hello world"; + * + * @endcode + */ +static const std::string DASH_GAP("dash-gap"); + +/** + * @brief Use the dash-width attribute to define the dash-width of underline. + * The width in pixels of the dashes of the dashed underline. Only valid when "DASHED" underline type is used. + * It is float value. + * @note If not provided then the default width is used (2 pixel). + * + * The following example explains how to apply it: + * @code + * + * textController.Text = "Hello world"; + * + * @endcode + */ +static const std::string DASH_WIDTH("dash-width"); + +} // namespace UNDERLINE_ATTRIBUTES + +namespace SPAN_ATTRIBUTES +{ +//NOTE: the MAX_NUM_OF_ATTRIBUTES in "markup-processor.cpp" should be updated when add a new attribute for span tag. + +/** + * @brief The font family attribute. + * + * Example: + * @code + * textController.Text = "Hello world"; + * @endcode + * @see FONT_ATTRIBUTES::FAMILY + */ +static const std::string FONT_FAMILY("font-family"); + +/** + * @brief The font size attribute. + * + * Example: + * @code + * textController.Text = "Hello world"; + * @endcode + * @see FONT_ATTRIBUTES::SIZE + */ +static const std::string FONT_SIZE("font-size"); + +/** + * @brief The font weight attribute. + * + * Example: + * @code + * textController.Text = "Hello world"; + * @endcode + * @see FONT_ATTRIBUTES::WEIGHT + */ +static const std::string FONT_WEIGHT("font-weight"); + +/** + * @brief The font width attribute. + * + * Example: + * @code + * textController.Text = "Hello world"; + * @endcode + * @see FONT_ATTRIBUTES::WIDTH + */ +static const std::string FONT_WIDTH("font-width"); + +/** + * @brief The font slant attribute. + * + * Example: + * @code + * textController.Text = "Hello world"; + * @endcode + * @see FONT_ATTRIBUTES::SLANT + */ +static const std::string FONT_SLANT("font-slant"); + +/** + * @brief The color value attribute. + * + * Example: + * @code + * textController.Text = "Hello world"; + * @endcode + * @see COLOR_ATTRIBUTES::VALUE + */ +static const std::string TEXT_COLOR("text-color"); + +/** + * @brief The background color attribute. + * + * Example: + * @code + * textController.Text = "Hello world"; + * @endcode + * @see BACKGROUND_ATTRIBUTES::COLOR + */ +static const std::string BACKGROUND_COLOR("background-color"); + +/** + * @brief The undeline color attribute. + * + * Example: + * @code + * textController.Text = "Hello world"; + * @endcode + * @see UNDERLINE_ATTRIBUTES::COLOR + */ +static const std::string UNDERLINE_COLOR("u-color"); + +/** + * @brief The undeline height attribute. + * + * Example: + * @code + * textController.Text = "Hello world"; + * @endcode + * @see UNDERLINE_ATTRIBUTES::HEIGHT + */ +static const std::string UNDERLINE_HEIGHT("u-height"); + +/** + * @brief The undeline type attribute. + * + * Example: + * @code + * textController.Text = "Hello world"; + * @endcode + * @see UNDERLINE_ATTRIBUTES::TYPE + */ +static const std::string UNDERLINE_TYPE("u-type"); + +/** + * @brief The undeline dash-gap attribute. + * + * Example: + * @code + * textController.Text = "Hello world"; + * @endcode + * @see UNDERLINE_ATTRIBUTES::DASH_GAP + */ +static const std::string UNDERLINE_DASH_GAP("u-dash-gap"); + +/** + * @brief The undeline dash-width attribute. + * + * Example: + * @code + * textController.Text = "Hello world"; + * @endcode + * @see UNDERLINE_ATTRIBUTES::DASH_WIDTH + */ +static const std::string UNDERLINE_DASH_WIDTH("u-dash-width"); + +/** + * @brief The strikethrough color attribute. + * + * Example: + * @code + * textController.Text = "Hello world"; + * @endcode + * @see STRIKETHROUGH_ATTRIBUTES::COLOR + */ +static const std::string STRIKETHROUGH_COLOR("s-color"); + +/** + * @brief The strikethrough height attribute. + * + * Example: + * @code + * textController.Text = "Hello world"; + * @endcode + * @see STRIKETHROUGH_ATTRIBUTES::HEIGHT + */ +static const std::string STRIKETHROUGH_HEIGHT("s-height"); + +/** + * @brief The character-spacing value attribute. + * + * Example: + * @code + * textController.Text = "Hello world"; + * @endcode + * @see CHARACTER_SPACING_ATTRIBUTES::VALUE + */ +static const std::string CHARACTER_SPACING_VALUE("char-space-value"); +} // namespace SPAN_ATTRIBUTES + +namespace STRIKETHROUGH_ATTRIBUTES +{ +/** + * @brief Use the color attribute to define the color of strikethrough. + * The supported attribute values are red, green, blue, yellow, magenta, cyan, white, black, and transparent. + * Web colors and colors represented in 32-bit hexadecimal 0xAARRGGBB format are also supported. + * + * The following example explains how to apply it: + * @code + * + * textController.Text = "Hello world"; + * + * @endcode + */ +static const std::string COLOR("color"); + +/** + * @brief Use the height attribute to define the height of strikethrough. + * It is float value. + * + * The following example explains how to apply it: + * @code + * + * textController.Text = "Hello world"; + * + * @endcode + */ +static const std::string HEIGHT("height"); +} // namespace STRIKETHROUGH_ATTRIBUTES + +namespace PARAGRAPH_ATTRIBUTES +{ +/** + * @brief Use the align attribute to define the horizontal alignment of paragraph. + * The supported attribute values are begin, center and end . + * + * The following example explains how to apply it: + * @code + * + * textController.Text = ""text outside

Paragraph end

text outside

Paragraph center

text outside

Paragraph begin

"; + * + * @endcode + */ +static const std::string ALIGN("align"); + +/** + * @brief Use the rrel-line-height attribute to define the relative height of the line (a factor that will be multiplied by text height). + * It is float value. + * + * The following example explains how to apply it: + * @code + * + * textController.Text = "

line 1

line\n2

line 3

line\n4

line 5"; + * + * @endcode + * @note If the value is less than 1, the lines could to be overlapped. + */ +static const std::string RELATIVE_LINE_HEIGHT("rel-line-height"); + +} // namespace PARAGRAPH_ATTRIBUTES + +namespace CHARACTER_SPACING_ATTRIBUTES +{ +/** + * @brief Use the value attribute to define the spaces between characters in Pixels. + * A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed). + * + * Examples: + * @code + * + * textController.Text = "Hello world"; /// Expanded + * + * @endcode + * + * @code + * + * textController.Text = "Hello world"); /// Condensed + * + * @endcode + */ +static const std::string VALUE("value"); +} // namespace CHARACTER_SPACING_ATTRIBUTES +namespace BACKGROUND_ATTRIBUTES +{ +/** + * @brief Use the value attribute to define the color of background. + * The supported attribute values are red, green, blue, yellow, magenta, cyan, white, black, and transparent. + * Web colors and colors represented in 32-bit hexadecimal 0xAARRGGBB format are also supported. + * + * The following example explains how to apply it: + * @code + * + * textController.Text = "Hello world"; + * + * @endcode + */ +static const std::string COLOR("color"); + +} // namespace BACKGROUND_ATTRIBUTES + +namespace EMBEDDED_ITEM_ATTRIBUTES +{ +/** + * @brief Use the url attribute to define url path of the image. + * + * @note The url of the image is optional. If there is no image + * the layout engine will use the width and height to + * create a space inside the text. This gap can be filled later. + */ +static const std::string URL("url"); + +/** + * @brief Use the width attribute to define the width of the item. + */ +static const std::string WIDTH("width"); + +/** + * @brief Use the height attribute to define the height of the item. + */ +static const std::string HEIGHT("height"); + +/** + * @brief Use the color-blending attribute to define whether the color of the image is multiplied by the color of the text. + * + * @note A color blending mode can be set. The default is NONE, the image will use its own color. If MULTIPLY is set, the color + * of the image will be multiplied by the color of the text. + */ +static const std::string COLOR_BLENDING("color-blending"); +} // namespace EMBEDDED_ITEM_ATTRIBUTES + +namespace ANCHOR_ATTRIBUTES +{ +/** + * @brief Use the href attribute to define the url of hyperlink. + */ +static const std::string HREF("href"); + +} // namespace ANCHOR_ATTRIBUTES + +} // namespace MARKUP + +} // namespace Text + +} // namespace Toolkit + +} // namespace Dali + +#endif // DALI_TOOLKIT_TEXT_MARKUPS_AND_ATTRIBUTES_H