-
-
Notifications
You must be signed in to change notification settings - Fork 4
Implementation of Unicode Bidi Algo #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
pauloamed
wants to merge
3
commits into
main
Choose a base branch
from
palm-bidi
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
|
|
||
| // 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 | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove?