2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FGrp_TextTextWidthManager.cpp
20 * @brief This is the implementation file for TextWidthManager class.
23 #include <FBaseSysLog.h>
24 #include "FGrp_TextCommon.h"
25 #include "FGrp_TextTextElement.h"
26 #include "FGrp_TextTextSimple.h"
27 #include "FGrp_TextTextCutLink.h"
28 #include "FGrp_TextTextComposite.h"
29 #include "FGrp_TextTextSimpleList.h"
30 #include "FGrp_TextTextWidthManager.h"
32 using namespace Tizen::Base::Utility;
36 const int MAX_TEXT_WIDTH_INFO_MERGE_LENGTH = 10;
39 namespace Tizen { namespace Graphics
45 enum TextWidthInfoType
47 TEXT_WIDTH_INFO_UNKNOWN = 0,
49 TEXT_WIDTH_INFO_SPACE,
50 TEXT_WIDTH_INFO_ENTER,
51 TEXT_WIDTH_INFO_SYMBOL
54 struct TextWidthCommonInfo
56 TextWidthInfoType type;
59 struct UnknownTextWidthInfo : public TextWidthCommonInfo
64 struct WordTextWidthInfo : public TextWidthCommonInfo
71 struct SpaceTextWidthInfo : public TextWidthCommonInfo
77 struct EnterTextWidthInfo : public TextWidthCommonInfo
83 struct SymbolTextWidthInfo : public TextWidthCommonInfo
89 TextWidthManager::TextWidthManager(TextComposite* pCompositeText)
91 __isComposing = false;
92 __isInitialized = false;
93 __pCompositeText = pCompositeText;
94 __pTextWidthInfoList = null;
95 __pCurrentComposeTextElement = null;
96 __pCurrentWordWidthInfoNode = null;
97 __pCachedWordWidthInfoNode = null;
98 __currentTextElementLength = 0;
99 __currentTextElementType = TEXT_ELEMENT_TYPE_NONE;
100 __textOffsetOfCachedWidthInfo = 0;
101 __currentTextIndex = 0;
102 __strCurrentRelIndex = 0;
103 __textOffsetOfCurrentWidthInfo = 0;
105 __currentComposeTextElementIndex = 0;
108 TextWidthManager::~TextWidthManager(void)
117 TextWidthManager::Initialize(int textLength)
124 __pTextWidthInfoList = TextSimpleList::Create();
126 , __pTextWidthInfoList
127 , false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
129 TextSimpleList::Init(__pTextWidthInfoList);
132 __isComposing = false;
133 __isInitialized = true;
134 __pCurrentComposeTextElement = null;
135 __pCachedWordWidthInfoNode = null;
136 __currentComposeTextElementIndex = 0;
140 InformTextInsert(0, textLength);
147 TextWidthManager::Finalize(void)
149 if (!__isInitialized)
154 if (__pTextWidthInfoList)
156 TextWidthCommonInfo* pTextWidthCommonInfo = null;
158 pTextWidthCommonInfo = static_cast < TextWidthCommonInfo* >(TextSimpleList::DeleteNthObject(__pTextWidthInfoList, 0));
159 while (pTextWidthCommonInfo)
161 delete pTextWidthCommonInfo;
162 pTextWidthCommonInfo = static_cast < TextWidthCommonInfo* >(TextSimpleList::DeleteNthObject(__pTextWidthInfoList, 0));
165 if (__pTextWidthInfoList->nodeCount != 0)
167 TextSimpleList::Init(__pTextWidthInfoList);
170 TextSimpleList::Destory(__pTextWidthInfoList);
171 __pTextWidthInfoList = null;
174 __isInitialized = false;
175 __isComposing = false;
177 __pCurrentComposeTextElement = null;
178 __pCachedWordWidthInfoNode = null;
184 TextWidthManager::StartCompose(int textIndex)
186 if (!__isInitialized)
191 if (__length <= textIndex)
196 SimpleNode* pCurrentTextWidthInfoNode = null;
197 int currentWidthInfoTextOffset = 0;
198 TextWidthCommonInfo* pCurrentTextWidthInfo = null;
200 pCurrentTextWidthInfoNode = SearchTextWidthInfo(textIndex, currentWidthInfoTextOffset);
202 , pCurrentTextWidthInfoNode
203 , false, E_SYSTEM, "[E_SYSTEM] Fail to get text width node.");
205 pCurrentTextWidthInfo = static_cast < TextWidthCommonInfo* >(pCurrentTextWidthInfoNode->pObject);
207 , pCurrentTextWidthInfo
208 , false, E_SYSTEM, "[E_SYSTEM] Fail to get text width information.");
210 __pCurrentWordWidthInfoNode = pCurrentTextWidthInfoNode;
211 __textOffsetOfCurrentWidthInfo = textIndex - currentWidthInfoTextOffset;
213 int elementIndex = 0;
214 int elementTextOffset = 0;
215 __currentTextIndex = textIndex;
216 __pCurrentComposeTextElement = __pCompositeText->GetElementAtTextIndex(textIndex, elementTextOffset,
217 elementIndex, __currentTextElementLength, __strCurrentRelIndex);
219 , __pCurrentComposeTextElement
220 , false, E_SYSTEM, "[E_SYSTEM] Fail to get text element.");
222 __currentComposeTextElementIndex = elementIndex;
223 __currentTextElementType = __pCurrentComposeTextElement->GetType();
224 __isComposing = true;
230 TextWidthManager::GetCurrentLineInfo(int lineWidth, TextLineComposeInfo& textLineComposeInfo)
237 if (__length <= __currentTextIndex)
242 TextWidthCommonInfo* pCurrentTextWidthInfo = static_cast < TextWidthCommonInfo* >(__pCurrentWordWidthInfoNode->pObject);
244 , pCurrentTextWidthInfo
245 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text width information.");
247 if (__textOffsetOfCurrentWidthInfo != 0)
249 UnknownTextWidthInfo* pUnknownTextWidthInfo = new (std::nothrow) UnknownTextWidthInfo;
251 , pUnknownTextWidthInfo
252 , false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
254 pUnknownTextWidthInfo->type = TEXT_WIDTH_INFO_UNKNOWN;
255 pUnknownTextWidthInfo->length = GetTextWidthInfoLength(pCurrentTextWidthInfo) - __textOffsetOfCurrentWidthInfo;
257 __pCurrentWordWidthInfoNode = SplitWidthInfo(__pCurrentWordWidthInfoNode, __textOffsetOfCurrentWidthInfo,
258 pUnknownTextWidthInfo);
261 , __pCurrentWordWidthInfoNode
262 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text width node.");
264 __textOffsetOfCurrentWidthInfo = 0;
266 pCurrentTextWidthInfo = static_cast < TextWidthCommonInfo* >(__pCurrentWordWidthInfoNode->pObject);
268 , pCurrentTextWidthInfo
269 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text width information.");
273 int remainingWidth = lineWidth;
276 int endType = TEXT_RETBY_NORMAL;
277 bool composeDone = false;
278 bool wordMeet = false;
279 bool enterMeet = false;
280 bool spaceMeetAfterWord = false;
281 bool cutLinkMeetAfterWord = false;
285 type = pCurrentTextWidthInfo->type;
289 case TEXT_WIDTH_INFO_UNKNOWN:
291 AnalyzeCurrentUnKnownTextWidthInfo(remainingWidth);
295 case TEXT_WIDTH_INFO_WORD:
297 if (remainingWidth <= 0)
302 WordTextWidthInfo* pWordTtextWidthInfo = static_cast < WordTextWidthInfo* >(pCurrentTextWidthInfo);
304 , pWordTtextWidthInfo
305 , false, E_SYSTEM, "[E_SYSTEM] Fail to cast text width information.");
307 if (pWordTtextWidthInfo->width <= remainingWidth)
309 bool iswordoverWidth = false;
310 int widthAnalyzed = 0;
311 int strLengthAnalyzed = 0;
312 int heightAnalzyed = 0;
313 bool nextKorean = false;
314 bool includeCutLink = false;
316 AnalyzeNextTextWidthInfo(remainingWidth - pWordTtextWidthInfo->width, iswordoverWidth,
317 widthAnalyzed, strLengthAnalyzed, heightAnalzyed, nextKorean, includeCutLink);
321 if ((nextKorean || !spaceMeetAfterWord) && !cutLinkMeetAfterWord)
323 remainingWidth -= (widthAnalyzed + pWordTtextWidthInfo->width);
324 if (maxHeight < pWordTtextWidthInfo->maxHeight)
326 maxHeight = pWordTtextWidthInfo->maxHeight;
329 if (maxHeight < heightAnalzyed)
331 maxHeight = heightAnalzyed;
334 textCount += (pWordTtextWidthInfo->length + strLengthAnalyzed);
335 Seek(pWordTtextWidthInfo->length + strLengthAnalyzed);
338 endType = TEXT_RETBY_LIMITWIDTH;
343 remainingWidth -= (pWordTtextWidthInfo->width + widthAnalyzed);
344 if (maxHeight < pWordTtextWidthInfo->maxHeight)
346 maxHeight = pWordTtextWidthInfo->maxHeight;
348 if (maxHeight < heightAnalzyed)
350 maxHeight = heightAnalzyed;
353 textCount += (pWordTtextWidthInfo->length + strLengthAnalyzed);
354 Seek(pWordTtextWidthInfo->length + strLengthAnalyzed);
357 cutLinkMeetAfterWord = includeCutLink;
363 , __pCurrentWordWidthInfoNode
364 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text width node.");
366 bool nextKorean = false;
367 int textLengthBeforeSplit = GetTextWidthInfoLength(static_cast < TextWidthCommonInfo* >(__pCurrentWordWidthInfoNode->pObject));
368 pWordTtextWidthInfo = SplitCurrentWordWidthInfo(remainingWidth, nextKorean);
370 , pWordTtextWidthInfo
371 , false, E_SYSTEM, "[E_SYSTEM] Fail to get text width information.");
373 if (textLengthBeforeSplit != pWordTtextWidthInfo->length)
375 if ((nextKorean || !spaceMeetAfterWord) && !cutLinkMeetAfterWord)
377 remainingWidth -= pWordTtextWidthInfo->width;
378 if (pWordTtextWidthInfo->maxHeight > maxHeight)
380 maxHeight = pWordTtextWidthInfo->maxHeight;
382 textCount += pWordTtextWidthInfo->length;
383 Seek(pWordTtextWidthInfo->length);
387 endType = TEXT_RETBY_LIMITWIDTH;
393 case TEXT_WIDTH_INFO_SPACE:
395 SpaceTextWidthInfo* pSpaceTextWidthInfo = static_cast < SpaceTextWidthInfo* >(pCurrentTextWidthInfo);
397 , pSpaceTextWidthInfo
398 , false, E_SYSTEM, "[E_SYSTEM] Fail to cast text width information.");
400 if (remainingWidth >= pSpaceTextWidthInfo->width)
402 remainingWidth -= pSpaceTextWidthInfo->width;
403 if (maxHeight < pSpaceTextWidthInfo->maxHeight)
405 maxHeight = pSpaceTextWidthInfo->maxHeight;
414 spaceMeetAfterWord = true;
417 cutLinkMeetAfterWord = false;
421 endType = TEXT_RETBY_LIMITWIDTH;
427 case TEXT_WIDTH_INFO_ENTER:
429 endType = TEXT_RETBY_LINEFEED;
431 EnterTextWidthInfo* pEnterTextWidthInfo = static_cast < EnterTextWidthInfo* >(pCurrentTextWidthInfo);
433 , pEnterTextWidthInfo
434 , false, E_SYSTEM, "[E_SYSTEM] Fail to cast text width information.");
436 maxHeight = pEnterTextWidthInfo->maxHeight;
437 textCount += pEnterTextWidthInfo->length;
438 Seek(pEnterTextWidthInfo->length);
444 case TEXT_WIDTH_INFO_SYMBOL:
448 SymbolTextWidthInfo* pSymbolTextWidthInfo = static_cast < SymbolTextWidthInfo* >(pCurrentTextWidthInfo);
450 , pSymbolTextWidthInfo
451 , false, E_SYSTEM, "[E_SYSTEM] Fail to cast text width information.");
453 remainingWidth -= pSymbolTextWidthInfo->width;
454 maxHeight = pSymbolTextWidthInfo->maxHeight;
460 endType = TEXT_RETBY_NORMAL;
467 if (remainingWidth <= 0)
472 if (!enterMeet && (__length <= __currentTextIndex))
474 endType = TEXT_RETBY_NORMAL;
481 , __pCurrentWordWidthInfoNode
482 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text width node.");
484 pCurrentTextWidthInfo = static_cast < TextWidthCommonInfo* >(__pCurrentWordWidthInfoNode->pObject);
486 , pCurrentTextWidthInfo
487 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text width information.");
491 textLineComposeInfo.length = textCount;
492 textLineComposeInfo.width = lineWidth - remainingWidth;
493 textLineComposeInfo.height = maxHeight;
494 textLineComposeInfo.endType = endType;
500 TextWidthManager::EndCompose(void)
502 __isComposing = false;
503 __pCurrentComposeTextElement = null;
504 __pCurrentWordWidthInfoNode = null;
510 TextWidthManager::InformTextInsert(int textIndex, int textLength)
512 SimpleNode* pCurrentTextWidthInfoNode = null;
513 if (!__isInitialized)
523 if (__length < textIndex)
528 if (textIndex == __length)
530 SimpleNode* pLastNode = TextSimpleList::GetLastNode(__pTextWidthInfoList);
531 int strLastTextWidthInfo = 0;
532 TextWidthCommonInfo* pLastTextWidthInfo = null;
534 if (pLastNode != null)
536 pLastTextWidthInfo = static_cast < TextWidthCommonInfo* >(pLastNode->pObject);
537 strLastTextWidthInfo = GetTextWidthInfoLength(pLastTextWidthInfo);
539 , strLastTextWidthInfo
540 , false, E_SYSTEM, "[E_SYSTEM] Fail to get text element node.");
543 if ((pLastNode == null) || (strLastTextWidthInfo + textLength > MAX_TEXT_WIDTH_INFO_MERGE_LENGTH))
545 UnknownTextWidthInfo* pUnknownTextWidthInfo = new (std::nothrow) UnknownTextWidthInfo;
547 , pUnknownTextWidthInfo
548 , false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
550 pUnknownTextWidthInfo->type = TEXT_WIDTH_INFO_UNKNOWN;
551 pUnknownTextWidthInfo->length = 0;
553 pCurrentTextWidthInfoNode = TextSimpleList::AppendObject(__pTextWidthInfoList, pUnknownTextWidthInfo);
555 , pCurrentTextWidthInfoNode
556 , false, E_SYSTEM, "[E_SYSTEM] Fail to get text element node.");
558 UpdateCachedTextWidhtInfo(__length, pCurrentTextWidthInfoNode);
559 pUnknownTextWidthInfo->length = textLength;
563 UnknownTextWidthInfo* pUnknownTextWidthInfo = new (std::nothrow) UnknownTextWidthInfo;
565 , pUnknownTextWidthInfo
566 , false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
568 pUnknownTextWidthInfo->type = TEXT_WIDTH_INFO_UNKNOWN;
569 pUnknownTextWidthInfo->length = strLastTextWidthInfo;
571 delete static_cast < TextWidthCommonInfo* >(pLastNode->pObject);
572 pLastNode->pObject = pUnknownTextWidthInfo;
574 UpdateCachedTextWidhtInfo(__length - strLastTextWidthInfo, pLastNode);
575 pUnknownTextWidthInfo->length += textLength;
578 __length += textLength;
583 int currentWidthInfoTextOffset = 0;
584 TextWidthCommonInfo* pCurrentTextWidthInfo = null;
586 pCurrentTextWidthInfoNode = SearchTextWidthInfo(textIndex, currentWidthInfoTextOffset);
587 if (pCurrentTextWidthInfoNode == null)
591 pCurrentTextWidthInfo = static_cast < TextWidthCommonInfo* >(pCurrentTextWidthInfoNode->pObject);
593 , pCurrentTextWidthInfo
594 , false, E_SYSTEM, "[E_SYSTEM] Fail to get text width information.");
596 int textIndexFromCurrentWidthInfoTextOffset = textIndex - currentWidthInfoTextOffset;
597 int widthinfoType = pCurrentTextWidthInfo->type;
599 switch (widthinfoType)
601 case TEXT_WIDTH_INFO_UNKNOWN:
603 UpdateCachedTextWidhtInfo(currentWidthInfoTextOffset, pCurrentTextWidthInfoNode);
605 UnknownTextWidthInfo* pUnknownTextWidthInfo = static_cast < UnknownTextWidthInfo* >(pCurrentTextWidthInfo);
607 , pUnknownTextWidthInfo
608 , false, E_SYSTEM, "[E_SYSTEM] Fail to get text width information.");
609 pUnknownTextWidthInfo->length += textLength;
610 __length += textLength;
614 case TEXT_WIDTH_INFO_WORD:
616 WordTextWidthInfo* pCurrentWordTextWidthInfo = static_cast < WordTextWidthInfo* >(pCurrentTextWidthInfo);
618 , pCurrentWordTextWidthInfo
619 , false, E_SYSTEM, "[E_SYSTEM] Fail to cast text width information.");
621 if ((textIndexFromCurrentWidthInfoTextOffset == 0) &&
622 (pCurrentWordTextWidthInfo->length + textLength > MAX_TEXT_WIDTH_INFO_MERGE_LENGTH))
624 UnknownTextWidthInfo* pUnknownTextWidthInfo = new (std::nothrow) UnknownTextWidthInfo;
626 , pUnknownTextWidthInfo
627 , false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
629 pUnknownTextWidthInfo->type = TEXT_WIDTH_INFO_UNKNOWN;
630 pUnknownTextWidthInfo->length = 0;
632 pCurrentTextWidthInfoNode = TextSimpleList::InsertObjectBeforeNode(__pTextWidthInfoList, pCurrentTextWidthInfoNode,
633 pUnknownTextWidthInfo);
634 UpdateCachedTextWidhtInfo(textIndex, pCurrentTextWidthInfoNode);
635 pUnknownTextWidthInfo->length = textLength;
639 UnknownTextWidthInfo* pUnknownTextWidthInfo = new (std::nothrow) UnknownTextWidthInfo;
641 , pUnknownTextWidthInfo
642 , false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
644 pUnknownTextWidthInfo->type = TEXT_WIDTH_INFO_UNKNOWN;
645 pUnknownTextWidthInfo->length = pCurrentWordTextWidthInfo->length;
646 delete static_cast < TextWidthCommonInfo* >(pCurrentTextWidthInfoNode->pObject);
647 pCurrentTextWidthInfoNode->pObject = pUnknownTextWidthInfo;
649 UpdateCachedTextWidhtInfo(currentWidthInfoTextOffset, pCurrentTextWidthInfoNode);
650 pUnknownTextWidthInfo->length += textLength;
653 __length += textLength;
657 case TEXT_WIDTH_INFO_SPACE:
659 case TEXT_WIDTH_INFO_ENTER:
661 case TEXT_WIDTH_INFO_SYMBOL:
663 UnknownTextWidthInfo* pUnknownTextWidthInfo = new (std::nothrow) UnknownTextWidthInfo;
665 , pUnknownTextWidthInfo
666 , false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
668 pUnknownTextWidthInfo->type = TEXT_WIDTH_INFO_UNKNOWN;
669 pUnknownTextWidthInfo->length = GetTextWidthInfoLength(pCurrentTextWidthInfo);
670 delete static_cast < TextWidthCommonInfo* >(pCurrentTextWidthInfoNode->pObject);
671 pCurrentTextWidthInfoNode->pObject = pUnknownTextWidthInfo;
673 UpdateCachedTextWidhtInfo(currentWidthInfoTextOffset, pCurrentTextWidthInfoNode);
674 pUnknownTextWidthInfo->length += textLength;
675 __length += textLength;
684 TextWidthManager::InformTextRemove(int textIndex, int textLength)
686 if (!__isInitialized)
696 if (__length <= textIndex)
701 if (__length < textIndex + textLength)
703 textLength = __length - textIndex;
706 int strLengthRemove = textLength;
707 SimpleNode* pCurrentTextWidthInfoNode = null;
708 int currentWidthInfoTextOffset = 0;
709 TextWidthCommonInfo* pCurrentTextWidthInfo = null;
711 pCurrentTextWidthInfoNode = SearchTextWidthInfo(textIndex, currentWidthInfoTextOffset);
713 , pCurrentTextWidthInfoNode
714 , false, E_SYSTEM, "[E_SYSTEM] Fail to get text text width node.");
716 pCurrentTextWidthInfo = static_cast < TextWidthCommonInfo* >(pCurrentTextWidthInfoNode->pObject);
718 , pCurrentTextWidthInfo
719 , false, E_SYSTEM, "[E_SYSTEM] Fail to get text width information.");
721 int textIndexFromCurrentWidthInfoTextOffset = textIndex - currentWidthInfoTextOffset;
722 int currentWidthInfoTextLength = GetTextWidthInfoLength(pCurrentTextWidthInfo);
723 bool cachedUpdated = false;
725 if ((textIndexFromCurrentWidthInfoTextOffset != 0) || (currentWidthInfoTextLength > textLength))
727 int strCurrrentRemoveLength = 0;
728 if (textIndexFromCurrentWidthInfoTextOffset == 0)
730 strCurrrentRemoveLength = textLength;
734 if (textLength + textIndexFromCurrentWidthInfoTextOffset >= currentWidthInfoTextLength)
736 strCurrrentRemoveLength = currentWidthInfoTextLength - textIndexFromCurrentWidthInfoTextOffset;
740 strCurrrentRemoveLength = textLength;
744 UpdateCachedTextWidhtInfo(currentWidthInfoTextOffset, pCurrentTextWidthInfoNode);
745 cachedUpdated = true;
747 UnknownTextWidthInfo* pUnknownTextWidthInfo = new (std::nothrow) UnknownTextWidthInfo;
749 , pUnknownTextWidthInfo
750 , false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
752 pUnknownTextWidthInfo->type = TEXT_WIDTH_INFO_UNKNOWN;
753 pUnknownTextWidthInfo->length = currentWidthInfoTextLength - strCurrrentRemoveLength;
754 delete static_cast < TextWidthCommonInfo* >(pCurrentTextWidthInfoNode->pObject);
755 pCurrentTextWidthInfoNode->pObject = pUnknownTextWidthInfo;
757 pCurrentTextWidthInfoNode = pCurrentTextWidthInfoNode->pNext;
759 textLength -= strCurrrentRemoveLength;
764 SimpleNode* pNextTextWidthInfoNode = null;
767 , pCurrentTextWidthInfoNode
768 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text element node.");
770 pCurrentTextWidthInfo = static_cast < TextWidthCommonInfo* >(pCurrentTextWidthInfoNode->pObject);
772 , pCurrentTextWidthInfo
773 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text width information.");
775 currentWidthInfoTextLength = GetTextWidthInfoLength(pCurrentTextWidthInfo);
777 if (textLength < currentWidthInfoTextLength)
782 pNextTextWidthInfoNode = pCurrentTextWidthInfoNode->pNext;
784 TextSimpleList::DeleteNode(__pTextWidthInfoList, pCurrentTextWidthInfoNode);
786 pCurrentTextWidthInfoNode = pNextTextWidthInfoNode;
788 textLength -= currentWidthInfoTextLength;
793 UnknownTextWidthInfo* pUnknownTextWidthInfo = new (std::nothrow) UnknownTextWidthInfo;
795 , pUnknownTextWidthInfo
796 , false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
798 pUnknownTextWidthInfo->type = TEXT_WIDTH_INFO_UNKNOWN;
799 pUnknownTextWidthInfo->length = currentWidthInfoTextLength - textLength;
800 delete static_cast < TextWidthCommonInfo* >(pCurrentTextWidthInfoNode->pObject);
801 pCurrentTextWidthInfoNode->pObject = pUnknownTextWidthInfo;
806 UpdateCachedTextWidhtInfo(textIndex, pCurrentTextWidthInfoNode);
809 __length -= strLengthRemove;
815 TextWidthManager::GetTextWidthInfoLength(TextWidthCommonInfo* pTextWidthCommonInfo)
817 int type = pTextWidthCommonInfo->type;
821 case TEXT_WIDTH_INFO_UNKNOWN:
823 UnknownTextWidthInfo* pUnknownTextWidthInfo = static_cast < UnknownTextWidthInfo* >(pTextWidthCommonInfo);
825 , pUnknownTextWidthInfo
826 , -1, E_SYSTEM, "[E_SYSTEM] Fail to cast text width information.");
828 return pUnknownTextWidthInfo->length;
831 case TEXT_WIDTH_INFO_WORD:
833 WordTextWidthInfo* pWordWidthInfo = static_cast < WordTextWidthInfo* >(pTextWidthCommonInfo);
836 , -1, E_SYSTEM, "[E_SYSTEM] Fail to get text width information.");
838 return pWordWidthInfo->length;
841 case TEXT_WIDTH_INFO_SPACE:
844 case TEXT_WIDTH_INFO_ENTER:
846 EnterTextWidthInfo* pEnterWidthInfo = static_cast < EnterTextWidthInfo* >(pTextWidthCommonInfo);
849 , -1, E_SYSTEM, "[E_SYSTEM] Fail to cast text width information.");
851 return pEnterWidthInfo->length;
854 case TEXT_WIDTH_INFO_SYMBOL:
862 TextWidthManager::SplitWidthInfo(SimpleNode* pOrginalTextWidthInfoNode, int splitStartIndex,
863 TextWidthCommonInfo* pTextWidthInfo)
865 TextWidthCommonInfo* pCurrentTextWidthInfo = static_cast < TextWidthCommonInfo* >(pOrginalTextWidthInfoNode->pObject);
867 , pCurrentTextWidthInfo
868 , null, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
870 int type = pCurrentTextWidthInfo->type;
872 if (type == TEXT_WIDTH_INFO_UNKNOWN)
874 UnknownTextWidthInfo* pUnknownTextWidthInfo = static_cast < UnknownTextWidthInfo* >(pCurrentTextWidthInfo);
876 , pUnknownTextWidthInfo
877 , null, E_SYSTEM, "[E_SYSTEM] Fail to cast text width information.");
879 pUnknownTextWidthInfo->length = splitStartIndex;
881 else if (type == TEXT_WIDTH_INFO_WORD)
883 UnknownTextWidthInfo* pUnknownTextWidthInfo = new (std::nothrow) UnknownTextWidthInfo;
885 , pUnknownTextWidthInfo
886 , null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
888 pUnknownTextWidthInfo->type = TEXT_WIDTH_INFO_UNKNOWN;
889 pUnknownTextWidthInfo->length = splitStartIndex;
890 delete static_cast < TextWidthCommonInfo* >(pOrginalTextWidthInfoNode->pObject);
891 pOrginalTextWidthInfoNode->pObject = pUnknownTextWidthInfo;
894 SimpleNode* pNode = TextSimpleList::InsertObjectAfterNode(__pTextWidthInfoList, pOrginalTextWidthInfoNode, pTextWidthInfo);
899 TextWidthManager::SplitCurrentWordWidthInfo(int limitWidth, bool& isNextKoreanStart)
901 TextWidthCommonInfo* pCurrentTextWidthInfo = static_cast < TextWidthCommonInfo* >(__pCurrentWordWidthInfoNode->pObject);
903 , pCurrentTextWidthInfo
904 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text width information.");
906 WordTextWidthInfo* pWordWidthInfo = static_cast < WordTextWidthInfo* >(pCurrentTextWidthInfo);
909 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text width information.");
911 int currentWordWidth = pWordWidthInfo->width;
912 int currentWordLength = pWordWidthInfo->length;
914 if ((currentWordWidth - limitWidth) >= (currentWordWidth >> 2))
916 TextElement* pTextElement = __pCurrentComposeTextElement;
917 int textElementIndex = __currentComposeTextElementIndex;
918 int strSrcRelIndex = __strCurrentRelIndex;
919 int currentLength = Math::Min(__currentTextElementLength, currentWordLength);
920 int stringLength = currentWordLength;
921 int endType = TEXT_RETBY_NORMAL;
922 int remainWidth = limitWidth;
929 while (stringLength != 0)
931 endType = pTextElement->ForwardAnalyze(strSrcRelIndex, currentLength, remainWidth,
932 TEXT_OBJECT_WRAP_TYPE_NONE, charCount, width, height);
934 if (endType == TEXT_RETBY_LIMITWIDTH)
936 textIndex += charCount;
937 strSrcRelIndex += charCount;
938 remainWidth -= width;
939 if (height > maxHeight)
945 else if (endType != TEXT_RETBY_LIMITLENGTH)
947 ; //SysAssert(false);
951 pTextElement = __pCompositeText->GetElementAtElementIndex(textElementIndex);
952 if (pTextElement == null)
957 remainWidth -= width;
958 if (height > maxHeight)
963 strSrcRelIndex = pTextElement->GetValue(SET_TEXT_OFFSET);
964 stringLength -= currentLength;
965 textIndex += currentLength;
966 currentLength = Math::Min(stringLength, pTextElement->GetValue(SET_TEXT_OFFSET) + pTextElement->GetTextLength() - strSrcRelIndex);
971 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text element.");
973 TextSimple* pSimpleTextElement = dynamic_cast < TextSimple* >(pTextElement);
976 , null, E_SYSTEM, "[E_SYSTEM] Fail to cast text element.");
978 wchar_t* pText = (wchar_t*)pSimpleTextElement->GetText();
979 isNextKoreanStart = IsKorean(pText[0]);
983 WordTextWidthInfo* pNewWordWidthInfo = new (std::nothrow) WordTextWidthInfo;
986 , null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
988 pNewWordWidthInfo->type = TEXT_WIDTH_INFO_WORD;
989 pNewWordWidthInfo->length = textIndex;
990 pNewWordWidthInfo->maxHeight = height;
991 pNewWordWidthInfo->width = limitWidth - remainWidth;
993 bool isCacheChanged = false;
995 if (__pCurrentWordWidthInfoNode == __pCachedWordWidthInfoNode)
997 isCacheChanged = true;
1000 __pCurrentWordWidthInfoNode = TextSimpleList::InsertObjectBeforeNode(__pTextWidthInfoList, __pCurrentWordWidthInfoNode,
1005 __pCachedWordWidthInfoNode = __pCurrentWordWidthInfoNode;
1008 pWordWidthInfo->length -= textIndex;
1009 pWordWidthInfo->width -= pNewWordWidthInfo->width;
1010 return pNewWordWidthInfo;
1014 return pWordWidthInfo;
1019 int remainingWidth = currentWordWidth - limitWidth;
1021 TextElement* pTextElement = __pCurrentComposeTextElement;
1022 int textElementIndex = __currentComposeTextElementIndex;
1023 int strSrcRelIndex = __strCurrentRelIndex;
1024 int textLength = currentWordLength;
1025 int currentLength = __currentTextElementLength;
1026 TextElement* pTextElementStack[10];
1027 int textElementStackIndex = 0;
1029 pTextElementStack[0] = pTextElement;
1031 while (textLength > 0)
1033 if (textLength <= currentLength)
1035 strSrcRelIndex += (textLength - 1);
1039 textLength -= currentLength;
1042 pTextElement = __pCompositeText->GetElementAtElementIndex(textElementIndex);
1043 if (pTextElement == null)
1048 strSrcRelIndex = pTextElement->GetValue(SET_TEXT_OFFSET);
1049 currentLength = pTextElement->GetValue(SET_TEXT_OFFSET) + pTextElement->GetTextLength() - strSrcRelIndex;
1051 textElementStackIndex++;
1052 pTextElementStack[textElementStackIndex] = pTextElement;
1055 SysTryReturn(NID_GRP
1057 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text element.");
1061 int strSrcStartRelIndex = pTextElement->GetValue(SET_TEXT_OFFSET);
1062 int widthBackward = 0;
1063 int stringLengthBackward = 0;
1066 while (0 < remainingWidth)
1068 pTextElement->GetRegion(strSrcRelIndex, 1, width, height);
1069 if (remainingWidth <= width)
1071 widthBackward += width;
1072 stringLengthBackward++;
1073 if (height > maxHeight)
1080 widthBackward += width;
1081 stringLengthBackward++;
1082 remainingWidth -= width;
1084 if (height > maxHeight)
1089 if (strSrcStartRelIndex < strSrcRelIndex)
1095 textElementStackIndex--;
1096 SysTryReturn(NID_GRP
1097 , textElementStackIndex >= 0
1098 , null, E_SYSTEM, "[E_SYSTEM] Index must be greater than or equal to 0.");
1100 pTextElement = pTextElementStack[textElementStackIndex];
1101 SysTryReturn(NID_GRP
1103 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text element.");
1105 strSrcStartRelIndex = pTextElement->GetValue(SET_TEXT_OFFSET);
1106 strSrcRelIndex = pTextElement->GetValue(SET_TEXT_OFFSET) + pTextElement->GetTextLength() - 1;
1110 TextSimple* pSimpleTextElement = dynamic_cast < TextSimple* >(pTextElement);
1111 SysTryReturn(NID_GRP
1112 , pSimpleTextElement
1113 , null, E_SYSTEM, "[E_SYSTEM] Fail to cast text element.");
1115 wchar_t* pText = (wchar_t*)pSimpleTextElement->GetText();
1116 isNextKoreanStart = IsKorean(pText[0]);
1118 if ((stringLengthBackward > 0) && (stringLengthBackward < pWordWidthInfo->length))
1120 WordTextWidthInfo* pNewWordWidthInfo = new (std::nothrow) WordTextWidthInfo;
1121 SysTryReturn(NID_GRP
1123 , null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
1125 pNewWordWidthInfo->type = TEXT_WIDTH_INFO_WORD;
1126 pNewWordWidthInfo->length = stringLengthBackward;
1127 pNewWordWidthInfo->maxHeight = height;
1128 pNewWordWidthInfo->width = widthBackward;
1130 TextSimpleList::InsertObjectAfterNode(__pTextWidthInfoList, __pCurrentWordWidthInfoNode, pNewWordWidthInfo);
1132 pWordWidthInfo->length -= stringLengthBackward;
1133 pWordWidthInfo->width -= widthBackward;
1137 return pWordWidthInfo;
1140 return pWordWidthInfo;
1147 TextWidthManager::SplitWordWidthInfo(SimpleNode* pCurrentWordWidthInfoNode, TextElement* pCurrentTextElement,
1148 int strCurrentRelIndex, int strCurrentLength, int limitWidth, bool& isNextKoreanStart)
1150 WordTextWidthInfo* pWordWidthInfo = static_cast < WordTextWidthInfo* >(pCurrentWordWidthInfoNode->pObject);
1151 SysTryReturn(NID_GRP
1153 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text width information.");
1155 int currentWordWidth = pWordWidthInfo->width;
1156 int currentWordLength = pWordWidthInfo->length;
1158 if ((currentWordWidth - limitWidth) >= (currentWordWidth >> 2))
1160 TextElement* pTextElement = pCurrentTextElement;
1161 int strSrcRelIndex = strCurrentRelIndex;
1162 int currentLength = Math::Min(__currentTextElementLength, currentWordLength);
1163 int stringLength = currentWordLength;
1164 int endType = TEXT_RETBY_NORMAL;
1165 int remainWidth = limitWidth;
1170 int stringIndex = 0;
1171 int textElementIndex = __pCompositeText->GetElementIndexOf(*pCurrentTextElement);
1172 SysTryReturn(NID_GRP
1173 , textElementIndex >= 0
1174 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text element.");
1176 while (stringLength != 0)
1178 endType = pTextElement->ForwardAnalyze(strSrcRelIndex, currentLength, remainWidth,
1179 TEXT_OBJECT_WRAP_TYPE_NONE, charCount, width, height);
1181 if (endType == TEXT_RETBY_LIMITWIDTH)
1183 stringIndex += charCount;
1184 strSrcRelIndex += charCount;
1185 remainWidth -= width;
1186 if (height > maxHeight)
1192 else if (endType != TEXT_RETBY_LIMITLENGTH)
1194 ; //SysAssert(false);
1198 pTextElement = __pCompositeText->GetElementAtElementIndex(textElementIndex);
1199 if (pTextElement == null)
1204 remainWidth -= width;
1206 if (height > maxHeight)
1211 strSrcRelIndex = pTextElement->GetValue(SET_TEXT_OFFSET);
1212 stringLength -= currentLength;
1213 stringIndex += currentLength;
1214 currentLength = Math::Min(stringLength, pTextElement->GetValue(
1215 SET_TEXT_OFFSET) + pTextElement->GetTextLength() - strSrcRelIndex);
1218 SysTryReturn(NID_GRP
1220 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text element.");
1222 TextSimple* pSimpleTextElement = dynamic_cast < TextSimple* >(pTextElement);
1223 SysTryReturn(NID_GRP
1224 , pSimpleTextElement
1225 , null, E_SYSTEM, "[E_SYSTEM] Fail to cast text element.");
1227 wchar_t* pText = (wchar_t*)pSimpleTextElement->GetText();
1228 isNextKoreanStart = IsKorean(pText[0]);
1230 if (stringIndex > 0)
1232 WordTextWidthInfo* pNewWordWidthInfo = new (std::nothrow) WordTextWidthInfo;
1233 SysTryReturn(NID_GRP
1235 , null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
1237 pNewWordWidthInfo->type = TEXT_WIDTH_INFO_WORD;
1238 pNewWordWidthInfo->length = stringIndex;
1239 pNewWordWidthInfo->maxHeight = height;
1240 pNewWordWidthInfo->width = limitWidth - remainWidth;
1242 if (pCurrentWordWidthInfoNode == __pCachedWordWidthInfoNode)
1244 __pCachedWordWidthInfoNode = TextSimpleList::InsertObjectBeforeNode(__pTextWidthInfoList,
1245 pCurrentWordWidthInfoNode, pNewWordWidthInfo);
1249 TextSimpleList::InsertObjectBeforeNode(__pTextWidthInfoList, pCurrentWordWidthInfoNode, pNewWordWidthInfo);
1252 pWordWidthInfo->length -= stringIndex;
1253 pWordWidthInfo->width -= pNewWordWidthInfo->width;
1254 return pNewWordWidthInfo;
1258 return pWordWidthInfo;
1263 int remainingWidth = currentWordWidth - limitWidth;
1265 TextElement* pTextElement = __pCurrentComposeTextElement;
1266 int textElementIndex = __currentComposeTextElementIndex;
1267 int strSrcRelIndex = strCurrentRelIndex;
1268 int textLength = currentWordLength;
1269 int currentLength = __currentTextElementLength;
1270 TextElement* pTextElementStack[10];
1271 int textElementStackIndex = 0;
1273 pTextElementStack[0] = pTextElement;
1275 while (textLength > 0)
1277 if (currentLength >= textLength)
1279 strSrcRelIndex += (textLength - 1);
1283 textLength -= currentLength;
1286 pTextElement = __pCompositeText->GetElementAtElementIndex(textElementIndex);
1287 if (pTextElement == null)
1292 strSrcRelIndex = pTextElement->GetValue(SET_TEXT_OFFSET);
1293 currentLength = pTextElement->GetValue(SET_TEXT_OFFSET) + pTextElement->GetTextLength() - strSrcRelIndex;
1295 textElementStackIndex++;
1296 pTextElementStack[textElementStackIndex] = pTextElement;
1299 SysTryReturn(NID_GRP
1301 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text element.");
1305 int strSrcStartRelIndex = pTextElement->GetValue(SET_TEXT_OFFSET);
1306 int widthBackward = 0;
1307 int stringLengthBackward = 0;
1309 while (remainingWidth > 0)
1311 pTextElement->GetRegion(strSrcRelIndex, 1, width, height);
1312 if (remainingWidth <= width)
1314 widthBackward += width;
1315 stringLengthBackward++;
1316 if (height > maxHeight)
1323 widthBackward += width;
1324 stringLengthBackward++;
1325 remainingWidth -= width;
1327 if (height > maxHeight)
1332 if (strSrcStartRelIndex < strSrcRelIndex)
1338 textElementStackIndex--;
1339 SysTryReturn(NID_GRP
1340 , textElementStackIndex >= 0
1341 , null, E_SYSTEM, "[E_SYSTEM] Index must be greater than or equal to 0.");
1343 pTextElement = pTextElementStack[textElementStackIndex];
1344 SysTryReturn(NID_GRP
1346 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text element.");
1348 strSrcStartRelIndex = pTextElement->GetValue(SET_TEXT_OFFSET);
1349 strSrcRelIndex = pTextElement->GetValue(SET_TEXT_OFFSET) + pTextElement->GetTextLength() - 1;
1353 TextSimple* pSimpleTextElement = dynamic_cast < TextSimple* >(pTextElement);
1354 SysTryReturn(NID_GRP
1355 , pSimpleTextElement
1356 , null, E_SYSTEM, "[E_SYSTEM] Fail to cast text element.");
1358 wchar_t* pText = (wchar_t*)pSimpleTextElement->GetText();
1359 isNextKoreanStart = IsKorean(pText[0]);
1361 if ((stringLengthBackward > 0) && (stringLengthBackward < pWordWidthInfo->length))
1363 WordTextWidthInfo* pNewWordWidthInfo = new (std::nothrow) WordTextWidthInfo;
1364 SysTryReturn(NID_GRP
1366 , null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
1368 pNewWordWidthInfo->type = TEXT_WIDTH_INFO_WORD;
1369 pNewWordWidthInfo->length = stringLengthBackward;
1370 pNewWordWidthInfo->maxHeight = height;
1371 pNewWordWidthInfo->width = widthBackward;
1373 TextSimpleList::InsertObjectAfterNode(__pTextWidthInfoList, pCurrentWordWidthInfoNode, pNewWordWidthInfo);
1375 pWordWidthInfo->length -= stringLengthBackward;
1376 pWordWidthInfo->width -= widthBackward;
1380 return pWordWidthInfo;
1383 return pWordWidthInfo;
1390 TextWidthManager::Seek(int textLength)
1392 if (__currentTextIndex + textLength > __length)
1397 if (__currentTextIndex + textLength == __length)
1399 __pCurrentWordWidthInfoNode = null;
1400 __pCurrentComposeTextElement = null;
1401 __currentTextIndex += textLength;
1405 if (textLength == 0)
1410 TextWidthCommonInfo* pCurrentTextWidthInfo = static_cast < TextWidthCommonInfo* >(__pCurrentWordWidthInfoNode->pObject);
1411 SysTryReturn(NID_GRP
1412 , pCurrentTextWidthInfo
1413 , false, E_SYSTEM, "[E_SYSTEM] Fail to get text width information.");
1415 int strCurrentTextWidthInfoLength = GetTextWidthInfoLength(pCurrentTextWidthInfo);
1417 if (__textOffsetOfCurrentWidthInfo != 0)
1422 int length = textLength;
1426 length -= strCurrentTextWidthInfoLength;
1428 __pCurrentWordWidthInfoNode = __pCurrentWordWidthInfoNode->pNext;
1429 pCurrentTextWidthInfo = static_cast < TextWidthCommonInfo* >(__pCurrentWordWidthInfoNode->pObject);
1430 SysTryReturn(NID_GRP
1431 , pCurrentTextWidthInfo
1432 , false, E_SYSTEM, "[E_SYSTEM] Fail to get text width information.");
1433 strCurrentTextWidthInfoLength = GetTextWidthInfoLength(pCurrentTextWidthInfo);
1436 length = textLength;
1437 TextElement* pTextElement = __pCurrentComposeTextElement;
1438 int textElementIndex = __currentComposeTextElementIndex;
1439 int strSrcRelIndex = __strCurrentRelIndex;
1440 int currentLength = __currentTextElementLength;
1444 if (currentLength > length)
1446 strSrcRelIndex += length;
1450 length -= currentLength;
1453 pTextElement = __pCompositeText->GetElementAtElementIndex(textElementIndex);
1454 if (pTextElement == null)
1459 strSrcRelIndex = pTextElement->GetValue(SET_TEXT_OFFSET);
1460 currentLength = pTextElement->GetValue(SET_TEXT_OFFSET) + pTextElement->GetTextLength() - strSrcRelIndex;
1463 SysTryReturn(NID_GRP
1465 , false, E_SYSTEM, "[E_SYSTEM] Fail to get text element.");
1467 __pCurrentComposeTextElement = pTextElement;
1468 __strCurrentRelIndex = strSrcRelIndex;
1469 __currentTextElementLength = pTextElement->GetValue(SET_TEXT_OFFSET) + pTextElement->GetTextLength() - strSrcRelIndex;
1470 __currentTextIndex += textLength;
1476 TextWidthManager::AnalyzeCurrentUnKnownTextWidthInfo(int limitWidth)
1478 SimpleNode* pCurrentWordWidthInfoNode = __pCurrentWordWidthInfoNode;
1479 UnknownTextWidthInfo* pCurrentUnknowTextWidthInfo = static_cast < UnknownTextWidthInfo* >(__pCurrentWordWidthInfoNode->pObject);
1480 SysTryReturn(NID_GRP
1481 , pCurrentUnknowTextWidthInfo
1482 , false, E_SYSTEM, "[E_SYSTEM] Fail to get text width information.");
1484 int strCurrentTextWidthInfoLength = pCurrentUnknowTextWidthInfo->length;
1486 TextElement* pTextElement = __pCurrentComposeTextElement;
1487 int textElementIndex = __currentComposeTextElementIndex;
1488 int strSrcRelIndex = __strCurrentRelIndex;
1489 int currentLength = __currentTextElementLength;
1490 int textLength = strCurrentTextWidthInfoLength;
1494 TextElementType objectType;
1496 bool getDone = false;
1498 while (textLength > 0)
1500 objectType = pTextElement->GetType();
1504 case TEXT_ELEMENT_TYPE_TEXT:
1506 case TEXT_ELEMENT_TYPE_CUTLINK:
1508 TextSimple* pSimpleTextElement = dynamic_cast < TextSimple* >(pTextElement);
1509 SysTryReturn(NID_GRP
1510 , pSimpleTextElement
1511 , null, E_SYSTEM, "[E_SYSTEM] Fail to cast text element.");
1514 int currentTextLength = 0;
1516 wordType = pSimpleTextElement->GetWordLength(strSrcRelIndex, currentTextLength);
1517 if (wordType == WORD_ENTER)
1519 pCurrentUnknowTextWidthInfo->length -= currentTextLength;
1521 pTextElement->GetRegion(strSrcRelIndex, 1, width, height);
1523 EnterTextWidthInfo* pNewEnterTextWidthInfo = new (std::nothrow) EnterTextWidthInfo;
1524 SysTryReturn(NID_GRP
1525 , pNewEnterTextWidthInfo
1526 , false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
1528 pNewEnterTextWidthInfo->type = TEXT_WIDTH_INFO_ENTER;
1529 pNewEnterTextWidthInfo->length = currentTextLength;
1530 pNewEnterTextWidthInfo->maxHeight = height;
1532 if (pCurrentWordWidthInfoNode == __pCurrentWordWidthInfoNode)
1534 bool changecachedInfo = false;
1536 if (__pCurrentWordWidthInfoNode == __pCachedWordWidthInfoNode)
1538 changecachedInfo = true;
1541 __pCurrentWordWidthInfoNode =
1542 TextSimpleList::InsertObjectBeforeNode(__pTextWidthInfoList, pCurrentWordWidthInfoNode,
1543 pNewEnterTextWidthInfo);
1545 if (changecachedInfo)
1547 __pCachedWordWidthInfoNode = __pCurrentWordWidthInfoNode;
1552 TextSimpleList::InsertObjectBeforeNode(__pTextWidthInfoList, pCurrentWordWidthInfoNode,
1553 pNewEnterTextWidthInfo);
1558 else if (wordType == WORD_SPACE)
1560 pCurrentUnknowTextWidthInfo->length--;
1562 pTextElement->GetRegion(strSrcRelIndex, 1, width, height);
1564 SpaceTextWidthInfo* pNewSpaceTextWidthInfo = new (std::nothrow) SpaceTextWidthInfo;
1565 SysTryReturn(NID_GRP
1566 , pNewSpaceTextWidthInfo
1567 , false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
1569 pNewSpaceTextWidthInfo->type = TEXT_WIDTH_INFO_SPACE;
1570 pNewSpaceTextWidthInfo->width = width;
1571 pNewSpaceTextWidthInfo->maxHeight = height;
1573 if (pCurrentWordWidthInfoNode == __pCurrentWordWidthInfoNode)
1575 bool changecachedInfo = false;
1577 if (__pCurrentWordWidthInfoNode == __pCachedWordWidthInfoNode)
1579 changecachedInfo = true;
1582 __pCurrentWordWidthInfoNode =
1583 TextSimpleList::InsertObjectBeforeNode(__pTextWidthInfoList, pCurrentWordWidthInfoNode,
1584 pNewSpaceTextWidthInfo);
1586 if (changecachedInfo)
1588 __pCachedWordWidthInfoNode = __pCurrentWordWidthInfoNode;
1593 TextSimpleList::InsertObjectBeforeNode(__pTextWidthInfoList, pCurrentWordWidthInfoNode,
1594 pNewSpaceTextWidthInfo);
1599 limitWidth -= width;
1604 if (currentTextLength > textLength)
1606 currentTextLength = textLength;
1608 pCurrentUnknowTextWidthInfo->length -= currentTextLength;
1610 pTextElement->GetRegion(strSrcRelIndex, currentTextLength, width, height);
1612 WordTextWidthInfo* pNewWordTextWidthInfo = new (std::nothrow) WordTextWidthInfo;
1613 SysTryReturn(NID_GRP
1614 , pNewWordTextWidthInfo
1615 , false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
1617 pNewWordTextWidthInfo->type = TEXT_WIDTH_INFO_WORD;
1618 pNewWordTextWidthInfo->length = currentTextLength;
1619 pNewWordTextWidthInfo->width = width;
1620 pNewWordTextWidthInfo->maxHeight = height;
1622 if (pCurrentWordWidthInfoNode == __pCurrentWordWidthInfoNode)
1624 bool changecachedInfo = false;
1626 if (__pCurrentWordWidthInfoNode == __pCachedWordWidthInfoNode)
1628 changecachedInfo = true;
1631 __pCurrentWordWidthInfoNode =
1632 TextSimpleList::InsertObjectBeforeNode(__pTextWidthInfoList, pCurrentWordWidthInfoNode,
1633 pNewWordTextWidthInfo);
1635 if (changecachedInfo)
1637 __pCachedWordWidthInfoNode = __pCurrentWordWidthInfoNode;
1642 TextSimpleList::InsertObjectBeforeNode(__pTextWidthInfoList, pCurrentWordWidthInfoNode,
1643 pNewWordTextWidthInfo);
1646 currentLength -= currentTextLength;
1647 strSrcRelIndex += currentTextLength;
1648 limitWidth -= width;
1649 textLength -= currentTextLength;
1654 case TEXT_ELEMENT_TYPE_IMAGE:
1656 pTextElement->GetRegion(0, 1, width, height);
1658 pCurrentUnknowTextWidthInfo->length--;
1660 SymbolTextWidthInfo* pNewSymbolTextWidthInfo = new (std::nothrow) SymbolTextWidthInfo;
1661 SysTryReturn(NID_GRP
1662 , pNewSymbolTextWidthInfo
1663 , false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
1665 pNewSymbolTextWidthInfo->type = TEXT_WIDTH_INFO_SYMBOL;
1666 pNewSymbolTextWidthInfo->width = width;
1667 pNewSymbolTextWidthInfo->maxHeight = height;
1669 if (pCurrentWordWidthInfoNode == __pCurrentWordWidthInfoNode)
1671 bool changecachedInfo = false;
1673 if (__pCurrentWordWidthInfoNode == __pCachedWordWidthInfoNode)
1675 changecachedInfo = true;
1678 __pCurrentWordWidthInfoNode =
1679 TextSimpleList::InsertObjectBeforeNode(__pTextWidthInfoList, pCurrentWordWidthInfoNode,
1680 pNewSymbolTextWidthInfo);
1682 if (changecachedInfo)
1684 __pCachedWordWidthInfoNode = __pCurrentWordWidthInfoNode;
1689 TextSimpleList::InsertObjectBeforeNode(__pTextWidthInfoList, pCurrentWordWidthInfoNode,
1690 pNewSymbolTextWidthInfo);
1701 if (limitWidth <= 0)
1711 if (currentLength <= 0)
1714 pTextElement = __pCompositeText->GetElementAtElementIndex(textElementIndex);
1715 if (pTextElement == null)
1720 strSrcRelIndex = pTextElement->GetValue(SET_TEXT_OFFSET);
1721 currentLength = pTextElement->GetValue(SET_TEXT_OFFSET) + pTextElement->GetTextLength() - strSrcRelIndex;
1725 if (pCurrentUnknowTextWidthInfo->length == 0)
1727 TextSimpleList::DeleteNode(__pTextWidthInfoList, pCurrentWordWidthInfoNode);
1734 TextWidthManager::AnalyzeUnKnownTextWidthInfo(SimpleNode* pCurrentWordWidthInfoNode, TextElement* pCurrentTextElement,
1735 int strCurrentRelIndex, int strCurrentLength, int limitWidth)
1737 SimpleNode* pReturnWordWidthInfoNode = null;
1738 SimpleNode* p_current_word_width_info_node = pCurrentWordWidthInfoNode;
1739 int strCurrentTextWidthInfoLength = 0;
1741 UnknownTextWidthInfo* pCurrentUnknowTextWidthInfo = static_cast < UnknownTextWidthInfo* >(pCurrentWordWidthInfoNode->pObject);
1742 SysTryReturn(NID_GRP
1743 , pCurrentUnknowTextWidthInfo
1744 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text width information.");
1745 strCurrentTextWidthInfoLength = pCurrentUnknowTextWidthInfo->length;
1747 TextElement* pTextElement = pCurrentTextElement;
1748 SysTryReturn(NID_GRP
1750 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text element.");
1752 int textElementIndex = __pCompositeText->GetElementIndexOf(*pCurrentTextElement);
1753 SysTryReturn(NID_GRP
1754 , textElementIndex >= 0
1755 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text element.");
1757 int strSrcRelIndex = strCurrentRelIndex;
1758 int currentLength = strCurrentLength;
1759 int textLength = strCurrentTextWidthInfoLength;
1760 TextElementType objectType;
1761 bool getDone = false;
1765 while (textLength > 0)
1767 objectType = pTextElement->GetType();
1771 case TEXT_ELEMENT_TYPE_TEXT:
1773 case TEXT_ELEMENT_TYPE_CUTLINK:
1775 TextSimple* pSimpleTextElement = dynamic_cast < TextSimple* >(pTextElement);
1776 SysTryReturn(NID_GRP
1777 , pSimpleTextElement
1778 , null, E_SYSTEM, "[E_SYSTEM] Fail to cast text element.");
1781 int currentTextLength = 0;
1783 wordType = pSimpleTextElement->GetWordLength(strSrcRelIndex, currentTextLength);
1784 if (wordType == WORD_ENTER)
1786 pCurrentUnknowTextWidthInfo->length -= currentTextLength;
1788 pTextElement->GetRegion(strSrcRelIndex, 1, width, height);
1790 EnterTextWidthInfo* pNewEnterTextWidthInfo = new (std::nothrow) EnterTextWidthInfo;
1791 SysTryReturn(NID_GRP
1792 , pNewEnterTextWidthInfo
1793 , null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
1795 pNewEnterTextWidthInfo->type = TEXT_WIDTH_INFO_ENTER;
1796 pNewEnterTextWidthInfo->length = currentTextLength;
1797 pNewEnterTextWidthInfo->maxHeight = height;
1799 if (pReturnWordWidthInfoNode == null)
1801 bool changecachedInfo = false;
1803 if (p_current_word_width_info_node == __pCachedWordWidthInfoNode)
1805 changecachedInfo = true;
1808 pReturnWordWidthInfoNode =
1809 TextSimpleList::InsertObjectBeforeNode(__pTextWidthInfoList, pCurrentWordWidthInfoNode,
1810 pNewEnterTextWidthInfo);
1812 if (changecachedInfo)
1814 __pCachedWordWidthInfoNode = pReturnWordWidthInfoNode;
1819 TextSimpleList::InsertObjectBeforeNode(__pTextWidthInfoList, pCurrentWordWidthInfoNode,
1820 pNewEnterTextWidthInfo);
1825 else if (wordType == WORD_SPACE)
1827 pCurrentUnknowTextWidthInfo->length--;
1829 pTextElement->GetRegion(strSrcRelIndex, 1, width, height);
1831 SpaceTextWidthInfo* pNewSpaceTextWidthInfo = new (std::nothrow) SpaceTextWidthInfo;
1832 SysTryReturn(NID_GRP
1833 , pNewSpaceTextWidthInfo
1834 , null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
1836 pNewSpaceTextWidthInfo->type = TEXT_WIDTH_INFO_SPACE;
1837 pNewSpaceTextWidthInfo->width = width;
1838 pNewSpaceTextWidthInfo->maxHeight = height;
1840 if (pReturnWordWidthInfoNode == null)
1842 bool changecachedInfo = false;
1844 if (p_current_word_width_info_node == __pCachedWordWidthInfoNode)
1846 changecachedInfo = true;
1849 pReturnWordWidthInfoNode = TextSimpleList::InsertObjectBeforeNode(__pTextWidthInfoList, pCurrentWordWidthInfoNode,
1850 pNewSpaceTextWidthInfo);
1852 if (changecachedInfo)
1854 __pCachedWordWidthInfoNode = pReturnWordWidthInfoNode;
1859 TextSimpleList::InsertObjectBeforeNode(__pTextWidthInfoList, pCurrentWordWidthInfoNode,
1860 pNewSpaceTextWidthInfo);
1865 limitWidth -= width;
1870 if (textLength < currentTextLength)
1872 currentTextLength = textLength;
1874 pCurrentUnknowTextWidthInfo->length -= currentTextLength;
1876 pTextElement->GetRegion(strSrcRelIndex, currentTextLength, width, height);
1878 WordTextWidthInfo* pNewWordTextWidthInfo = new (std::nothrow) WordTextWidthInfo;
1879 SysTryReturn(NID_GRP
1880 , pNewWordTextWidthInfo
1881 , null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
1883 pNewWordTextWidthInfo->type = TEXT_WIDTH_INFO_WORD;
1884 pNewWordTextWidthInfo->length = currentTextLength;
1885 pNewWordTextWidthInfo->width = width;
1886 pNewWordTextWidthInfo->maxHeight = height;
1888 if (pReturnWordWidthInfoNode == null)
1890 bool changecachedInfo = false;
1892 if (p_current_word_width_info_node == __pCachedWordWidthInfoNode)
1894 changecachedInfo = true;
1897 pReturnWordWidthInfoNode =
1898 TextSimpleList::InsertObjectBeforeNode(__pTextWidthInfoList, pCurrentWordWidthInfoNode,
1899 pNewWordTextWidthInfo);
1901 if (changecachedInfo)
1903 __pCachedWordWidthInfoNode = pReturnWordWidthInfoNode;
1908 TextSimpleList::InsertObjectBeforeNode(__pTextWidthInfoList, pCurrentWordWidthInfoNode,
1909 pNewWordTextWidthInfo);
1912 currentLength -= currentTextLength;
1913 strSrcRelIndex += currentTextLength;
1914 limitWidth -= width;
1915 textLength -= currentTextLength;
1920 case TEXT_ELEMENT_TYPE_IMAGE:
1922 pTextElement->GetRegion(0, 1, width, height);
1924 pCurrentUnknowTextWidthInfo->length--;
1926 SymbolTextWidthInfo* pNewSymbolTextWidthInfo = new (std::nothrow) SymbolTextWidthInfo;
1927 SysTryReturn(NID_GRP
1928 , pNewSymbolTextWidthInfo
1929 , null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
1931 pNewSymbolTextWidthInfo->type = TEXT_WIDTH_INFO_SYMBOL;
1932 pNewSymbolTextWidthInfo->width = width;
1933 pNewSymbolTextWidthInfo->maxHeight = height;
1935 if (pReturnWordWidthInfoNode == null)
1937 bool changecachedInfo = false;
1939 if (p_current_word_width_info_node == __pCachedWordWidthInfoNode)
1941 changecachedInfo = true;
1944 pReturnWordWidthInfoNode = TextSimpleList::InsertObjectBeforeNode(__pTextWidthInfoList, pCurrentWordWidthInfoNode,
1945 pNewSymbolTextWidthInfo);
1947 if (changecachedInfo)
1949 __pCachedWordWidthInfoNode = pReturnWordWidthInfoNode;
1954 TextSimpleList::InsertObjectBeforeNode(__pTextWidthInfoList, pCurrentWordWidthInfoNode,
1955 pNewSymbolTextWidthInfo);
1966 if (limitWidth <= 0)
1976 if (currentLength <= 0)
1979 pTextElement = __pCompositeText->GetElementAtElementIndex(textElementIndex);
1980 if (pTextElement == null)
1985 strSrcRelIndex = pTextElement->GetValue(SET_TEXT_OFFSET);
1986 currentLength = pTextElement->GetValue(SET_TEXT_OFFSET) + pTextElement->GetTextLength() - strSrcRelIndex;
1990 if (pCurrentUnknowTextWidthInfo->length == 0)
1992 TextSimpleList::DeleteNode(__pTextWidthInfoList, pCurrentWordWidthInfoNode);
1995 return pReturnWordWidthInfoNode;
1999 TextWidthManager::AnalyzeNextTextWidthInfo(int limitWidth, bool& wordoverWidth, int& widthAnlyzed, int& strLengthAalyzed,
2000 int& heightAnalzyed, bool& isnextKorean, bool& meetCutlink)
2003 strLengthAalyzed = 0;
2005 wordoverWidth = false;
2006 isnextKorean = false;
2008 TextWidthCommonInfo* pCurrentCommonTextWidthInfo = static_cast < TextWidthCommonInfo* >(__pCurrentWordWidthInfoNode->pObject);
2009 SysTryReturn(NID_GRP
2010 , pCurrentCommonTextWidthInfo
2011 , false, E_SYSTEM, "[E_SYSTEM] Fail to get text width information.");
2013 int strCurrentTextWidthInfoLength = GetTextWidthInfoLength(pCurrentCommonTextWidthInfo);
2015 SimpleNode* pCurrentWordWidthInfoNode = __pCurrentWordWidthInfoNode->pNext;
2016 if (pCurrentWordWidthInfoNode == null)
2021 pCurrentCommonTextWidthInfo = static_cast < TextWidthCommonInfo* >(pCurrentWordWidthInfoNode->pObject);
2022 SysTryReturn(NID_GRP
2023 , pCurrentCommonTextWidthInfo
2024 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text width information.");
2026 TextElement* pTextElement = __pCurrentComposeTextElement;
2027 int textElementIndex = __currentComposeTextElementIndex;
2028 int strSrcRelIndex = __strCurrentRelIndex;
2029 int strTextElementLength = __currentTextElementLength;
2031 int seekLength = strCurrentTextWidthInfoLength;
2033 while (seekLength > 0)
2035 if (seekLength < strTextElementLength)
2037 strSrcRelIndex += seekLength;
2038 strTextElementLength -= seekLength;
2042 seekLength -= strTextElementLength;
2044 if (pTextElement->GetType() == TEXT_ELEMENT_TYPE_CUTLINK)
2049 pTextElement = __pCompositeText->GetElementAtElementIndex(textElementIndex);
2050 if (pTextElement == null)
2059 pTextElement = __pCompositeText->GetElementAtElementIndex(textElementIndex);
2060 if (pTextElement == null)
2065 strSrcRelIndex = pTextElement->GetValue(SET_TEXT_OFFSET);
2066 strTextElementLength = pTextElement->GetValue(SET_TEXT_OFFSET) + pTextElement->GetTextLength() - strSrcRelIndex;
2068 if (pTextElement->GetType() == TEXT_ELEMENT_TYPE_CUTLINK)
2075 int widthAnalyzed = 0;
2077 int stringAnalzyed = 0;
2078 int widthLeft = limitWidth;
2080 int type = pCurrentCommonTextWidthInfo->type;
2082 while (((type == TEXT_WIDTH_INFO_WORD) || (type == TEXT_WIDTH_INFO_UNKNOWN)) && !meetCutlink)
2084 SysTryReturn(NID_GRP
2086 , false, E_SYSTEM, "[E_SYSTEM] Fail to get text element.");
2089 if (type == TEXT_WIDTH_INFO_WORD)
2091 WordTextWidthInfo* pWordTtextWidthInfo = static_cast < WordTextWidthInfo* >(pCurrentCommonTextWidthInfo);
2092 SysTryReturn(NID_GRP
2093 , pWordTtextWidthInfo
2094 , false, E_SYSTEM, "[E_SYSTEM] Fail to get text width information.");
2096 if (widthLeft < pWordTtextWidthInfo->width)
2098 if ((widthLeft <= 0) || (pTextElement->GetType() == TEXT_ELEMENT_TYPE_CUTLINK))
2100 wordoverWidth = true;
2104 int textLengthBeforeSplit = GetTextWidthInfoLength(static_cast < TextWidthCommonInfo* >(pCurrentWordWidthInfoNode->pObject));
2105 pWordTtextWidthInfo = SplitWordWidthInfo(pCurrentWordWidthInfoNode, pTextElement, strSrcRelIndex,
2106 strTextElementLength, widthLeft, isnextKorean);
2108 if (textLengthBeforeSplit != pWordTtextWidthInfo->length)
2110 widthAnalyzed += pWordTtextWidthInfo->width;
2111 stringAnalzyed += pWordTtextWidthInfo->length;
2112 if (pWordTtextWidthInfo->maxHeight > maxHeight)
2114 maxHeight = pWordTtextWidthInfo->maxHeight;
2118 wordoverWidth = true;
2123 widthAnalyzed += pWordTtextWidthInfo->width;
2124 widthLeft -= pWordTtextWidthInfo->width;
2125 stringAnalzyed += pWordTtextWidthInfo->length;
2126 if (pWordTtextWidthInfo->maxHeight > maxHeight)
2128 maxHeight = pWordTtextWidthInfo->maxHeight;
2131 stringtoGo = pWordTtextWidthInfo->length;
2136 SimpleNode* pNewSimpleNode = AnalyzeUnKnownTextWidthInfo(pCurrentWordWidthInfoNode, pTextElement,
2137 strSrcRelIndex, strTextElementLength, widthLeft);
2139 SysTryReturn(NID_GRP
2141 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text element node.");
2143 pCurrentWordWidthInfoNode = pNewSimpleNode;
2144 pCurrentCommonTextWidthInfo = static_cast < TextWidthCommonInfo* >(pCurrentWordWidthInfoNode->pObject);
2145 SysTryReturn(NID_GRP
2146 , pCurrentCommonTextWidthInfo
2147 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text width information.");
2149 type = pCurrentCommonTextWidthInfo->type;
2154 pCurrentWordWidthInfoNode = pCurrentWordWidthInfoNode->pNext;
2155 if (pCurrentWordWidthInfoNode == null)
2160 pCurrentCommonTextWidthInfo = static_cast < TextWidthCommonInfo* >(pCurrentWordWidthInfoNode->pObject);
2161 SysTryReturn(NID_GRP
2162 , pCurrentCommonTextWidthInfo
2163 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text element node.");
2165 type = pCurrentCommonTextWidthInfo->type;
2167 seekLength = stringtoGo;
2169 while (seekLength > 0)
2171 if (seekLength < strTextElementLength)
2173 strSrcRelIndex += seekLength;
2174 strTextElementLength -= seekLength;
2178 seekLength -= strTextElementLength;
2180 if (pTextElement->GetType() == TEXT_ELEMENT_TYPE_CUTLINK)
2183 pTextElement = __pCompositeText->GetElementAtElementIndex(textElementIndex);
2184 if (pTextElement == null)
2194 pTextElement = __pCompositeText->GetElementAtElementIndex(textElementIndex);
2195 SysTryReturn(NID_GRP
2197 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text element.");
2199 strSrcRelIndex = pTextElement->GetValue(SET_TEXT_OFFSET);
2200 strTextElementLength = pTextElement->GetValue(SET_TEXT_OFFSET) + pTextElement->GetTextLength() - strSrcRelIndex;
2202 if (pTextElement->GetType() == TEXT_ELEMENT_TYPE_CUTLINK)
2211 widthAnlyzed = widthAnalyzed;
2212 strLengthAalyzed = stringAnalzyed;
2213 heightAnalzyed = maxHeight;
2219 TextWidthManager::UpdateCachedTextWidhtInfo(int textOffset, SimpleNode* pTextWidthInfoNode)
2221 __pCachedWordWidthInfoNode = pTextWidthInfoNode;
2222 __textOffsetOfCachedWidthInfo = textOffset;
2228 TextWidthManager::SearchTextWidthInfo(int textIndex, int& widthInfoTextOffset)
2230 SimpleNode* pCurrentTextWidthInfoNode = __pCachedWordWidthInfoNode;
2231 int currentWidthInfoTextOffset = __textOffsetOfCachedWidthInfo;
2233 if (pCurrentTextWidthInfoNode == null)
2235 pCurrentTextWidthInfoNode = TextSimpleList::GetNthNode(__pTextWidthInfoList, 0);
2236 currentWidthInfoTextOffset = 0;
2239 if (pCurrentTextWidthInfoNode == null)
2241 widthInfoTextOffset = 0;
2245 TextWidthCommonInfo* pCurrentTextWidthInfo = static_cast < TextWidthCommonInfo* >(pCurrentTextWidthInfoNode->pObject);
2246 SysTryReturn(NID_GRP
2247 , pCurrentTextWidthInfo
2248 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text width information.");
2250 if (currentWidthInfoTextOffset < textIndex)
2252 int currentWidthInfoTextLength = GetTextWidthInfoLength(pCurrentTextWidthInfo);
2254 while (currentWidthInfoTextOffset + currentWidthInfoTextLength <= textIndex)
2256 pCurrentTextWidthInfoNode = pCurrentTextWidthInfoNode->pNext;
2257 SysTryReturn(NID_GRP
2258 , pCurrentTextWidthInfoNode
2259 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text width.");
2261 currentWidthInfoTextOffset += currentWidthInfoTextLength;
2262 pCurrentTextWidthInfo = static_cast < TextWidthCommonInfo* >(pCurrentTextWidthInfoNode->pObject);
2263 SysTryReturn(NID_GRP
2264 , pCurrentTextWidthInfo
2265 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text width information.");
2267 currentWidthInfoTextLength = GetTextWidthInfoLength(pCurrentTextWidthInfo);
2270 else if (textIndex < currentWidthInfoTextOffset)
2272 pCurrentTextWidthInfoNode = pCurrentTextWidthInfoNode->pPrev;
2274 SysTryReturn(NID_GRP
2275 , pCurrentTextWidthInfoNode
2276 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text width.");
2278 pCurrentTextWidthInfo = static_cast < TextWidthCommonInfo* >(pCurrentTextWidthInfoNode->pObject);
2279 SysTryReturn(NID_GRP
2280 , pCurrentTextWidthInfo
2281 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text width.");
2283 currentWidthInfoTextOffset -= GetTextWidthInfoLength(pCurrentTextWidthInfo);
2285 while (textIndex < currentWidthInfoTextOffset)
2287 pCurrentTextWidthInfoNode = pCurrentTextWidthInfoNode->pPrev;
2289 SysTryReturn(NID_GRP
2290 , pCurrentTextWidthInfoNode
2291 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text width.");
2293 pCurrentTextWidthInfo = static_cast < TextWidthCommonInfo* >(pCurrentTextWidthInfoNode->pObject);
2294 SysTryReturn(NID_GRP
2295 , pCurrentTextWidthInfo
2296 , null, E_SYSTEM, "[E_SYSTEM] Fail to get text width.");
2298 currentWidthInfoTextOffset -= GetTextWidthInfoLength(pCurrentTextWidthInfo);
2302 widthInfoTextOffset = currentWidthInfoTextOffset;
2304 return pCurrentTextWidthInfoNode;
2308 TextWidthManager::IsKorean(wchar_t ch)
2312 if (0xAC00 <= ch && ch <= 0xD7A3)
2316 else if (0x3130 <= ch && ch <= 0x318F)
2320 else if (0x1100 <= ch && ch <= 0x11FF)
2324 else if (0X2E80 <= ch && ch <= 0x2FFF)
2328 else if (0x3220 <= ch && ch <= 0x3243)
2332 else if (0x3280 <= ch && ch <= 0x32CB)
2336 else if (0x3400 <= ch && ch <= 0x4DBF)
2340 else if (0x4E00 <= ch && ch <= 0x9FFF)
2344 else if (0xF900 <= ch && ch <= 0xFAFF)
2352 }}} // Tizen::Graphics::_Text