diff --git a/CLAUDE.md b/CLAUDE.md index 7e8131e..f019ed9 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -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) -- ✅ Parsing TTF completo (glyf, cmap format 4 y 12) -- ✅ Rasterización con bezier cuadráticas +- ✅ Parsing TTF (glyf, cmap format 4 y 12) +- ✅ Rasterización bezier cuadráticas - ✅ Antialiasing 2x supersampling -- ✅ **Fuente embebida** (DroidSans, 187KB) - Fuente estática clásica -- ✅ Integración con SoftwareRenderer -- ⚠️ **Pendiente:** UTF-8 multibyte (á,é,ñ) - drawText itera bytes, no codepoints +- ✅ Fuente embebida (DroidSans) +- ❌ **BUG: Rendering corrupto** (ver arriba) -### Uso +### Uso (cuando funcione) ```zig -// Fuente embebida (RECOMENDADO - cero dependencias) var ttf = try TtfFont.initEmbedded(allocator); defer ttf.deinit(); ttf.setSize(14); 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