[coretext] Add coretext_aat shaper
This is a higher-priority shaper than default shaper ("ot"), but only picks up fonts that have AAT "morx"/"mort" table. Note that for this to work the font face's get_table() implementation should know how to return the full font blob. Based on patch from Konstantin Ritt.
This commit is contained in:
parent
af1aa362ca
commit
c79865f90f
|
@ -810,3 +810,97 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* AAT shaper
|
||||||
|
*/
|
||||||
|
|
||||||
|
HB_SHAPER_DATA_ENSURE_DECLARE(coretext_aat, face)
|
||||||
|
HB_SHAPER_DATA_ENSURE_DECLARE(coretext_aat, font)
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* shaper face data
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct hb_coretext_aat_shaper_face_data_t {};
|
||||||
|
|
||||||
|
hb_coretext_aat_shaper_face_data_t *
|
||||||
|
_hb_coretext_aat_shaper_face_data_create (hb_face_t *face)
|
||||||
|
{
|
||||||
|
hb_blob_t *mort_blob = face->reference_table (HB_CORETEXT_TAG_MORT);
|
||||||
|
/* Umm, we just reference the table to check whether it exists.
|
||||||
|
* Maybe add better API for this? */
|
||||||
|
if (!hb_blob_get_length (mort_blob))
|
||||||
|
{
|
||||||
|
hb_blob_destroy (mort_blob);
|
||||||
|
mort_blob = face->reference_table (HB_CORETEXT_TAG_MORX);
|
||||||
|
if (!hb_blob_get_length (mort_blob))
|
||||||
|
{
|
||||||
|
hb_blob_destroy (mort_blob);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hb_blob_destroy (mort_blob);
|
||||||
|
|
||||||
|
return hb_coretext_shaper_face_data_ensure (face) ? (hb_coretext_aat_shaper_face_data_t *) HB_SHAPER_DATA_SUCCEEDED : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_hb_coretext_aat_shaper_face_data_destroy (hb_coretext_aat_shaper_face_data_t *data HB_UNUSED)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* shaper font data
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct hb_coretext_aat_shaper_font_data_t {};
|
||||||
|
|
||||||
|
hb_coretext_aat_shaper_font_data_t *
|
||||||
|
_hb_coretext_aat_shaper_font_data_create (hb_font_t *font)
|
||||||
|
{
|
||||||
|
return hb_coretext_shaper_font_data_ensure (font) ? (hb_coretext_aat_shaper_font_data_t *) HB_SHAPER_DATA_SUCCEEDED : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_hb_coretext_aat_shaper_font_data_destroy (hb_coretext_aat_shaper_font_data_t *data HB_UNUSED)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* shaper shape_plan data
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct hb_coretext_aat_shaper_shape_plan_data_t {};
|
||||||
|
|
||||||
|
hb_coretext_aat_shaper_shape_plan_data_t *
|
||||||
|
_hb_coretext_aat_shaper_shape_plan_data_create (hb_shape_plan_t *shape_plan HB_UNUSED,
|
||||||
|
const hb_feature_t *user_features HB_UNUSED,
|
||||||
|
unsigned int num_user_features HB_UNUSED)
|
||||||
|
{
|
||||||
|
return (hb_coretext_aat_shaper_shape_plan_data_t *) HB_SHAPER_DATA_SUCCEEDED;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_hb_coretext_aat_shaper_shape_plan_data_destroy (hb_coretext_aat_shaper_shape_plan_data_t *data HB_UNUSED)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* shaper
|
||||||
|
*/
|
||||||
|
|
||||||
|
hb_bool_t
|
||||||
|
_hb_coretext_aat_shape (hb_shape_plan_t *shape_plan,
|
||||||
|
hb_font_t *font,
|
||||||
|
hb_buffer_t *buffer,
|
||||||
|
const hb_feature_t *features,
|
||||||
|
unsigned int num_features)
|
||||||
|
{
|
||||||
|
return _hb_coretext_shape (shape_plan, font, buffer, features, num_features);
|
||||||
|
}
|
||||||
|
|
|
@ -34,6 +34,10 @@
|
||||||
HB_BEGIN_DECLS
|
HB_BEGIN_DECLS
|
||||||
|
|
||||||
|
|
||||||
|
#define HB_CORETEXT_TAG_MORT HB_TAG('m','o','r','t')
|
||||||
|
#define HB_CORETEXT_TAG_MORX HB_TAG('m','o','r','x')
|
||||||
|
|
||||||
|
|
||||||
CGFontRef
|
CGFontRef
|
||||||
hb_coretext_face_get_cg_font (hb_face_t *face);
|
hb_coretext_face_get_cg_font (hb_face_t *face);
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,10 @@
|
||||||
/* Only picks up fonts that have a "Silf" table. */
|
/* Only picks up fonts that have a "Silf" table. */
|
||||||
HB_SHAPER_IMPLEMENT (graphite2)
|
HB_SHAPER_IMPLEMENT (graphite2)
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_CORETEXT
|
||||||
|
/* Only picks up fonts that have a "mort" or "morx" table. */
|
||||||
|
HB_SHAPER_IMPLEMENT (coretext_aat)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_OT
|
#ifdef HAVE_OT
|
||||||
HB_SHAPER_IMPLEMENT (ot) /* <--- This is our main OpenType shaper. */
|
HB_SHAPER_IMPLEMENT (ot) /* <--- This is our main OpenType shaper. */
|
||||||
|
|
Loading…
Reference in New Issue