5828 Commits

Author SHA1 Message Date
Mitchell Hashimoto
89a4c59f3c make opengl loader context-aware 2022-10-23 19:39:02 -07:00
Mitchell Hashimoto
de9731da1f rename grid to a renderer, extract to subfolder
"Grid" was a really antiquated name when it had both the screen state
AND the renderering functionality tied together. This hasn't been true
for a LONG time and it is long overdue that this is renamed to its
proper name.

This also begins setting up a folder structure to anticipate future
renderers and rendering functionality. I'm not working on any alternate
renderers right now so the interface isn't expected to be good, just
laying out the files in this way.
2022-10-23 16:47:34 -07:00
Mitchell Hashimoto
34e1c96dd7 workaround for https://github.com/ziglang/zig/issues/13277 2022-10-23 11:39:21 -07:00
Mitchell Hashimoto
bc3762e85b update zig to latest, fix todos 2022-10-23 10:54:39 -07:00
Mitchell Hashimoto
79f69885ca update to latest zig which renames @min/@max 2022-10-19 10:42:31 -07:00
Mitchell Hashimoto
366ea2ff4c cell under cursor always remains visible by inverting fg colors 2022-10-18 15:28:31 -07:00
Mitchell Hashimoto
fa0028f104 coretext: rasterize glyph with a padding to prevent artifacting 2022-10-18 14:57:44 -07:00
Mitchell Hashimoto
c00c8f52b5 coretext: render glyph on its own bounding box, calculate bearings 2022-10-18 14:49:23 -07:00
Mitchell Hashimoto
38e0c258d0 coretext: we do want to smooth and anti-alias glyphs 2022-10-18 12:56:02 -07:00
Mitchell Hashimoto
4669032e56 face: coretext zero the bitmap before render 2022-10-18 12:52:37 -07:00
Mitchell Hashimoto
58c107dceb freetype: resize glyphs that are too tall prior to storing in texture
Most emoji fonts are massive glyphs (128x128, 256x256, etc.). This means
the texture we need to store emoji is also massive. For a 128x128 emoji
font (both Apple and Noto), we can only store 12 emoji before resizing
prior to this commit.

This commit now threads through a max height through to the font face
and resizes the bitmap in memory before putting it in the atlas. This
results in significant savings. The max height is the cell height. We
allow the glyphs to be as wide as necessary due to double (and more)
wide glyphs.

For the unicode emoji test file, the atlas size before and after:

  Before: 262 MB
  After: 16 MB
2022-10-17 19:14:30 -07:00
Mitchell Hashimoto
c103a278f1 render font info in dev mode 2022-10-17 14:47:51 -07:00
Mitchell Hashimoto
7cb3f2267f use our built-in font for dev mode 2022-10-17 11:56:46 -07:00
Mitchell Hashimoto
ab721b5b26 disable inputs when they're captured by dev mode 2022-10-17 11:19:35 -07:00
Mitchell Hashimoto
a39fe6baed Use scalable check rather than fixed size check for setting char size 2022-10-16 20:55:06 -07:00
Mitchell Hashimoto
2e1bc7bb01 Bring back freetype font bitmap conversion
Monaco on Mac is mono
2022-10-16 20:47:21 -07:00
Mitchell Hashimoto
f29393bca6 Imgui (#20)
* vendor/cimgui

* Add a "dev mode" window which for now is just imgui demo
2022-10-16 16:20:08 -07:00
Mitchell Hashimoto
2d10ac0a77 opengl: setting buffer data with array must get proper pointer
This finally gets the terminal compiling with the self-hosted Zig
compiler! Wow! And this was one of those things that... should've never
worked.
2022-10-15 11:29:25 -07:00
Mitchell Hashimoto
846c9db0c3 get rid of stage2 workaround for now 2022-10-15 10:43:39 -07:00
Mitchell Hashimoto
a1087af7c8 Workaround stage2 compile issue with issue link 2022-10-14 09:56:53 -07:00
Mitchell Hashimoto
e324e38352 workaround stage2 translate-c issue with link to issue 2022-10-14 09:53:23 -07:00
Mitchell Hashimoto
2d3febac0e fix invalid ptrcast 2022-10-14 09:19:58 -07:00
Mitchell Hashimoto
c99fb89738 new opengl function calls for stage2 2022-10-14 09:18:33 -07:00
Mitchell Hashimoto
e73db24f0e move shaders into src/ tree for stage2 2022-10-14 09:18:20 -07:00
Mitchell Hashimoto
8decfa6452 I think this gets us on master zig... 2022-10-13 11:31:02 -07:00
Mitchell Hashimoto
e493a722a3 fix some issues that fail nightly stage2 compiler 2022-10-13 10:54:30 -07:00
Mitchell Hashimoto
1e23779337 pkg/macos: more stuff 2022-10-10 09:03:03 -07:00
Mitchell Hashimoto
c75e54fca0 update to API 2022-10-09 16:30:26 -07:00
Mitchell Hashimoto
276ae4f788 font: fix some coretext rendering issues 2022-10-09 11:45:02 -07:00
Mitchell Hashimoto
9c99a49ac5 font: deferred face can load core text backend 2022-10-09 11:28:28 -07:00
Mitchell Hashimoto
97e989daa8 font: coretext initial render glyph 2022-10-09 11:23:57 -07:00
Mitchell Hashimoto
1b7bc052d4 font: coretext calculate cell metrics 2022-10-09 10:57:19 -07:00
Mitchell Hashimoto
150b0a4d51 font: calculate cell height 2022-10-09 08:51:30 -07:00
Mitchell Hashimoto
a97f997f9a font: start working on core text cell height calcs 2022-10-08 17:03:09 -07:00
Mitchell Hashimoto
22f437aac6 font: coretext cell width calculation 2022-10-08 11:49:23 -07:00
Mitchell Hashimoto
f393049988 fix compilation 2022-10-08 11:25:54 -07:00
Mitchell Hashimoto
0e167ae24c font: coretext initialize face from memory 2022-10-08 11:21:24 -07:00
Mitchell Hashimoto
a21dda2b08 font: lower interface requirement for face 2022-10-08 10:07:35 -07:00
Mitchell Hashimoto
0ff79a0623 font: coretext glyphIndex 2022-10-08 10:04:17 -07:00
Mitchell Hashimoto
723db8be2f font: coretext face presentation 2022-10-08 09:55:22 -07:00
Mitchell Hashimoto
90f3b9391c font: begin coretext Face 2022-10-08 09:43:54 -07:00
Mitchell Hashimoto
71ec509930 Make font face a compile time interface, stub for coretext 2022-10-08 09:19:21 -07:00
Mitchell Hashimoto
a44d4ea33b Fix underline/strikeout position with larger fonts 2022-10-06 15:40:43 -07:00
Mitchell Hashimoto
b18309187e Strikethrough (#19)
Not as straightforward as it sounds, but not hard either:

* Read OS/2 sfnt tables from TrueType fonts
* Calculate strikethrough position/thickness (prefer font-advertised if possible, calculate if not)
* Plumb the SGR code through the terminal state -- does not increase cell memory size
* Modify the shader to support it

The shaders are getting pretty nasty after this... there's tons of room for improvement. I chose to follow the existing shader style for this to keep it straightforward but will likely soon refactor the shaders.
2022-10-06 15:03:19 -07:00
Mitchell Hashimoto
3a7e53e2e4 font: calculate correct offset for non-scalable emoji fonts 2022-10-06 14:12:03 -07:00
Mitchell Hashimoto
3b549e0709 more accurately compute font metrics 2022-10-06 11:07:49 -07:00
Mitchell Hashimoto
3d4aacd51d underline is derived from the primary font 2022-10-04 11:08:07 -07:00
Mitchell Hashimoto
c149696f61 redoing some of the baseline calcs, remove from shader 2022-10-04 10:00:32 -07:00
Mitchell Hashimoto
a4e8b5ae8c calculate font metrics per face 2022-10-03 12:31:07 -07:00
Mitchell Hashimoto
c565c561fd Use Apple Emoji font on Mac 2022-10-02 11:20:55 -07:00