Replace backend-specific branches with a demo_renderer_t base class
that both GL and Metal implement. This eliminates all if(metal) checks
in the view code and makes adding future backends (WebGPU) clean.
- Add demo-renderer.h with virtual interface
- Add demo-renderer-gl.cc wrapping existing GL code
- Rewrite demo-metal.mm to implement renderer interface
- Move VBO/VAO management from demo_buffer into GL renderer
- Fix Metal vsync (CAMetalLayer.displaySyncEnabled)
- Fix dark mode crash on Metal (was calling GL directly)
- Add set_background to renderer for clear color control
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add MSL shader translations of the Slug GPU text rasterizer, and a
Metal rendering backend for hb-gpu-demo selectable via --metal flag.
Library changes:
- Add HB_GPU_SHADER_LANG_MSL enum value
- Add hb-gpu-vertex.msl and hb-gpu-fragment.msl
- Extend gen-gpu-shader-artifacts.py for MSL
Demo changes:
- Add demo-metal.h/mm with CAMetalLayer rendering
- Add external atlas backend for non-GL paths
- Add demo_buffer_get_vertices for Metal draw path
- Skip GL init when using Metal (GLFW_NO_API)
- Add --metal command-line flag
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Detect RTL direction from shaped buffers and right-align those
lines in the demo. Uses the average width of RTL lines as the
alignment target for a balanced look.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace the manual getopt-based demo main with the standard
main_font_text_t / shape_consumer_t composition, getting all
harfbuzz options for free: --variations, --features, --script,
--direction, --face-index, --font-funcs, etc.
New gpu_output_t (in util/gpu-output.hh) implements the output
interface, feeding shaped glyphs to the demo's GL renderer.
Add demo_buffer_add_glyph() and demo_buffer_current_line() to
demo-buffer for glyph-at-a-time insertion (vs the old batch
add_text which did its own shaping).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>