summaryrefslogtreecommitdiffstats
path: root/src/libvterm/find-wide-chars.pl
diff options
context:
space:
mode:
Diffstat (limited to 'src/libvterm/find-wide-chars.pl')
-rw-r--r--src/libvterm/find-wide-chars.pl30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/libvterm/find-wide-chars.pl b/src/libvterm/find-wide-chars.pl
new file mode 100644
index 0000000..f7f2205
--- /dev/null
+++ b/src/libvterm/find-wide-chars.pl
@@ -0,0 +1,30 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+STDOUT->autoflush(1);
+
+sub iswide
+{
+ my ( $cp ) = @_;
+ return chr($cp) =~ m/\p{East_Asian_Width=Wide}|\p{East_Asian_Width=Fullwidth}/;
+}
+
+my ( $start, $end );
+foreach my $cp ( 0 .. 0x1FFFF ) {
+ iswide($cp) or next;
+
+ if( defined $end and $end == $cp-1 ) {
+ # extend the range
+ $end = $cp;
+ next;
+ }
+
+ # start a new range
+ printf " { %#04x, %#04x },\n", $start, $end if defined $start;
+
+ $start = $end = $cp;
+}
+
+printf " { %#04x, %#04x },\n", $start, $end if defined $start;