1 /***************************************************************************** 2 * Copyright (c) 2014-2020 OpenRCT2 developers 3 * 4 * For a complete list of all authors, please refer to contributors.md 5 * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 6 * 7 * OpenRCT2 is licensed under the GNU General Public License version 3. 8 *****************************************************************************/ 9 10 #pragma once 11 12 #include "../common.h" 13 14 #include <string_view> 15 16 enum class FormatToken 17 { 18 Unknown, 19 Literal, 20 Escaped, 21 22 Newline, 23 NewlineSmall, 24 25 // With parameters 26 Move, 27 InlineSprite, 28 29 // With arguments 30 Comma32, 31 Int32, 32 Comma1dp16, 33 Comma2dp32, 34 Comma16, 35 UInt16, 36 Currency2dp, 37 Currency, 38 StringId, 39 String, 40 MonthYear, 41 Month, 42 Velocity, 43 DurationShort, 44 DurationLong, 45 Length, 46 Sprite, 47 Pop16, 48 Push16, 49 50 // Colours 51 ColourWindow1, 52 ColourWindow2, 53 ColourWindow3, 54 ColourBlack, 55 ColourGrey, 56 ColourWhite, 57 ColourRed, 58 ColourGreen, 59 ColourYellow, 60 ColourTopaz, 61 ColourCeladon, 62 ColourBabyBlue, 63 ColourPaleLavender, 64 ColourPaleGold, 65 ColourLightPink, 66 ColourPearlAqua, 67 ColourPaleSilver, 68 69 // Fonts 70 FontTiny, 71 FontSmall, 72 FontMedium, 73 74 OutlineEnable, 75 OutlineDisable, 76 }; 77 78 std::string_view GetFormatTokenStringWithBraces(FormatToken token); 79 FormatToken FormatTokenFromString(std::string_view token); 80 std::string_view FormatTokenToString(FormatToken token, bool withBraces = false); 81 bool FormatTokenTakesArgument(FormatToken token); 82 bool FormatTokenIsColour(FormatToken token); 83 size_t FormatTokenGetTextColourIndex(FormatToken token); 84 FormatToken FormatTokenFromTextColour(size_t textColour); 85 86 constexpr uint8_t CS_SPRITE_FONT_OFFSET = 32; 87 88 namespace CSChar 89 { 90 constexpr char32_t quote_close = 0x22; 91 92 constexpr char32_t a_ogonek_uc = 0x9F; 93 constexpr char32_t up = 0xA0; 94 95 constexpr char32_t c_acute_uc = 0xA2; 96 constexpr char32_t e_ogonek_uc = 0xA6; 97 constexpr char32_t l_stroke_uc = 0xA7; 98 99 constexpr char32_t down = 0xAA; 100 constexpr char32_t tick = 0xAC; 101 constexpr char32_t cross = 0xAD; 102 constexpr char32_t right = 0xAF; 103 constexpr char32_t railway = 0xB1; 104 constexpr char32_t quote_open = 0xB4; 105 constexpr char32_t euro = 0xB5; 106 constexpr char32_t road = 0xB6; 107 constexpr char32_t air = 0xB7; 108 constexpr char32_t water = 0xB8; 109 constexpr char32_t superscript_minus_one = 0xB9; 110 constexpr char32_t bullet = 0xBA; 111 constexpr char32_t small_up = 0xBC; 112 constexpr char32_t small_down = 0xBD; 113 constexpr char32_t left = 0xBE; 114 115 constexpr char32_t n_acute_uc = 0xC6; 116 constexpr char32_t s_acute_uc = 0xD0; 117 constexpr char32_t z_acute_uc = 0xD7; 118 constexpr char32_t z_dot_uc = 0xD8; 119 constexpr char32_t a_ogonek = 0xDD; 120 constexpr char32_t c_acute = 0xDE; 121 constexpr char32_t e_ogonek = 0xE6; 122 constexpr char32_t n_acute = 0xF0; 123 constexpr char32_t o_circumflex = 0xF4; 124 constexpr char32_t l_stroke = 0xF7; 125 constexpr char32_t s_acute = 0xF8; 126 constexpr char32_t z_acute = 0xFE; 127 128 constexpr char32_t z_dot = 0xFD; 129 } // namespace CSChar 130 131 namespace UnicodeChar 132 { 133 // Latin alphabet 134 constexpr char32_t j = 0x6A; 135 constexpr char32_t l = 0x6C; 136 constexpr char32_t ae_uc = 0xC6; 137 constexpr char32_t o_stroke_uc = 0xD8; 138 constexpr char32_t y_acute_uc = 0xDD; 139 constexpr char32_t ae = 0xE6; 140 constexpr char32_t o_stroke = 0xF8; 141 constexpr char32_t y_acute = 0xFD; 142 constexpr char32_t a_breve_uc = 0x102; 143 constexpr char32_t a_breve = 0x103; 144 constexpr char32_t a_ogonek_uc = 0x104; 145 constexpr char32_t a_ogonek = 0x105; 146 constexpr char32_t c_acute_uc = 0x106; 147 constexpr char32_t c_acute = 0x107; 148 constexpr char32_t c_circumflex_uc = 0x108; 149 constexpr char32_t c_circumflex = 0x109; 150 constexpr char32_t c_caron_uc = 0x10C; 151 constexpr char32_t c_caron = 0x10D; 152 constexpr char32_t d_caron_uc = 0x10E; 153 constexpr char32_t d_caron = 0x10F; 154 constexpr char32_t e_ogonek_uc = 0x118; 155 constexpr char32_t e_ogonek = 0x119; 156 constexpr char32_t e_caron_uc = 0x11A; 157 constexpr char32_t e_caron = 0x11B; 158 constexpr char32_t g_circumflex_uc = 0x11C; 159 constexpr char32_t g_circumflex = 0x11D; 160 constexpr char32_t g_breve_uc = 0x11E; 161 constexpr char32_t g_breve = 0x11F; 162 constexpr char32_t h_circumflex_uc = 0x124; 163 constexpr char32_t h_circumflex = 0x125; 164 constexpr char32_t i_with_dot_uc = 0x130; 165 constexpr char32_t i_without_dot = 0x131; 166 constexpr char32_t j_circumflex_uc = 0x134; 167 constexpr char32_t j_circumflex = 0x135; 168 constexpr char32_t l_stroke_uc = 0x141; 169 constexpr char32_t l_stroke = 0x142; 170 constexpr char32_t n_acute_uc = 0x143; 171 constexpr char32_t n_acute = 0x144; 172 constexpr char32_t n_caron_uc = 0x147; 173 constexpr char32_t n_caron = 0x148; 174 constexpr char32_t o_macron = 0x14D; 175 constexpr char32_t o_double_acute_uc = 0x150; 176 constexpr char32_t o_double_acute = 0x151; 177 constexpr char32_t oe_uc = 0x152; 178 constexpr char32_t oe = 0x153; 179 constexpr char32_t r_caron_uc = 0x158; 180 constexpr char32_t r_caron = 0x159; 181 constexpr char32_t s_acute_uc = 0x15A; 182 constexpr char32_t s_acute = 0x15B; 183 constexpr char32_t s_circumflex_uc = 0x15C; 184 constexpr char32_t s_circumflex = 0x15D; 185 constexpr char32_t s_cedilla_uc = 0x15E; 186 constexpr char32_t s_cedilla = 0x15F; 187 constexpr char32_t s_caron_uc = 0x160; 188 constexpr char32_t s_caron = 0x161; 189 constexpr char32_t t_caron_uc = 0x164; 190 constexpr char32_t t_caron = 0x165; 191 constexpr char32_t u_breve_uc = 0x16C; 192 constexpr char32_t u_breve = 0x16D; 193 constexpr char32_t u_ring_uc = 0x16E; 194 constexpr char32_t u_ring = 0x16F; 195 constexpr char32_t u_double_acute_uc = 0x170; 196 constexpr char32_t u_double_acute = 0x171; 197 constexpr char32_t z_acute_uc = 0x179; 198 constexpr char32_t z_acute = 0x17A; 199 constexpr char32_t z_dot_uc = 0x17B; 200 constexpr char32_t z_dot = 0x17C; 201 constexpr char32_t z_caron_uc = 0x17D; 202 constexpr char32_t z_caron = 0x17E; 203 constexpr char32_t f_with_hook_uc = 0x191; 204 constexpr char32_t s_comma_uc = 0x218; 205 constexpr char32_t s_comma = 0x219; 206 constexpr char32_t t_comma_uc = 0x21A; 207 constexpr char32_t t_comma = 0x21B; 208 constexpr char32_t sharp_s_uc = 0x1E9E; 209 210 // Cyrillic alphabet 211 constexpr char32_t cyrillic_io_uc = 0x401; 212 constexpr char32_t cyrillic_a_uc = 0x410; 213 constexpr char32_t cyrillic_be_uc = 0x411; 214 constexpr char32_t cyrillic_ve_uc = 0x412; 215 constexpr char32_t cyrillic_ghe_uc = 0x413; 216 constexpr char32_t cyrillic_de_uc = 0x414; 217 constexpr char32_t cyrillic_ie_uc = 0x415; 218 constexpr char32_t cyrillic_zhe_uc = 0x416; 219 constexpr char32_t cyrillic_ze_uc = 0x417; 220 constexpr char32_t cyrillic_i_uc = 0x418; 221 constexpr char32_t cyrillic_short_i_uc = 0x419; 222 constexpr char32_t cyrillic_ka_uc = 0x41A; 223 constexpr char32_t cyrillic_el_uc = 0x41B; 224 constexpr char32_t cyrillic_em_uc = 0x41C; 225 constexpr char32_t cyrillic_en_uc = 0x41D; 226 constexpr char32_t cyrillic_o_uc = 0x41E; 227 constexpr char32_t cyrillic_pe_uc = 0x41F; 228 constexpr char32_t cyrillic_er_uc = 0x420; 229 constexpr char32_t cyrillic_es_uc = 0x421; 230 constexpr char32_t cyrillic_te_uc = 0x422; 231 constexpr char32_t cyrillic_u_uc = 0x423; 232 constexpr char32_t cyrillic_ef_uc = 0x424; 233 constexpr char32_t cyrillic_ha_uc = 0x425; 234 constexpr char32_t cyrillic_tse_uc = 0x426; 235 constexpr char32_t cyrillic_che_uc = 0x427; 236 constexpr char32_t cyrillic_sha_uc = 0x428; 237 constexpr char32_t cyrillic_shcha_uc = 0x429; 238 constexpr char32_t cyrillic_hard_sign_uc = 0x42A; 239 constexpr char32_t cyrillic_yeru_uc = 0x42B; 240 constexpr char32_t cyrillic_soft_sign_uc = 0x42C; 241 constexpr char32_t cyrillic_e_uc = 0x42D; 242 constexpr char32_t cyrillic_yu_uc = 0x42E; 243 constexpr char32_t cyrillic_ya_uc = 0x42F; 244 245 constexpr char32_t cyrillic_a = 0x430; 246 constexpr char32_t cyrillic_be = 0x431; 247 constexpr char32_t cyrillic_ve = 0x432; 248 constexpr char32_t cyrillic_ghe = 0x433; 249 constexpr char32_t cyrillic_de = 0x434; 250 constexpr char32_t cyrillic_ie = 0x435; 251 constexpr char32_t cyrillic_zhe = 0x436; 252 constexpr char32_t cyrillic_ze = 0x437; 253 constexpr char32_t cyrillic_i = 0x438; 254 constexpr char32_t cyrillic_short_i = 0x439; 255 constexpr char32_t cyrillic_ka = 0x43A; 256 constexpr char32_t cyrillic_el = 0x43B; 257 constexpr char32_t cyrillic_em = 0x43C; 258 constexpr char32_t cyrillic_en = 0x43D; 259 constexpr char32_t cyrillic_o = 0x43E; 260 constexpr char32_t cyrillic_pe = 0x43F; 261 constexpr char32_t cyrillic_er = 0x440; 262 constexpr char32_t cyrillic_es = 0x441; 263 constexpr char32_t cyrillic_te = 0x442; 264 constexpr char32_t cyrillic_u = 0x443; 265 constexpr char32_t cyrillic_ef = 0x444; 266 constexpr char32_t cyrillic_ha = 0x445; 267 constexpr char32_t cyrillic_tse = 0x446; 268 constexpr char32_t cyrillic_che = 0x447; 269 constexpr char32_t cyrillic_sha = 0x448; 270 constexpr char32_t cyrillic_shcha = 0x449; 271 constexpr char32_t cyrillic_hard_sign = 0x44A; 272 constexpr char32_t cyrillic_yeru = 0x44B; 273 constexpr char32_t cyrillic_soft_sign = 0x44C; 274 constexpr char32_t cyrillic_e = 0x44D; 275 constexpr char32_t cyrillic_yu = 0x44E; 276 constexpr char32_t cyrillic_ya = 0x44F; 277 278 constexpr char32_t cyrillic_io = 0x451; 279 280 // Punctuation 281 constexpr char32_t non_breaking_space = 0xA0; 282 constexpr char32_t leftguillemet = 0xAB; 283 constexpr char32_t rightguillemet = 0xBB; 284 constexpr char32_t interpunct = 0xB7; 285 constexpr char32_t multiplication_sign = 0xD7; 286 constexpr char32_t en_dash = 0x2013; 287 constexpr char32_t em_dash = 0x2014; 288 constexpr char32_t single_quote_open = 0x2018; 289 constexpr char32_t single_quote_end = 0x2019; 290 constexpr char32_t single_german_quote_open = 0x201A; 291 constexpr char32_t german_quote_open = 0x201E; 292 constexpr char32_t bullet = 0x2022; 293 constexpr char32_t ellipsis = 0x2026; 294 constexpr char32_t narrow_non_breaking_space = 0x202F; 295 constexpr char32_t quote_open = 0x201C; 296 constexpr char32_t quote_close = 0x201D; 297 298 // Currency 299 constexpr char32_t guilder = 0x192; 300 constexpr char32_t euro = 0x20AC; 301 constexpr char32_t rouble = 0x20BD; 302 303 // Dingbats 304 constexpr char32_t up = 0x25B2; 305 constexpr char32_t small_up = 0x25B4; 306 constexpr char32_t right = 0x25B6; 307 constexpr char32_t down = 0x25BC; 308 constexpr char32_t small_down = 0x25BE; 309 constexpr char32_t left = 0x25C0; 310 constexpr char32_t air = 0x2601; 311 constexpr char32_t tick = 0x2713; 312 constexpr char32_t plus = 0x2795; 313 constexpr char32_t minus = 0x2796; 314 315 // Emoji 316 constexpr char32_t cross = 0x274C; 317 constexpr char32_t variation_selector = 0xFE0F; 318 constexpr char32_t water = 0x1F30A; 319 constexpr char32_t road = 0x1F6E3; 320 constexpr char32_t railway = 0x1F6E4; 321 322 // Misc 323 constexpr char32_t superscript_minus_one = 0x207B; 324 325 }; // namespace UnicodeChar 326