HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
src
TTauri
Foundation
CP1252.hpp
1
// Copyright 2020 Pokitec
2
// All rights reserved.
3
4
#pragma once
5
6
#include <cstddef>
7
8
namespace
tt {
9
10
[[nodiscard]]
constexpr
char32_t
CP1252_to_UTF32(
char
inputCharacter)
noexcept
11
{
12
ttlet inputCharacter_ =
static_cast<
uint8_t
>
(inputCharacter);
13
if
(inputCharacter_ >= 0 && inputCharacter_ <= 0x7f) {
14
return
inputCharacter_;
15
}
else
if
(inputCharacter_ >= 0xa0) {
16
return
inputCharacter_;
17
}
else
{
18
switch
(inputCharacter_) {
19
case
0x80:
return
0x20ac;
20
case
0x81:
return
0xfffd;
// Replacement character.
21
case
0x82:
return
0x201a;
22
case
0x83:
return
0x0192;
23
case
0x84:
return
0x201e;
24
case
0x85:
return
0x2026;
25
case
0x86:
return
0x2020;
26
case
0x87:
return
0x2021;
27
case
0x88:
return
0x02c6;
28
case
0x89:
return
0x2030;
29
case
0x8a:
return
0x0160;
30
case
0x8b:
return
0x2039;
31
case
0x8c:
return
0x0152;
32
case
0x8d:
return
0xfffd;
// Replacement character.
33
case
0x8e:
return
0x017d;
34
case
0x8f:
return
0xfffd;
// Replacement character.
35
case
0x90:
return
0xfffd;
// Replacement character.
36
case
0x91:
return
0x2018;
37
case
0x92:
return
0x2019;
38
case
0x93:
return
0x201c;
39
case
0x94:
return
0x201d;
40
case
0x95:
return
0x2022;
41
case
0x96:
return
0x2013;
42
case
0x97:
return
0x2014;
43
case
0x98:
return
0x02dc;
44
case
0x99:
return
0x2122;
45
case
0x9a:
return
0x0161;
46
case
0x9b:
return
0x203a;
47
case
0x9c:
return
0x0153;
48
case
0x9d:
return
0xfffd;
// Replacement character.
49
case
0x9e:
return
0x017e;
50
case
0x9f:
return
0x0178;
51
default
:
return
0xfffd;
// Replacement character.
52
}
53
}
54
}
55
56
}
Generated on Mon Apr 22 2024 12:53:56 for HikoGUI by
1.10.0