# Mode T - Font Patterns (stock mode) Crash

**URL:** <https://forum.critterandguitari.com/t/mode-t-font-patterns-stock-mode-crash/8487>\
**Category:** EYESY\
**Created:** [June 2, 2022, 5:04pm UTC](https://forum.critterandguitari.com/t/mode-t-font-patterns-stock-mode-crash/8487 "2022-06-02T17:04:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![FustavGromm](https://avatars.discourse-cdn.com/v4/letter/f/71e660/32.png) [@FustavGromm](https://forum.critterandguitari.com/u/FustavGromm)\
**Post date:** [June 2, 2022, 5:04pm UTC](https://forum.critterandguitari.com/t/mode-t-font-patterns-stock-mode-crash/8487/1 "2022-06-02T17:04:34Z")

</div>

Hi,

after some tweaking, the mode in the object crashes and send me a message:

Traceback (most recent call last):  
File “main.py”, line 195, in   
mode.draw(screen,etc)  
File"sdcard/Modes/Python/T - Font Patterns//.py", line 29, in draw  
text = font.render(unistr, True, (color))  
error: Text has zero width

How can I solve it?

It is possible to download this stock mode again in case I made some mistake? (even if I didn’t change anything here)

Thanks

W.

---

<div class="post-metadata">

**Author:** ![FustavGromm](https://avatars.discourse-cdn.com/v4/letter/f/71e660/32.png) [@FustavGromm](https://forum.critterandguitari.com/u/FustavGromm)\
**Post date:** [June 2, 2022, 5:35pm UTC](https://forum.critterandguitari.com/t/mode-t-font-patterns-stock-mode-crash/8487/2 "2022-06-02T17:35:20Z")

</div>

I copied the error during the performance from the editor view:

File “/sdcard/Modes/Python/T - Font Patterns//main.py”, line 29, in draw  
text = font.render(unistr, True, (color))  
error: Text has zero width

this is the code reloaded:  
import os  
import pygame  
import time  
import random

count = 0  
trigger = False  
unistr = unichr(random.randint(0x25a0, 0x25ff))  
textpos = (0,0)

def setup(screen, etc):  
pass

def draw(screen, etc):  
global count, trigger, unistr, textpos  
etc.color\_picker\_bg(etc.knob5)  
xr = etc.xres  
yr = etc.yres  
x320 = ((320_xr)/1280)  
x160 = ((160_xr)/1280)  
x260 = ((260_xr)/1280)  
x80 = ((80_xr)/1280)  
y90 = ((90_yr)/720)  
y45 = ((45_yr)/720)  
shift = int(etc.knob1\*x320-x160)  
size = int(etc.knob2 \* x260) + 5  
font = pygame.font.Font(etc.mode\_root + “/font.ttf”, size)  
color = etc.color\_picker(etc.knob4)  
text = font.render(unistr, True, (color))  
y = 0

```
if etc.audio_trig or etc.midi_note_new :
    trigger = True
    
if trigger == True :
    unistr = get_unicode_character(int(etc.knob3 * 10)+1)

for i in range(0,81) :
    
    odd = i%2
    if odd == 0 :
        x = ((i % 9) * x160 + x80 + shift) - x160
        y = (int(i / 9) % 9) * y90 + y45 #+ (shift-70)
            
    if odd == 1 :
        x = ((i % 9) * x160 + x80) - x160
        y = (int(i / 9) % 9) * y90 + y45
        
    textpos = text.get_rect(center = (x,y))
    screen.blit(text, textpos)
trigger = False

```

def get\_unicode\_character(set) :

```
if set == 0 :
    # all of them (or a lot of them...)
    return unichr(random.choice((0x0000, 0xFF00)) + random.randint(0, 0xff))
    
if set == 1 :
    # ogham
    return unichr(random.randint(0x1680, 0x169C))
    
if set == 2 :
    # arrows
    return unichr(random.randint(0x2190, 0x21FF))
    
if set == 3 :
    # math
    return unichr(random.randint(0x2200, 0x22ff))
    
if set == 4 :
    # geometric shapes
    return unichr(random.randint(0x25a0, 0x25ff))
    
if set == 5 :
    # box drawing
    return unichr(random.randint(0x2500, 0x257f))
    
if set == 6 :
    # Brail
    return unichr(random.randint(0x2800, 0x28FF))
    
if set == 7 :
    # More math
    return unichr(random.randint(0x2A00, 0x2ADF))
    
if set == 8 :
    # from math -- sharp symbols
    return unichr(random.randint(0x2A80, 0x2ABC))

if set == 9 :
    # more arrows
    return unichr(random.randint(0x2900, 0x297F))

if set == 10 :
    #chess
    return unichr(random.randint(0xE010, 0xE04F))
    
if set == 11 :
    #Genji-mon Symbols
    return unichr(random.randint(0xF500, 0xF535))
```

---

<div class="post-metadata">

**Author:** ![jcgriggs](https://avatars.discourse-cdn.com/v4/letter/j/9e8a1a/32.png) [@jcgriggs](https://forum.critterandguitari.com/u/jcgriggs)\
**Post date:** [June 2, 2022, 7:51pm UTC](https://forum.critterandguitari.com/t/mode-t-font-patterns-stock-mode-crash/8487/3 "2022-06-02T19:51:18Z")

</div>

I think this is discussed and solved here: [Bug in one of EYESY's factory modes - Text has zero width](https://forum.critterandguitari.com/t/bug-in-one-of-eyesys-factory-modes-text-has-zero-width/6388), although maybe for a different stock mode.

Regards,  
John

---

<div class="post-metadata">

**Author:** ![FustavGromm](https://avatars.discourse-cdn.com/v4/letter/f/71e660/32.png) [@FustavGromm](https://forum.critterandguitari.com/u/FustavGromm)\
**Post date:** [June 3, 2022, 11:17am UTC](https://forum.critterandguitari.com/t/mode-t-font-patterns-stock-mode-crash/8487/4 "2022-06-03T11:17:06Z")

</div>

> [@jcgriggs](#):
>
> John

Dear John,

thank you very much for your kind reply. I solved downloading the update file via [Bug in one of EYESY's factory modes - Text has zero width - #20 by chrisk](https://forum.critterandguitari.com/t/bug-in-one-of-eyesys-factory-modes-text-has-zero-width/6388/20)

Regards,

W.
