Kit · K03: init checks every bundled file through the app's source; Assets::before joins another source
This commit is contained in:
1 parent
dabc1eb4d2
commit
98de2a455f
7 files changed
+119
-15
No files matched your search
@@ -6,7 +6,7 @@ An Ely app is a GPUI app with four more parts: Ely's assets, one call to `init`,
|
||||
|
||||
| Part | Why |
|
||||
| --- | --- |
|
||||
| `gpui_platform::application().with_assets(Assets)` | Ely embeds its icons and fonts. `init` returns an error without them. |
|
||||
| `gpui_platform::application().with_assets(Assets)` | Ely embeds its icons and fonts. `init` returns an error when the source cannot load one of them. |
|
||||
| `ely_gpui_component::init(cx)?` | Call once, before any window. It returns an error if the asset source fails. It registers the fonts, sets the theme, and binds Tab, Shift-Tab and the keys of text fields, the code editor, documents and, natively, the terminal. |
|
||||
| A root `FocusScope` | `FocusScope::new(&handle).root()` owns Tab for the window and takes focus back when the focused element leaves the tree. Focus its handle when the window opens. |
|
||||
| `cx.theme()` | Colors, sizes and radii come from the theme. Components read it; an app's own boxes read it too. |
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Icons, fonts and assets
|
||||
|
||||
`Assets` embeds Ely's icons and fonts in the binary. Pass it to `with_assets`; `init` registers the fonts and checks that `icons/check.svg` loads.
|
||||
`Assets` embeds Ely's icons and fonts in the binary. Pass it to `with_assets`, or `Assets::before(other)` to serve Ely's files first and every other path from another source; `init` checks that each of Ely's files loads through the app's source, then registers the fonts.
|
||||
|
||||
## Icons
|
||||
|
||||
@@ -42,7 +42,7 @@ A name rule beats an extension rule, and both beat Ely's map.
|
||||
|
||||
## An app's own assets
|
||||
|
||||
GPUI takes one asset source. An app with files of its own writes an `AssetSource` that answers its own paths and hands every other path to `Assets`. `init` returns an error unless `icons/check.svg` loads through it.
|
||||
GPUI takes one asset source. An app with files of its own, or another library's, passes `Assets::before(theirs)`: Ely's paths load from Ely, every other path from `theirs`, whose errors pass through. `init` returns an error naming the first of Ely's files the source cannot load.
|
||||
|
||||
Use `Icon::from_path("app-icons/mark.svg")` to draw one of those SVG assets with Ely's themed sizing and color. It also accepts an owned `String` or `SharedString`. Paths are asset keys resolved by `AssetSource`; a path it lacks logs an error on first draw and shows a red broken-picture icon. SVGs render as single-color masks; `IconName` and `IconPicker` continue to list the bundled icons.
|
||||
|
||||
|
||||
@@ -41,8 +41,7 @@ A window opens with a counter and a Press button. From a clone of the repository
|
||||
|
||||
| Symptom | Cause and fix |
|
||||
| --- | --- |
|
||||
| `init` error: `` ely: pass `ely_gpui_component::Assets` to `Application::with_assets` `` | `init` found no Ely assets. Start the app with `gpui_platform::application().with_assets(Assets)`. |
|
||||
| `init` error: `ely: asset source failed` | The app's asset source returned an error. The error carries it. |
|
||||
| `init` error: `ely: the asset source lacks N of Ely's files, first <path>: <reason>` | The app's source cannot load every file Ely bundles. Pass `Assets`, or `Assets::before(yours)` when the app has a source of its own. |
|
||||
| `init` error: `ely: embedded fonts failed to register` | GPUI's text system refused Ely's fonts. File a bug with the log. |
|
||||
| Windows open with no text on macOS | `gpui_platform` lacks the `font-kit` feature. |
|
||||
| `mismatched types`, with the note ``there are multiple different versions of crate `gpui` in the dependency graph`` | `gpui` names another snapshot or a git source. Use `gpui-pre` at `=0.3.8`. |
|
||||
|
||||
Reference in new issue
Block a user