docs: TTF bug NO RESUELTO - documentación completa

- Actualiza CLAUDE.md: bug crítico TTF prominente
- Documenta 3 intentos fallidos (DroidSans, Y-flip, UTF-8)
- Añade hipótesis actuales y pasos de verificación
- Instrucciones claras para próxima sesión

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
reugenio 2025-12-16 13:37:08 +01:00
parent 399afc1149
commit d68ba3a03a

View file

@ -129,30 +129,65 @@ GPU/CPU interpola → bordes suaves sin multisampling
--- ---
## TAREA COMPLETADA: Fuentes TTF con Antialiasing ✅ ## ⚠️ BUG CRÍTICO: TTF Rendering Corrupto (NO RESUELTO)
> **Prioridad**: ALTA
> **Documentación completa**: `/mnt/cello2/arno/re/recode/teamdocs/agenda/hitos/2025-12-16_ttf_debug_session.md`
> **Fecha**: 2025-12-16
### El Problema
El texto TTF se renderiza como **garabatos ilegibles** en zsimifactu. TODO el texto está corrupto, incluyendo ASCII básico (A-Z, a-z, 0-9), no solo caracteres acentuados.
### Lo que se intentó (NO funcionó)
| Intento | Hipótesis | Resultado |
|---------|-----------|-----------|
| DroidSans | AdwaitaSans era fuente variable | ❌ Sigue corrupto |
| Y-flip | Coordenadas TTF invertidas | ❌ Sigue corrupto |
| UTF-8 decode | drawText iteraba bytes | ❌ Sigue corrupto |
### Hipótesis actuales (NO verificadas)
1. **Tabla cmap mal parseada para DroidSans** - Los tests de glyph indices ('A'=36) fueron con AdwaitaSans
2. **Formato cmap diferente** - DroidSans podría usar formato no soportado
3. **Renderer no usa TTF** - Posible fallback o fuente no cargada
4. **Pipeline corrupto** - Algo entre parseo y dibujo falla
### ⚠️ INSTRUCCIONES PARA PRÓXIMA SESIÓN
**IMPORTANTE: NO hacer cambios sin antes verificar:**
1. Que DroidSans se carga realmente (`font_data.len` ≈ 187KB)
2. Glyph indices de DroidSans: `getGlyphIndex('A')`, `getGlyphIndex('a')`
3. Formato cmap que usa DroidSans (format 4? 12? otro?)
4. Probar fuente del sistema vs embebida
5. Test aislado: renderizar 'A' a ASCII art
### Archivos clave
- `src/render/ttf.zig` - Parser TTF + rasterización (~1000 líneas)
- `src/render/embedded_font.zig` - Fuente embebida
- `src/render/fonts/DroidSans.ttf` - Fuente actual (187KB)
---
## Fuentes TTF: Implementación Técnica
### Estado actual (v0.16.2) ### Estado actual (v0.16.2)
- ✅ Parsing TTF completo (glyf, cmap format 4 y 12) - ✅ Parsing TTF (glyf, cmap format 4 y 12)
- ✅ Rasterización con bezier cuadráticas - ✅ Rasterización bezier cuadráticas
- ✅ Antialiasing 2x supersampling - ✅ Antialiasing 2x supersampling
- ✅ **Fuente embebida** (DroidSans, 187KB) - Fuente estática clásica - ✅ Fuente embebida (DroidSans)
- ✅ Integración con SoftwareRenderer - ❌ **BUG: Rendering corrupto** (ver arriba)
- ⚠️ **Pendiente:** UTF-8 multibyte (á,é,ñ) - drawText itera bytes, no codepoints
### Uso ### Uso (cuando funcione)
```zig ```zig
// Fuente embebida (RECOMENDADO - cero dependencias)
var ttf = try TtfFont.initEmbedded(allocator); var ttf = try TtfFont.initEmbedded(allocator);
defer ttf.deinit(); defer ttf.deinit();
ttf.setSize(14); ttf.setSize(14);
renderer.setTtfFont(&ttf); renderer.setTtfFont(&ttf);
``` ```
### Archivos clave
- `src/render/ttf.zig` - Parsing y rasterización TTF
- `src/render/embedded_font.zig` - Fuente embebida
- `src/render/fonts/DroidSans.ttf` - Datos de fuente (Apache 2.0)
--- ---
## INFORMACIÓN DEL PROYECTO ## INFORMACIÓN DEL PROYECTO