33 Commits

Author SHA1 Message Date
Qwerasd
2384bd69cc style: use decl literals
This commit changes a LOT of areas of the code to use decl literals
instead of redundantly referring to the type.

These changes were mostly driven by some regex searches and then manual
adjustment on a case-by-case basis.

I almost certainly missed quite a few places where decl literals could
be used, but this is a good first step in converting things, and other
instances can be addressed when they're discovered.

I tested GLFW+Metal and building the framework on macOS and tested a GTK
build on Linux, so I'm 99% sure I didn't introduce any syntax errors or
other problems with this. (fingers crossed)
2025-05-26 21:50:14 -06:00
Qwerasd
5319d38366 fix(tests): correctly deinit font faces 2025-05-01 18:37:47 -06:00
Qwerasd
cfedd477b2 font/freetype: introduce mutexes to ensure thread safety of Library and Face
For details see comments and FreeType docs @
https://freetype.org/freetype2/docs/reference/ft2-library_setup.html#ft_library
https://freetype.org/freetype2/docs/reference/ft2-face_creation.html#ft_face

tl;dr: FT_New_Face and FT_Done_Face require the Library to be locked for
thread safety, and FT_Load_Glyph and FT_Render_Glyph and friends need
the face to be locked for thread safety, since we're sharing faces
across threads.
2025-05-01 18:22:37 -06:00
Mitchell Hashimoto
0f4d2bb237 Lots of 0.14 changes 2025-03-12 09:55:52 -07:00
Qwerasd
298aeb7536 refactor(font): move ownership of Metrics to Collection
This sets the stage for dynamically adjusting the sizes of fallback
fonts based on the primary font's face metrics. It also removes a lot of
unnecessary work when loading fallback fonts, since we only actually use
the metrics based on the parimary font.
2025-01-06 20:13:45 -05:00
Qwerasd
540fcc0b69 refactor(font): move Metrics out of face
in preparation to move ownership of metrics from faces to collections
2025-01-06 20:13:45 -05:00
Nadir Fejzic
0e0751ad5b docs: write documentation for freetype_load_flags field 2024-11-09 12:34:45 +01:00
Nadir Fejzic
83c4d0077b refactor: define FreetypeLoadFlags struct and default in font.face 2024-11-09 12:34:39 +01:00
Nadir Fejzic
c0b24ee60d refactor: make freetype flags void for non-freetype backend
This is an attempt to use `void` as type for Freetype Load Flags when
backend does not use these flags.
2024-11-09 01:39:10 +01:00
Nadir Fejzic
945a715b08 refactor: handle freetype load flags in face instead of renderer 2024-11-09 00:42:18 +01:00
Mitchell Hashimoto
3f1d6eb301 expand explicit error set usage
This continues our work to improve the amount of explicit error sets
we use in the codebase. Explicit error sets make it easier to understand
possible failure scenarios, allow us to use exhaustive matching, create
compiler errors if errors are unexpectedly added or removed, etc.

The goal eventually is 100% coverage but we're not even close yet.
This just moves us a little closer.
2024-10-18 08:10:41 -07:00
Mitchell Hashimoto
be3ae56bc8 font: add stylistic variants for built-in font, fix naming convention
Fixes #2364

This adds the bold, italic, and bold italic variants of JB Mono so it is
built-in. This also fixes up the naming convention for the embedded font
files across tests and removes redundant embedded font files.
2024-10-02 15:17:18 -07:00
Mitchell Hashimoto
bdcc21942d config: font-synthetic-style to enable/disable synthetic styles
This adds a new configuration "font-synthetic-style" to enable or
disable synthetic styles. This is different from "font-style-*" which
specifies a named style or disables a style completely.

Instead, "font-synthetic-style" will disable only the creation of
synthetic styles in the case a font does not support a given style.
This is useful for users who want to obviously know when a font doesn't
support a given style or a user who wants to explicitly only use the
styles that were designed by the font designer.

The default value is to enable all synthetic styles.
2024-08-26 20:52:34 -07:00
Mitchell Hashimoto
ac3e2163f3 typos 2024-08-24 19:49:04 -07:00
Mitchell Hashimoto
ce6c5517af font: synthesize bold italic 2024-08-23 21:08:41 -07:00
Mitchell Hashimoto
d22551cd31 font/coretext: support synthetic bold 2024-08-23 20:53:22 -07:00
Mitchell Hashimoto
74291793db font: rename auto-italicize to synthetic italic 2024-08-23 20:34:37 -07:00
Mitchell Hashimoto
9941440f47 font: bold italic fallback has to avoid nested alias entry 2024-08-23 20:20:44 -07:00
Mitchell Hashimoto
47fb7f0115 font: Collection can't use segmentedlist prealloc 2024-08-23 19:18:21 -07:00
Mitchell Hashimoto
874caf29da font: completeStyles 2024-08-23 15:21:26 -07:00
Mitchell Hashimoto
1f3ccb2d66 font: Collection uses SegmentedList for styles for pointer stability 2024-08-23 14:50:04 -07:00
Mitchell Hashimoto
c183e71a92 font: support aliased entries in the font collection style table 2024-08-23 14:31:29 -07:00
Mitchell Hashimoto
326659c522 font: handle presentation at glyph layer 2024-05-28 20:09:05 -07:00
Mitchell Hashimoto
b77513de1a font/harfbuzz: work with new font structures 2024-04-05 21:48:53 -07:00
Mitchell Hashimoto
4a29da3525 font: SharedGridSet clarify memory ownership 2024-04-05 15:15:30 -07:00
Mitchell Hashimoto
b2541d24f1 font: CodepointResolver style disabling test 2024-04-05 09:29:41 -07:00
Mitchell Hashimoto
4eccd42f6b font: CodepointResolver beginnings 2024-04-05 09:29:41 -07:00
Mitchell Hashimoto
bd479db09f font: Collection setSize 2024-04-05 09:29:41 -07:00
Mitchell Hashimoto
4d70859864 font: Collection autoItalicize 2024-04-05 09:29:41 -07:00
Mitchell Hashimoto
40b4183b1f font: Collection deinit 2024-04-05 09:29:41 -07:00
Mitchell Hashimoto
0d0688404e font: Collection.getIndex 2024-04-05 09:29:41 -07:00
Mitchell Hashimoto
833d54e441 font: Collection has load options 2024-04-05 09:29:41 -07:00
Mitchell Hashimoto
72d59956d5 font: [broken] working on extracting Collection from Group 2024-04-05 09:29:40 -07:00