提交 db5d430e 编写于 作者: B Behdad Esfahbod

[aat] Update for blob changes

Also, uncomment code again, just "if (0)" it out, so it doesn't get stale again.
上级 68310a65
...@@ -41,43 +41,9 @@ ...@@ -41,43 +41,9 @@
#include "hb-aat-ltag-table.hh" // Just so we compile it; unused otherwise. #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& static inline const AAT::morx&
_get_morx (hb_face_t *face, hb_blob_t **blob = nullptr) _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) ...@@ -88,30 +54,12 @@ _get_morx (hb_face_t *face, hb_blob_t **blob = nullptr)
return Null(AAT::morx); return Null(AAT::morx);
} }
hb_ot_layout_t * layout = hb_ot_layout_from_face (face); 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 ()); const AAT::morx& morx = *(layout->morx.get ());
if (blob) if (blob)
*blob = layout->morx.blob; *blob = layout->morx.get_blob ();
return morx; 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 // static inline void
// _hb_aat_layout_create (hb_face_t *face) // _hb_aat_layout_create (hb_face_t *face)
// { // {
...@@ -129,13 +77,11 @@ _get_trak (hb_face_t *face, hb_blob_t **blob = nullptr) ...@@ -129,13 +77,11 @@ _get_trak (hb_face_t *face, hb_blob_t **blob = nullptr)
void void
hb_aat_layout_substitute (hb_font_t *font, hb_buffer_t *buffer) hb_aat_layout_substitute (hb_font_t *font, hb_buffer_t *buffer)
{ {
#if 0
hb_blob_t *blob; hb_blob_t *blob;
const AAT::morx& morx = _get_morx (font->face, &blob); const AAT::morx& morx = _get_morx (font->face, &blob);
AAT::hb_aat_apply_context_t c (font, buffer, blob); AAT::hb_aat_apply_context_t c (font, buffer, blob);
morx.apply (&c); morx.apply (&c);
#endif
} }
void void
......
...@@ -290,9 +290,10 @@ struct hb_sanitize_context_t : ...@@ -290,9 +290,10 @@ struct hb_sanitize_context_t :
template <typename Type> template <typename Type>
struct Sanitizer 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; bool sane;
/* TODO is_sane() stuff */ /* TODO is_sane() stuff */
...@@ -1265,21 +1266,27 @@ struct hb_table_lazy_loader_t ...@@ -1265,21 +1266,27 @@ struct hb_table_lazy_loader_t
hb_blob_destroy (blob); hb_blob_destroy (blob);
} }
inline const T* get (void) const inline hb_blob_t* get_blob (void) const
{ {
retry: retry:
hb_blob_t *blob_ = (hb_blob_t *) hb_atomic_ptr_get (&blob); hb_blob_t *b = (hb_blob_t *) hb_atomic_ptr_get (&blob);
if (unlikely (!blob_)) if (unlikely (!b))
{ {
blob_ = OT::Sanitizer<T>().sanitize (face->reference_table (T::tableTag)); b = OT::Sanitizer<T>(face->get_num_glyphs ()).sanitize (face->reference_table (T::tableTag));
if (!hb_atomic_ptr_cmpexch (&blob, nullptr, blob_)) if (!hb_atomic_ptr_cmpexch (&blob, nullptr, b))
{ {
hb_blob_destroy (blob_); hb_blob_destroy (b);
goto retry; 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 inline const T* operator-> (void) const
......
...@@ -176,6 +176,7 @@ struct hb_ot_layout_t ...@@ -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::MATH> math;
OT::hb_table_lazy_loader_t<struct OT::fvar> fvar; 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 OT::avar> avar;
OT::hb_table_lazy_loader_t<struct AAT::morx> morx;
unsigned int gsub_lookup_count; unsigned int gsub_lookup_count;
unsigned int gpos_lookup_count; unsigned int gpos_lookup_count;
......
...@@ -66,6 +66,7 @@ _hb_ot_layout_create (hb_face_t *face) ...@@ -66,6 +66,7 @@ _hb_ot_layout_create (hb_face_t *face)
layout->math.init (face); layout->math.init (face);
layout->fvar.init (face); layout->fvar.init (face);
layout->avar.init (face); layout->avar.init (face);
layout->morx.init (face);
{ {
/* /*
...@@ -215,6 +216,7 @@ _hb_ot_layout_destroy (hb_ot_layout_t *layout) ...@@ -215,6 +216,7 @@ _hb_ot_layout_destroy (hb_ot_layout_t *layout)
layout->math.fini (); layout->math.fini ();
layout->fvar.fini (); layout->fvar.fini ();
layout->avar.fini (); layout->avar.fini ();
layout->morx.fini ();
free (layout); free (layout);
} }
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#include "hb-set-private.hh" #include "hb-set-private.hh"
#include "hb-ot-layout-gsubgpos-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[] = { static hb_tag_t common_features[] = {
HB_TAG('c','c','m','p'), HB_TAG('c','c','m','p'),
...@@ -623,8 +623,8 @@ hb_ot_substitute_complex (hb_ot_shape_context_t *c) ...@@ -623,8 +623,8 @@ hb_ot_substitute_complex (hb_ot_shape_context_t *c)
c->plan->substitute (c->font, buffer); c->plan->substitute (c->font, buffer);
/* XXX Call morx instead. */ if (0) /* XXX Call morx instead. */
//hb_aat_layout_substitute (c->font, c->buffer); hb_aat_layout_substitute (c->font, c->buffer);
} }
static inline void static inline void
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册