Fonts

From APL Wiki
Revision as of 07:04, 29 July 2024 by Adám Brudzewsky (talk | contribs) (Add Courier FZR APL)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

With the prevalence of Unicode, many systems render APL legibly out-of-the-box. However, for a uniform appearance, the font should be designed with APL in mind.[1] This article lists some fonts that are suited for APL, and shows how to use them.

Monospace

Name
(website)
Source
(download)
Description Sample
APL2 Unicode IBM Straight from IBM typewriter terminals with oblique letters.
APL2741 Unicode GitHub Unicode version of APL2741 with more characters.
APL385 Unicode Adrian Smith Inspired by Comic Sans Serif.
APL386 Unicode GitHub APL385 Unicode with fewer issues and more accented characters.
BQN386 Unicode GitHub Re-hinted APL386 Unicode with harmonised glyphs and support for BQN.
APLX Upright MicroAPL A monospaced grotesque font, reminiscent of Akzidenz-Grotesk.
Courier APL2 Unicode IBM The classic Courier typewriter font, extended with APL symbols.
Courier FZR APL GitHub An extension to the Courier Prime font featuring APL glyphs.
Cozette GitHub A bitmap programming font optimized for coziness. (In Dyalog Windows IDE, works best in sizes divisble by 13)
DejaVu BQN Sans Mono GitHub DejaVu Sans Mono with support for BQN.
DejaVu Sans Mono GitHub Wide range of characters with original look and feel of Vera.
DejaVu Sans Mono Bront GitHub DejaVu Sans Mono tweaked to be better geared for programming.
DejaVu Sans Mono Nerd AUR DejaVu Sans Mono patched with a high number of extra glyphs.
Everson Mono Evertype (shareware) A simple font, quite legible at sizes as small as 4 points.
Fairfax KreativeKorp Regular/Bold/Italic 6×12 bitmap font supporting many characters.
Fairfax Serif Serif 6×12 bitmap font supporting many characters.
Fairfax HD KreativeKorp Plotter-like font supporting many characters.
Fira Code APL Github A special version of the free monospaced font with programming ligatures which supports APL and BQN glyphs.
IBM 3270 GitHub Modern version of a classic IBM terminal font.
Iosevka Anonymous Pro Style GitHub A slender, highly customisable monospace sans-serif and slab-serif typeface inspired by Pragmata Pro, M+ and PF DIN Mono. This list includes seven ready-made versions, but it is easy to build one's own version too. When compiling, it is possible to configure character variants with apl-form = 'enable' to prioritise harmonising APL glyphs.
Iosevka Fira Mono Style GitHub
Iosevka Pragmata Pro Style GitHub
Iosevka Source Code Pro Style GitHub
Iosevka JetBrains Mono Style GitHub
Iosevka IBM Plex Mono Style GitHub
Iosevka Recursive Mono Style GitHub
JetBrains Mono JetBrains Geometric font optimized for reading vertically.  
poultreMono Codeberg A 5×9 pixel font.
PragmataPro (commercial) A condensed font optimized for coding, mathematics and engineering.
SAX2 GitHub Curly font with italic letters, based on Sharp APL for Unix.
SImPL Vector Courier-based, but thicker.
Unifont Unifoundry Low-resolution bitmap fall-back font

Proportional

Name
(website)
Source
(download)
Description Sample
APL333 Adrian Smith Proportionally spaced version of APL385 Unicode
Code2000 FontSpace Wedge-serif pan-Unicode font.
Iosevka Aile GitHub Proportionally spaced version of Iosevka.
Iosevka Etoile GitHub Proportionally spaced slab-serif version of Iosevka.
Quivira Website Serif font supporting many symbols, similar to Garamond.
Segoe UI Symbol (commercial) Microsoft's humanist interface and corporate font.
Stix Two Math GitHub Serif font, broadly compatible with Times New Roman.
Symbola UFAS (free for personal non-commercial use only) Supporting many scripts and symbols, similar to Computer Modern.
 
The APL typeball

Historical anecdote

Using IBM's APL\360 required the use of the IBM 2741 or IBM 1050 printing terminal with an APL type ball. The APL2741 font is based directly on this type ball.

Rendering APL on websites

For APL code to be rendered well on a website, three conditions must be fulfilled:

  1. The page has to use a proper encoding
  2. The APL code has to be formatted with an appropriate APL font
  3. The APL font has to be made available for those users that do not have it installed

All these things can be achieved by inserting the following into the <head> element of the page. Replace font name and file name with values corresponding to the desired font:

<meta charset="UTF-8">
<style>
  @font-face {
    font-family: APL; 
    src: local("APL385 Unicode"), url(Apl385.ttf)
  }
  pre, code {
    font-family: APL
  }
</style>

The Apl385.ttf font file must be placed in the same directory as the HTML file, and all APL code must be wrapped in <pre> or <code> elements.

Bad rendering

The Blink browser engine instructs the HarfBuzz text shaping engine to prefer fidelity in typeface over fidelity in glyph shape. As a consequence, text using a font that lacks the glyph (Tally, Not Match) often ends up looking like ≡/ (Match reduction), causing great confusion. The issue affects diverse things like Android WebView, Chromium Embedded Framework, all Electron apps, Qt software), as well as many popular web browsers, like Amazon Silk, Google Chrome, Microsoft Edge, Brave, Opera, Vivaldi, and the Yandex Browser.

In browsers, it is possible to mitigate the problem by overriding the used font, either by configuring the browser to override all font specifications, or via a user style manager like Stylus or Stylish, which gives more fine-grained control.

Here are examples of appropriate user style rules for some common websites:

Domain Rule
chat.stackexchange.com div.message pre,div.message code{font-family:"APL385 Unicode"}
stackexchange.com .s-prose code,.comment-copy code{font-family:"APL385 Unicode"}
discord.com code{font-family:"APL385 Unicode"!important}
github.com textarea,.cm-line,.blob-code-inner{font-family:"APL385 Unicode"}

Changing font in Dyalog RIDE

Dyalog Ltd's cross-platform RIDE interface, which is the default GUI interface on all non-Windows platforms, did not expose a font setting until version 4.5. However, it is trivial to change font:

  • Open ride-base.css*
  • Find the line that says src: url('./fonts/Apl385.woff') format('woff'), url('./fonts/Apl385.ttf') format('truetype');
  • Insert local('font name'), immediately after src:, for example src: local('SAX2'), url('./fonts/Apl385.woff') format('woff'), url('./fonts/Apl385.ttf') format('truetype');
  • Restart RIDE

* The full path to ride-base.css varies (examples for RIDE 4.4 and Dyalog 18.2):

  • Stand-alone installation:
    • Windows: %LOCALAPPDATA%\Programs\Dyalog\Ride-4.4\resources\app\style\ride-base.css
    • Linux: /opt/ride-4.4/resources/app/style/ride-base.css
    • macOS: /Applications/Ride-4.4.app/resources/app/style/ride-base.css
  • Zero-footprint RIDE (served by the interpreter and normally accessed through a browser):
    • Linux or AIX: /opt/mdyalog/18.2/64/unicode/Contents/Resources/Dyalog/RIDEapp/resources/app/style/ride-base.css
    • macOS: /Applications/Dyalog-18.2.app/Contents/Resources/Dyalog/RIDEapp/resources/app/style/ride-base.css

Designing a font

Making a good APL font is no small task. Since many glyphs share sub-glyphs due to the history of overstriking, multiple dimensions of commonality need to be aligned. The following table can help:

Class Glyphs
alphas ⍺⍶@
arrows-down ↓⍗⍖
arrows-left ←⍇⍅
arrows-right →⍈⍆
arrows-up ↑⍐⍏
asterisks *⍣⍟⋆
brackets []⌈⌊⌷
circles ○⍥⍟⌽⍉⊖⍜⊙⌾∅
colons :⍠÷⌹
commas ,⍪;⍮
dashes -+÷⌹⌿⍀⍪⍏⍖⊢⊣
dels ∇⍒⍫⍢
deltas ∆⍙⍋⍍
diamonds ⋄⌺⍚
diereses ¨⍨⍥⍤⍣⍢⍡⍩∵
dots .:;?!⍰∵‼
epsilons ∊⍷
equals =≠⌸⍯
iotas ⍳⍸
jots ∘⍤⍛⍝⍎⍕¤⌾⟃⟄
letters ⍺⍶∆⍙∂∊⍷⍳⍸λπ⍴ϼχ⍵⍹∫
omegas ⍵⍹
quads ⎕⌸⌹⌺⌻⌼⍁⍂⍃⍄⍇⍈⍌⍍⍐⍓⍯⍰
quotes '!⍘⍞"‼
shoes-down ∪⍦
shoes-left ⊂⊆⍧⟃
shoes-right ⊃⊇⟄
shoes-up ∩⋔
slashes /⌿⍁%⫽
slashes-back \⍀⍉⍂⑊
stiles |⌽⍒⍋∥⍭⍦⍧$
tacks-down ⌶⊤⍕⍑⍡
tacks-up ⌶⊥⍎⍊
tildes ~⍬⍭⍱⍲
underscores _⍙⍷⍛⍸⊆⊇⍊⍜⍶⍹⍮⍚⍘ⒶⒷⒸⒹⒺⒻⒼⒽⒾⒿⓀⓁⓂⓃⓄⓅⓆⓇⓈⓉⓊⓋⓌⓍⓎⓏ*
wedges-down ∨⍱⍌
wedges-left <≤⍃ᑈ«
wedges-right >≥⍄⍩ᐵ»
wedges-up ∧⍲⍓
miscellaneous ➥∞√˝⇐
* Dyalog APL maps the traditional APL underscored alphabet to Unicode's circled uppercase letters.

References

  1. Phil Chastney: APL fonts are different
APL development [edit]
Interface SessionTyping glyphs (on Linux) ∙ FontsText editors
Publications IntroductionsLearning resourcesSimple examplesAdvanced examplesMnemonicsISO 8485:1989ISO/IEC 13751:2001A Dictionary of APLCase studiesDocumentation suitesBooksPapersVideosAPL Quote QuadVector journalTerminology (Chinese, German) ∙ Neural networksError trapping with Dyalog APL (in forms)
Sharing code Backwards compatibilityAPLcartAPLTreeAPL-CationDfns workspaceTatinCider
Implementation ResourcesOpen-sourceMagic functionPerformanceAPL hardware
Developers Timeline of corporationsAPL2000DyalogIBMIPSASTSC