Skip to content

Commit c6c4a33

Browse files
committed
add README.md
1 parent baa6dd5 commit c6c4a33

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# web-spf
2+
3+
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+
<script src="./web_spf.js" type="module"></script>
14+
```
15+
16+
Now you can load fonts with the `spf-font` tag:
17+
```html
18+
<spf-font src="./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-font src="./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! -->
29+
<spf-text style="height: 8rem;" class="bannerText">Hello!</spf-text>
30+
```

0 commit comments

Comments
 (0)