# More than 64 fonts in the same gui causes a crash

**URL:** <https://forum.defold.com/t/more-than-64-fonts-in-the-same-gui-causes-a-crash/76636>\
**Category:** Bugs\
**Created:** [April 17, 2024, 10:49am UTC](https://forum.defold.com/t/more-than-64-fonts-in-the-same-gui-causes-a-crash/76636 "2024-04-17T10:49:07Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![CrazyAmphibian](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/crazyamphibian/32/26089_2.png) [@CrazyAmphibian](https://forum.defold.com/u/CrazyAmphibian)\
**Post date:** [April 17, 2024, 10:49am UTC](https://forum.defold.com/t/more-than-64-fonts-in-the-same-gui-causes-a-crash/76636/1 "2024-04-17T10:49:07Z")

</div>

see: [more than 64 fonts in the same gui causes a crash · Issue #8810 · defold/defold · GitHub](https://github.com/defold/defold/issues/8810)

### Describe the bug

when putting more than 64 fonts in the game gui, it will cause a crash with the following error

```lua
ERROR:GAMESYS: Unable to add font 'font_name' to scene (-4)
WARNING:RESOURCE: Unable to create resource: /main/main.collectionc: FORMAT_ERROR

```

### Steps to reproduce the behavior:

1. create a gui
2. add more than 64 fonts
3. try to run the game

### Expected behavior (REQUIRED)

The engine does not crash

### Defold version

- Version 1.7.0

### Platforms (REQUIRED):

- Windows 10 x64

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [April 17, 2024, 10:56am UTC](https://forum.defold.com/t/more-than-64-fonts-in-the-same-gui-causes-a-crash/76636/2 "2024-04-17T10:56:51Z")

</div>

You don’t have to report github issues in the forum. We read the issues on github several times per week.

---

<div class="post-metadata">

**Author:** ![CrazyAmphibian](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/crazyamphibian/32/26089_2.png) [@CrazyAmphibian](https://forum.defold.com/u/CrazyAmphibian)\
**Post date:** [April 17, 2024, 11:00am UTC](https://forum.defold.com/t/more-than-64-fonts-in-the-same-gui-causes-a-crash/76636/3 "2024-04-17T11:00:17Z")

</div>

oh, ok  
there’s a bugs tab, so i figured i would put it here

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [April 17, 2024, 11:09am UTC](https://forum.defold.com/t/more-than-64-fonts-in-the-same-gui-causes-a-crash/76636/4 "2024-04-17T11:09:27Z")

</div>

Yeah, it’s more for asking about potential new bugs 🙂

---

<div class="post-metadata">

**Author:** ![CrazyAmphibian](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/crazyamphibian/32/26089_2.png) [@CrazyAmphibian](https://forum.defold.com/u/CrazyAmphibian)\
**Post date:** [April 17, 2024, 11:10am UTC](https://forum.defold.com/t/more-than-64-fonts-in-the-same-gui-causes-a-crash/76636/5 "2024-04-17T11:10:46Z")

</div>

ahh, got it.  
noted for future reference

---

<div class="post-metadata">

**Author:** ![NaakkaDev](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/naakkadev/32/34927_2.png) [@NaakkaDev](https://forum.defold.com/u/NaakkaDev)\
**Post date:** [April 17, 2024, 3:32pm UTC](https://forum.defold.com/t/more-than-64-fonts-in-the-same-gui-causes-a-crash/76636/6 "2024-04-17T15:32:54Z")

</div>

I’m asking this out of pure curiosity; How did you end up with that many fonts?

---

<div class="post-metadata">

**Author:** ![CrazyAmphibian](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/crazyamphibian/32/26089_2.png) [@CrazyAmphibian](https://forum.defold.com/u/CrazyAmphibian)\
**Post date:** [April 17, 2024, 4:29pm UTC](https://forum.defold.com/t/more-than-64-fonts-in-the-same-gui-causes-a-crash/76636/7 "2024-04-17T16:29:36Z")

</div>

for my project i have to make any font that _could_ be used ahead of time, since the engine doesn’t allow them to be made at runtime.

i’ve had to severely cut down on them, even, but currently:  
2 font faces (monospaced, sans-serif)  
4 font styles (regular, bold, italic, bold italic)  
2 outline styles (none, outlined)  
4 font sizes

---

<div class="post-metadata">

**Author:** ![Chung\_Xa](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/chung_xa/32/34470_2.png) [@Chung\_Xa](https://forum.defold.com/u/Chung_Xa)\
**Post date:** [April 17, 2024, 4:38pm UTC](https://forum.defold.com/t/more-than-64-fonts-in-the-same-gui-causes-a-crash/76636/8 "2024-04-17T16:38:55Z")

</div>

Is it better to use scale on text nodes instead of font variants?

---

<div class="post-metadata">

**Author:** ![CrazyAmphibian](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/crazyamphibian/32/26089_2.png) [@CrazyAmphibian](https://forum.defold.com/u/CrazyAmphibian)\
**Post date:** [April 17, 2024, 4:44pm UTC](https://forum.defold.com/t/more-than-64-fonts-in-the-same-gui-causes-a-crash/76636/9 "2024-04-17T16:44:06Z")

</div>

well, the last time i used a really big font (if it’s not bigger, then the font will look bad when you upscale it), it used all the cache and also led to the UI failing to load properly

---

<div class="post-metadata">

**Author:** ![Chung\_Xa](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/chung_xa/32/34470_2.png) [@Chung\_Xa](https://forum.defold.com/u/Chung_Xa)\
**Post date:** [April 17, 2024, 4:53pm UTC](https://forum.defold.com/t/more-than-64-fonts-in-the-same-gui-causes-a-crash/76636/10 "2024-04-17T16:53:57Z")

</div>

It seems you are using Bitmap fonts? You can try Distance Field fonts which could keep your texts display well on scaling

---

<div class="post-metadata">

**Author:** ![CrazyAmphibian](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/crazyamphibian/32/26089_2.png) [@CrazyAmphibian](https://forum.defold.com/u/CrazyAmphibian)\
**Post date:** [April 17, 2024, 5:39pm UTC](https://forum.defold.com/t/more-than-64-fonts-in-the-same-gui-causes-a-crash/76636/11 "2024-04-17T17:39:56Z")

</div>

yeah, using a distance field frees up some slots, but those are quickly backfilled again

---

<div class="post-metadata">

**Author:** ![NaakkaDev](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/naakkadev/32/34927_2.png) [@NaakkaDev](https://forum.defold.com/u/NaakkaDev)\
**Post date:** [April 17, 2024, 6:23pm UTC](https://forum.defold.com/t/more-than-64-fonts-in-the-same-gui-causes-a-crash/76636/12 "2024-04-17T18:23:50Z")

</div>

Ah I see! That will indeed quickly add up. Thanks.
