Unicode 框绘制对角线

问题描述 投票:0回答:2

我有一个使用 ascii 中的对角线绘制的表格。基本上是

/\^V<>
的混合,像这样:

  ^
 / \
<   >
 \ /
  v

我更喜欢使用更适合工作的unicode字符来编写此内容,例如

,但我缺少
^
V
<
>
的字符,所以我只能这样做:

  ╳
 ╱ ╲
╳   ╳
 ╲ ╱
  ╳

这对于我想要传达的内容来说是不够的。

我想知道我是否缺少一些画框角色?

我基本上是通过这个块,可能另一个块有更适合绘制对角线的东西。 我还查看了 http://shapecatcher.com/,它建议使用例如大写 Lambda,

Λ
,代表
^
,但情况仍然不太匹配。

如果目前没有这样的字符,您是否知道是否有任何添加它们的计划,或者您能想到另一种在终端中显示这样的表格的好方法吗?

unicode ascii ascii-art
2个回答
4
投票

您要查找的角色不存在。不过,您可以这样做(按照@jasonharper的建议):

╱╲
╲╱

或者:

 ╱╲
╱  ╲
╲  ╱
 ╲╱

0
投票

我希望这不是一篇太多的墓碑。我也想知道。

好吧,我将高度关注这一点。我将为您提供我能找到的所有可能的选择。由于这是一个美学问题,您必须根据项目及其需求自行选择。我根据与旋转正方形的相似性得出自己的结论,我认为这就是这里的目标。

事实证明,不,您并没有真正错过一个包含所有答案的特殊字符空间。我希望。

首先,您似乎特别打算在钻石中的每个角度仅使用 1 个字符。这将人为地限制您的选择。

2 字符钻石与 1 字符钻石的常见空白内部:

  /\                        ^
 /░░\                      /░\
/░hi░\ can't center text  <░!░>  can center text
\░hi░/                     \░/
 \░░/                       v
  \/

如果上图对您的项目不重要,那么请考虑使用 2 字符钻石,因为它们更容易构造。


每个角度 2 个字符(如果居中对您来说不是障碍): 标题是这些字符所来自的 unicode 块的名称。

基础拉丁语

     /\
    /  \    basic solidus diamond for comparison
   /    \     
   \    /       \ slash: solidus
    \  /        / backslash: reverse solidus
     \/

盒子图

     ╱╲                                        ╱╲
    ╱  ╲      box drawing diagonals           /  \
   ╱    ╲                                    /    \
   ╲    ╱      like solidus, but jagged.     \    /
    ╲  ╱       you could mix and match        \  /
     ╲╱        for the best of both worlds:    ╲╱

     ▟▙
    ▟▘▝▙      fun with quadrants and half blocks
   ▟▘  ▝▙     
   ▜▖  ▗▛        
    ▜▖▗▛         
     ▜▛

杂项数学符号-A

       ⟋⟍
     ⟋    ⟍        mathematical rising/falling diagonal
   ⟋        ⟍   
   ⟍        ⟋       
     ⟍    ⟋    
       ⟍⟋        ||
                  ||       not grid-friendly width

半角和全角表格

       /\
     /    \        fullwidth solidus + reverse solidus
   /        \      basically a perfect diamond
   \        /      grid-friendly only if your grid is in fullwidth,
     \    /        the width of CJK ideographs like 爱
       \/          fullwidth space: " "

杂项数学符号-B

    ⧸⧹
   ⧸  ⧹
  ⧸    ⧹     "big solidus"
  ⧹    ⧸
   ⧹  ⧸         
    ⧹⧸

混合

盒子图

     ██      
   ██  ██     double full blocks
 ██      ██      (2 char up & down, 1 char right & left)
   ██  ██    
     ██      

每个角度 1 个字符(为了让事情变得有意义,当我们正在探索的 unicode 块没有任何可实验的内容时,我将省略角度):

基础拉丁语

   ^
  / \     your example for comparison
 <   >    aka the "There Must Be A Better Way To Do This" diamond
  \ /     which we have all struggled with!
   v        

盒子图

   █
  █ █     single full blocks
 █   █
  █ █        
   █ 

   ▄
  ▞ ▚     half blocks and quadrants
 ▐   ▌       cramped
  ▚ ▞        
   ▀

其他技术 杂项技术

   ⍲    "Apl functional symbol up caret tilde" width issues
  /  \
  \  /
   ⍱    "Apl functional symbol down caret tilde"


   ⌃
  / \    up/down arrowhead
  \ /
   ⌄


  ⎠⎝     various parenthesis (probably not useful)
  
  ⎞⎛

  /\
 〈   〉    angle brackets look promising
  \/     unfortunately, width makes it not grid-friendly

(杂项技术中的“右尖括号” 与“数学右尖括号”相同 杂项数学符号-A)

你能看出区别吗?

⟩  〉

拼音扩展

 ^    ^    (normal caret)
/ \  / \    
\ /  \ /   Left: "Latin subscript small letter v"
 ᵥ    ᵛ    Right: "Modifier letter small v"

 ᴧ    ᴧ   "Greek letter small capital lamda"
/ \  / \
\ /  \ /
 v    ᴠ   normal v for comparison, and "Latin letter small capital v"

杂项数学符号-B

  /\          
 ⦑   ⦒    |   Left/Right angle bracket with dot
  \/     |        width problems
         |
  /\
 ⦉   ⦊   "Z notation [left/right] binding bracket"
  \/            same width problem

标志

 /\
❬  ❭    "Medium [left/right]-pointing angle bracket ornament"
 \/          good width    

一般标点符号

 /\
‹  ›  "Single [left/right]-pointing angle quotation mark" aka guillemets
 \/        
               good width

统一加拿大原住民音节

  ᐱ    ||
 / \   ||    would be great if not for those pesky width issues
ᐸ   ᐳ  ||   ᐱ: Canadian syllabics pi  ᐯ: pe ᐳ: po ᐸ: pa
 \ /   ||    
  ᐯ    ||

结论:

世界上最好的居中unicode钻石(没有宽度问题)可能是......(使用正常的斜线和反向斜线作为此处的线):

  ᴧ 
 / \     
❬   ❭
 \ /
  ᴠ

再次对比原图:

  ^
 / \
<   >
 \ /
  v

没错,Dingbats 和 IPA 拯救了这一天。说实话,不是一直都是这样吗?


但是如果你问我,一点点艺术创造力可能会让它更容易理解......

   |
  / \    using simple solidus (slashes), dashes, and | <-this thing
 -   -
  \ /
   |

我想这取决于你想要达到多尖锐的程度。

或者,为了完整起见,另一个方向:

   ▁
  / \    block elements 1/8th characters (up, down, left, right)
 ▕   ▏
  \ /
   ▔

感谢您与我一起踏上这段旅程。我希望您发现它至少有点用。

© www.soinside.com 2019 - 2024. All rights reserved.