docs: Actualizar CLAUDE.md - zcatttf v1.0 funcionando
- TTF section actualizada: TRIUNFO HISTÓRICO zcatttf v1.0 - Lección clave: 'No reimplementar, TRADUCIR' - Bug final: y_offset = -iy0 (positivo, no negativo) - Versión actualizada a v0.17.0 - PROYECTOS RELACIONADOS: zcatttf v1.0 COMPLETA 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
8b90a1b285
commit
6bf1eb1eb8
1 changed files with 49 additions and 58 deletions
107
CLAUDE.md
107
CLAUDE.md
|
|
@ -129,82 +129,72 @@ GPU/CPU interpola → bordes suaves sin multisampling
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## ⚠️ BUG TTF: Rendering Corrupto → SOLUCIÓN: zcatttf
|
## ✅ TTF Rendering - RESUELTO (2025-12-17) ⭐⭐⭐
|
||||||
|
|
||||||
> **Estado**: PAUSADO - Nueva librería zcatttf en desarrollo (otra conversación)
|
> **Estado**: ✅ COMPLETADO - zcatttf v1.0 integrado y funcionando perfectamente
|
||||||
> **Documentación debug**: `docs/research/TTF_DEBUG_SESSION_2025-12-17.md`
|
> **Documentación**: `/mnt/cello2/arno/re/recode/teamdocs/agenda/hitos/2025-12-17_zcatttf_v1.0.md`
|
||||||
> **Fecha**: 2025-12-16/17
|
|
||||||
|
|
||||||
### El Problema
|
### El Problema (16-17 Dic)
|
||||||
|
|
||||||
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).
|
El texto TTF se renderizaba como garabatos ilegibles. 2 días de debugging con múltiples intentos fallidos.
|
||||||
|
|
||||||
### Lo que se intentó (Sesiones 16-17 Dic)
|
### Solución: zcatttf v1.0
|
||||||
|
|
||||||
| Intento | Hipótesis | Resultado |
|
**TRADUCCIÓN LITERAL** de stb_truetype.h, sin intentar "mejorar" o "reimaginar".
|
||||||
|---------|-----------|-----------|
|
|
||||||
| DroidSans | AdwaitaSans era fuente variable | ❌ Sigue corrupto |
|
|
||||||
| Y-flip rasterización | Coordenadas TTF invertidas | ❌ Mejoró colores, no texto |
|
|
||||||
| UTF-8 decode | drawText iteraba bytes | ❌ No era el problema |
|
|
||||||
| Fix ABGR (líneas 951-955) | Framebuffer usa ABGR, no RGBA | ⚠️ Colores OK, texto aún mal |
|
|
||||||
| bearing_x = 0 | Offset incorrecto | ⚠️ Mejoró, pero "eco" |
|
|
||||||
| bearing_y = y_max | Baseline incorrecto | ⚠️ NO VERIFICADO |
|
|
||||||
|
|
||||||
### Diagnóstico cmap_debug
|
**Bug final:** `y_offset = iy0` (negativo) → `y_offset = -iy0` (positivo).
|
||||||
|
El bearing_y debe ser positivo para glyphs encima de la baseline.
|
||||||
|
|
||||||
Se creó `src/render/cmap_debug.zig` para diagnosticar. **Resultado**:
|
### Lección Clave
|
||||||
- ✅ DroidSans se parsea correctamente
|
|
||||||
- ✅ cmap format 4 funciona ('A'→36, 'a'→68)
|
|
||||||
- ✅ ASCII Art de 'A' es legible en test aislado
|
|
||||||
- ❌ La integración con zcatgui sigue corrupta
|
|
||||||
|
|
||||||
**Conclusión**: El código base TTF funciona. El bug está en la integración.
|
> **"No reimplementar, TRADUCIR"**
|
||||||
|
> Si existe código C que funciona, traducirlo literalmente.
|
||||||
### Solución: Nueva librería zcatttf
|
> La humildad técnica es fundamental.
|
||||||
|
|
||||||
Decisión consensuada: Reimplementar TTF desde cero en librería independiente.
|
|
||||||
|
|
||||||
| Campo | Valor |
|
| Campo | Valor |
|
||||||
|-------|-------|
|
|-------|-------|
|
||||||
| **Proyecto** | `/mnt/cello2/arno/re/recode/zig/zcatttf/` |
|
| **Librería** | `/mnt/cello2/arno/re/recode/zig/zcatttf/` |
|
||||||
| **Algoritmo** | Áreas trapezoidales (como stb_truetype) |
|
| **Versión** | v1.0 |
|
||||||
| **Estado** | EN DESARROLLO (otra conversación Claude) |
|
| **Algoritmo** | Traducción literal stb_truetype (~1,200 LOC rasterize.zig) |
|
||||||
| **Integración** | zcatgui usará zcatttf como dependencia |
|
| **Estado** | ✅ FUNCIONA PERFECTAMENTE en zsimifactu |
|
||||||
|
|
||||||
**Documentación zcatttf**:
|
### Archivos clave
|
||||||
- `teamdocs/agenda/hitos/2025-12-16_zcatttf_plan_implementacion.md`
|
- `src/render/ttf.zig` - Wrapper sobre zcatttf (API compatible)
|
||||||
- `teamdocs/agenda/hitos/2025-12-16_estudio_dvui_stb_truetype.md`
|
- `src/render/embedded_font.zig` - Fuente DroidSans embebida
|
||||||
|
- `build.zig.zon` - Dependencia de zcatttf
|
||||||
|
|
||||||
### Mientras tanto
|
### Uso
|
||||||
|
```zig
|
||||||
- zsimifactu usa **bitmap fonts** (funciona)
|
var ttf = try TtfFont.initEmbedded(allocator);
|
||||||
- El código TTF en `src/render/ttf.zig` está **congelado** hasta integrar zcatttf
|
defer ttf.deinit();
|
||||||
|
ttf.setSize(14);
|
||||||
### Archivos clave (NO MODIFICAR)
|
ttf.drawText(fb, x, y, "Hola UTF-8: áéíóú ñ €", color, clip);
|
||||||
- `src/render/ttf.zig` - Parser TTF + rasterización (CONGELADO)
|
```
|
||||||
- `src/render/embedded_font.zig` - Fuente embebida
|
|
||||||
- `src/render/cmap_debug.zig` - Herramienta diagnóstico
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Fuentes TTF: Estado Técnico
|
## Fuentes TTF: Estado Técnico
|
||||||
|
|
||||||
### Estado actual (v0.16.2) - CONGELADO
|
### Estado actual (v0.17.0) - FUNCIONAL
|
||||||
- ✅ Parsing TTF (glyf, cmap format 4 y 12)
|
- ✅ Parsing TTF via zcatttf (cmap format 4 y 12)
|
||||||
- ✅ Rasterización bezier cuadráticas
|
- ✅ Rasterización con áreas trapezoidales (antialiasing)
|
||||||
- ✅ Antialiasing 2x supersampling
|
|
||||||
- ✅ Fuente embebida (DroidSans)
|
- ✅ Fuente embebida (DroidSans)
|
||||||
- ❌ **BUG: Rendering corrupto en integración** (ver arriba)
|
- ✅ Soporte UTF-8 completo (áéíóú ñ €)
|
||||||
- 🔄 **ESPERANDO**: Librería zcatttf
|
- ✅ Cache de glyphs renderizados
|
||||||
|
|
||||||
### Uso futuro (cuando zcatttf esté listo)
|
### Uso actual
|
||||||
```zig
|
```zig
|
||||||
// zcatttf reemplazará el código actual
|
const ttf = @import("render/ttf.zig");
|
||||||
const zcatttf = @import("zcatttf");
|
|
||||||
var font = try zcatttf.Font.load(allocator, font_data);
|
// Opción 1: Fuente embebida
|
||||||
|
var font = try ttf.TtfFont.initEmbedded(allocator);
|
||||||
|
|
||||||
|
// Opción 2: Cargar archivo
|
||||||
|
var font = try ttf.TtfFont.loadFromFile(allocator, "/path/to/font.ttf");
|
||||||
|
|
||||||
defer font.deinit();
|
defer font.deinit();
|
||||||
font.setSize(14);
|
font.setSize(14);
|
||||||
const bitmap = try font.rasterizeGlyph(font.getGlyphIndex('A'));
|
font.drawText(fb, x, y, "Texto con UTF-8: ñ €", color, clip);
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -214,9 +204,9 @@ const bitmap = try font.rasterizeGlyph(font.getGlyphIndex('A'));
|
||||||
| Campo | Valor |
|
| Campo | Valor |
|
||||||
|-------|-------|
|
|-------|-------|
|
||||||
| **Nombre** | zcatgui |
|
| **Nombre** | zcatgui |
|
||||||
| **Versión** | v0.16.2 |
|
| **Versión** | v0.17.0 |
|
||||||
| **Fecha inicio** | 2025-12-09 |
|
| **Fecha inicio** | 2025-12-09 |
|
||||||
| **Estado** | ✅ COMPLETO - 37 widgets, ~35K LOC, 4 backends |
|
| **Estado** | ✅ COMPLETO - 37 widgets, ~35K LOC, 4 backends, TTF funcional |
|
||||||
| **Lenguaje** | Zig 0.15.2 |
|
| **Lenguaje** | Zig 0.15.2 |
|
||||||
| **Paradigma** | Immediate Mode GUI |
|
| **Paradigma** | Immediate Mode GUI |
|
||||||
| **Inspiración** | Gio (Go), microui (C), DVUI (Zig), Dear ImGui (C++) |
|
| **Inspiración** | Gio (Go), microui (C), DVUI (Zig), Dear ImGui (C++) |
|
||||||
|
|
@ -774,13 +764,14 @@ const stdout = std.fs.File.stdout(); // NO std.io.getStdOut()
|
||||||
| 2025-12-11 | v0.15.2 | Widgets adaptados a FocusSystem: numberentry, textarea, select, radio, slider, tabs |
|
| 2025-12-11 | v0.15.2 | Widgets adaptados a FocusSystem: numberentry, textarea, select, radio, slider, tabs |
|
||||||
| 2025-12-16 | v0.16.0 | TTF rasterization con antialiasing (supersampling 2x) |
|
| 2025-12-16 | v0.16.0 | TTF rasterization con antialiasing (supersampling 2x) |
|
||||||
| 2025-12-16 | v0.16.1 | Fuente embebida: TtfFont.initEmbedded() |
|
| 2025-12-16 | v0.16.1 | Fuente embebida: TtfFont.initEmbedded() |
|
||||||
| 2025-12-16 | v0.16.2 | Fix TTF: DroidSans (187KB) reemplaza AdwaitaSans (variable). Y-flip rasterización. **UTF-8 pendiente** |
|
| 2025-12-16 | v0.16.2 | Fix TTF: DroidSans (187KB) reemplaza AdwaitaSans (variable). Y-flip rasterización. |
|
||||||
|
| 2025-12-17 | v0.17.0 | ⭐⭐⭐ Integración zcatttf v1.0 - TTF FUNCIONA PERFECTAMENTE |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## ESTADO ACTUAL
|
## ESTADO ACTUAL
|
||||||
|
|
||||||
**✅ PROYECTO COMPLETADO - v0.16.2**
|
**✅ PROYECTO COMPLETADO - v0.17.0**
|
||||||
|
|
||||||
> **Para detalles técnicos completos, ver `REFERENCE.md`** (1370 líneas de documentación)
|
> **Para detalles técnicos completos, ver `REFERENCE.md`** (1370 líneas de documentación)
|
||||||
|
|
||||||
|
|
@ -936,7 +927,7 @@ state.focused = has_focus;
|
||||||
|
|
||||||
| Proyecto | Ruta | Descripción |
|
| Proyecto | Ruta | Descripción |
|
||||||
|----------|------|-------------|
|
|----------|------|-------------|
|
||||||
| **zcatttf** | `/mnt/cello2/arno/re/recode/zig/zcatttf/` | ⭐ Librería TTF (reemplazará ttf.zig) - EN DESARROLLO |
|
| **zcatttf** | `/mnt/cello2/arno/re/recode/zig/zcatttf/` | ⭐ Librería TTF v1.0 - COMPLETA (dependencia de zcatgui) |
|
||||||
| **zsimifactu** | `/mnt/cello2/arno/re/recode/zig/zsimifactu/` | App de facturación Zig (consumidor principal) |
|
| **zsimifactu** | `/mnt/cello2/arno/re/recode/zig/zsimifactu/` | App de facturación Zig (consumidor principal) |
|
||||||
| **zcatui** | `/mnt/cello2/arno/re/recode/zig/zcatui/` | TUI library (proyecto hermano) |
|
| **zcatui** | `/mnt/cello2/arno/re/recode/zig/zcatui/` | TUI library (proyecto hermano) |
|
||||||
| **zcatp2p** | `/mnt/cello2/arno/re/recode/zig/zcatp2p/` | Librería P2P (v1.0.0 completa) |
|
| **zcatp2p** | `/mnt/cello2/arno/re/recode/zig/zcatp2p/` | Librería P2P (v1.0.0 completa) |
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue