2 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali-toolkit/internal/text/markup-processor.h>
22 #include <dali/integration-api/debug.h>
23 #include <climits> // for ULONG_MAX
27 #include <dali-toolkit/internal/text/character-set-conversion.h>
28 #include <dali-toolkit/internal/text/markup-processor-anchor.h>
29 #include <dali-toolkit/internal/text/markup-processor-background.h>
30 #include <dali-toolkit/internal/text/markup-processor-color.h>
31 #include <dali-toolkit/internal/text/markup-processor-embedded-item.h>
32 #include <dali-toolkit/internal/text/markup-processor-font.h>
33 #include <dali-toolkit/internal/text/markup-processor-helper-functions.h>
34 #include <dali-toolkit/internal/text/xhtml-entities.h>
44 // HTML-ISH tag and attribute constants.
45 // Note they must be lower case in order to make the comparison to work
46 // as the parser converts all the read tags to lower case.
47 const std::string XHTML_COLOR_TAG("color");
48 const std::string XHTML_FONT_TAG("font");
49 const std::string XHTML_B_TAG("b");
50 const std::string XHTML_I_TAG("i");
51 const std::string XHTML_U_TAG("u");
52 const std::string XHTML_SHADOW_TAG("shadow");
53 const std::string XHTML_GLOW_TAG("glow");
54 const std::string XHTML_OUTLINE_TAG("outline");
55 const std::string XHTML_ITEM_TAG("item");
56 const std::string XHTML_ANCHOR_TAG("a");
57 const std::string XHTML_BACKGROUND_TAG("background");
59 const char LESS_THAN = '<';
60 const char GREATER_THAN = '>';
61 const char EQUAL = '=';
62 const char QUOTATION_MARK = '\'';
63 const char SLASH = '/';
64 const char BACK_SLASH = '\\';
65 const char AMPERSAND = '&';
66 const char HASH = '#';
67 const char SEMI_COLON = ';';
68 const char CHAR_ARRAY_END = '\0';
69 const char HEX_CODE = 'x';
71 const char WHITE_SPACE = 0x20; // ASCII value of the white space.
73 // Range 1 0x0u < XHTML_DECIMAL_ENTITY_RANGE <= 0xD7FFu
74 // Range 2 0xE000u < XHTML_DECIMAL_ENTITY_RANGE <= 0xFFFDu
75 // Range 3 0x10000u < XHTML_DECIMAL_ENTITY_RANGE <= 0x10FFFFu
76 const unsigned long XHTML_DECIMAL_ENTITY_RANGE[] = {0x0u, 0xD7FFu, 0xE000u, 0xFFFDu, 0x10000u, 0x10FFFFu};
78 const unsigned int MAX_NUM_OF_ATTRIBUTES = 5u; ///< The font tag has the 'family', 'size' 'weight', 'width' and 'slant' attrubutes.
79 const unsigned int DEFAULT_VECTOR_SIZE = 16u; ///< Default size of run vectors.
81 #if defined(DEBUG_ENABLED)
82 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_MARKUP_PROCESSOR");
86 * @brief Struct used to retrieve the style runs from the mark-up string.
90 typedef VectorBase::SizeType RunIndex;
92 Vector<RunIndex> stack; ///< Use a vector as a style stack. Stores the indices pointing where the run is stored inside the logical model.
93 unsigned int topIndex; ///< Points the top of the stack.
99 stack.Resize(DEFAULT_VECTOR_SIZE);
102 void Push(RunIndex index)
104 // Check if there is space inside the style stack.
105 const VectorBase::SizeType size = stack.Count();
108 // Resize the style stack.
109 stack.Resize(2u * size);
112 // Set the run index in the top of the stack.
113 *(stack.Begin() + topIndex) = index;
115 // Reposition the pointer to the top of the stack.
121 // Pop the top of the stack.
123 return *(stack.Begin() + topIndex);
128 * @brief Initializes a font run description to its defaults.
130 * @param[in,out] fontRun The font description run to initialize.
132 void Initialize(FontDescriptionRun& fontRun)
134 fontRun.characterRun.characterIndex = 0u;
135 fontRun.characterRun.numberOfCharacters = 0u;
136 fontRun.familyName = NULL;
137 fontRun.familyLength = 0u;
138 fontRun.weight = TextAbstraction::FontWeight::NORMAL;
139 fontRun.width = TextAbstraction::FontWidth::NORMAL;
140 fontRun.slant = TextAbstraction::FontSlant::NORMAL;
142 fontRun.familyDefined = false;
143 fontRun.weightDefined = false;
144 fontRun.widthDefined = false;
145 fontRun.slantDefined = false;
146 fontRun.sizeDefined = false;
150 * @brief Initializes a color run description to its defaults.
152 * @param[in,out] colorRun The font description run to initialize.
154 void Initialize(ColorRun& colorRun)
156 colorRun.characterRun.characterIndex = 0u;
157 colorRun.characterRun.numberOfCharacters = 0u;
161 * @brief Initializes a underlined character run to its defaults.
163 * @param[in,out] underlinedCharacterRun The underelined character run to initialize.
165 void Initialize(UnderlinedCharacterRun& underlinedCharacterRun)
167 underlinedCharacterRun.characterRun.characterIndex = 0u;
168 underlinedCharacterRun.characterRun.numberOfCharacters = 0u;
172 * @brief Splits the tag string into the tag name and its attributes.
174 * The attributes are stored in a vector in the tag.
176 * @param[in,out] tag The tag.
178 void ParseAttributes(Tag& tag)
180 if(tag.buffer == NULL)
185 tag.attributes.Resize(MAX_NUM_OF_ATTRIBUTES);
187 // Find first the tag name.
188 bool isQuotationOpen = false;
190 const char* tagBuffer = tag.buffer;
191 const char* const tagEndBuffer = tagBuffer + tag.length;
193 for(; tagBuffer < tagEndBuffer; ++tagBuffer)
195 const char character = *tagBuffer;
196 if(WHITE_SPACE < character)
202 // Stops counting the length of the tag when a white space is found.
203 // @note a white space is the WHITE_SPACE character and anything below as 'tab', 'return' or 'control characters'.
207 SkipWhiteSpace(tagBuffer, tagEndBuffer);
209 // Find the attributes.
210 unsigned int attributeIndex = 0u;
211 const char* nameBuffer = NULL;
212 const char* valueBuffer = NULL;
213 Length nameLength = 0u;
214 Length valueLength = 0u;
216 bool addToNameValue = true;
217 Length numberOfWhiteSpace = 0u;
218 for(; tagBuffer < tagEndBuffer; ++tagBuffer)
220 const char character = *tagBuffer;
221 if((WHITE_SPACE >= character) && !isQuotationOpen)
223 if(NULL != valueBuffer)
225 // Remove white spaces at the end of the value.
226 valueLength -= numberOfWhiteSpace;
229 if((NULL != nameBuffer) && (NULL != valueBuffer))
231 // Every time a white space is found, a new attribute is created and stored in the attributes vector.
232 Attribute& attribute = *(tag.attributes.Begin() + attributeIndex);
235 attribute.nameBuffer = nameBuffer;
236 attribute.valueBuffer = valueBuffer;
237 attribute.nameLength = nameLength;
238 attribute.valueLength = valueLength;
245 addToNameValue = true; // next read characters will be added to the name.
248 else if(EQUAL == character) // '='
250 addToNameValue = false; // next read characters will be added to the value.
251 SkipWhiteSpace(tagBuffer, tagEndBuffer);
253 else if(QUOTATION_MARK == character) // '\''
255 // Do not add quotation marks to neither name nor value.
256 isQuotationOpen = !isQuotationOpen;
261 SkipWhiteSpace(tagBuffer, tagEndBuffer);
267 // Adds characters to the name or the value.
270 if(NULL == nameBuffer)
272 nameBuffer = tagBuffer;
280 if(WHITE_SPACE >= character)
282 ++numberOfWhiteSpace;
286 numberOfWhiteSpace = 0u;
289 if(NULL == valueBuffer)
291 valueBuffer = tagBuffer;
298 if(NULL != valueBuffer)
300 // Remove white spaces at the end of the value.
301 valueLength -= numberOfWhiteSpace;
304 if((NULL != nameBuffer) && (NULL != valueBuffer))
306 // Checks if the last attribute needs to be added.
307 Attribute& attribute = *(tag.attributes.Begin() + attributeIndex);
310 attribute.nameBuffer = nameBuffer;
311 attribute.valueBuffer = valueBuffer;
312 attribute.nameLength = nameLength;
313 attribute.valueLength = valueLength;
316 // Resize the vector of attributes.
317 tag.attributes.Resize(attributeIndex);
321 * @brief It parses a tag and its attributes if the given iterator @e it is pointing at a tag beginning.
323 * @param[in,out] markupStringBuffer The mark-up string buffer. It's a const iterator pointing the current character.
324 * @param[in] markupStringEndBuffer Pointer to one character after the end of the mark-up string buffer.
325 * @param[out] tag The tag with its attributes.
327 * @return @e true if the iterator @e it is pointing a mark-up tag. Otherwise @e false.
329 bool IsTag(const char*& markupStringBuffer,
330 const char* const markupStringEndBuffer,
334 bool isQuotationOpen = false;
335 bool attributesFound = false;
336 tag.isEndTag = false;
337 bool isPreviousLessThan = false;
338 bool isPreviousSlash = false;
340 const char character = *markupStringBuffer;
341 if(LESS_THAN == character) // '<'
345 isPreviousLessThan = true;
347 // if the iterator is pointing to a '<' character, then check if it's a mark-up tag is needed.
348 ++markupStringBuffer;
349 if(markupStringBuffer < markupStringEndBuffer)
351 SkipWhiteSpace(markupStringBuffer, markupStringEndBuffer);
353 for(; (!isTag) && (markupStringBuffer < markupStringEndBuffer); ++markupStringBuffer)
355 const char character = *markupStringBuffer;
357 if(!isQuotationOpen && (SLASH == character)) // '/'
359 if(isPreviousLessThan)
365 // if the tag has a '/' it may be an end tag.
366 isPreviousSlash = true;
369 isPreviousLessThan = false;
370 if((markupStringBuffer + 1u < markupStringEndBuffer) && (WHITE_SPACE >= *(markupStringBuffer + 1u)))
372 ++markupStringBuffer;
373 SkipWhiteSpace(markupStringBuffer, markupStringEndBuffer);
374 --markupStringBuffer;
377 else if(GREATER_THAN == character) // '>'
385 isPreviousSlash = false;
386 isPreviousLessThan = false;
388 else if(QUOTATION_MARK == character)
390 isQuotationOpen = !isQuotationOpen;
393 isPreviousSlash = false;
394 isPreviousLessThan = false;
396 else if(WHITE_SPACE >= character) // ' '
398 // If the tag contains white spaces then it may have attributes.
401 attributesFound = true;
407 if(NULL == tag.buffer)
409 tag.buffer = markupStringBuffer;
412 // If it's not any of the 'special' characters then just add it to the tag string.
415 isPreviousSlash = false;
416 isPreviousLessThan = false;
421 // If the tag string has white spaces, then parse the attributes is needed.
424 ParseAttributes(tag);
432 * @brief Returns length of XHTML entity by parsing the text. It also determines if it is XHTML entity or not.
434 * @param[in] markupStringBuffer The mark-up string buffer. It's a const iterator pointing the current character.
435 * @param[in] markupStringEndBuffer Pointing to end of mark-up string buffer.
437 * @return Length of markupText in case of XHTML entity otherwise return 0.
439 unsigned int GetXHTMLEntityLength(const char*& markupStringBuffer,
440 const char* const markupStringEndBuffer)
442 char character = *markupStringBuffer;
443 if(AMPERSAND == character) // '&'
445 // if the iterator is pointing to a '&' character, then check for ';' to find end to XHTML entity.
446 ++markupStringBuffer;
447 if(markupStringBuffer < markupStringEndBuffer)
449 unsigned int len = 1u;
450 for(; markupStringBuffer < markupStringEndBuffer; ++markupStringBuffer)
452 character = *markupStringBuffer;
454 if(SEMI_COLON == character) // ';'
456 // found end of XHTML entity
457 ++markupStringBuffer;
460 else if((AMPERSAND == character) || (BACK_SLASH == character) || (LESS_THAN == character))
471 * @brief It parses a XHTML string which has hex/decimal entity and fill its corresponging utf-8 string.
473 * @param[in] markupText The mark-up text buffer.
474 * @param[out] utf-8 text Corresponding to markup Text
476 * @return true if string is successfully parsed otherwise false
478 bool XHTMLNumericEntityToUtf8(const char* markupText, char* utf8)
482 if(NULL != markupText)
486 // check if hex or decimal entity
487 if((CHAR_ARRAY_END != *markupText) && (HEX_CODE == *markupText))
494 unsigned long l = strtoul(markupText, &end, (isHex ? 16 : 10)); // l contains UTF-32 code in case of correct XHTML entity
496 // check for valid XHTML numeric entities (between '#' or "#x" and ';')
497 if((l > 0) && (l < ULONG_MAX) && (*end == SEMI_COLON)) // in case wrong XHTML entity is set eg. "abcdefs;" in that case *end will be 'a'
499 /* characters XML 1.1 permits */
500 if(((XHTML_DECIMAL_ENTITY_RANGE[0] < l) && (l <= XHTML_DECIMAL_ENTITY_RANGE[1])) ||
501 ((XHTML_DECIMAL_ENTITY_RANGE[2] <= l) && (l <= XHTML_DECIMAL_ENTITY_RANGE[3])) ||
502 ((XHTML_DECIMAL_ENTITY_RANGE[4] <= l) && (l <= XHTML_DECIMAL_ENTITY_RANGE[5])))
504 // Convert UTF32 code to UTF8
505 Utf32ToUtf8(reinterpret_cast<const uint32_t* const>(&l), 1, reinterpret_cast<uint8_t*>(utf8));
514 * @brief Processes a particular tag for the required run (color-run, font-run or underlined-character-run).
516 * @tparam RunType Whether ColorRun , FontDescriptionRun or UnderlinedCharacterRun
518 * @param[in/out] runsContainer The container containing all the runs
519 * @param[in/out] styleStack The style stack
520 * @param[in] tag The tag we are currently processing
521 * @param[in] characterIndex The current character index
522 * @param[in/out] runIndex The run index
523 * @param[in/out] tagReference The tagReference we should increment/decrement
524 * @param[in] parameterSettingFunction This function will be called to set run specific parameters
526 template<typename RunType>
527 void ProcessTagForRun(
528 Vector<RunType>& runsContainer,
529 StyleStack& styleStack,
531 const CharacterIndex characterIndex,
532 StyleStack::RunIndex& runIndex,
534 std::function<void(const Tag&, RunType&)> parameterSettingFunction)
542 // Fill the run with the parameters.
543 run.characterRun.characterIndex = characterIndex;
544 parameterSettingFunction(tag, run);
546 // Push the run in the logical model.
547 runsContainer.PushBack(run);
549 // Push the index of the run into the stack.
550 styleStack.Push(runIndex);
552 // Point the next free run.
555 // Increase reference
562 // Pop the top of the stack and set the number of characters of the run.
563 RunType& run = *(runsContainer.Begin() + styleStack.Pop());
564 run.characterRun.numberOfCharacters = characterIndex - run.characterRun.characterIndex;
571 * @brief Processes the item tag
573 * @param[in/out] markupProcessData The markup process data
574 * @param[in] tag The current tag
575 * @param[in/out] characterIndex The current character index
578 MarkupProcessData& markupProcessData,
580 CharacterIndex& characterIndex)
584 // Create an embedded item instance.
586 item.characterIndex = characterIndex;
587 ProcessEmbeddedItem(tag, item);
589 markupProcessData.items.PushBack(item);
591 // Insert white space character that will be replaced by the item.
592 markupProcessData.markupProcessedText.append(1u, WHITE_SPACE);
598 * @brief Processes the anchor tag
600 * @param[in/out] markupProcessData The markup process data
601 * @param[in] tag The current tag
602 * @param[in/out] characterIndex The current character index
604 void ProcessAnchorTag(
605 MarkupProcessData& markupProcessData,
607 CharacterIndex& characterIndex)
611 // Create an anchor instance.
613 anchor.startIndex = characterIndex;
614 anchor.endIndex = 0u;
615 ProcessAnchor(tag, anchor);
616 markupProcessData.anchors.PushBack(anchor);
621 unsigned int count = markupProcessData.anchors.Count();
624 markupProcessData.anchors[count - 1].endIndex = characterIndex;
630 * @brief Resizes the model's vectors
632 * @param[in/out] markupProcessData The markup process data
633 * @param[in] fontRunIndex The font run index
634 * @param[in] colorRunIndex The color run index
635 * @param[in] underlinedCharacterRunIndex The underlined character run index
636 * @param[in] backgroundRunIndex The background run index
638 void ResizeModelVectors(MarkupProcessData& markupProcessData, const StyleStack::RunIndex fontRunIndex, const StyleStack::RunIndex colorRunIndex, const StyleStack::RunIndex underlinedCharacterRunIndex, const StyleStack::RunIndex backgroundRunIndex)
640 markupProcessData.fontRuns.Resize(fontRunIndex);
641 markupProcessData.colorRuns.Resize(colorRunIndex);
642 markupProcessData.underlinedCharacterRuns.Resize(underlinedCharacterRunIndex);
643 markupProcessData.backgroundColorRuns.Resize(backgroundRunIndex);
646 for(unsigned int i = 0; i < colorRunIndex; ++i)
648 ColorRun& run = markupProcessData.colorRuns[i];
649 DALI_LOG_INFO(gLogFilter, Debug::Verbose, "run[%d] index: %d, length: %d, color %f,%f,%f,%f\n", i, run.characterRun.characterIndex, run.characterRun.numberOfCharacters, run.color.r, run.color.g, run.color.b, run.color.a);
655 * @brief Processes the markup string buffer
657 * @param[in/out] markupProcessData The markup process data
658 * @param[in/out] markupStringBuffer The markup string buffer pointer
659 * @param[in] markupStringEndBuffer The markup string end buffer pointer
660 * @param[in/out] characterIndex The current character index
662 void ProcessMarkupStringBuffer(
663 MarkupProcessData& markupProcessData,
664 const char*& markupStringBuffer,
665 const char* const markupStringEndBuffer,
666 CharacterIndex& characterIndex)
668 unsigned char character = *markupStringBuffer;
669 const char* markupBuffer = markupStringBuffer;
670 unsigned char count = GetUtf8Length(character);
673 if((BACK_SLASH == character) && (markupStringBuffer + 1u < markupStringEndBuffer))
675 // Adding < , > or & special character.
676 const unsigned char nextCharacter = *(markupStringBuffer + 1u);
677 if((LESS_THAN == nextCharacter) || (GREATER_THAN == nextCharacter) || (AMPERSAND == nextCharacter))
679 character = nextCharacter;
680 ++markupStringBuffer;
682 count = GetUtf8Length(character);
683 markupBuffer = markupStringBuffer;
686 else // checking if contains XHTML entity or not
688 const unsigned int len = GetXHTMLEntityLength(markupStringBuffer, markupStringEndBuffer);
690 // Parse markupStringTxt if it contains XHTML Entity between '&' and ';'
693 char* entityCode = NULL;
697 // Checking if XHTML Numeric Entity
698 if(HASH == *(markupBuffer + 1u))
700 entityCode = &utf8[0];
701 // markupBuffer is currently pointing to '&'. By adding 2u to markupBuffer it will point to numeric string by skipping "&#'
702 result = XHTMLNumericEntityToUtf8((markupBuffer + 2u), entityCode);
704 else // Checking if XHTML Named Entity
706 entityCode = const_cast<char*>(NamedEntityToUtf8(markupBuffer, len));
707 result = (entityCode != NULL);
711 markupBuffer = entityCode; //utf8 text assigned to markupBuffer
712 character = markupBuffer[0];
716 DALI_LOG_INFO(gLogFilter, Debug::Verbose, "Not valid XHTML entity : (%.*s) \n", len, markupBuffer);
720 else // in case string conatins Start of XHTML Entity('&') but not its end character(';')
722 if(character == AMPERSAND)
725 DALI_LOG_INFO(gLogFilter, Debug::Verbose, "Not Well formed XHTML content \n");
730 if(markupBuffer != NULL)
732 const unsigned char numberOfBytes = GetUtf8Length(character);
733 markupProcessData.markupProcessedText.push_back(character);
735 for(unsigned char i = 1u; i < numberOfBytes; ++i)
738 markupProcessData.markupProcessedText.push_back(*markupBuffer);
742 markupStringBuffer += count;
748 void ProcessMarkupString(const std::string& markupString, MarkupProcessData& markupProcessData)
750 DALI_LOG_INFO(gLogFilter, Debug::Verbose, "markupString: %s\n", markupString.c_str());
752 // Reserve space for the plain text.
753 const Length markupStringSize = markupString.size();
754 markupProcessData.markupProcessedText.reserve(markupStringSize);
756 // Stores a struct with the index to the first character of the run, the type of run and its parameters.
757 StyleStack styleStack;
759 // Points the next free position in the vector of runs.
760 StyleStack::RunIndex colorRunIndex = 0u;
761 StyleStack::RunIndex fontRunIndex = 0u;
762 StyleStack::RunIndex underlinedCharacterRunIndex = 0u;
763 StyleStack::RunIndex backgroundRunIndex = 0u;
765 // check tag reference
766 int colorTagReference = 0u;
767 int fontTagReference = 0u;
768 int iTagReference = 0u;
769 int bTagReference = 0u;
770 int uTagReference = 0u;
771 int backgroundTagReference = 0u;
773 // Give an initial default value to the model's vectors.
774 markupProcessData.colorRuns.Reserve(DEFAULT_VECTOR_SIZE);
775 markupProcessData.fontRuns.Reserve(DEFAULT_VECTOR_SIZE);
776 markupProcessData.underlinedCharacterRuns.Reserve(DEFAULT_VECTOR_SIZE);
777 markupProcessData.backgroundColorRuns.Reserve(DEFAULT_VECTOR_SIZE);
779 // Get the mark-up string buffer.
780 const char* markupStringBuffer = markupString.c_str();
781 const char* const markupStringEndBuffer = markupStringBuffer + markupStringSize;
784 CharacterIndex characterIndex = 0u;
785 for(; markupStringBuffer < markupStringEndBuffer;)
787 tag.attributes.Clear();
788 if(IsTag(markupStringBuffer,
789 markupStringEndBuffer,
792 if(TokenComparison(XHTML_COLOR_TAG, tag.buffer, tag.length))
794 ProcessTagForRun<ColorRun>(
795 markupProcessData.colorRuns, styleStack, tag, characterIndex, colorRunIndex, colorTagReference, [](const Tag& tag, ColorRun& run) { ProcessColorTag(tag, run); });
797 else if(TokenComparison(XHTML_I_TAG, tag.buffer, tag.length))
799 ProcessTagForRun<FontDescriptionRun>(
800 markupProcessData.fontRuns, styleStack, tag, characterIndex, fontRunIndex, iTagReference, [](const Tag&, FontDescriptionRun& fontRun) {
801 fontRun.slant = TextAbstraction::FontSlant::ITALIC;
802 fontRun.slantDefined = true;
805 else if(TokenComparison(XHTML_U_TAG, tag.buffer, tag.length))
807 ProcessTagForRun<UnderlinedCharacterRun>(
808 markupProcessData.underlinedCharacterRuns, styleStack, tag, characterIndex, underlinedCharacterRunIndex, uTagReference, [](const Tag& tag, UnderlinedCharacterRun& run) {});
810 else if(TokenComparison(XHTML_B_TAG, tag.buffer, tag.length))
812 ProcessTagForRun<FontDescriptionRun>(
813 markupProcessData.fontRuns, styleStack, tag, characterIndex, fontRunIndex, bTagReference, [](const Tag&, FontDescriptionRun& fontRun) {
814 fontRun.weight = TextAbstraction::FontWeight::BOLD;
815 fontRun.weightDefined = true;
818 else if(TokenComparison(XHTML_FONT_TAG, tag.buffer, tag.length))
820 ProcessTagForRun<FontDescriptionRun>(
821 markupProcessData.fontRuns, styleStack, tag, characterIndex, fontRunIndex, fontTagReference, [](const Tag& tag, FontDescriptionRun& fontRun) { ProcessFontTag(tag, fontRun); });
823 else if(TokenComparison(XHTML_ANCHOR_TAG, tag.buffer, tag.length))
826 ProcessAnchorTag(markupProcessData, tag, characterIndex);
828 ProcessTagForRun<ColorRun>(
829 markupProcessData.colorRuns, styleStack, tag, characterIndex, colorRunIndex, colorTagReference, [](const Tag& tag, ColorRun& run) {
830 run.color = Color::BLUE;
831 ProcessColorTag(tag, run);
833 /* TODO - underline */
834 } // <a href=https://www.tizen.org>tizen</a>
835 else if(TokenComparison(XHTML_SHADOW_TAG, tag.buffer, tag.length))
837 // TODO: If !tag.isEndTag, then create a new shadow run.
838 // else Pop the top of the stack and set the number of characters of the run.
839 } // <shadow></shadow>
840 else if(TokenComparison(XHTML_GLOW_TAG, tag.buffer, tag.length))
842 // TODO: If !tag.isEndTag, then create a new glow run.
843 // else Pop the top of the stack and set the number of characters of the run.
845 else if(TokenComparison(XHTML_OUTLINE_TAG, tag.buffer, tag.length))
847 // TODO: If !tag.isEndTag, then create a new outline run.
848 // else Pop the top of the stack and set the number of characters of the run.
849 } // <outline></outline>
850 else if(TokenComparison(XHTML_ITEM_TAG, tag.buffer, tag.length))
852 ProcessItemTag(markupProcessData, tag, characterIndex);
854 else if(TokenComparison(XHTML_BACKGROUND_TAG, tag.buffer, tag.length))
856 ProcessTagForRun<ColorRun>(
857 markupProcessData.backgroundColorRuns, styleStack, tag, characterIndex, backgroundRunIndex, backgroundTagReference, [](const Tag& tag, ColorRun& run) { ProcessBackground(tag, run); });
859 } // end if( IsTag() )
860 else if(markupStringBuffer < markupStringEndBuffer)
862 ProcessMarkupStringBuffer(markupProcessData, markupStringBuffer, markupStringEndBuffer, characterIndex);
866 // Resize the model's vectors.
867 ResizeModelVectors(markupProcessData, fontRunIndex, colorRunIndex, underlinedCharacterRunIndex, backgroundRunIndex);
872 } // namespace Toolkit