17 #if !defined(OPENNURBS_TEXTITERATOR_INC_) 18 #define OPENNURBS_TEXTITERATOR_INC_ 31 int m_rtf_font_index = -1;
33 unsigned int m_codepage = 1252;
34 unsigned int m_charset = 0;
60 bool PeekCodePoint(ON__UINT32& unicode_code_point)
const;
73 bool ReadCodePoint(ON__UINT32& unicode_code_point);
83 bool AtBackslashTic()
const;
89 const wchar_t* m_text =
nullptr;
91 size_t m_prev_text_ci = 0;
92 size_t m_next_text_ci = 0;
93 size_t m_cur_text_ci = 0;
94 ON__UINT32 m_prev_codepoint = 0;
95 ON__UINT32 m_cur_codepoint = 0;
120 unsigned int charset)
122 , m_stackscale(stackscale)
124 , m_stackformat(stackformat)
127 , m_underlined(underlined)
128 , m_strikethrough(strikethrough)
131 double Height()
const 135 void SetHeight(
double h)
140 double StackScale()
const 144 void SetStackScale(
double s)
146 if (0.0 < s && 10.0 > s)
159 return m_stackformat;
169 void SetBold(
bool bold)
177 void SetItalic(
bool italic)
185 void SetUnderlined(
bool underlined)
187 m_underlined = underlined;
189 bool IsStrikethrough()
191 return m_strikethrough;
193 void SetStrikethrough(
bool strikethrough)
195 m_strikethrough = strikethrough;
197 unsigned int CodePage()
201 void SetCodePage(
unsigned int codepage)
203 m_codepage = codepage;
206 unsigned int CharSet()
210 void SetCharSet(
unsigned int charset,
bool setcodepage)
215 m_codepage = ON_MapRTFcharsetToWindowsCodePage(charset, 1252);
220 double m_height = 1.0;
221 double m_stackscale = 0.7;
225 bool m_italic =
false;
226 bool m_underlined =
false;
227 bool m_strikethrough =
false;
228 unsigned int m_codepage = 1252;
229 unsigned int m_charset = 0;
243 m_UFT16_waiting_mark = 0xEEEE,
244 m_UFT16_unused_mark = 0xFFFF
246 ON__INT32 m_current_UTF16_buffer_count = 0;
247 ON__UINT16 m_current_UTF16_buffer[2];
251 ON__INT32 m_level = 0;
252 ON__INT32 m_font_table_level = -1;
253 ON__INT32 m_font_index = 0;
254 ON__INT32 m_default_font_index = 0;
259 virtual void InitBuilder(
const ON_Font* default_font);
260 virtual void FlushText(
size_t count, ON__UINT32* cp_array);
261 virtual void GroupBegin();
262 virtual void GroupEnd();
264 virtual void BeginHeader();
265 virtual void BeginFontTable();
266 virtual void DefaultFont(
const wchar_t* value);
267 virtual void FontTag(
const wchar_t* value);
268 virtual void FontSize(
const wchar_t* value);
269 virtual void CharSet(
const wchar_t* value);
270 virtual void CodePage(
const wchar_t* value);
272 virtual void Newline();
273 virtual void Paragraph();
274 virtual void ParagraphDefaults();
275 virtual void Section();
278 virtual void Bold(
const wchar_t* value);
279 virtual void Italic(
const wchar_t* value);
280 virtual void UnderlineOn();
281 virtual void UnderlineOff();
282 virtual void Strikethrough(
const wchar_t* value);
284 virtual void Superscript();
285 virtual void Subscript();
286 virtual void NoSuperSub();
288 virtual void BeginColorTable();
289 virtual void ColorRed(
const wchar_t* value);
290 virtual void ColorGreen(
const wchar_t* value);
291 virtual void ColorBlue(
const wchar_t* value);
292 virtual void ColorForeground(
const wchar_t* value);
293 virtual void ColorBackground(
const wchar_t* value);
295 virtual void SetStackScale(
const wchar_t* value);
296 virtual void StackFraction(
const wchar_t* value);
297 virtual void StackEnd();
299 virtual void TextField(
const wchar_t* name);
301 virtual void UniEmbeddedDest(
const wchar_t* value);
302 virtual void UniDest(
const wchar_t* value);
304 virtual void UniCpCount(
const wchar_t* value);
305 virtual void UniDecimal(
const wchar_t* value);
307 virtual void LQuote();
308 virtual void RQuote();
309 virtual void LDblQuote();
310 virtual void RDblQuote();
311 virtual void Bullet();
312 virtual void EnDash();
313 virtual void EmDash();
315 virtual bool AppendCodePoint(ON__UINT32 codept);
317 ON__UINT32* RunCodePoints(
const ON_TextRun& run);
320 unsigned int CodePageFromMap(
int nval);
321 unsigned int CharSetFromMap(
int nval);
348 void FinishCurrentRun();
349 void AppendCurrentRun();
351 void InitBuilder(
const ON_Font* default_font)
override;
352 void FlushText(
size_t count, ON__UINT32* cp_array)
override;
353 void GroupBegin()
override;
354 void GroupEnd()
override;
356 void BeginHeader()
override;
357 void BeginFontTable()
override;
358 void DefaultFont(
const wchar_t* value)
override;
359 void FontTag(
const wchar_t* value)
override;
360 void FontSize(
const wchar_t* value)
override;
362 void Newline()
override;
363 void Paragraph()
override;
364 void ParagraphDefaults()
override;
365 void Section()
override;
368 void Bold(
const wchar_t* value)
override;
369 void Italic(
const wchar_t* value)
override;
370 void UnderlineOn()
override;
371 void UnderlineOff()
override;
372 void Strikethrough(
const wchar_t* value)
override;
374 void Superscript()
override;
375 void Subscript()
override;
376 void NoSuperSub()
override;
378 void BeginColorTable()
override;
379 void ColorRed(
const wchar_t* value)
override;
380 void ColorGreen(
const wchar_t* value)
override;
381 void ColorBlue(
const wchar_t* value)
override;
382 void ColorForeground(
const wchar_t* value)
override;
383 void ColorBackground(
const wchar_t* value)
override;
385 void SetStackScale(
const wchar_t* value)
override;
386 void StackFraction(
const wchar_t* value)
override;
387 void StackEnd()
override;
389 void TextField(
const wchar_t* name)
override;
391 void UniEmbeddedDest(
const wchar_t* value)
override;
392 void UniDest(
const wchar_t* value)
override;
428 m_underlined =
false;
429 m_strikethrough =
false;
435 void SetFontIndex(
int index)
438 m_font_index = index;
445 bool IsItalic()
const 449 bool IsUnderlined()
const 453 bool IsStrikeThrough()
const 455 return m_strikethrough;
461 void SetItalic(
bool b)
465 void SetUnderlined(
bool b)
469 void SetStrikeThrough(
bool b)
474 void AddControl(
const wchar_t* str)
477 size_t i = wcslen(str);
478 if(str[i-1] == L
' ' || str[i-1] == L
'{' || str[i-1] == L
'}')
481 m_terminated =
false;
482 m_has_content =
true;
485 void AddText(
const wchar_t* str)
491 m_has_content =
true;
494 void AddChar(
const wchar_t ch)
500 m_has_content =
true;
503 void SetTerminated(
bool terminated)
505 m_terminated = terminated;
524 bool m_has_content =
false;
525 bool m_terminated =
true;
528 bool m_italic =
false;
529 bool m_underlined =
false;
530 bool m_strikethrough =
false;
531 int m_font_index = -1;
537 bool m_in_font_table =
false;
538 bool m_in_color_table =
false;
540 bool m_skip_color_tbl =
false;
541 bool m_skip_bold =
false;
542 bool m_skip_italic =
false;
543 bool m_skip_underline =
false;
544 bool m_skip_facename =
false;
546 bool m_make_bold =
false;
547 bool m_make_italic =
false;
548 bool m_make_underline =
false;
549 bool m_make_facename =
false;
554 bool m_have_rtf =
false;
561 void InitStringBuilder(
const ON_DimStyle* default_style);
567 void SetInFontTable(
bool b);
569 void SetInColorTable(
bool b);
571 void SetSkipColorTbl(
bool b);
572 void SetSkipBold(
bool b);
573 void SetSkipItalic(
bool b);
574 void SetSkipUnderline(
bool b);
575 void SetSkipFacename(
bool b);
580 bool SkipUnderline();
583 void SetMakeBold(
bool b);
584 void SetMakeItalic(
bool b);
585 void SetMakeUnderline(
bool b);
586 void SetMakeFacename(
bool b);
590 bool MakeUnderline();
593 bool SkippingFacename();
594 bool SettingFacename();
596 void SetDefaultFacename(
const wchar_t* facename);
597 void SetOverrideFacename(
const wchar_t* facename);
601 void GroupBegin()
override;
602 void GroupEnd()
override;
604 void BeginHeader()
override;
605 void BeginFontTable()
override;
606 void DefaultFont(
const wchar_t* value)
override;
607 void FontTag(
const wchar_t* value)
override;
608 void FontSize(
const wchar_t* value)
override;
610 void Newline()
override;
611 void Paragraph()
override;
612 void ParagraphDefaults()
override;
613 void Section()
override;
616 void Bold(
const wchar_t* value)
override;
617 void Italic(
const wchar_t* value)
override;
618 void UnderlineOn()
override;
619 void UnderlineOff()
override;
620 void Strikethrough(
const wchar_t* value)
override;
622 void Superscript()
override;
623 void Subscript()
override;
624 void NoSuperSub()
override;
626 void BeginColorTable()
override;
627 void ColorRed(
const wchar_t* value)
override;
628 void ColorGreen(
const wchar_t* value)
override;
629 void ColorBlue(
const wchar_t* value)
override;
630 void ColorForeground(
const wchar_t* value)
override;
631 void ColorBackground(
const wchar_t* value)
override;
633 void TextField(
const wchar_t* name)
override;
635 bool AppendCodePoint(ON__UINT32 codept)
override;
637 void UniEmbeddedDest(
const wchar_t* value)
override;
638 void UniDecimal(
const wchar_t* value)
override;
639 void UniDest(
const wchar_t* value)
override;
677 m_underlined =
false;
678 m_strikethrough =
false;
684 void SetFontIndex(
int index)
687 m_font_index = index;
694 bool IsItalic()
const 698 bool IsUnderlined()
const 702 bool IsStrikeThrough()
const 704 return m_strikethrough;
710 void SetItalic(
bool b)
714 void SetUnderlined(
bool b)
718 void SetStrikeThrough(
bool b)
723 void AddText(
const wchar_t* str)
729 m_has_content =
true;
738 bool m_has_content =
false;
739 bool m_terminated =
true;
742 bool m_italic =
false;
743 bool m_underlined =
false;
744 bool m_strikethrough =
false;
745 int m_font_index = -1;
750 bool m_in_font_table =
false;
751 bool m_in_color_table =
false;
753 bool m_have_rtf =
false;
760 void InitStringBuilder(
const ON_DimStyle* default_style);
766 void SetInFontTable(
bool b);
768 void SetInColorTable(
bool b);
772 void GroupBegin()
override;
773 void GroupEnd()
override;
775 void BeginHeader()
override;
776 void BeginFontTable()
override;
777 void BeginColorTable()
override;
778 void TextField(
const wchar_t* name)
override;
779 bool AppendCodePoint(ON__UINT32 codept)
override;
781 void FontTag(
const wchar_t* value)
override;
783 void Bold(
const wchar_t* value)
override;
784 void Italic(
const wchar_t* value)
override;
785 void UnderlineOn()
override;
786 void UnderlineOff()
override;
787 void Strikethrough(
const wchar_t* value)
override;
802 ON__UINT32 Internal_ParseMBCSString(
803 const ON__UINT32 windows_code_page
813 bool ReadTag(
bool optional);
814 bool ProcessTag(
const wchar_t* name,
const wchar_t* value,
bool optional);
829 bool m_italic =
false;
830 bool m_underline =
false;
831 bool m_strikeout =
false;
833 int m_facename_key = -1;
837 static bool ComposeA(
847 static void ComposeRunA(
859 static void ComposeRun(
873 static bool RecomposeRTF();
874 static void SetRecomposeRTF(
bool b);
877 static bool m_bComposeRTF;
880 static unsigned int GetFacenameKey(
const wchar_t* facename,
ON_SimpleArray<
wchar_t[34] >& fonttable);
882 static bool FormatTextHeight(
double height,
ON_wString& str);
Definition: opennurbs_textiterator.h:816
Definition: opennurbs_unicode.h:344
Definition: opennurbs_textiterator.h:22
A range of text with all the same attributes.
Definition: opennurbs_textrun.h:66
Definition: opennurbs_textiterator.h:654
Converts wchar_t characters to Unicode codepoints.
Definition: opennurbs_textiterator.h:38
ON_wString m_facename
Definition: opennurbs_textiterator.h:32
stack_format
Format of stacked fractions
Definition: opennurbs_dimensionstyle.h:977
Definition: opennurbs_textiterator.h:644
Definition: opennurbs_textrun.h:363
Definition: opennurbs_textiterator.h:28
Definition: opennurbs_textiterator.h:819
Definition: opennurbs_textiterator.h:792
Definition: opennurbs_string.h:2020
Definition: opennurbs_dimensionstyle.h:218
Definition: opennurbs_color.h:24
Definition: opennurbs_text.h:28
Definition: opennurbs_textiterator.h:103
An ON_Font is a face in a font family. It corresponds to a Windows LOGFONT, a .NET System...
Definition: opennurbs_font.h:225
RunType
Definition: opennurbs_textrun.h:122
Definition: opennurbs_textiterator.h:96
Definition: opennurbs_textiterator.h:405
Stack with horizontal line
const ON_Font * managed_font
Definition: opennurbs_textiterator.h:25
int rtf_font_index
Definition: opennurbs_textiterator.h:24
Definition: opennurbs_array.h:409
static const ON_wString EmptyString
Definition: opennurbs_string.h:2026
static const ON_Font Default
Definition: opennurbs_font.h:502
Definition: opennurbs_textiterator.h:395
Definition: opennurbs_textiterator.h:326
static const ON_Color Black
Definition: opennurbs_color.h:33