diff --git a/.gitmodules b/.gitmodules index e7b817c6..67f48684 100644 --- a/.gitmodules +++ b/.gitmodules @@ -41,3 +41,6 @@ url = ../../jrsoftware/issrc.git branch = main update = merge +[submodule "src/3rdparty/unicodetools"] + path = src/3rdparty/unicodetools + url = https://github.com/unicode-org/unicodetools diff --git a/src/3rdparty/unicodetools b/src/3rdparty/unicodetools new file mode 160000 index 00000000..6aa0313f --- /dev/null +++ b/src/3rdparty/unicodetools @@ -0,0 +1 @@ +Subproject commit 6aa0313f491a21b791230cb630322e9cffa7e1ab diff --git a/src/wincompose/sequences/Category.cs b/src/wincompose/sequences/Category.cs index 36a8e395..3bf7d923 100644 --- a/src/wincompose/sequences/Category.cs +++ b/src/wincompose/sequences/Category.cs @@ -96,17 +96,19 @@ private static IEnumerable GetAllCategories() { var list = new List(); - const BindingFlags flags = BindingFlags.Static | BindingFlags.Public; - Regex r = new Regex(@"^U([a-fA-F0-9]*)_U([a-fA-F0-9]*)$"); - foreach (var property in typeof(unicode.Block).GetProperties(flags)) + using (var reader = new GZipResourceStream("Blocks.txt.gz")) { - Match m = r.Match(property.Name); - if (m.Success) + Regex r = new Regex(@"^([a-fA-F0-9]*)\.\.([a-fA-F0-9]*); ([A-Za-z0-9 \-]*)$"); + for (string l = reader.ReadLine(); l != null; l = reader.ReadLine()) { - var name = (string)property.GetValue(null, null); - var start = Convert.ToInt32(m.Groups[1].Value, 16); - var end = Convert.ToInt32(m.Groups[2].Value, 16); - list.Add(new CodepointCategory() { Name = name, RangeStart = start, RangeEnd = end }); + Match m = r.Match(l); + if (m.Success) + { + var start = Convert.ToInt32(m.Groups[1].Value, 16); + var end = Convert.ToInt32(m.Groups[2].Value, 16); + var name = (string)m.Groups[3].Value; + list.Add(new CodepointCategory() { Name = name, RangeStart = start, RangeEnd = end }); + } } } diff --git a/src/wincompose/wincompose.csproj b/src/wincompose/wincompose.csproj index 5a9dc9c6..b4be16c4 100644 --- a/src/wincompose/wincompose.csproj +++ b/src/wincompose/wincompose.csproj @@ -39,21 +39,25 @@ Inputs="..\3rdparty\xorgproto\include\X11\keysymdef.h ..\3rdparty\libx11\nls\en_US.UTF-8\Compose.pre ..\3rdparty\xcompose\dotXCompose - ..\3rdparty\unicode-emoji\emoji-test.txt" + ..\3rdparty\unicode-emoji\emoji-test.txt + ..\3rdparty\unicodetools\unicodetools\data\ucd\15.0.0\Blocks.txt" Outputs="$(OutputPath)\keysymdef.h.gz $(OutputPath)\xorg.rules.gz $(OutputPath)\xcompose.rules.gz - $(OutputPath)\emoji-test.txt.gz"> + $(OutputPath)\emoji-test.txt.gz + $(OutputPath)\Blocks.txt.gz"> + + @@ -86,6 +90,10 @@ false emoji-test.txt.gz + + false + Blocks.txt.gz +