53
edits
(typos) |
|||
(15 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
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.<ref>Phil Chastney: ''[https://web.archive.org/web/20161005120746/http://www.chastney.com/~philip/SImPL/APL_fonts_are_different.pdf APL fonts are different]'' | 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.<ref>Phil Chastney: ''[https://web.archive.org/web/20161005120746/http://www.chastney.com/~philip/SImPL/APL_fonts_are_different.pdf APL fonts are different]'' | ||
</ref> This article lists some fonts that are suited for APL, and how to use them. | </ref> This article lists some fonts that are suited for APL, and shows how to use them. | ||
== Monospace == | == Monospace == | ||
{|class=wikitable | {|class=wikitable | ||
Line 25: | Line 25: | ||
| [https://www.ibm.com/us-en/marketplace/apl2 Courier APL2 Unicode] || [https://www.ibm.com/account/reg/us-en/signup?formid=urx-32206 IBM] || The classic Courier typewriter font, extended with APL symbols.|| | | [https://www.ibm.com/us-en/marketplace/apl2 Courier APL2 Unicode] || [https://www.ibm.com/account/reg/us-en/signup?formid=urx-32206 IBM] || The classic Courier typewriter font, extended with APL symbols.|| | ||
[[File:Courier APL2 Unicode.png|none]] | [[File:Courier APL2 Unicode.png|none]] | ||
|- | |||
| [https://github.com/slavfox/Cozette Cozette] || [https://github.com/slavfox/Cozette/releases/download/v.1.20.0/CozetteVector.ttf GitHub] || A bitmap programming font optimized for coziness. (In Dyalog Windows IDE, works best in sizes divisble by 13) || [[File:Cozette.png|none]] | |||
|- | |- | ||
|[https://mlochbaum.github.io/BQN/fonts.html DejaVu BQN Sans Mono]||[https://github.com/mlochbaum/BQN/blob/master/docs/DejaVuBQNSansMono.ttf?raw=true GitHub]||DejaVu Sans Mono with support for [[BQN]].|| | |[https://mlochbaum.github.io/BQN/fonts.html DejaVu BQN Sans Mono]||[https://github.com/mlochbaum/BQN/blob/master/docs/DejaVuBQNSansMono.ttf?raw=true GitHub]||DejaVu Sans Mono with support for [[BQN]].|| | ||
Line 63: | Line 65: | ||
|- | |- | ||
| [https://typeof.net/Iosevka/ Iosevka] Recursive Mono Style || [https://github.com/be5invis/Iosevka/releases/download/v10.1.1/ttf-iosevka-fixed-ss17-10.1.1.zip GitHub] || [[File:Iosevka Recursive Mono.png|none]] | | [https://typeof.net/Iosevka/ Iosevka] Recursive Mono Style || [https://github.com/be5invis/Iosevka/releases/download/v10.1.1/ttf-iosevka-fixed-ss17-10.1.1.zip GitHub] || [[File:Iosevka Recursive Mono.png|none]] | ||
|- | |||
| [https://www.jetbrains.com/mono/ JetBrains Mono] || [https://download.jetbrains.com/fonts/JetBrainsMono-2.304.zip JetBrains] || Geometric font optimized for reading vertically. || [[File:JetBrains_Mono.png]] | |||
|- | |- | ||
| [https://codeberg.org/Wezl/fonts poultreMono] || [https://codeberg.org/attachments/042040b4-ca97-4ffe-8401-540d4921e534 Codeberg] || A 5×9 pixel font. || [[File:PoultreMono.png|none]] | | [https://codeberg.org/Wezl/fonts poultreMono] || [https://codeberg.org/attachments/042040b4-ca97-4ffe-8401-540d4921e534 Codeberg] || A 5×9 pixel font. || [[File:PoultreMono.png|none]] | ||
Line 115: | Line 119: | ||
# The APL code has to be formatted with an appropriate APL font | # The APL code has to be formatted with an appropriate APL font | ||
# The APL font has to be made available for those users that do not have it installed | # 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 <syntaxhighlight lang=html inline><head></syntaxhighlight> element of the page | All these things can be achieved by inserting the following into the <syntaxhighlight lang=html inline><head></syntaxhighlight> element of the page. | ||
Replace font name and file name with values corresponding to the desired font: | |||
<syntaxhighlight lang=html> | <syntaxhighlight lang=html> | ||
<meta charset="UTF-8"> | <meta charset="UTF-8"> | ||
<style> | <style> | ||
@font-face{ | @font-face { | ||
font-family: APL; src: local("APL385 Unicode"), url(Apl385.ttf) | font-family: APL; | ||
src: local("APL385 Unicode"), url(Apl385.ttf) | |||
} | } | ||
pre, code { | pre, code { | ||
Line 127: | Line 133: | ||
</style> | </style> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
The <syntaxhighlight lang=shell inline>Apl385.ttf</syntaxhighlight> file must | The <syntaxhighlight lang=shell inline>Apl385.ttf</syntaxhighlight> font file must be placed in the same directory as the HTML file, and all APL code must be wrapped in <syntaxhighlight lang=html inline><pre></syntaxhighlight> or <syntaxhighlight lang=html inline><code></syntaxhighlight> elements. | ||
== Bad rendering == | |||
The [[wikipedia:Blink browser engine|Blink browser engine]] instructs the [[wikipedia:HarfBuzz|HarfBuzz]] text shaping engine to prefer fidelity in typeface over fidelity in glyph shape. As a consequence, text using a font that lacks the <syntaxhighlight lang=apl inline>≢</syntaxhighlight> glyph ([[Tally]], [[Not Match]]) often ends up looking like <syntaxhighlight lang=apl inline>≡/</syntaxhighlight> (Match reduction), causing great confusion. The issue affects diverse things like Android WebView, Chromium Embedded Framework, all [[wikipedia:Electron (softwareframework)|Electron]] apps, [[wikipedia:Qt software)|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 [[wikipedia:Stylus (browser extension)|Stylus]] or [[wikipedia:Stylish|Stylish]], which gives more fine-grained control. | |||
Here are examples of appropriate user style rules for some common websites: | |||
{|class=wikitable | |||
! Domain !! Rule | |||
|- | |||
| chat.stackexchange.com || <syntaxhighlight lang=css inline>div.message pre,div.message code{font-family:"APL385 Unicode"}</syntaxhighlight> | |||
|- | |||
| stackexchange.com || <syntaxhighlight lang=css inline>.s-prose code,.comment-copy code{font-family:"APL385 Unicode"}</syntaxhighlight> | |||
|- | |||
| discord.com || <syntaxhighlight lang=css inline>code{font-family:"APL385 Unicode"!important}</syntaxhighlight> | |||
|- | |||
| github.com || <syntaxhighlight lang=css inline>textarea,.cm-line,.blob-code-inner{font-family:"APL385 Unicode"}</syntaxhighlight> | |||
|} | |||
== Changing font in Dyalog RIDE == | == Changing font in Dyalog RIDE == | ||
[[Dyalog Ltd]]'s cross-platform RIDE interface, which is the default GUI interface on all non-Windows platforms, | [[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[[#loc|*]] | * Open ride-base.css[[#loc|*]] | ||
* Find the line that says <syntaxhighlight lang=css inline>src: url('./fonts/Apl385.woff') format('woff'), url('./fonts/Apl385.ttf') format('truetype');</syntaxhighlight> | * Find the line that says <syntaxhighlight lang=css inline>src: url('./fonts/Apl385.woff') format('woff'), url('./fonts/Apl385.ttf') format('truetype');</syntaxhighlight> | ||
Line 144: | Line 168: | ||
:** Linux or AIX: /opt/mdyalog/18.2/64/unicode/Contents/Resources/Dyalog/RIDEapp/resources/app/style/ride-base.css | :** 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 | :** 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 [[glyph]]s share sub-glyphs due to the history of [[overstrike|overstriking]], multiple dimensions of commonality need to be aligned. The following table can help: | |||
{|class=wikitable | |||
!Class !! Glyphs | |||
|- | |||
| alphas || <code>⍺⍶@</code> | |||
|- | |||
| arrows-down || <code>↓⍗⍖</code> | |||
|- | |||
| arrows-left || <code>←⍇⍅</code> | |||
|- | |||
| arrows-right || <code>→⍈⍆</code> | |||
|- | |||
| arrows-up || <code>↑⍐⍏</code> | |||
|- | |||
| asterisks || <code>*⍣⍟⋆</code> | |||
|- | |||
| brackets || <code>[]⌈⌊⌷</code> | |||
|- | |||
| circles || <code>○⍥⍟⌽⍉⊖⍜⊙⌾∅</code> | |||
|- | |||
| colons || <code>:⍠÷⌹</code> | |||
|- | |||
| commas || <code>,⍪;⍮</code> | |||
|- | |||
| dashes || <code>-+÷⌹⌿⍀⍪⍏⍖⊢⊣</code> | |||
|- | |||
| dels || <code>∇⍒⍫⍢</code> | |||
|- | |||
| deltas || <code>∆⍙⍋⍍</code> | |||
|- | |||
| diamonds || <code>⋄⌺⍚</code> | |||
|- | |||
| diereses || <code>¨⍨⍥⍤⍣⍢⍡⍩∵</code> | |||
|- | |||
| dots || <code>.:;?!⍰∵‼</code> | |||
|- | |||
| epsilons || <code>∊⍷</code> | |||
|- | |||
| equals || <code>=≠⌸⍯</code> | |||
|- | |||
| iotas || <code>⍳⍸</code> | |||
|- | |||
| jots || <code>∘⍤⍛⍝⍎⍕¤⌾⟃⟄</code> | |||
|- | |||
| letters || <code>⍺⍶∆⍙∂∊⍷⍳⍸λπ⍴ϼχ⍵⍹∫</code> | |||
|- | |||
| omegas || <code>⍵⍹</code> | |||
|- | |||
| quads || <code>⎕⌸⌹⌺⌻⌼⍁⍂⍃⍄⍇⍈⍌⍍⍐⍓⍯⍰</code> | |||
|- | |||
| quotes || <code>'!⍘⍞"‼</code> | |||
|- | |||
| shoes-down || <code>∪⍦</code> | |||
|- | |||
| shoes-left || <code>⊂⊆⍧⟃</code> | |||
|- | |||
| shoes-right || <code>⊃⊇⟄</code> | |||
|- | |||
| shoes-up || <code>∩⋔</code> | |||
|- | |||
| slashes || <code>/⌿⍁%⫽</code> | |||
|- | |||
| slashes-back || <code>\⍀⍉⍂⑊</code> | |||
|- | |||
| stiles || <code><nowiki>|</nowiki>⌽⍒⍋∥⍭⍦⍧$</code> | |||
|- | |||
| tacks-down || <code>⌶⊤⍕⍑⍡</code> | |||
|- | |||
| tacks-up || <code>⌶⊥⍎⍊</code> | |||
|- | |||
| tildes || <code>~⍬⍭⍱⍲</code> | |||
|- | |||
| underscores || <code>_⍙⍷⍛⍸⊆⊇⍊⍜⍶⍹⍮⍚⍘ⒶⒷⒸⒹⒺⒻⒼⒽⒾⒿⓀⓁⓂⓃⓄⓅⓆⓇⓈⓉⓊⓋⓌⓍⓎⓏ</code>* | |||
|- | |||
| wedges-down || <code>∨⍱⍌</code> | |||
|- | |||
| wedges-left || <code><≤⍃ᑈ«</code> | |||
|- | |||
| wedges-right || <code>>≥⍄⍩ᐵ»</code> | |||
|- | |||
| wedges-up || <code>∧⍲⍓</code> | |||
|- | |||
| miscellaneous || <code>➥∞√˝⇐</code> | |||
|} | |||
:<nowiki>*</nowiki> [[Dyalog APL]] maps the traditional APL underscored alphabet to [[Unicode]]'s circled uppercase letters. | |||
== References == | == References == | ||
<references/> | <references/> | ||
{{APL development}}[[Category:APL character set]][[Category:Lists]] | {{APL development}}[[Category:APL character set]][[Category:Lists]] |