265 Commits

Author SHA1 Message Date
Mitchell Hashimoto
ead8610604 font: Box font uses canvas abstraction 2022-12-13 21:08:45 -08:00
Mitchell Hashimoto
b21e18a9e6 font: start converting Box font to our abstract canvas interface 2022-12-13 16:16:56 -08:00
Mitchell Hashimoto
a87b21dbee font: mac should use freetype rasterizer by default 2022-12-12 22:12:11 -08:00
Mitchell Hashimoto
c8252133a3 update zig version 2022-12-12 22:10:52 -08:00
Mitchell Hashimoto
bc74033ad6 face: web canvas can render grapheme clusters 2022-12-12 21:40:54 -08:00
Mitchell Hashimoto
a1dda2c37f font: faceFromIndex returns a pointer to the face 2022-12-12 21:34:34 -08:00
Mitchell Hashimoto
c06ca04a1a font: web canvas tracks glyph indexes for grapheme clusters 2022-12-12 11:31:30 -08:00
Mitchell Hashimoto
2b3478ce3d font: start web canvas shaping, we perform grapheme clustering 2022-12-11 22:12:12 -08:00
Mitchell Hashimoto
35000bced1 font: shaper test should decode unicode codepoints 2022-12-08 12:42:09 -08:00
Mitchell Hashimoto
0c9a9b1f91 font: web canvas face has to render to check presentation for cp
Since we have no way to detect our presentation (text/emoji), we need to
actually render the glyph that is being requested to double-check that
the glyph matches our supported presentation.

We do this because the browser will render fallback fonts for a glyph if
it can't find one in the named font.
2022-12-07 19:20:04 -08:00
Mitchell Hashimoto
f53d9fb704 font: web canvas shaper yields runs 2022-12-07 18:29:49 -08:00
Mitchell Hashimoto
dd71456f35 font: shapers init with allocator since web canvas needs to init buffer 2022-12-06 13:44:55 -08:00
Mitchell Hashimoto
f0b7fbecee font: extract common shaper elements out 2022-12-06 13:23:53 -08:00
Mitchell Hashimoto
e3c18f3f51 font: move shaper into comptime interface 2022-12-06 11:20:37 -08:00
Mitchell Hashimoto
6aa212707e font: web canvas can render emoji 2022-12-06 10:55:42 -08:00
Mitchell Hashimoto
41cbc1a323 wasm: show color atlas in example web app 2022-12-05 21:33:54 -08:00
Mitchell Hashimoto
5993528f33 font: GroupCache is wasm compatible 2022-12-05 21:01:56 -08:00
Mitchell Hashimoto
62990bb33e font: Group is now wasm-compatible 2022-12-05 20:52:03 -08:00
Mitchell Hashimoto
aaa0d46b5d font: web canvas doesn't support discovery 2022-12-05 20:37:17 -08:00
Mitchell Hashimoto
5291501251 font: DeferredFace is wasm-compatible 2022-12-05 20:28:50 -08:00
Mitchell Hashimoto
2a74330911 font: begin making Group work with wasm 2022-12-05 16:08:20 -08:00
Mitchell Hashimoto
d2afddb7e2 font: fix some JS memory leaks 2022-12-05 15:45:31 -08:00
Mitchell Hashimoto
ed4e8c36b0 font: add 1 to the canvas glyph to avoid clipping 2022-12-05 15:37:55 -08:00
Mitchell Hashimoto
25f2f1a652 font: fix glyph offset calculations for render 2022-12-05 15:25:09 -08:00
Mitchell Hashimoto
5e9dd02eab font: add method for drawing atlas to canvas 2022-12-05 15:01:34 -08:00
Mitchell Hashimoto
84f6f37450 face: web canvas glyph rendering appears to work! 2022-12-05 14:28:10 -08:00
Mitchell Hashimoto
19e326dab6 font: working on rendering glyphs in canvas 2022-12-05 10:54:40 -08:00
Mitchell Hashimoto
df302fc2b6 calculate font metrics via canvas 2022-12-04 22:01:58 -08:00
Mitchell Hashimoto
37f00ac725 don't export coretext/freetype 2022-12-04 13:19:29 -08:00
Mitchell Hashimoto
c48d8cd151 hook up logging to wasm, example uses new zig-js package 2022-12-04 13:16:54 -08:00
Mitchell Hashimoto
437f1772f1 logging works for wasm 2022-12-04 12:29:11 -08:00
Mitchell Hashimoto
940828ed97 font: web canvas creates a canvas element 2022-12-03 22:11:01 -08:00
Mitchell Hashimoto
c32219554a blank out web canvas impl 2022-12-01 13:02:17 -08:00
Mitchell Hashimoto
b858aea124 Start scaffolding web_canvas backend 2022-12-01 13:02:17 -08:00
Mitchell Hashimoto
24cc01e055 move wasm main to src/, export an Atlas API
We don't need the Atlas API for wasm at all, but its a good way to test
things work incrementally and its a pretty cool thing to have as a wasm
library really.
2022-12-01 13:02:17 -08:00
Mitchell Hashimoto
f871630fa4 move Atlas to font 2022-11-28 10:35:46 -08:00
Mitchell Hashimoto
2796a0b964 font: when resizing a glyph, scale metrics by same ratio
We rely on the top/left offset to position the glyph properly. When we
were resizing, we weren't properly recalculating this offset which led
to some glyphs slightly (or majorly) off depending on how much they
resized.
2022-11-27 22:06:25 -08:00
Mitchell Hashimoto
0e55f4054e font: Shaper should replace 0 with 0x20 (space)
This didn't cause any real problems but it was a waste to trigger the
full font fallback system for codepoint 0.
2022-11-27 20:25:21 -08:00
Mitchell Hashimoto
bfc657395a curly underlines 2022-11-27 16:11:15 -08:00
Mitchell Hashimoto
fee681ac78 dashed underlines 2022-11-27 15:44:12 -08:00
Mitchell Hashimoto
6a32a30a16 font: render dotted underlines 2022-11-27 15:39:18 -08:00
Mitchell Hashimoto
278668c953 font: draw single and double underlines as sprites 2022-11-27 15:14:49 -08:00
Mitchell Hashimoto
84efd2ac5f font: use Canvas more, Canvas rect 2022-11-27 14:08:15 -08:00
Mitchell Hashimoto
28d386967d font: introduce Canvas, start converting Box 2022-11-27 13:54:43 -08:00
Mitchell Hashimoto
b34e336c5c rearrange box rendering to prepare for more sprite drawing 2022-11-27 10:17:12 -08:00
Mitchell Hashimoto
1062a39681 more glyphs 2022-11-25 15:28:47 -08:00
Mitchell Hashimoto
4cac375fcf more 2022-11-25 15:22:59 -08:00
Mitchell Hashimoto
d2727b1f5c more wedges 2022-11-25 15:18:36 -08:00
Mitchell Hashimoto
120dfb4043 more wedges 2022-11-25 15:12:34 -08:00
Mitchell Hashimoto
2c9b3e2f9b wedge triangles 2022-11-25 15:02:12 -08:00