Mitchell Hashimoto
ec69644de6
move stb to src/stb, add stb_image for png decoding
2023-08-20 22:03:20 -07:00
Mitchell Hashimoto
9e27dcdec9
font: shaper doesn't split run on selection if selection splits grapheme
2023-08-15 15:32:10 -07:00
Mitchell Hashimoto
0af6edc25b
only the app should own the font discovery instance
2023-08-13 11:51:24 -07:00
Mitchell Hashimoto
619d2ade3e
only initialize font discovery mechanism once, cache on App
...
Fontconfig in particular appears unsafe to initialize multiple times.
Font discovery is a singleton object in an application and only ever
accessed from the main thread so we can work around this by only
initializing and caching the font discovery mechanism exactly once on
the app singleton.
2023-08-13 08:01:33 -07:00
Kevin Hovsäter
22b8173164
Fix typos
2023-08-08 14:27:34 +02:00
Mitchell Hashimoto
4137c6cf69
font/shaper: do not break on merged emoji if cursor is directly on it
2023-07-18 16:38:02 -07:00
Mitchell Hashimoto
4b062dc45c
font/shaper: text runs should split around block cursors
...
Fixes #206
2023-07-18 16:20:30 -07:00
Mitchell Hashimoto
9300404603
font: block cursor was not taking full cell width
2023-07-10 11:45:35 -07:00
Mitchell Hashimoto
45ac9b5d4c
font-feature config to enable/disable OpenType Font Features
2023-07-05 13:12:30 -07:00
Mitchell Hashimoto
853f15ef19
bar cursor was short by a couple pixels
2023-07-04 13:12:21 -07:00
Mitchell Hashimoto
8113ad1393
font: share skew matrix for core text
2023-07-03 15:58:52 -07:00
Mitchell Hashimoto
c90a52ee50
font: don't fallback styles when searching for a codepoint
...
see comment
2023-07-03 15:55:01 -07:00
Mitchell Hashimoto
4bf8a0d149
font: support skew transform for auto-italics
2023-07-03 15:54:50 -07:00
Mitchell Hashimoto
369a7dda4c
coretext: use alternate approach to calcaulate cell height and ascent
...
Fixes #174
2023-07-03 14:26:06 -07:00
Mitchell Hashimoto
0e802b6118
coretext: switch up positive/negative y axis values
...
No functional change, just swapping the math around to match freetype.
2023-07-03 14:04:35 -07:00
Mitchell Hashimoto
0faf6097d0
Change font metrics to all be integers, not floats.
...
Font metrics realistically should be integral. Cell widths, cell
heights, etc. do not make sense to be floats, since our grid is
integral. There is no such thing as a "half cell" (or any point).
The reason we historically had these all as f32 is simplicity mixed
with history. OpenGL APIs and shaders all use f32 for their values, we
originally only supported OpenGL, and all the font rendering used to be
directly in the renderer code (like... a year+ ago).
When we refactored the font metrics calculation to its own system and
also added additional renderers like Metal (which use f64, not f32), we
never updated anything. We just kept metrics as f32 and casted
everywhere.
With CoreText and #177 this finally reared its ugly head. By forgetting
a simple rounding on cell metric calculation, our integral renderers
(sprite fonts) were off by 1 pixel compared to the GPU renderers.
Insidious.
Let's represent font metrics with the types that actually make sense: a
cell width/height, etc. is _integral_. When we get to the GPU, we now
cast to floats. We also cast to floats whenever we're doing more precise
math (i.e. mouse offset calculation). In this case, we're only
converting to floats from a integral type which is going to be much
safer and less prone to uncertain rounding than converting to an int
from a float type.
Fixes #177
2023-07-03 11:23:20 -07:00
Mitchell Hashimoto
9968128da9
fix failing test on non-Mac
2023-07-01 15:17:50 -07:00
Mitchell Hashimoto
1d1b868958
font: do not use Noto on macOS for tests, it doesn't work
2023-07-01 13:51:31 -07:00
Mitchell Hashimoto
0a718ec3eb
pkg/macos: do not use bitCast through a function
...
workaround Zig issue: https://github.com/ziglang/zig/issues/16290
2023-07-01 13:38:10 -07:00
Mitchell Hashimoto
06f63288c8
coretext: address TODO
2023-07-01 10:15:50 -07:00
Mitchell Hashimoto
126817cac2
coretext: tweak underline position
2023-07-01 10:12:29 -07:00
Mitchell Hashimoto
51e42a62ed
font: default rasterizer on macOS is now coretext
2023-07-01 10:04:49 -07:00
Mitchell Hashimoto
3795cd6c2d
font: turn rasterization options into a struct, add thicken
2023-07-01 09:55:19 -07:00
Mitchell Hashimoto
e99376cac1
font: update comment
2023-07-01 09:23:41 -07:00
Mitchell Hashimoto
b5cc37e20c
font: comment out debug logs
2023-07-01 09:23:40 -07:00
Mitchell Hashimoto
42cc11e32c
coretext: remove the old renderGlyph impl
2023-07-01 09:23:40 -07:00
Mitchell Hashimoto
3c5be0726f
sprite: all rasterized sprites should have a 1px padding
2023-07-01 09:23:40 -07:00
Mitchell Hashimoto
362eeac74b
coretext: do not treat color diffs special for offset
2023-07-01 09:23:40 -07:00
Mitchell Hashimoto
d39e3f5428
coretext: improved baseline calculation
2023-07-01 09:23:40 -07:00
Mitchell Hashimoto
69396b0853
coretext: layout rect must fit all chars
2023-07-01 09:23:40 -07:00
Mitchell Hashimoto
5706770c38
coretext: handle glyph padding in region reservation
2023-07-01 09:23:40 -07:00
Mitchell Hashimoto
55254acaad
coretext: fix emoji placement
2023-07-01 09:23:40 -07:00
Mitchell Hashimoto
c52dc229f3
coretext: validate atlas depth matches color depth
2023-07-01 09:23:40 -07:00
Mitchell Hashimoto
a74e49833b
coretext: colored glyph rendering
2023-07-01 09:23:40 -07:00
Mitchell Hashimoto
286944cd43
cleaning up rasterization, comments
2023-07-01 09:23:39 -07:00
Mitchell Hashimoto
552a1b51d0
coretext: rasterization looking cleaner
2023-07-01 09:23:39 -07:00
Mitchell Hashimoto
079fe7bc94
coretext: the size needs to be in pixels! (see comment)
2023-07-01 09:23:39 -07:00
Mitchell Hashimoto
4d7a2c9f05
font: remove the old comment about not doing the grey stroke
2023-07-01 09:23:39 -07:00
Mitchell Hashimoto
45da58188c
fix up for new zig
2023-07-01 09:23:39 -07:00
Mitchell Hashimoto
ef5d86ffb0
coretext: initially fill grey
2023-07-01 09:23:39 -07:00
Mitchell Hashimoto
2a1cbb4f21
coretext: calculate units per em/point
2023-07-01 09:23:39 -07:00
Mitchell Hashimoto
314f9287b1
Update Zig ( #164 )
...
* update zig
* pkg/fontconfig: clean up @as
* pkg/freetype,harfbuzz: clean up @as
* pkg/imgui: clean up @as
* pkg/macos: clean up @as
* pkg/pixman,utf8proc: clean up @as
* clean up @as
* lots more @as cleanup
* undo flatpak changes
* clean up @as
2023-06-30 12:15:31 -07:00
Mitchell Hashimoto
56f8e39e5b
Update zig, mach, fmt
2023-06-25 11:08:20 -07:00
Mitchell Hashimoto
30fdbaebf4
font: run splitting needs to detect italics
2023-06-23 13:56:07 -07:00
Mitchell Hashimoto
6e79e84acf
config file quoted strings are accepted now
2023-06-23 13:45:48 -07:00
Mitchell Hashimoto
1d45df17e4
font: underline sprites should never go out of bounds for canvas
2023-06-22 20:11:57 -07:00
Mitchell Hashimoto
43554c1b64
font: remove old logging
2023-06-22 16:07:43 -07:00
Mitchell Hashimoto
e810a7bf91
font: fix double underline drawing with very low underline positions
2023-06-22 16:07:10 -07:00
Mitchell Hashimoto
cfb8108279
font: curly underline has a minimum wave height
...
This fixes rendering issues with some fonts where the underline position
is too close to the bottom of the cell causing a very shallow curl.
2023-06-22 16:01:00 -07:00
Mitchell Hashimoto
01de38b20d
font: if CoreText needs to allocate, stack allocate and log
2023-05-31 22:03:27 -07:00