dy / linefont

Font for rendering line chart data
https://dy.github.io/linefont/scripts
SIL Open Font License 1.1
385 stars 6 forks source link
datavis line-chart opentype truetype waveform

linefont build

Typeface for rendering small/medium-scale line charts (eg. time series).

image

Demo  •  Google fonts  •  V-fonts  •  Test

Usage

Put Linefont[wdth,wght].woff2 into your project directory and use this code:

<style>
@font-face {
    font-family: linefont;
    font-display: block;
    src: url(./Linefont[wdth,wght].woff2) format('woff2');
}
.linefont {
    --wght: 200;
    --wdth: 50;
    font-family: linefont;
    font-variation-settings: 'wght' var(--wght), 'wdth' var(--wdth);
    line-height: 1.4; /* match selection, optional */
}
</style>

<!-- Set values manually -->
<textarea id="linefont" class="linefont" cols="100">
abcdefghijklmnopqrstuvwwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
</textarea>

<script>
// Set values programmatically (more precise)
linefont.textContent = Array.from({length: 127}, (_,i) => String.fromCharCode(0x100 + i)).join('')
</script>

Ranges

Linefont values span from 0 to 100, assigned to different characters:

Variable Axes

Tag Range Meaning
wght 1-1000 Line thickness (quarter upms, linear).
wdth 25-200 Width of the font (ie. zoom of the signal).

Features

npm package

Linefont npm package contains the font and a js function that produces font string from values.

import lf from 'linefont'

// get characters for values from 0..127 range
lf(0, 1, 50, 99, 127, ...) // ĀāIJţŤ...

Building

make build

Troubleshooting

See also

🕉