You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An implementation of SimplePixelFont rendering for the web.
4
+
5
+
# About
6
+
7
+
`web=spf` provides a native api for loading and rendering .spf` files in the web. The api uses HTML's custom elements to define unique spf tags. And internally uses [`render_spf`](https://github.com/The-Nice-One/web-spf/tree/main/crates/render_spf), a framework for creating textures from `.spf` text strings. You can see a live demo at the following site: [https://the-nice-one.github.io/web-spf/](https://the-nice-one.github.io/web-spf/).
8
+
9
+
# Usage
10
+
11
+
Copy the [pkg](pkg/) directory and [web_spf.js](web_spf.js) file in your project. Then in your html document add the following script tag:
12
+
```html
13
+
<scriptsrc="./web_spf.js"type="module"></script>
14
+
```
15
+
16
+
Now you can load fonts with the `spf-font` tag:
17
+
```html
18
+
<spf-fontsrc="./Peaberry.spf"></spf-font>
19
+
```
20
+
21
+
Add the `default` attribute to set the font as the default for all text-renderings:
22
+
```html
23
+
<spf-fontsrc="./Peaberry.spf"default></spf-font>
24
+
```
25
+
26
+
Lastly, use the `spf-text` to render any text:
27
+
```html
28
+
<!-- You can even use custom styles like height to simulate custom text size! -->
0 commit comments