Created
March 2, 2022 16:28
-
-
Save subzey/8e5dd776cb7b3b8741c4bce7975df451 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<canvas id="a" width="500" height="500"></canvas> | |
<script> | |
const ctx = document.querySelector('canvas').getContext('2d'); | |
const font = new FontFace('Charting', 'local("SF Pro Display")', {featureSettings: '"tnum" on, "lnum" on'}); | |
document.fonts.add(font); | |
ctx.font = '42px Charting, sans-serif'; | |
ctx.fillText('11111|', 0, 50); | |
ctx.fillText('88888|', 0, 90); | |
ctx.font = '42px SF Pro Display, sans-serif'; | |
ctx.fillText('11111|', 0, 150); | |
ctx.fillText('88888|', 0, 190); | |
font.loaded.then(console.log, console.error); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment