[config] Add HB_NO_OT_SHAPE / HB_NO_OT
Part of https://github.com/harfbuzz/harfbuzz/issues/1652
This commit is contained in:
parent
cee9f6e044
commit
7aad53657e
14
CONFIG.md
14
CONFIG.md
|
@ -86,6 +86,20 @@ In that case, or if you otherwise provide those functions by calling
|
|||
without loss of functionality by defining `HB_NO_OT_FONT`.
|
||||
|
||||
|
||||
## Shapers
|
||||
|
||||
Most HarfBuzz clients use it for the main shaper, called "ot". However, it
|
||||
is legitimate to want to compile HarfBuzz with only another backend, eg.
|
||||
CoreText, for example for an iOS app. For that, you want `HB_NO_OT_SHAPE`,
|
||||
or more generally `HB_NO_OT`.
|
||||
|
||||
This is very rarely what you need. Make sure you understand exactly what you
|
||||
are doing.
|
||||
|
||||
Defining `HB_NO_FALLBACK_SHAPE` however is pretty harmless. That removes the
|
||||
(unused) "fallback" shaper.
|
||||
|
||||
|
||||
## Thread-safety
|
||||
|
||||
By default HarfBuzz builds as a thread-safe library. The exception is that
|
||||
|
|
|
@ -98,6 +98,10 @@ for h in headers:
|
|||
print (" * %s" % (l.strip()))
|
||||
print (" */")
|
||||
print ()
|
||||
print ('#include "hb.hh"')
|
||||
print ()
|
||||
print ('#ifndef HB_NO_OT_SHAPE')
|
||||
print ()
|
||||
print ('#include "hb-ot-shape-complex-indic.hh"')
|
||||
print ()
|
||||
|
||||
|
@ -251,6 +255,8 @@ for i in range (2):
|
|||
print ("#undef %s_%s" %
|
||||
(what_short[i], short[i][v]))
|
||||
print ()
|
||||
print ()
|
||||
print ('#endif')
|
||||
print ("/* == End of generated table == */")
|
||||
|
||||
# Maintain at least 30% occupancy in the table */
|
||||
|
|
|
@ -419,6 +419,10 @@ for h in headers:
|
|||
print (" * %s" % (l.strip()))
|
||||
print (" */")
|
||||
print ()
|
||||
print ('#include "hb.hh"')
|
||||
print ()
|
||||
print ('#ifndef HB_NO_OT_SHAPE')
|
||||
print ()
|
||||
print ('#include "hb-ot-shape-complex-use.hh"')
|
||||
print ()
|
||||
|
||||
|
@ -533,6 +537,8 @@ for k,v in sorted(use_positions.items()):
|
|||
tag = k + suf
|
||||
print ("#undef %s" % tag)
|
||||
print ()
|
||||
print ()
|
||||
print ('#endif')
|
||||
print ("/* == End of generated table == */")
|
||||
|
||||
# Maintain at least 50% occupancy in the table */
|
||||
|
|
|
@ -157,6 +157,11 @@ print (' *')
|
|||
for line in scripts_header:
|
||||
print (' * %s' % line.strip ())
|
||||
print (' */')
|
||||
|
||||
print ()
|
||||
print ('#include "hb.hh"')
|
||||
print ()
|
||||
print ('#ifndef HB_NO_OT_SHAPE')
|
||||
print ()
|
||||
print ('#include "hb-ot-shape-complex-vowel-constraints.hh"')
|
||||
print ()
|
||||
|
@ -223,4 +228,6 @@ print (' }')
|
|||
print ('}')
|
||||
|
||||
print ()
|
||||
print ()
|
||||
print ('#endif')
|
||||
print ('/* == End of generated functions == */')
|
||||
|
|
|
@ -121,6 +121,10 @@
|
|||
#define HB_NO_OT_NAME_LANGUAGE
|
||||
#endif
|
||||
|
||||
#ifdef HB_NO_OT
|
||||
#define HB_NO_OT_SHAPE
|
||||
#endif
|
||||
|
||||
#ifdef HB_NO_OT_SHAPE_FALLBACK
|
||||
#define HB_NO_OT_SHAPE_COMPLEX_ARABIC_FALLBACK
|
||||
#define HB_NO_OT_SHAPE_COMPLEX_HEBREW_FALLBACK
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
*/
|
||||
|
||||
#include "hb.hh"
|
||||
|
||||
#ifndef HB_NO_OT_SHAPE
|
||||
|
||||
#include "hb-ot-shape-complex-arabic.hh"
|
||||
#include "hb-ot-shape.hh"
|
||||
|
||||
|
@ -710,3 +713,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_arabic =
|
|||
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
|
||||
true, /* fallback_position */
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -24,6 +24,10 @@
|
|||
* Google Author(s): Behdad Esfahbod
|
||||
*/
|
||||
|
||||
#include "hb.hh"
|
||||
|
||||
#ifndef HB_NO_OT_SHAPE
|
||||
|
||||
#include "hb-ot-shape-complex.hh"
|
||||
|
||||
|
||||
|
@ -44,3 +48,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_default =
|
|||
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
|
||||
true, /* fallback_position */
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -24,6 +24,10 @@
|
|||
* Google Author(s): Behdad Esfahbod
|
||||
*/
|
||||
|
||||
#include "hb.hh"
|
||||
|
||||
#ifndef HB_NO_OT_SHAPE
|
||||
|
||||
#include "hb-ot-shape-complex.hh"
|
||||
|
||||
|
||||
|
@ -430,3 +434,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_hangul =
|
|||
HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
|
||||
false, /* fallback_position */
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -24,6 +24,10 @@
|
|||
* Google Author(s): Behdad Esfahbod
|
||||
*/
|
||||
|
||||
#include "hb.hh"
|
||||
|
||||
#ifndef HB_NO_OT_SHAPE
|
||||
|
||||
#include "hb-ot-shape-complex.hh"
|
||||
|
||||
|
||||
|
@ -176,3 +180,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_hebrew =
|
|||
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
|
||||
true, /* fallback_position */
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -14,6 +14,10 @@
|
|||
* # Date: 2018-07-30, 19:40:00 GMT [KW]
|
||||
*/
|
||||
|
||||
#include "hb.hh"
|
||||
|
||||
#ifndef HB_NO_OT_SHAPE
|
||||
|
||||
#include "hb-ot-shape-complex-indic.hh"
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
|
@ -487,4 +491,6 @@ hb_indic_get_categories (hb_codepoint_t u)
|
|||
#undef IMC_TR
|
||||
#undef IMC_VOL
|
||||
|
||||
|
||||
#endif
|
||||
/* == End of generated table == */
|
||||
|
|
|
@ -24,6 +24,10 @@
|
|||
* Google Author(s): Behdad Esfahbod
|
||||
*/
|
||||
|
||||
#include "hb.hh"
|
||||
|
||||
#ifndef HB_NO_OT_SHAPE
|
||||
|
||||
#include "hb-ot-shape-complex-indic.hh"
|
||||
#include "hb-ot-shape-complex-vowel-constraints.hh"
|
||||
#include "hb-ot-layout.hh"
|
||||
|
@ -1648,3 +1652,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_indic =
|
|||
HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
|
||||
false, /* fallback_position */
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -24,6 +24,10 @@
|
|||
* Google Author(s): Behdad Esfahbod
|
||||
*/
|
||||
|
||||
#include "hb.hh"
|
||||
|
||||
#ifndef HB_NO_OT_SHAPE
|
||||
|
||||
#include "hb-ot-shape-complex-khmer.hh"
|
||||
#include "hb-ot-layout.hh"
|
||||
|
||||
|
@ -502,3 +506,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_khmer =
|
|||
HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
|
||||
false, /* fallback_position */
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -24,6 +24,10 @@
|
|||
* Google Author(s): Behdad Esfahbod
|
||||
*/
|
||||
|
||||
#include "hb.hh"
|
||||
|
||||
#ifndef HB_NO_OT_SHAPE
|
||||
|
||||
#include "hb-ot-shape-complex-myanmar.hh"
|
||||
|
||||
|
||||
|
@ -415,3 +419,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar_zawgyi =
|
|||
HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
|
||||
false, /* fallback_position */
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -24,6 +24,10 @@
|
|||
* Google Author(s): Behdad Esfahbod
|
||||
*/
|
||||
|
||||
#include "hb.hh"
|
||||
|
||||
#ifndef HB_NO_OT_SHAPE
|
||||
|
||||
#include "hb-ot-shape-complex.hh"
|
||||
|
||||
|
||||
|
@ -385,3 +389,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_thai =
|
|||
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
|
||||
false,/* fallback_position */
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -15,6 +15,10 @@
|
|||
* UnicodeData.txt does not have a header.
|
||||
*/
|
||||
|
||||
#include "hb.hh"
|
||||
|
||||
#ifndef HB_NO_OT_SHAPE
|
||||
|
||||
#include "hb-ot-shape-complex-use.hh"
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
|
@ -851,4 +855,6 @@ hb_use_get_category (hb_codepoint_t u)
|
|||
#undef VMPst
|
||||
#undef VMAbv
|
||||
|
||||
|
||||
#endif
|
||||
/* == End of generated table == */
|
||||
|
|
|
@ -26,6 +26,10 @@
|
|||
* Google Author(s): Behdad Esfahbod
|
||||
*/
|
||||
|
||||
#include "hb.hh"
|
||||
|
||||
#ifndef HB_NO_OT_SHAPE
|
||||
|
||||
#include "hb-ot-shape-complex-use.hh"
|
||||
#include "hb-ot-shape-complex-arabic.hh"
|
||||
#include "hb-ot-shape-complex-vowel-constraints.hh"
|
||||
|
@ -643,3 +647,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_use =
|
|||
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY,
|
||||
false, /* fallback_position */
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -13,6 +13,10 @@
|
|||
* # Date: 2019-01-28, 22:16:47 GMT
|
||||
*/
|
||||
|
||||
#include "hb.hh"
|
||||
|
||||
#ifndef HB_NO_OT_SHAPE
|
||||
|
||||
#include "hb-ot-shape-complex-vowel-constraints.hh"
|
||||
|
||||
static void
|
||||
|
@ -440,4 +444,6 @@ _hb_preprocess_text_vowel_constraints (const hb_ot_shape_plan_t *plan HB_UNUSED,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
/* == End of generated functions == */
|
||||
|
|
|
@ -24,6 +24,10 @@
|
|||
* Google Author(s): Behdad Esfahbod
|
||||
*/
|
||||
|
||||
#include "hb.hh"
|
||||
|
||||
#ifndef HB_NO_OT_SHAPE
|
||||
|
||||
#include "hb-ot-shape-fallback.hh"
|
||||
#include "hb-kern.hh"
|
||||
|
||||
|
@ -587,3 +591,6 @@ _hb_ot_shape_fallback_spaces (const hb_ot_shape_plan_t *plan HB_UNUSED,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -24,6 +24,10 @@
|
|||
* Google Author(s): Behdad Esfahbod
|
||||
*/
|
||||
|
||||
#include "hb.hh"
|
||||
|
||||
#ifndef HB_NO_OT_SHAPE
|
||||
|
||||
#include "hb-ot-shape-normalize.hh"
|
||||
#include "hb-ot-shape-complex.hh"
|
||||
#include "hb-ot-shape.hh"
|
||||
|
@ -469,3 +473,6 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
|
|||
buffer->swap_buffers ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -26,6 +26,10 @@
|
|||
* Google Author(s): Behdad Esfahbod
|
||||
*/
|
||||
|
||||
#include "hb.hh"
|
||||
|
||||
#ifndef HB_NO_OT_SHAPE
|
||||
|
||||
#include "hb-shaper-impl.hh"
|
||||
|
||||
#include "hb-ot-shape.hh"
|
||||
|
@ -1146,3 +1150,6 @@ hb_ot_shape_glyphs_closure (hb_font_t *font,
|
|||
|
||||
hb_shape_plan_destroy (shape_plan);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -79,7 +79,9 @@ hb_shape_plan_key_t::init (bool copy,
|
|||
}
|
||||
this->shaper_func = nullptr;
|
||||
this->shaper_name = nullptr;
|
||||
#ifndef HB_NO_OT_SHAPE
|
||||
this->ot.init (face, coords, num_coords);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Choose shaper.
|
||||
|
@ -148,7 +150,9 @@ hb_shape_plan_key_t::equal (const hb_shape_plan_key_t *other)
|
|||
{
|
||||
return hb_segment_properties_equal (&this->props, &other->props) &&
|
||||
this->user_features_match (other) &&
|
||||
#ifndef HB_NO_OT_SHAPE
|
||||
this->ot.equal (&other->ot) &&
|
||||
#endif
|
||||
this->shaper_func == other->shaper_func;
|
||||
}
|
||||
|
||||
|
@ -224,12 +228,16 @@ hb_shape_plan_create2 (hb_face_t *face,
|
|||
num_coords,
|
||||
shaper_list)))
|
||||
goto bail2;
|
||||
#ifndef HB_NO_OT_SHAPE
|
||||
if (unlikely (!shape_plan->ot.init0 (face, &shape_plan->key)))
|
||||
goto bail3;
|
||||
#endif
|
||||
|
||||
return shape_plan;
|
||||
|
||||
#ifndef HB_NO_OT_SHAPE
|
||||
bail3:
|
||||
#endif
|
||||
shape_plan->key.free ();
|
||||
bail2:
|
||||
free (shape_plan);
|
||||
|
@ -281,7 +289,9 @@ hb_shape_plan_destroy (hb_shape_plan_t *shape_plan)
|
|||
{
|
||||
if (!hb_object_destroy (shape_plan)) return;
|
||||
|
||||
#ifndef HB_NO_OT_SHAPE
|
||||
shape_plan->ot.fini ();
|
||||
#endif
|
||||
shape_plan->key.free ();
|
||||
free (shape_plan);
|
||||
}
|
||||
|
|
|
@ -39,7 +39,9 @@ struct hb_shape_plan_key_t
|
|||
const hb_feature_t *user_features;
|
||||
unsigned int num_user_features;
|
||||
|
||||
#ifndef HB_NO_OT_SHAPE
|
||||
hb_ot_shape_plan_key_t ot;
|
||||
#endif
|
||||
|
||||
hb_shape_func_t *shaper_func;
|
||||
const char *shaper_name;
|
||||
|
@ -65,7 +67,9 @@ struct hb_shape_plan_t
|
|||
hb_object_header_t header;
|
||||
hb_face_t *face_unsafe; /* We don't carry a reference to face. */
|
||||
hb_shape_plan_key_t key;
|
||||
#ifndef HB_NO_OT_SHAPE
|
||||
hb_ot_shape_plan_t ot;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -35,7 +35,9 @@
|
|||
HB_SHAPER_IMPLEMENT (graphite2)
|
||||
#endif
|
||||
|
||||
#ifndef HB_NO_OT_SHAPE
|
||||
HB_SHAPER_IMPLEMENT (ot) /* <--- This is our main OpenType shaper. */
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISCRIBE
|
||||
HB_SHAPER_IMPLEMENT (uniscribe)
|
||||
|
|
Loading…
Reference in New Issue