ferramenta de text pot importar gifs

ferramenta de text accepta separació entre quadricules de lletres
This commit is contained in:
2026-03-22 19:06:01 +01:00
parent 0c116665bc
commit 94684e8758
6 changed files with 328 additions and 181 deletions

View File

@@ -86,6 +86,10 @@ auto Text::loadTextFile(const std::string& file_path) -> std::shared_ptr<File> {
ls >> tf->box_height;
} else if (key == "columns") {
ls >> tf->columns;
} else if (key == "cell_spacing") {
ls >> tf->cell_spacing;
} else if (key == "row_spacing") {
ls >> tf->row_spacing;
} else {
// Línea de glifo: codepoint_decimal ancho_visual
uint32_t codepoint = 0;
@@ -97,8 +101,9 @@ auto Text::loadTextFile(const std::string& file_path) -> std::shared_ptr<File> {
continue; // línea mal formateada, ignorar
}
Offset off{};
off.x = (glyph_index % tf->columns) * tf->box_width;
off.y = (glyph_index / tf->columns) * tf->box_height;
const int row_sp = tf->row_spacing > 0 ? tf->row_spacing : tf->cell_spacing;
off.x = (glyph_index % tf->columns) * (tf->box_width + tf->cell_spacing) + tf->cell_spacing;
off.y = (glyph_index / tf->columns) * (tf->box_height + row_sp) + tf->cell_spacing;
off.w = width;
tf->offset[codepoint] = off;
++glyph_index;