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_TextTextSimple.cpp
20 * @brief This is the implementation file for TextSimple class.
24 #include <FBaseString.h>
25 #include <FBaseSysLog.h>
26 #include "FGrp_CanvasImpl.h"
27 #include "FGrp_BitmapImpl.h"
28 #include "FGrp_TextTextSimple.h"
29 #include "FGrp_TextTextUtility.h"
30 #include "FGrp_FontImpl.h"
31 #include "../FGrp_BitmapUtil.h"
32 #include "../FGrp_Font.h"
33 #include "../FGrp_Canvas.h"
37 const int DEFAULT_FONT_SIZE = 42;
38 const int LINE_FEED_WIDTH = 8;
41 namespace Tizen { namespace Graphics
47 TextSimple::TextSimple(const wchar_t* pText, int length, TextElementSourceType sourceType, Font* pFont,
48 const Color& foregroundColor, const Color& backgroundColor, const Color& outlineColor)
51 _type = TEXT_ELEMENT_TYPE_TEXT;
52 _sourceType = sourceType;
54 _isAlternateLookEnabled = false;
58 _pFont = _FontImpl::CloneN(const_cast <Font&>(*pFont));
62 _pFont = new (std::nothrow) Font();
63 _pFont->Construct(FONT_STYLE_PLAIN, DEFAULT_FONT_SIZE);
66 _foregroundColor = foregroundColor;
67 _backgroundColor = backgroundColor;
68 _outlineColor = outlineColor;
71 if (sourceType == TEXT_ELEMENT_SOURCE_TYPE_INTERNAL)
73 wchar_t* pTempText = new (std::nothrow) wchar_t[length + 1];
76 int test = (int) _pText;
79 TextUtility::CopyText(pTempText, pText, length);
80 pTempText[length] = 0;
92 _isBackgroundDrawingModeEnabled = false;
93 _userWrap = TEXT_OBJECT_WRAP_TYPE_WORD;
97 TextSimple::~TextSimple(void)
99 if (_sourceType == TEXT_ELEMENT_SOURCE_TYPE_INTERNAL)
122 TextSimple::ForwardAnalyze(int startTextIndex, int textLength, int maxWidth, TextObjectWrapType wrap, int& actualLength,
123 int& width, int& height)
126 int r = TEXT_RETBY_NORMAL;
128 if (textLength > _length)
130 textLength = _length;
135 actualLength = textLength;
139 return TEXT_RETBY_NORMAL;
144 int bitmapWidth = __pBitmap->GetWidth();
145 int bitmapHeight = __pBitmap->GetHeight();
147 if (maxWidth < bitmapWidth)
153 return TEXT_RETBY_OVERWIDTH;
157 actualLength = _length;
159 height = bitmapHeight;
161 return TEXT_RETBY_NORMAL;
165 Font* pCurrentFont = GetCurrentFont();
166 _Font* pFont = _Font::GetInstance(*_FontImpl::GetInstance(*pCurrentFont));
169 , -1, E_SYSTEM, "[E_SYSTEM] Fail to get native font instance.");
171 const wchar_t* pText = &_pText[startTextIndex];
175 case TEXT_OBJECT_WRAP_TYPE_NONE:
177 if (_userWrap == TEXT_OBJECT_WRAP_TYPE_NONE)
179 wchar_t* pModifiedText = new (std::nothrow) wchar_t[textLength + 1];
182 , -1, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
184 int length = ConvertEnterToSpace(pModifiedText, pText, textLength);
185 pModifiedText[length] = 0;
187 actualLength = TextUtility::GetCharCountInWidth(pFont, pModifiedText, length, maxWidth, _outline, width, height);
189 charCount = textLength;
190 r = TEXT_RETBY_NORMAL;
192 delete[] pModifiedText;
193 pModifiedText = null;
197 actualLength = TextUtility::GetCharCountInWidth(pFont, pText, textLength, maxWidth, _outline, width, height);
198 charCount = textLength;
199 r = TEXT_RETBY_NORMAL;
204 case TEXT_OBJECT_WRAP_TYPE_CHARACTER:
205 r = GetSentenceLength(pText, textLength, charCount);
206 actualLength = TextUtility::GetCharCountInWidth(pFont, pText, charCount, maxWidth, _outline, width, height);
207 if (_pText[startTextIndex + actualLength] == TEXT_LINE_FEED ||
208 _pText[startTextIndex + actualLength] == TEXT_CARRIAGE_RETURN)
211 r = TEXT_RETBY_LINEFEED;
215 case TEXT_OBJECT_WRAP_TYPE_WORD:
216 actualLength = TextUtility::GetCharCountInWidth(pFont, pText, textLength, maxWidth, _outline, width, height);
217 int widthcheck = width;
219 if (_pText[startTextIndex + actualLength] == TEXT_LINE_FEED || _pText[startTextIndex + actualLength] == TEXT_CARRIAGE_RETURN)
222 r = TEXT_RETBY_LINEFEED;
224 else if (textLength == actualLength)
226 r = TEXT_RETBY_LIMITLENGTH;
228 else if (actualLength == 0)
231 r = TEXT_RETBY_LIMITWIDTH;
235 r = GetWordWrapLengthEx(pText, actualLength, charCount);
237 if (charCount < actualLength)
241 r = TEXT_RETBY_LIMITWIDTH;
245 r = TEXT_RETBY_NORMAL;
251 if (charCount > (actualLength / 2))
253 const wchar_t* pExtraText = &_pText[startTextIndex + charCount];
254 int overCharCount = TextUtility::GetCharCountInWidth(pFont, pExtraText, actualLength - charCount, maxWidth, _outline, width, height);
255 actualLength = actualLength - overCharCount;
256 width = widthcheck - width;
260 actualLength = TextUtility::GetCharCountInWidth(pFont, pText, charCount, maxWidth, _outline, width, height);
263 actualLength = charCount;
270 if (height == 0 && (textLength > 0))
272 height = pFont->GetLeading();
275 if (actualLength < charCount)
277 r = TEXT_RETBY_LIMITWIDTH;
284 TextSimple::IsKorean(const wchar_t* ch) const
286 if (0xAC00 <= *ch && *ch <= 0xD7A3)
291 if (0x3130 <= *ch && *ch <= 0x318F)
296 if (0x1100 <= *ch && *ch <= 0x11FF)
305 TextSimple::IsChinese(const wchar_t* ch) const
307 if (0X2E80 <= *ch && *ch <= 0x2FFF)
312 else if (0x3220 <= *ch && *ch <= 0x3243)
317 else if (0x3280 <= *ch && *ch <= 0x32CB)
322 else if (0x3400 <= *ch && *ch <= 0x4DBF)
327 else if (0x4E00 <= *ch && *ch <= 0x9FFF)
332 else if (0xF900 <= *ch && *ch <= 0xFAFF)
341 TextSimple::GetRegion(int textIndex, int textLength, int& width, int& height) const
343 const wchar_t* pText = null;
344 Font* pCurrentFont = GetCurrentFont();
347 , E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] This instance is not line wrapped yet.");
349 _Font* pFont = _Font::GetInstance(*_FontImpl::GetInstance(*pCurrentFont));
352 , E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native font instance.");
354 if (textLength > _length)
356 textLength = _length;
369 width = __pBitmap->GetWidth();
370 height = __pBitmap->GetHeight();
375 pText = &_pText[textIndex];
379 case TEXT_OBJECT_WRAP_TYPE_NONE:
381 wchar_t* pModifiedText = new (std::nothrow) wchar_t[textLength + 1];
384 , E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
386 int length = ConvertEnterToSpace(pModifiedText, pText, textLength);
387 pModifiedText[textLength] = 0;
389 TextUtility::GetTextExtent(pFont, pModifiedText, length, _outline, width, height);
391 delete[] pModifiedText;
392 pModifiedText = null;
396 case TEXT_OBJECT_WRAP_TYPE_CHARACTER:
398 case TEXT_OBJECT_WRAP_TYPE_WORD:
399 TextUtility::GetTextExtent(pFont, pText, textLength, _outline, width, height);
403 if (height == 0 && (textLength > 0))
405 height = pFont->GetLeading();
412 TextSimple::GetBlockRegion(int textIndex, int textLength, int& width, int& height) const
414 const wchar_t* pText = null;
415 Font* pCurrentFont = GetCurrentFont();
418 , E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] This instance is not line wrapped yet.");
420 _Font* pFont = _Font::GetInstance(*_FontImpl::GetInstance(*pCurrentFont));
423 , E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native font instance.");
425 if (textLength > _length)
427 textLength = _length;
440 width = __pBitmap->GetWidth();
441 height = __pBitmap->GetHeight();
446 pText = &_pText[textIndex];
450 case TEXT_OBJECT_WRAP_TYPE_NONE:
452 wchar_t* pModifiedText = new (std::nothrow) wchar_t[textLength + 1];
455 , E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
457 int length = ConvertEnterToSpace(pModifiedText, pText, textLength);
458 pModifiedText[textLength] = 0;
460 TextUtility::GetTextExtent(pFont, pModifiedText, length, _outline, width, height);
462 delete[] pModifiedText;
463 pModifiedText = null;
467 case TEXT_OBJECT_WRAP_TYPE_CHARACTER:
469 case TEXT_OBJECT_WRAP_TYPE_WORD:
470 TextUtility::GetTextExtent(pFont, pText, textLength, _outline, width, height);
472 if (pText[textLength-1] == TEXT_LINE_FEED || pText[textLength-1] == TEXT_CARRIAGE_RETURN)
474 width += LINE_FEED_WIDTH;
479 if (height == 0 && (textLength > 0))
481 height = pFont->GetLeading();
488 TextSimple::GetHeight(void) const
490 Font* pFont = GetCurrentFont();
493 , E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] This instance is not line wrapped yet.");
499 maxHeight = __pBitmap->GetHeight();
503 maxHeight = TextUtility::GetFontMaxHeight(pFont);
510 TextSimple::Draw(_CanvasImpl& canvasImpl, Rectangle& displayRect, int startTextIndex, int textLength,
511 const TextObjectAlignment align, const TextObjectActionType action)
514 , textLength <= _length
515 , E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
522 result r = E_SUCCESS;
523 _Canvas* pCanvas = _Canvas::GetInstance(canvasImpl);
526 , E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native canvas instance.");
530 r = pCanvas->DrawBitmap(Point(displayRect.x, displayRect.y), *GetBitmapEx(*_BitmapImpl::GetInstance(*__pBitmap)));
533 , r, r, "[%s] Propagating.", GetErrorMessage(r));
538 Color foregroundColor = GetCurrentForegroundColor();
539 pCanvas->SetForegroundColor(foregroundColor);
541 Color backgroundColor = GetCurrentBackgroundColor();
542 pCanvas->SetBackgroundColor(backgroundColor);
544 Color outlineColor = GetCurrentOutlineColor();
546 Font* pCurrentFont = GetCurrentFont();
549 , E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] This instance is not line wrapped yet.");
551 _Font* pFont = _Font::GetInstance(*_FontImpl::GetInstance(*pCurrentFont));
554 , E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native font instance.");
556 r = pCanvas->SetPriorityFont(*pFont);
559 , r, r, "[%s] Propagating.", GetErrorMessage(r));
561 if (_userWrap != TEXT_OBJECT_WRAP_TYPE_NONE)
565 return TextUtility::DrawOutlineText(*pCanvas, displayRect.x, displayRect.y, &_pText[startTextIndex], textLength, outlineColor);
569 return TextUtility::DrawText(*pCanvas, displayRect.x, displayRect.y, &_pText[startTextIndex], textLength);
574 wchar_t* pModifiedText = new (std::nothrow) wchar_t[textLength + 1];
577 , E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
579 int length = ConvertEnterToSpace(pModifiedText, &_pText[startTextIndex], textLength);
580 pModifiedText[length] = 0;
584 TextUtility::DrawOutlineText(*pCanvas, displayRect.x, displayRect.y, pModifiedText, length, outlineColor);
588 TextUtility::DrawText(*pCanvas, displayRect.x, displayRect.y, pModifiedText, length);
591 delete[] pModifiedText;
592 pModifiedText = null;
601 TextSimple::CloneN(TextComponentInfoValueType type, unsigned int value)
603 TextSimple* pSimpleTextElement = null;
605 pSimpleTextElement = new (std::nothrow) TextSimple(_pText, _length, TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL, _pFont,
606 _foregroundColor, _backgroundColor, _outlineColor);
610 , null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
612 TextElement::CopyMembers(pSimpleTextElement);
614 pSimpleTextElement->SetValue(SET_TEXT_OFFSET, _offset);
615 pSimpleTextElement->SetValue(SET_ALTERNATE_LOOK, _isAlternateLookEnabled);
616 pSimpleTextElement->SetValue(type, value);
617 pSimpleTextElement->SetUserWrap(_userWrap);
619 return pSimpleTextElement;
623 TextSimple::CopyN(int startTextIndex, int textLength)
625 const wchar_t* pText = null;
627 TextSimple* pSimpleTextElement = null;
629 if (startTextIndex >= _length)
634 if (startTextIndex + textLength > _length)
636 textLength = _length - startTextIndex;
644 pText = &_pText[_offset + startTextIndex];
646 pSimpleTextElement = new (std::nothrow) TextSimple(pText, textLength, _sourceType, _pFont,
647 _foregroundColor, _backgroundColor, _outlineColor);
651 , false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
653 pSimpleTextElement->_isBackgroundDrawingModeEnabled = _isBackgroundDrawingModeEnabled;
655 return pSimpleTextElement;
659 TextSimple::GetValue(TextComponentInfoValueType type) const
665 return (unsigned int) _pFont;
667 case SET_FONT_FGCOLOR:
669 return (unsigned int) _foregroundColor.GetRGB32();
671 case SET_FONT_BGCOLOR:
673 return (unsigned int) _backgroundColor.GetRGB32();
675 case SET_FONT_OUTLINECOLOR:
677 return (unsigned int) _outlineColor.GetRGB32();
679 case SET_TEXT_OFFSET:
681 return (unsigned int) _offset;
683 case SET_ALTERNATE_LOOK:
685 return (unsigned int) _isAlternateLookEnabled;
687 case SET_ALTERNATIVE_FGCOLOR:
689 return (unsigned int) GetAlternativeForegroundColor().GetRGB32();
700 TextSimple::SetValue(TextComponentInfoValueType type, unsigned int value)
702 result r = E_SUCCESS;
711 return E_INVALID_ARG;
714 pFont = _FontImpl::CloneN(const_cast <Font&>(*(Font*) value));
718 , r, r, "[%s] Propagating.", GetErrorMessage(r));
729 case SET_FONT_FGCOLOR:
730 _foregroundColor = Color(value);
733 case SET_FONT_BGCOLOR:
734 _backgroundColor = Color(value);
737 case SET_FONT_OUTLINECOLOR:
738 _outlineColor = Color(value);
741 case SET_TEXT_OFFSET:
742 _offset = (int) value;
745 case SET_ALLVALUE_CLONE:
748 case SET_ALTERNATE_LOOK:
749 _isAlternateLookEnabled = (bool) value;
752 case SET_ALTERNATIVE_FGCOLOR:
753 SetAlternativeForegroundColor(Color(value));
764 TextSimple::SetFont(const Font* pFont)
768 , E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
770 result r = E_SUCCESS;
771 Font* pTmpFont = null;
773 pTmpFont = _FontImpl::CloneN(const_cast <Font&>(*pFont));
777 , r, r, "[%s] Propagating.", GetErrorMessage(r));
790 TextSimple::SetForegroundColor(const Color& color)
792 _foregroundColor = color;
796 TextSimple::SetBackgroundColor(const Color& color)
798 _backgroundColor = color;
802 TextSimple::SetOutlineColor(const Color& color)
804 _outlineColor = color;
809 TextSimple::GetFont(void) const
815 TextSimple::GetForegroundColor(void) const
817 return _foregroundColor;
821 TextSimple::GetBackgroundColor(void) const
823 return _backgroundColor;
827 TextSimple::GetOutlineColor(void) const
829 return _outlineColor;
833 TextSimple::SetTextOffset(int offset)
837 , E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
845 TextSimple::GetTextOffset(void) const
851 TextSimple::GetTextSource(void) const
857 TextSimple::GetText(void) const
859 return &_pText[_offset];
863 TextSimple::IsSame(wchar_t* pText, Font* pFont, const Color& fgColor,
864 const Color& bgColor, const Color& outlineColor)
871 if (!TextUtility::IsSameFontAttribute(_pFont, pFont))
876 if (_foregroundColor != fgColor)
881 if (_backgroundColor != bgColor)
886 if (_outlineColor != outlineColor)
895 TextSimple::ChangeTextOffset(wchar_t* pText, int gap)
899 , E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
907 TextSimple::GetSentenceLength(const wchar_t* pText, int textLength, int& actualLength) const
914 if (*pText == TEXT_LINE_FEED || *pText == TEXT_CARRIAGE_RETURN)
916 wchar_t mch = *pText;
919 if (mch != *pText && (*pText == TEXT_LINE_FEED || *pText == TEXT_CARRIAGE_RETURN))
926 return TEXT_RETBY_LINEFEED;
930 while (length && (*pText != 0))
936 if (*pText == TEXT_LINE_FEED || *pText == TEXT_PARAGRAPH_SEPARATOR)
942 if (*pText == TEXT_CARRIAGE_RETURN)
949 return TEXT_RETBY_LINEFEED;
956 return TEXT_RETBY_LIMITLENGTH;
959 return TEXT_RETBY_NORMAL;
963 TextSimple::GetWordWrapLength(const wchar_t* pText, int textLength, int& actualLength) const
965 int length = textLength;
968 if (*pText == (wchar_t)L' ' || *pText == TEXT_OBJ_CHARACTER)
971 return TEXT_RETBY_NORMAL;
973 else if (*pText == TEXT_LINE_FEED || *pText == TEXT_CARRIAGE_RETURN
974 || *pText == TEXT_PARAGRAPH_SEPARATOR)
976 wchar_t mch = *pText;
982 if (mch != *pText && (*pText == TEXT_LINE_FEED || *pText == TEXT_CARRIAGE_RETURN))
988 return TEXT_RETBY_LINEFEED;
992 while (length && (*pText != 0))
998 if (*pText == (wchar_t)L' ' || *pText == TEXT_OBJ_CHARACTER)
1000 return TEXT_RETBY_NORMAL;
1002 else if (*pText == TEXT_LINE_FEED || *pText == TEXT_CARRIAGE_RETURN || *pText == TEXT_PARAGRAPH_SEPARATOR)
1004 wchar_t mch = *pText;
1010 if (mch != *pText && (*pText == TEXT_LINE_FEED || *pText == TEXT_CARRIAGE_RETURN))
1016 return TEXT_RETBY_LINEFEED;
1023 return TEXT_RETBY_LIMITLENGTH;
1026 return TEXT_RETBY_NORMAL;
1030 TextSimple::GetWordWrapLengthEx(const wchar_t* pText, int textLength, int& actualLength) const
1032 for (int i = 0; i < textLength; i++)
1037 int length = textLength;
1038 actualLength = textLength;
1040 const wchar_t* pLastCharacter = pText - 1;
1041 if (*pLastCharacter == TEXT_LINE_FEED || *pLastCharacter == TEXT_CARRIAGE_RETURN)
1043 return TEXT_RETBY_LINEFEED;
1045 else if (*pLastCharacter == (wchar_t)L' ' || *pLastCharacter == TEXT_OBJ_CHARACTER)
1047 return TEXT_RETBY_NORMAL;
1050 if (*pText == TEXT_OBJ_CHARACTER)
1052 return TEXT_RETBY_NORMAL;
1054 else if (*pText == (wchar_t)L' ')
1060 else if (*pText == TEXT_LINE_FEED || *pText == TEXT_CARRIAGE_RETURN)
1062 wchar_t mch = *pText;
1065 if (mch != *pText && (*pText == TEXT_LINE_FEED || *pText == TEXT_CARRIAGE_RETURN))
1072 return TEXT_RETBY_LINEFEED;
1074 else if (IsChinese(pText))
1076 return TEXT_RETBY_NORMAL;
1079 while ((length >= 0) && (*pText != 0))
1081 if (*pText == (wchar_t)L' ' || *pText == TEXT_OBJ_CHARACTER)
1087 return TEXT_RETBY_NORMAL;
1089 else if (*pText == TEXT_LINE_FEED || *pText == TEXT_CARRIAGE_RETURN)
1091 wchar_t mch = *pText;
1097 if (mch != *pText && (*pText == TEXT_LINE_FEED || *pText == TEXT_CARRIAGE_RETURN))
1104 return TEXT_RETBY_LINEFEED;
1112 if (actualLength < 0)
1117 if (actualLength == 0)
1119 return TEXT_RETBY_LIMITLENGTH;
1122 return TEXT_RETBY_NORMAL;
1126 TextSimple::GetCurrentFont(void) const
1132 TextSimple::GetCurrentForegroundColor(void) const
1134 const TextSimple* pSimpleTextElement = null;
1135 pSimpleTextElement = this;
1137 if (_isAlternateLookEnabled)
1139 return pSimpleTextElement->GetAlternativeForegroundColor();
1143 return _foregroundColor;
1148 TextSimple::SetBackGroundDrawingModeEnabled(bool enable)
1150 _isBackgroundDrawingModeEnabled = enable;
1154 TextSimple::IsBackGroundDrawingModeEnable(void) const
1156 return _isBackgroundDrawingModeEnabled;
1160 TextSimple::ConvertEnterToSpace(wchar_t* pDstText, const wchar_t* pSrcText, int textLength)
1165 for (i = 0; i < textLength; )
1167 if (*pSrcText == TEXT_LINE_FEED)
1169 *pDstText = (wchar_t)L' ';
1175 else if (*pSrcText == TEXT_CARRIAGE_RETURN)
1177 if (*(pSrcText + 1) == TEXT_LINE_FEED)
1179 *pDstText = (wchar_t)L' ';
1187 *pDstText = (wchar_t)L' ';
1196 *pDstText = *pSrcText;
1209 TextSimple::SetUserWrap(TextObjectWrapType userWrap)
1211 _userWrap = userWrap;
1215 TextSimple::GetCurrentBackgroundColor(void) const
1217 return _backgroundColor;
1221 TextSimple::GetCurrentOutlineColor(void) const
1223 return _outlineColor;
1227 TextSimple::GetWordLength(int textIndex, int& wordLength) const
1230 const wchar_t* pText = &_pText[textIndex];
1232 length = GetTextOffset() + _length - textIndex;
1238 if (*pText == (wchar_t)L' ')
1243 else if (*pText == TEXT_LINE_FEED || *pText == TEXT_CARRIAGE_RETURN
1244 || *pText == TEXT_PARAGRAPH_SEPARATOR)
1252 wchar_t mch = *pText;
1255 if (mch != *pText && (*pText == TEXT_LINE_FEED || *pText == TEXT_CARRIAGE_RETURN))
1270 while (length && (*pText != 0))
1272 if (*pText == (wchar_t)L' ')
1276 else if (*pText == TEXT_LINE_FEED || *pText == TEXT_CARRIAGE_RETURN
1277 || *pText == TEXT_PARAGRAPH_SEPARATOR)
1294 TextSimple::SetBitmap(const Bitmap& bitmap)
1296 result r = E_SUCCESS;
1298 Bitmap* pBitmap = new (std::nothrow) Bitmap();
1299 SysTryReturn(NID_GRP
1301 , E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1303 r = pBitmap->Construct(bitmap, Rectangle(0, 0, bitmap.GetWidth(), bitmap.GetHeight()));
1307 SysLog(NID_GRP, "[%s] Propagating.", GetErrorMessage(r));
1318 __pBitmap = pBitmap;
1324 TextSimple::GetBitmap(void) const
1330 TextSimple::GetBaseline(void) const
1332 Font* pCurrentFont = GetCurrentFont();
1333 SysTryReturn(NID_GRP
1335 , E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] This instance is not line wrapped yet.");
1337 _Font* pFont = _Font::GetInstance(*_FontImpl::GetInstance(*pCurrentFont));
1338 SysTryReturn(NID_GRP
1340 , E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get native font instance.");
1342 return (-1) * pFont->GetDescender();
1345 }}} // Tizen::Graphics::_Text