Merge branch 'master' into cff-subset

This commit is contained in:
Michiharu Ariza 2018-10-18 13:08:42 -07:00
commit 51fba41cc9
42 changed files with 217 additions and 92 deletions

16
AUTHORS
View File

@ -1,9 +1,11 @@
Behdad Esfahbod Behdad Esfahbod
Simon Hausmann
Martin Hosken
Jonathan Kew
Lars Knoll
Werner Lemberg
Roozbeh Pournader
Owen Taylor
David Turner David Turner
Ebrahim Byagowi
Jonathan Kew
Khaled Hosny
Lars Knoll
Martin Hosken
Owen Taylor
Roozbeh Pournader
Simon Hausmann
Werner Lemberg

68
NEWS
View File

@ -1,3 +1,71 @@
Overview of changes leading to 2.0.0
Wednesday, October 17, 2018
====================================
- Added AAT shaping support (morx/kerx/trak).
Automatically used if GSUB/GPOS are not available respectively.
Set HB_OPTIONS=aat env var to have morx/kerx preferred over
GSUB/GPOS.
- Apply TrueType kern table internally, instead of relying on
hb_font_t callbacks.
- Khmer shaper significantly rewritten to better match Uniscribe.
- Indic3 tags ('dev3', etc) are passed to USE shaper.
- .dfont Mac font containers implemented.
- Script- and language-mapping revamped to better use BCP 47.
- Misc USE and Indic fixes.
- Misc everything fixes.
- Too many things to list. Biggest release since 0.9.1, with
over 500 commits in just over 5 weeks! Didn't intend it to
be a big release. Just happened to become.
- hb-ft now locks underlying FT_Face during use.
API changes:
- Newly-created hb_font_t's now have our internal "hb-ot-font"
callbacks set on them, so they should work out of the box
without any callbacks set. If callbacks are set, everything
is back to what it was before, the fallback callbacks are
null. If you to get the internal implementation modified,
sub_font it.
- New hb_font_funcs_set_nominal_glyphs_func() allows speeding
up character to glyph mapping.
New API:
+HB_FEATURE_GLOBAL_START
+HB_FEATURE_GLOBAL_END
+hb_buffer_set_invisible_glyph()
+hb_buffer_get_invisible_glyph()
+hb_font_funcs_set_nominal_glyphs_func()
+hb_ot_layout_table_select_script()
+hb_ot_layout_script_select_language()
+hb_ot_layout_feature_get_name_ids()
+hb_ot_layout_feature_get_characters()
+hb_name_id_t
+HB_NAME_ID_INVALID
+HB_OT_MAX_TAGS_PER_SCRIPT
+hb_ot_tags_from_script_and_language()
+hb_ot_tags_to_script_and_language()
Deprecated API:
-hb_font_funcs_set_glyph_func()
-hb_unicode_eastasian_width_func_t
-hb_unicode_funcs_set_eastasian_width_func()
-hb_unicode_eastasian_width()
-hb_unicode_decompose_compatibility_func_t
-HB_UNICODE_MAX_DECOMPOSITION_LEN
-hb_unicode_funcs_set_decompose_compatibility_func()
-hb_unicode_decompose_compatibility()
-hb_font_funcs_set_glyph_h_kerning_func()
-hb_font_funcs_set_glyph_v_kerning_func()
-hb_font_get_glyph_h_kerning()
-hb_font_get_glyph_v_kerning()
-hb_font_get_glyph_kerning_for_direction()
-hb_ot_layout_table_choose_script()
-hb_ot_layout_script_find_language()
-hb_ot_tags_from_script()
-hb_ot_tag_from_language()
Overview of changes leading to 1.9.0 Overview of changes leading to 1.9.0
Monday, September 10, 2018 Monday, September 10, 2018
==================================== ====================================

View File

@ -1,6 +1,6 @@
AC_PREREQ([2.64]) AC_PREREQ([2.64])
AC_INIT([HarfBuzz], AC_INIT([HarfBuzz],
[1.9.0], [2.0.0],
[https://github.com/harfbuzz/harfbuzz/issues/new], [https://github.com/harfbuzz/harfbuzz/issues/new],
[harfbuzz], [harfbuzz],
[http://harfbuzz.org/]) [http://harfbuzz.org/])

View File

@ -291,10 +291,27 @@ struct Lookup
LookupFormat8<T> format8; LookupFormat8<T> format8;
} u; } u;
public: public:
DEFINE_SIZE_MIN (0); /* 0 min size, makes sure this cannot be used on null pool, DEFINE_SIZE_UNION (2, format);
* because Format0 has unbounded size depending on num_glyphs.
* We cannot define custom null bytes for a template :(. */
}; };
/* Lookup 0 has unbounded size (dependant on num_glyphs). So we need to defined
* special NULL objects for Lookup<> objects, but since it's template our macros
* don't work. So we have to hand-code them here. UGLY. */
} /* Close namespace. */
/* Ugly hand-coded null objects for template Lookup<> :(. */
extern HB_INTERNAL const unsigned char _hb_Null_AAT_Lookup[2];
template <>
/*static*/ inline const AAT::Lookup<OT::HBUINT16>& Null<AAT::Lookup<OT::HBUINT16> > (void) {
return *reinterpret_cast<const AAT::Lookup<OT::HBUINT16> *> (_hb_Null_AAT_Lookup);
}
template <>
/*static*/ inline const AAT::Lookup<OT::HBUINT32>& Null<AAT::Lookup<OT::HBUINT32> > (void) {
return *reinterpret_cast<const AAT::Lookup<OT::HBUINT32> *> (_hb_Null_AAT_Lookup);
}
template <>
/*static*/ inline const AAT::Lookup<OT::Offset<OT::HBUINT16, false> >& Null<AAT::Lookup<OT::Offset<OT::HBUINT16, false> > > (void) {
return *reinterpret_cast<const AAT::Lookup<OT::Offset<OT::HBUINT16, false> > *> (_hb_Null_AAT_Lookup);
}
namespace AAT {
/* /*
@ -405,6 +422,8 @@ struct StateTable
num_states, num_states,
num_classes * states[0].static_size))) num_classes * states[0].static_size)))
return_trace (false); return_trace (false);
if ((c->max_ops -= num_states - state) < 0)
return_trace (false);
{ /* Sweep new states. */ { /* Sweep new states. */
const HBUINT16 *stop = &states[num_states * num_classes]; const HBUINT16 *stop = &states[num_states * num_classes];
for (const HBUINT16 *p = &states[state * num_classes]; p < stop; p++) for (const HBUINT16 *p = &states[state * num_classes]; p < stop; p++)
@ -414,6 +433,8 @@ struct StateTable
if (unlikely (!c->check_array (entries, num_entries))) if (unlikely (!c->check_array (entries, num_entries)))
return_trace (false); return_trace (false);
if ((c->max_ops -= num_entries - entry) < 0)
return_trace (false);
{ /* Sweep new entries. */ { /* Sweep new entries. */
const Entry<Extra> *stop = &entries[num_entries]; const Entry<Extra> *stop = &entries[num_entries];
for (const Entry<Extra> *p = &entries[entry]; p < stop; p++) for (const Entry<Extra> *p = &entries[entry]; p < stop; p++)

View File

@ -93,12 +93,11 @@ struct TrackData
float s0 = size_table[idx].to_float (); float s0 = size_table[idx].to_float ();
float s1 = size_table[idx + 1].to_float (); float s1 = size_table[idx + 1].to_float ();
float t = unlikely (s0 == s1) ? 0.f : (target_size - s0) / (s1 - s0); float t = unlikely (s0 == s1) ? 0.f : (target_size - s0) / (s1 - s0);
return (float) t * trackTableEntry.get_value (base, idx + 1, sizes) + return t * trackTableEntry.get_value (base, idx + 1, sizes) +
((float) 1.0 - t) * trackTableEntry.get_value (base, idx, sizes); (1.f - t) * trackTableEntry.get_value (base, idx, sizes);
return 0;
} }
inline float get_tracking (const void *base, float ptem) const inline int get_tracking (const void *base, float ptem) const
{ {
/* CoreText points are CSS pixels (96 per inch), /* CoreText points are CSS pixels (96 per inch),
* NOT typographic points (72 per inch). * NOT typographic points (72 per inch).
@ -121,7 +120,7 @@ struct TrackData
if (trackTable[i].get_track_value () == 0.f) if (trackTable[i].get_track_value () == 0.f)
{ {
trackTableEntry = &trackTable[0]; trackTableEntry = &trackTable[i];
break; break;
} }
} }
@ -141,8 +140,8 @@ struct TrackData
if (size_table[size_index].to_float () >= csspx) if (size_table[size_index].to_float () >= csspx)
break; break;
return interpolate_at (size_index ? size_index - 1 : 0, csspx, return round (interpolate_at (size_index ? size_index - 1 : 0, csspx,
*trackTableEntry, base); *trackTableEntry, base));
} }
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
@ -193,7 +192,7 @@ struct trak
if (HB_DIRECTION_IS_HORIZONTAL (buffer->props.direction)) if (HB_DIRECTION_IS_HORIZONTAL (buffer->props.direction))
{ {
const TrackData &trackData = this+horizData; const TrackData &trackData = this+horizData;
float tracking = trackData.get_tracking (this, ptem); int tracking = trackData.get_tracking (this, ptem);
hb_position_t offset_to_add = c->font->em_scalef_x (tracking / 2); hb_position_t offset_to_add = c->font->em_scalef_x (tracking / 2);
hb_position_t advance_to_add = c->font->em_scalef_x (tracking); hb_position_t advance_to_add = c->font->em_scalef_x (tracking);
foreach_grapheme (buffer, start, end) foreach_grapheme (buffer, start, end)
@ -205,7 +204,7 @@ struct trak
else else
{ {
const TrackData &trackData = this+vertData; const TrackData &trackData = this+vertData;
float tracking = trackData.get_tracking (this, ptem); int tracking = trackData.get_tracking (this, ptem);
hb_position_t offset_to_add = c->font->em_scalef_y (tracking / 2); hb_position_t offset_to_add = c->font->em_scalef_y (tracking / 2);
hb_position_t advance_to_add = c->font->em_scalef_y (tracking); hb_position_t advance_to_add = c->font->em_scalef_y (tracking);
foreach_grapheme (buffer, start, end) foreach_grapheme (buffer, start, end)

View File

@ -1190,7 +1190,7 @@ hb_buffer_get_replacement_codepoint (hb_buffer_t *buffer)
* U+0020 SPACE character is used. Otherwise, this value is used * U+0020 SPACE character is used. Otherwise, this value is used
* verbatim. * verbatim.
* *
* Since: REPLACEME * Since: 2.0.0
**/ **/
void void
hb_buffer_set_invisible_glyph (hb_buffer_t *buffer, hb_buffer_set_invisible_glyph (hb_buffer_t *buffer,
@ -1211,7 +1211,7 @@ hb_buffer_set_invisible_glyph (hb_buffer_t *buffer,
* Return value: * Return value:
* The @buffer invisible #hb_codepoint_t. * The @buffer invisible #hb_codepoint_t.
* *
* Since: REPLACEME * Since: 2.0.0
**/ **/
hb_codepoint_t hb_codepoint_t
hb_buffer_get_invisible_glyph (hb_buffer_t *buffer) hb_buffer_get_invisible_glyph (hb_buffer_t *buffer)

View File

@ -401,13 +401,13 @@ typedef void (*hb_destroy_func_t) (void *user_data);
/** /**
* HB_FEATURE_GLOBAL_START * HB_FEATURE_GLOBAL_START
* *
* Since: REPLACEME * Since: 2.0.0
*/ */
#define HB_FEATURE_GLOBAL_START 0 #define HB_FEATURE_GLOBAL_START 0
/** /**
* HB_FEATURE_GLOBAL_END * HB_FEATURE_GLOBAL_END
* *
* Since: REPLACEME * Since: 2.0.0
*/ */
#define HB_FEATURE_GLOBAL_END ((unsigned int) -1) #define HB_FEATURE_GLOBAL_END ((unsigned int) -1)

View File

@ -61,7 +61,7 @@ hb_set_invert (hb_set_t *set);
/** /**
* hb_unicode_eastasian_width_func_t: * hb_unicode_eastasian_width_func_t:
* *
* Deprecated: REPLACEME * Deprecated: 2.0.0
*/ */
typedef unsigned int (*hb_unicode_eastasian_width_func_t) (hb_unicode_funcs_t *ufuncs, typedef unsigned int (*hb_unicode_eastasian_width_func_t) (hb_unicode_funcs_t *ufuncs,
hb_codepoint_t unicode, hb_codepoint_t unicode,
@ -77,7 +77,7 @@ typedef unsigned int (*hb_unicode_eastasian_width_func_t) (hb_unicode_funcs_t
* *
* *
* Since: 0.9.2 * Since: 0.9.2
* Deprecated: REPLACEME * Deprecated: 2.0.0
**/ **/
HB_EXTERN HB_DEPRECATED void HB_EXTERN HB_DEPRECATED void
hb_unicode_funcs_set_eastasian_width_func (hb_unicode_funcs_t *ufuncs, hb_unicode_funcs_set_eastasian_width_func (hb_unicode_funcs_t *ufuncs,
@ -88,7 +88,7 @@ hb_unicode_funcs_set_eastasian_width_func (hb_unicode_funcs_t *ufuncs,
* hb_unicode_eastasian_width: * hb_unicode_eastasian_width:
* *
* Since: 0.9.2 * Since: 0.9.2
* Deprecated: REPLACEME * Deprecated: 2.0.0
**/ **/
HB_EXTERN HB_DEPRECATED unsigned int HB_EXTERN HB_DEPRECATED unsigned int
hb_unicode_eastasian_width (hb_unicode_funcs_t *ufuncs, hb_unicode_eastasian_width (hb_unicode_funcs_t *ufuncs,
@ -113,7 +113,7 @@ hb_unicode_eastasian_width (hb_unicode_funcs_t *ufuncs,
* *
* Return value: number of codepoints in the full compatibility decomposition of @u, or 0 if no decomposition available. * Return value: number of codepoints in the full compatibility decomposition of @u, or 0 if no decomposition available.
* *
* Deprecated: REPLACEME * Deprecated: 2.0.0
*/ */
typedef unsigned int (*hb_unicode_decompose_compatibility_func_t) (hb_unicode_funcs_t *ufuncs, typedef unsigned int (*hb_unicode_decompose_compatibility_func_t) (hb_unicode_funcs_t *ufuncs,
hb_codepoint_t u, hb_codepoint_t u,
@ -125,7 +125,7 @@ typedef unsigned int (*hb_unicode_decompose_compatibility_func_t) (hb_unicode_
* *
* See Unicode 6.1 for details on the maximum decomposition length. * See Unicode 6.1 for details on the maximum decomposition length.
* *
* Deprecated: REPLACEME * Deprecated: 2.0.0
*/ */
#define HB_UNICODE_MAX_DECOMPOSITION_LEN (18+1) /* codepoints */ #define HB_UNICODE_MAX_DECOMPOSITION_LEN (18+1) /* codepoints */
@ -139,7 +139,7 @@ typedef unsigned int (*hb_unicode_decompose_compatibility_func_t) (hb_unicode_
* *
* *
* Since: 0.9.2 * Since: 0.9.2
* Deprecated: REPLACEME * Deprecated: 2.0.0
**/ **/
HB_EXTERN HB_DEPRECATED void HB_EXTERN HB_DEPRECATED void
hb_unicode_funcs_set_decompose_compatibility_func (hb_unicode_funcs_t *ufuncs, hb_unicode_funcs_set_decompose_compatibility_func (hb_unicode_funcs_t *ufuncs,
@ -150,7 +150,7 @@ hb_unicode_funcs_set_decompose_compatibility_func (hb_unicode_funcs_t *ufuncs,
* hb_unicode_decompose_compatibility: * hb_unicode_decompose_compatibility:
* *
* *
* Deprecated: REPLACEME * Deprecated: 2.0.0
**/ **/
HB_EXTERN HB_DEPRECATED unsigned int HB_EXTERN HB_DEPRECATED unsigned int
hb_unicode_decompose_compatibility (hb_unicode_funcs_t *ufuncs, hb_unicode_decompose_compatibility (hb_unicode_funcs_t *ufuncs,
@ -174,7 +174,7 @@ typedef hb_font_get_glyph_kerning_func_t hb_font_get_glyph_v_kerning_func_t;
* *
* *
* Since: 0.9.2 * Since: 0.9.2
* Deprecated: REPLACEME * Deprecated: 2.0.0
**/ **/
HB_EXTERN void HB_EXTERN void
hb_font_funcs_set_glyph_h_kerning_func (hb_font_funcs_t *ffuncs, hb_font_funcs_set_glyph_h_kerning_func (hb_font_funcs_t *ffuncs,
@ -191,7 +191,7 @@ hb_font_funcs_set_glyph_h_kerning_func (hb_font_funcs_t *ffuncs,
* *
* *
* Since: 0.9.2 * Since: 0.9.2
* Deprecated: REPLACEME * Deprecated: 2.0.0
**/ **/
HB_EXTERN void HB_EXTERN void
hb_font_funcs_set_glyph_v_kerning_func (hb_font_funcs_t *ffuncs, hb_font_funcs_set_glyph_v_kerning_func (hb_font_funcs_t *ffuncs,

View File

@ -922,7 +922,7 @@ hb_font_get_glyph_v_origin (hb_font_t *font,
* Return value: * Return value:
* *
* Since: 0.9.2 * Since: 0.9.2
* Deprecated: REPLACEME * Deprecated: 2.0.0
**/ **/
hb_position_t hb_position_t
hb_font_get_glyph_h_kerning (hb_font_t *font, hb_font_get_glyph_h_kerning (hb_font_t *font,
@ -942,7 +942,7 @@ hb_font_get_glyph_h_kerning (hb_font_t *font,
* Return value: * Return value:
* *
* Since: 0.9.2 * Since: 0.9.2
* Deprecated: REPLACEME * Deprecated: 2.0.0
**/ **/
hb_position_t hb_position_t
hb_font_get_glyph_v_kerning (hb_font_t *font, hb_font_get_glyph_v_kerning (hb_font_t *font,
@ -1171,7 +1171,7 @@ hb_font_subtract_glyph_origin_for_direction (hb_font_t *font,
* *
* *
* Since: 0.9.2 * Since: 0.9.2
* Deprecated: REPLACEME * Deprecated: 2.0.0
**/ **/
void void
hb_font_get_glyph_kerning_for_direction (hb_font_t *font, hb_font_get_glyph_kerning_for_direction (hb_font_t *font,

View File

@ -237,7 +237,7 @@ hb_font_funcs_set_nominal_glyph_func (hb_font_funcs_t *ffuncs,
* *
* *
* *
* Since: REPLACEME * Since: 2.0.0
**/ **/
HB_EXTERN void HB_EXTERN void
hb_font_funcs_set_nominal_glyphs_func (hb_font_funcs_t *ffuncs, hb_font_funcs_set_nominal_glyphs_func (hb_font_funcs_t *ffuncs,

View File

@ -227,7 +227,8 @@ struct hb_sanitize_context_t :
inline hb_sanitize_context_t (void) : inline hb_sanitize_context_t (void) :
debug_depth (0), debug_depth (0),
start (nullptr), end (nullptr), start (nullptr), end (nullptr),
writable (false), edit_count (0), max_ops (0), max_ops (0),
writable (false), edit_count (0),
blob (nullptr), blob (nullptr),
num_glyphs (65536), num_glyphs (65536),
num_glyphs_set (false) {} num_glyphs_set (false) {}
@ -443,10 +444,10 @@ struct hb_sanitize_context_t :
mutable unsigned int debug_depth; mutable unsigned int debug_depth;
const char *start, *end; const char *start, *end;
mutable int max_ops;
private: private:
bool writable; bool writable;
unsigned int edit_count; unsigned int edit_count;
mutable int max_ops;
hb_blob_t *blob; hb_blob_t *blob;
unsigned int num_glyphs; unsigned int num_glyphs;
bool num_glyphs_set; bool num_glyphs_set;

View File

@ -376,7 +376,7 @@ hb_ot_layout_table_choose_script (hb_face_t *face,
/** /**
* hb_ot_layout_table_select_script: * hb_ot_layout_table_select_script:
* *
* Since: REPLACEME * Since: 2.0.0
**/ **/
hb_bool_t hb_bool_t
hb_ot_layout_table_select_script (hb_face_t *face, hb_ot_layout_table_select_script (hb_face_t *face,
@ -489,7 +489,7 @@ hb_ot_layout_script_find_language (hb_face_t *face,
/** /**
* hb_ot_layout_script_select_language: * hb_ot_layout_script_select_language:
* *
* Since: REPLACEME * Since: 2.0.0
**/ **/
hb_bool_t hb_bool_t
hb_ot_layout_script_select_language (hb_face_t *face, hb_ot_layout_script_select_language (hb_face_t *face,
@ -1134,7 +1134,7 @@ hb_ot_layout_get_size_params (hb_face_t *face,
* *
* Return value: true if data found, false otherwise * Return value: true if data found, false otherwise
* *
* Since: REPLACEME * Since: 2.0.0
**/ **/
hb_bool_t hb_bool_t
hb_ot_layout_feature_get_name_ids (hb_face_t *face, hb_ot_layout_feature_get_name_ids (hb_face_t *face,
@ -1207,7 +1207,7 @@ hb_ot_layout_feature_get_name_ids (hb_face_t *face,
* *
* Return value: Number of total sample characters in the cvXX feature. * Return value: Number of total sample characters in the cvXX feature.
* *
* Since: REPLACEME * Since: 2.0.0
**/ **/
unsigned int unsigned int
hb_ot_layout_feature_get_characters (hb_face_t *face, hb_ot_layout_feature_get_characters (hb_face_t *face,

View File

@ -37,14 +37,14 @@ HB_BEGIN_DECLS
/** /**
* hb_name_id_t: * hb_name_id_t:
* *
* Since: REPLACEME * Since: 2.0.0
*/ */
typedef unsigned int hb_name_id_t; typedef unsigned int hb_name_id_t;
/** /**
* HB_NAME_ID_INVALID * HB_NAME_ID_INVALID
* *
* Since: REPLACEME * Since: 2.0.0
**/ **/
#define HB_NAME_ID_INVALID 0xFFFF #define HB_NAME_ID_INVALID 0xFFFF

View File

@ -458,9 +458,9 @@ apply_stch (const hb_ot_shape_plan_t *plan,
int sign = font->x_scale < 0 ? -1 : +1; int sign = font->x_scale < 0 ? -1 : +1;
unsigned int extra_glyphs_needed = 0; // Set during MEASURE, used during CUT unsigned int extra_glyphs_needed = 0; // Set during MEASURE, used during CUT
typedef enum { MEASURE, CUT } step_t; enum { MEASURE, CUT } /* step_t */;
for (step_t step = MEASURE; step <= CUT; step = (step_t) (step + 1)) for (unsigned int step = MEASURE; step <= CUT; step = step + 1)
{ {
unsigned int count = buffer->len; unsigned int count = buffer->len;
hb_glyph_info_t *info = buffer->info; hb_glyph_info_t *info = buffer->info;

View File

@ -64,42 +64,42 @@ set_myanmar_properties (hb_glyph_info_t &info)
{ {
hb_codepoint_t u = info.codepoint; hb_codepoint_t u = info.codepoint;
unsigned int type = hb_indic_get_categories (u); unsigned int type = hb_indic_get_categories (u);
indic_category_t cat = (indic_category_t) (type & 0x7Fu); unsigned int cat = type & 0x7Fu;
indic_position_t pos = (indic_position_t) (type >> 8); indic_position_t pos = (indic_position_t) (type >> 8);
/* Myanmar /* Myanmar
* https://docs.microsoft.com/en-us/typography/script-development/myanmar#analyze * https://docs.microsoft.com/en-us/typography/script-development/myanmar#analyze
*/ */
if (unlikely (hb_in_range<hb_codepoint_t> (u, 0xFE00u, 0xFE0Fu))) if (unlikely (hb_in_range<hb_codepoint_t> (u, 0xFE00u, 0xFE0Fu)))
cat = (indic_category_t) OT_VS; cat = OT_VS;
switch (u) switch (u)
{ {
case 0x104Eu: case 0x104Eu:
cat = (indic_category_t) OT_C; /* The spec says C, IndicSyllableCategory doesn't have. */ cat = OT_C; /* The spec says C, IndicSyllableCategory doesn't have. */
break; break;
case 0x002Du: case 0x00A0u: case 0x00D7u: case 0x2012u: case 0x002Du: case 0x00A0u: case 0x00D7u: case 0x2012u:
case 0x2013u: case 0x2014u: case 0x2015u: case 0x2022u: case 0x2013u: case 0x2014u: case 0x2015u: case 0x2022u:
case 0x25CCu: case 0x25FBu: case 0x25FCu: case 0x25FDu: case 0x25CCu: case 0x25FBu: case 0x25FCu: case 0x25FDu:
case 0x25FEu: case 0x25FEu:
cat = (indic_category_t) OT_GB; cat = OT_GB;
break; break;
case 0x1004u: case 0x101Bu: case 0x105Au: case 0x1004u: case 0x101Bu: case 0x105Au:
cat = (indic_category_t) OT_Ra; cat = OT_Ra;
break; break;
case 0x1032u: case 0x1036u: case 0x1032u: case 0x1036u:
cat = (indic_category_t) OT_A; cat = OT_A;
break; break;
case 0x1039u: case 0x1039u:
cat = (indic_category_t) OT_H; cat = OT_H;
break; break;
case 0x103Au: case 0x103Au:
cat = (indic_category_t) OT_As; cat = OT_As;
break; break;
case 0x1041u: case 0x1042u: case 0x1043u: case 0x1044u: case 0x1041u: case 0x1042u: case 0x1043u: case 0x1044u:
@ -107,47 +107,47 @@ set_myanmar_properties (hb_glyph_info_t &info)
case 0x1049u: case 0x1090u: case 0x1091u: case 0x1092u: case 0x1049u: case 0x1090u: case 0x1091u: case 0x1092u:
case 0x1093u: case 0x1094u: case 0x1095u: case 0x1096u: case 0x1093u: case 0x1094u: case 0x1095u: case 0x1096u:
case 0x1097u: case 0x1098u: case 0x1099u: case 0x1097u: case 0x1098u: case 0x1099u:
cat = (indic_category_t) OT_D; cat = OT_D;
break; break;
case 0x1040u: case 0x1040u:
cat = (indic_category_t) OT_D; /* XXX The spec says D0, but Uniscribe doesn't seem to do. */ cat = OT_D; /* XXX The spec says D0, but Uniscribe doesn't seem to do. */
break; break;
case 0x103Eu: case 0x1060u: case 0x103Eu: case 0x1060u:
cat = (indic_category_t) OT_MH; cat = OT_MH;
break; break;
case 0x103Cu: case 0x103Cu:
cat = (indic_category_t) OT_MR; cat = OT_MR;
break; break;
case 0x103Du: case 0x1082u: case 0x103Du: case 0x1082u:
cat = (indic_category_t) OT_MW; cat = OT_MW;
break; break;
case 0x103Bu: case 0x105Eu: case 0x105Fu: case 0x103Bu: case 0x105Eu: case 0x105Fu:
cat = (indic_category_t) OT_MY; cat = OT_MY;
break; break;
case 0x1063u: case 0x1064u: case 0x1069u: case 0x106Au: case 0x1063u: case 0x1064u: case 0x1069u: case 0x106Au:
case 0x106Bu: case 0x106Cu: case 0x106Du: case 0xAA7Bu: case 0x106Bu: case 0x106Cu: case 0x106Du: case 0xAA7Bu:
cat = (indic_category_t) OT_PT; cat = OT_PT;
break; break;
case 0x1038u: case 0x1087u: case 0x1088u: case 0x1089u: case 0x1038u: case 0x1087u: case 0x1088u: case 0x1089u:
case 0x108Au: case 0x108Bu: case 0x108Cu: case 0x108Du: case 0x108Au: case 0x108Bu: case 0x108Cu: case 0x108Du:
case 0x108Fu: case 0x109Au: case 0x109Bu: case 0x109Cu: case 0x108Fu: case 0x109Au: case 0x109Bu: case 0x109Cu:
cat = (indic_category_t) OT_SM; cat = OT_SM;
break; break;
case 0x104Au: case 0x104Bu: case 0x104Au: case 0x104Bu:
cat = (indic_category_t) OT_P; cat = OT_P;
break; break;
case 0xAA74u: case 0xAA75u: case 0xAA76u: case 0xAA74u: case 0xAA75u: case 0xAA76u:
/* https://github.com/roozbehp/unicode-data/issues/3 */ /* https://github.com/roozbehp/unicode-data/issues/3 */
cat = (indic_category_t) OT_C; cat = OT_C;
break; break;
} }
@ -155,15 +155,15 @@ set_myanmar_properties (hb_glyph_info_t &info)
{ {
switch ((int) pos) switch ((int) pos)
{ {
case POS_PRE_C: cat = (indic_category_t) OT_VPre; case POS_PRE_C: cat = OT_VPre;
pos = POS_PRE_M; break; pos = POS_PRE_M; break;
case POS_ABOVE_C: cat = (indic_category_t) OT_VAbv; break; case POS_ABOVE_C: cat = OT_VAbv; break;
case POS_BELOW_C: cat = (indic_category_t) OT_VBlw; break; case POS_BELOW_C: cat = OT_VBlw; break;
case POS_POST_C: cat = (indic_category_t) OT_VPst; break; case POS_POST_C: cat = OT_VPst; break;
} }
} }
info.myanmar_category() = (myanmar_category_t) cat; info.myanmar_category() = cat;
info.myanmar_position() = pos; info.myanmar_position() = pos;
} }

View File

@ -336,7 +336,7 @@ parse_private_use_subtag (const char *private_use_subtag,
* *
* Converts an #hb_script_t and an #hb_language_t to script and language tags. * Converts an #hb_script_t and an #hb_language_t to script and language tags.
* *
* Since: REPLACEME * Since: 2.0.0
**/ **/
void void
hb_ot_tags_from_script_and_language (hb_script_t script, hb_ot_tags_from_script_and_language (hb_script_t script,
@ -448,7 +448,7 @@ hb_ot_tag_to_language (hb_tag_t tag)
* Converts a script tag and a language tag to an #hb_script_t and an * Converts a script tag and a language tag to an #hb_script_t and an
* #hb_language_t. * #hb_language_t.
* *
* Since: REPLACEME * Since: 2.0.0
**/ **/
void void
hb_ot_tags_to_script_and_language (hb_tag_t script_tag, hb_ot_tags_to_script_and_language (hb_tag_t script_tag,

View File

@ -42,13 +42,13 @@ HB_BEGIN_DECLS
/** /**
* HB_OT_MAX_TAGS_PER_SCRIPT: * HB_OT_MAX_TAGS_PER_SCRIPT:
* *
* Since: REPLACEME * Since: 2.0.0
**/ **/
#define HB_OT_MAX_TAGS_PER_SCRIPT 3u #define HB_OT_MAX_TAGS_PER_SCRIPT 3u
/** /**
* HB_OT_MAX_TAGS_PER_LANGUAGE: * HB_OT_MAX_TAGS_PER_LANGUAGE:
* *
* Since: REPLACEME * Since: 2.0.0
**/ **/
#define HB_OT_MAX_TAGS_PER_LANGUAGE 3u #define HB_OT_MAX_TAGS_PER_LANGUAGE 3u

View File

@ -28,6 +28,8 @@
#include "hb-open-type.hh" #include "hb-open-type.hh"
#include "hb-ot-layout-common.hh" #include "hb-ot-layout-common.hh"
#include "hb-aat-layout-ankr-table.hh" /* I don't even want to know why... */
#include "hb-aat-layout-common.hh"
#include "hb-face.hh" #include "hb-face.hh"
#include "hb-ot-head-table.hh" #include "hb-ot-head-table.hh"
@ -41,6 +43,8 @@ hb_vector_size_impl_t const _hb_NullPool[(HB_NULL_POOL_SIZE + sizeof (hb_vector_
DEFINE_NULL_NAMESPACE_BYTES (OT, Index) = {0xFF,0xFF}; DEFINE_NULL_NAMESPACE_BYTES (OT, Index) = {0xFF,0xFF};
DEFINE_NULL_NAMESPACE_BYTES (OT, LangSys) = {0x00,0x00, 0xFF,0xFF, 0x00,0x00}; DEFINE_NULL_NAMESPACE_BYTES (OT, LangSys) = {0x00,0x00, 0xFF,0xFF, 0x00,0x00};
DEFINE_NULL_NAMESPACE_BYTES (OT, RangeRecord) = {0x00,0x01, 0x00,0x00, 0x00, 0x00}; DEFINE_NULL_NAMESPACE_BYTES (OT, RangeRecord) = {0x00,0x01, 0x00,0x00, 0x00, 0x00};
/* Hand-coded because Lookup is a template. Sad. */
const unsigned char _hb_Null_AAT_Lookup[2] = {0xFF, 0xFF};
void void

View File

@ -36,11 +36,11 @@
HB_BEGIN_DECLS HB_BEGIN_DECLS
#define HB_VERSION_MAJOR 1 #define HB_VERSION_MAJOR 2
#define HB_VERSION_MINOR 9 #define HB_VERSION_MINOR 0
#define HB_VERSION_MICRO 0 #define HB_VERSION_MICRO 0
#define HB_VERSION_STRING "1.9.0" #define HB_VERSION_STRING "2.0.0"
#define HB_VERSION_ATLEAST(major,minor,micro) \ #define HB_VERSION_ATLEAST(major,minor,micro) \
((major)*10000+(minor)*100+(micro) <= \ ((major)*10000+(minor)*100+(micro) <= \

View File

@ -464,8 +464,8 @@ test_tags (hb_script_t script,
unsigned int i; unsigned int i;
hb_tag_t *script_tags = malloc (script_count * sizeof (hb_tag_t)); hb_tag_t *script_tags = malloc (script_count * sizeof (hb_tag_t));
hb_tag_t *language_tags = malloc (language_count * sizeof (hb_tag_t)); hb_tag_t *language_tags = malloc (language_count * sizeof (hb_tag_t));
g_assert_nonnull (script_tags); g_assert (script_tags);
g_assert_nonnull (language_tags); g_assert (language_tags);
hb_language_t lang = hb_language_from_string (lang_s, -1); hb_language_t lang = hb_language_from_string (lang_s, -1);
va_start (expected_tags, expected_language_count); va_start (expected_tags, expected_language_count);

View File

@ -228,7 +228,7 @@ test_subset_glyf_strip_hints_composite (void)
static void static void
test_subset_glyf_strip_hints_invalid (void) test_subset_glyf_strip_hints_invalid (void)
{ {
hb_face_t *face = hb_subset_test_open_font ("fonts/oom-ccc61c92d589f895174cdef6ff2e3b20e9999a1a"); hb_face_t *face = hb_subset_test_open_font ("../fuzzing/fonts/oom-ccc61c92d589f895174cdef6ff2e3b20e9999a1a");
hb_set_t *codepoints = hb_set_create(); hb_set_t *codepoints = hb_set_create();
const hb_codepoint_t text[] = const hb_codepoint_t text[] =

View File

@ -72,7 +72,7 @@ test_subset_hdmx_multiple_device_records (void)
static void static void
test_subset_hdmx_invalid (void) test_subset_hdmx_invalid (void)
{ {
hb_face_t *face = hb_subset_test_open_font("fonts/crash-ccc61c92d589f895174cdef6ff2e3b20e9999a1a"); hb_face_t *face = hb_subset_test_open_font("../fuzzing/fonts/crash-ccc61c92d589f895174cdef6ff2e3b20e9999a1a");
hb_subset_input_t *input = hb_subset_input_create_or_fail (); hb_subset_input_t *input = hb_subset_input_create_or_fail ();
hb_set_t *codepoints = hb_subset_input_unicode_set (input); hb_set_t *codepoints = hb_subset_input_unicode_set (input);
@ -94,7 +94,7 @@ test_subset_hdmx_invalid (void)
static void static void
test_subset_hdmx_fails_sanitize (void) test_subset_hdmx_fails_sanitize (void)
{ {
hb_face_t *face = hb_subset_test_open_font("fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5609911946838016"); hb_face_t *face = hb_subset_test_open_font("../fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5609911946838016");
hb_subset_input_t *input = hb_subset_input_create_or_fail (); hb_subset_input_t *input = hb_subset_input_create_or_fail ();
hb_set_t *codepoints = hb_subset_input_unicode_set (input); hb_set_t *codepoints = hb_subset_input_unicode_set (input);

View File

@ -153,7 +153,7 @@ test_subset_hmtx_noop (void)
static void static void
test_subset_invalid_hmtx (void) test_subset_invalid_hmtx (void)
{ {
hb_face_t *face = hb_subset_test_open_font("fonts/crash-e4e0bb1458a91b692eba492c907ae1f94e635480"); hb_face_t *face = hb_subset_test_open_font("../fuzzing/fonts/crash-e4e0bb1458a91b692eba492c907ae1f94e635480");
hb_face_t *subset; hb_face_t *subset;
hb_subset_input_t *input = hb_subset_input_create_or_fail (); hb_subset_input_t *input = hb_subset_input_create_or_fail ();

View File

@ -32,7 +32,7 @@
static void static void
test_subset_32_tables (void) test_subset_32_tables (void)
{ {
hb_face_t *face = hb_subset_test_open_font("fonts/oom-6ef8c96d3710262511bcc730dce9c00e722cb653"); hb_face_t *face = hb_subset_test_open_font("../fuzzing/fonts/oom-6ef8c96d3710262511bcc730dce9c00e722cb653");
hb_subset_input_t *input = hb_subset_input_create_or_fail (); hb_subset_input_t *input = hb_subset_input_create_or_fail ();
hb_set_t *codepoints = hb_subset_input_unicode_set (input); hb_set_t *codepoints = hb_subset_input_unicode_set (input);
@ -54,7 +54,7 @@ test_subset_32_tables (void)
static void static void
test_subset_no_inf_loop (void) test_subset_no_inf_loop (void)
{ {
hb_face_t *face = hb_subset_test_open_font("fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5521982557782016"); hb_face_t *face = hb_subset_test_open_font("../fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5521982557782016");
hb_subset_input_t *input = hb_subset_input_create_or_fail (); hb_subset_input_t *input = hb_subset_input_create_or_fail ();
hb_set_t *codepoints = hb_subset_input_unicode_set (input); hb_set_t *codepoints = hb_subset_input_unicode_set (input);
@ -76,7 +76,7 @@ test_subset_no_inf_loop (void)
static void static void
test_subset_crash (void) test_subset_crash (void)
{ {
hb_face_t *face = hb_subset_test_open_font("fonts/crash-4b60576767ee4d9fe1cc10959d89baf73d4e8249"); hb_face_t *face = hb_subset_test_open_font("../fuzzing/fonts/crash-4b60576767ee4d9fe1cc10959d89baf73d4e8249");
hb_subset_input_t *input = hb_subset_input_create_or_fail (); hb_subset_input_t *input = hb_subset_input_create_or_fail ();
hb_set_t *codepoints = hb_subset_input_unicode_set (input); hb_set_t *codepoints = hb_subset_input_unicode_set (input);

View File

@ -2,7 +2,36 @@
from __future__ import print_function, division, absolute_import from __future__ import print_function, division, absolute_import
import sys, os, subprocess import sys, os, subprocess, tempfile, threading
def cmd(command):
# https://stackoverflow.com/a/4408409
# https://stackoverflow.com/a/10012262
with tempfile.TemporaryFile() as tempf:
p = subprocess.Popen (command, stderr=tempf)
is_killed = {'value': False}
def timeout(p, is_killed):
is_killed['value'] = True
p.kill()
timer = threading.Timer (2, timeout, [p, is_killed])
try:
timer.start()
p.wait ()
tempf.seek (0)
text = tempf.read().decode ("utf-8").strip ()
returncode = p.returncode
finally:
timer.cancel()
if is_killed['value']:
text = 'error: timeout, ' + text
returncode = 1
return text, returncode
srcdir = os.environ.get ("srcdir", ".") srcdir = os.environ.get ("srcdir", ".")
EXEEXT = os.environ.get ("EXEEXT", "") EXEEXT = os.environ.get ("EXEEXT", "")
@ -24,10 +53,11 @@ parent_path = os.path.join (srcdir, "fonts")
for file in os.listdir (parent_path): for file in os.listdir (parent_path):
path = os.path.join(parent_path, file) path = os.path.join(parent_path, file)
p = subprocess.Popen ([hb_shape_fuzzer, path]) text, returncode = cmd ([hb_shape_fuzzer, path])
print (text)
if p.wait () != 0: if returncode != 0 or 'error' in text:
print ('failure on %s', font) print ('failure on %s' % file)
fails = fails + 1 fails = fails + 1
if fails: if fails:

View File

@ -660,7 +660,7 @@ font_options_t::get_font (void) const
blob = hb_blob_create_from_file (font_path); blob = hb_blob_create_from_file (font_path);
if (blob == hb_blob_get_empty ()) if (blob == hb_blob_get_empty ())
fail (false, "No such file or directory"); fail (false, "Couldn't read or find %s, or it was empty.", font_path);
/* Create the face */ /* Create the face */
hb_face_t *face = hb_face_create (blob, face_index); hb_face_t *face = hb_face_create (blob, face_index);