chore(cpp/vendor): vendor Tabler Icons v3.41.1 (TTF + generador)
Vendorea el set de iconos Tabler (~5500 iconos, MIT) para usar en apps
ImGui via icon_font_cpp_core. Incluye:
- tabler-icons.ttf — atlas TTF para mergear en ImGui
- tabler-icons.css — referencia de codepoints (no se compila)
- gen_header.py — script que regenera cpp/functions/core/icons_tabler.h
con macros TI_<NAME> a partir del CSS
- LICENSE / README.md — atribucion MIT
Versionar el TTF (~700 KB) evita depender de descargas en build. Las apps
usan TI_* en strings y el atlas se carga con icon_font_cpp_core::load().
This commit is contained in:
Vendored
+21
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020-2026 Paweł Kuna
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
Vendored
+16
@@ -0,0 +1,16 @@
|
|||||||
|
# Tabler Icons (vendored webfont)
|
||||||
|
|
||||||
|
- Version: 3.41.1
|
||||||
|
- Source: https://github.com/tabler/tabler-icons
|
||||||
|
- Package: `@tabler/icons-webfont@3.41.1` (jsdelivr CDN)
|
||||||
|
- License: MIT (see LICENSE)
|
||||||
|
|
||||||
|
Files:
|
||||||
|
- `tabler-icons.ttf` — TrueType font (2.7 MB), Private Use Area codepoints U+E000..U+F8FF
|
||||||
|
- `LICENSE` — MIT license
|
||||||
|
|
||||||
|
Header with `TI_*` macros for every glyph: `cpp/functions/core/icons_tabler.h`
|
||||||
|
(generated from the official `tabler-icons.css` of this same version).
|
||||||
|
|
||||||
|
To upgrade: bump the version, redownload `.ttf` and `.css`, rerun the generator
|
||||||
|
in `cpp/vendor/tabler-icons/gen_header.py`.
|
||||||
+86
@@ -0,0 +1,86 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Genera cpp/functions/core/icons_tabler.h a partir del CSS oficial de Tabler.
|
||||||
|
|
||||||
|
Uso:
|
||||||
|
cd cpp/vendor/tabler-icons
|
||||||
|
python3 gen_header.py
|
||||||
|
|
||||||
|
Lee tabler-icons.css (descargado desde el npm package @tabler/icons-webfont) y
|
||||||
|
escribe ../../functions/core/icons_tabler.h con un #define TI_<NAME> "<utf8>"
|
||||||
|
para cada glyph.
|
||||||
|
"""
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
HERE = Path(__file__).parent
|
||||||
|
CSS = HERE / "tabler-icons.css"
|
||||||
|
OUT = HERE / ".." / ".." / "functions" / "core" / "icons_tabler.h"
|
||||||
|
OUT = OUT.resolve()
|
||||||
|
|
||||||
|
VERSION_RE = re.compile(r"Tabler Icons\s+([\d.]+)")
|
||||||
|
RULE_RE = re.compile(r"\.ti-([a-z0-9-]+):before\s*\{\s*content:\s*\"\\([0-9a-fA-F]+)\"")
|
||||||
|
|
||||||
|
|
||||||
|
def to_utf8_escape(codepoint: int) -> str:
|
||||||
|
"""Devuelve la cadena UTF-8 del codepoint en hex escapado para C strings."""
|
||||||
|
return "".join(f"\\x{b:02x}" for b in chr(codepoint).encode("utf-8"))
|
||||||
|
|
||||||
|
|
||||||
|
def name_to_macro(name: str) -> str:
|
||||||
|
return "TI_" + name.upper().replace("-", "_")
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> int:
|
||||||
|
if not CSS.exists():
|
||||||
|
sys.stderr.write(f"missing {CSS}\n")
|
||||||
|
return 1
|
||||||
|
|
||||||
|
text = CSS.read_text(encoding="utf-8")
|
||||||
|
m = VERSION_RE.search(text)
|
||||||
|
version = m.group(1) if m else "unknown"
|
||||||
|
|
||||||
|
entries = []
|
||||||
|
seen = set()
|
||||||
|
for name, hexcp in RULE_RE.findall(text):
|
||||||
|
macro = name_to_macro(name)
|
||||||
|
if macro in seen:
|
||||||
|
continue
|
||||||
|
seen.add(macro)
|
||||||
|
cp = int(hexcp, 16)
|
||||||
|
entries.append((macro, cp, to_utf8_escape(cp)))
|
||||||
|
|
||||||
|
entries.sort(key=lambda e: e[0])
|
||||||
|
|
||||||
|
lines = [
|
||||||
|
"#pragma once",
|
||||||
|
"",
|
||||||
|
"// Tabler Icons codepoints — generado por cpp/vendor/tabler-icons/gen_header.py",
|
||||||
|
f"// Version: {version}",
|
||||||
|
"// Fuente: https://github.com/tabler/tabler-icons (MIT)",
|
||||||
|
"//",
|
||||||
|
"// Uso:",
|
||||||
|
"// #include \"core/icons_tabler.h\"",
|
||||||
|
"// icon_button(\"##rl\", TI_REFRESH, \"Reload\");",
|
||||||
|
"// button(TI_DEVICE_FLOPPY \" Save\", V::Primary);",
|
||||||
|
"//",
|
||||||
|
"// El glyph SOLO se renderiza si la fuente Tabler esta cargada (mergeada en el",
|
||||||
|
"// atlas de ImGui via fn_ui::load_default_fonts). Sin esa carga, los TI_* salen",
|
||||||
|
"// como cuadritos vacios.",
|
||||||
|
"",
|
||||||
|
f"#define TI_FONT_VERSION \"{version}\"",
|
||||||
|
"#define TI_ICON_MIN 0xE000",
|
||||||
|
"#define TI_ICON_MAX 0xF8FF",
|
||||||
|
"",
|
||||||
|
]
|
||||||
|
for macro, cp, utf8 in entries:
|
||||||
|
lines.append(f"#define {macro:<48} \"{utf8}\" // U+{cp:04X}")
|
||||||
|
lines.append("")
|
||||||
|
|
||||||
|
OUT.write_text("\n".join(lines), encoding="utf-8")
|
||||||
|
print(f"wrote {OUT} ({len(entries)} icons, version {version})")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
+20394
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
Reference in New Issue
Block a user