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)
146 if (0.0 < s && 10.0 > s)
159 return m_stackformat;
187 m_underlined = underlined;
191 return m_strikethrough;
195 m_strikethrough = strikethrough;
203 m_codepage = codepage;
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;
438 m_font_index = index;
455 return m_strikethrough;
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;
491 m_has_content =
true;
500 m_has_content =
true;
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;
687 m_font_index = index;
704 return m_strikethrough;
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);
TextProps()
Definition: opennurbs_textiterator.h:109
ON_SimpleArray< const ON_Font *> m_font_stack
Definition: opennurbs_textiterator.h:341
TextRun()
Definition: opennurbs_textiterator.h:660
void EmptyText()
Definition: opennurbs_textiterator.h:513
Definition: opennurbs_textiterator.h:819
Definition: opennurbs_unicode.h:345
Definition: opennurbs_textiterator.h:22
double StackScale() const
Definition: opennurbs_textiterator.h:140
ON_TextRun::RunType Type() const
Definition: opennurbs_textiterator.h:413
void SetType(ON_TextRun::RunType type)
Definition: opennurbs_textiterator.h:417
ON_TextRun m_current_run
Definition: opennurbs_textiterator.h:344
bool IsUnderlined() const
Definition: opennurbs_textiterator.h:449
ON_DimStyle::stack_format StackFormat() const
Definition: opennurbs_textiterator.h:157
void SetHeight(double h)
Definition: opennurbs_textiterator.h:135
ON__INT32 m_in_run
Definition: opennurbs_textiterator.h:250
void SetCodePage(unsigned int codepage)
Definition: opennurbs_textiterator.h:201
void SetUnderlined(bool b)
Definition: opennurbs_textiterator.h:465
A range of text with all the same attributes.
Definition: opennurbs_textrun.h:66
Definition: opennurbs_textiterator.h:657
Converts wchar_t characters to Unicode codepoints.
Definition: opennurbs_textiterator.h:38
bool IsUnderlined() const
Definition: opennurbs_textiterator.h:698
ON_wString m_facename
Definition: opennurbs_textiterator.h:32
bool IsItalic() const
Definition: opennurbs_textiterator.h:694
void AddControl(const wchar_t *str)
Definition: opennurbs_textiterator.h:474
stack_format
Format of stacked fractions
Definition: opennurbs_dimensionstyle.h:1000
Definition: opennurbs_textiterator.h:647
void SetStackScale(double s)
Definition: opennurbs_textiterator.h:144
Definition: opennurbs_textrun.h:366
TextProps(double height, double stackscale, ON_Color color, ON_DimStyle::stack_format stackformat, bool bold, bool italic, bool underlined, bool strikethrough, unsigned int charset)
Definition: opennurbs_textiterator.h:111
Definition: opennurbs_textiterator.h:28
Definition: opennurbs_textiterator.h:822
bool IsUnderlined()
Definition: opennurbs_textiterator.h:181
bool IsBold() const
Definition: opennurbs_textiterator.h:690
Definition: opennurbs_textiterator.h:795
void SetStackFormat(ON_DimStyle::stack_format s)
Definition: opennurbs_textiterator.h:161
Definition: opennurbs_string.h:2089
bool IsStrikethrough()
Definition: opennurbs_textiterator.h:189
bool IsStrikeThrough() const
Definition: opennurbs_textiterator.h:702
Definition: opennurbs_dimensionstyle.h:224
ON_ClassArray< ON_FaceNameKey > m_facename_map
Definition: opennurbs_textiterator.h:257
void SetItalic(bool b)
Definition: opennurbs_textiterator.h:710
void SetTerminated(bool terminated)
Definition: opennurbs_textiterator.h:503
void SetType(ON_TextRun::RunType type)
Definition: opennurbs_textiterator.h:666
ON_ClassArray< TextProps > m_prop_stack
Definition: opennurbs_textiterator.h:232
const ON_wString & TextString()
Definition: opennurbs_textiterator.h:518
void SetStrikeThrough(bool b)
Definition: opennurbs_textiterator.h:469
Definition: opennurbs_color.h:24
TextRun m_current_run
Definition: opennurbs_textiterator.h:757
void SetStrikethrough(bool strikethrough)
Definition: opennurbs_textiterator.h:193
Definition: opennurbs_text.h:28
ON_Color Color() const
Definition: opennurbs_textiterator.h:149
ON_TextRun::RunType Type() const
Definition: opennurbs_textiterator.h:662
bool IsTerminated()
Definition: opennurbs_textiterator.h:508
bool IsBold() const
Definition: opennurbs_textiterator.h:441
bool IsItalic()
Definition: opennurbs_textiterator.h:173
int FontIndex()
Definition: opennurbs_textiterator.h:680
void SetBold(bool b)
Definition: opennurbs_textiterator.h:706
void SetBold(bool b)
Definition: opennurbs_textiterator.h:457
void SetCharSet(unsigned int charset, bool setcodepage)
Definition: opennurbs_textiterator.h:210
void SetColor(ON_Color c)
Definition: opennurbs_textiterator.h:153
Definition: opennurbs_textiterator.h:106
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:125
void SetItalic(bool italic)
Definition: opennurbs_textiterator.h:177
bool IsBold()
Definition: opennurbs_textiterator.h:165
void SetFontIndex(int index)
Definition: opennurbs_textiterator.h:435
void SetBold(bool bold)
Definition: opennurbs_textiterator.h:169
Definition: opennurbs_textiterator.h:99
void InitRun()
Definition: opennurbs_textiterator.h:421
ON_TextRunArray & m_runs
Definition: opennurbs_textiterator.h:345
ON_wString m_run_text
Definition: opennurbs_textiterator.h:827
Definition: opennurbs_textiterator.h:408
void AddChar(const wchar_t ch)
Definition: opennurbs_textiterator.h:494
Stack with horizontal line
int FontIndex()
Definition: opennurbs_textiterator.h:431
void SetUnderlined(bool b)
Definition: opennurbs_textiterator.h:714
const ON_Font * managed_font
Definition: opennurbs_textiterator.h:25
void SetItalic(bool b)
Definition: opennurbs_textiterator.h:461
int rtf_font_index
Definition: opennurbs_textiterator.h:24
void SetUnderlined(bool underlined)
Definition: opennurbs_textiterator.h:185
Definition: opennurbs_array.h:412
bool IsItalic() const
Definition: opennurbs_textiterator.h:445
ON_ClassArray< TextRun > m_run_stack
Definition: opennurbs_textiterator.h:559
TextProps m_current_props
Definition: opennurbs_textiterator.h:233
TextRun m_current_run
Definition: opennurbs_textiterator.h:558
void AddText(const wchar_t *str)
Definition: opennurbs_textiterator.h:723
void AddText(const wchar_t *str)
Definition: opennurbs_textiterator.h:485
static const ON_wString EmptyString
Definition: opennurbs_string.h:2095
ON_TextContent & m_text
Definition: opennurbs_textiterator.h:346
void SetFontIndex(int index)
Definition: opennurbs_textiterator.h:684
void InitRun()
Definition: opennurbs_textiterator.h:670
static const ON_Font Default
Definition: opennurbs_font.h:512
Definition: opennurbs_textiterator.h:398
unsigned int CodePage()
Definition: opennurbs_textiterator.h:197
double Height() const
Definition: opennurbs_textiterator.h:131
Definition: opennurbs_textiterator.h:329
ON_SimpleArray< ON__UINT32 > m_current_codepoints
Definition: opennurbs_textiterator.h:249
const ON_wString & Text()
Definition: opennurbs_textiterator.h:732
TextRun()
Definition: opennurbs_textiterator.h:411
void SetStrikeThrough(bool b)
Definition: opennurbs_textiterator.h:718
static const ON_Color Black
0x00000000u
Definition: opennurbs_color.h:33
unsigned int CharSet()
Definition: opennurbs_textiterator.h:206
ON_ClassArray< TextRun > m_run_stack
Definition: opennurbs_textiterator.h:758
bool IsStrikeThrough() const
Definition: opennurbs_textiterator.h:453