| 
									
										
										
										
											2018-04-21 21:24:46 +08:00
										 |  |  |  | #include "..\e2dnode.h"
 | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | e2d::Text::Text() | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	: _style() | 
					
						
							|  |  |  |  | 	, _textLayout(nullptr) | 
					
						
							|  |  |  |  | 	, _textFormat(nullptr) | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-07 15:48:06 +08:00
										 |  |  |  | e2d::Text::Text(const String& text) | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	: _style() | 
					
						
							|  |  |  |  | 	, _textLayout(nullptr) | 
					
						
							|  |  |  |  | 	, _textFormat(nullptr) | 
					
						
							|  |  |  |  | 	, _text(text) | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 	_reset(); | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | e2d::Text::Text(TextStyle textStyle) | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	: _style(textStyle) | 
					
						
							|  |  |  |  | 	, _textLayout(nullptr) | 
					
						
							|  |  |  |  | 	, _textFormat(nullptr) | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 	_reset(); | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-07 15:48:06 +08:00
										 |  |  |  | e2d::Text::Text(const String& text, TextStyle textStyle) | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	: _style(textStyle) | 
					
						
							|  |  |  |  | 	, _textLayout(nullptr) | 
					
						
							|  |  |  |  | 	, _textFormat(nullptr) | 
					
						
							|  |  |  |  | 	, _text(text) | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 	_reset(); | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | e2d::Text::Text( | 
					
						
							| 
									
										
										
										
											2018-05-07 15:48:06 +08:00
										 |  |  |  | 	const String& text,  | 
					
						
							|  |  |  |  | 	const String& fontFamily,  | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | 	double fontSize,  | 
					
						
							|  |  |  |  | 	UINT32 color,  | 
					
						
							|  |  |  |  | 	UINT32 fontWeight,  | 
					
						
							|  |  |  |  | 	bool italic,  | 
					
						
							| 
									
										
										
										
											2018-04-24 21:22:34 +08:00
										 |  |  |  | 	TextAlign alignment, | 
					
						
							|  |  |  |  | 	bool wrapping, | 
					
						
							|  |  |  |  | 	double wrappingWidth, | 
					
						
							|  |  |  |  | 	double lineSpacing, | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | 	bool hasUnderline,  | 
					
						
							|  |  |  |  | 	bool hasStrikethrough, | 
					
						
							| 
									
										
										
										
											2018-04-22 14:08:29 +08:00
										 |  |  |  | 	bool hasOutline, | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | 	UINT32 outlineColor, | 
					
						
							|  |  |  |  | 	UINT32 outlineWidth | 
					
						
							|  |  |  |  | ) | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	: _style( | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | 		fontFamily,  | 
					
						
							|  |  |  |  | 		fontSize,  | 
					
						
							|  |  |  |  | 		color,  | 
					
						
							|  |  |  |  | 		fontWeight,  | 
					
						
							|  |  |  |  | 		italic,  | 
					
						
							| 
									
										
										
										
											2018-04-24 21:22:34 +08:00
										 |  |  |  | 		alignment, | 
					
						
							|  |  |  |  | 		wrapping, | 
					
						
							|  |  |  |  | 		wrappingWidth, | 
					
						
							|  |  |  |  | 		lineSpacing, | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | 		hasUnderline,  | 
					
						
							|  |  |  |  | 		hasStrikethrough,  | 
					
						
							| 
									
										
										
										
											2018-04-22 14:08:29 +08:00
										 |  |  |  | 		hasOutline,  | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | 		outlineColor, | 
					
						
							|  |  |  |  | 		outlineWidth | 
					
						
							|  |  |  |  | 	) | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	, _textLayout(nullptr) | 
					
						
							|  |  |  |  | 	, _textFormat(nullptr) | 
					
						
							|  |  |  |  | 	, _text(text) | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 	_reset(); | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-17 12:22:52 +08:00
										 |  |  |  | e2d::Text * e2d::Text::create() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	return Create<Text>(); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | e2d::Text * e2d::Text::create(const String & text) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	return Create<Text>(text); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | e2d::Text * e2d::Text::create(TextStyle textStyle) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	return Create<Text>(textStyle); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | e2d::Text * e2d::Text::create(const String & text, TextStyle textStyle) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	return Create<Text>(text, textStyle); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | e2d::Text * e2d::Text::create(const String & text, const String & fontFamily, double fontSize, UINT32 color, UINT32 fontWeight, bool italic, TextAlign alignment, bool wrapping, double wrappingWidth, double lineSpacing, bool hasUnderline, bool hasStrikethrough, bool hasOutline, UINT32 outlineColor, UINT32 outlineWidth) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	return Create<Text>(text, fontFamily, fontSize, color, fontWeight, italic, alignment, wrapping, wrappingWidth, lineSpacing, hasUnderline, hasStrikethrough, hasOutline, outlineColor, outlineWidth); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | e2d::Text::~Text() | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-10 20:23:32 +08:00
										 |  |  |  | 	SafeReleaseInterface(_textFormat); | 
					
						
							|  |  |  |  | 	SafeReleaseInterface(_textLayout); | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | e2d::String e2d::Text::getText() const | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	return _text; | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | e2d::TextStyle e2d::Text::getTextStyle() const | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	return _style; | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | e2d::String e2d::Text::getFontFamily() const | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	return _style.fontFamily; | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | double e2d::Text::getFontSize() const | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	return _style.fontSize; | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | UINT32 e2d::Text::getFontWeight() const | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	return _style.fontWeight; | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-22 13:15:57 +08:00
										 |  |  |  | e2d::Color e2d::Text::getColor() const | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	return _style.color; | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-22 13:15:57 +08:00
										 |  |  |  | e2d::Color e2d::Text::getOutlineColor() const | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	return _style.outlineColor; | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | double e2d::Text::getOutlineWidth() const | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	return _style.outlineWidth; | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-24 21:22:34 +08:00
										 |  |  |  | e2d::LineJoin e2d::Text::getOutlineJoin() const | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	return _style.outlineJoin; | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-09 01:07:49 +08:00
										 |  |  |  | int e2d::Text::getLineCount() const | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	if (_textLayout) | 
					
						
							| 
									
										
										
										
											2018-04-09 18:41:56 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		DWRITE_TEXT_METRICS metrics; | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 		_textLayout->GetMetrics(&metrics); | 
					
						
							| 
									
										
										
										
											2018-04-09 18:41:56 +08:00
										 |  |  |  | 		return static_cast<int>(metrics.lineCount); | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 	else | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		return 0; | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-04-09 01:07:49 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | bool e2d::Text::isItalic() const | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	return _style.italic; | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-22 14:08:29 +08:00
										 |  |  |  | bool e2d::Text::hasStrikethrough() const | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	return _style.hasStrikethrough; | 
					
						
							| 
									
										
										
										
											2018-04-22 14:08:29 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | bool e2d::Text::hasUnderline() const | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	return _style.hasUnderline; | 
					
						
							| 
									
										
										
										
											2018-04-22 14:08:29 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | bool e2d::Text::hasOutline() const | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	return _style.hasOutline; | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-07 15:48:06 +08:00
										 |  |  |  | void e2d::Text::setText(const String& text) | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	_text = text; | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 	_reset(); | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-10 14:16:36 +08:00
										 |  |  |  | void e2d::Text::setStyle(const TextStyle& textStyle) | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	_style = textStyle; | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 	_reset(); | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-07 15:48:06 +08:00
										 |  |  |  | void e2d::Text::setFontFamily(const String& fontFamily) | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	_style.fontFamily = fontFamily; | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 	_reset(); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::Text::setFontSize(double fontSize) | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	_style.fontSize = fontSize; | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 	_reset(); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-22 13:15:57 +08:00
										 |  |  |  | void e2d::Text::setFontWeight(UINT32 fontWeight) | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	_style.fontWeight = fontWeight; | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 	_reset(); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-22 13:15:57 +08:00
										 |  |  |  | void e2d::Text::setColor(Color color) | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	_style.color = color; | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::Text::setItalic(bool value) | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	_style.italic = value; | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 	_reset(); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-24 21:22:34 +08:00
										 |  |  |  | void e2d::Text::setWrapping(bool wrapping) | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	if (_style.wrapping != wrapping) | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 		_style.wrapping = wrapping; | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 		_reset(); | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-10 14:16:36 +08:00
										 |  |  |  | void e2d::Text::setWrappingWidth(double wrappingWidth) | 
					
						
							| 
									
										
										
										
											2018-04-24 21:22:34 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-10 14:16:36 +08:00
										 |  |  |  | 	if (_style.wrappingWidth != wrappingWidth) | 
					
						
							| 
									
										
										
										
											2018-04-24 21:22:34 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-05-10 14:16:36 +08:00
										 |  |  |  | 		_style.wrappingWidth = max(wrappingWidth, 0); | 
					
						
							| 
									
										
										
										
											2018-04-24 21:22:34 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 		if (_style.wrapping) | 
					
						
							| 
									
										
										
										
											2018-04-24 21:22:34 +08:00
										 |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			_reset(); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-10 14:16:36 +08:00
										 |  |  |  | void e2d::Text::setLineSpacing(double lineSpacing) | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-10 14:16:36 +08:00
										 |  |  |  | 	if (_style.lineSpacing != lineSpacing) | 
					
						
							| 
									
										
										
										
											2018-03-30 01:41:29 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-05-10 14:16:36 +08:00
										 |  |  |  | 		_style.lineSpacing = lineSpacing; | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 		_reset(); | 
					
						
							| 
									
										
										
										
											2018-03-30 01:41:29 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-24 21:22:34 +08:00
										 |  |  |  | void e2d::Text::setAlignment(TextAlign align) | 
					
						
							| 
									
										
										
										
											2018-03-30 01:41:29 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	if (_style.alignment != align) | 
					
						
							| 
									
										
										
										
											2018-03-30 01:41:29 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 		_style.alignment = align; | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 		_reset(); | 
					
						
							| 
									
										
										
										
											2018-03-30 01:41:29 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::Text::setUnderline(bool hasUnderline) | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	if (_style.hasUnderline != hasUnderline) | 
					
						
							| 
									
										
										
										
											2018-03-30 01:41:29 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 		_style.hasUnderline = hasUnderline; | 
					
						
							|  |  |  |  | 		if (!_textFormat) | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 			_createFormat(); | 
					
						
							|  |  |  |  | 		_createLayout(); | 
					
						
							| 
									
										
										
										
											2018-03-30 01:41:29 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::Text::setStrikethrough(bool hasStrikethrough) | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	if (_style.hasStrikethrough != hasStrikethrough) | 
					
						
							| 
									
										
										
										
											2018-03-30 01:41:29 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 		_style.hasStrikethrough = hasStrikethrough; | 
					
						
							|  |  |  |  | 		if (!_textFormat) | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 			_createFormat(); | 
					
						
							|  |  |  |  | 		_createLayout(); | 
					
						
							| 
									
										
										
										
											2018-03-30 01:41:29 +08:00
										 |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-22 14:08:29 +08:00
										 |  |  |  | void e2d::Text::setOutline(bool hasOutline) | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	_style.hasOutline = hasOutline; | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-22 13:15:57 +08:00
										 |  |  |  | void e2d::Text::setOutlineColor(Color outlineColor) | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	_style.outlineColor = outlineColor; | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::Text::setOutlineWidth(double outlineWidth) | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	_style.outlineWidth = outlineWidth; | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-24 21:22:34 +08:00
										 |  |  |  | void e2d::Text::setOutlineJoin(LineJoin outlineJoin) | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	_style.outlineJoin = outlineJoin; | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | void e2d::Text::onRender() | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	if (_textLayout) | 
					
						
							| 
									
										
										
										
											2018-03-30 01:41:29 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | 		// <20><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 		D2D1_RECT_F textLayoutRect = D2D1::RectF(0, 0, _width, _height); | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | 		// <20><><EFBFBD>û<EFBFBD>ˢ<EFBFBD><CBA2>ɫ<EFBFBD><C9AB><EFBFBD><CDB8><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 		Renderer::getSolidColorBrush()->SetOpacity(_displayOpacity); | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | 		// <20><>ȡ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD>Ⱦ<EFBFBD><C8BE>
 | 
					
						
							|  |  |  |  | 		auto pTextRenderer = Renderer::getCustomTextRenderer(); | 
					
						
							|  |  |  |  | 		pTextRenderer->SetTextStyle( | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 			_style.color.toColorF(), | 
					
						
							|  |  |  |  | 			_style.hasOutline, | 
					
						
							|  |  |  |  | 			_style.outlineColor.toColorF(), | 
					
						
							|  |  |  |  | 			float(_style.outlineWidth), | 
					
						
							|  |  |  |  | 			D2D1_LINE_JOIN(_style.outlineJoin) | 
					
						
							| 
									
										
										
										
											2018-03-30 01:41:29 +08:00
										 |  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 		_textLayout->Draw(NULL, pTextRenderer, 0, 0); | 
					
						
							| 
									
										
										
										
											2018-03-30 01:41:29 +08:00
										 |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | void e2d::Text::_reset() | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD>ʽ<EFBFBD><CABD>
 | 
					
						
							|  |  |  |  | 	_createFormat(); | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֲ<EFBFBD><D6B2><EFBFBD>
 | 
					
						
							|  |  |  |  | 	_createLayout(); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::Text::_createFormat() | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-10 20:23:32 +08:00
										 |  |  |  | 	SafeReleaseInterface(_textFormat); | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	HRESULT hr = Renderer::getIDWriteFactory()->CreateTextFormat( | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 		_style.fontFamily, | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 		NULL, | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 		DWRITE_FONT_WEIGHT(_style.fontWeight), | 
					
						
							|  |  |  |  | 		_style.italic ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL, | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 		DWRITE_FONT_STRETCH_NORMAL, | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 		float(_style.fontSize), | 
					
						
							| 
									
										
										
										
											2018-04-17 11:41:33 +08:00
										 |  |  |  | 		L"", | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 		&_textFormat | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 	); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	ASSERT(SUCCEEDED(hr), "Create IDWriteTextFormat Failed!"); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	if (_textFormat) | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 		// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD><D6B6>뷽ʽ
 | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 		_textFormat->SetTextAlignment(DWRITE_TEXT_ALIGNMENT(_style.alignment)); | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 		// <20><><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 		if (_style.lineSpacing == 0.0) | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 			_textFormat->SetLineSpacing(DWRITE_LINE_SPACING_METHOD_DEFAULT, 0, 0); | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 		else | 
					
						
							|  |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 			_textFormat->SetLineSpacing( | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 				DWRITE_LINE_SPACING_METHOD_UNIFORM, | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 				float(_style.lineSpacing), | 
					
						
							|  |  |  |  | 				float(_style.lineSpacing) * 0.8f | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 			); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 		// <20><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 		if (_style.wrapping) | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 			_textFormat->SetWordWrapping(DWRITE_WORD_WRAPPING_WRAP); | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 		else | 
					
						
							|  |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 			_textFormat->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP); | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | } | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | void e2d::Text::_createLayout() | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-10 20:23:32 +08:00
										 |  |  |  | 	SafeReleaseInterface(_textLayout); | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// <20>ı<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	if (_text.isEmpty()) | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 		this->setSize(0, 0); | 
					
						
							|  |  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	if (_textFormat == nullptr) | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 		WARN_IF(true, "Text::_createLayout failed! _textFormat NULL pointer exception."); | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	UINT32 length = UINT32(_text.getLength()); | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 	// <20><><EFBFBD><EFBFBD> TextLayout
 | 
					
						
							|  |  |  |  | 	HRESULT hr; | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD>ı<EFBFBD><C4B1>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD><C2BD>д<EFBFBD><D0B4><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	if (_style.wrapping) | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		hr = Renderer::getIDWriteFactory()->CreateTextLayout( | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 			_text, | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 			length, | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 			_textFormat, | 
					
						
							|  |  |  |  | 			float(_style.wrappingWidth), | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 			0, | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 			&_textLayout | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 		if (_textLayout) | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			// <20><>ȡ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD>ֵĿ<D6B5><C4BF>Ⱥ߶<CDB8>
 | 
					
						
							|  |  |  |  | 			DWRITE_TEXT_METRICS metrics; | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 			_textLayout->GetMetrics(&metrics); | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 			// <20><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 			this->setSize(metrics.layoutWidth, metrics.height); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 	else | 
					
						
							|  |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 		hr = Renderer::getIDWriteFactory()->CreateTextLayout(_text, length, _textFormat, 0, 0, &_textLayout); | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 		// Ϊ<><CEAA>ֹ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⣬<EFBFBD><E2A3AC><EFBFBD>ݸղŴ<D5B2><C5B4><EFBFBD><EFBFBD><EFBFBD> layout <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>´<EFBFBD><C2B4><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 		if (_textLayout) | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			// <20><>ȡ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD>ֵĿ<D6B5><C4BF>Ⱥ߶<CDB8>
 | 
					
						
							|  |  |  |  | 			DWRITE_TEXT_METRICS metrics; | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 			_textLayout->GetMetrics(&metrics); | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 			// <20><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 			this->setSize(metrics.width, metrics.height); | 
					
						
							|  |  |  |  | 			// <20><><EFBFBD>´<EFBFBD><C2B4><EFBFBD> layout
 | 
					
						
							| 
									
										
										
										
											2018-05-10 20:23:32 +08:00
										 |  |  |  | 			SafeReleaseInterface(_textLayout); | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 			hr = Renderer::getIDWriteFactory()->CreateTextLayout(_text, length, _textFormat, _width, 0, &_textLayout); | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	ASSERT(SUCCEEDED(hr), "Create IDWriteTextFormat Failed!"); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-30 01:41:29 +08:00
										 |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD>»<EFBFBD><C2BB>ߺ<EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2018-04-01 13:28:32 +08:00
										 |  |  |  | 	DWRITE_TEXT_RANGE range = { 0, length }; | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	if (_style.hasUnderline) | 
					
						
							| 
									
										
										
										
											2018-03-30 01:41:29 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 		_textLayout->SetUnderline(true, range); | 
					
						
							| 
									
										
										
										
											2018-03-30 01:41:29 +08:00
										 |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	if (_style.hasStrikethrough) | 
					
						
							| 
									
										
										
										
											2018-03-30 01:41:29 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 		_textLayout->SetStrikethrough(true, range); | 
					
						
							| 
									
										
										
										
											2018-03-30 01:41:29 +08:00
										 |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | } |