| 
									
										
										
										
											2018-04-21 21:24:46 +08:00
										 |  |  |  | #include "..\e2dnode.h"
 | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-17 15:22:14 +08:00
										 |  |  |  | //-------------------------------------------------------
 | 
					
						
							|  |  |  |  | // Style
 | 
					
						
							|  |  |  |  | //-------------------------------------------------------
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | e2d::Text::Style::Style() | 
					
						
							| 
									
										
										
										
											2018-05-24 20:37:34 +08:00
										 |  |  |  | 	: color(Color::White) | 
					
						
							|  |  |  |  | 	, alignment(Align::Left) | 
					
						
							| 
									
										
										
										
											2018-05-17 15:22:14 +08:00
										 |  |  |  | 	, wrapping(false) | 
					
						
							| 
									
										
										
										
											2018-07-28 20:06:27 +08:00
										 |  |  |  | 	, wrappingWidth(0.f) | 
					
						
							|  |  |  |  | 	, lineSpacing(0.f) | 
					
						
							| 
									
										
										
										
											2018-05-17 15:22:14 +08:00
										 |  |  |  | 	, hasUnderline(false) | 
					
						
							|  |  |  |  | 	, hasStrikethrough(false) | 
					
						
							|  |  |  |  | 	, hasOutline(true) | 
					
						
							| 
									
										
										
										
											2018-05-24 20:37:34 +08:00
										 |  |  |  | 	, outlineColor(Color(Color::Black, 0.5)) | 
					
						
							| 
									
										
										
										
											2018-07-28 20:06:27 +08:00
										 |  |  |  | 	, outlineWidth(1.f) | 
					
						
							| 
									
										
										
										
											2018-08-23 00:03:26 +08:00
										 |  |  |  | 	, outlineStroke(Stroke::Round) | 
					
						
							| 
									
										
										
										
											2018-05-17 15:22:14 +08:00
										 |  |  |  | {} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | e2d::Text::Style::Style( | 
					
						
							|  |  |  |  | 	Color color, | 
					
						
							|  |  |  |  | 	Align alignment, | 
					
						
							| 
									
										
										
										
											2018-04-24 21:22:34 +08:00
										 |  |  |  | 	bool wrapping, | 
					
						
							| 
									
										
										
										
											2018-07-28 20:06:27 +08:00
										 |  |  |  | 	float wrappingWidth, | 
					
						
							|  |  |  |  | 	float lineSpacing, | 
					
						
							| 
									
										
										
										
											2018-05-17 15:22:14 +08:00
										 |  |  |  | 	bool hasUnderline, | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | 	bool hasStrikethrough, | 
					
						
							| 
									
										
										
										
											2018-04-22 14:08:29 +08:00
										 |  |  |  | 	bool hasOutline, | 
					
						
							| 
									
										
										
										
											2018-05-17 15:22:14 +08:00
										 |  |  |  | 	Color outlineColor, | 
					
						
							| 
									
										
										
										
											2018-07-28 20:06:27 +08:00
										 |  |  |  | 	float outlineWidth, | 
					
						
							| 
									
										
										
										
											2018-08-23 00:03:26 +08:00
										 |  |  |  | 	Stroke outlineStroke | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | ) | 
					
						
							| 
									
										
										
										
											2018-05-17 15:22:14 +08:00
										 |  |  |  | 	: color(color) | 
					
						
							|  |  |  |  | 	, alignment(alignment) | 
					
						
							|  |  |  |  | 	, wrapping(wrapping) | 
					
						
							|  |  |  |  | 	, wrappingWidth(wrappingWidth) | 
					
						
							|  |  |  |  | 	, lineSpacing(lineSpacing) | 
					
						
							|  |  |  |  | 	, hasUnderline(hasUnderline) | 
					
						
							|  |  |  |  | 	, hasStrikethrough(hasStrikethrough) | 
					
						
							|  |  |  |  | 	, hasOutline(hasOutline) | 
					
						
							|  |  |  |  | 	, outlineColor(outlineColor) | 
					
						
							|  |  |  |  | 	, outlineWidth(outlineWidth) | 
					
						
							| 
									
										
										
										
											2018-08-23 00:03:26 +08:00
										 |  |  |  | 	, outlineStroke(outlineStroke) | 
					
						
							| 
									
										
										
										
											2018-05-17 15:22:14 +08:00
										 |  |  |  | {} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | //-------------------------------------------------------
 | 
					
						
							|  |  |  |  | // Text
 | 
					
						
							|  |  |  |  | //-------------------------------------------------------
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | e2d::Text::Text() | 
					
						
							|  |  |  |  | 	: _font() | 
					
						
							|  |  |  |  | 	, _style() | 
					
						
							|  |  |  |  | 	, _textLayout(nullptr) | 
					
						
							|  |  |  |  | 	, _textFormat(nullptr) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | e2d::Text::Text(const String & text, const Font & font, const Style & style) | 
					
						
							|  |  |  |  | 	: _font(font) | 
					
						
							|  |  |  |  | 	, _style(style) | 
					
						
							| 
									
										
										
										
											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-02-07 16:37:12 +08:00
										 |  |  |  | e2d::Text::~Text() | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-22 12:24:43 +08:00
										 |  |  |  | 	SafeRelease(_textFormat); | 
					
						
							|  |  |  |  | 	SafeRelease(_textLayout); | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 16:58:32 +08:00
										 |  |  |  | const 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-08-23 16:58:32 +08:00
										 |  |  |  | const e2d::Font& e2d::Text::getFont() const | 
					
						
							| 
									
										
										
										
											2018-05-17 15:22:14 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	return _font; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 16:58:32 +08:00
										 |  |  |  | const e2d::Text::Style& e2d::Text::getStyle() 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
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 16:58:32 +08:00
										 |  |  |  | const e2d::String& e2d::Text::getFontFamily() const | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-17 15:22:14 +08:00
										 |  |  |  | 	return _font.family; | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 16:37:51 +08:00
										 |  |  |  | float e2d::Text::getFontSize() const | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-17 15:22:14 +08:00
										 |  |  |  | 	return _font.size; | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 16:37:51 +08:00
										 |  |  |  | UINT e2d::Text::getFontWeight() const | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-17 15:22:14 +08:00
										 |  |  |  | 	return _font.weight; | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 16:58:32 +08:00
										 |  |  |  | const 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-08-23 16:58:32 +08:00
										 |  |  |  | const 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
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 16:37:51 +08:00
										 |  |  |  | float e2d::Text::getOutlineWidth() const | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	return _style.outlineWidth; | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 16:37:51 +08:00
										 |  |  |  | e2d::Stroke e2d::Text::getOutlineStroke() const | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-08-23 00:03:26 +08:00
										 |  |  |  | 	return _style.outlineStroke; | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 16:37:51 +08:00
										 |  |  |  | int e2d::Text::getLineCount() const | 
					
						
							| 
									
										
										
										
											2018-04-09 01:07:49 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											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-08-23 16:37:51 +08:00
										 |  |  |  | bool e2d::Text::isItalic() const | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-17 15:22:14 +08:00
										 |  |  |  | 	return _font.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-08-23 16:37:51 +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-08-23 16:37:51 +08:00
										 |  |  |  | void e2d::Text::setStyle(const Style& style) | 
					
						
							| 
									
										
										
										
											2018-05-17 15:22:14 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	_style = style; | 
					
						
							|  |  |  |  | 	_reset(); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 16:37:51 +08:00
										 |  |  |  | void e2d::Text::setFont(const Font & font) | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-17 15:22:14 +08:00
										 |  |  |  | 	_font = font; | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 	_reset(); | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 16:37:51 +08:00
										 |  |  |  | void e2d::Text::setFontFamily(const String& family) | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-17 15:22:14 +08:00
										 |  |  |  | 	_font.family = family; | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 	_reset(); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 16:37:51 +08:00
										 |  |  |  | void e2d::Text::setFontSize(float size) | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-17 15:22:14 +08:00
										 |  |  |  | 	_font.size = size; | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 	_reset(); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 16:37:51 +08:00
										 |  |  |  | void e2d::Text::setFontWeight(UINT weight) | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-17 15:22:14 +08:00
										 |  |  |  | 	_font.weight = weight; | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 	_reset(); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 16:37:51 +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
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 16:37:51 +08:00
										 |  |  |  | void e2d::Text::setItalic(bool value) | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-17 15:22:14 +08:00
										 |  |  |  | 	_font.italic = value; | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 	_reset(); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 16:37:51 +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-08-23 16:37:51 +08:00
										 |  |  |  | void e2d::Text::setWrappingWidth(float 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-07-28 20:06:27 +08:00
										 |  |  |  | 		_style.wrappingWidth = std::max(wrappingWidth, 0.f); | 
					
						
							| 
									
										
										
										
											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-08-23 16:37:51 +08:00
										 |  |  |  | void e2d::Text::setLineSpacing(float 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-08-23 16:37:51 +08:00
										 |  |  |  | void e2d::Text::setAlignment(Align 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
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 16:37:51 +08:00
										 |  |  |  | void e2d::Text::setUnderline(bool hasUnderline) | 
					
						
							| 
									
										
										
										
											2018-03-30 01:41:29 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											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
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 16:37:51 +08:00
										 |  |  |  | void e2d::Text::setStrikethrough(bool hasStrikethrough) | 
					
						
							| 
									
										
										
										
											2018-03-30 01:41:29 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											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-08-23 16:37:51 +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-08-23 16:37:51 +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
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 16:37:51 +08:00
										 |  |  |  | void e2d::Text::setOutlineWidth(float outlineWidth) | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 	_style.outlineWidth = outlineWidth; | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 16:37:51 +08:00
										 |  |  |  | void e2d::Text::setOutlineStroke(Stroke outlineStroke) | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-08-23 00:03:26 +08:00
										 |  |  |  | 	_style.outlineStroke = outlineStroke; | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-28 00:06:10 +08:00
										 |  |  |  | void e2d::Text::draw() const | 
					
						
							| 
									
										
										
										
											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-08-28 00:06:10 +08:00
										 |  |  |  | 		auto renderer = Renderer::getInstance(); | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | 		// <20><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2018-08-23 16:37:51 +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-08-23 16:37:51 +08:00
										 |  |  |  | 		renderer->getSolidColorBrush()->SetOpacity(_displayOpacity); | 
					
						
							| 
									
										
										
										
											2018-04-22 00:33:20 +08:00
										 |  |  |  | 		// <20><>ȡ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD>Ⱦ<EFBFBD><C8BE>
 | 
					
						
							| 
									
										
										
										
											2018-08-28 00:06:10 +08:00
										 |  |  |  | 		auto textRenderer = renderer->getTextRenderer(); | 
					
						
							|  |  |  |  | 		textRenderer->SetTextStyle( | 
					
						
							| 
									
										
										
										
											2018-07-29 02:24:34 +08:00
										 |  |  |  | 			(D2D1_COLOR_F)_style.color, | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  |  | 			_style.hasOutline, | 
					
						
							| 
									
										
										
										
											2018-07-29 02:24:34 +08:00
										 |  |  |  | 			(D2D1_COLOR_F)_style.outlineColor, | 
					
						
							| 
									
										
										
										
											2018-07-28 20:06:27 +08:00
										 |  |  |  | 			_style.outlineWidth, | 
					
						
							| 
									
										
										
										
											2018-08-23 00:03:26 +08:00
										 |  |  |  | 			D2D1_LINE_JOIN(_style.outlineStroke) | 
					
						
							| 
									
										
										
										
											2018-03-30 01:41:29 +08:00
										 |  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2018-08-28 00:06:10 +08:00
										 |  |  |  | 		_textLayout->Draw(nullptr, textRenderer, 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-22 12:24:43 +08:00
										 |  |  |  | 	SafeRelease(_textFormat); | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-28 00:06:10 +08:00
										 |  |  |  | 	ThrowIfFailed( | 
					
						
							|  |  |  |  | 		Renderer::getWriteFactory()->CreateTextFormat( | 
					
						
							|  |  |  |  | 			(const WCHAR *)_font.family, | 
					
						
							|  |  |  |  | 			nullptr, | 
					
						
							|  |  |  |  | 			DWRITE_FONT_WEIGHT(_font.weight), | 
					
						
							|  |  |  |  | 			_font.italic ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL, | 
					
						
							|  |  |  |  | 			DWRITE_FONT_STRETCH_NORMAL, | 
					
						
							|  |  |  |  | 			_font.size, | 
					
						
							|  |  |  |  | 			L"", | 
					
						
							|  |  |  |  | 			&_textFormat | 
					
						
							|  |  |  |  | 		) | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 	); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-28 00:06:10 +08:00
										 |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD><D6B6>뷽ʽ
 | 
					
						
							|  |  |  |  | 	_textFormat->SetTextAlignment(DWRITE_TEXT_ALIGNMENT(_style.alignment)); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC><EFBFBD>
 | 
					
						
							|  |  |  |  | 	if (_style.lineSpacing == 0.f) | 
					
						
							| 
									
										
										
										
											2018-05-24 12:24:39 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-08-28 00:06:10 +08:00
										 |  |  |  | 		_textFormat->SetLineSpacing(DWRITE_LINE_SPACING_METHOD_DEFAULT, 0, 0); | 
					
						
							| 
									
										
										
										
											2018-05-24 12:24:39 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 	else | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-08-28 00:06:10 +08:00
										 |  |  |  | 		_textFormat->SetLineSpacing( | 
					
						
							|  |  |  |  | 			DWRITE_LINE_SPACING_METHOD_UNIFORM, | 
					
						
							|  |  |  |  | 			_style.lineSpacing, | 
					
						
							|  |  |  |  | 			_style.lineSpacing * 0.8f | 
					
						
							|  |  |  |  | 		); | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 	if (_style.wrapping) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		_textFormat->SetWordWrapping(DWRITE_WORD_WRAPPING_WRAP); | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 	else | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		_textFormat->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP); | 
					
						
							| 
									
										
										
										
											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-22 12:24:43 +08:00
										 |  |  |  | 	SafeRelease(_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-08-23 16:37:51 +08:00
										 |  |  |  | 	if (_text.isEmpty()) | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-08-23 16:37:51 +08:00
										 |  |  |  | 		this->setSize(0, 0); | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 		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-24 12:24:39 +08:00
										 |  |  |  | 		WARN("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-08-19 15:11:20 +08:00
										 |  |  |  | 	UINT32 length = (UINT32)_text.length(); | 
					
						
							| 
									
										
										
										
											2018-08-28 00:06:10 +08:00
										 |  |  |  | 	auto writeFactory = Renderer::getWriteFactory(); | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 	// <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
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-08-28 00:06:10 +08:00
										 |  |  |  | 		ThrowIfFailed( | 
					
						
							|  |  |  |  | 			writeFactory->CreateTextLayout( | 
					
						
							|  |  |  |  | 				(const WCHAR *)_text, | 
					
						
							|  |  |  |  | 				length, | 
					
						
							|  |  |  |  | 				_textFormat, | 
					
						
							|  |  |  |  | 				_style.wrappingWidth, | 
					
						
							|  |  |  |  | 				0, | 
					
						
							|  |  |  |  | 				&_textLayout | 
					
						
							|  |  |  |  | 			) | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2018-08-28 00:06:10 +08:00
										 |  |  |  | 		// <20><>ȡ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD>ֵĿ<D6B5><C4BF>Ⱥ߶<CDB8>
 | 
					
						
							|  |  |  |  | 		DWRITE_TEXT_METRICS metrics; | 
					
						
							|  |  |  |  | 		_textLayout->GetMetrics(&metrics); | 
					
						
							|  |  |  |  | 		// <20><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		this->setSize(metrics.layoutWidth, metrics.height); | 
					
						
							| 
									
										
										
										
											2018-03-30 23:37:42 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 	else | 
					
						
							|  |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-08-28 00:06:10 +08:00
										 |  |  |  | 		// Ϊ<><CEAA>ֹ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⣬<EFBFBD><E2A3AC><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD> layout <20>Ի<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		ThrowIfFailed( | 
					
						
							|  |  |  |  | 			writeFactory->CreateTextLayout( | 
					
						
							|  |  |  |  | 				(const WCHAR *)_text, | 
					
						
							|  |  |  |  | 				length, | 
					
						
							|  |  |  |  | 				_textFormat, | 
					
						
							|  |  |  |  | 				0, | 
					
						
							|  |  |  |  | 				0, | 
					
						
							|  |  |  |  | 				&_textLayout | 
					
						
							|  |  |  |  | 			) | 
					
						
							|  |  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-28 00:06:10 +08:00
										 |  |  |  | 		// <20><>ȡ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD>ֵĿ<D6B5><C4BF>Ⱥ߶<CDB8>
 | 
					
						
							|  |  |  |  | 		DWRITE_TEXT_METRICS metrics; | 
					
						
							|  |  |  |  | 		_textLayout->GetMetrics(&metrics); | 
					
						
							|  |  |  |  | 		// <20><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		this->setSize(metrics.width, metrics.height); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// <20><><EFBFBD>´<EFBFBD><C2B4><EFBFBD> layout
 | 
					
						
							|  |  |  |  | 		SafeRelease(_textLayout); | 
					
						
							|  |  |  |  | 		ThrowIfFailed( | 
					
						
							|  |  |  |  | 			writeFactory->CreateTextLayout( | 
					
						
							|  |  |  |  | 				(const WCHAR *)_text, | 
					
						
							|  |  |  |  | 				length, | 
					
						
							|  |  |  |  | 				_textFormat, | 
					
						
							|  |  |  |  | 				_width, | 
					
						
							|  |  |  |  | 				0, | 
					
						
							|  |  |  |  | 				&_textLayout | 
					
						
							|  |  |  |  | 			) | 
					
						
							|  |  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2018-05-24 12:24:39 +08:00
										 |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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
										 |  |  |  | } |