[aat] Update for blob changes

Also, uncomment code again, just "if (0)" it out, so it doesn't get stale again.
This commit is contained in:
Behdad Esfahbod 2018-07-17 18:14:45 +02:00
parent 68310a65cb
commit db5d430eff
5 changed files with 25 additions and 69 deletions

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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);
}

View File

@ -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