cmiscm /leonsans

Leon Sans is a geometric sans-serif typeface made with code in 2019 by Jongmin Kim.

★ 10,172⑂ 518👁 140⑃ 3● 33▤ 0
JavaScriptCreated 2019-07-29leon-kim.com/
10,172
stars
+0+3+12
518
forks
140
watchers
3
prs
33
issues
0
releases
–
discussions

README

Leon Sans
Leon Sans is a geometric sans-serif typeface made with code in 2019 by Jongmin Kim. It allows to change font weight dynamically and to create custom animations, effects or shapes in the Canvas element of HTML5. He designed the font to celebrate his newborn baby Leon.

There are live examples at https://leon-kim.com/examples/

And website at https://leon-kim.com/



!uppercase

!lowercase

!number

!latin upper

!latin lower


 What is special?
The font is made with code, it has coordinate values of the drawing points for each glyph. With the coordinate values, you can create custom shapes, effects or animations.

!Drawing animation
- Drawing animation

!Weight change
- Weight change

!Wave
- Wave

!Metaball
- Metaball

!Plant
- Plant

!Colorful
- Colorful

!Color pattern
- Color pattern


 Usage
Download the minified js file in dist folder and include it in your html.
html



Generate LeonSans and draw it in the Canvas element of HTML5.
javascript

let leon, canvas, ctx;

const sw = 800;
const sh = 600;
const pixelRatio = 2;

function init() {
    canvas = document.createElement('canvas');
    document.body.appendChild(canvas);
    ctx = canvas.getContext("2d");

    canvas.width = sw  pixelRatio;
    canvas.height = sh  pixelRatio;
    canvas.style.width = sw + 'px';
    canvas.style.height = sh + 'px';
    ctx.scale(pixelRatio, pixelRatio);

    leon = new LeonSans({
        text: 'The quick brown\nfox jumps over\nthe lazy dog',
        color: ['000000'],
        size: 80,
        weight: 200
    });

    requestAnimationFrame(animate);
}

function animate(t) {
    requestAnimationFrame(animate);

    ctx.clearRect(0, 0, sw, sh);

    const x = (sw - leon.rect.w) / 2;
    const y = (sh - leon.rect.h) / 2;
    leon.position(x, y);

    leon.draw(ctx);
}

window.onload = () = {
    init();
};


For the drawing animation, include TweenMax (JS animation library) in your html.
html



And update all the drawing values from 0 to 1
javascript
let i, total = leon.drawing.length;
for (i = 0; i < total; i++) {
    TweenMax.fromTo(leon.drawing[i], 1.6, {
        value: 0
    }, {
        delay: i  0.05,
        value: 1,
        ease: Power4.easeOut
    });
}




 Option list

| Name                 | Type     | Description                                                                                                                                                                                                     |
| -------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| text               | string   | The text that needs to be shown.                                                    |
| size               | integer   | The size of the text.                                                              |
| weight              | number   | The weight of th

Snapshot: 2026-11-04T14:00:00Z · Data license Apache-2.0 · JSON