# gpui/metal: Clamp max texture width/height to 16kB \(\#10314\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 4fb9f41e6954fe6b51faaae60dea955f133b9a7b

Requested commit: 4fb9f41e6954fe6b51faaae60dea955f133b9a7b

Commit: 4fb9f41e6954fe6b51faaae60dea955f133b9a7b

Tree: cc0a9ab784880b6a518ff1a81bb08706dd7bc6c4

Author: Piotr Osiewicz

Committer: GitHub

## Message

```
gpui/metal: Clamp max texture width/height to 16kB (#10314)

Fixed #10149
A user had Zed crash due to invalid font size in settings. It turned out
the width/height of glyphs does not pass validation in Metal texture
initialization with a large enough font size.

All modern Macs have a max texture width/height of 16kB (barring Apple
A8, used by iPhone 6 back in 2014, which uses 8kB). This commit clamps
texture size at 16kB. Note that while it fixes Zed crash, using a font
size that hits the limit is still pretty unusable - the users will still
have a pretty unusable editor, but at least it won't crash for them.



Release Notes:

- Fixed crashes with huge `buffer_font_size` values.
```

## Parents

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

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