Reduces wasm size from 933K to 687K via size optimization
and link-time dead code elimination.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Merge the .c and .h files into single .hh headers with
static inline functions. Eliminates the C/C++ linkage issue
and simplifies the web demo build to a single em++ call.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When GL_FRAMEBUFFER_SRGB is not available (e.g. WebGL2), fall
back to shader-based gamma correction (pow(coverage, gamma)).
Press 'g' to cycle: sRGB → gamma 2.2 → no correction.
Default tries sRGB, falls back to gamma 2.2 automatically.
Replaces the old 's' (sRGB toggle) key binding.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The demo headers are pre-generated and committed; the
custom_target generation was already removed but the empty
variable and its reference remained.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Make scroll zoom proportional to delta (pow(STEP, yoffset))
instead of fixed steps. Add JS pinch-to-zoom handler that
translates two-finger touch to wheel events with a dead zone
to prevent jitter.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Small finger movements (< 5 pixels) during a touch no longer
count as a drag, allowing tap-to-toggle-animation to work
reliably on touchscreens.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Web build using Emscripten + WebGL2 with HB_GPU_ATLAS_2D mode.
Touch support: drag to pan, tap to toggle animation.
FPS counter overlay. Viewport meta for mobile.
Fix cursor position on first touch by querying glfwGetCursorPos
in mouse_func. Left click/tap also toggles animation.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The shader source is compatible with both GLSL 3.30 and
GLSL ES 3.00. Rename the enum value to reflect this and
match the type name convention.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Pre-generate demo shader headers, default text, and default font
so the demo builds without stringize or hexify at compile time.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Pre-generate hb-gpu-{fragment,vertex}-glsl.hh from the .glsl
sources so the library builds without Python/stringize at
compile time.
When stringize is found, a build rule regenerates them from
the .glsl sources and copies back to the source tree, matching
the ragel artifact pattern.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The large default text block looked too distorted with
perspective=4. Use 16 for a flatter initial view.
The user can still adjust with Shift+right-drag.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Change hb_gpu_shader_{fragment,vertex}_sources() (array + count)
to hb_gpu_shader_{fragment,vertex}_source() returning a single
const char *. Each language variant is one complete string.
Simplifies the demo shader compilation and documentation.
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>
recycle_blob stores the blob; encode reuses both the blob object
and its data buffer when the buffer is >= needed and < 2x needed.
Otherwise malloc fresh and replace_buffer on the recycled blob.
hb_blob_t::replace_buffer now skips destroy_user_data when the
new data pointer is the same as the old one (same-buffer reuse).
Add explicit destructor to hb_gpu_draw_t for recycled_blob cleanup.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The demo requires GLEW, GLFW3, and GL. Make these optional so the
library still builds on headless systems. The demo is skipped when
they're missing.
Install the GL packages in the Linux CI workflow so the demo
builds there.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The object is a draw_funcs_t closure, same role as hb_raster_draw_t.
Rename for consistency with the other modules.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move the executable definition to util/meson.build so the binary
lands at util/hb-gpu, consistent with other utilities.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fall back to an embedded font when no font file is given,
matching the glyphy-demo behaviour.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Port the glyphy-demo to use the hb-gpu API. Builds as util/hb-gpu
and requires GLEW, GLFW3, and OpenGL 3.3. Includes default text
and embedded font for quick testing.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>