From 4cff919b4393ea60b36f237c18ad451a99a329c7 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sat, 14 Nov 2020 22:45:52 -0500 Subject: Add font comparison page --- docs/BQN386_sub.woff2 | Bin 0 -> 64584 bytes docs/FairfaxHD_sub.woff2 | Bin 0 -> 41044 bytes docs/JuliaMono_sub.woff2 | Bin 0 -> 132976 bytes docs/fonts.html | 181 +++++++++++++++++++++++++++++++++++++++++++++++ docs/index.html | 2 +- docs/style.css | 12 ++++ 6 files changed, 194 insertions(+), 1 deletion(-) create mode 100644 docs/BQN386_sub.woff2 create mode 100644 docs/FairfaxHD_sub.woff2 create mode 100644 docs/JuliaMono_sub.woff2 create mode 100644 docs/fonts.html (limited to 'docs') diff --git a/docs/BQN386_sub.woff2 b/docs/BQN386_sub.woff2 new file mode 100644 index 00000000..1110f860 Binary files /dev/null and b/docs/BQN386_sub.woff2 differ diff --git a/docs/FairfaxHD_sub.woff2 b/docs/FairfaxHD_sub.woff2 new file mode 100644 index 00000000..0dfb50b9 Binary files /dev/null and b/docs/FairfaxHD_sub.woff2 differ diff --git a/docs/JuliaMono_sub.woff2 b/docs/JuliaMono_sub.woff2 new file mode 100644 index 00000000..7e788da5 Binary files /dev/null and b/docs/JuliaMono_sub.woff2 differ diff --git a/docs/fonts.html b/docs/fonts.html new file mode 100644 index 00000000..4d9b3e61 --- /dev/null +++ b/docs/fonts.html @@ -0,0 +1,181 @@ + + + + + Fonts for BQN + + + + + + +

Fonts for BQN

+ +

This page displays samples of all four free fonts I know of that fully support BQN's character set:

+ +

Other than DejaVu, the versions embedded on this page are small subsets, and you should get your copy from the links above (unless perhaps you want to use them for embedding as well). In addition to these, Pragmata Pro and Everson Mono have full support, but each charges a significant fee for usage and I can't freely embed them here.

+ +

The table below shows samples of the whole BQN keyboard (which includes the entire BQN character set plus a few unused characters) and APL characters that don't feature in BQN.

+ + + + + + + + + + + + +
+DejaVu Sans Mono BQN +
`1234567890=  ~!@#$%^&*()_+
+ qwertyuiop[] QWERTYUIOP{}
+ asdfghjkl;'\ ASDFGHJKL:"|
+ zxcvbnm,./   ZXCVBNM<>?
+
+˜˘¨⁼⌜´˝ ∞¯×  ¬⎉⚇⍟◶⊘⎊⍎⍕⟨⟩√⋆
+ 𝕨∊↑∧ ⊔⊏⊐π←→𝕎⍷𝕣  ⊑⊒⊣⊢
+ 𝕤𝕗𝕘⊸∘○⟜𝕊 𝔽𝔾« »·˙|
+ 𝕩↓∨⌊ ≡∾≍≠    𝕏 ⍒⌈ ≢≤≥
+
+⍬⍺⍵⍴⍳⍸⌷⍨⍤⍥⍣⊖⊂⊃⊆⊇∩∪⊥⊤⍝⍀⌿⍪
+⎕⌺⌹⌸⍞⍠⌶⍱⍲⍫∇∆⍢⍙…
+
+
+
BQN386
+
`1234567890=  ~!@#$%^&*()_+
+ qwertyuiop[] QWERTYUIOP{}
+ asdfghjkl;'\ ASDFGHJKL:"|
+ zxcvbnm,./   ZXCVBNM<>?
+
+˜˘¨⁼⌜´˝ ∞¯×  ¬⎉⚇⍟◶⊘⎊⍎⍕⟨⟩√⋆
+ 𝕨∊↑∧ ⊔⊏⊐π←→𝕎⍷𝕣  ⊑⊒⊣⊢
+ 𝕤𝕗𝕘⊸∘○⟜𝕊 𝔽𝔾« »·˙|
+ 𝕩↓∨⌊ ≡∾≍≠    𝕏 ⍒⌈ ≢≤≥
+
+⍬⍺⍵⍴⍳⍸⌷⍨⍤⍥⍣⊖⊂⊃⊆⊇∩∪⊥⊤⍝⍀⌿⍪
+⎕⌺⌹⌸⍞⍠⌶⍱⍲⍫∇∆⍢⍙…
+
+
+
`1234567890=  ~!@#$%^&*()_+
+ qwertyuiop[] QWERTYUIOP{}
+ asdfghjkl;'\ ASDFGHJKL:"|
+ zxcvbnm,./   ZXCVBNM<>?
+
+˜˘¨⁼⌜´˝ ∞¯×  ¬⎉⚇⍟◶⊘⎊⍎⍕⟨⟩√⋆
+ 𝕨∊↑∧ ⊔⊏⊐π←→𝕎⍷𝕣  ⊑⊒⊣⊢
+ 𝕤𝕗𝕘⊸∘○⟜𝕊 𝔽𝔾« »·˙|
+ 𝕩↓∨⌊ ≡∾≍≠    𝕏 ⍒⌈ ≢≤≥
+
+⍬⍺⍵⍴⍳⍸⌷⍨⍤⍥⍣⊖⊂⊃⊆⊇∩∪⊥⊤⍝⍀⌿⍪
+⎕⌺⌹⌸⍞⍠⌶⍱⍲⍫∇∆⍢⍙…
+
+Fairfax HD +
+
`1234567890=  ~!@#$%^&*()_+
+ qwertyuiop[] QWERTYUIOP{}
+ asdfghjkl;'\ ASDFGHJKL:"|
+ zxcvbnm,./   ZXCVBNM<>?
+
+˜˘¨⁼⌜´˝ ∞¯×  ¬⎉⚇⍟◶⊘⎊⍎⍕⟨⟩√⋆
+ 𝕨∊↑∧ ⊔⊏⊐π←→𝕎⍷𝕣  ⊑⊒⊣⊢
+ 𝕤𝕗𝕘⊸∘○⟜𝕊 𝔽𝔾« »·˙|
+ 𝕩↓∨⌊ ≡∾≍≠    𝕏 ⍒⌈ ≢≤≥
+
+⍬⍺⍵⍴⍳⍸⌷⍨⍤⍥⍣⊖⊂⊃⊆⊇∩∪⊥⊤⍝⍀⌿⍪
+⎕⌺⌹⌸⍞⍠⌶⍱⍲⍫∇∆⍢⍙…
+
+
Julia Mono
+
+ + +

And here are code samples taken from this repository.

+
DejaVu Sans Mono BQN
+
+  c𝕩='#'s/00«sm𝕩='''d/dm𝕩='"'
+  gq  s¯1d/c qgq                # Open indices
+  e g⊏∾2+s 1d-»(0∾+`c)//(𝕩=lf)1 # Matching close indices
+  Se{(˜𝕨)Se 1¨((𝕩/𝕨))𝕩}(0=¯1⊑⊢)       # Mark reachable openings
+
+PrecedesGroup  {
+  # We prepend a 0 to 𝕨, so that 0 is the "before start" index, with a
+  # false value, and normal indices are increased by 1.
+  𝕨 ˜ 0
+  inds  1 + ↕≠𝕩
+  # Zero out indices where 𝕩 was true, and find the greatest index so
+  # far at each position.
+  last  ` inds × ¬𝕩
+  last  𝕨
+}
+
+ +
BQN386
+
+  c𝕩='#'s/00«sm𝕩='''d/dm𝕩='"'
+  gq  s¯1d/c qgq                # Open indices
+  e g⊏∾2+s 1d-»(0∾+`c)//(𝕩=lf)1 # Matching close indices
+  Se{(˜𝕨)Se 1¨((𝕩/𝕨))𝕩}(0=¯1⊑⊢)       # Mark reachable openings
+
+PrecedesGroup  {
+  # We prepend a 0 to 𝕨, so that 0 is the "before start" index, with a
+  # false value, and normal indices are increased by 1.
+  𝕨 ˜ 0
+  inds  1 + ↕≠𝕩
+  # Zero out indices where 𝕩 was true, and find the greatest index so
+  # far at each position.
+  last  ` inds × ¬𝕩
+  last  𝕨
+}
+
+ +
Fairfax HD
+
+  c𝕩='#'s/00«sm𝕩='''d/dm𝕩='"'
+  gq  s¯1d/c qgq                # Open indices
+  e g⊏∾2+s 1d-»(0∾+`c)//(𝕩=lf)1 # Matching close indices
+  Se{(˜𝕨)Se 1¨((𝕩/𝕨))𝕩}(0=¯1⊑⊢)       # Mark reachable openings
+
+PrecedesGroup  {
+  # We prepend a 0 to 𝕨, so that 0 is the "before start" index, with a
+  # false value, and normal indices are increased by 1.
+  𝕨 ˜ 0
+  inds  1 + ↕≠𝕩
+  # Zero out indices where 𝕩 was true, and find the greatest index so
+  # far at each position.
+  last  ` inds × ¬𝕩
+  last  𝕨
+}
+
+ +
Julia Mono
+
+  c𝕩='#'s/00«sm𝕩='''d/dm𝕩='"'
+  gq  s¯1d/c qgq                # Open indices
+  e g⊏∾2+s 1d-»(0∾+`c)//(𝕩=lf)1 # Matching close indices
+  Se{(˜𝕨)Se 1¨((𝕩/𝕨))𝕩}(0=¯1⊑⊢)       # Mark reachable openings
+
+PrecedesGroup  {
+  # We prepend a 0 to 𝕨, so that 0 is the "before start" index, with a
+  # false value, and normal indices are increased by 1.
+  𝕨 ˜ 0
+  inds  1 + ↕≠𝕩
+  # Zero out indices where 𝕩 was true, and find the greatest index so
+  # far at each position.
+  last  ` inds × ¬𝕩
+  last  𝕨
+}
+
+ + + diff --git a/docs/index.html b/docs/index.html index df8ec593..9a88ee71 100644 --- a/docs/index.html +++ b/docs/index.html @@ -51,7 +51,7 @@

More snippets are programmed into the live demo at the top of the page: hit the arrow at the right of the code window to see them. For longer samples, you can gaze into the abyss that is the self-hosted compiler, or the shallower but wider abyss of the runtime, or take a look at the friendlier markdown processor used to format and highlight documentation files. This repository also has some translations from "A History of APL in 50 Functions".

How do I work with the character set?

I type the special characters using a backslash escape, so that, for example, typing \ then z writes (the backslash character itself is not used by BQN). The online REPL supports this method out of the box, and this repository also has scripts to support it, along with the standard syntax highlighting and indentation, in Vim and Kakoune. When starting out, it may be easier to use the bar above the REPL: hover over a character to see a short description, and click to insert it into the editor. Finally, on Linux this configuration file for XKB can be used to allow typing glyphs with a modifier key system-wide.

-

Few existing monospace fonts support all the BQN characters (double-struck letters like 𝕩 are a particular sticking point), which can cause these characters to be rendered with a fallback font and have the wrong width or look inconsistent. Two fonts modified to support BQN are available currently. This site uses a modified DejaVu Sans Mono, and another, more playful option is BQN386 (demo). Existing font Fairfax HD has excellent BQN support, but be careful not to confuse single quote (') with the smaller acute accent (´). Julia Mono also supports all BQN characters, but with varying styles and weights.

+

As for fonts, take a look at this comparison page. Few existing monospace fonts support all the BQN characters (double-struck letters like 𝕩 are a particular sticking point), which can cause these characters to be rendered with a fallback font and have the wrong width or look inconsistent. Two fonts modified to support BQN are available currently. This site uses a modified DejaVu Sans Mono, and another, more playful option is BQN386 (demo). Existing font Fairfax HD has excellent BQN support, but be careful not to confuse single quote (') with the smaller acute accent (´). Julia Mono also supports all BQN characters, but with varying styles and weights.

How do I get started?

Writing good learning material for a programming language is a pretty huge task, so neither the tutorials nor the documentation are complete. With some willingness to experiment and possibly outside knowledge of array programming, it's enough to get by, just not smooth sailing.

BQN's tutorials are intended as an introduction to array programming with BQN. They assume only knowledge of elementary mathematics, but will probably be hard to follow if you have no programming experience. BQN has a lot in common with dynamically-typed functional languages like Lisp, Julia, or Javascript, so knowledge of these languages will be particularly helpful. However, there's a significant (but shrinking) gap between the last tutorial and existing documentation. If you're motivated, you may be able to get across by reading material on other array languages like APL, J, NumPy, or Julia.

diff --git a/docs/style.css b/docs/style.css index c91db5be..31c94304 100644 --- a/docs/style.css +++ b/docs/style.css @@ -40,6 +40,18 @@ table th { font-family: BQN; src: url(DejaVuBQNSansMono.ttf) format('truetype'); } +@font-face{ + font-family: FFHD; + src: url(FairfaxHD_sub.woff2) format('woff2'); +} +@font-face{ + font-family: BQN386; + src: url(BQN386_sub.woff2) format('woff2'); +} +@font-face{ + font-family: JuliaMono; + src: url(JuliaMono_sub.woff2) format('woff2'); +} pre, code, textarea, .primitives tr td:first-child { background-color: #e3e7e7; color: #292929; -- cgit v1.2.3