[HarfBuzz] harfbuzz: Branch 'master' - 4 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Tue Sep 4 11:55:19 PDT 2012
src/hb-open-type-private.hh | 14 +++++-
src/hb-ot-layout-gsub-table.hh | 80 ++++++++++++++++++++++++++++++++++-
src/hb-ot-layout-gsubgpos-private.hh | 8 +--
src/hb-ot-layout.cc | 6 +-
src/hb-ot-shape-complex-arabic.cc | 4 +
5 files changed, 100 insertions(+), 12 deletions(-)
New commits:
commit a5ddd9e31cd7906c4b559aa5b2fafdae4b9c8935
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Tue Sep 4 14:55:00 2012 -0400
[OT] Really fix possible NULL dereference this time
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index 40d5c57..baf0cb3 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -86,13 +86,13 @@ struct hb_would_apply_context_t
const hb_codepoint_t *glyphs_,
unsigned int len_,
bool zero_context_,
- const hb_set_digest_t *digest_
+ const hb_set_digest_t &digest_
) :
face (face_),
glyphs (glyphs_),
len (len_),
zero_context (zero_context_),
- digest (digest_ ? *digest_ : hb_set_digest_t()),
+ digest (digest_),
debug_depth (0) {};
};
@@ -124,7 +124,7 @@ struct hb_apply_context_t
hb_apply_context_t (hb_font_t *font_,
hb_buffer_t *buffer_,
hb_mask_t lookup_mask_,
- const hb_set_digest_t *digest_) :
+ const hb_set_digest_t &digest_) :
font (font_), face (font->face), buffer (buffer_),
direction (buffer_->props.direction),
lookup_mask (lookup_mask_),
@@ -132,7 +132,7 @@ struct hb_apply_context_t
lookup_props (0), property (0), debug_depth (0),
gdef (*hb_ot_layout_from_face (face)->gdef),
has_glyph_classes (gdef.has_glyph_classes ()),
- digest (*digest_) {}
+ digest (digest_) {}
void set_lookup_props (unsigned int lookup_props_) {
lookup_props = lookup_props_;
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index a319959..3ea6342 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -417,7 +417,7 @@ hb_ot_layout_would_substitute_lookup_fast (hb_face_t *face,
hb_bool_t zero_context)
{
if (unlikely (lookup_index >= hb_ot_layout_from_face (face)->gsub_lookup_count)) return false;
- OT::hb_would_apply_context_t c (face, glyphs, glyphs_length, zero_context, &hb_ot_layout_from_face (face)->gsub_digests[lookup_index]);
+ OT::hb_would_apply_context_t c (face, glyphs, glyphs_length, zero_context, hb_ot_layout_from_face (face)->gsub_digests[lookup_index]);
return hb_ot_layout_from_face (face)->gsub->would_substitute_lookup (&c, lookup_index);
}
@@ -434,7 +434,7 @@ hb_ot_layout_substitute_lookup (hb_font_t *font,
hb_mask_t mask)
{
if (unlikely (lookup_index >= hb_ot_layout_from_face (font->face)->gsub_lookup_count)) return false;
- OT::hb_apply_context_t c (font, buffer, mask, &hb_ot_layout_from_face (font->face)->gsub_digests[lookup_index]);
+ OT::hb_apply_context_t c (font, buffer, mask, hb_ot_layout_from_face (font->face)->gsub_digests[lookup_index]);
return hb_ot_layout_from_face (font->face)->gsub->substitute_lookup (&c, lookup_index);
}
@@ -476,7 +476,7 @@ hb_ot_layout_position_lookup (hb_font_t *font,
hb_mask_t mask)
{
if (unlikely (lookup_index >= hb_ot_layout_from_face (font->face)->gpos_lookup_count)) return false;
- OT::hb_apply_context_t c (font, buffer, mask, &hb_ot_layout_from_face (font->face)->gpos_digests[lookup_index]);
+ OT::hb_apply_context_t c (font, buffer, mask, hb_ot_layout_from_face (font->face)->gpos_digests[lookup_index]);
return hb_ot_layout_from_face (font->face)->gpos->position_lookup (&c, lookup_index);
}
diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc
index 965947a..fed39c6 100644
--- a/src/hb-ot-shape-complex-arabic.cc
+++ b/src/hb-ot-shape-complex-arabic.cc
@@ -246,7 +246,9 @@ arabic_fallback_shape (hb_font_t *font, hb_buffer_t *buffer)
buffer->info[i].codepoint = shaped;
}
- OT::hb_apply_context_t c (font, buffer, 1/*global mask*/, NULL);
+ hb_set_digest_t digest;
+ digest.init ();
+ OT::hb_apply_context_t c (font, buffer, 1/*global mask*/, digest);
c.set_lookup_props (OT::LookupFlag::IgnoreMarks);
/* Mandatory ligatures */
commit 29416833584d7831ece84aaeada6f5ebba7828c0
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Mon Sep 3 23:31:14 2012 -0400
[OT] Implement serialize() for AlternateSubst
diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index 62bdb33..4feaa23 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -485,6 +485,23 @@ struct AlternateSubstFormat1
return TRACE_RETURN (true);
}
+ inline bool serialize (hb_serialize_context_t *c,
+ const USHORT *glyphs,
+ unsigned int *alternate_len_list,
+ unsigned int num_glyphs,
+ const USHORT *alternate_glyphs_list)
+ {
+ TRACE_SERIALIZE ();
+ if (unlikely (!c->extend_min (*this))) return TRACE_RETURN (false);
+ if (unlikely (!coverage.serialize (c, this).serialize (c, glyphs, num_glyphs))) return TRACE_RETURN (false);
+ if (unlikely (!alternateSet.serialize (c, num_glyphs))) return TRACE_RETURN (false);
+ for (unsigned int i = 0; i < num_glyphs; i++) {
+ if (unlikely (!alternateSet[i].serialize (c, this).serialize (c, alternate_glyphs_list, alternate_len_list[i]))) return TRACE_RETURN (false);
+ alternate_glyphs_list += alternate_len_list[i];
+ }
+ return TRACE_RETURN (true);
+ }
+
inline bool sanitize (hb_sanitize_context_t *c) {
TRACE_SANITIZE ();
return TRACE_RETURN (coverage.sanitize (c, this) && alternateSet.sanitize (c, this));
@@ -534,6 +551,22 @@ struct AlternateSubst
}
}
+ inline bool serialize (hb_serialize_context_t *c,
+ const USHORT *glyphs,
+ unsigned int *alternate_len_list,
+ unsigned int num_glyphs,
+ const USHORT *alternate_glyphs_list)
+ {
+ TRACE_SERIALIZE ();
+ if (unlikely (!c->extend_min (u.format))) return TRACE_RETURN (false);
+ unsigned int format = 1;
+ u.format.set (format);
+ switch (u.format) {
+ case 1: return TRACE_RETURN (u.format1.serialize (c, glyphs, alternate_len_list, num_glyphs, alternate_glyphs_list));
+ default:return TRACE_RETURN (false);
+ }
+ }
+
inline bool sanitize (hb_sanitize_context_t *c) {
TRACE_SANITIZE ();
if (!u.format.sanitize (c)) return TRACE_RETURN (false);
commit 1f07e3382a1608b054cbf88b89fef74f6c485434
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Mon Sep 3 23:28:34 2012 -0400
[OT] Implement serialize() for MultiSubst
diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index 11cb621..384cdb7 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ -677,6 +677,16 @@ struct GenericArrayOf
{ return len.static_size + len * Type::static_size; }
inline bool serialize (hb_serialize_context_t *c,
+ unsigned int items_len)
+ {
+ TRACE_SERIALIZE ();
+ if (unlikely (!c->extend_min (*this))) return TRACE_RETURN (false);
+ len.set (items_len); /* TODO(serialize) Overflow? */
+ if (unlikely (!c->extend (*this))) return TRACE_RETURN (false);
+ return TRACE_RETURN (true);
+ }
+
+ inline bool serialize (hb_serialize_context_t *c,
const Type *items,
unsigned int items_len)
{
diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index f8d66b4..62bdb33 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -276,6 +276,16 @@ struct Sequence
return TRACE_RETURN (true);
}
+ inline bool serialize (hb_serialize_context_t *c,
+ const USHORT *glyphs,
+ unsigned int num_glyphs)
+ {
+ TRACE_SERIALIZE ();
+ if (unlikely (!c->extend_min (*this))) return TRACE_RETURN (false);
+ if (unlikely (!substitute.serialize (c, glyphs, num_glyphs))) return TRACE_RETURN (false);
+ return TRACE_RETURN (true);
+ }
+
public:
inline bool sanitize (hb_sanitize_context_t *c) {
TRACE_SANITIZE ();
@@ -320,6 +330,23 @@ struct MultipleSubstFormat1
return TRACE_RETURN ((this+sequence[index]).apply (c));
}
+ inline bool serialize (hb_serialize_context_t *c,
+ const USHORT *glyphs,
+ unsigned int *substitute_len_list,
+ unsigned int num_glyphs,
+ const USHORT *substitute_glyphs_list)
+ {
+ TRACE_SERIALIZE ();
+ if (unlikely (!c->extend_min (*this))) return TRACE_RETURN (false);
+ if (unlikely (!coverage.serialize (c, this).serialize (c, glyphs, num_glyphs))) return TRACE_RETURN (false);
+ if (unlikely (!sequence.serialize (c, num_glyphs))) return TRACE_RETURN (false);
+ for (unsigned int i = 0; i < num_glyphs; i++) {
+ if (unlikely (!sequence[i].serialize (c, this).serialize (c, substitute_glyphs_list, substitute_len_list[i]))) return TRACE_RETURN (false);
+ substitute_glyphs_list += substitute_len_list[i];
+ }
+ return TRACE_RETURN (true);
+ }
+
inline bool sanitize (hb_sanitize_context_t *c) {
TRACE_SANITIZE ();
return TRACE_RETURN (coverage.sanitize (c, this) && sequence.sanitize (c, this));
@@ -369,6 +396,22 @@ struct MultipleSubst
}
}
+ inline bool serialize (hb_serialize_context_t *c,
+ const USHORT *glyphs,
+ unsigned int *substitute_len_list,
+ unsigned int num_glyphs,
+ const USHORT *substitute_glyphs_list)
+ {
+ TRACE_SERIALIZE ();
+ if (unlikely (!c->extend_min (u.format))) return TRACE_RETURN (false);
+ unsigned int format = 1;
+ u.format.set (format);
+ switch (u.format) {
+ case 1: return TRACE_RETURN (u.format1.serialize (c, glyphs, substitute_len_list, num_glyphs, substitute_glyphs_list));
+ default:return TRACE_RETURN (false);
+ }
+ }
+
inline bool sanitize (hb_sanitize_context_t *c) {
TRACE_SANITIZE ();
if (!u.format.sanitize (c)) return TRACE_RETURN (false);
commit 4912030dfba740c822e200d33cbb5c6dbbeaf79e
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Mon Sep 3 20:58:03 2012 -0400
Minor
diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index ce268b2..11cb621 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ -601,7 +601,7 @@ struct GenericOffsetTo : OffsetType
inline Type& serialize (hb_serialize_context_t *c, void *base)
{
Type *t = (Type *) c->head;
- this->set ((char *) t - (char *) base);
+ this->set ((char *) t - (char *) base); /* TODO(serialize) Overflow? */
return *t;
}
@@ -682,7 +682,7 @@ struct GenericArrayOf
{
TRACE_SERIALIZE ();
if (unlikely (!c->extend_min (*this))) return TRACE_RETURN (false);
- len.set (items_len); /* TODO may overflow */
+ len.set (items_len); /* TODO(serialize) Overflow? */
if (unlikely (!c->extend (*this))) return TRACE_RETURN (false);
unsigned int count = items_len;
for (unsigned int i = 0; i < count; i++)
diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index c50b206..f8d66b4 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -80,7 +80,7 @@ struct SingleSubstFormat1
TRACE_SERIALIZE ();
if (unlikely (!c->extend_min (*this))) return TRACE_RETURN (false);
if (unlikely (!coverage.serialize (c, this).serialize (c, glyphs, num_glyphs))) return TRACE_RETURN (false);
- deltaGlyphID.set (delta); /* TODO overflow? */
+ deltaGlyphID.set (delta); /* TODO(serilaize) overflow? */
return TRACE_RETURN (true);
}
@@ -211,7 +211,7 @@ struct SingleSubst
unsigned int delta;
if (num_glyphs) {
format = 1;
- /* TODO check for wrap-around */
+ /* TODO(serialize) check for wrap-around */
delta = substitutes[0] - glyphs[0];
for (unsigned int i = 1; i < num_glyphs; i++)
if (delta != substitutes[i] - glyphs[i]) {
More information about the HarfBuzz
mailing list