mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-20 14:31:10 +01:00
Merge pull request #5824 from harfbuzz/svgz
[raster] Support gzip-compressed SVG documents
This commit is contained in:
21 files changed
+844
-239
No files matched your search
@@ -34,7 +34,9 @@ jobs:
|
||||
libglib2.0-dev \
|
||||
libgraphite2-dev \
|
||||
libicu-dev \
|
||||
libpng-dev \
|
||||
pkg-config \
|
||||
zlib1g-dev \
|
||||
help2man
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
||||
|
||||
@@ -21,6 +21,8 @@ Before non-trivial work, read:
|
||||
- Preserve optional-feature behavior, reduced-feature builds, and compile-time feature guards.
|
||||
- Keep out-of-memory behavior in mind. New code should fail safely and follow existing allocation and error-handling patterns.
|
||||
- Prefer HarfBuzz's established `likely`/`unlikely` and nil-object/null-pattern conventions where they fit the surrounding code.
|
||||
- Prefer HarfBuzz helpers from `hb-algs.hh` such as `hb_memcpy`, `hb_memcmp`, and `hb_memset` over raw `memcpy`, `memcmp`, and `memset` where those helpers are available.
|
||||
- Do not introduce STL containers in library code. Follow HarfBuzz container and utility patterns instead.
|
||||
- Leave unrelated user changes and untracked artifacts alone.
|
||||
|
||||
## Repo map
|
||||
@@ -91,10 +93,10 @@ For API work:
|
||||
## Commit guidance
|
||||
|
||||
- Before any commit, run the entire test suite with `meson test -C build`.
|
||||
- Exception: simple documentation-only or CI-only changes may be committed without running tests if they do not affect code, build logic, generated outputs, or test inputs.
|
||||
- Use descriptive commit messages with consistent bracketed subsystem prefixes such as `[subset]`, `[raster]`, `[util]`, or `[meson]`.
|
||||
- Wrap commit message bodies to about 70 columns.
|
||||
- When passing commit bodies through the shell, use real newlines, not literal
|
||||
`\n` escapes. Prefer `$'...'` quoting or a temporary commit message file.
|
||||
- For multi-line commit messages, write the message from a file or editor-backed input. Do not pass escaped `\n` sequences via shell `-m` arguments.
|
||||
- Explain root cause, fix, and testing in the commit body when testing was actually performed or is relevant.
|
||||
- When relevant, link issues or PRs with trailers such as `Fixes:`.
|
||||
- Always include an `Assisted-by:` trailer on commits you write through the agent.
|
||||
|
||||
@@ -160,6 +160,7 @@ endif
|
||||
|
||||
chafa_dep = dependency('chafa', version: chafa_min_version, required: get_option('chafa'))
|
||||
png_dep = dependency('libpng', required: false)
|
||||
zlib_dep = dependency('zlib', required: false)
|
||||
|
||||
fontations_dep_found = false
|
||||
if get_option('fontations').enabled()
|
||||
@@ -223,6 +224,10 @@ if png_dep.found()
|
||||
conf.set('HAVE_PNG', 1)
|
||||
endif
|
||||
|
||||
if zlib_dep.found()
|
||||
conf.set('HAVE_ZLIB', 1)
|
||||
endif
|
||||
|
||||
if fontations_dep_found
|
||||
conf.set('HAVE_FONTATIONS', 1)
|
||||
endif
|
||||
@@ -487,6 +492,7 @@ build_summary = {
|
||||
},
|
||||
'Dependencies used by additional libraries':
|
||||
{'PNG': conf.get('HAVE_PNG', 0) == 1,
|
||||
'Zlib': conf.get('HAVE_ZLIB', 0) == 1,
|
||||
},
|
||||
'Other features':
|
||||
{'Utilities': not get_option('utilities').disabled(),
|
||||
|
||||
@@ -27,8 +27,10 @@
|
||||
|
||||
#include "../../../hb-open-type.hh"
|
||||
#include "../../../hb-blob.hh"
|
||||
#include "../../../hb-limits.hh"
|
||||
#include "../../../hb-map.hh"
|
||||
#include "../../../hb-paint.hh"
|
||||
#include "../../../hb-zlib.hh"
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -42,6 +44,50 @@
|
||||
|
||||
namespace OT {
|
||||
|
||||
static inline hb_blob_t *
|
||||
hb_ot_svg_reference_normalized_blob (hb_blob_t *image,
|
||||
const char **svg,
|
||||
unsigned *len)
|
||||
{
|
||||
hb_blob_t *blob = hb_blob_reference (image);
|
||||
unsigned data_len = 0;
|
||||
const char *data = hb_blob_get_data (blob, &data_len);
|
||||
|
||||
if (!data || !data_len)
|
||||
goto fail;
|
||||
|
||||
if (hb_blob_is_gzip (data, data_len))
|
||||
{
|
||||
uint32_t expected_size = 0;
|
||||
if (hb_gzip_get_uncompressed_size (data, data_len, &expected_size) &&
|
||||
unlikely ((size_t) expected_size > (size_t) HB_SVG_MAX_DOCUMENT_SIZE))
|
||||
goto fail;
|
||||
|
||||
hb_blob_t *uncompressed = hb_blob_decompress_gzip (blob,
|
||||
HB_SVG_MAX_DOCUMENT_SIZE);
|
||||
if (!uncompressed)
|
||||
goto fail;
|
||||
|
||||
hb_blob_destroy (blob);
|
||||
blob = uncompressed;
|
||||
data = hb_blob_get_data (blob, &data_len);
|
||||
if (!data || !data_len)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (unlikely ((size_t) data_len > (size_t) HB_SVG_MAX_DOCUMENT_SIZE))
|
||||
goto fail;
|
||||
|
||||
if (svg) *svg = data;
|
||||
if (len) *len = data_len;
|
||||
return blob;
|
||||
|
||||
fail:
|
||||
hb_blob_destroy (blob);
|
||||
if (svg) *svg = nullptr;
|
||||
if (len) *len = 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
struct SVGDocumentIndexEntry
|
||||
{
|
||||
|
||||
@@ -112,6 +112,10 @@
|
||||
#define HB_SVG_MAX_PATH_SEGMENTS 262144
|
||||
#endif
|
||||
|
||||
#ifndef HB_SVG_MAX_DOCUMENT_SIZE
|
||||
#define HB_SVG_MAX_DOCUMENT_SIZE ((size_t) 16 << 20)
|
||||
#endif
|
||||
|
||||
#ifndef HB_RASTER_MAX_BUFFER_SIZE
|
||||
#define HB_RASTER_MAX_BUFFER_SIZE ((size_t) 1 << 24)
|
||||
#endif
|
||||
|
||||
+38
-16
@@ -37,6 +37,7 @@
|
||||
#include "hb-raster-svg-bbox.hh"
|
||||
#include "hb-raster-svg-fill.hh"
|
||||
#include "hb-raster-svg-use.hh"
|
||||
#include "OT/Color/svg/svg.hh"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
@@ -154,8 +155,17 @@ svg_render_container_element (hb_svg_render_context_t *ctx,
|
||||
viewport_h = hb_raster_svg_parse_non_percent_length (svg_pick_attr_or_style (parser, geom_style_props.height, "height"));
|
||||
if (!(viewport_w > 0.f && viewport_h > 0.f))
|
||||
{
|
||||
viewport_w = vb_w;
|
||||
viewport_h = vb_h;
|
||||
if (ctx->depth == 1)
|
||||
{
|
||||
unsigned upem = hb_font_get_face (ctx->font)->get_upem ();
|
||||
viewport_w = (float) upem;
|
||||
viewport_h = (float) upem;
|
||||
}
|
||||
else
|
||||
{
|
||||
viewport_w = vb_w;
|
||||
viewport_h = vb_h;
|
||||
}
|
||||
}
|
||||
has_viewbox_transform =
|
||||
hb_raster_svg_compute_viewbox_transform (viewport_w, viewport_h,
|
||||
@@ -433,30 +443,41 @@ hb_raster_svg_render (hb_raster_paint_t *paint,
|
||||
unsigned palette,
|
||||
hb_color_t foreground)
|
||||
{
|
||||
unsigned data_len;
|
||||
const char *data = hb_blob_get_data (blob, &data_len);
|
||||
if (!data || !data_len) return false;
|
||||
|
||||
bool ret = false;
|
||||
hb_blob_t *render_blob = nullptr;
|
||||
hb_face_t *face HB_UNUSED = hb_font_get_face (font);
|
||||
const OT::SVG::svg_doc_cache_t *doc_cache = nullptr;
|
||||
#ifndef HB_NO_SVG
|
||||
unsigned doc_index = 0;
|
||||
hb_codepoint_t start_glyph = HB_CODEPOINT_INVALID;
|
||||
hb_codepoint_t end_glyph = HB_CODEPOINT_INVALID;
|
||||
#endif
|
||||
hb_paint_funcs_t *pfuncs = hb_raster_paint_get_funcs ();
|
||||
hb_svg_render_context_t ctx;
|
||||
hb_svg_cascade_t initial_state;
|
||||
hb_svg_defs_scan_context_t scan_ctx;
|
||||
bool found_glyph = false;
|
||||
#ifndef HB_NO_SVG
|
||||
unsigned glyph_start = 0, glyph_end = 0;
|
||||
#endif
|
||||
|
||||
unsigned data_len = 0;
|
||||
const char *data = nullptr;
|
||||
render_blob = OT::hb_ot_svg_reference_normalized_blob (blob, &data, &data_len);
|
||||
if (!render_blob || !data_len)
|
||||
goto done;
|
||||
|
||||
#ifndef HB_NO_SVG
|
||||
if (face &&
|
||||
hb_ot_color_glyph_get_svg_document_index (face, glyph, &doc_index) &&
|
||||
hb_ot_color_get_svg_document_glyph_range (face, doc_index, &start_glyph, &end_glyph))
|
||||
doc_cache = face->table.SVG->get_or_create_doc_cache (blob, data, data_len,
|
||||
doc_cache = face->table.SVG->get_or_create_doc_cache (render_blob, data, data_len,
|
||||
doc_index, start_glyph, end_glyph);
|
||||
|
||||
if (doc_cache)
|
||||
data = face->table.SVG->doc_cache_get_svg (doc_cache, &data_len);
|
||||
#endif
|
||||
|
||||
hb_paint_funcs_t *pfuncs = hb_raster_paint_get_funcs ();
|
||||
|
||||
hb_svg_render_context_t ctx;
|
||||
ctx.paint = paint;
|
||||
ctx.pfuncs = pfuncs;
|
||||
ctx.font = font;
|
||||
@@ -469,10 +490,9 @@ hb_raster_svg_render (hb_raster_paint_t *paint,
|
||||
#endif
|
||||
ctx.doc_cache = doc_cache;
|
||||
|
||||
hb_svg_cascade_t initial_state;
|
||||
initial_state.color = foreground;
|
||||
|
||||
hb_svg_defs_scan_context_t scan_ctx = {
|
||||
scan_ctx = {
|
||||
&ctx.defs, ctx.pfuncs, ctx.paint,
|
||||
ctx.foreground, hb_font_get_face (ctx.font),
|
||||
ctx.palette,
|
||||
@@ -481,9 +501,7 @@ hb_raster_svg_render (hb_raster_paint_t *paint,
|
||||
};
|
||||
hb_raster_svg_collect_defs (&scan_ctx, data, data_len);
|
||||
|
||||
bool found_glyph = false;
|
||||
#ifndef HB_NO_SVG
|
||||
unsigned glyph_start = 0, glyph_end = 0;
|
||||
if (doc_cache && face->table.SVG->doc_cache_get_glyph_span (doc_cache, glyph, &glyph_start, &glyph_end))
|
||||
{
|
||||
hb_svg_xml_parser_t parser (data + glyph_start, glyph_end - glyph_start);
|
||||
@@ -518,7 +536,7 @@ hb_raster_svg_render (hb_raster_paint_t *paint,
|
||||
if (id.len)
|
||||
{
|
||||
if (id.len == (unsigned) glyph_id_len &&
|
||||
0 == memcmp (id.data, glyph_id_str, (unsigned) glyph_id_len))
|
||||
0 == hb_memcmp (id.data, glyph_id_str, (unsigned) glyph_id_len))
|
||||
{
|
||||
hb_paint_push_font_transform (ctx.pfuncs, ctx.paint, font);
|
||||
ctx.push_transform (1, 0, 0, -1, 0, 0);
|
||||
@@ -533,7 +551,11 @@ hb_raster_svg_render (hb_raster_paint_t *paint,
|
||||
}
|
||||
}
|
||||
|
||||
return found_glyph;
|
||||
ret = found_glyph;
|
||||
|
||||
done:
|
||||
hb_blob_destroy (render_blob);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* !HB_NO_RASTER_SVG */
|
||||
+156
-38
@@ -30,6 +30,7 @@
|
||||
#include "hb-vector-svg-subset.hh"
|
||||
#ifndef HB_NO_SVG
|
||||
#include "OT/Color/svg/svg.hh"
|
||||
#include "hb-raster-svg-parse.hh"
|
||||
#endif
|
||||
#include "hb-vector-svg-utils.hh"
|
||||
#include "hb-map.hh"
|
||||
@@ -40,6 +41,33 @@
|
||||
#include <string.h>
|
||||
|
||||
#ifndef HB_NO_SVG
|
||||
static bool
|
||||
hb_svg_append_str (hb_vector_t<char> *out,
|
||||
const char *s)
|
||||
{
|
||||
return hb_svg_append_len (out, s, (unsigned) strlen (s));
|
||||
}
|
||||
|
||||
static bool
|
||||
hb_svg_append_unsigned (hb_vector_t<char> *out,
|
||||
unsigned v)
|
||||
{
|
||||
char tmp[10];
|
||||
unsigned n = 0;
|
||||
do {
|
||||
tmp[n++] = (char) ('0' + (v % 10));
|
||||
v /= 10;
|
||||
} while (v);
|
||||
|
||||
unsigned old_len = out->length;
|
||||
if (unlikely (!out->resize_dirty ((int) (old_len + n))))
|
||||
return false;
|
||||
|
||||
for (unsigned i = 0; i < n; i++)
|
||||
out->arrayZ[old_len + i] = tmp[n - 1 - i];
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
hb_svg_append_with_prefix (hb_vector_t<char> *out,
|
||||
const char *s,
|
||||
@@ -171,10 +199,10 @@ hb_svg_add_unique_id (hb_vector_t<OT::SVG::svg_id_span_t> *v,
|
||||
const char *p,
|
||||
unsigned n)
|
||||
{
|
||||
if (!n) return false;
|
||||
if (!n) return true;
|
||||
OT::SVG::svg_id_span_t key = {p, n};
|
||||
if (seen_ids->has (key))
|
||||
return false;
|
||||
return true;
|
||||
if (unlikely (!seen_ids->set (key, true)))
|
||||
return false;
|
||||
auto *slot = v->push ();
|
||||
@@ -254,6 +282,30 @@ hb_svg_collect_refs (const char *s,
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
hb_svg_find_root_open_tag (const char *svg,
|
||||
unsigned len,
|
||||
unsigned *root_open_len,
|
||||
bool *missing_viewport)
|
||||
{
|
||||
hb_svg_xml_parser_t parser (svg, len);
|
||||
hb_svg_token_type_t tok = parser.next ();
|
||||
if (!((tok == SVG_TOKEN_OPEN_TAG || tok == SVG_TOKEN_SELF_CLOSE_TAG) &&
|
||||
parser.tag_name.eq ("svg")))
|
||||
return false;
|
||||
|
||||
if (missing_viewport)
|
||||
{
|
||||
*missing_viewport =
|
||||
parser.find_attr ("width").is_null () ||
|
||||
parser.find_attr ("height").is_null ();
|
||||
}
|
||||
|
||||
if (root_open_len)
|
||||
*root_open_len = (unsigned) (parser.p - parser.tag_start);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
hb_svg_subset_glyph_image (hb_face_t *face,
|
||||
hb_blob_t *image,
|
||||
@@ -262,47 +314,61 @@ hb_svg_subset_glyph_image (hb_face_t *face,
|
||||
hb_vector_t<char> *defs_dst,
|
||||
hb_vector_t<char> *body_dst)
|
||||
{
|
||||
if (glyph == HB_CODEPOINT_INVALID || !image_counter || !defs_dst || !body_dst)
|
||||
return false;
|
||||
|
||||
unsigned len;
|
||||
const char *svg = hb_blob_get_data (image, &len);
|
||||
if (!svg || !len)
|
||||
return false;
|
||||
|
||||
bool ret = false;
|
||||
hb_blob_t *normalized_image = nullptr;
|
||||
unsigned len = 0;
|
||||
const char *svg = nullptr;
|
||||
unsigned doc_index = 0;
|
||||
if (!hb_ot_color_glyph_get_svg_document_index (face, glyph, &doc_index))
|
||||
return false;
|
||||
|
||||
hb_codepoint_t start_glyph = HB_CODEPOINT_INVALID;
|
||||
hb_codepoint_t end_glyph = HB_CODEPOINT_INVALID;
|
||||
if (!hb_ot_color_get_svg_document_glyph_range (face, doc_index, &start_glyph, &end_glyph))
|
||||
return false;
|
||||
const OT::SVG::svg_doc_cache_t *doc_cache = nullptr;
|
||||
unsigned glyph_start = 0, glyph_end = 0;
|
||||
const hb_vector_t<OT::SVG::svg_defs_entry_t> *defs_entries = nullptr;
|
||||
hb_vector_t<OT::SVG::svg_id_span_t> needed_ids;
|
||||
hb_hashmap_t<OT::SVG::svg_id_span_t, hb_bool_t> needed_ids_set;
|
||||
hb_vector_t<unsigned> chosen_defs;
|
||||
hb_vector_t<uint8_t> chosen_def_marks;
|
||||
unsigned root_open_len = 0;
|
||||
bool glyph_is_root_svg = false;
|
||||
bool root_missing_viewport = false;
|
||||
char prefix[32];
|
||||
int prefix_len = 0;
|
||||
|
||||
auto *doc_cache = face->table.SVG->get_or_create_doc_cache (image, svg, len,
|
||||
doc_index, start_glyph, end_glyph);
|
||||
if (glyph == HB_CODEPOINT_INVALID || !image_counter || !defs_dst || !body_dst)
|
||||
goto done;
|
||||
|
||||
normalized_image = OT::hb_ot_svg_reference_normalized_blob (image, &svg, &len);
|
||||
if (!normalized_image || !svg || !len)
|
||||
goto done;
|
||||
|
||||
if (!hb_ot_color_glyph_get_svg_document_index (face, glyph, &doc_index))
|
||||
goto done;
|
||||
|
||||
if (!hb_ot_color_get_svg_document_glyph_range (face, doc_index, &start_glyph, &end_glyph))
|
||||
goto done;
|
||||
|
||||
doc_cache = face->table.SVG->get_or_create_doc_cache (normalized_image, svg, len,
|
||||
doc_index, start_glyph, end_glyph);
|
||||
if (!doc_cache)
|
||||
return false;
|
||||
goto done;
|
||||
svg = face->table.SVG->doc_cache_get_svg (doc_cache, &len);
|
||||
|
||||
unsigned glyph_start = 0, glyph_end = 0;
|
||||
if (!face->table.SVG->doc_cache_get_glyph_span (doc_cache, glyph, &glyph_start, &glyph_end))
|
||||
return false;
|
||||
goto done;
|
||||
|
||||
auto *defs_entries = face->table.SVG->doc_cache_get_defs_entries (doc_cache);
|
||||
defs_entries = face->table.SVG->doc_cache_get_defs_entries (doc_cache);
|
||||
if (!hb_svg_find_root_open_tag (svg, len, &root_open_len, &root_missing_viewport))
|
||||
goto done;
|
||||
glyph_is_root_svg = glyph_start == 0;
|
||||
|
||||
hb_vector_t<OT::SVG::svg_id_span_t> needed_ids;
|
||||
needed_ids.alloc (16);
|
||||
hb_hashmap_t<OT::SVG::svg_id_span_t, hb_bool_t> needed_ids_set;
|
||||
if (!hb_svg_collect_refs (svg + glyph_start, glyph_end - glyph_start,
|
||||
&needed_ids, &needed_ids_set))
|
||||
return false;
|
||||
goto done;
|
||||
|
||||
hb_vector_t<unsigned> chosen_defs;
|
||||
chosen_defs.alloc (16);
|
||||
hb_vector_t<uint8_t> chosen_def_marks;
|
||||
if (unlikely (!chosen_def_marks.resize ((int) defs_entries->length)))
|
||||
return false;
|
||||
goto done;
|
||||
hb_memset (chosen_def_marks.arrayZ, 0, defs_entries->length);
|
||||
for (unsigned qi = 0; qi < needed_ids.length; qi++)
|
||||
{
|
||||
@@ -316,36 +382,88 @@ hb_svg_subset_glyph_image (hb_face_t *face,
|
||||
{
|
||||
chosen_def_marks.arrayZ[i] = 1;
|
||||
if (unlikely (!chosen_defs.push_or_fail (i)))
|
||||
return false;
|
||||
goto done;
|
||||
if (!hb_svg_collect_refs (svg + e.start, e.end - e.start,
|
||||
&needed_ids, &needed_ids_set))
|
||||
return false;
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
char prefix[32];
|
||||
int prefix_len = snprintf (prefix, sizeof (prefix), "hbimg%u_", (*image_counter)++);
|
||||
prefix_len = snprintf (prefix, sizeof (prefix), "hbimg%u_", (*image_counter)++);
|
||||
if (prefix_len <= 0 || (unsigned) prefix_len >= sizeof (prefix))
|
||||
return false;
|
||||
goto done;
|
||||
|
||||
body_dst->alloc (body_dst->length + (glyph_end - glyph_start) + (unsigned) prefix_len + 32);
|
||||
body_dst->alloc (body_dst->length + (glyph_end - glyph_start) + 64);
|
||||
|
||||
for (unsigned i = 0; i < chosen_defs.length; i++)
|
||||
{
|
||||
const auto &e = defs_entries->arrayZ[chosen_defs.arrayZ[i]];
|
||||
if (!hb_svg_append_with_prefix (defs_dst, svg + e.start, e.end - e.start, prefix, (unsigned) prefix_len))
|
||||
return false;
|
||||
if (!hb_svg_append_c (defs_dst, '\n')) return false;
|
||||
goto done;
|
||||
if (!hb_svg_append_c (defs_dst, '\n'))
|
||||
goto done;
|
||||
}
|
||||
|
||||
return hb_svg_append_with_prefix (body_dst,
|
||||
if (glyph_is_root_svg && root_missing_viewport && root_open_len > 1)
|
||||
{
|
||||
unsigned upem = face->get_upem ();
|
||||
if (!hb_svg_append_with_prefix (body_dst,
|
||||
svg + glyph_start,
|
||||
glyph_end - glyph_start,
|
||||
root_open_len - 1,
|
||||
prefix,
|
||||
(unsigned) prefix_len);
|
||||
(unsigned) prefix_len))
|
||||
goto done;
|
||||
if (!hb_svg_append_str (body_dst, " width=\""))
|
||||
goto done;
|
||||
if (!hb_svg_append_unsigned (body_dst, upem))
|
||||
goto done;
|
||||
if (!hb_svg_append_str (body_dst, "\" height=\""))
|
||||
goto done;
|
||||
if (!hb_svg_append_unsigned (body_dst, upem))
|
||||
goto done;
|
||||
if (!hb_svg_append_str (body_dst, "\" overflow=\"visible"))
|
||||
goto done;
|
||||
if (!hb_svg_append_c (body_dst, '"'))
|
||||
goto done;
|
||||
if (!hb_svg_append_c (body_dst, '>'))
|
||||
goto done;
|
||||
ret = hb_svg_append_with_prefix (body_dst,
|
||||
svg + glyph_start + root_open_len,
|
||||
glyph_end - glyph_start - root_open_len,
|
||||
prefix,
|
||||
(unsigned) prefix_len);
|
||||
}
|
||||
else if (glyph_is_root_svg && root_open_len > 1)
|
||||
{
|
||||
if (!hb_svg_append_with_prefix (body_dst,
|
||||
svg + glyph_start,
|
||||
root_open_len - 1,
|
||||
prefix,
|
||||
(unsigned) prefix_len))
|
||||
goto done;
|
||||
if (!hb_svg_append_str (body_dst, " overflow=\"visible\""))
|
||||
goto done;
|
||||
if (!hb_svg_append_c (body_dst, '>'))
|
||||
goto done;
|
||||
ret = hb_svg_append_with_prefix (body_dst,
|
||||
svg + glyph_start + root_open_len,
|
||||
glyph_end - glyph_start - root_open_len,
|
||||
prefix,
|
||||
(unsigned) prefix_len);
|
||||
}
|
||||
else
|
||||
ret = hb_svg_append_with_prefix (body_dst,
|
||||
svg + glyph_start,
|
||||
glyph_end - glyph_start,
|
||||
prefix,
|
||||
(unsigned) prefix_len);
|
||||
|
||||
done:
|
||||
hb_blob_destroy (normalized_image);
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
bool
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
#ifndef HB_ZLIB_CC
|
||||
#define HB_ZLIB_CC
|
||||
|
||||
#include "hb.hh"
|
||||
|
||||
#include "hb-zlib.hh"
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#include <zlib.h>
|
||||
#endif
|
||||
|
||||
hb_blob_t *
|
||||
hb_blob_decompress_gzip (hb_blob_t *blob,
|
||||
unsigned max_output_len)
|
||||
{
|
||||
#ifndef HAVE_ZLIB
|
||||
return nullptr;
|
||||
#else
|
||||
unsigned compressed_len = 0;
|
||||
const uint8_t *compressed = (const uint8_t *) hb_blob_get_data (blob, &compressed_len);
|
||||
if (!compressed || !compressed_len)
|
||||
return nullptr;
|
||||
|
||||
z_stream stream = {};
|
||||
stream.next_in = (Bytef *) compressed;
|
||||
stream.avail_in = compressed_len;
|
||||
|
||||
if (inflateInit2 (&stream, 16 + MAX_WBITS) != Z_OK)
|
||||
return nullptr;
|
||||
|
||||
uint32_t expected_size = 0;
|
||||
hb_gzip_get_uncompressed_size ((const char *) compressed,
|
||||
compressed_len,
|
||||
&expected_size);
|
||||
|
||||
size_t allocated = hb_min ((size_t) hb_max (expected_size, 4096u),
|
||||
(size_t) max_output_len);
|
||||
char *output = (char *) hb_malloc (allocated);
|
||||
if (!output)
|
||||
{
|
||||
inflateEnd (&stream);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int status = Z_OK;
|
||||
while (true)
|
||||
{
|
||||
size_t produced = (size_t) stream.total_out;
|
||||
if (unlikely (produced >= (size_t) max_output_len))
|
||||
goto fail;
|
||||
|
||||
if (produced == allocated)
|
||||
{
|
||||
size_t new_allocated = hb_min (allocated * 2, (size_t) max_output_len);
|
||||
if (unlikely (new_allocated <= allocated))
|
||||
goto fail;
|
||||
|
||||
char *new_output = (char *) hb_realloc (output, new_allocated);
|
||||
if (unlikely (!new_output))
|
||||
goto fail;
|
||||
|
||||
output = new_output;
|
||||
allocated = new_allocated;
|
||||
}
|
||||
|
||||
stream.next_out = (Bytef *) output + stream.total_out;
|
||||
stream.avail_out = (uInt) (allocated - (size_t) stream.total_out);
|
||||
|
||||
status = inflate (&stream, Z_FINISH);
|
||||
if (status == Z_STREAM_END)
|
||||
break;
|
||||
|
||||
if ((status == Z_OK || status == Z_BUF_ERROR) && stream.avail_out == 0)
|
||||
continue;
|
||||
|
||||
goto fail;
|
||||
}
|
||||
|
||||
inflateEnd (&stream);
|
||||
|
||||
if (unlikely ((size_t) stream.total_out > (size_t) max_output_len))
|
||||
goto fail_free;
|
||||
|
||||
return hb_blob_create_or_fail (output,
|
||||
(unsigned) stream.total_out,
|
||||
HB_MEMORY_MODE_WRITABLE,
|
||||
output,
|
||||
hb_free);
|
||||
|
||||
fail:
|
||||
inflateEnd (&stream);
|
||||
fail_free:
|
||||
hb_free (output);
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* HB_ZLIB_CC */
|
||||
@@ -0,0 +1,37 @@
|
||||
#ifndef HB_ZLIB_HH
|
||||
#define HB_ZLIB_HH
|
||||
|
||||
#include "hb-blob.hh"
|
||||
|
||||
static inline bool
|
||||
hb_blob_is_gzip (const char *data,
|
||||
unsigned data_len)
|
||||
{
|
||||
return data_len >= 3 &&
|
||||
(unsigned char) data[0] == 0x1Fu &&
|
||||
(unsigned char) data[1] == 0x8Bu &&
|
||||
(unsigned char) data[2] == 0x08u;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
hb_gzip_get_uncompressed_size (const char *data,
|
||||
unsigned data_len,
|
||||
uint32_t *size)
|
||||
{
|
||||
if (data_len < 4)
|
||||
return false;
|
||||
|
||||
const unsigned char *trailer = (const unsigned char *) data + data_len - 4;
|
||||
if (size)
|
||||
*size = (uint32_t) trailer[0] |
|
||||
((uint32_t) trailer[1] << 8) |
|
||||
((uint32_t) trailer[2] << 16) |
|
||||
((uint32_t) trailer[3] << 24);
|
||||
return true;
|
||||
}
|
||||
|
||||
HB_INTERNAL hb_blob_t *
|
||||
hb_blob_decompress_gzip (hb_blob_t *blob,
|
||||
unsigned max_output_len);
|
||||
|
||||
#endif /* HB_ZLIB_HH */
|
||||
+13
-1
@@ -706,6 +706,8 @@ if not get_option('subset').disabled()
|
||||
endif
|
||||
|
||||
hb_raster_sources = [
|
||||
'hb-zlib.cc',
|
||||
'hb-zlib.hh',
|
||||
'hb-raster.cc',
|
||||
'hb-raster-image.cc',
|
||||
'hb-raster-image.hh',
|
||||
@@ -744,6 +746,8 @@ hb_raster_headers = [
|
||||
]
|
||||
|
||||
hb_vector_sources = [
|
||||
'hb-zlib.cc',
|
||||
'hb-zlib.hh',
|
||||
'hb-vector.cc',
|
||||
'hb-vector-svg-draw.cc',
|
||||
'hb-vector-svg-path.cc',
|
||||
@@ -766,6 +770,9 @@ if not get_option('raster').disabled()
|
||||
if png_dep.found()
|
||||
raster_deps += [png_dep]
|
||||
endif
|
||||
if zlib_dep.found()
|
||||
raster_deps += [zlib_dep]
|
||||
endif
|
||||
|
||||
libharfbuzz_raster = library('harfbuzz-raster', hb_raster_sources,
|
||||
include_directories: incconfig,
|
||||
@@ -803,9 +810,14 @@ endif
|
||||
|
||||
libharfbuzz_vector_dep = null_dep
|
||||
if not get_option('vector').disabled()
|
||||
vector_deps = [m_dep]
|
||||
if zlib_dep.found()
|
||||
vector_deps += [zlib_dep]
|
||||
endif
|
||||
|
||||
libharfbuzz_vector = library('harfbuzz-vector', hb_vector_sources,
|
||||
include_directories: incconfig,
|
||||
dependencies: [m_dep],
|
||||
dependencies: vector_deps,
|
||||
link_with: [libharfbuzz],
|
||||
cpp_args: cpp_args + extra_hb_cpp_args,
|
||||
soversion: hb_so_version,
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include "hb-test.h"
|
||||
#include "hb-raster.h"
|
||||
#include <hb-ot.h>
|
||||
|
||||
|
||||
/* ── Helpers ─────────────────────────────────────────────────────── */
|
||||
@@ -62,6 +63,32 @@ pixel_at (hb_raster_image_t *img, int x, int y)
|
||||
return hb_raster_image_get_buffer (img)[row * ext.stride + col];
|
||||
}
|
||||
|
||||
static hb_raster_image_t *
|
||||
render_svg_glyph (hb_face_t *face,
|
||||
hb_codepoint_t glyph)
|
||||
{
|
||||
g_assert_nonnull (face);
|
||||
|
||||
hb_font_t *font = hb_font_create (face);
|
||||
g_assert_nonnull (font);
|
||||
hb_font_set_scale (font, 128, 128);
|
||||
|
||||
hb_raster_paint_t *paint = hb_raster_paint_create_or_fail ();
|
||||
g_assert_nonnull (paint);
|
||||
hb_raster_paint_set_foreground (paint, HB_COLOR (0, 0, 0, 255));
|
||||
|
||||
hb_raster_extents_t extents = {-32, -192, 256, 256, 0};
|
||||
hb_raster_paint_set_extents (paint, &extents);
|
||||
g_assert_true (hb_raster_paint_glyph (paint, font, glyph, 0.f, 0.f, 0, HB_COLOR (0, 0, 0, 255)));
|
||||
|
||||
hb_raster_image_t *img = hb_raster_paint_render (paint);
|
||||
g_assert_nonnull (img);
|
||||
|
||||
hb_raster_paint_destroy (paint);
|
||||
hb_font_destroy (font);
|
||||
return img;
|
||||
}
|
||||
|
||||
|
||||
/* ── Test 1: rectangle geometry ──────────────────────────────────── */
|
||||
|
||||
@@ -224,6 +251,44 @@ test_set_glyph_extents_with_transform (void)
|
||||
hb_raster_draw_destroy (rdr);
|
||||
}
|
||||
|
||||
/* ── Test 6: gzip-compressed SVG documents ──────────────────────── */
|
||||
|
||||
static void
|
||||
test_svgz_render_matches_svg (void)
|
||||
{
|
||||
#if !defined (HB_NO_SVG) && defined (HAVE_ZLIB)
|
||||
hb_face_t *svg_face = hb_test_open_font_file ("../fuzzing/fonts/noto_handwriting-untouchedsvg.ttf");
|
||||
hb_face_t *svgz_face = hb_test_open_font_file ("../fuzzing/fonts/noto_handwriting-untouchedsvgz.ttf");
|
||||
|
||||
hb_raster_image_t *svg = render_svg_glyph (svg_face, 7);
|
||||
hb_raster_image_t *svgz = render_svg_glyph (svgz_face, 7);
|
||||
|
||||
hb_raster_extents_t svg_extents;
|
||||
hb_raster_extents_t svgz_extents;
|
||||
hb_raster_image_get_extents (svg, &svg_extents);
|
||||
hb_raster_image_get_extents (svgz, &svgz_extents);
|
||||
|
||||
g_assert_cmpint (hb_raster_image_get_format (svg), ==, hb_raster_image_get_format (svgz));
|
||||
g_assert_cmpint (svg_extents.x_origin, ==, svgz_extents.x_origin);
|
||||
g_assert_cmpint (svg_extents.y_origin, ==, svgz_extents.y_origin);
|
||||
g_assert_cmpuint (svg_extents.width, ==, svgz_extents.width);
|
||||
g_assert_cmpuint (svg_extents.height, ==, svgz_extents.height);
|
||||
g_assert_cmpuint (svg_extents.stride, ==, svgz_extents.stride);
|
||||
g_assert_cmpuint (svg_extents.width, >, 0);
|
||||
g_assert_cmpuint (svg_extents.height, >, 0);
|
||||
|
||||
size_t len = (size_t) svg_extents.stride * svg_extents.height;
|
||||
g_assert_cmpint (memcmp (hb_raster_image_get_buffer (svg),
|
||||
hb_raster_image_get_buffer (svgz),
|
||||
len), ==, 0);
|
||||
|
||||
hb_raster_image_destroy (svg);
|
||||
hb_raster_image_destroy (svgz);
|
||||
hb_face_destroy (svg_face);
|
||||
hb_face_destroy (svgz_face);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* ── main ────────────────────────────────────────────────────────── */
|
||||
|
||||
@@ -237,6 +302,7 @@ main (int argc, char **argv)
|
||||
hb_test_add (test_subpixel_edge);
|
||||
hb_test_add (test_transform);
|
||||
hb_test_add (test_set_glyph_extents_with_transform);
|
||||
hb_test_add (test_svgz_render_matches_svg);
|
||||
|
||||
return hb_test_run ();
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-16 -966 1307 1232" width="1307" height="1232">
|
||||
<defs>
|
||||
|
||||
<clipPath id="c0"><rect x="64" y="-224" width="1152" height="1152"/></clipPath>
|
||||
<path id="p13" d="M1200,270C1200,299 1177,322 1148,323C1125,324 1067,309 1034,325C954,363 621,538 621,538C592,554 520,577 484,568L218,462C192,456 171,440 158,420C148,409 138,332 123,262C108,192 90,146 90,146C76,93 118,57 156,51C193,44 242,67 256,121L287,268C292,292 312,311 337,314L430,311L397,143C397,143 564,-71 799,-121C885,-140 966,-86 1028,-82C1056,-80 1116,-86 1142,-94C1171,-102 1200,-81 1200,-52L1200,270Z"/>
|
||||
<clipPath id="clip-g13"><use href="#p13"/></clipPath>
|
||||
<radialGradient id="gr0" gradientUnits="userSpaceOnUse" cx="288" cy="494" r="467" fx="288" fy="494" spreadMethod="pad">
|
||||
<stop offset="0.3533" stop-color="rgb(255,202,40)"/>
|
||||
<stop offset="0.7665" stop-color="rgb(255,179,0)"/>
|
||||
</radialGradient>
|
||||
<path id="p14" d="M860,-135C800,-134 709,-100 646,-73C599,-52 547,-50 499,-67L451,-84C405,-100 354,-85 325,-47L231,79L1019,81C1019,81 1004,-138 860,-135Z"/>
|
||||
<clipPath id="clip-g14"><use href="#p14"/></clipPath>
|
||||
<path id="p15" d="M418,268L559,501L558,462C557,422 583,386 622,374L418,268Z"/>
|
||||
<clipPath id="clip-g15"><use href="#p15"/></clipPath>
|
||||
<path id="p16" d="M259,-90L98,-209C86,-218 72,-209 75,-195L120,-10C121,-6 123,-1 125,2L659,892C670,911 693,918 711,908L793,862C810,852 815,829 804,810L270,-77C268,-82 264,-87 259,-90Z"/>
|
||||
<clipPath id="clip-g16"><use href="#p16"/></clipPath>
|
||||
<path id="p17" d="M503,542C535,542 585,525 608,513C622,506 942,337 1023,299C1037,293 1054,290 1075,290C1092,290 1108,291 1122,293C1131,294 1140,295 1146,295L1147,295C1161,294 1172,284 1172,270L1172,-52C1172,-61 1163,-68 1155,-68C1153,-68 1151,-67 1150,-67C1122,-59 1069,-53 1039,-53C1034,-53 1030,-53 1026,-54C999,-55 972,-64 943,-74L937,-76C933,-77 930,-79 927,-82C908,-99 887,-107 863,-107L860,-107C817,-106 741,-84 657,-47C628,-34 597,-28 565,-28C539,-28 514,-32 489,-41L441,-58C432,-61 423,-62 413,-62C387,-62 363,-50 348,-30L335,-13C330,-6 321,-2 313,-2C312,-2 311,-2 310,-2C307,-2 304,-2 302,-2C274,-2 264,11 259,22C252,36 251,51 257,66C259,72 259,78 257,84C263,85 269,88 274,92C280,99 288,105 296,109C297,109 297,110 297,110L425,186C432,190 436,197 438,204L458,305C459,314 457,323 451,330C446,336 438,339 430,339C429,339 428,339 428,339L347,331L346,331C310,326 281,299 273,265L230,129C229,129 229,128 229,128C229,126 228,124 227,122C225,116 225,109 227,104C221,103 215,100 211,96C199,85 183,78 168,78C165,78 163,78 160,79C145,81 130,91 122,103C116,113 114,125 117,138C121,147 137,191 150,256C155,279 159,301 163,323C169,355 176,394 181,403C181,404 181,404 181,404C192,420 207,431 225,435C226,435 228,436 229,436L492,541C494,542 498,542 503,542ZM503,570C496,570 489,569 484,568L218,462C193,456 172,440 158,420C148,409 138,332 123,262C108,192 91,146 91,146C76,93 118,57 156,51C160,50 164,50 168,50C189,50 212,58 230,76C223,55 223,32 234,10C248,-19 274,-30 302,-30C305,-30 309,-30 313,-30L326,-47C346,-75 380,-90 414,-90C426,-90 439,-88 451,-84L499,-67C521,-59 543,-56 566,-56C593,-56 620,-61 646,-73C709,-100 800,-134 860,-135L863,-135C897,-135 925,-122 946,-102C975,-93 1003,-83 1028,-82C1031,-82 1035,-81 1039,-81C1070,-81 1119,-87 1142,-94C1146,-95 1151,-96 1155,-96C1179,-96 1200,-76 1200,-52L1200,270C1200,299 1177,322 1148,323C1148,323 1147,323 1146,323C1130,323 1102,318 1076,318C1061,318 1046,319 1035,325C954,363 621,538 621,538C596,551 541,570 503,570ZM254,112C255,115 255,118 256,121L300,257C305,281 325,300 350,303L430,311L410,210L283,134C272,128 262,120 254,112Z"/>
|
||||
<clipPath id="clip-g17"><use href="#p17"/></clipPath>
|
||||
<linearGradient id="gr1" gradientUnits="userSpaceOnUse" x1="669" y1="776" x2="572" y2="-1477" spreadMethod="pad">
|
||||
<stop offset="0" stop-color="rgb(100,181,246)"/>
|
||||
<stop offset="1" stop-color="rgb(33,150,243)"/>
|
||||
</linearGradient>
|
||||
<path id="p18" d="M694,884C695,884 696,884 697,884L779,837C779,837 781,836 781,834C782,833 782,829 779,824L246,-63C245,-65 244,-66 242,-68L112,-164L147,-16C147,-15 148,-13 149,-12L683,877C686,882 691,884 694,884ZM694,913C681,913 667,905 659,892L125,2C122,-1 121,-5 120,-10L75,-195C73,-205 80,-212 89,-212C92,-212 95,-211 98,-209L259,-90C264,-87 268,-82 271,-77L804,810C815,829 810,852 793,862L711,908C706,911 700,913 694,913Z"/>
|
||||
<clipPath id="clip-g18"><use href="#p18"/></clipPath>
|
||||
<path id="p19" d="M775,346C659,390 569,383 503,332C458,296 294,179 222,102C187,65 219,24 249,5C308,-32 366,-29 494,48C559,88 600,55 647,23C647,23 719,-36 783,-59C846,-81 995,-47 1045,29C1100,112 1011,256 775,346Z"/>
|
||||
<clipPath id="clip-g19"><use href="#p19"/></clipPath>
|
||||
<radialGradient id="gr2" gradientUnits="userSpaceOnUse" cx="634" cy="160" r="342" fx="634" fy="160" spreadMethod="pad">
|
||||
<stop offset="0.3533" stop-color="rgb(255,202,40)"/>
|
||||
<stop offset="0.7665" stop-color="rgb(255,179,0)"/>
|
||||
</radialGradient>
|
||||
<path id="p20" d="M635,347C590,347 553,335 521,310C511,302 495,290 476,275C409,225 297,141 242,83C235,75 234,69 235,65C236,54 248,39 264,29C284,16 303,11 323,11C360,11 408,30 479,73C504,88 527,95 551,95C593,95 625,73 656,51L662,47C663,46 664,46 665,45C665,45 734,-12 792,-32C795,-34 801,-35 808,-36C832,-51 857,-59 886,-60C846,-68 808,-68 783,-59C719,-36 647,24 647,24C644,25 642,27 640,28C596,58 556,86 494,49C366,-29 308,-32 249,5C219,24 187,65 222,102C294,179 458,296 503,332C518,343 535,353 552,360C577,370 605,375 635,375C657,375 681,372 707,366C717,364 728,361 739,358C707,355 684,350 667,345C656,346 645,347 635,347Z"/>
|
||||
<clipPath id="clip-g20"><use href="#p20"/></clipPath>
|
||||
<g id="cg0">
|
||||
<g clip-path="url(#c0)">
|
||||
<g clip-path="url(#clip-g13)">
|
||||
<g transform="matrix(1,0,0,0.9768066,0,0)">
|
||||
<rect x="-32767" y="-32767" width="65534" height="65534" fill="url(#gr0)"/>
|
||||
</g>
|
||||
</g>
|
||||
<g clip-path="url(#clip-g14)">
|
||||
<rect x="-32767" y="-32767" width="65534" height="65534" fill="#FA0"/>
|
||||
</g>
|
||||
<g clip-path="url(#clip-g15)">
|
||||
<rect x="-32767" y="-32767" width="65534" height="65534" fill="#EDA600"/>
|
||||
</g>
|
||||
<g clip-path="url(#clip-g16)">
|
||||
<rect x="-32767" y="-32767" width="65534" height="65534" fill="#1E88E5"/>
|
||||
</g>
|
||||
<g clip-path="url(#clip-g17)">
|
||||
<rect x="-32767" y="-32767" width="65534" height="65534" fill="#EDA600"/>
|
||||
</g>
|
||||
<g clip-path="url(#clip-g16)">
|
||||
<rect x="-32767" y="-32767" width="65534" height="65534" fill="url(#gr1)"/>
|
||||
</g>
|
||||
<g clip-path="url(#clip-g18)">
|
||||
<rect x="-32767" y="-32767" width="65534" height="65534" fill="#424242" fill-opacity="0.2"/>
|
||||
</g>
|
||||
<g clip-path="url(#clip-g19)">
|
||||
<g transform="matrix(1,0,0,0.9691162,0,0)">
|
||||
<rect x="-32767" y="-32767" width="65534" height="65534" fill="url(#gr2)"/>
|
||||
</g>
|
||||
</g>
|
||||
<g clip-path="url(#clip-g20)">
|
||||
<rect x="-32767" y="-32767" width="65534" height="65534" fill="#EDA600"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</defs>
|
||||
|
||||
<use href="#cg0" transform="translate(0,0) scale(1,-1)"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 6.6 KiB |
@@ -0,0 +1,71 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-16 -966 1307 1232" width="1307" height="1232">
|
||||
<defs>
|
||||
|
||||
<clipPath id="c0"><rect x="64" y="-224" width="1152" height="1152"/></clipPath>
|
||||
<path id="p13" d="M1200,270L1200,270L1200,-52Q1200,-74 1182,-87Q1164,-100 1142,-94Q1129,-90 1107.5,-87Q1086,-84 1064,-82.5Q1042,-81 1028,-82Q997,-84 960.5,-97.5Q924,-111 883,-120.5Q842,-130 799,-121Q728,-106 667,-75Q606,-44 556,-7Q506,30 470.5,64.5Q435,99 416,121Q397,143 397,143L430,311L337,314Q318,311 304.5,298.5Q291,286 287,268L256,121Q245,81 214.5,63.5Q184,46 156,51Q137,54 119,66.5Q101,79 92,99Q83,119 90,146Q90,146 101,178Q112,210 123,262Q130,297 136.5,331Q143,365 148,389.5Q153,414 158,420Q180,453 218,462L484,568Q502,573 528.5,568Q555,563 580.5,554.5Q606,546 621,538Q621,538 645.5,525Q670,512 710,491Q750,470 797.5,445.5Q845,421 891.5,397Q938,373 976,353.5Q1014,334 1034,325Q1051,317 1073,317.5Q1095,318 1116,321Q1137,324 1148,323Q1170,322 1185,307Q1200,292 1200,270Z"/>
|
||||
<clipPath id="clip-g13"><use href="#p13"/></clipPath>
|
||||
<radialGradient id="gr0" gradientUnits="userSpaceOnUse" cx="288" cy="494" r="467" fx="288" fy="494" spreadMethod="pad">
|
||||
<stop offset="0.3533" stop-color="rgb(255,202,40)"/>
|
||||
<stop offset="0.7665" stop-color="rgb(255,179,0)"/>
|
||||
</radialGradient>
|
||||
<path id="p14" d="M860,-135Q903,-136 932,-114.5Q961,-93 978.5,-60.5Q996,-28 1004.5,4.5Q1013,37 1016,59Q1019,81 1019,81L231,79L325,-47Q347,-76 381.5,-86Q416,-96 451,-84L499,-67Q573,-41 646,-73Q677,-86 715.5,-100.5Q754,-115 792,-125Q830,-135 860,-135Z"/>
|
||||
<clipPath id="clip-g14"><use href="#p14"/></clipPath>
|
||||
<path id="p15" d="M418,268L622,374Q593,383 575,407.5Q557,432 558,462L559,501L418,268Z"/>
|
||||
<clipPath id="clip-g15"><use href="#p15"/></clipPath>
|
||||
<path id="p16" d="M259,-90Q266,-85 270,-77L804,810Q812,824 809,839.5Q806,855 793,862L711,908Q698,916 682.5,911Q667,906 659,892L125,2Q121,-3 120,-10L75,-195Q73,-205 81,-210.5Q89,-216 98,-209L259,-90Z"/>
|
||||
<clipPath id="clip-g16"><use href="#p16"/></clipPath>
|
||||
<path id="p17" d="M503,542Q499,542 496.5,541.5Q494,541 492,541L229,436Q227,436 225,435Q197,428 181,404Q181,404 181,404Q181,404 181,403Q177,396 172.5,371.5Q168,347 163,323Q160,307 157,290Q154,273 150,256Q140,208 130,176Q120,144 117,138Q112,118 122,103Q135,83 160,79Q164,78 168,78Q192,78 211,96Q217,102 227,104Q224,113 227,122Q229,126 229,128Q229,128 229,128.5Q229,129 230,129L273,265Q279,291 299,309Q319,327 346,331Q346,331 346.5,331Q347,331 347,331L428,339Q428,339 430,339Q443,339 451,330Q460,319 458,305L438,204Q436,192 425,186L297,110Q297,109 296,109Q284,102 274,92Q267,85 257,84Q260,75 257,66Q249,44 259,22Q263,14 272,6Q281,-2 302,-2Q306,-2 310,-2Q311,-2 313,-2Q327,-2 335,-13L348,-30Q372,-62 413,-62Q428,-62 441,-58L489,-41Q526,-28 565,-28Q613,-28 657,-47Q720,-74 774,-90Q828,-106 860,-107L863,-107Q899,-107 927,-82Q931,-78 937,-76L943,-74Q964,-67 985,-61Q1006,-55 1026,-54Q1031,-53 1039,-53Q1062,-53 1095.5,-57Q1129,-61 1150,-67Q1152,-68 1155,-68Q1161,-68 1166.5,-63.5Q1172,-59 1172,-52L1172,270Q1172,280 1164.5,287Q1157,294 1147,295L1146,295Q1142,295 1135.5,294.5Q1129,294 1122,293Q1112,292 1100,291Q1088,290 1075,290Q1043,290 1023,299Q1002,309 965,327.5Q928,346 882.5,369.5Q837,393 790,417.5Q743,442 703,463Q663,484 637,497.5Q611,511 608,513Q591,522 559,532Q527,542 503,542L503,542ZM503,570Q532,570 567.5,559Q603,548 621,538Q621,538 645.5,525Q670,512 710,491Q750,470 797.5,445.5Q845,421 892,397Q939,373 977,353.5Q1015,334 1035,325Q1043,321 1053.5,319.5Q1064,318 1076,318Q1095,318 1114.5,320.5Q1134,323 1146,323Q1146,323 1147,323Q1148,323 1148,323Q1170,322 1185,307Q1200,292 1200,270L1200,-52Q1200,-70 1186.5,-83Q1173,-96 1155,-96Q1148,-96 1142,-94Q1125,-89 1093.5,-85Q1062,-81 1039,-81Q1033,-81 1028,-82Q1009,-83 988.5,-89Q968,-95 946,-102Q930,-117 909.5,-126Q889,-135 863,-135L860,-135Q830,-134 792,-124.5Q754,-115 715.5,-100.5Q677,-86 646,-73Q608,-56 566,-56Q531,-56 499,-67L451,-84Q433,-90 414,-90Q388,-90 364.5,-79Q341,-68 326,-47L313,-30Q307,-30 302,-30Q281,-30 263,-21Q245,-12 234,10Q218,42 230,76Q217,63 200.5,56.5Q184,50 168,50Q162,50 156,51Q137,54 119,66.5Q101,79 92,99Q83,119 91,146Q91,146 101.5,178Q112,210 123,262Q130,297 136.5,331Q143,365 148,389.5Q153,414 158,420Q180,453 218,462L484,568Q492,570 503,570ZM254,112Q266,125 283,134L410,210L430,311L350,303Q331,300 317.5,287.5Q304,275 300,257L256,121Q255,116 254,112Z"/>
|
||||
<clipPath id="clip-g17"><use href="#p17"/></clipPath>
|
||||
<linearGradient id="gr1" gradientUnits="userSpaceOnUse" x1="669" y1="776" x2="572" y2="-1477" spreadMethod="pad">
|
||||
<stop offset="0" stop-color="rgb(100,181,246)"/>
|
||||
<stop offset="1" stop-color="rgb(33,150,243)"/>
|
||||
</linearGradient>
|
||||
<path id="p18" d="M694,884Q687,884 683,877L149,-12Q148,-14 147,-16L112,-164L242,-68Q244,-66 246,-63L779,824Q782,828 782,830.5Q782,833 781,834Q781,837 779,837L697,884Q696,884 694,884L694,884ZM694,913Q703,913 711,908L793,862Q806,855 809,839.5Q812,824 804,810L271,-77Q266,-85 259,-90L98,-209Q94,-212 89,-212Q82,-212 78,-207Q74,-202 75,-195L120,-10Q121,-3 125,2L659,892Q671,913 694,913Z"/>
|
||||
<clipPath id="clip-g18"><use href="#p18"/></clipPath>
|
||||
<path id="p19" d="M775,346Q893,301 962,243Q1031,185 1051.5,127.5Q1072,70 1045,29Q1026,0 992,-20Q958,-40 918.5,-51.5Q879,-63 842.5,-65Q806,-67 783,-59Q751,-48 719.5,-28Q688,-8 667.5,7.5Q647,23 647,23Q623,39 600.5,52.5Q578,66 552,67Q526,68 494,48Q430,10 386.5,-5.5Q343,-21 310.5,-17Q278,-13 249,5Q234,14 221.5,30Q209,46 206.5,64.5Q204,83 222,102Q249,131 289.5,165Q330,199 372.5,232Q415,265 450.5,291.5Q486,318 503,332Q552,370 620,374.5Q688,379 775,346Z"/>
|
||||
<clipPath id="clip-g19"><use href="#p19"/></clipPath>
|
||||
<radialGradient id="gr2" gradientUnits="userSpaceOnUse" cx="634" cy="160" r="342" fx="634" fy="160" spreadMethod="pad">
|
||||
<stop offset="0.3533" stop-color="rgb(255,202,40)"/>
|
||||
<stop offset="0.7665" stop-color="rgb(255,179,0)"/>
|
||||
</radialGradient>
|
||||
<path id="p20" d="M635,347Q650,347 667,345Q680,349 697.5,352.5Q715,356 739,358Q722,363 707,366Q669,375 635,375Q590,375 552,360Q526,349 503,332Q486,318 450.5,291.5Q415,265 372.5,232Q330,199 289.5,165Q249,131 222,102Q204,84 206.5,65Q209,46 221.5,30.5Q234,15 249,5Q278,-13 310.5,-17Q343,-21 386.5,-5.5Q430,10 494,49Q525,67 550,67Q575,67 596.5,55Q618,43 640,28Q643,26 647,24Q647,24 667.5,8Q688,-8 719.5,-28Q751,-48 783,-59Q801,-65 828.5,-65.5Q856,-66 886,-60L886,-60Q864,-59 845,-53Q826,-47 808,-36Q799,-35 792,-32Q763,-22 733.5,-3.5Q704,15 684.5,30Q665,45 665,45Q664,45 662,47L656,51Q633,67 607.5,81Q582,95 551,95Q515,95 479,73Q426,40 388.5,25.5Q351,11 323,11Q293,11 264,29Q237,46 235,65Q234,68 235,72.5Q236,77 242,83Q269,112 311.5,147Q354,182 398,216Q442,250 476,275Q490,286 501.5,295Q513,304 521,310Q568,347 635,347Z"/>
|
||||
<clipPath id="clip-g20"><use href="#p20"/></clipPath>
|
||||
<g id="cg0">
|
||||
<g clip-path="url(#c0)">
|
||||
<g clip-path="url(#clip-g13)">
|
||||
<g transform="matrix(1,0,0,0.9768066,0,0)">
|
||||
<rect x="-32767" y="-32767" width="65534" height="65534" fill="url(#gr0)"/>
|
||||
</g>
|
||||
</g>
|
||||
<g clip-path="url(#clip-g14)">
|
||||
<rect x="-32767" y="-32767" width="65534" height="65534" fill="#FA0"/>
|
||||
</g>
|
||||
<g clip-path="url(#clip-g15)">
|
||||
<rect x="-32767" y="-32767" width="65534" height="65534" fill="#EDA600"/>
|
||||
</g>
|
||||
<g clip-path="url(#clip-g16)">
|
||||
<rect x="-32767" y="-32767" width="65534" height="65534" fill="#1E88E5"/>
|
||||
</g>
|
||||
<g clip-path="url(#clip-g17)">
|
||||
<rect x="-32767" y="-32767" width="65534" height="65534" fill="#EDA600"/>
|
||||
</g>
|
||||
<g clip-path="url(#clip-g16)">
|
||||
<rect x="-32767" y="-32767" width="65534" height="65534" fill="url(#gr1)"/>
|
||||
</g>
|
||||
<g clip-path="url(#clip-g18)">
|
||||
<rect x="-32767" y="-32767" width="65534" height="65534" fill="#424242" fill-opacity="0.2"/>
|
||||
</g>
|
||||
<g clip-path="url(#clip-g19)">
|
||||
<g transform="matrix(1,0,0,0.9691162,0,0)">
|
||||
<rect x="-32767" y="-32767" width="65534" height="65534" fill="url(#gr2)"/>
|
||||
</g>
|
||||
</g>
|
||||
<g clip-path="url(#clip-g20)">
|
||||
<rect x="-32767" y="-32767" width="65534" height="65534" fill="#EDA600"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</defs>
|
||||
|
||||
<use href="#cg0" transform="translate(0,0) scale(1,-1)"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 7.7 KiB |
@@ -0,0 +1,21 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-16 -966 1307 1232" width="1307" height="1232">
|
||||
<defs>
|
||||
|
||||
<path d="M124,72.49 C124,69.49 121.57,67.03 118.48,66.88 C116,66.76 109.83,68.33 106.34,66.69 C97.73,62.64 62.24,43.96 62.24,43.96 C59.12,42.27 51.47,39.77 47.59,40.74 L19.29,52.02 C16.53,52.71 14.29,54.38 12.86,56.55 C11.82,57.73 10.68,65.93 9.12,73.38 C7.56,80.83 5.65,85.76 5.65,85.76 C4.11,91.44 8.6,95.25 12.59,95.93 C16.58,96.61 21.8,94.16 23.34,88.47 L26.62,72.73 C27.15,70.17 29.26,68.21 31.9,67.82 L41.87,68.18 L38.36,86.13 C38.36,86.13 56.12,108.86 81.23,114.25 C90.44,116.23 99.01,110.47 105.61,110.06 C108.66,109.87 115,110.54 117.79,111.35 C120.89,112.25 124.01,109.97 124.01,106.84 L124.01,72.49 Z" id="hbimg0_g_270d.0"/>
|
||||
<radialGradient id="hbimg0_g1" cx="26.716" cy="51.096" r="49.865" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1 0 0 0.977 0 0)"><stop offset="0.353" stop-color="#FFCA28"/><stop offset="0.766" stop-color="#FFB300"/></radialGradient>
|
||||
<path d="M87.7,115.75 C81.34,115.63 71.59,112.02 64.89,109.08 C59.94,106.91 54.31,106.69 49.2,108.5 L44.07,110.31 C39.2,112.03 33.74,110.41 30.7,106.34 L20.63,92.87 L104.68,92.7 C104.68,92.7 103.14,116.05 87.7,115.75 Z" id="hbimg0_g_270d.1"/>
|
||||
<path d="M40.57,72.75 L55.59,47.91 L55.49,52.06 C55.39,56.3 58.16,60.11 62.32,61.46 L40.57,72.75 Z" id="hbimg0_g_270d.2"/>
|
||||
<path d="M23.62,110.95 L6.44,123.65 C5.22,124.55 3.7,123.58 4.05,122.12 L8.78,102.38 C8.89,101.93 9.07,101.48 9.32,101.08 L66.28,6.22 C67.49,4.21 69.96,3.41 71.8,4.45 L80.57,9.4 C82.41,10.44 82.92,12.91 81.71,14.93 L24.85,109.58 C24.54,110.12 24.12,110.59 23.62,110.95 Z" id="hbimg0_g_270d.3"/>
|
||||
<path d="M49.64,43.52 C53.06,43.52 58.45,45.31 60.85,46.61 C62.3,47.37 96.49,65.37 105.07,69.4 C106.56,70.1 108.4,70.44 110.7,70.44 C112.46,70.44 114.18,70.25 115.7,70.08 C116.69,69.97 117.63,69.87 118.2,69.87 L118.34,69.87 C119.83,69.94 121,71.09 121,72.48 L121,106.83 C121,107.86 120.05,108.54 119.17,108.54 C118.99,108.54 118.8,108.51 118.62,108.46 C115.7,107.61 110.04,107.02 106.79,107.02 C106.29,107.02 105.83,107.03 105.42,107.06 C102.58,107.24 99.65,108.19 96.55,109.21 L95.94,109.41 C95.53,109.54 95.15,109.77 94.83,110.06 C92.89,111.86 90.65,112.74 88,112.74 L87.76,112.74 C83.15,112.65 75.05,110.25 66.09,106.32 C62.99,104.96 59.7,104.27 56.3,104.27 C53.53,104.27 50.8,104.74 48.2,105.66 L43.07,107.47 C42.11,107.81 41.11,107.98 40.1,107.98 C37.33,107.98 34.72,106.69 33.1,104.54 L31.74,102.73 C31.17,101.97 30.28,101.53 29.34,101.53 C29.24,101.53 29.15,101.53 29.05,101.54 C28.75,101.57 28.45,101.58 28.17,101.58 C25.27,101.58 24.21,100.11 23.67,99 C22.9,97.45 22.81,95.85 23.38,94.27 C23.61,93.64 23.61,92.97 23.42,92.36 C24.07,92.28 24.69,91.98 25.18,91.49 C25.88,90.78 26.69,90.17 27.6,89.68 C27.64,89.66 27.67,89.64 27.7,89.62 L41.3,81.53 C42.03,81.09 42.55,80.37 42.71,79.53 L44.82,68.76 C45,67.83 44.74,66.87 44.1,66.17 C43.53,65.54 42.72,65.18 41.88,65.18 C41.79,65.18 41.69,65.18 41.6,65.19 L33.04,66 C32.99,66.01 32.93,66.01 32.88,66.02 C29.07,66.58 25.98,69.42 25.13,73.11 L20.48,87.55 C20.47,87.59 20.45,87.64 20.44,87.68 C20.39,87.88 20.32,88.09 20.22,88.36 C19.99,89 19.98,89.67 20.17,90.28 C19.54,90.36 18.94,90.64 18.46,91.1 C17.22,92.31 15.51,93.03 13.9,93.03 C13.62,93.03 13.34,93.01 13.08,92.96 C11.45,92.68 9.85,91.66 9.01,90.34 C8.33,89.27 8.15,88.03 8.5,86.66 C8.86,85.7 10.59,80.92 12.04,73.99 C12.54,71.59 12.99,69.19 13.42,66.86 C14.04,63.51 14.81,59.35 15.28,58.3 C15.3,58.27 15.33,58.23 15.35,58.2 C16.43,56.57 18.09,55.4 20.01,54.92 C20.14,54.89 20.27,54.85 20.39,54.8 L48.47,43.6 C48.73,43.57 49.11,43.52 49.64,43.52 M49.64,40.52 C48.89,40.52 48.2,40.59 47.6,40.74 L19.3,52.02 C16.54,52.71 14.3,54.38 12.87,56.55 C11.83,57.73 10.69,65.93 9.13,73.38 C7.57,80.84 5.66,85.75 5.66,85.75 C4.12,91.43 8.61,95.24 12.6,95.92 C13.03,95.99 13.47,96.03 13.92,96.03 C16.19,96.03 18.66,95.11 20.57,93.25 C19.77,95.47 19.82,97.93 21,100.32 C22.5,103.36 25.18,104.57 28.19,104.57 C28.58,104.57 28.97,104.55 29.36,104.51 L30.72,106.32 C32.95,109.3 36.48,110.97 40.12,110.97 C41.45,110.97 42.79,110.75 44.09,110.29 L49.22,108.48 C51.52,107.67 53.92,107.27 56.32,107.27 C59.25,107.27 62.18,107.87 64.91,109.07 C71.61,112.01 81.37,115.62 87.72,115.74 L88.01,115.74 C91.73,115.74 94.63,114.35 96.88,112.26 C100.05,111.23 102.99,110.22 105.62,110.05 C105.97,110.03 106.37,110.02 106.81,110.02 C110.1,110.02 115.34,110.63 117.8,111.34 C118.27,111.48 118.73,111.54 119.19,111.54 C121.77,111.54 124.02,109.49 124.02,106.83 L124.02,72.49 C124.02,69.49 121.59,67.03 118.5,66.88 C118.41,66.88 118.31,66.87 118.22,66.87 C116.53,66.87 113.54,67.44 110.72,67.44 C109.12,67.44 107.59,67.26 106.37,66.69 C97.76,62.64 62.27,43.96 62.27,43.96 C59.61,42.53 53.73,40.52 49.64,40.52 Z M23.04,89.39 C23.15,89.09 23.25,88.79 23.34,88.47 L28.04,73.9 C28.57,71.34 30.68,69.38 33.32,68.99 L41.87,68.19 L39.76,78.96 L26.16,87.05 C24.98,87.7 23.93,88.49 23.04,89.39 Z" id="hbimg0_g_270d.4"/>
|
||||
<linearGradient id="hbimg0_g2" x1="67.412" y1="18.589" x2="15.176" y2="112.62" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#64B5F6"/><stop offset="1" stop-color="#2196F3"/></linearGradient>
|
||||
<path d="M70.04,7 C70.15,7 70.25,7.02 70.33,7.07 L79.1,12.02 C79.14,12.04 79.27,12.12 79.34,12.36 C79.38,12.51 79.44,12.9 79.14,13.39 L22.28,108.05 C22.16,108.24 22.01,108.42 21.83,108.55 L7.92,118.83 L11.69,103.08 C11.73,102.92 11.79,102.77 11.88,102.62 L68.86,7.77 C69.17,7.24 69.68,7 70.04,7 M70.04,4 C68.6,4 67.13,4.81 66.28,6.22 L9.31,101.07 C9.06,101.48 8.88,101.92 8.77,102.37 L4.04,122.11 C3.79,123.19 4.54,124 5.44,124 C5.77,124 6.12,123.89 6.44,123.65 L23.62,110.95 C24.12,110.58 24.54,110.12 24.86,109.58 L81.72,14.93 C82.93,12.92 82.42,10.44 80.58,9.4 L71.81,4.45 C71.26,4.15 70.65,4 70.04,4 Z" id="hbimg0_g_270d.6" fill="#424242" opacity="0.2"/>
|
||||
<path d="M78.69,64.46 C66.28,59.75 56.68,60.45 49.69,65.97 C44.85,69.8 27.32,82.28 19.63,90.47 C15.96,94.39 19.38,98.8 22.57,100.79 C28.82,104.71 35.07,104.4 48.65,96.16 C55.59,91.95 60.04,95.46 64.97,98.83 C64.97,98.83 72.68,105.22 79.47,107.61 C86.26,110 102.13,106.33 107.44,98.29 C113.31,89.4 103.81,74 78.69,64.46 Z" id="hbimg0_g_270d.7"/>
|
||||
<radialGradient id="hbimg0_g4" cx="63.581" cy="87.541" r="36.481" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1 0 0 0.969 0 0)"><stop offset="0.353" stop-color="#FFCA28"/><stop offset="0.766" stop-color="#FFB300"/></radialGradient>
|
||||
<path d="M63.72,64.34 C58.93,64.34 54.95,65.64 51.54,68.31 C50.46,69.16 48.81,70.4 46.73,71.96 C39.59,77.31 27.64,86.28 21.81,92.5 C21.03,93.33 20.99,93.94 21.05,94.37 C21.2,95.6 22.48,97.18 24.15,98.23 C26.33,99.6 28.27,100.21 30.42,100.21 C34.39,100.21 39.53,98.16 47.09,93.58 C49.71,91.99 52.22,91.22 54.76,91.22 C59.22,91.22 62.66,93.59 65.98,95.88 L66.66,96.35 C66.74,96.41 66.81,96.46 66.88,96.52 C66.95,96.58 74.27,102.6 80.46,104.78 C80.853,104.918 81.423,105.073 82.208,105.183 C84.695,106.724 87.443,107.654 90.468,107.71 L90.472,107.713 C86.199,108.54 82.146,108.539 79.48,107.6 C72.69,105.21 64.98,98.82 64.98,98.82 C64.746,98.66 64.513,98.5 64.281,98.34 C59.622,95.134 55.27,92.14 48.66,96.15 C35.08,104.39 28.83,104.7 22.58,100.78 C19.39,98.79 15.97,94.38 19.64,90.46 C27.33,82.27 44.86,69.79 49.7,65.96 C51.296,64.699 53.029,63.69 54.902,62.941 C57.559,61.88 60.495,61.34 63.72,61.34 C66.126,61.34 68.684,61.639 71.404,62.248 C72.507,62.495 73.634,62.792 74.79,63.14 C71.406,63.431 68.952,63.953 67.173,64.557 C65.979,64.413 64.827,64.34 63.72,64.34 Z" id="hbimg0_g_270d.8"/>
|
||||
<g id="cg0">
|
||||
<g id="hbimg0_glyph7" transform="matrix(9.375 0 0 9.375 37.5 -950)"><use xlink:href="#hbimg0_g_270d.0" fill="url(#hbimg0_g1)"/><use xlink:href="#hbimg0_g_270d.1" fill="#FFAA00"/><use xlink:href="#hbimg0_g_270d.2" fill="#EDA600"/><use xlink:href="#hbimg0_g_270d.3" fill="#1E88E5"/><use xlink:href="#hbimg0_g_270d.4" fill="#EDA600"/><use xlink:href="#hbimg0_g_270d.3" fill="url(#hbimg0_g2)"/><use xlink:href="#hbimg0_g_270d.6"/><use xlink:href="#hbimg0_g_270d.7" fill="url(#hbimg0_g4)"/><use xlink:href="#hbimg0_g_270d.8" fill="#EDA600"/></g>
|
||||
</g>
|
||||
</defs>
|
||||
|
||||
<use href="#cg0" transform="translate(0,0)"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 8.0 KiB |
@@ -0,0 +1,12 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-16 -966 1307 1235" width="1307" height="1235">
|
||||
<defs>
|
||||
|
||||
<g id="cg0">
|
||||
<g transform="translate(38,949) scale(9.39,-9.39)">
|
||||
<image href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAABFFBMVEVHcExHmt5OmtldntI7k91YnNQ8mehIl9phs/Zco9tBlNpequdktfZcsfZPmdc6kdxTmtNPmNFXr/VQrPVNouVLqfWZqoz1rgXyrAWQn3b3tgvzrQfwqQLupgDaqSBkmKdKltK0oEf0rAXyqgHjvjjxqQHtqQb2swv/xR//yihnorbKqjv1rgT/vhLMu1f/tgT/tAL/swD8sQH3sASNp4hGk9FFp/X/uAfzqgH3rAT/ugv8rwDzrAT5txBApPT/xyI/nOT/whnLulfzqwI+kND/ySX/vA5Okr//wBX/xBw2k904ofT9rgE0jNEnmfMsiNEmkOT/qgD/rAAmidknh9UohdH7qQD3qAAilvMmjN0liNklh9dxQCd+AAAAXHRSTlMAXdn/Qf8ixv//lP////B4////////PG/c/x+v+v//////nP//7f////////////////86/////8BT/xCE////////zv///////////////////8Xq/////12v1NVD8A4AAAh+SURBVHgB7JLXttswDARzDa1FmaIMkLf39v/fGLiSKY85y7Q5R8+zAufLf34B/7lYiayGjn7IjtW61wDIAYx9/KO7Q5jEwaaDf4BInOc57ScsW/qARWSa98RDCmT/1p3J7XXCQi8wzmf2KQzsAucWX7DlF/jtgIsuBdYKwC+wEkRkw/Ovf/YAS88Co1ALGOQnB1iRCwzhuwOsef4NIDE4vQpUYAoH+hQISDjRo0AAMVTmwC4QmFJo4BeImFKdkDoUmFKzgF8g3F4nRIBaoB4eoE4QgFqgKlJLBMAsUFVjagHALNBUp5waJoBaoKpm55sHGJgFqsW8pz7ASC4wHzkdwJgFmmnJuU7I7ALNLnPLpEot0ExzS1RVZoH7A5RcgSq1QDOU3HCpSi7Qrkop5xsUVSUWeO3+y53evwNgFnhze2dmLq8TLs1YBd4/PD49Hw5QJxQ1G0k//+S8vL6qe+uESzNbc35+x9vr6+tVqeQr9789vjN+3vn4dP9laYHZy1dezEO9USsKwum9Z/suAi/qghXCQvISoxJjXJFS3/9VcobDdy7WscOHIme21/nvzHBlmf6k8/zxD9/t9QfDuwFwASMLAsJjHt7zB4PBOwRwB4D87XHgCcIjHh4i/x+eku4E0BoHk9C1oBfHj3d4aBpF0Yz8BQELnM4JYKIQDn14qO1E0RO4C8IPjvPjnAEOjPC2Yw4vGkaR89SICqBKRgIgCCev/qv9e3V46F1kAmDR+e2YAQ6K8FYfHnI4ACME0I7nYwAohF/29z/F4ZPq4WWBi9nM+M+cyJnGAiDyuL29L8fjrmW5y8Gu2uS/mj2dGQRaoDNHAwygEPa9n19o/3KBEbkbhCfUyFECgAAAh0OgAa61/69YIHnDngloErblzmWD9yOcNm+ABjDQIn8H7hLCin6nRWGNdQOsUO7nxo9Ab8DSCzQIC/qNlxYUooEDIpxZVqIXmGKBVf0YOZEFuZ4XeiEJHIdA6Nw3gWGaIgCjJxTAEZm7VlVeGCgEtymCZVnnaoFpmq4WVQLyt3fcEUZPLaIxwnva4Pn5DkKUps6CJP60wKlbuvZ6vQTf4owUx3guGyHoDXrLHYIpBQB/QVhEFyPOPPEvIcgnCUIQ7ItwQhtcEgHJ3IEogMUIjt21SD12X0PMwAiGQCNU74XjBzbo95eMwBDrlxyAQVi95BcrNjdiBCHQCMzQOTnpdDoPfexAR7u86gOhZFi3eIFGT4r4E7a/MmIGISB/jaB0qu9Bi/6vPiGw1l07Ta+r5x8ifjeGPWz7EIRf7BKAoQbhWL0Uu/IfA8I9ogBuFkZTq4v4+fTCCYGhDMEQ6Ish9DwvJOHnaEFtsLcukwVD0rooChCEIv4eH78vY4EEgQiQgR6i1i39Z2qDVC4jQN5LBCD2X3L8Pvuz/YDFDIaAI6iTAqDX4uzSrJsXeAMhhalF8jLxZ3eRIeAScCs2BMAGfd883gkWCHd8K+Mn/8uqvybgGVQjkDLqAN4WB2QEiArIcXwgPCniTzIfAWh/lhCgBAGQMdYCvABARh7M0L5IcwQADYv446wMwPhrAi5hdwVBLQBPgF9UfCiz8zwtA3jJ/jECQAHKX1qQCGKJQBNoAJlATMpYozzNeYFPWvhQPZhzAFyAeCoCRKA60AQaABNw5/MYAkCalwXw5ReMGQAL0AGIOALdgSbQAJjAnBQXepnnvEC+/Mh/XmnAOOoVqA5ENQD0y3BMPlDWyssAivpvJwggRgM6AN3BfgDP0XMwJoHALgMYof5wUgsgMiNoCnBGRdOdwQwj8qcFror6J5NdgMF+AEHwIAA/hHiNYoZigZuh+AvAmgEOnwAasIQUC9yUt8/kfwI4wVlL8QKnPD9IV3B4gBc4bCkbAcAfpUANRljzFAQPApyZ044QAPy7E1H1HlguD/sYqgryfFv6GzW8iPgmbJTAewkcCxR/Uf1VbAJoDgB1mCBoUQC28pcRcAd+4nlekix1ANxA/QY1wLFFcsOJvd3mI/HXHdD5euYdsX+uAigbaAqAEqAW+f+GMBRA2YEPe6OuX/XnBXAADQGQAVpAABu3BNAdZGzvJfQbScI/Xxp/XoAE0BAAn6A+2m63m02LLwXdQa9bWN7+zvoj8RBCYvx3AmgwQtZn5P/bBpfQfRGErrEXhOK3zsle/E0AzQH+RACk7j0EbO+GYs4KixDWsJe3BU3fmIg+KQIgfQwCT3/mz6XTKxUhJEu21/5NAP7CAgsNu3xcPruHw5Nu/4ChUpGNdyn+D74vCmoAvkIBpVYt9nRd12J1tb0socinp96eN03g77IACYGlw9cKLZKb/at/UAfwPQdgZI+Ywf2nPTNmUhcGovgWjsW/scQ/UuHkqlSxuDDa2d1wExQWUL//97hFMKsJM3JekcZfG5339u2LFpH+8C75NQTJ+i8kUHIAPd/G/KcV1E+0OQRCfo7r5+q5gQrxwcAXVXIn6FO+g7ppGjpomrp2m0CXx9dXx8OEBBCxbVm/NcYsIE5cBzVJ39PwaT4UVipHno6eGzghmpa4W0B1+49iDVZ3PXAV+AITqm/vhA6cEYu2tRYKCmAGRGY1ePZkqfUuilItPAvHWwxrqZQtb67kej3cayn7QijHQGUNtMMCyvt3PEakGTDZ3l/F8crI0pgP2WUl3ApYCkPAwFbzF5PVBlxSm8NhBF+d2TxWgA0YRGNOYNmmQpC48NWdGHwPN+P7XQREFkUrLfpMk8ypgLHjI2I1g0mwRbeSPL5vPI60TmMYr0CBRAm/ZrPisnS/EHXTyy9jmABXwCCxgJdgD0wKk5ghoh2/msPLxOmSTUx6yeYKcPx/JO6KJsReZzCZC2IxxH+CECAZsPEHYN4ZQOIMYfiHRIj4uQIcfxCQ4w8Dxx+IEi/B4n/z5gdDGmi2aLLPLAAAAABJRU5ErkJggg==" width="128" height="128"/>
|
||||
</g>
|
||||
</g>
|
||||
</defs>
|
||||
|
||||
<use href="#cg0" transform="translate(0,0) scale(1,-1)"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.8 KiB |
@@ -0,0 +1,11 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-16 -966 1307 1232" width="1307" height="1232">
|
||||
<defs>
|
||||
|
||||
<path id="hbimg0_b" d="m74.79 63.14c-2.06-0.62-4.03-1.08-5.93-1.38-7.78-1.23-14.15 0.24-19.16 4.2-4.84 3.83-22.37 16.31-30.06 24.5-3.67 3.92-0.25 8.33 2.94 10.32 6.25 3.92 12.5 3.61 26.08-4.63 6.94-4.21 11.39-0.7 16.32 2.67 0 0 7.71 6.39 14.5 8.78 2.67 0.94 6.73 0.94 11.01 0.11-20.12-0.34-28.01-39.39-28.01-39.39s-0.01-4.12 12.31-5.18z"/>
|
||||
<g id="cg0">
|
||||
<g id="hbimg0_glyph7" transform="matrix(9.375 0 0 9.375 37.5 -950)"><radialGradient id="hbimg0_e" cx="34.77" cy="46.297" r="48.535" gradientTransform="matrix(1.0274 0 0 1.0036 -9.0068 3.4483)" gradientUnits="userSpaceOnUse"><stop stop-color="#FFCA28" offset=".3533"/><stop stop-color="#FFB300" offset=".7665"/></radialGradient><path d="m124 72.49c0-3-2.43-5.46-5.52-5.61-2.48-0.12-8.65 1.45-12.14-0.19-8.61-4.05-44.1-22.73-44.1-22.73-3.12-1.69-10.77-4.19-14.65-3.22l-28.3 11.28c-2.76 0.69-5 2.36-6.43 4.53-1.04 1.18-2.18 9.38-3.74 16.83s-3.47 12.38-3.47 12.38c-1.54 5.68 2.95 9.49 6.94 10.17s9.21-1.77 10.75-7.46l3.28-15.74c0.53-2.56 2.64-4.52 5.28-4.91l9.97 0.36-3.51 17.95s17.76 22.73 42.87 28.12c9.21 1.98 17.78-3.78 24.38-4.19 3.05-0.19 9.39 0.48 12.18 1.29 3.1 0.9 6.22-1.38 6.22-4.51v-34.35z" fill="url(#hbimg0_e)"/><path d="m87.7 115.75c-6.36-0.12-16.11-3.73-22.81-6.67-4.95-2.17-10.58-2.39-15.69-0.58l-5.13 1.81c-4.87 1.72-10.33 0.1-13.37-3.97l-10.07-13.47 84.05-0.17s-1.54 23.35-16.98 23.05z" fill="#fa0"/><path d="m40.57 72.75 15.02-24.84-0.1 4.15c-0.1 4.24 2.67 8.05 6.83 9.4l-21.75 11.29z" fill="#EDA600"/><path d="m23.62 110.95-17.18 12.7c-1.22 0.9-2.74-0.07-2.39-1.53l4.73-19.74c0.11-0.45 0.29-0.9 0.54-1.3l56.96-94.86c1.21-2.01 3.68-2.81 5.52-1.77l8.77 4.95c1.84 1.04 2.35 3.51 1.14 5.53l-56.86 94.65c-0.31 0.54-0.73 1.01-1.23 1.37z" fill="#1E88E5"/><path d="m49.64 43.52c3.42 0 8.81 1.79 11.21 3.09 1.45 0.76 35.64 18.76 44.22 22.79 1.49 0.7 3.33 1.04 5.63 1.04 1.76 0 3.48-0.19 5-0.36 0.99-0.11 1.93-0.21 2.5-0.21h0.14c1.49 0.07 2.66 1.22 2.66 2.61v34.35c0 1.03-0.95 1.71-1.83 1.71-0.18 0-0.37-0.03-0.55-0.08-2.92-0.85-8.58-1.44-11.83-1.44-0.5 0-0.96 0.01-1.37 0.04-2.84 0.18-5.77 1.13-8.87 2.15l-0.61 0.2c-0.41 0.13-0.79 0.36-1.11 0.65-1.94 1.8-4.18 2.68-6.83 2.68h-0.24c-4.61-0.09-12.71-2.49-21.67-6.42-3.1-1.36-6.39-2.05-9.79-2.05-2.77 0-5.5 0.47-8.1 1.39l-5.13 1.81c-0.96 0.34-1.96 0.51-2.97 0.51-2.77 0-5.38-1.29-7-3.44l-1.36-1.81c-0.57-0.76-1.46-1.2-2.4-1.2-0.1 0-0.19 0-0.29 0.01-0.3 0.03-0.6 0.04-0.88 0.04-2.9 0-3.96-1.47-4.5-2.58-0.77-1.55-0.86-3.15-0.29-4.73 0.23-0.63 0.23-1.3 0.04-1.91 0.65-0.08 1.27-0.38 1.76-0.87 0.7-0.71 1.51-1.32 2.42-1.81 0.04-0.02 0.07-0.04 0.1-0.06l13.6-8.09c0.73-0.44 1.25-1.16 1.41-2l2.11-10.77c0.18-0.93-0.08-1.89-0.72-2.59-0.57-0.63-1.38-0.99-2.22-0.99-0.09 0-0.19 0-0.28 0.01l-8.56 0.81c-0.05 0.01-0.11 0.01-0.16 0.02-3.81 0.56-6.9 3.4-7.75 7.09l-4.65 14.44c-0.01 0.04-0.03 0.09-0.04 0.13-0.05 0.2-0.12 0.41-0.22 0.68-0.23 0.64-0.24 1.31-0.05 1.92-0.63 0.08-1.23 0.36-1.71 0.82-1.24 1.21-2.95 1.93-4.56 1.93-0.28 0-0.56-0.02-0.82-0.07-1.63-0.28-3.23-1.3-4.07-2.62-0.68-1.07-0.86-2.31-0.51-3.68 0.36-0.96 2.09-5.74 3.54-12.67 0.5-2.4 0.95-4.8 1.38-7.13 0.62-3.35 1.39-7.51 1.86-8.56 0.02-0.03 0.05-0.07 0.07-0.1 1.08-1.63 2.74-2.8 4.66-3.28 0.13-0.03 0.26-0.07 0.38-0.12l28.08-11.2c0.26-0.03 0.64-0.08 1.17-0.08m0-3c-0.75 0-1.44 0.07-2.04 0.22l-28.3 11.28c-2.76 0.69-5 2.36-6.43 4.53-1.04 1.18-2.18 9.38-3.74 16.83-1.56 7.46-3.47 12.37-3.47 12.37-1.54 5.68 2.95 9.49 6.94 10.17 0.43 0.07 0.87 0.11 1.32 0.11 2.27 0 4.74-0.92 6.65-2.78-0.8 2.22-0.75 4.68 0.43 7.07 1.5 3.04 4.18 4.25 7.19 4.25 0.39 0 0.78-0.02 1.17-0.06l1.36 1.81c2.23 2.98 5.76 4.65 9.4 4.65 1.33 0 2.67-0.22 3.97-0.68l5.13-1.81c2.3-0.81 4.7-1.21 7.1-1.21 2.93 0 5.86 0.6 8.59 1.8 6.7 2.94 16.46 6.55 22.81 6.67h0.29c3.72 0 6.62-1.39 8.87-3.48 3.17-1.03 6.11-2.04 8.74-2.21 0.35-0.02 0.75-0.03 1.19-0.03 3.29 0 8.53 0.61 10.99 1.32 0.47 0.14 0.93 0.2 1.39 0.2 2.58 0 4.83-2.05 4.83-4.71v-34.34c0-3-2.43-5.46-5.52-5.61-0.09 0-0.19-0.01-0.28-0.01-1.69 0-4.68 0.57-7.5 0.57-1.6 0-3.13-0.18-4.35-0.75-8.61-4.05-44.1-22.73-44.1-22.73-2.66-1.43-8.54-3.44-12.63-3.44zm-26.6 48.87c0.11-0.3 0.21-0.6 0.3-0.92l4.7-14.57c0.53-2.56 2.64-4.52 5.28-4.91l8.55-0.8-2.11 10.77-13.6 8.09c-1.18 0.65-2.23 1.44-3.12 2.34z" fill="#EDA600"/><linearGradient id="hbimg0_d" x1="67.412" x2="15.176" y1="18.589" y2="112.62" gradientUnits="userSpaceOnUse"><stop stop-color="#64B5F6" offset="0"/><stop stop-color="#2196F3" offset="1"/></linearGradient><path d="m23.62 110.95-17.18 12.7c-1.22 0.9-2.74-0.07-2.39-1.53l4.73-19.74c0.11-0.45 0.29-0.9 0.54-1.3l56.96-94.86c1.21-2.01 3.68-2.81 5.52-1.77l8.77 4.95c1.84 1.04 2.35 3.51 1.14 5.53l-56.86 94.65c-0.31 0.54-0.73 1.01-1.23 1.37z" fill="url(#hbimg0_d)"/><g opacity=".2"><path d="m70.04 7c0.11 0 0.21 0.02 0.29 0.07l8.77 4.95c0.04 0.02 0.17 0.1 0.24 0.34 0.04 0.15 0.1 0.54-0.2 1.03l-56.86 94.66c-0.12 0.19-0.27 0.37-0.45 0.5l-13.91 10.28 3.77-15.75c0.04-0.16 0.1-0.31 0.19-0.46l56.98-94.85c0.31-0.53 0.82-0.77 1.18-0.77m0-3c-1.44 0-2.91 0.81-3.76 2.22l-56.97 94.85c-0.25 0.41-0.43 0.85-0.54 1.3l-4.73 19.74c-0.25 1.08 0.5 1.89 1.4 1.89 0.33 0 0.68-0.11 1-0.35l17.18-12.7c0.5-0.37 0.92-0.83 1.24-1.37l56.86-94.65c1.21-2.01 0.7-4.49-1.14-5.53l-8.77-4.95c-0.55-0.3-1.16-0.45-1.77-0.45z" fill="#424242"/></g><radialGradient id="hbimg0_c" cx="73.325" cy="81.096" r="35.227" gradientTransform="matrix(1.0356 0 0 1.0036 -12.354 3.4483)" gradientUnits="userSLine truncated
|
||||
<clipPath id="hbimg0_a"><use xlink:href="#hbimg0_b"/></clipPath><g clip-path="url(#hbimg0_a)"><path d="m63.72 64.34c2.32 0 4.84 0.32 7.52 0.95-2.64 14.23 1.87 28.66 12.39 40.02-1.56-0.07-2.57-0.32-3.17-0.53-6.19-2.18-13.51-8.2-13.58-8.26s-0.14-0.11-0.22-0.17l-0.68-0.47c-3.32-2.29-6.76-4.66-11.22-4.66-2.54 0-5.05 0.77-7.67 2.36-7.56 4.58-12.7 6.63-16.67 6.63-2.15 0-4.09-0.61-6.27-1.98-1.67-1.05-2.95-2.63-3.1-3.86-0.06-0.43-0.02-1.04 0.76-1.87 5.83-6.22 17.78-15.19 24.92-20.54 2.08-1.56 3.73-2.8 4.81-3.65 3.41-2.67 7.39-3.97 12.18-3.97m0-3c-5.5 0-10.16 1.57-14.03 4.62-4.84 3.83-22.37 16.31-30.06 24.5-3.67 3.92-0.25 8.33 2.94 10.32 2.47 1.55 4.94 2.44 7.86 2.44 4.47 0 10.01-2.08 18.22-7.06 2.27-1.38 4.27-1.93 6.12-1.93 3.79 0 6.89 2.33 10.2 4.6 0 0 7.71 6.39 14.5 8.78 1.38 0.48 3.12 0.72 5.08 0.72 1.84 0 3.86-0.21 5.93-0.61-12.97-11.05-20.03-27.57-15.69-44.58-4.01-1.21-7.69-1.8-11.07-1.8z" fill="#EDA600"/></g></g>
|
||||
</g>
|
||||
</defs>
|
||||
<use href="#cg0" transform="translate(0,0)"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 7.1 KiB |
@@ -13,3 +13,11 @@
|
||||
../../../api/fonts/AdobeVFPrototype.abc.otf;--variations=wght=900,CNTR=100;U+0061,U+0062,U+0063;../expected/basic/cff2-var-cntr.svg
|
||||
../../../api/fonts/SourceSerifVariable-Roman-VVAR.abc.ttf;--direction=ttb --variations=wght=900;U+0061,U+0062,U+0063;../expected/basic/glyf-vvar-ttb-wght900.svg
|
||||
../fonts/2db082c6c462d5056544e56e7ea13bf58c33a832.ttf;--logical;U+0646,U+0633,U+062A,U+0639,U+0644,U+06CC,U+0642;../expected/basic/iran-nastaliq-y-offsets.svg
|
||||
../../../fuzzing/fonts/noto_handwriting-untouchedsvg.ttf;;U+270D;../expected/basic/handwriting-svg.svg
|
||||
../../../fuzzing/fonts/noto_handwriting-untouchedsvgz.ttf;;U+270D;../expected/basic/handwriting-svg.svg
|
||||
../../../fuzzing/fonts/noto_handwriting-picosvg.ttf;;U+270D;../expected/basic/handwriting-picosvg.svg
|
||||
../../../fuzzing/fonts/noto_handwriting-picosvgz.ttf;;U+270D;../expected/basic/handwriting-picosvg.svg
|
||||
../../../fuzzing/fonts/noto_handwriting-sbix.ttf;;U+270D;../expected/basic/handwriting-sbix.svg
|
||||
../../../fuzzing/fonts/noto_handwriting-glyf_colr_1.ttf;;U+270D;../expected/basic/handwriting-glyf-colr-1.svg
|
||||
../../../fuzzing/fonts/noto_handwriting-cff_colr_1.otf;;U+270D;../expected/basic/handwriting-cff-colr-1.svg
|
||||
../../../fuzzing/fonts/noto_handwriting-cff2_colr_1.otf;;U+270D;../expected/basic/handwriting-cff-colr-1.svg
|
||||
+2
-4
@@ -29,8 +29,6 @@
|
||||
|
||||
#include "hb.hh"
|
||||
|
||||
#include <cairo.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
@@ -375,8 +373,8 @@ ansi_print_image_rgb24 (const uint32_t *data,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
unsigned int stride,
|
||||
cairo_write_func_t write_func,
|
||||
void *closure)
|
||||
helper_image_write_func_t write_func,
|
||||
void *closure)
|
||||
{
|
||||
image_t image (width, height, data, stride);
|
||||
|
||||
|
||||
+1
-174
@@ -27,182 +27,9 @@
|
||||
#ifndef HELPER_CAIRO_ANSI_HH
|
||||
#define HELPER_CAIRO_ANSI_HH
|
||||
|
||||
#include "hb.hh"
|
||||
|
||||
#include "helper-image-output.hh"
|
||||
#include <cairo.h>
|
||||
|
||||
#include "ansi-print.hh"
|
||||
|
||||
#ifdef HAVE_CHAFA
|
||||
# include <chafa.h>
|
||||
|
||||
/* Similar to ansi-print.cc */
|
||||
# define CELL_W 8
|
||||
# define CELL_H (2 * CELL_W)
|
||||
|
||||
static void
|
||||
chafa_print_image_rgb24 (const void *data, int width, int height, int stride, int level,
|
||||
cairo_write_func_t write_func,
|
||||
void *closure)
|
||||
{
|
||||
ChafaTermInfo *term_info;
|
||||
ChafaSymbolMap *symbol_map;
|
||||
ChafaCanvasConfig *config;
|
||||
ChafaCanvas *canvas;
|
||||
GString *gs;
|
||||
unsigned int cols = (width + CELL_W - 1) / CELL_W;
|
||||
unsigned int rows = (height + CELL_H - 1) / CELL_H;
|
||||
gchar **environ;
|
||||
ChafaCanvasMode mode;
|
||||
ChafaPixelMode pixel_mode;
|
||||
|
||||
/* Adapt to terminal; use sixels if available, and fall back to symbols
|
||||
* with as many colors as are supported */
|
||||
|
||||
chafa_set_n_threads (1); // https://github.com/hpjansson/chafa/issues/125#issuecomment-1397475217
|
||||
|
||||
environ = g_get_environ ();
|
||||
term_info = chafa_term_db_detect (chafa_term_db_get_default (),
|
||||
environ);
|
||||
|
||||
pixel_mode = CHAFA_PIXEL_MODE_SYMBOLS;
|
||||
|
||||
if (chafa_term_info_have_seq (term_info, CHAFA_TERM_SEQ_BEGIN_SIXELS))
|
||||
{
|
||||
pixel_mode = CHAFA_PIXEL_MODE_SIXELS;
|
||||
mode = CHAFA_CANVAS_MODE_TRUECOLOR;
|
||||
}
|
||||
else if (chafa_term_info_have_seq (term_info, CHAFA_TERM_SEQ_SET_COLOR_FGBG_DIRECT))
|
||||
mode = CHAFA_CANVAS_MODE_TRUECOLOR;
|
||||
else if (chafa_term_info_have_seq (term_info, CHAFA_TERM_SEQ_SET_COLOR_FGBG_256))
|
||||
mode = CHAFA_CANVAS_MODE_INDEXED_240;
|
||||
else if (chafa_term_info_have_seq (term_info, CHAFA_TERM_SEQ_SET_COLOR_FGBG_16))
|
||||
mode = CHAFA_CANVAS_MODE_INDEXED_16;
|
||||
else if (chafa_term_info_have_seq (term_info, CHAFA_TERM_SEQ_INVERT_COLORS))
|
||||
mode = CHAFA_CANVAS_MODE_FGBG_BGFG;
|
||||
else
|
||||
mode = CHAFA_CANVAS_MODE_FGBG;
|
||||
|
||||
/* Create the configuration */
|
||||
|
||||
symbol_map = chafa_symbol_map_new ();
|
||||
chafa_symbol_map_add_by_tags (symbol_map,
|
||||
(ChafaSymbolTags) (CHAFA_SYMBOL_TAG_BLOCK
|
||||
| CHAFA_SYMBOL_TAG_SPACE
|
||||
| (level >= 2 ? CHAFA_SYMBOL_TAG_WEDGE : 0)
|
||||
| (level >= 3 ? CHAFA_SYMBOL_TAG_ALL : 0)
|
||||
));
|
||||
|
||||
config = chafa_canvas_config_new ();
|
||||
chafa_canvas_config_set_canvas_mode (config, mode);
|
||||
chafa_canvas_config_set_pixel_mode (config, pixel_mode);
|
||||
chafa_canvas_config_set_cell_geometry (config, CELL_W, CELL_H);
|
||||
chafa_canvas_config_set_geometry (config, cols, rows);
|
||||
chafa_canvas_config_set_symbol_map (config, symbol_map);
|
||||
chafa_canvas_config_set_color_extractor (config, CHAFA_COLOR_EXTRACTOR_MEDIAN);
|
||||
chafa_canvas_config_set_work_factor (config, 1.0f);
|
||||
|
||||
/* Create canvas, draw to it and render output string */
|
||||
|
||||
canvas = chafa_canvas_new (config);
|
||||
chafa_canvas_draw_all_pixels (canvas,
|
||||
/* Cairo byte order is host native */
|
||||
G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
? CHAFA_PIXEL_BGRA8_PREMULTIPLIED
|
||||
: CHAFA_PIXEL_ARGB8_PREMULTIPLIED,
|
||||
(const guint8 *) data,
|
||||
width,
|
||||
height,
|
||||
stride);
|
||||
gs = chafa_canvas_print (canvas, term_info);
|
||||
|
||||
/* Print the string */
|
||||
|
||||
write_func (closure, (const unsigned char *) gs->str, gs->len);
|
||||
|
||||
if (pixel_mode != CHAFA_PIXEL_MODE_SIXELS)
|
||||
write_func (closure, (const unsigned char *) "\n", 1);
|
||||
|
||||
/* Free resources */
|
||||
|
||||
g_string_free (gs, TRUE);
|
||||
chafa_canvas_unref (canvas);
|
||||
chafa_canvas_config_unref (config);
|
||||
chafa_symbol_map_unref (symbol_map);
|
||||
chafa_term_info_unref (term_info);
|
||||
g_strfreev (environ);
|
||||
}
|
||||
|
||||
#endif /* HAVE_CHAFA */
|
||||
|
||||
static inline cairo_status_t
|
||||
helper_image_write_to_ansi_stream_rgb24 (const uint32_t *data,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
unsigned int stride,
|
||||
cairo_write_func_t write_func,
|
||||
void *closure)
|
||||
{
|
||||
/* We don't have rows to spare on the terminal window...
|
||||
* Find the tight image top/bottom and only print in between. */
|
||||
|
||||
/* Use corner color as background color. */
|
||||
uint32_t bg_color = data ? * (uint32_t *) data : 0;
|
||||
|
||||
/* Drop first row while empty */
|
||||
auto orig_data = data;
|
||||
while (height)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < width; i++)
|
||||
if (data[i] != bg_color)
|
||||
break;
|
||||
if (i < width)
|
||||
break;
|
||||
data += stride / 4;
|
||||
height--;
|
||||
}
|
||||
if (orig_data < data)
|
||||
{
|
||||
data -= stride / 4;
|
||||
height++; /* Add one first blank row for padding. */
|
||||
}
|
||||
|
||||
/* Drop last row while empty */
|
||||
auto orig_height = height;
|
||||
while (height)
|
||||
{
|
||||
const uint32_t *row = data + (height - 1) * stride / 4;
|
||||
unsigned int i;
|
||||
for (i = 0; i < width; i++)
|
||||
if (row[i] != bg_color)
|
||||
break;
|
||||
if (i < width)
|
||||
break;
|
||||
height--;
|
||||
}
|
||||
if (height < orig_height)
|
||||
height++; /* Add one last blank row for padding. */
|
||||
|
||||
if (width && height)
|
||||
{
|
||||
#ifdef HAVE_CHAFA
|
||||
const char *env = getenv ("HB_CHAFA");
|
||||
int chafa_level = 1;
|
||||
if (env)
|
||||
chafa_level = atoi (env);
|
||||
if (chafa_level)
|
||||
chafa_print_image_rgb24 (data, width, height, stride, chafa_level,
|
||||
write_func, closure);
|
||||
else
|
||||
#endif
|
||||
ansi_print_image_rgb24 (data, width, height, stride / 4,
|
||||
write_func, closure);
|
||||
}
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static inline cairo_status_t
|
||||
helper_cairo_surface_write_to_ansi_stream (cairo_surface_t *surface,
|
||||
cairo_write_func_t write_func,
|
||||
|
||||
+177
-3
@@ -29,7 +29,23 @@
|
||||
|
||||
#include "hb.hh"
|
||||
|
||||
#ifdef HAVE_CAIRO
|
||||
#include <cairo.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CAIRO
|
||||
using helper_image_status_t = cairo_status_t;
|
||||
using helper_image_write_func_t = cairo_write_func_t;
|
||||
#define HELPER_IMAGE_STATUS_SUCCESS CAIRO_STATUS_SUCCESS
|
||||
#else
|
||||
using helper_image_status_t = int;
|
||||
using helper_image_write_func_t = helper_image_status_t (*) (void *closure,
|
||||
const unsigned char *data,
|
||||
unsigned int size);
|
||||
#define HELPER_IMAGE_STATUS_SUCCESS 0
|
||||
#endif
|
||||
|
||||
#include "ansi-print.hh"
|
||||
|
||||
enum class helper_image_protocol_t {
|
||||
NONE = 0,
|
||||
@@ -37,7 +53,7 @@ enum class helper_image_protocol_t {
|
||||
KITTY,
|
||||
};
|
||||
|
||||
static inline cairo_status_t
|
||||
static inline helper_image_status_t
|
||||
helper_image_stdio_write_func (void *closure,
|
||||
const unsigned char *data,
|
||||
unsigned int size)
|
||||
@@ -53,7 +69,7 @@ helper_image_stdio_write_func (void *closure,
|
||||
fail (false, "Failed to write output: %s", strerror (errno));
|
||||
}
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
return HELPER_IMAGE_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static inline const char *
|
||||
@@ -98,7 +114,7 @@ helper_image_get_implicit_output_format (FILE *fp,
|
||||
static inline void
|
||||
helper_image_write_png_data (const unsigned char *data,
|
||||
unsigned int length,
|
||||
cairo_write_func_t write_func,
|
||||
helper_image_write_func_t write_func,
|
||||
void *closure,
|
||||
helper_image_protocol_t protocol)
|
||||
{
|
||||
@@ -154,4 +170,162 @@ helper_image_write_png_data (const unsigned char *data,
|
||||
g_string_free (string, TRUE);
|
||||
}
|
||||
|
||||
#ifdef HAVE_CHAFA
|
||||
# include <chafa.h>
|
||||
|
||||
/* Similar to ansi-print.cc */
|
||||
# define CELL_W 8
|
||||
# define CELL_H (2 * CELL_W)
|
||||
|
||||
static void
|
||||
chafa_print_image_rgb24 (const void *data, int width, int height, int stride, int level,
|
||||
helper_image_write_func_t write_func,
|
||||
void *closure)
|
||||
{
|
||||
ChafaTermInfo *term_info;
|
||||
ChafaSymbolMap *symbol_map;
|
||||
ChafaCanvasConfig *config;
|
||||
ChafaCanvas *canvas;
|
||||
GString *gs;
|
||||
unsigned int cols = (width + CELL_W - 1) / CELL_W;
|
||||
unsigned int rows = (height + CELL_H - 1) / CELL_H;
|
||||
gchar **environ;
|
||||
ChafaCanvasMode mode;
|
||||
ChafaPixelMode pixel_mode;
|
||||
|
||||
/* Adapt to terminal; use sixels if available, and fall back to symbols
|
||||
* with as many colors as are supported */
|
||||
|
||||
chafa_set_n_threads (1); // https://github.com/hpjansson/chafa/issues/125#issuecomment-1397475217
|
||||
|
||||
environ = g_get_environ ();
|
||||
term_info = chafa_term_db_detect (chafa_term_db_get_default (),
|
||||
environ);
|
||||
|
||||
pixel_mode = CHAFA_PIXEL_MODE_SYMBOLS;
|
||||
|
||||
if (chafa_term_info_have_seq (term_info, CHAFA_TERM_SEQ_BEGIN_SIXELS))
|
||||
{
|
||||
pixel_mode = CHAFA_PIXEL_MODE_SIXELS;
|
||||
mode = CHAFA_CANVAS_MODE_TRUECOLOR;
|
||||
}
|
||||
else if (chafa_term_info_have_seq (term_info, CHAFA_TERM_SEQ_SET_COLOR_FGBG_DIRECT))
|
||||
mode = CHAFA_CANVAS_MODE_TRUECOLOR;
|
||||
else if (chafa_term_info_have_seq (term_info, CHAFA_TERM_SEQ_SET_COLOR_FGBG_256))
|
||||
mode = CHAFA_CANVAS_MODE_INDEXED_240;
|
||||
else if (chafa_term_info_have_seq (term_info, CHAFA_TERM_SEQ_SET_COLOR_FGBG_16))
|
||||
mode = CHAFA_CANVAS_MODE_INDEXED_16;
|
||||
else if (chafa_term_info_have_seq (term_info, CHAFA_TERM_SEQ_INVERT_COLORS))
|
||||
mode = CHAFA_CANVAS_MODE_FGBG_BGFG;
|
||||
else
|
||||
mode = CHAFA_CANVAS_MODE_FGBG;
|
||||
|
||||
symbol_map = chafa_symbol_map_new ();
|
||||
chafa_symbol_map_add_by_tags (symbol_map,
|
||||
(ChafaSymbolTags) (CHAFA_SYMBOL_TAG_BLOCK
|
||||
| CHAFA_SYMBOL_TAG_SPACE
|
||||
| (level >= 2 ? CHAFA_SYMBOL_TAG_WEDGE : 0)
|
||||
| (level >= 3 ? CHAFA_SYMBOL_TAG_ALL : 0)
|
||||
));
|
||||
|
||||
config = chafa_canvas_config_new ();
|
||||
chafa_canvas_config_set_canvas_mode (config, mode);
|
||||
chafa_canvas_config_set_pixel_mode (config, pixel_mode);
|
||||
chafa_canvas_config_set_cell_geometry (config, CELL_W, CELL_H);
|
||||
chafa_canvas_config_set_geometry (config, cols, rows);
|
||||
chafa_canvas_config_set_symbol_map (config, symbol_map);
|
||||
chafa_canvas_config_set_color_extractor (config, CHAFA_COLOR_EXTRACTOR_MEDIAN);
|
||||
chafa_canvas_config_set_work_factor (config, 1.0f);
|
||||
|
||||
canvas = chafa_canvas_new (config);
|
||||
chafa_canvas_draw_all_pixels (canvas,
|
||||
G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
? CHAFA_PIXEL_BGRA8_PREMULTIPLIED
|
||||
: CHAFA_PIXEL_ARGB8_PREMULTIPLIED,
|
||||
(const guint8 *) data,
|
||||
width,
|
||||
height,
|
||||
stride);
|
||||
gs = chafa_canvas_print (canvas, term_info);
|
||||
|
||||
write_func (closure, (const unsigned char *) gs->str, gs->len);
|
||||
|
||||
if (pixel_mode != CHAFA_PIXEL_MODE_SIXELS)
|
||||
write_func (closure, (const unsigned char *) "\n", 1);
|
||||
|
||||
g_string_free (gs, TRUE);
|
||||
chafa_canvas_unref (canvas);
|
||||
chafa_canvas_config_unref (config);
|
||||
chafa_symbol_map_unref (symbol_map);
|
||||
chafa_term_info_unref (term_info);
|
||||
g_strfreev (environ);
|
||||
}
|
||||
|
||||
#endif /* HAVE_CHAFA */
|
||||
|
||||
static inline helper_image_status_t
|
||||
helper_image_write_to_ansi_stream_rgb24 (const uint32_t *data,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
unsigned int stride,
|
||||
helper_image_write_func_t write_func,
|
||||
void *closure)
|
||||
{
|
||||
/* We don't have rows to spare on the terminal window...
|
||||
* Find the tight image top/bottom and only print in between. */
|
||||
|
||||
uint32_t bg_color = data ? * (uint32_t *) data : 0;
|
||||
|
||||
auto orig_data = data;
|
||||
while (height)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < width; i++)
|
||||
if (data[i] != bg_color)
|
||||
break;
|
||||
if (i < width)
|
||||
break;
|
||||
data += stride / 4;
|
||||
height--;
|
||||
}
|
||||
if (orig_data < data)
|
||||
{
|
||||
data -= stride / 4;
|
||||
height++;
|
||||
}
|
||||
|
||||
auto orig_height = height;
|
||||
while (height)
|
||||
{
|
||||
const uint32_t *row = data + (height - 1) * stride / 4;
|
||||
unsigned int i;
|
||||
for (i = 0; i < width; i++)
|
||||
if (row[i] != bg_color)
|
||||
break;
|
||||
if (i < width)
|
||||
break;
|
||||
height--;
|
||||
}
|
||||
if (height < orig_height)
|
||||
height++;
|
||||
|
||||
if (width && height)
|
||||
{
|
||||
#ifdef HAVE_CHAFA
|
||||
const char *env = getenv ("HB_CHAFA");
|
||||
int chafa_level = 1;
|
||||
if (env)
|
||||
chafa_level = atoi (env);
|
||||
if (chafa_level)
|
||||
chafa_print_image_rgb24 (data, width, height, stride, chafa_level,
|
||||
write_func, closure);
|
||||
else
|
||||
#endif
|
||||
ansi_print_image_rgb24 (data, width, height, stride / 4,
|
||||
write_func, closure);
|
||||
}
|
||||
|
||||
return HELPER_IMAGE_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -30,7 +30,6 @@
|
||||
#include "options.hh"
|
||||
#include "output-options.hh"
|
||||
#include "view-options.hh"
|
||||
#include "helper-cairo-ansi.hh"
|
||||
#include "helper-image-output.hh"
|
||||
#include "hb-raster.h"
|
||||
#include "hb-ot.h"
|
||||
|
||||
Reference in new issue
Block a user