Skip to content
Merged
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
4 changes: 3 additions & 1 deletion Unic.yyp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions objects/obj_unic_test/Create_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ repeat(3)
}

show_debug_message(UnicGetCharacters("ja"));
show_debug_message(json_stringify(UnicBlockGetRanges(UnicGetCharacters("ja")), true));

if (os_get_config() == "Unit_Test") {
game_end();
Expand Down
12 changes: 12 additions & 0 deletions scripts/UnicBlockGetRanges/UnicBlockGetRanges.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Feather disable all

/// Returns an array of structs with all of the valid character block ranges, based on the provided string characters.
/// These character block ranges are derived from https://www.unicode.org/charts/, and Blocks.txt respectively.
///
/// @param {String} string
/// @return {Array<Struct>}
function UnicBlockGetRanges(_str) {
var _results = [];
UnicBlockGetRangesExt(_results, _str);
return _results;
}
13 changes: 13 additions & 0 deletions scripts/UnicBlockGetRanges/UnicBlockGetRanges.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 80 additions & 0 deletions scripts/UnicBlockGetRangesExt/UnicBlockGetRangesExt.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// Feather disable all

/// Returns a count of all the valid character block ranges, based on the provided string characters.
/// The provided array is updated as well to include these character block ranges at the end.
/// These character block ranges are derived from https://www.unicode.org/charts/, and Blocks.txt respectively.
///
/// @param {Array} array
/// @param {String} string
/// @param {String} ...
/// @return {Real}
function UnicBlockGetRangesExt(_array, _str) {
static _ctx = {
_results: undefined,
_count: 0,
min: infinity,
max: -infinity,
addedEntry: false,
}

static _callback = function(_char, _pos) {
static _db = __UnicDatabaseBlocks();
static _len = array_length(_db);
static _cachePos = 0;
var _charCode = ord(_char);
// Very early exit
if (addedEntry) {
if (_charCode >= self.min && _charCode <= self.max) {
return;
}
}

// Cache handling, speeds up character codes that are apart of a similar group.
var _entry = _db[_cachePos];
var _min = _entry.min;
var _max = _entry.max;
if (_charCode >= _min && _charCode <= _max) {
// Entry found, add if dupe doesn't exist and exit!
if (array_get_index(_results, _entry) == -1) {
array_push(_results, _entry);
addedEntry = true;
++_count;
}
self.min = _min;
self.max = _max;
return;
}

for(var _i = 0; _i < _len; ++_i) {
_entry = _db[_i];
_min = _entry.min;
_max = _entry.max;
if (_charCode >= _min && _charCode <= _max) {
// Entry found, add if dupe doesn't exist and exit!
if (array_get_index(_results, _entry) == -1) {
array_push(_results, _entry);
addedEntry = true;
++_count;
}
_cachePos = _i;
self.min = _min;
self.max = _max;
return;
}
}
};


_ctx._results = _array;
_ctx._count = 0;
_ctx.min = infinity;
_ctx.max = -infinity;
_ctx.addedEntry = false;
with(_ctx) {
for(var _i = 1; _i < argument_count; ++_i) {
string_foreach(argument[_i], _callback);
}
}
_ctx._results = undefined;
return _ctx._count;
}
13 changes: 13 additions & 0 deletions scripts/UnicBlockGetRangesExt/UnicBlockGetRangesExt.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function __UnicBlocksGenerateDatabase() {
buffer_delete(_buff);

var _writeBuff = buffer_create(1, buffer_grow, 1);
buffer_write(_writeBuff, buffer_text, "// feather ignore all\n/// @ignore\n");
buffer_write(_writeBuff, buffer_text, "// Feather ignore all\n/// @ignore\n");
buffer_write(_writeBuff, buffer_text, "function __UnicDatabaseBlocks() {\n static _inst = [\n");
var _results = string_split(_str, "\n");
for(var _i = 0; _i < array_length(_results); ++_i) {
Expand Down
42 changes: 41 additions & 1 deletion scripts/__UnicDatabaseBlocks/__UnicDatabaseBlocks.gml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// feather ignore all
// Feather ignore all
/// @ignore
function __UnicDatabaseBlocks() {
static _inst = [
Expand Down Expand Up @@ -977,6 +977,11 @@ function __UnicDatabaseBlocks() {
max: 0x1093F,
description: "Lydian",
},
{
min: 0x10940,
max: 0x1095F,
description: "Sidetic",
},
{
min: 0x10980,
max: 0x1099F,
Expand Down Expand Up @@ -1232,6 +1237,11 @@ function __UnicDatabaseBlocks() {
max: 0x11B5F,
description: "Devanagari Extended-A",
},
{
min: 0x11B60,
max: 0x11B7F,
description: "Sharada Supplement",
},
{
min: 0x11BC0,
max: 0x11BFF,
Expand All @@ -1257,6 +1267,11 @@ function __UnicDatabaseBlocks() {
max: 0x11DAF,
description: "Gunjala Gondi",
},
{
min: 0x11DB0,
max: 0x11DEF,
description: "Tolong Siki",
},
{
min: 0x11EE0,
max: 0x11EFF,
Expand Down Expand Up @@ -1357,6 +1372,11 @@ function __UnicDatabaseBlocks() {
max: 0x16E9F,
description: "Medefaidrin",
},
{
min: 0x16EA0,
max: 0x16EDF,
description: "Beria Erfe",
},
{
min: 0x16F00,
max: 0x16F9F,
Expand Down Expand Up @@ -1387,6 +1407,11 @@ function __UnicDatabaseBlocks() {
max: 0x18D7F,
description: "Tangut Supplement",
},
{
min: 0x18D80,
max: 0x18DFF,
description: "Tangut Components Supplement",
},
{
min: 0x1AFF0,
max: 0x1AFFF,
Expand Down Expand Up @@ -1427,6 +1452,11 @@ function __UnicDatabaseBlocks() {
max: 0x1CEBF,
description: "Symbols for Legacy Computing Supplement",
},
{
min: 0x1CEC0,
max: 0x1CEFF,
description: "Miscellaneous Symbols Supplement",
},
{
min: 0x1CF00,
max: 0x1CFCF,
Expand Down Expand Up @@ -1517,6 +1547,11 @@ function __UnicDatabaseBlocks() {
max: 0x1E5FF,
description: "Ol Onal",
},
{
min: 0x1E6C0,
max: 0x1E6FF,
description: "Tai Yo",
},
{
min: 0x1E7E0,
max: 0x1E7FF,
Expand Down Expand Up @@ -1672,6 +1707,11 @@ function __UnicDatabaseBlocks() {
max: 0x323AF,
description: "CJK Unified Ideographs Extension H",
},
{
min: 0x323B0,
max: 0x3347F,
description: "CJK Unified Ideographs Extension J",
},
{
min: 0xE0000,
max: 0xE007F,
Expand Down
4 changes: 2 additions & 2 deletions scripts/__UnicDatabaseBlocks/__UnicDatabaseBlocks.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions scripts/__UnicLineBreak/__UnicLineBreak.gml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// https://www.unicode.org/reports/tr14/

enum UnicLineBreak {
MANDATORY_BREAK = 0, // BK
CARRIAGE_RETURN = 1, // CR
Expand Down
14 changes: 11 additions & 3 deletions unicode-specifics/Blocks.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Blocks-16.0.0.txt
# Date: 2024-02-02
# © 2024 Unicode®, Inc.
# Blocks-17.0.0.txt
# Date: 2025-08-01
# © 2025 Unicode®, Inc.
# Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the U.S. and other countries.
# For terms of use and license, see https://www.unicode.org/terms_of_use.html
#
Expand Down Expand Up @@ -228,6 +228,7 @@ FFF0..FFFF; Specials
108E0..108FF; Hatran
10900..1091F; Phoenician
10920..1093F; Lydian
10940..1095F; Sidetic
10980..1099F; Meroitic Hieroglyphs
109A0..109FF; Meroitic Cursive
10A00..10A5F; Kharoshthi
Expand Down Expand Up @@ -279,11 +280,13 @@ FFF0..FFFF; Specials
11AB0..11ABF; Unified Canadian Aboriginal Syllabics Extended-A
11AC0..11AFF; Pau Cin Hau
11B00..11B5F; Devanagari Extended-A
11B60..11B7F; Sharada Supplement
11BC0..11BFF; Sunuwar
11C00..11C6F; Bhaiksuki
11C70..11CBF; Marchen
11D00..11D5F; Masaram Gondi
11D60..11DAF; Gunjala Gondi
11DB0..11DEF; Tolong Siki
11EE0..11EFF; Makasar
11F00..11F5F; Kawi
11FB0..11FBF; Lisu Supplement
Expand All @@ -304,12 +307,14 @@ FFF0..FFFF; Specials
16B00..16B8F; Pahawh Hmong
16D40..16D7F; Kirat Rai
16E40..16E9F; Medefaidrin
16EA0..16EDF; Beria Erfe
16F00..16F9F; Miao
16FE0..16FFF; Ideographic Symbols and Punctuation
17000..187FF; Tangut
18800..18AFF; Tangut Components
18B00..18CFF; Khitan Small Script
18D00..18D7F; Tangut Supplement
18D80..18DFF; Tangut Components Supplement
1AFF0..1AFFF; Kana Extended-B
1B000..1B0FF; Kana Supplement
1B100..1B12F; Kana Extended-A
Expand All @@ -318,6 +323,7 @@ FFF0..FFFF; Specials
1BC00..1BC9F; Duployan
1BCA0..1BCAF; Shorthand Format Controls
1CC00..1CEBF; Symbols for Legacy Computing Supplement
1CEC0..1CEFF; Miscellaneous Symbols Supplement
1CF00..1CFCF; Znamenny Musical Notation
1D000..1D0FF; Byzantine Musical Symbols
1D100..1D1FF; Musical Symbols
Expand All @@ -336,6 +342,7 @@ FFF0..FFFF; Specials
1E2C0..1E2FF; Wancho
1E4D0..1E4FF; Nag Mundari
1E5D0..1E5FF; Ol Onal
1E6C0..1E6FF; Tai Yo
1E7E0..1E7FF; Ethiopic Extended-B
1E800..1E8DF; Mende Kikakui
1E900..1E95F; Adlam
Expand Down Expand Up @@ -367,6 +374,7 @@ FFF0..FFFF; Specials
2F800..2FA1F; CJK Compatibility Ideographs Supplement
30000..3134F; CJK Unified Ideographs Extension G
31350..323AF; CJK Unified Ideographs Extension H
323B0..3347F; CJK Unified Ideographs Extension J
E0000..E007F; Tags
E0100..E01EF; Variation Selectors Supplement
F0000..FFFFF; Supplementary Private Use Area-A
Expand Down