Commit Graph
563 Commits
Author SHA1 Message Date
Behdad Esfahbod f587af3ec3 [gpu] Extract shared shader helpers into hb_gpu_shader_source() (#5921)
The draw-renderer fragment shaders defined utilities
(HB_GPU_UNITS_PER_EM, the hb_gpu_atlas uniform, hb_gpu_fetch) that
any future GPU renderer will also need.  The draw-renderer vertex
shader likewise contained only the generic hb_gpu_dilate helper.
If a paint renderer were added today and a caller linked both
fragment sources together, hb_gpu_fetch would be defined twice.

Move these shared helpers into a new family of sources and expose
them via a new public entry point:

  hb_gpu_shader_source (stage, lang);

The existing hb_gpu_draw_shader_source() now returns only the
draw-specific fragment code; it returns an empty string for the
vertex stage because all current vertex logic is shared.  Callers
concatenate the shared source first, then the draw-specific
source, then their own main():

  [#version, hb_gpu_shader_source (...), hb_gpu_draw_shader_source
  (...), main]

Additions:
 - src/hb-gpu-fragment.{glsl,msl,wgsl,hlsl} — shared fragment
 - src/hb-gpu-vertex.{glsl,msl,wgsl,hlsl}   — shared vertex,
   renamed from hb-gpu-draw-vertex.*
 - src/hb-gpu-shaders.cc — hb_gpu_shader_source() dispatcher

Removals:
 - src/hb-gpu-draw-vertex.{glsl,msl,wgsl,hlsl} — moved to common

Shared sources are Behdad-only copyright; the Eric Lengyel / Slug
attribution stays on the draw-specific fragment sources where the
Slug algorithm actually lives.

Updates: test/api/test-gpu.cc, the Metal/D3D11/WebGPU/GL demo
shaders, the hb-gpu SECTION documentation, meson.build,
CMakeLists.txt, gen-gpu-shader-artifacts.py decl_map,
harfbuzz-world.cc, and docs/harfbuzz-sections.txt.

Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 12:10:23 -06:00
Behdad Esfahbod 90678d6876 [docs] Register new raster and vector getters in sections.txt
Add the eight new getters introduced in the recent API-cleanup
commits to their section indexes:

  hb_raster_paint_get_foreground
  hb_raster_paint_set_palette
  hb_raster_paint_get_palette
  hb_vector_draw_get_flat
  hb_vector_draw_get_precision
  hb_vector_paint_get_foreground
  hb_vector_paint_get_palette
  hb_vector_paint_get_flat
  hb_vector_paint_get_precision

Without these entries gtk-doc's doc-check flags the new symbols
as undocumented.

Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 03:49:56 -06:00
Behdad Esfahbod eeec9bd9fa [gpu] Unify shader source getters; rename for draw/paint split
Replace the two separate getters

  hb_gpu_shader_fragment_source (lang)
  hb_gpu_shader_vertex_source   (lang)

with a single

  hb_gpu_draw_shader_source (stage, lang)

where stage is the new hb_gpu_shader_stage_t enum (VERTEX or
FRAGMENT).  Parameter order is stage-first because "the vertex
shader in GLSL" reads more naturally than the reverse, and stage
is the primary axis (it determines which shader object the source
is compiled into).

The `_draw_` in the new name makes room for the incoming
hb_gpu_paint_shader_source() once the COLRv1 encoder lands —
that family will have its own (likely different) shader sources
per stage and language.

Updated the four in-tree callers: test/api/test-gpu.cc, and the
GPU demos under util/gpu/.  ABI break on a 14.0-only API; the
gpu library is still young enough that this is acceptable.

Marked new API with XSince: REPLACEME.

Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 02:26:21 -06:00
Behdad Esfahbod 8cd50a7b77 [gpu] Add hb_gpu_draw_get_scale companion getter
hb_gpu_draw_set_scale() existed without a paired getter; all other
draw/paint contexts have get/set pairs.  Fill the gap for symmetry.

Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 01:58:06 -06:00
Behdad Esfahbod 4650398a07 [gpu] encode() returns extents + auto-clears; drop get_extents() (#5910)
Bring hb_gpu_draw_encode into line with the rest of the render APIs:
auto-clear on success, and return the computed glyph extents to the
caller via a new out-parameter (nullable).

  HB_EXTERN hb_blob_t *
  hb_gpu_draw_encode (hb_gpu_draw_t      *draw,
                      hb_glyph_extents_t *extents);

Consumers typically need both the encoded blob and the glyph's
extents to size the quad they'll draw into in the vertex shader;
returning them together removes a redundant trip through the draw
state and lets encode() auto-clear like hb_vector_*_render() and
hb_raster_*_render() do.

Drop hb_gpu_draw_get_extents() from the public API — its only
role was reading extents out of the draw state post-encode, which
the new encode() signature makes redundant.  The computation
stays (moved to a static _hb_gpu_draw_get_extents helper) so
encode() can call it before auto-clear wipes the state.

ABI break for anyone who had already wired up against the 14.0.0
hb_gpu_draw_encode signature or hb_gpu_draw_get_extents, but the
library is new/experimental and the two in-tree consumers
(test/api/test-gpu.cc, util/gpu/demo-font.cc, util/hb-gpu-encode-all.cc,
test/fuzzing/hb-gpu-fuzzer.cc) are updated here.

All 240 tests pass.

Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 00:15:54 -06:00
Behdad Esfahbod 8ad69b4175 [docs] List the new _clear() entry points in harfbuzz-sections.txt
Follow-up to the _clear() API additions — add the five new public
symbols to the generated-docs section index so gtk-doc picks them up.

Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 21:27:51 -06:00
Behdad Esfahbod 7b6f26e844 [vector] Address review feedback
- Default hb_vector_{draw,paint}_t::format to HB_VECTOR_FORMAT_INVALID
  instead of HB_VECTOR_FORMAT_SVG.
- Update renamed hb_vector_{draw,paint}_set_{flat,precision} API docs
  from "Since: 13.0.0" to "XSince: REPLACEME".
- Extract hb_vector_draw_render_svg() helper to match the
  hb_vector_draw_render_pdf() pattern; move the misplaced
  hb_vector_draw_render doc comment to the actual function and update
  it to say "output blob" since the renderer is no longer SVG-only.
- Revert 14.0.0 NEWS entry edits; the API rename will be announced in
  the next release entry.
- Update docs/harfbuzz-sections.txt to reflect the API renames.
- hb-vector tool: expose -O/--output-format with supported formats
  "svg/pdf", validate format, update description string, and switch
  PDF detection to g_ascii_strcasecmp for case-insensitive matching.

Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 22:02:38 -06:00
Behdad Esfahbod 1141e97ef4 [paint] Add hb_paint_push_group_for() API
Add a new push_group variant that receives the compositing mode
upfront. This lets backends like PDF emit blend-mode state before
painting the group content, avoiding the need to buffer and
retroactively wrap.

The default (nil) implementation calls hb_paint_push_group(), so
existing backends are unaffected.

Callers updated:
- COLR PaintComposite now calls push_group_for() for both groups
- Rust/fontations push_layer passes the mode through
- hb-raster SVG context accepts mode parameter (default SRC_OVER)

All 233 tests pass.

Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 20:12:59 -06:00
Khaled Hosny cfb70b0b91 14.1.0 2026-04-04 20:31:18 +02:00
Behdad Esfahbod 33baa306b2 [gpu] Fix docs for hb_gpu_draw_set_scale
Use XSince: REPLACEME and add to harfbuzz-sections.txt.

Assisted-by: Claude <noreply@anthropic.com>
2026-04-02 01:19:42 -06:00
Khaled Hosny da69b6585c 14.0.0 2026-04-01 14:54:05 +02:00
Behdad Esfahbod 90e2f5f8b9 [docs] Update vector and subset library logos
New artwork from hb-libs2.png.

Assisted-by: Claude <noreply@anthropic.com>
2026-03-31 19:16:46 -06:00
Behdad Esfahbod 355bd4b011 Tweak logos 2026-03-31 11:31:42 -06:00
Behdad EsfahbodandClaude Opus 4.6 be79d54265 [docs] Point to GitHub README for overview, clarify this is API reference
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 00:39:15 -06:00
Behdad EsfahbodandClaude Opus 4.6 c68696c4fa [docs] Update docs opening paragraph
Mention subsetting, rasterization, GPU, and platform integrations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 00:34:24 -06:00
Behdad EsfahbodandClaude Opus 4.6 30ed85024d [docs] Add library logos to docs front page
Show subset, raster, vector, GPU logos inline at 64px
next to the main HarfBuzz logo.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 00:31:59 -06:00
Behdad EsfahbodandClaude Opus 4.6 2a31d1c745 [docs] Add per-library logos
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 00:22:06 -06:00
Behdad Esfahbod 5955ab5198 [docs] Add favicon for generated docs
The generated gtk-doc site only shipped the existing logo assets, so
harfbuzz.github.io had no root favicon for browsers to discover.

Add a small 64x64 favicon.ico derived from the existing docs logo
and install it as a gtk-doc HTML asset so the Pages deployment
copies it to the site root.

Testing:
- meson test -C build

Assisted-by: OpenAI Codex
2026-03-30 16:58:23 -06:00
Behdad EsfahbodandClaude Opus 4.6 99c17acbcd [gpu] Add HB_HAS_GPU to harfbuzz-sections.txt
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 03:06:31 -06:00
Behdad EsfahbodandClaude Opus 4.6 0582846c08 [gpu] Simplify shader API: return single string per language
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>
2026-03-27 17:10:04 -06:00
Behdad EsfahbodandClaude Opus 4.6 d9a81a9cc5 [gpu] Add hb-gpu to docs sections and docs index
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 19:40:13 -06:00
Khaled Hosny 5ad3909af4 13.2.0 2026-03-19 00:45:24 +02:00
Khaled Hosny 257769a9d2 [ot-shape] Add hb_ot_shape_get_buffer_format_serial() (#5857) 2026-03-18 10:24:52 -06:00
Khaled Hosny 8168bf5fe0 [docs] Remove note about old HarfBuzz
Old HarfBuzz is long long dead that this note is likely to just confuse
people now.
2026-03-14 10:51:47 +02:00
Khaled Hosny 8fbf89c638 [docs] Re-order API sections a bit
Keep libharfbuzz APIs together, except for the integration APIs which
now comes last.
2026-03-13 15:28:29 +02:00
Behdad Esfahbod 3786b83fa6 [amalgamation] Add HB_HAS_SUBSET and share SVG helpers (#5835)
Add HB_HAS_SUBSET to hb-features.h and wire it through the same
HAVE_* feature plumbing used by the other HB_HAS_* macros.

Refactor the raster/vector SVG helper code so the duplicated
private helpers live in shared internal headers, avoiding
duplicate definitions when sources are combined in a single
translation unit.

Testing: meson compile -C build

Assisted-by: OpenAI Codex
2026-03-12 08:32:37 -06:00
Behdad Esfahbod 4da15dadff [meson] Add raster/vector feature macros
Raster and vector libraries were configurable, but hb-features.h.in
did not expose matching HB_HAS_* macros.

Set HAVE_RASTER and HAVE_VECTOR during configuration, include both
features in the generated hb-features.h list, and add them to the
gtk-doc section index.

Testing: meson test -C build

Assisted-by: OpenAI Codex
2026-03-12 02:53:11 -03:00
Khaled Hosny 68d19d6964 13.1.0 2026-03-11 04:01:41 +02:00
Behdad Esfahbod dfc64f02c0 raster: add PNG serialization API for images 2026-03-09 23:37:36 +02:00
Khaled Hosny f5190a73aa [usermanual] Document hb-info, hb-raster, and hb-vector 2026-03-08 00:03:57 +02:00
Khaled Hosny 5408e599f6 [usermanual] Move code blocks inside list item 2026-03-08 00:03:57 +02:00
Khaled Hosny c27ef57976 [usermanual] Improve program listings
Content inside <programlisting> tags is sensitive to white space, and the
extra indentation appear in the output.
2026-03-08 00:03:57 +02:00
Khaled Hosny c4eafe606c [docs] Move hb-raster and hb-vector to their own section 2026-03-08 00:03:57 +02:00
Khaled Hosny a0fc099681 13.0.0 2026-03-04 22:28:50 +02:00
Behdad EsfahbodandClaude Opus 4.6 6a1c028a61 [buffer] Add hb_buffer_changed() (#5755)
* [buffer] Add hb_buffer_changed()

To be called by message callbacks if they modify buffer glyph indices,
to update internal caches (currently the buffer digest).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* [buffer] Implement changed() callback and hook up to OT shaper.

* Only install buffer changed() callback if messaging enabled

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 09:16:54 -07:00
Behdad Esfahbod 7b73346253 [docs] Export hb-vector custom palette APIs in sections 2026-02-26 17:21:48 -03:00
Behdad Esfahbod fb88a3127c [docs] List new hb-raster custom palette APIs 2026-02-25 15:43:37 -03:00
Behdad Esfahbod 9f464bf067 [vector,raster] Export new getter APIs in headers/docs 2026-02-24 19:32:49 -03:00
Behdad Esfahbod 3f39f12e20 [vector,raster] Add get_extents APIs for draw/paint contexts 2026-02-24 19:25:35 -03:00
Behdad Esfahbod 40ec999ace [docs] Drop 12.2.0 index and use placeholder XSince for new SVG range API 2026-02-24 18:35:06 -03:00
Behdad Esfahbod ebdb23879d [ot-color] Add SVG document glyph-range API and use in vector cache 2026-02-24 16:39:39 -03:00
Behdad Esfahbod 9207a61b35 [ot-color][vector] Add SVG doc-index API and cache by document index 2026-02-24 14:52:45 -03:00
Behdad Esfahbod 86e0e55b70 [vector] Make format constructor-time and drop set_format APIs 2026-02-24 14:01:39 -03:00
Behdad Esfahbod ba6de29374 [docs] Remove libharfbuzz-vector design doc 2026-02-24 12:41:09 -03:00
Behdad Esfahbod edf193095a [docs] Add hb-vector API section and raster glyph entries 2026-02-24 12:37:37 -03:00
Behdad Esfahbod 3c099ee71c Add initial libharfbuzz-vector SVG backend and utility rename 2026-02-24 08:52:34 -03:00
Behdad Esfahbod bcd19a4c39 raster: add draw/paint scale-factor API 2026-02-24 05:02:35 -03:00
Behdad Esfahbod 70f45cbdcd raster-draw: hardwire output format to A8 2026-02-24 04:52:44 -03:00
Behdad Esfahbod 5ea04afcda raster: adopt create_or_fail and strict render semantics 2026-02-24 04:46:51 -03:00
Behdad Esfahbod 0727834314 raster-image: consolidate configuration API 2026-02-24 04:22:51 -03:00