From d68ba3a03a1370a0bffd27810f48cac80d348a95 Mon Sep 17 00:00:00 2001 From: reugenio Date: Tue, 16 Dec 2025 13:37:08 +0100 Subject: [PATCH] =?UTF-8?q?docs:=20TTF=20bug=20NO=20RESUELTO=20-=20documen?= =?UTF-8?q?taci=C3=B3n=20completa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- CLAUDE.md | 61 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 13 deletions(-) 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