Files
harfbuzz/src/hb-vector-path.hh
T
Behdad EsfahbodandClaude Opus 4.6 834826289e [vector] Fold svg-path sink into a format-aware vector-path
Rename hb-vector-svg-path.{cc,hh} to hb-vector-path.{cc,hh}
and make the sink format-aware (SVG or PDF), so the PDF
backend can reuse it for arbitrary-path clipping without
spinning up its own path serializer.

hb_vector_svg_path_sink_t gains a hb_vector_format_t field
and becomes hb_vector_path_sink_t; the draw callbacks
switch on format and emit SVG path-data or PDF path
operators into the external buffer.  hb-vector-draw.cc and
hb-vector-paint.cc (push_clip_glyph + the recent arbitrary
clip-path start) are updated to the new name with
format=SVG.  No behavior change on the SVG side.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 16:18:20 -06:00

51 lines
1.7 KiB
C++

/*
* Copyright © 2026 Behdad Esfahbod
*
* This is part of HarfBuzz, a text shaping library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Author(s): Behdad Esfahbod
*/
#ifndef HB_VECTOR_PATH_HH
#define HB_VECTOR_PATH_HH
#include "hb.hh"
#include "hb-vector.hh"
#include "hb-vector.h"
#include "hb-draw.h"
/* Lightweight path sink: serializes hb_draw_* calls into an
* external char buffer as either SVG path-data or PDF path
* operators, depending on format. Used by the vector paint
* backends to accumulate arbitrary clip paths (and by the
* SVG backend to emit glyph outlines into defs). */
struct hb_vector_path_sink_t
{
hb_vector_t<char> *path;
unsigned precision;
hb_vector_format_t format;
};
HB_INTERNAL hb_draw_funcs_t *
hb_vector_path_draw_funcs_get (void);
#endif /* HB_VECTOR_PATH_HH */