# component_preview: Fix example rendering no text or icons \(\#59241\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/f9d57b54dcbc2263581790ec95d3a004df0d288e)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: f9d57b54dcbc2263581790ec95d3a004df0d288e

Requested commit: f9d57b54dcbc2263581790ec95d3a004df0d288e

Commit: f9d57b54dcbc2263581790ec95d3a004df0d288e

Tree: 2dbd7dd56f6e9254a3181454d320b2050261b66f

Author: Sergei G\.

Committer: GitHub

## Message

````
component_preview: Fix example rendering no text or icons (#59241)

`cargo run -p component_preview --example component_preview` does not
work.
On current main it panics at startup:

```
thread 'main' panicked at crates/gpui/src/action.rs:296:13:
Action with name `zed::Quit` already registered
```

With that panic fixed, the window opens but renders no text and no icons
(see Showcase below).s

## Solution

Root cause for the blank window: `component_preview` package resolves
`gpui_platform` with just `"screen-capture"`.

On macOS the missing `font-kit` feature makes `MacPlatform` fall back to
`gpui::NoopTextSystem`, as mentiond also in README (or CONTRIBUTE) file.

On Linux the missing `wayland`/`x11` features leave no windowing backend
at all.

list of changes:

- Enable the same `gpui_platform` features as the `zed` binary.
- Attach `Assets` and load the embedded fonts.
- Initialize `env_logger` so platform warnings reach the terminal.
- Fix three startup panics: move the example's `Quit` action to the
`component_preview` namespace.

## Testing

Tested on macOS/Linux, not tested on Windows. I use Parallel VMs.

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)

## Showcase

Before:
<img width="1312" height="945" alt="cp_pr1_before"
src="https://github.com/user-attachments/assets/4611596f-6775-4863-bd4a-5f4d8c642e35"
/>

After:
<img width="1312" height="945" alt="cp_pr1_after"
src="https://github.com/user-attachments/assets/8f8082e6-c8cd-48f5-946a-032ce8186d30"
/>

---

Release Notes:

- N/A
````

## Parents

- [f39cf25c0ba571eaaa7a21f3266c8a356367fa5f](https://git.cafe/gitcafe/zed/commit/f39cf25c0ba571eaaa7a21f3266c8a356367fa5f?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/f9d57b54dcbc2263581790ec95d3a004df0d288e?format=markdown)
