15 Commits
Author SHA1 Message Date
Liu d57350e286 fix(ui-xml): resource node should reject missing type attribute
ui_builder_parse_resource_node() only rejected the case where both
type and src were absent, then passed a NULL type to strstr(). Require
type before dispatching on it, release attributes through the existing
exit path, and check src before loading a font.

Fixes GHSA-xr82-f9q8-h384.
2026-11-24 21:49:20 +08:00
Liu 464eed1402 build: centralize package versions and standardize on C11
versions.json is now the single source of truth; scripts/sync-versions.mjs keeps xmake descriptors, tracked version headers and package.json in sync. Sub-library versions are aligned with the published 1.0.0 packages. C11 is set at the project level, and _GNU_SOURCE is defined on POSIX so strict C11 still exposes clock_gettime, strdup and recursive pthread mutexes.
2026-11-19 22:03:59 +08:00
Liu 3801fdc10f refactor(yutil): rename public APIs and migrate timer to ptk
- charset module renamed to encoding (decode/encode kept)
- time: get_time_ms → y_gettime, sleep_ms → y_sleep
- time: delete get_time_us, get_time_delta, sleep_s
- string: strdup2 → y_strdup, wcsdup2 → y_wcsdup
- string: strtolower → y_strlower, strtrim → y_strtrim
- string: wcstrim → y_wcstrim, strhash → y_strhash
- string: strreplace → y_strreplace, strsplit → y_strsplit
- string: delete wcsreplace, cmdsplit
- math: delete y_iround, y_pow2
- timer module migrated from yutil to ptk as internal timer_scheduler
- WinMain simplified to use __argc/__argv instead of cmdsplit

BREAKING CHANGE: all renamed yutil public APIs require downstream
  to update function names. Deleted APIs require code changes:
  - get_time_us: use y_gettime() for ms timestamps
  - get_time_delta: use y_gettime() - start instead
  - sleep_s: use y_sleep(ms) with millisecond argument
  - wcsreplace: no replacement, had zero callers
  - cmdsplit: WinMain now uses __argc/__argv from CRT
  - timer_list_*: migrated to ptk timer_scheduler_*;
    ptk_reset_timer still available for external use
2026-08-05 22:42:26 +08:00
Liu 6cd01b468e chore: update copyright comment 2026-08-05 22:42:22 +08:00
Liu 7f9f52b904 chore: update copyright and email 2026-08-05 22:42:16 +08:00
Liu 3a867040d1 build(xmake): fix package name, target naming and example install
- Remove per-lib set_project() calls that overrode the global lcui
  project name; xmake show now correctly reports the project as lcui.
- Move per-lib set_version() into the corresponding target() block so
  each sub-library keeps an independent version usable for standalone
  packaging.
- Add set_default(false) and set_group(examples) to all pandagl
  examples so they are no longer picked up by xmake package.
- Rename targets to use dashes for consistency:
    pandagl_cairo_example  -> pandagl-cairo-example
    preview_block_layout   -> preview-block-layout
    preview_flex_layout    -> preview-flex-layout
    preview_scrollbar      -> preview-scrollbar
    preview_widget_opacity -> preview-widget-opacity
- Bump yutil submodule to drop its set_project() call as well.
2026-08-05 22:41:23 +08:00
Liu d64fe6202b refactor(pandagl): rename font API to align with typeface/glyph concepts
The previous naming conflated multiple levels of the font model:
pd_font_t actually owned a single typeface resource (FT_Face), while
pd_font_bitmap_t represented a per-glyph bitmap. The pd_font_library_*
prefix was redundant under the pd_font_ namespace and resulted in
verbose call sites (up to 34 chars).

Type renames
- pd_font_t          -> pd_font_face_t
- pd_font_bitmap_t   -> pd_glyph_bitmap_t
- font_engine_t      -> pd_font_engine_t
- struct tags updated to match the typedef names.

API renames (grouped by sub-object)
- Face lifecycle:    pd_font_create/destroy -> pd_font_face_create/destroy
- Face registry:     pd_font_library_add_font     -> pd_font_register
                     pd_font_library_get_font     -> pd_font_get
                     pd_font_library_get_font_id  -> pd_font_get_id
                     pd_font_library_query        -> pd_font_query
                     pd_font_library_load_file    -> pd_font_load_file
                     pd_font_library_get_font_path-> pd_font_find_path
                     pd_font_library_get_default_font -> pd_font_get_default
                     pd_font_library_set_default_font -> pd_font_set_default
                     pd_font_library_set_font_family_alias
                                                  -> pd_font_family_set_alias
                     pd_font_library_update_font_weight
                                                  -> pd_font_replace_weight
                     pd_font_library_update_font_style
                                                  -> pd_font_replace_style
- Parsing helpers:   pd_font_library_detect_weight -> pd_font_parse_weight
                     pd_font_library_detect_style  -> pd_font_parse_style
- Glyph rendering:   pd_font_library_render_bitmap -> pd_font_render_glyph
                     pd_canvas_mix_font_bitmap     -> pd_canvas_mix_glyph_bitmap
                     pd_font_bitmap_init/destroy   -> pd_glyph_bitmap_init/destroy
- Glyph cache:       pd_font_library_add_bitmap    -> pd_font_cache_add_bitmap
                     pd_font_library_get_bitmap    -> pd_font_cache_get_bitmap

pd_font_library_init/destroy are kept as the module lifecycle entry
points, matching the FT_Init_FreeType / FT_Done_FreeType convention.

All call sites in lib/pandagl, lib/ui, lib/ui-xml, src/, tests/ and
examples/ are updated accordingly.
2026-08-05 22:41:19 +08:00
Liu 75dbca815d test: reorganize test suite with xmake test integration
Restructure the test infrastructure with these changes:

* Extend libctest with ctest_suite_t, ctest_parse_args, ctest_run_suites and CTEST_MAIN macro to standardize test entry points; support --grep / --grep= / --list / --interactive flags; add ctest-tests for self-tests.

* Regroup tests by lib boundary: sink unit tests into lib/<name>/tests/ with <lib>_<topic> entry function names, move fixtures into lib/<name>/tests/fixtures/, rename top-level tests/cases/ to tests/integration/ for cross-lib integration tests.

* Add tests/scenes/ for reusable widget tree builders shared by integration cases and visual preview binaries; add tests/previews/ with 4 diagnostic binaries (flex_layout, block_layout, widget_opacity, scrollbar).

* Rewrite all describe/equal description strings using 'should ...' style or noun topic names; drop redundant lcui_quit/lcui_main calls from integration cases.

* Integrate xmake test via add_tests(\default\) and a shared tests.runnable rule defined in the root xmake.lua; the rule wraps the test binary with drmemory (Windows) or valgrind (Linux) when option memcheck=y.

* Drop the lcui-tests aggregation: lcui-tests now contains only integration cases and scenes, not the union of lib tests. Use xmake test to run everything across libs.

* Fix .clang-format: InsertNewlineAtEndOfFile -> InsertNewlineAtEOF (correct key for clang-format 16+).

* Update AGENTS.md with the new test layout, naming rules, description style and run commands.

* Update CI to use xmake test and xmake f --memcheck=y instead of per-lib runs.
2026-08-05 22:41:12 +08:00
Liu 940a0fc33a chore: update copyright 2025-01-05 23:29:56 +08:00
Liu 6851e9aef3 refactor: change type naming style 2024-12-22 23:14:13 +08:00
Liu 738853e939 refactor(ui-xml): clear compiler errors 2024-12-07 13:30:28 +08:00
Liu d60ec9227d chore: update copyright year 2024-05-13 22:49:22 +08:00
Liu 023b35e245 chore: add copyright header 2024-05-13 22:49:20 +08:00
Liu 329b7c192d refactor: simplify naming and function parameters 2023-06-07 23:39:01 +08:00
Liu f5d0d120a2 refactor: update header files and xmake.lua 2023-04-30 00:31:47 +08:00