Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions meta/plugins/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from cutekit import ensure

ensure((0, 9, 0))

from . import preamble # noqa E402, F401: Needed for side effect
33 changes: 33 additions & 0 deletions meta/plugins/preamble.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import subprocess
import requests

def build_ucd_cpp():
subprocess.run([
"python3",
"src/libs/karm-icu/defs/build_ucd_cpp.py",
"src/libs/karm-icu/ucd.cpp"
], check=True)


def download_to(url, path):
with requests.get(url, stream=True) as r:
r.raise_for_status()
with open(path, "wb") as f:
for line_bytes in r.iter_lines():
f.write(line_bytes)



def build_preamble():
build_ucd_cpp()

# Unicode Bidi Character Test
download_to(
"https://www.unicode.org/Public/16.0.0/ucd/BidiCharacterTest.txt",
"src/libs/karm-icu/tests/res/BidiCharacterTest.txt"
)



if __name__ == "__main__":
build_preamble()
36 changes: 36 additions & 0 deletions src/libs/karm-icu/base.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,41 @@
module;

#include <karm-base/base.h>

export module Karm.Icu:base;

namespace Karm::Icu {

usize const PLANE_SIZE = 65536; // 2^16
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove?


// MARK: Bidirectional Character Types
// https://unicode.org/reports/tr9/#Bidirectional_Character_Types
export enum struct BidiType : u8 {
L = 0, //< Left-to-right
LRE = 1, //< Left-to-Right Embedding
LRO = 2, //< Left-to-Right Override
R = 3, //< Right-to-Left
AL = 4, //< Right-to-Left Arabic
RLE = 5, //< Right-to-Left Embedding
RLO = 6, //< Right-to-Left Override
PDF = 7, //< Pop Directional Format
EN = 8, //< European Number
ES = 9, //< European Number Separator
ET = 10, //< European Number Terminator
AN = 11, //< Arabic Number
CS = 12, //< Common Number Separator
NSM = 13, //< Non-Spacing Mark
BN = 14, //< Boundary Neutral
B = 15, //< Paragraph Separator
S = 16, //< Segment Separator
WS = 17, //< Whitespace
ON = 18, //< Other Neutrals
LRI = 19, //< Left-to-Right Isolate
RLI = 20, //< Right-to-Left Isolate
FSI = 21, //< First-Strong Isolate
PDI = 22, //< Pop Directional Isolate

_LEN
};

} // namespace Karm::Icu
Loading