From 89efed6981c6d30e433dc6891c6fae8a50b7aaa5 Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Mon, 23 Dec 2024 13:43:18 -0500 Subject: [PATCH 1/6] Support Unicode-16 octant characters --- Project.toml | 2 +- src/core.jl | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/ndarray.jl | 2 ++ 3 files changed, 67 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 17185a3..ecc57ed 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "UnicodeGraphics" uuid = "ebadf6b4-db70-5817-83da-4a19ad584e34" authors = ["Rafael Schouten "] -version = "0.2.1" +version = "0.2.2" [compat] julia = "1.6" diff --git a/src/core.jl b/src/core.jl index 758811e..5d8464d 100644 --- a/src/core.jl +++ b/src/core.jl @@ -37,6 +37,70 @@ function to_block(io::IO, f::Function, A::AbstractMatrix) return nothing end +# These are the 256 Unicode-16 octant characters. Some "octants" are +# taken from other character ranges, e.g. quandrants. This needs to be +# an array because the character mapping is not regular. +# +# The array is stored according to the octant bit pattern: +# 0 1 +# 2 3 +# 4 5 +# 6 7 +const OCTANT_CHARS = Char[ + Char(0x0020),Char(0x1CEA8),Char(0x1CEAB),Char(0x1FB82),Char(0x1CD00),Char(0x2598),Char(0x1CD01),Char(0x1CD02), + Char(0x1CD03),Char(0x1CD04),Char(0x259D),Char(0x1CD05),Char(0x1CD06),Char(0x1CD07),Char(0x1CD08),Char(0x2580), + Char(0x1CD09),Char(0x1CD0A),Char(0x1CD0B),Char(0x1CD0C),Char(0x1FBE6),Char(0x1CD0D),Char(0x1CD0E),Char(0x1CD0F), + Char(0x1CD10),Char(0x1CD11),Char(0x1CD12),Char(0x1CD13),Char(0x1CD14),Char(0x1CD15),Char(0x1CD16),Char(0x1CD17), + Char(0x1CD18),Char(0x1CD19),Char(0x1CD1A),Char(0x1CD1B),Char(0x1CD1C),Char(0x1CD1D),Char(0x1CD1E),Char(0x1CD1F), + Char(0x1FBE7),Char(0x1CD20),Char(0x1CD21),Char(0x1CD22),Char(0x1CD23),Char(0x1CD24),Char(0x1CD25),Char(0x1CD26), + Char(0x1CD27),Char(0x1CD28),Char(0x1CD29),Char(0x1CD2A),Char(0x1CD2B),Char(0x1CD2C),Char(0x1CD2D),Char(0x1CD2E), + Char(0x1CD2F),Char(0x1CD30),Char(0x1CD31),Char(0x1CD32),Char(0x1CD33),Char(0x1CD34),Char(0x1CD35),Char(0x1FB85), + Char(0x1CEA3),Char(0x1CD36),Char(0x1CD37),Char(0x1CD38),Char(0x1CD39),Char(0x1CD3A),Char(0x1CD3B),Char(0x1CD3C), + Char(0x1CD3D),Char(0x1CD3E),Char(0x1CD3F),Char(0x1CD40),Char(0x1CD41),Char(0x1CD42),Char(0x1CD43),Char(0x1CD44), + Char(0x2596),Char(0x1CD45),Char(0x1CD46),Char(0x1CD47),Char(0x1CD48),Char(0x258C),Char(0x1CD49),Char(0x1CD4A), + Char(0x1CD4B),Char(0x1CD4C),Char(0x259E),Char(0x1CD4D),Char(0x1CD4E),Char(0x1CD4F),Char(0x1CD50),Char(0x259B), + Char(0x1CD51),Char(0x1CD52),Char(0x1CD53),Char(0x1CD54),Char(0x1CD55),Char(0x1CD56),Char(0x1CD57),Char(0x1CD58), + Char(0x1CD59),Char(0x1CD5A),Char(0x1CD5B),Char(0x1CD5C),Char(0x1CD5D),Char(0x1CD5E),Char(0x1CD5F),Char(0x1CD60), + Char(0x1CD61),Char(0x1CD62),Char(0x1CD63),Char(0x1CD64),Char(0x1CD65),Char(0x1CD66),Char(0x1CD67),Char(0x1CD68), + Char(0x1CD69),Char(0x1CD6A),Char(0x1CD6B),Char(0x1CD6C),Char(0x1CD6D),Char(0x1CD6E),Char(0x1CD6F),Char(0x1CD70), + Char(0x1CEA0),Char(0x1CD71),Char(0x1CD72),Char(0x1CD73),Char(0x1CD74),Char(0x1CD75),Char(0x1CD76),Char(0x1CD77), + Char(0x1CD78),Char(0x1CD79),Char(0x1CD7A),Char(0x1CD7B),Char(0x1CD7C),Char(0x1CD7D),Char(0x1CD7E),Char(0x1CD7F), + Char(0x1CD80),Char(0x1CD81),Char(0x1CD82),Char(0x1CD83),Char(0x1CD84),Char(0x1CD85),Char(0x1CD86),Char(0x1CD87), + Char(0x1CD88),Char(0x1CD89),Char(0x1CD8A),Char(0x1CD8B),Char(0x1CD8C),Char(0x1CD8D),Char(0x1CD8E),Char(0x1CD8F), + Char(0x2597),Char(0x1CD90),Char(0x1CD91),Char(0x1CD92),Char(0x1CD93),Char(0x259A),Char(0x1CD94),Char(0x1CD95), + Char(0x1CD96),Char(0x1CD97),Char(0x2590),Char(0x1CD98),Char(0x1CD99),Char(0x1CD9A),Char(0x1CD9B),Char(0x259C), + Char(0x1CD9C),Char(0x1CD9D),Char(0x1CD9E),Char(0x1CD9F),Char(0x1CDA0),Char(0x1CDA1),Char(0x1CDA2),Char(0x1CDA3), + Char(0x1CDA4),Char(0x1CDA5),Char(0x1CDA6),Char(0x1CDA7),Char(0x1CDA8),Char(0x1CDA9),Char(0x1CDAA),Char(0x1CDAB), + Char(0x2582),Char(0x1CDAC),Char(0x1CDAD),Char(0x1CDAE),Char(0x1CDAF),Char(0x1CDB0),Char(0x1CDB1),Char(0x1CDB2), + Char(0x1CDB3),Char(0x1CDB4),Char(0x1CDB5),Char(0x1CDB6),Char(0x1CDB7),Char(0x1CDB8),Char(0x1CDB9),Char(0x1CDBA), + Char(0x1CDBB),Char(0x1CDBC),Char(0x1CDBD),Char(0x1CDBE),Char(0x1CDBF),Char(0x1CDC0),Char(0x1CDC1),Char(0x1CDC2), + Char(0x1CDC3),Char(0x1CDC4),Char(0x1CDC5),Char(0x1CDC6),Char(0x1CDC7),Char(0x1CDC8),Char(0x1CDC9),Char(0x1CDCA), + Char(0x1CDCB),Char(0x1CDCC),Char(0x1CDCD),Char(0x1CDCE),Char(0x1CDCF),Char(0x1CDD0),Char(0x1CDD1),Char(0x1CDD2), + Char(0x1CDD3),Char(0x1CDD4),Char(0x1CDD5),Char(0x1CDD6),Char(0x1CDD7),Char(0x1CDD8),Char(0x1CDD9),Char(0x1CDDA), + Char(0x2584),Char(0x1CDDB),Char(0x1CDDC),Char(0x1CDDD),Char(0x1CDDE),Char(0x2599),Char(0x1CDDF),Char(0x1CDE0), + Char(0x1CDE1),Char(0x1CDE2),Char(0x259F),Char(0x1CDE3),Char(0x2586),Char(0x1CDE4),Char(0x1CDE5),Char(0x2588), +] + +function to_octant(io::IO, f::Function, A::AbstractMatrix) + h, w = axes(A) + yrange = first(h):4:last(h) + xrange = first(w):2:last(w) + for y in yrange + for x in xrange + index = 1 + for row in 0:3, col in 0:1 + if checkval(f, A, y + row, x + col, h, w) + bit = 1 << (col + 2 * row) + index += bit + end + end + print(io, OCTANT_CHARS[index]) + end + println(io) + end + return nothing +end + @inline function checkval(f, a, y, x, yrange, xrange) x > last(xrange) && return false y > last(yrange) && return false diff --git a/src/ndarray.jl b/src/ndarray.jl index 0bba3cc..8a876f4 100644 --- a/src/ndarray.jl +++ b/src/ndarray.jl @@ -4,6 +4,8 @@ function _uprint_nd(io::IO, f::Function, A::AbstractMatrix, method::Symbol) to_braille(io, f, A) elseif method == :block to_block(io, f, A) + elseif method == :octant + to_octant(io, f, A) else throw(ArgumentError("Valid methods are :braille and :block, got :$method.")) end From c81fcd1d46f1e6417c2985bcf341d7305514d15e Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Mon, 23 Dec 2024 14:21:04 -0500 Subject: [PATCH 2/6] Update README and tests --- README.md | 7 +++++++ test/references/octant_ghost.txt | 4 ++++ test/references/octant_pac.txt | 5 +++++ test/runtests.jl | 2 ++ 4 files changed, 18 insertions(+) create mode 100644 test/references/octant_ghost.txt create mode 100644 test/references/octant_pac.txt diff --git a/README.md b/README.md index 2bf21ae..0771ff4 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,13 @@ julia> uprint(pac, :block) ▀█████████████████ ▀██████████████▀ ▀▀██████▀▀ + +julia> uprint(pac, :octant) + 𜷋𜷡𜷥██𜷤𜷞𜶻 +𜷓███▙▟█𜵰𜴗▘ +█████𜷂𜴶 𜴘 +𜴢██████𜷤𜷞▖ + 𜴅𜴦𜶫██𜵰𜴗𜴂 ``` When passing a filtering function, diff --git a/test/references/octant_ghost.txt b/test/references/octant_ghost.txt new file mode 100644 index 0000000..d3e650f --- /dev/null +++ b/test/references/octant_ghost.txt @@ -0,0 +1,4 @@ +𜺠𜴯𜷥█𜴴𜷞𜺣 +𜷡🯦𜷕𜷤🯦𜷕▙ +█𜶫█🮅█𜵰█ +𜺨 🮂 🮂 𜺫 diff --git a/test/references/octant_pac.txt b/test/references/octant_pac.txt new file mode 100644 index 0000000..eadfed3 --- /dev/null +++ b/test/references/octant_pac.txt @@ -0,0 +1,5 @@ + 𜷋𜷡𜷥██𜷤𜷞𜶻 +𜷓███▙▟█𜵰𜴗▘ +█████𜷂𜴶 𜴘 +𜴢██████𜷤𜷞▖ + 𜴅𜴦𜶫██𜵰𜴗𜴂 diff --git a/test/runtests.jl b/test/runtests.jl index 9d315ae..44f3971 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -74,8 +74,10 @@ ghost2 = [ @test_reference "references/braille_ghost.txt" ustring(iseven, ghost2) @test_reference "references/block_ghost.txt" ustring(iseven, ghost2, :block) +@test_reference "references/octant_ghost.txt" ustring(iseven, ghost2, :octant) @test_reference "references/braille_ghost.txt" @capture_out uprint(iseven, ghost2) @test_reference "references/block_ghost.txt" @capture_out uprint(iseven, ghost2, :block) +@test_reference "references/octant_ghost.txt" @capture_out uprint(iseven, ghost2, :octant) # Test vector and n-dimensional arrays v = [0, 1, 0, 1, 1, 0, 0, 1] From 2e7b828e83120b24e82b095dd0f838223bb9247b Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Mon, 30 Dec 2024 11:17:52 -0500 Subject: [PATCH 3/6] Add quadrant and sextant modes --- src/core.jl | 426 +++++++++++++++++++++++++++++++++++++++++++++---- src/ndarray.jl | 4 + 2 files changed, 396 insertions(+), 34 deletions(-) diff --git a/src/core.jl b/src/core.jl index 5d8464d..bf71a29 100644 --- a/src/core.jl +++ b/src/core.jl @@ -37,6 +37,142 @@ function to_block(io::IO, f::Function, A::AbstractMatrix) return nothing end +# These are the 16 Unicode quadrant characters. +# +# The array is stored according to the octant bit pattern: +# 0 1 +# 2 3 +# 4 5 +# 6 7 +const QUADRANT_CHARS = Char[0x00A0, # NO-BREAK SPACE + 0x2598, # QUADRANT UPPER LEFT + 0x259D, # QUADRANT UPPER RIGHT + 0x2580, # UPPER HALF BLOCK + 0x2596, # QUADRANT LOWER LEFT + 0x258C, # LEFT HALF BLOCK + 0x259E, # QUADRANT UPPER RIGHT AND LOWER LEFT + 0x259B, # QUADRANT UPPER LEFT AND UPPER RIGHT AND LOWER LEFT + 0x2597, # QUADRANT LOWER RIGHT + 0x259A, # QUADRANT UPPER LEFT AND LOWER RIGHT + 0x2590, # RIGHT HALF BLOCK + 0x259C, # QUADRANT UPPER LEFT AND UPPER RIGHT AND LOWER RIGHT + 0x2584, # LOWER HALF BLOCK + 0x2599, # QUADRANT UPPER LEFT AND LOWER LEFT AND LOWER RIGHT + 0x259F, # QUADRANT UPPER RIGHT AND LOWER LEFT AND LOWER RIGHT + 0x2588] # FULL BLOCK + +function to_quadrant(io::IO, f::Function, A::AbstractMatrix) + h, w = axes(A) + yrange = first(h):2:last(h) + xrange = first(w):2:last(w) + for y in yrange + for x in xrange + index = 1 + for row in 0:1, col in 0:1 + if checkval(f, A, y + row, x + col, h, w) + bit = 1 << (col + 2 * row) + index += bit + end + end + print(io, QUADRANT_CHARS[index]) + end + println(io) + end + return nothing +end + +# These are the 64 Unicode sextant characters. This needs to be an +# array because the character mapping is not regular. +# +# The array is stored according to this sextant bit pattern: +# 0 1 +# 2 3 +# 4 5 +const SEXTANT_CHARS = Char[0x00000A0, # NO-BREAK SPACE + 0x001FB00, # BLOCK SEXTANT-1 + 0x001FB01, # BLOCK SEXTANT-2 + 0x001FB02, # BLOCK SEXTANT-12 + 0x001FB03, # BLOCK SEXTANT-3 + 0x001FB04, # BLOCK SEXTANT-13 + 0x001FB05, # BLOCK SEXTANT-23 + 0x001FB06, # BLOCK SEXTANT-123 + 0x001FB07, # BLOCK SEXTANT-4 + 0x001FB08, # BLOCK SEXTANT-14 + 0x001FB09, # BLOCK SEXTANT-24 + 0x001FB0A, # BLOCK SEXTANT-124 + 0x001FB0B, # BLOCK SEXTANT-34 + 0x001FB0C, # BLOCK SEXTANT-134 + 0x001FB0D, # BLOCK SEXTANT-234 + 0x001FB0E, # BLOCK SEXTANT-1234 + 0x001FB0F, # BLOCK SEXTANT-5 + 0x001FB10, # BLOCK SEXTANT-15 + 0x001FB11, # BLOCK SEXTANT-25 + 0x001FB12, # BLOCK SEXTANT-125 + 0x001FB13, # BLOCK SEXTANT-35 + 0x000258C, # LEFT HALF BLOCK + 0x001FB14, # BLOCK SEXTANT-235 + 0x001FB15, # BLOCK SEXTANT-1235 + 0x001FB16, # BLOCK SEXTANT-45 + 0x001FB17, # BLOCK SEXTANT-145 + 0x001FB18, # BLOCK SEXTANT-245 + 0x001FB19, # BLOCK SEXTANT-1245 + 0x001FB1A, # BLOCK SEXTANT-345 + 0x001FB1B, # BLOCK SEXTANT-1345 + 0x001FB1C, # BLOCK SEXTANT-2345 + 0x001FB1D, # BLOCK SEXTANT-12345 + 0x001FB1E, # BLOCK SEXTANT-6 + 0x001FB1F, # BLOCK SEXTANT-16 + 0x001FB20, # BLOCK SEXTANT-26 + 0x001FB21, # BLOCK SEXTANT-126 + 0x001FB22, # BLOCK SEXTANT-36 + 0x001FB23, # BLOCK SEXTANT-136 + 0x001FB24, # BLOCK SEXTANT-236 + 0x001FB25, # BLOCK SEXTANT-1236 + 0x001FB26, # BLOCK SEXTANT-46 + 0x001FB27, # BLOCK SEXTANT-146 + 0x0002590, # RIGHT HALF BLOCK + 0x001FB28, # BLOCK SEXTANT-1246 + 0x001FB29, # BLOCK SEXTANT-346 + 0x001FB2A, # BLOCK SEXTANT-1346 + 0x001FB2B, # BLOCK SEXTANT-2346 + 0x001FB2C, # BLOCK SEXTANT-12346 + 0x001FB2D, # BLOCK SEXTANT-56 + 0x001FB2E, # BLOCK SEXTANT-156 + 0x001FB2F, # BLOCK SEXTANT-256 + 0x001FB30, # BLOCK SEXTANT-1256 + 0x001FB31, # BLOCK SEXTANT-356 + 0x001FB32, # BLOCK SEXTANT-1356 + 0x001FB33, # BLOCK SEXTANT-2356 + 0x001FB34, # BLOCK SEXTANT-12356 + 0x001FB35, # BLOCK SEXTANT-456 + 0x001FB36, # BLOCK SEXTANT-1456 + 0x001FB37, # BLOCK SEXTANT-2456 + 0x001FB38, # BLOCK SEXTANT-12456 + 0x001FB39, # BLOCK SEXTANT-3456 + 0x001FB3A, # BLOCK SEXTANT-13456 + 0x001FB3B, # BLOCK SEXTANT-23456 + 0x00002588] # FULL BLOCK + +function to_sextant(io::IO, f::Function, A::AbstractMatrix) + h, w = axes(A) + yrange = first(h):3:last(h) + xrange = first(w):2:last(w) + for y in yrange + for x in xrange + index = 1 + for row in 0:2, col in 0:1 + if checkval(f, A, y + row, x + col, h, w) + bit = 1 << (col + 2 * row) + index += bit + end + end + print(io, SEXTANT_CHARS[index]) + end + println(io) + end + return nothing +end + # These are the 256 Unicode-16 octant characters. Some "octants" are # taken from other character ranges, e.g. quandrants. This needs to be # an array because the character mapping is not regular. @@ -46,40 +182,262 @@ end # 2 3 # 4 5 # 6 7 -const OCTANT_CHARS = Char[ - Char(0x0020),Char(0x1CEA8),Char(0x1CEAB),Char(0x1FB82),Char(0x1CD00),Char(0x2598),Char(0x1CD01),Char(0x1CD02), - Char(0x1CD03),Char(0x1CD04),Char(0x259D),Char(0x1CD05),Char(0x1CD06),Char(0x1CD07),Char(0x1CD08),Char(0x2580), - Char(0x1CD09),Char(0x1CD0A),Char(0x1CD0B),Char(0x1CD0C),Char(0x1FBE6),Char(0x1CD0D),Char(0x1CD0E),Char(0x1CD0F), - Char(0x1CD10),Char(0x1CD11),Char(0x1CD12),Char(0x1CD13),Char(0x1CD14),Char(0x1CD15),Char(0x1CD16),Char(0x1CD17), - Char(0x1CD18),Char(0x1CD19),Char(0x1CD1A),Char(0x1CD1B),Char(0x1CD1C),Char(0x1CD1D),Char(0x1CD1E),Char(0x1CD1F), - Char(0x1FBE7),Char(0x1CD20),Char(0x1CD21),Char(0x1CD22),Char(0x1CD23),Char(0x1CD24),Char(0x1CD25),Char(0x1CD26), - Char(0x1CD27),Char(0x1CD28),Char(0x1CD29),Char(0x1CD2A),Char(0x1CD2B),Char(0x1CD2C),Char(0x1CD2D),Char(0x1CD2E), - Char(0x1CD2F),Char(0x1CD30),Char(0x1CD31),Char(0x1CD32),Char(0x1CD33),Char(0x1CD34),Char(0x1CD35),Char(0x1FB85), - Char(0x1CEA3),Char(0x1CD36),Char(0x1CD37),Char(0x1CD38),Char(0x1CD39),Char(0x1CD3A),Char(0x1CD3B),Char(0x1CD3C), - Char(0x1CD3D),Char(0x1CD3E),Char(0x1CD3F),Char(0x1CD40),Char(0x1CD41),Char(0x1CD42),Char(0x1CD43),Char(0x1CD44), - Char(0x2596),Char(0x1CD45),Char(0x1CD46),Char(0x1CD47),Char(0x1CD48),Char(0x258C),Char(0x1CD49),Char(0x1CD4A), - Char(0x1CD4B),Char(0x1CD4C),Char(0x259E),Char(0x1CD4D),Char(0x1CD4E),Char(0x1CD4F),Char(0x1CD50),Char(0x259B), - Char(0x1CD51),Char(0x1CD52),Char(0x1CD53),Char(0x1CD54),Char(0x1CD55),Char(0x1CD56),Char(0x1CD57),Char(0x1CD58), - Char(0x1CD59),Char(0x1CD5A),Char(0x1CD5B),Char(0x1CD5C),Char(0x1CD5D),Char(0x1CD5E),Char(0x1CD5F),Char(0x1CD60), - Char(0x1CD61),Char(0x1CD62),Char(0x1CD63),Char(0x1CD64),Char(0x1CD65),Char(0x1CD66),Char(0x1CD67),Char(0x1CD68), - Char(0x1CD69),Char(0x1CD6A),Char(0x1CD6B),Char(0x1CD6C),Char(0x1CD6D),Char(0x1CD6E),Char(0x1CD6F),Char(0x1CD70), - Char(0x1CEA0),Char(0x1CD71),Char(0x1CD72),Char(0x1CD73),Char(0x1CD74),Char(0x1CD75),Char(0x1CD76),Char(0x1CD77), - Char(0x1CD78),Char(0x1CD79),Char(0x1CD7A),Char(0x1CD7B),Char(0x1CD7C),Char(0x1CD7D),Char(0x1CD7E),Char(0x1CD7F), - Char(0x1CD80),Char(0x1CD81),Char(0x1CD82),Char(0x1CD83),Char(0x1CD84),Char(0x1CD85),Char(0x1CD86),Char(0x1CD87), - Char(0x1CD88),Char(0x1CD89),Char(0x1CD8A),Char(0x1CD8B),Char(0x1CD8C),Char(0x1CD8D),Char(0x1CD8E),Char(0x1CD8F), - Char(0x2597),Char(0x1CD90),Char(0x1CD91),Char(0x1CD92),Char(0x1CD93),Char(0x259A),Char(0x1CD94),Char(0x1CD95), - Char(0x1CD96),Char(0x1CD97),Char(0x2590),Char(0x1CD98),Char(0x1CD99),Char(0x1CD9A),Char(0x1CD9B),Char(0x259C), - Char(0x1CD9C),Char(0x1CD9D),Char(0x1CD9E),Char(0x1CD9F),Char(0x1CDA0),Char(0x1CDA1),Char(0x1CDA2),Char(0x1CDA3), - Char(0x1CDA4),Char(0x1CDA5),Char(0x1CDA6),Char(0x1CDA7),Char(0x1CDA8),Char(0x1CDA9),Char(0x1CDAA),Char(0x1CDAB), - Char(0x2582),Char(0x1CDAC),Char(0x1CDAD),Char(0x1CDAE),Char(0x1CDAF),Char(0x1CDB0),Char(0x1CDB1),Char(0x1CDB2), - Char(0x1CDB3),Char(0x1CDB4),Char(0x1CDB5),Char(0x1CDB6),Char(0x1CDB7),Char(0x1CDB8),Char(0x1CDB9),Char(0x1CDBA), - Char(0x1CDBB),Char(0x1CDBC),Char(0x1CDBD),Char(0x1CDBE),Char(0x1CDBF),Char(0x1CDC0),Char(0x1CDC1),Char(0x1CDC2), - Char(0x1CDC3),Char(0x1CDC4),Char(0x1CDC5),Char(0x1CDC6),Char(0x1CDC7),Char(0x1CDC8),Char(0x1CDC9),Char(0x1CDCA), - Char(0x1CDCB),Char(0x1CDCC),Char(0x1CDCD),Char(0x1CDCE),Char(0x1CDCF),Char(0x1CDD0),Char(0x1CDD1),Char(0x1CDD2), - Char(0x1CDD3),Char(0x1CDD4),Char(0x1CDD5),Char(0x1CDD6),Char(0x1CDD7),Char(0x1CDD8),Char(0x1CDD9),Char(0x1CDDA), - Char(0x2584),Char(0x1CDDB),Char(0x1CDDC),Char(0x1CDDD),Char(0x1CDDE),Char(0x2599),Char(0x1CDDF),Char(0x1CDE0), - Char(0x1CDE1),Char(0x1CDE2),Char(0x259F),Char(0x1CDE3),Char(0x2586),Char(0x1CDE4),Char(0x1CDE5),Char(0x2588), -] +const OCTANT_CHARS = Char[0x000000A0, # NO-BREAK SPACE + 0x0001CEA8, # LEFT HALF UPPER ONE QUARTER BLOCK + 0x0001CEAB, # RIGHT HALF UPPER ONE QUARTER BLOCK + 0x0001FB82, # UPPER ONE QUARTER BLOCK + 0x0001CD00, # BLOCK OCTANT-3 + 0x00002598, # QUADRANT UPPER LEFT + 0x0001CD01, # BLOCK OCTANT-23 + 0x0001CD02, # BLOCK OCTANT-123 + 0x0001CD03, # BLOCK OCTANT-4 + 0x0001CD04, # BLOCK OCTANT-14 + 0x0000259D, # QUADRANT UPPER RIGHT + 0x0001CD05, # BLOCK OCTANT-124 + 0x0001CD06, # BLOCK OCTANT-34 + 0x0001CD07, # BLOCK OCTANT-134 + 0x0001CD08, # BLOCK OCTANT-234 + 0x00002580, # UPPER HALF BLOCK + 0x0001CD09, # BLOCK OCTANT-5 + 0x0001CD0A, # BLOCK OCTANT-15 + 0x0001CD0B, # BLOCK OCTANT-25 + 0x0001CD0C, # BLOCK OCTANT-125 + 0x0001FBE6, # MIDDLE LEFT ONE QUARTER BLOCK + 0x0001CD0D, # BLOCK OCTANT-135 + 0x0001CD0E, # BLOCK OCTANT-235 + 0x0001CD0F, # BLOCK OCTANT-1235 + 0x0001CD10, # BLOCK OCTANT-45 + 0x0001CD11, # BLOCK OCTANT-145 + 0x0001CD12, # BLOCK OCTANT-245 + 0x0001CD13, # BLOCK OCTANT-1245 + 0x0001CD14, # BLOCK OCTANT-345 + 0x0001CD15, # BLOCK OCTANT-1345 + 0x0001CD16, # BLOCK OCTANT-2345 + 0x0001CD17, # BLOCK OCTANT-12345 + 0x0001CD18, # BLOCK OCTANT-6 + 0x0001CD19, # BLOCK OCTANT-16 + 0x0001CD1A, # BLOCK OCTANT-26 + 0x0001CD1B, # BLOCK OCTANT-126 + 0x0001CD1C, # BLOCK OCTANT-36 + 0x0001CD1D, # BLOCK OCTANT-136 + 0x0001CD1E, # BLOCK OCTANT-236 + 0x0001CD1F, # BLOCK OCTANT-1236 + 0x0001FBE7, # MIDDLE RIGHT ONE QUARTER BLOCK + 0x0001CD20, # BLOCK OCTANT-146 + 0x0001CD21, # BLOCK OCTANT-246 + 0x0001CD22, # BLOCK OCTANT-1246 + 0x0001CD23, # BLOCK OCTANT-346 + 0x0001CD24, # BLOCK OCTANT-1346 + 0x0001CD25, # BLOCK OCTANT-2346 + 0x0001CD26, # BLOCK OCTANT-12346 + 0x0001CD27, # BLOCK OCTANT-56 + 0x0001CD28, # BLOCK OCTANT-156 + 0x0001CD29, # BLOCK OCTANT-256 + 0x0001CD2A, # BLOCK OCTANT-1256 + 0x0001CD2B, # BLOCK OCTANT-356 + 0x0001CD2C, # BLOCK OCTANT-1356 + 0x0001CD2D, # BLOCK OCTANT-2356 + 0x0001CD2E, # BLOCK OCTANT-12356 + 0x0001CD2F, # BLOCK OCTANT-456 + 0x0001CD30, # BLOCK OCTANT-1456 + 0x0001CD31, # BLOCK OCTANT-2456 + 0x0001CD32, # BLOCK OCTANT-12456 + 0x0001CD33, # BLOCK OCTANT-3456 + 0x0001CD34, # BLOCK OCTANT-13456 + 0x0001CD35, # BLOCK OCTANT-23456 + 0x0001FB85, # UPPER THREE QUARTERS BLOCK + 0x0001CEA3, # LEFT HALF LOWER ONE QUARTER BLOCK + 0x0001CD36, # BLOCK OCTANT-17 + 0x0001CD37, # BLOCK OCTANT-27 + 0x0001CD38, # BLOCK OCTANT-127 + 0x0001CD39, # BLOCK OCTANT-37 + 0x0001CD3A, # BLOCK OCTANT-137 + 0x0001CD3B, # BLOCK OCTANT-237 + 0x0001CD3C, # BLOCK OCTANT-1237 + 0x0001CD3D, # BLOCK OCTANT-47 + 0x0001CD3E, # BLOCK OCTANT-147 + 0x0001CD3F, # BLOCK OCTANT-247 + 0x0001CD40, # BLOCK OCTANT-1247 + 0x0001CD41, # BLOCK OCTANT-347 + 0x0001CD42, # BLOCK OCTANT-1347 + 0x0001CD43, # BLOCK OCTANT-2347 + 0x0001CD44, # BLOCK OCTANT-12347 + 0x00002596, # QUADRANT LOWER LEFT + 0x0001CD45, # BLOCK OCTANT-157 + 0x0001CD46, # BLOCK OCTANT-257 + 0x0001CD47, # BLOCK OCTANT-1257 + 0x0001CD48, # BLOCK OCTANT-357 + 0x0000258C, # LEFT HALF BLOCK + 0x0001CD49, # BLOCK OCTANT-2357 + 0x0001CD4A, # BLOCK OCTANT-12357 + 0x0001CD4B, # BLOCK OCTANT-457 + 0x0001CD4C, # BLOCK OCTANT-1457 + 0x0000259E, # QUADRANT UPPER RIGHT AND LOWER LEFT + 0x0001CD4D, # BLOCK OCTANT-12457 + 0x0001CD4E, # BLOCK OCTANT-3457 + 0x0001CD4F, # BLOCK OCTANT-13457 + 0x0001CD50, # BLOCK OCTANT-23457 + 0x0000259B, # QUADRANT UPPER LEFT AND UPPER RIGHT AND LOWER LEFT + 0x0001CD51, # BLOCK OCTANT-67 + 0x0001CD52, # BLOCK OCTANT-167 + 0x0001CD53, # BLOCK OCTANT-267 + 0x0001CD54, # BLOCK OCTANT-1267 + 0x0001CD55, # BLOCK OCTANT-367 + 0x0001CD56, # BLOCK OCTANT-1367 + 0x0001CD57, # BLOCK OCTANT-2367 + 0x0001CD58, # BLOCK OCTANT-12367 + 0x0001CD59, # BLOCK OCTANT-467 + 0x0001CD5A, # BLOCK OCTANT-1467 + 0x0001CD5B, # BLOCK OCTANT-2467 + 0x0001CD5C, # BLOCK OCTANT-12467 + 0x0001CD5D, # BLOCK OCTANT-3467 + 0x0001CD5E, # BLOCK OCTANT-13467 + 0x0001CD5F, # BLOCK OCTANT-23467 + 0x0001CD60, # BLOCK OCTANT-123467 + 0x0001CD61, # BLOCK OCTANT-567 + 0x0001CD62, # BLOCK OCTANT-1567 + 0x0001CD63, # BLOCK OCTANT-2567 + 0x0001CD64, # BLOCK OCTANT-12567 + 0x0001CD65, # BLOCK OCTANT-3567 + 0x0001CD66, # BLOCK OCTANT-13567 + 0x0001CD67, # BLOCK OCTANT-23567 + 0x0001CD68, # BLOCK OCTANT-123567 + 0x0001CD69, # BLOCK OCTANT-4567 + 0x0001CD6A, # BLOCK OCTANT-14567 + 0x0001CD6B, # BLOCK OCTANT-24567 + 0x0001CD6C, # BLOCK OCTANT-124567 + 0x0001CD6D, # BLOCK OCTANT-34567 + 0x0001CD6E, # BLOCK OCTANT-134567 + 0x0001CD6F, # BLOCK OCTANT-234567 + 0x0001CD70, # BLOCK OCTANT-1234567 + 0x0001CEA0, # RIGHT HALF LOWER ONE QUARTER BLOCK + 0x0001CD71, # BLOCK OCTANT-18 + 0x0001CD72, # BLOCK OCTANT-28 + 0x0001CD73, # BLOCK OCTANT-128 + 0x0001CD74, # BLOCK OCTANT-38 + 0x0001CD75, # BLOCK OCTANT-138 + 0x0001CD76, # BLOCK OCTANT-238 + 0x0001CD77, # BLOCK OCTANT-1238 + 0x0001CD78, # BLOCK OCTANT-48 + 0x0001CD79, # BLOCK OCTANT-148 + 0x0001CD7A, # BLOCK OCTANT-248 + 0x0001CD7B, # BLOCK OCTANT-1248 + 0x0001CD7C, # BLOCK OCTANT-348 + 0x0001CD7D, # BLOCK OCTANT-1348 + 0x0001CD7E, # BLOCK OCTANT-2348 + 0x0001CD7F, # BLOCK OCTANT-12348 + 0x0001CD80, # BLOCK OCTANT-58 + 0x0001CD81, # BLOCK OCTANT-158 + 0x0001CD82, # BLOCK OCTANT-258 + 0x0001CD83, # BLOCK OCTANT-1258 + 0x0001CD84, # BLOCK OCTANT-358 + 0x0001CD85, # BLOCK OCTANT-1358 + 0x0001CD86, # BLOCK OCTANT-2358 + 0x0001CD87, # BLOCK OCTANT-12358 + 0x0001CD88, # BLOCK OCTANT-458 + 0x0001CD89, # BLOCK OCTANT-1458 + 0x0001CD8A, # BLOCK OCTANT-2458 + 0x0001CD8B, # BLOCK OCTANT-12458 + 0x0001CD8C, # BLOCK OCTANT-3458 + 0x0001CD8D, # BLOCK OCTANT-13458 + 0x0001CD8E, # BLOCK OCTANT-23458 + 0x0001CD8F, # BLOCK OCTANT-123458 + 0x00002597, # QUADRANT LOWER RIGHT + 0x0001CD90, # BLOCK OCTANT-168 + 0x0001CD91, # BLOCK OCTANT-268 + 0x0001CD92, # BLOCK OCTANT-1268 + 0x0001CD93, # BLOCK OCTANT-368 + 0x0000259A, # QUADRANT UPPER LEFT AND LOWER RIGHT + 0x0001CD94, # BLOCK OCTANT-2368 + 0x0001CD95, # BLOCK OCTANT-12368 + 0x0001CD96, # BLOCK OCTANT-468 + 0x0001CD97, # BLOCK OCTANT-1468 + 0x00002590, # RIGHT HALF BLOCK + 0x0001CD98, # BLOCK OCTANT-12468 + 0x0001CD99, # BLOCK OCTANT-3468 + 0x0001CD9A, # BLOCK OCTANT-13468 + 0x0001CD9B, # BLOCK OCTANT-23468 + 0x0000259C, # QUADRANT UPPER LEFT AND UPPER RIGHT AND LOWER RIGHT + 0x0001CD9C, # BLOCK OCTANT-568 + 0x0001CD9D, # BLOCK OCTANT-1568 + 0x0001CD9E, # BLOCK OCTANT-2568 + 0x0001CD9F, # BLOCK OCTANT-12568 + 0x0001CDA0, # BLOCK OCTANT-3568 + 0x0001CDA1, # BLOCK OCTANT-13568 + 0x0001CDA2, # BLOCK OCTANT-23568 + 0x0001CDA3, # BLOCK OCTANT-123568 + 0x0001CDA4, # BLOCK OCTANT-4568 + 0x0001CDA5, # BLOCK OCTANT-14568 + 0x0001CDA6, # BLOCK OCTANT-24568 + 0x0001CDA7, # BLOCK OCTANT-124568 + 0x0001CDA8, # BLOCK OCTANT-34568 + 0x0001CDA9, # BLOCK OCTANT-134568 + 0x0001CDAA, # BLOCK OCTANT-234568 + 0x0001CDAB, # BLOCK OCTANT-1234568 + 0x00002582, # LOWER ONE QUARTER BLOCK + 0x0001CDAC, # BLOCK OCTANT-178 + 0x0001CDAD, # BLOCK OCTANT-278 + 0x0001CDAE, # BLOCK OCTANT-1278 + 0x0001CDAF, # BLOCK OCTANT-378 + 0x0001CDB0, # BLOCK OCTANT-1378 + 0x0001CDB1, # BLOCK OCTANT-2378 + 0x0001CDB2, # BLOCK OCTANT-12378 + 0x0001CDB3, # BLOCK OCTANT-478 + 0x0001CDB4, # BLOCK OCTANT-1478 + 0x0001CDB5, # BLOCK OCTANT-2478 + 0x0001CDB6, # BLOCK OCTANT-12478 + 0x0001CDB7, # BLOCK OCTANT-3478 + 0x0001CDB8, # BLOCK OCTANT-13478 + 0x0001CDB9, # BLOCK OCTANT-23478 + 0x0001CDBA, # BLOCK OCTANT-123478 + 0x0001CDBB, # BLOCK OCTANT-578 + 0x0001CDBC, # BLOCK OCTANT-1578 + 0x0001CDBD, # BLOCK OCTANT-2578 + 0x0001CDBE, # BLOCK OCTANT-12578 + 0x0001CDBF, # BLOCK OCTANT-3578 + 0x0001CDC0, # BLOCK OCTANT-13578 + 0x0001CDC1, # BLOCK OCTANT-23578 + 0x0001CDC2, # BLOCK OCTANT-123578 + 0x0001CDC3, # BLOCK OCTANT-4578 + 0x0001CDC4, # BLOCK OCTANT-14578 + 0x0001CDC5, # BLOCK OCTANT-24578 + 0x0001CDC6, # BLOCK OCTANT-124578 + 0x0001CDC7, # BLOCK OCTANT-34578 + 0x0001CDC8, # BLOCK OCTANT-134578 + 0x0001CDC9, # BLOCK OCTANT-234578 + 0x0001CDCA, # BLOCK OCTANT-1234578 + 0x0001CDCB, # BLOCK OCTANT-678 + 0x0001CDCC, # BLOCK OCTANT-1678 + 0x0001CDCD, # BLOCK OCTANT-2678 + 0x0001CDCE, # BLOCK OCTANT-12678 + 0x0001CDCF, # BLOCK OCTANT-3678 + 0x0001CDD0, # BLOCK OCTANT-13678 + 0x0001CDD1, # BLOCK OCTANT-23678 + 0x0001CDD2, # BLOCK OCTANT-123678 + 0x0001CDD3, # BLOCK OCTANT-4678 + 0x0001CDD4, # BLOCK OCTANT-14678 + 0x0001CDD5, # BLOCK OCTANT-24678 + 0x0001CDD6, # BLOCK OCTANT-124678 + 0x0001CDD7, # BLOCK OCTANT-34678 + 0x0001CDD8, # BLOCK OCTANT-134678 + 0x0001CDD9, # BLOCK OCTANT-234678 + 0x0001CDDA, # BLOCK OCTANT-1234678 + 0x00002584, # LOWER HALF BLOCK + 0x0001CDDB, # BLOCK OCTANT-15678 + 0x0001CDDC, # BLOCK OCTANT-25678 + 0x0001CDDD, # BLOCK OCTANT-125678 + 0x0001CDDE, # BLOCK OCTANT-35678 + 0x00002599, # QUADRANT UPPER LEFT AND LOWER LEFT AND LOWER RIGHT + 0x0001CDDF, # BLOCK OCTANT-235678 + 0x0001CDE0, # BLOCK OCTANT-1235678 + 0x0001CDE1, # BLOCK OCTANT-45678 + 0x0001CDE2, # BLOCK OCTANT-145678 + 0x0000259F, # QUADRANT UPPER RIGHT AND LOWER LEFT AND LOWER RIGHT + 0x0001CDE3, # BLOCK OCTANT-1245678 + 0x00002586, # LOWER THREE QUARTERS BLOCK + 0x0001CDE4, # BLOCK OCTANT-1345678 + 0x0001CDE5, # BLOCK OCTANT-2345678 + 0x00002588] # FULL BLOCK function to_octant(io::IO, f::Function, A::AbstractMatrix) h, w = axes(A) diff --git a/src/ndarray.jl b/src/ndarray.jl index 8a876f4..8816f71 100644 --- a/src/ndarray.jl +++ b/src/ndarray.jl @@ -4,6 +4,10 @@ function _uprint_nd(io::IO, f::Function, A::AbstractMatrix, method::Symbol) to_braille(io, f, A) elseif method == :block to_block(io, f, A) + elseif method == :quadrant + to_quadrant(io, f, A) + elseif method == :sextant + to_sextant(io, f, A) elseif method == :octant to_octant(io, f, A) else From e98b7c7caaf9eb8c8cf00bd9ccf1b89bbc3165ee Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Mon, 30 Dec 2024 11:34:16 -0500 Subject: [PATCH 4/6] Add quadrant and sextant test cases --- test/references/octant_ghost.txt | 2 +- test/references/quadrant_ghost.txt | 7 +++++++ test/references/sextant_ghost.txt | 5 +++++ test/runtests.jl | 4 ++++ 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 test/references/quadrant_ghost.txt create mode 100644 test/references/sextant_ghost.txt diff --git a/test/references/octant_ghost.txt b/test/references/octant_ghost.txt index d3e650f..78a2281 100644 --- a/test/references/octant_ghost.txt +++ b/test/references/octant_ghost.txt @@ -1,4 +1,4 @@ 𜺠𜴯𜷥█𜴴𜷞𜺣 𜷡🯦𜷕𜷤🯦𜷕▙ █𜶫█🮅█𜵰█ -𜺨 🮂 🮂 𜺫 +𜺨 🮂 🮂 𜺫 diff --git a/test/references/quadrant_ghost.txt b/test/references/quadrant_ghost.txt new file mode 100644 index 0000000..da4e333 --- /dev/null +++ b/test/references/quadrant_ghost.txt @@ -0,0 +1,7 @@ + ▗▟█▙▖  +▗▀██▀█▖ +▗▖▐▙▖▐▌ +█▘▟█▘▟█ +███████ +█▜█▀█▛█ +▘ ▀ ▀ ▝ diff --git a/test/references/sextant_ghost.txt b/test/references/sextant_ghost.txt new file mode 100644 index 0000000..363e48a --- /dev/null +++ b/test/references/sextant_ghost.txt @@ -0,0 +1,5 @@ + 🬵🬻█🬺🬱  +🬠🬏🬨🬴🬏🬨▌ +█🬮🬻█🬮🬻█ +█🬬█🬎█🬝█ +🬀 🬂 🬂 🬁 diff --git a/test/runtests.jl b/test/runtests.jl index 44f3971..01c18cf 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -74,9 +74,13 @@ ghost2 = [ @test_reference "references/braille_ghost.txt" ustring(iseven, ghost2) @test_reference "references/block_ghost.txt" ustring(iseven, ghost2, :block) +@test_reference "references/quadrant_ghost.txt" ustring(iseven, ghost2, :quadrant) +@test_reference "references/sextant_ghost.txt" ustring(iseven, ghost2, :sextant) @test_reference "references/octant_ghost.txt" ustring(iseven, ghost2, :octant) @test_reference "references/braille_ghost.txt" @capture_out uprint(iseven, ghost2) @test_reference "references/block_ghost.txt" @capture_out uprint(iseven, ghost2, :block) +@test_reference "references/quadrant_ghost.txt" @capture_out uprint(iseven, ghost2, :quadrant) +@test_reference "references/sextant_ghost.txt" @capture_out uprint(iseven, ghost2, :sextant) @test_reference "references/octant_ghost.txt" @capture_out uprint(iseven, ghost2, :octant) # Test vector and n-dimensional arrays From 38d1f3bc6a2cd35bbcd4fedd512939d9e243190f Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Mon, 30 Dec 2024 13:18:51 -0500 Subject: [PATCH 5/6] Update README and CHANGELOG --- CHANGELOG.md | 7 +++++++ README.md | 19 +++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a60b3b..7ec9a8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,10 @@ # UnicodeGraphics.jl +## Version `v0.2.2` +* ![Feature][badge-feature] Added support for plotting via quadrants, + sextants, and octants. Octants requires Unicode 16 font support and + is in 2024 not yet widely available. Things will work but the result + will look bad. ([#8][pr-8]) + ## Version `v0.2.1` * ![Feature][badge-feature] Added support for multidimensional arrays ([#7][pr-7]) @@ -22,6 +28,7 @@ [pr-5]: https://github.com/JuliaGraphics/UnicodeGraphics.jl/pull/5 [pr-7]: https://github.com/JuliaGraphics/UnicodeGraphics.jl/pull/7 +[pr-8]: https://github.com/JuliaGraphics/UnicodeGraphics.jl/pull/8 [badge-breaking]: https://img.shields.io/badge/BREAKING-red.svg [badge-deprecation]: https://img.shields.io/badge/deprecation-orange.svg diff --git a/README.md b/README.md index 0771ff4..755931b 100644 --- a/README.md +++ b/README.md @@ -56,13 +56,20 @@ julia> uprint(pac, :block) ▀██████████████▀ ▀▀██████▀▀ -julia> uprint(pac, :octant) - 𜷋𜷡𜷥██𜷤𜷞𜶻 -𜷓███▙▟█𜵰𜴗▘ -█████𜷂𜴶 𜴘 -𜴢██████𜷤𜷞▖ - 𜴅𜴦𜶫██𜵰𜴗𜴂 +julia> uprint(pac, :sextant) + 🬞🬵🬻██🬺🬱🬏 +🬞███🬕🬨███🬓 +🬻█████🬝🬆🬀 +█████🬲🬏  🬇 +🬨██████🬺🬱🬏 + 🬬██████🬝🬀 +  🬁🬊🬎🬎🬆🬀 ``` +Other drawing modes include `:quadrant` and `:octant`. While `:block` +splits each character cell in two, the quadrants, sextants, and +octants split a cell into 4, 6, or 8 "pixels". Octant mode requires +Unicode 16 support in fonts and is not yet (as of late 2024) widely +available. When passing a filtering function, UnicodeGraphics will fill all values for which the function returns `true`, From eacec71b179d82a4386c6c746f2964a968f91f57 Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Mon, 30 Dec 2024 13:27:25 -0500 Subject: [PATCH 6/6] Update documentation --- src/api.jl | 28 ++++++++++++++++++++-------- src/ndarray.jl | 2 +- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/api.jl b/src/api.jl index 23ecf64..e65d834 100644 --- a/src/api.jl +++ b/src/api.jl @@ -4,8 +4,11 @@ Write to `io` (or to the default output stream `stdout` if `io` is not given) a binary unicode representation of `A` , filling values that are `true` or greater than zero. -The printing method can be specified by passing either `:braille` or `:block`. -The default is `:$DEFAULT_METHOD`. +The printing method can be specified by passing either `:braille`, +`:block`, `:quadrant`, `:sextant`, or `:octant`. The default is +`:$DEFAULT_METHOD`. (Note that `:octant` requires either a font or a +terminal emulator that supports Unicode 16; otherwise the output will +look strange.) # Example ```julia-repl @@ -41,8 +44,11 @@ end Write to `io` (or to the default output stream `stdout` if `io` is not given) a binary unicode representation of `A` , filling values for which `f` returns `true`. -The printing method can be specified by passing either `:braille` or `:block`. -The default is `:$DEFAULT_METHOD`. +The printing method can be specified by passing either `:braille`, +`:block`, `:quadrant`, `:sextant`, or `:octant`. The default is +`:$DEFAULT_METHOD`. (Note that `:octant` requires either a font or a +terminal emulator that supports Unicode 16; otherwise the output will +look strange.) # Example ```julia-repl @@ -80,8 +86,11 @@ end Return a string containing a binary unicode representation of `A` , filling values that are `true` or greater than zero. -The printing method can be specified by passing either `:braille` or `:block`. -The default is `:$DEFAULT_METHOD`. +The printing method can be specified by passing either `:braille`, +`:block`, `:quadrant`, `:sextant`, or `:octant`. The default is +`:$DEFAULT_METHOD`. (Note that `:octant` requires either a font or a +terminal emulator that supports Unicode 16; otherwise the output will +look strange.) # Example ```julia-repl @@ -113,8 +122,11 @@ end Return a string containing a binary unicode representation of `A`, filling values for which `f` returns `true`. -The printing method can be specified by passing either `:braille` or `:block`. -The default is `:$DEFAULT_METHOD`. +The printing method can be specified by passing either `:braille`, +`:block`, `:quadrant`, `:sextant`, or `:octant`. The default is +`:$DEFAULT_METHOD`. (Note that `:octant` requires either a font or a +terminal emulator that supports Unicode 16; otherwise the output will +look strange.) # Example ```julia-repl diff --git a/src/ndarray.jl b/src/ndarray.jl index 8816f71..e30a996 100644 --- a/src/ndarray.jl +++ b/src/ndarray.jl @@ -11,7 +11,7 @@ function _uprint_nd(io::IO, f::Function, A::AbstractMatrix, method::Symbol) elseif method == :octant to_octant(io, f, A) else - throw(ArgumentError("Valid methods are :braille and :block, got :$method.")) + throw(ArgumentError("Valid methods are :braille, :block, :quadrant, :sextant, or :octant; got :$method instead.")) end return nothing end