[HarfBuzz] harfbuzz: Branch 'master'
Behdad Esfahbod
behdad at kemper.freedesktop.org
Tue Jul 17 16:15:24 UTC 2018
src/hb-aat-layout.cc | 58 +-------------------------------------------
src/hb-open-type-private.hh | 27 ++++++++++++--------
src/hb-ot-layout-private.hh | 1
src/hb-ot-layout.cc | 2 +
src/hb-ot-shape.cc | 6 ++--
5 files changed, 25 insertions(+), 69 deletions(-)
New commits:
commit db5d430effce67db57ddea2545694b7275ee8b35
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Tue Jul 17 18:14:45 2018 +0200
[aat] Update for blob changes
Also, uncomment code again, just "if (0)" it out, so it doesn't get stale again.
diff --git a/src/hb-aat-layout.cc b/src/hb-aat-layout.cc
index 7784fae3..df6c38c4 100644
--- a/src/hb-aat-layout.cc
+++ b/src/hb-aat-layout.cc
@@ -41,43 +41,9 @@
#include "hb-aat-ltag-table.hh" // Just so we compile it; unused otherwise.
/*
- * morx/kerx/trak
+ * morx/kerx/trak/ankr
*/
-#if 0
-static inline const AAT::ankr&
-_get_ankr (hb_face_t *face, hb_blob_t **blob = nullptr)
-{
- if (unlikely (!hb_ot_shaper_face_data_ensure (face)))
- {
- if (blob)
- *blob = hb_blob_get_empty ();
- return Null(AAT::ankr);
- }
- hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
- const AAT::ankr& ankr = *(layout->ankr.get ());
- if (blob)
- *blob = layout->ankr.blob;
- return ankr;
-}
-
-static inline const AAT::kerx&
-_get_kerx (hb_face_t *face, hb_blob_t **blob = nullptr)
-{
- if (unlikely (!hb_ot_shaper_face_data_ensure (face)))
- {
- if (blob)
- *blob = hb_blob_get_empty ();
- return Null(AAT::kerx);
- }
- hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
- /* XXX this doesn't call set_num_glyphs on sanitizer. */
- const AAT::kerx& kerx = *(layout->kerx.get ());
- if (blob)
- *blob = layout->kerx.blob;
- return kerx;
-}
-
static inline const AAT::morx&
_get_morx (hb_face_t *face, hb_blob_t **blob = nullptr)
{
@@ -88,30 +54,12 @@ _get_morx (hb_face_t *face, hb_blob_t **blob = nullptr)
return Null(AAT::morx);
}
hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
- /* XXX this doesn't call set_num_glyphs on sanitizer. */
const AAT::morx& morx = *(layout->morx.get ());
if (blob)
- *blob = layout->morx.blob;
+ *blob = layout->morx.get_blob ();
return morx;
}
-static inline const AAT::trak&
-_get_trak (hb_face_t *face, hb_blob_t **blob = nullptr)
-{
- if (unlikely (!hb_ot_shaper_face_data_ensure (face)))
- {
- if (blob)
- *blob = hb_blob_get_empty ();
- return Null(AAT::trak);
- }
- hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
- const AAT::trak& trak = *(layout->trak.get ());
- if (blob)
- *blob = layout->trak.blob;
- return trak;
-}
-#endif
-
// static inline void
// _hb_aat_layout_create (hb_face_t *face)
// {
@@ -129,13 +77,11 @@ _get_trak (hb_face_t *face, hb_blob_t **blob = nullptr)
void
hb_aat_layout_substitute (hb_font_t *font, hb_buffer_t *buffer)
{
-#if 0
hb_blob_t *blob;
const AAT::morx& morx = _get_morx (font->face, &blob);
AAT::hb_aat_apply_context_t c (font, buffer, blob);
morx.apply (&c);
-#endif
}
void
diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index f6113c33..f681c573 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ -290,9 +290,10 @@ struct hb_sanitize_context_t :
template <typename Type>
struct Sanitizer
{
- inline Sanitizer (void) {}
+ inline Sanitizer (unsigned int num_glyphs = 0) { c->num_glyphs = num_glyphs; }
- inline hb_blob_t *sanitize (hb_blob_t *blob) {
+ inline hb_blob_t *sanitize (hb_blob_t *blob)
+ {
bool sane;
/* TODO is_sane() stuff */
@@ -1265,21 +1266,27 @@ struct hb_table_lazy_loader_t
hb_blob_destroy (blob);
}
- inline const T* get (void) const
+ inline hb_blob_t* get_blob (void) const
{
retry:
- hb_blob_t *blob_ = (hb_blob_t *) hb_atomic_ptr_get (&blob);
- if (unlikely (!blob_))
+ hb_blob_t *b = (hb_blob_t *) hb_atomic_ptr_get (&blob);
+ if (unlikely (!b))
{
- blob_ = OT::Sanitizer<T>().sanitize (face->reference_table (T::tableTag));
- if (!hb_atomic_ptr_cmpexch (&blob, nullptr, blob_))
+ b = OT::Sanitizer<T>(face->get_num_glyphs ()).sanitize (face->reference_table (T::tableTag));
+ if (!hb_atomic_ptr_cmpexch (&blob, nullptr, b))
{
- hb_blob_destroy (blob_);
+ hb_blob_destroy (b);
goto retry;
}
- blob = blob_;
+ blob = b;
}
- return blob_->as<T> ();
+ return b;
+ }
+
+ inline const T* get (void) const
+ {
+ hb_blob_t *b = get_blob ();
+ return b->as<T> ();
}
inline const T* operator-> (void) const
diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh
index b2f974b8..6fe673e9 100644
--- a/src/hb-ot-layout-private.hh
+++ b/src/hb-ot-layout-private.hh
@@ -176,6 +176,7 @@ struct hb_ot_layout_t
OT::hb_table_lazy_loader_t<struct OT::MATH> math;
OT::hb_table_lazy_loader_t<struct OT::fvar> fvar;
OT::hb_table_lazy_loader_t<struct OT::avar> avar;
+ OT::hb_table_lazy_loader_t<struct AAT::morx> morx;
unsigned int gsub_lookup_count;
unsigned int gpos_lookup_count;
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 655c36c1..3a082307 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -66,6 +66,7 @@ _hb_ot_layout_create (hb_face_t *face)
layout->math.init (face);
layout->fvar.init (face);
layout->avar.init (face);
+ layout->morx.init (face);
{
/*
@@ -215,6 +216,7 @@ _hb_ot_layout_destroy (hb_ot_layout_t *layout)
layout->math.fini ();
layout->fvar.fini ();
layout->avar.fini ();
+ layout->morx.fini ();
free (layout);
}
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 1189b207..6696ad88 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -41,7 +41,7 @@
#include "hb-set-private.hh"
#include "hb-ot-layout-gsubgpos-private.hh"
-//#include "hb-aat-layout-private.hh"
+#include "hb-aat-layout-private.hh"
static hb_tag_t common_features[] = {
HB_TAG('c','c','m','p'),
@@ -623,8 +623,8 @@ hb_ot_substitute_complex (hb_ot_shape_context_t *c)
c->plan->substitute (c->font, buffer);
- /* XXX Call morx instead. */
- //hb_aat_layout_substitute (c->font, c->buffer);
+ if (0) /* XXX Call morx instead. */
+ hb_aat_layout_substitute (c->font, c->buffer);
}
static inline void
More information about the HarfBuzz
mailing list