CommonLibSSE NG
Loading...
Searching...
No Matches
GFxWWHelper.h
Go to the documentation of this file.
1#pragma once
2
3namespace RE
4{
6 {
7 public:
8 enum class BreakInfoFlags
9 {
10 kNone = 0,
11 kNonStartingChar = 1 << 0,
12 kNonTerminatingChar = 1 << 1,
14 };
15
16 // An enumeration that describes bits in word-wrapping mode bit mask parameter of the Translator constructor.
18 {
19 kNone = 0,
20 kDefault = static_cast<std::underlying_type_t<WordWrappingType>>(kNone), // - Custom word-wrapping is off, OnWordWrapping will not be invoked
21 kAsian = 1 << 0, // - Turns on Chinese word-wrapping rules
22 kProhibition = 1 << 1, // - Prohibits certain chars at start/end of line (turns on Japanese prohibition rule)
23 kNoHangulWrap = 1 << 2, // - Turns on Korean-specific word-wrapping rules
24 kCustom = 1 << 7,
25 kLast = static_cast<std::underlying_type_t<WordWrappingType>>(kNoHangulWrap),
26 kHyphenation = kLast < 1,
27 kKorean = kProhibition | kNoHangulWrap,
28 kJapanese = static_cast<std::underlying_type_t<WordWrappingType>>(kProhibition),
29 kChinese = kProhibition | kAsian,
30 kAll = kAsian | kProhibition | kNoHangulWrap
31 };
32
34 {
35 wchar_t ch; // 0
37 std::uint8_t pad3; // 3
38 };
39 static_assert(sizeof(CharBreakInfo) == 0x4);
40
41 static bool FindCharWithFlags(WordWrappingType a_wwMode, wchar_t a_ch, BreakInfoFlags a_charBreakFlags);
42 static bool IsAsianChar(WordWrappingType a_wwMode, wchar_t a_ch);
43 static bool IsNonStartingChar(WordWrappingType a_wwMode, wchar_t a_ch);
44 static bool IsNonTerminatingChar(WordWrappingType a_wwMode, wchar_t a_ch);
45 static bool IsWhiteSpaceChar(wchar_t a_ch);
46 static bool IsLineFeedChar(wchar_t a_ch);
47 static bool IsLineBreakOpportunityAt(WordWrappingType a_wwMode, const wchar_t* a_wstr, UPInt a_index);
48 static bool IsLineBreakOpportunityAt(WordWrappingType a_wwMode, wchar_t a_prevChar, wchar_t a_curChar);
49 static UPInt FindNextNonWhiteSpace(const wchar_t* a_wstr, UPInt a_pos, UPInt a_maxPos);
50 static UPInt FindPrevNonWhiteSpace(const wchar_t* a_wstr, UPInt a_pos);
51 static bool IsVowel(wchar_t a_ch);
52 static UPInt FindWordWrapPos(WordWrappingType a_wwMode, UPInt a_wordWrapPos, const wchar_t* a_paraText, UPInt a_paraLen, UPInt a_lineStartPos, UPInt a_lineLen);
53
129 { 0x0FDFC, BreakInfoFlags::kNonStartingChar, 0 },
130 { 0x0FE50, BreakInfoFlags::kNonStartingChar, 0 },
131 { 0x0FE51, BreakInfoFlags::kNonStartingChar, 0 },
132 { 0x0FE52, BreakInfoFlags::kNonStartingChar, 0 },
133 { 0x0FE54, BreakInfoFlags::kNonStartingChar, 0 },
134 { 0x0FE55, BreakInfoFlags::kNonStartingChar, 0 },
135 { 0x0FE56, BreakInfoFlags::kNonStartingChar, 0 },
136 { 0x0FE57, BreakInfoFlags::kNonStartingChar, 0 },
138 { 0x0FE5A, BreakInfoFlags::kNonStartingChar, 0 },
140 { 0x0FE5C, BreakInfoFlags::kNonStartingChar, 0 },
142 { 0x0FE5E, BreakInfoFlags::kNonStartingChar, 0 },
143 { 0x0FE6A, BreakInfoFlags::kNonStartingChar, 0 },
144 { 0x0FF01, BreakInfoFlags::kNonStartingChar, 0 },
146 { 0x0FF05, BreakInfoFlags::kNonStartingChar, 0 },
148 { 0x0FF09, BreakInfoFlags::kNonStartingChar, 0 },
149 { 0x0FF0C, BreakInfoFlags::kNonStartingChar, 0 },
150 { 0x0FF0E, BreakInfoFlags::kNonStartingChar, 0 },
151 { 0x0FF1A, BreakInfoFlags::kNonStartingChar, 0 },
152 { 0x0FF1B, BreakInfoFlags::kNonStartingChar, 0 },
153 { 0x0FF1F, BreakInfoFlags::kNonStartingChar, 0 },
156 { 0x0FF3D, BreakInfoFlags::kNonStartingChar, 0 },
158 { 0x0FF5D, BreakInfoFlags::kNonStartingChar, 0 },
159 { 0x0FF61, BreakInfoFlags::kNonStartingChar, 0 },
160 { 0x0FF64, BreakInfoFlags::kNonStartingChar, 0 },
161 { 0x0FFE0, BreakInfoFlags::kAll, 0 },
165 };
166 };
167 static_assert(sizeof(GFxWWHelper) == 0x1);
168}
Definition GFxWWHelper.h:6
static bool IsAsianChar(WordWrappingType a_wwMode, wchar_t a_ch)
static bool IsNonTerminatingChar(WordWrappingType a_wwMode, wchar_t a_ch)
BreakInfoFlags
Definition GFxWWHelper.h:9
static UPInt FindPrevNonWhiteSpace(const wchar_t *a_wstr, UPInt a_pos)
static UPInt FindNextNonWhiteSpace(const wchar_t *a_wstr, UPInt a_pos, UPInt a_maxPos)
static bool IsVowel(wchar_t a_ch)
static bool IsNonStartingChar(WordWrappingType a_wwMode, wchar_t a_ch)
WordWrappingType
Definition GFxWWHelper.h:18
static bool IsWhiteSpaceChar(wchar_t a_ch)
static CharBreakInfo charBreakInfoArray[]
Definition GFxWWHelper.h:54
static bool IsLineBreakOpportunityAt(WordWrappingType a_wwMode, const wchar_t *a_wstr, UPInt a_index)
static bool IsLineBreakOpportunityAt(WordWrappingType a_wwMode, wchar_t a_prevChar, wchar_t a_curChar)
static bool FindCharWithFlags(WordWrappingType a_wwMode, wchar_t a_ch, BreakInfoFlags a_charBreakFlags)
static UPInt FindWordWrapPos(WordWrappingType a_wwMode, UPInt a_wordWrapPos, const wchar_t *a_paraText, UPInt a_paraLen, UPInt a_lineStartPos, UPInt a_lineLen)
static bool IsLineFeedChar(wchar_t a_ch)
Definition PCH.h:223
Definition AbsorbEffect.h:6
std::size_t UPInt
Definition SFTypes.h:5
Definition GFxWWHelper.h:34
std::uint8_t pad3
Definition GFxWWHelper.h:37
wchar_t ch
Definition GFxWWHelper.h:35
stl::enumeration< BreakInfoFlags, std::uint8_t > flags
Definition GFxWWHelper.h:36