# Tipografia experimental
# Grupo de estudos em Python
## Sesc Av. Paulista - 12 de junho de 2025
# Tipografia experimental
## `hackmd.io/@sesc-av-paulista/estudos-em-python-12-junho`
https://pad.riseup.net/p/sesc-python-12
Conversa de corredor: Palestra do Cory Doctorow https://www.youtube.com/watch?v=ydVmzg_SJLw&ab_channel=PyConUS
Fontes
```python
# lista das fontes instaladas no sistema
import py5
for f in py5.Py5Font.list():
if 'courier' in f.lower():
print(f)
# Para usar uma fonte https://py5coding.org/reference/sketch_create_font.html
def setup():
size(400, 400)
#no_smooth()
f = create_font('Tomorrow Bold', 48) # nome da fonte instalada ou...
# ... caminho de um arquivo .ttf ou .otf
text_font(f)
text_size(24)
#text_leading(20)
text('Opa,\nEneas!', 0, 300)
line(10, 10, 100, 100)
```
## Para extrair os contornos da fonte
https://raw.githubusercontent.com/villares/villares/refs/heads/main/shapely_helpers.py
STL https://github.com/py5coding/py5generator/discussions/620
## Tela auxiliar
```python
def setup():
size(400, 400)
background(0, 200, 0)
#no_smooth()
f = create_font('Tomorrow Bold', 48)
ta = create_graphics(width, height)
ta.begin_draw()
ta.background(100, 0, 0) # para demo, sem isso o fundo é transparente
ta.text_font(f)
ta.text_align(CENTER, CENTER)
ta.text('HELLO', 200, 200)
ta.end_draw()
image(ta, 50, 50)
```
Texto animado final
```python=
import py5_tools
def setup():
global ta
size(600, 400)
#no_smooth()
f = create_font('Tomorrow Bold', 48)
ta = create_graphics(width, height)
ta.begin_draw()
#ta.background(100, 0, 0)
ta.text_font(f)
ta.text_size(140)
ta.text_leading(120)
ta.text_align(CENTER, CENTER)
ta.text('HELLO\nSesc', width / 2, height / 2)
ta.end_draw()
# fill('#FFFFFF00') # transparente
# square(100, 100, 100)
# fill('#FFFFFFFF') # branco
# square(200, 100, 100)
py5_tools.animated_gif('out.gif', duration=0.1, frame_numbers=range(1, 11))
def draw ():
background(100)
#image(ta, 50, 50) # para debug
no_stroke()
for x in range(0, width, 5):
for y in range(0, height, 5):
px = ta.get_pixels(x, y)
# -1 == py5.color(255) >>> True
if px == color(255):
fill(random(255), random(255), 128)
circle(x, y, 5)