summaryrefslogtreecommitdiff
path: root/thirdparty/harfbuzz/src/hb-subset-accelerator.hh
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2022-12-17 00:19:09 +0200
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2022-12-17 00:19:09 +0200
commitd4fbe1ef061d0e058a2700cfd4f602e55e126f65 (patch)
tree69fdc1397d2e26992e1c117fa9cf371a325159a2 /thirdparty/harfbuzz/src/hb-subset-accelerator.hh
parent2e657e51f8818401f0a54a0df3d3e74446044b93 (diff)
HarfBuzz: Update to version 6.0.0
Diffstat (limited to 'thirdparty/harfbuzz/src/hb-subset-accelerator.hh')
-rw-r--r--thirdparty/harfbuzz/src/hb-subset-accelerator.hh61
1 files changed, 53 insertions, 8 deletions
diff --git a/thirdparty/harfbuzz/src/hb-subset-accelerator.hh b/thirdparty/harfbuzz/src/hb-subset-accelerator.hh
index 34bd0534fb..63ae6d77e2 100644
--- a/thirdparty/harfbuzz/src/hb-subset-accelerator.hh
+++ b/thirdparty/harfbuzz/src/hb-subset-accelerator.hh
@@ -31,21 +31,34 @@
#include "hb.hh"
#include "hb-map.hh"
+#include "hb-multimap.hh"
#include "hb-set.hh"
+extern HB_INTERNAL hb_user_data_key_t _hb_subset_accelerator_user_data_key;
+
+namespace CFF {
+struct cff_subset_accelerator_t;
+}
+
+namespace OT {
+struct SubtableUnicodesCache;
+};
+
struct hb_subset_accelerator_t
{
static hb_user_data_key_t* user_data_key()
{
- static hb_user_data_key_t key;
- return &key;
+ return &_hb_subset_accelerator_user_data_key;
}
static hb_subset_accelerator_t* create(const hb_map_t& unicode_to_gid_,
- const hb_set_t& unicodes_) {
+ const hb_multimap_t gid_to_unicodes_,
+ const hb_set_t& unicodes_,
+ bool has_seac_) {
hb_subset_accelerator_t* accel =
(hb_subset_accelerator_t*) hb_malloc (sizeof(hb_subset_accelerator_t));
- new (accel) hb_subset_accelerator_t (unicode_to_gid_, unicodes_);
+ new (accel) hb_subset_accelerator_t (unicode_to_gid_, gid_to_unicodes_, unicodes_);
+ accel->has_seac = has_seac_;
return accel;
}
@@ -53,22 +66,54 @@ struct hb_subset_accelerator_t
if (!value) return;
hb_subset_accelerator_t* accel = (hb_subset_accelerator_t*) value;
+
+ if (accel->cff_accelerator && accel->destroy_cff_accelerator)
+ accel->destroy_cff_accelerator ((void*) accel->cff_accelerator);
+
+ if (accel->cmap_cache && accel->destroy_cmap_cache)
+ accel->destroy_cmap_cache ((void*) accel->cmap_cache);
+
accel->~hb_subset_accelerator_t ();
hb_free (accel);
}
- hb_subset_accelerator_t(const hb_map_t& unicode_to_gid_,
+ hb_subset_accelerator_t (const hb_map_t& unicode_to_gid_,
+ const hb_multimap_t& gid_to_unicodes_,
const hb_set_t& unicodes_)
- : unicode_to_gid(unicode_to_gid_), unicodes(unicodes_) {}
+ : unicode_to_gid(unicode_to_gid_), gid_to_unicodes (gid_to_unicodes_), unicodes(unicodes_),
+ cmap_cache(nullptr), destroy_cmap_cache(nullptr),
+ has_seac(false), cff_accelerator(nullptr), destroy_cff_accelerator(nullptr)
+ { sanitized_table_cache_lock.init (); }
+
+ ~hb_subset_accelerator_t ()
+ { sanitized_table_cache_lock.fini (); }
+
+ // Generic
+
+ mutable hb_mutex_t sanitized_table_cache_lock;
+ mutable hb_hashmap_t<hb_tag_t, hb::unique_ptr<hb_blob_t>> sanitized_table_cache;
const hb_map_t unicode_to_gid;
+ const hb_multimap_t gid_to_unicodes;
const hb_set_t unicodes;
+
+ // cmap
+ const OT::SubtableUnicodesCache* cmap_cache;
+ hb_destroy_func_t destroy_cmap_cache;
+
+ // CFF
+ bool has_seac;
+ const CFF::cff_subset_accelerator_t* cff_accelerator;
+ hb_destroy_func_t destroy_cff_accelerator;
+
// TODO(garretrieger): cumulative glyf checksum map
- // TODO(garretrieger): sanitized table cache.
bool in_error () const
{
- return unicode_to_gid.in_error() || unicodes.in_error ();
+ return unicode_to_gid.in_error () ||
+ gid_to_unicodes.in_error () ||
+ unicodes.in_error () ||
+ sanitized_table_cache.in_error ();
}
};