src/hb-coretext.cc | 32 ++--- src/hb-icu-le.cc | 2 src/hb-old.cc | 10 - src/hb-open-file-private.hh | 2 src/hb-open-type-private.hh | 2 src/hb-ot-head-table.hh | 2 src/hb-ot-hhea-table.hh | 2 src/hb-ot-hmtx-table.hh | 2 src/hb-ot-layout-common-private.hh | 26 ++++ src/hb-ot-layout-gdef-table.hh | 14 +- src/hb-ot-layout-gpos-table.hh | 10 - src/hb-ot-layout-gsub-table.hh | 189 ++++++++++++++++++++++++++++++++++- src/hb-ot-layout-gsubgpos-private.hh | 69 +++++++++++- src/hb-ot-layout-private.hh | 10 + src/hb-ot-layout.cc | 43 +++++++ src/hb-ot-layout.h | 23 +--- src/hb-ot-maxp-table.hh | 2 src/hb-ot-name-table.hh | 2 src/hb-ot-shape-complex-default.cc | 109 ++++++++++---------- src/hb-ot-shape.cc | 5 src/hb-shape-plan-private.hh | 1 src/hb-shape-plan.cc | 7 + src/hb-shape-plan.h | 4 src/hb-tt-font.cc | 2 24 files changed, 443 insertions(+), 127 deletions(-)
New commits: commit e8cfdd7fa8d0fb66e0a261f3547e5824897e5131 Author: Behdad Esfahbod <beh...@behdad.org> Date: Fri Nov 16 19:07:06 2012 -0800 Start implementing collect_glyphs() operation Not functional yet. diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 6e185ba..4acd67b 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -52,6 +52,16 @@ struct SingleSubstFormat1 } } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const + { + Coverage::Iter iter; + for (iter.init (this+coverage); iter.more (); iter.next ()) { + hb_codepoint_t glyph_id = iter.get_glyph (); + c->input.add (glyph_id); + c->output.add ((glyph_id + deltaGlyphID) & 0xFFFF); + } + } + inline const Coverage &get_coverage (void) const { return this+coverage; @@ -116,6 +126,15 @@ struct SingleSubstFormat2 } } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const + { + Coverage::Iter iter; + for (iter.init (this+coverage); iter.more (); iter.next ()) { + c->input.add (iter.get_glyph ()); + c->output.add (substitute[iter.get_coverage ()]); + } + } + inline const Coverage &get_coverage (void) const { return this+coverage; @@ -182,6 +201,16 @@ struct SingleSubst } } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const + { + TRACE_CLOSURE (); + switch (u.format) { + case 1: u.format1.collect_glyphs (c); break; + case 2: u.format2.collect_glyphs (c); break; + default: break; + } + } + inline const Coverage &get_coverage (void) const { switch (u.format) { @@ -261,6 +290,13 @@ struct Sequence c->glyphs->add (substitute[i]); } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const + { + unsigned int count = substitute.len; + for (unsigned int i = 0; i < count; i++) + c->output.add (substitute[i]); + } + inline bool apply (hb_apply_context_t *c) const { TRACE_APPLY (); @@ -316,6 +352,14 @@ struct MultipleSubstFormat1 } } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const + { + (this+coverage).add_coverage (&c->input); + unsigned int count = sequence.len; + for (unsigned int i = 0; i < count; i++) + (this+sequence[i]).collect_glyphs (c); + } + inline const Coverage &get_coverage (void) const { return this+coverage; @@ -382,6 +426,14 @@ struct MultipleSubst } } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const + { + switch (u.format) { + case 1: u.format1.collect_glyphs (c); break; + default: break; + } + } + inline const Coverage &get_coverage (void) const { switch (u.format) { @@ -455,6 +507,18 @@ struct AlternateSubstFormat1 } } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const + { + Coverage::Iter iter; + for (iter.init (this+coverage); iter.more (); iter.next ()) { + c->input.add (iter.get_glyph ()); + const AlternateSet &alt_set = this+alternateSet[iter.get_coverage ()]; + unsigned int count = alt_set.len; + for (unsigned int i = 0; i < count; i++) + c->output.add (alt_set[i]); + } + } + inline const Coverage &get_coverage (void) const { return this+coverage; @@ -539,6 +603,14 @@ struct AlternateSubst } } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const + { + switch (u.format) { + case 1: u.format1.collect_glyphs (c); break; + default: break; + } + } + inline const Coverage &get_coverage (void) const { switch (u.format) { @@ -605,6 +677,14 @@ struct Ligature c->glyphs->add (ligGlyph); } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const + { + unsigned int count = component.len; + for (unsigned int i = 1; i < count; i++) + c->input.add (component[i]); + c->output.add (ligGlyph); + } + inline bool would_apply (hb_would_apply_context_t *c) const { if (c->len != component.len) @@ -693,6 +773,13 @@ struct LigatureSet (this+ligature[i]).closure (c); } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const + { + unsigned int num_ligs = ligature.len; + for (unsigned int i = 0; i < num_ligs; i++) + (this+ligature[i]).collect_glyphs (c); + } + inline bool would_apply (hb_would_apply_context_t *c) const { unsigned int num_ligs = ligature.len; @@ -767,6 +854,15 @@ struct LigatureSubstFormat1 } } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const + { + Coverage::Iter iter; + for (iter.init (this+coverage); iter.more (); iter.next ()) { + c->input.add (iter.get_glyph ()); + (this+ligatureSet[iter.get_coverage ()]).collect_glyphs (c); + } + } + inline const Coverage &get_coverage (void) const { return this+coverage; @@ -844,6 +940,14 @@ struct LigatureSubst } } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const + { + switch (u.format) { + case 1: u.format1.collect_glyphs (c); break; + default: break; + } + } + inline const Coverage &get_coverage (void) const { switch (u.format) { @@ -907,6 +1011,7 @@ struct LigatureSubst static inline bool substitute_lookup (hb_apply_context_t *c, unsigned int lookup_index); static inline void closure_lookup (hb_closure_context_t *c, unsigned int lookup_index); +static inline void collect_glyphs_lookup (hb_collect_glyphs_context_t *c, unsigned int lookup_index); struct ContextSubst : Context { @@ -920,6 +1025,11 @@ struct ContextSubst : Context return Context::closure (c, closure_lookup); } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const + { + return Context::collect_glyphs (c, collect_glyphs_lookup); + } + inline bool apply (hb_apply_context_t *c) const { TRACE_APPLY (); @@ -939,6 +1049,11 @@ struct ChainContextSubst : ChainContext return ChainContext::closure (c, closure_lookup); } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const + { + return ChainContext::collect_glyphs (c, collect_glyphs_lookup); + } + inline bool apply (hb_apply_context_t *c) const { TRACE_APPLY (); @@ -962,6 +1077,8 @@ struct ExtensionSubst : Extension inline void closure (hb_closure_context_t *c) const; + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const; + inline const Coverage &get_coverage (void) const; inline bool would_apply (hb_would_apply_context_t *c) const; @@ -1005,6 +1122,28 @@ struct ReverseChainSingleSubstFormat1 } } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const + { + const OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (backtrack); + + unsigned int count; + + (this+coverage).add_coverage (&c->input); + + count = backtrack.len; + for (unsigned int i = 0; i < count; i++) + (this+backtrack[i]).add_coverage (&c->before); + + count = lookahead.len; + for (unsigned int i = 0; i < count; i++) + (this+lookahead[i]).add_coverage (&c->after); + + const ArrayOf<GlyphID> &substitute = StructAfter<ArrayOf<GlyphID> > (lookahead); + count = substitute.len; + for (unsigned int i = 0; i < count; i++) + c->output.add (substitute[i]); + } + inline const Coverage &get_coverage (void) const { return this+coverage; @@ -1084,6 +1223,14 @@ struct ReverseChainSingleSubst } } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const + { + switch (u.format) { + case 1: u.format1.collect_glyphs (c); break; + default: break; + } + } + inline const Coverage &get_coverage (void) const { switch (u.format) { @@ -1155,6 +1302,22 @@ struct SubstLookupSubTable } } + inline void collect_glyphs (hb_collect_glyphs_context_t *c, + unsigned int lookup_type) const + { + switch (lookup_type) { + case Single: u.single.collect_glyphs (c); break; + case Multiple: u.multiple.collect_glyphs (c); break; + case Alternate: u.alternate.collect_glyphs (c); break; + case Ligature: u.ligature.collect_glyphs (c); break; + case Context: u.context.collect_glyphs (c); break; + case ChainContext: u.chainContext.collect_glyphs (c); break; + case Extension: u.extension.collect_glyphs (c); break; + case ReverseChainSingle: u.reverseChainContextSingle.collect_glyphs (c); break; + default: break; + } + } + inline const Coverage &get_coverage (unsigned int lookup_type) const { switch (lookup_type) { @@ -1286,6 +1449,14 @@ struct SubstLookup : Lookup } } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const + { + unsigned int lookup_type = get_type (); + unsigned int count = get_subtable_count (); + for (unsigned int i = 0; i < count; i++) + get_subtable (i).collect_glyphs (c, lookup_type); + } + inline bool would_apply (hb_would_apply_context_t *c, const hb_set_digest_t *digest) const { if (unlikely (!c->len)) return false; @@ -1506,6 +1677,11 @@ inline void ExtensionSubst::closure (hb_closure_context_t *c) const get_subtable ().closure (c, get_type ()); } +inline void ExtensionSubst::collect_glyphs (hb_collect_glyphs_context_t *c) const +{ + get_subtable ().collect_glyphs (c, get_type ()); +} + inline const Coverage & ExtensionSubst::get_coverage (void) const { return get_subtable ().get_coverage (get_type ()); @@ -1552,6 +1728,15 @@ static inline void closure_lookup (hb_closure_context_t *c, unsigned int lookup_ c->nesting_level_left++; } +static inline void collect_glyphs_lookup (hb_collect_glyphs_context_t *c, unsigned int lookup_index) +{ + const GSUB &gsub = *(hb_ot_layout_from_face (c->face)->gsub); + const SubstLookup &l = gsub.get_lookup (lookup_index); + + /* XXX TODO */ + l.collect_glyphs (c); +} + static inline bool substitute_lookup (hb_apply_context_t *c, unsigned int lookup_index) { const GSUB &gsub = *(hb_ot_layout_from_face (c->face)->gsub); diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index 66e37a6..4272681 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -93,6 +93,40 @@ struct hb_would_apply_context_t }; + +/* TODO Add TRACE_RETURN annotation to gsub. */ +#ifndef HB_DEBUG_COLLECT_GLYPHS +#define HB_DEBUG_COLLECT_GLYPHS (HB_DEBUG+0) +#endif + +#define TRACE_COLLECT_GLYPHS() \ + hb_auto_trace_t<HB_DEBUG_COLLECT_GLYPHS> trace (&c->debug_depth, "COLLECT_GLYPHS", this, HB_FUNC, ""); + + +struct hb_collect_glyphs_context_t +{ + hb_face_t *face; + hb_set_t &before; + hb_set_t &input; + hb_set_t &after; + hb_set_t &output; + unsigned int debug_depth; + + hb_collect_glyphs_context_t (hb_face_t *face_, + hb_set_t *glyphs_before, /* OUT. May be NULL */ + hb_set_t *glyphs_input, /* OUT. May be NULL */ + hb_set_t *glyphs_after, /* OUT. May be NULL */ + hb_set_t *glyphs_output /* OUT. May be NULL */) : + face (face_), + before (glyphs_before ? *glyphs_before : *hb_set_get_empty ()), + input (glyphs_input ? *glyphs_input : *hb_set_get_empty ()), + after (glyphs_after ? *glyphs_after : *hb_set_get_empty ()), + output (glyphs_output ? *glyphs_output : *hb_set_get_empty ()), + debug_depth (0) {}; +}; + + + #ifndef HB_DEBUG_APPLY #define HB_DEBUG_APPLY (HB_DEBUG+0) #endif @@ -341,6 +375,7 @@ struct hb_apply_context_t typedef bool (*intersects_func_t) (hb_set_t *glyphs, const USHORT &value, const void *data); typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const USHORT &value, const void *data); typedef void (*closure_lookup_func_t) (hb_closure_context_t *c, unsigned int lookup_index); +typedef void (*collect_glyphs_lookup_func_t) (hb_collect_glyphs_context_t *c, unsigned int lookup_index); typedef bool (*apply_lookup_func_t) (hb_apply_context_t *c, unsigned int lookup_index); struct ContextClosureFuncs @@ -1105,6 +1140,17 @@ struct Context } } + inline void collect_glyphs (hb_collect_glyphs_context_t *c, collect_glyphs_lookup_func_t closure_func) const + { + TRACE_CLOSURE (); + switch (u.format) { +// case 1: u.format1.collect_glyphs (c); break; +// case 2: u.format2.collect_glyphs (c); break; +// case 3: u.format2.collect_glyphs (c); break; + default: break; + } + } + inline const Coverage &get_coverage (void) const { switch (u.format) { @@ -1648,6 +1694,17 @@ struct ChainContext } } + inline void collect_glyphs (hb_collect_glyphs_context_t *c, collect_glyphs_lookup_func_t closure_func) const + { + TRACE_CLOSURE (); + switch (u.format) { +// case 1: u.format1.collect_glyphs (c); break; +// case 2: u.format2.collect_glyphs (c); break; +// case 3: u.format2.collect_glyphs (c); break; + default: break; + } + } + inline const Coverage &get_coverage (void) const { switch (u.format) { diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index a0c9fe8..580f95d 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -401,6 +401,35 @@ hb_ot_layout_feature_get_lookups (hb_face_t *face, return f.get_lookup_indexes (start_offset, lookup_count, lookup_indexes); } +void +hb_ot_layout_lookup_collect_glyphs (hb_face_t *face, + hb_tag_t table_tag, + unsigned int lookup_index, + hb_set_t *glyphs_before, /* OUT. May be NULL */ + hb_set_t *glyphs_input, /* OUT. May be NULL */ + hb_set_t *glyphs_after, /* OUT. May be NULL */ + hb_set_t *glyphs_output /* OUT. May be NULL */) +{ + if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return; + + OT::hb_collect_glyphs_context_t c (face, glyphs_before, glyphs_input, glyphs_after, glyphs_output); + + switch (table_tag) { + case HB_OT_TAG_GSUB: + { + const OT::SubstLookup& l = hb_ot_layout_from_face (face)->gsub->get_lookup (lookup_index); + l.collect_glyphs (&c); + return; + } + case HB_OT_TAG_GPOS: + { + const OT::PosLookup& l = hb_ot_layout_from_face (face)->gpos->get_lookup (lookup_index); +// l.collect_glyphs (&c); + return; + } + } +} + /* * OT::GSUB diff --git a/src/hb-ot-layout.h b/src/hb-ot-layout.h index 4a023c4..f97c893 100644 --- a/src/hb-ot-layout.h +++ b/src/hb-ot-layout.h @@ -194,16 +194,14 @@ hb_ot_shape_plan_collect_lookups (hb_shape_plan_t *shape_plan, hb_tag_t table_tag, hb_set_t *lookup_indexes /* OUT */); -#ifdef HB_NOT_IMPLEMENTED void -Xhb_ot_layout_lookup_collect_glyphs (hb_face_t *face, +hb_ot_layout_lookup_collect_glyphs (hb_face_t *face, hb_tag_t table_tag, unsigned int lookup_index, hb_set_t *glyphs_before, /* OUT. May be NULL */ hb_set_t *glyphs_input, /* OUT. May be NULL */ hb_set_t *glyphs_after, /* OUT. May be NULL */ hb_set_t *glyphs_output /* OUT. May be NULL */); -#endif #ifdef HB_NOT_IMPLEMENTED typedef struct commit 7d52e6601f0e695690cd168a288466746cf25300 Author: Behdad Esfahbod <beh...@behdad.org> Date: Fri Nov 16 18:49:54 2012 -0800 Whitespace diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc index 4152a39..dfb6341 100644 --- a/src/hb-coretext.cc +++ b/src/hb-coretext.cc @@ -212,26 +212,22 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan, CFDictionaryRef attrs = CFDictionaryCreate (kCFAllocatorDefault, (const void**) &kCTFontAttributeName, (const void**) &font_data->ct_font, - 1, // count of attributes + 1, /* count of attributes */ &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); - // TODO: support features + /* TODO: support features */ - // Now we can create an attributed string CFAttributedStringRef attr_string = CFAttributedStringCreate (kCFAllocatorDefault, string_ref, attrs); CFRelease (string_ref); CFRelease (attrs); - // Create the CoreText line from our string, then we're done with it CTLineRef line = CTLineCreateWithAttributedString (attr_string); CFRelease (attr_string); - // and finally retrieve the glyph data and store into the gfxTextRun CFArrayRef glyph_runs = CTLineGetGlyphRuns (line); unsigned int num_runs = CFArrayGetCount (glyph_runs); - // Iterate through the glyph runs. bool success = true; buffer->len = 0; @@ -246,11 +242,9 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan, buffer->ensure (buffer->len + num_glyphs); - // retrieve the laid-out glyph data from the CTRun - - // Testing indicates that CTRunGetGlyphsPtr (almost?) always succeeds, - // and so copying data to our own buffer with CTRunGetGlyphs will be - // extremely rare. + /* Testing indicates that CTRunGetGlyphsPtr (almost?) always succeeds, + * and so copying data to our own buffer with CTRunGetGlyphs will be + * extremely rare. */ unsigned int scratch_size; char *scratch = (char *) buffer->get_scratch_buffer (&scratch_size); @@ -294,7 +288,7 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan, info->codepoint = glyphs[j]; info->cluster = string_indices[j]; - // currently, we do all x-positioning by setting the advance, we never use x-offset + /* Currently, we do all x-positioning by setting the advance, we never use x-offset. */ info->mask = advance; info->var1.u32 = 0; info->var2.u32 = positions[j].y; @@ -316,12 +310,13 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan, pos->y_offset = info->var2.u32; } - // Fix up clusters so that we never return out-of-order indices; - // if core text has reordered glyphs, we'll merge them to the - // beginning of the reordered cluster. - // This does *not* mean we'll form the same clusters as Uniscribe - // or the native OT backend, only that the cluster indices will be - // non-decreasing in the output buffer. + /* Fix up clusters so that we never return out-of-order indices; + * if core text has reordered glyphs, we'll merge them to the + * beginning of the reordered cluster. + * + * This does *not* mean we'll form the same clusters as Uniscribe + * or the native OT backend, only that the cluster indices will be + * monotonic in the output buffer. */ if (HB_DIRECTION_IS_FORWARD (buffer->props.direction)) { unsigned int prev_cluster = 0; for (unsigned int i = 0; i < count; i++) { @@ -337,7 +332,6 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan, prev_cluster = curr_cluster; } } else { - // For RTL runs, we make them non-increasing instead. unsigned int prev_cluster = (unsigned int)-1; for (unsigned int i = 0; i < count; i++) { unsigned int curr_cluster = buffer->info[i].cluster; diff --git a/src/hb-icu-le.cc b/src/hb-icu-le.cc index d73752d..61099fe 100644 --- a/src/hb-icu-le.cc +++ b/src/hb-icu-le.cc @@ -115,7 +115,7 @@ _hb_icu_le_shape (hb_shape_plan_t *shape_plan, LEFontInstance *font_instance = HB_SHAPER_DATA_GET (font); le_int32 script_code = hb_icu_script_from_script (shape_plan->props.script); le_int32 language_code = -1 /* TODO */; - le_int32 typography_flags = 3; // essential for ligatures and kerning + le_int32 typography_flags = 3; /* Needed for ligatures and kerning */ LEErrorCode status = LE_NO_ERROR; le_engine *le = le_create ((const le_font *) font_instance, script_code, diff --git a/src/hb-old.cc b/src/hb-old.cc index 529bffa..7c3e370 100644 --- a/src/hb-old.cc +++ b/src/hb-old.cc @@ -100,7 +100,7 @@ hb_old_convertStringToGlyphIndices (HB_Font old_font, glyphs[i] = u; } - *numGlyphs = length; // XXX + *numGlyphs = length; /* XXX */ return true; } @@ -123,7 +123,7 @@ hb_old_canRender (HB_Font old_font, const HB_UChar16 *string, hb_uint32 length) { - return true; // TODO + return true; /* TODO */ } static HB_Error @@ -135,7 +135,7 @@ hb_old_getPointInOutline (HB_Font old_font, HB_Fixed *ypos, hb_uint32 *nPoints) { - return HB_Err_Ok; // TODO + return HB_Err_Ok; /* TODO */ } static void @@ -230,8 +230,8 @@ _hb_old_shaper_font_data_create (hb_font_t *font) data->klass = &hb_old_font_class; data->x_ppem = font->x_ppem; data->y_ppem = font->y_ppem; - data->x_scale = font->x_scale; // XXX - data->y_scale = font->y_scale; // XXX + data->x_scale = font->x_scale; /* XXX */ + data->y_scale = font->y_scale; /* XXX */ data->userData = font; return data; diff --git a/src/hb-open-file-private.hh b/src/hb-open-file-private.hh index 31fedfb..20d5e87 100644 --- a/src/hb-open-file-private.hh +++ b/src/hb-open-file-private.hh @@ -255,7 +255,7 @@ struct OpenTypeFontFile }; -} // namespace OT +} /* namespace OT */ #endif /* HB_OPEN_FILE_PRIVATE_HH */ diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh index 8595038..2e03dc3 100644 --- a/src/hb-open-type-private.hh +++ b/src/hb-open-type-private.hh @@ -922,7 +922,7 @@ struct SortedArrayOf : ArrayOf<Type> { }; -} // namespace OT +} /* namespace OT */ #endif /* HB_OPEN_TYPE_PRIVATE_HH */ diff --git a/src/hb-ot-head-table.hh b/src/hb-ot-head-table.hh index 3949531..b3b3a14 100644 --- a/src/hb-ot-head-table.hh +++ b/src/hb-ot-head-table.hh @@ -143,7 +143,7 @@ struct head }; -} // namespace OT +} /* namespace OT */ #endif /* HB_OT_HEAD_TABLE_HH */ diff --git a/src/hb-ot-hhea-table.hh b/src/hb-ot-hhea-table.hh index 5009e6b..fa3088c 100644 --- a/src/hb-ot-hhea-table.hh +++ b/src/hb-ot-hhea-table.hh @@ -91,7 +91,7 @@ struct hhea }; -} // namespace OT +} /* namespace OT */ #endif /* HB_OT_HHEA_TABLE_HH */ diff --git a/src/hb-ot-hmtx-table.hh b/src/hb-ot-hmtx-table.hh index feb6016..e09996c 100644 --- a/src/hb-ot-hmtx-table.hh +++ b/src/hb-ot-hmtx-table.hh @@ -86,7 +86,7 @@ struct hmtx }; -} // namespace OT +} /* namespace OT */ #endif /* HB_OT_HMTX_TABLE_HH */ diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh index 0696e47..54f5936 100644 --- a/src/hb-ot-layout-common-private.hh +++ b/src/hb-ot-layout-common-private.hh @@ -878,7 +878,7 @@ struct Device }; -} // namespace OT +} /* namespace OT */ #endif /* HB_OT_LAYOUT_COMMON_PRIVATE_HH */ diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh index 0ab2bc2..900dedd 100644 --- a/src/hb-ot-layout-gdef-table.hh +++ b/src/hb-ot-layout-gdef-table.hh @@ -425,7 +425,7 @@ struct GDEF }; -} // namespace OT +} /* namespace OT */ #endif /* HB_OT_LAYOUT_GDEF_TABLE_HH */ diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index d0f228d..afe18b5 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -1712,7 +1712,7 @@ static inline bool position_lookup (hb_apply_context_t *c, unsigned int lookup_i #undef cursive_chain -} // namespace OT +} /* namespace OT */ #endif /* HB_OT_LAYOUT_GPOS_TABLE_HH */ diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index e5058c6..6e185ba 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -1567,7 +1567,7 @@ static inline bool substitute_lookup (hb_apply_context_t *c, unsigned int lookup } -} // namespace OT +} /* namespace OT */ #endif /* HB_OT_LAYOUT_GSUB_TABLE_HH */ diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index dd0ef63..66e37a6 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -1820,7 +1820,7 @@ struct GSUBGPOS }; -} // namespace OT +} /* namespace OT */ #endif /* HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH */ diff --git a/src/hb-ot-maxp-table.hh b/src/hb-ot-maxp-table.hh index 9e113c7..ef2b9f1 100644 --- a/src/hb-ot-maxp-table.hh +++ b/src/hb-ot-maxp-table.hh @@ -63,7 +63,7 @@ struct maxp }; -} // namespace OT +} /* namespace OT */ #endif /* HB_OT_MAXP_TABLE_HH */ diff --git a/src/hb-ot-name-table.hh b/src/hb-ot-name-table.hh index 6cc7a5e..ab7a692 100644 --- a/src/hb-ot-name-table.hh +++ b/src/hb-ot-name-table.hh @@ -126,7 +126,7 @@ struct name }; -} // namespace OT +} /* namespace OT */ #endif /* HB_OT_NAME_TABLE_HH */ diff --git a/src/hb-ot-shape-complex-default.cc b/src/hb-ot-shape-complex-default.cc index 6a17330..5340293 100644 --- a/src/hb-ot-shape-complex-default.cc +++ b/src/hb-ot-shape-complex-default.cc @@ -90,114 +90,115 @@ compose_default (const hb_ot_shape_normalize_context_t *c, hb_codepoint_t *ab) { /* Hebrew presentation-form shaping. - * https://bugzilla.mozilla.org/show_bug.cgi?id=728866 */ - // Hebrew presentation forms with dagesh, for characters 0x05D0..0x05EA; - // note that some letters do not have a dagesh presForm encoded + * https://bugzilla.mozilla.org/show_bug.cgi?id=728866 + * Hebrew presentation forms with dagesh, for characters 0x05D0..0x05EA; + * Note that some letters do not have a dagesh presForm encoded. + */ static const hb_codepoint_t sDageshForms[0x05EA - 0x05D0 + 1] = { - 0xFB30, // ALEF - 0xFB31, // BET - 0xFB32, // GIMEL - 0xFB33, // DALET - 0xFB34, // HE - 0xFB35, // VAV - 0xFB36, // ZAYIN - 0, // HET - 0xFB38, // TET - 0xFB39, // YOD - 0xFB3A, // FINAL KAF - 0xFB3B, // KAF - 0xFB3C, // LAMED - 0, // FINAL MEM - 0xFB3E, // MEM - 0, // FINAL NUN - 0xFB40, // NUN - 0xFB41, // SAMEKH - 0, // AYIN - 0xFB43, // FINAL PE - 0xFB44, // PE - 0, // FINAL TSADI - 0xFB46, // TSADI - 0xFB47, // QOF - 0xFB48, // RESH - 0xFB49, // SHIN - 0xFB4A // TAV + 0xFB30, /* ALEF */ + 0xFB31, /* BET */ + 0xFB32, /* GIMEL */ + 0xFB33, /* DALET */ + 0xFB34, /* HE */ + 0xFB35, /* VAV */ + 0xFB36, /* ZAYIN */ + 0x0000, /* HET */ + 0xFB38, /* TET */ + 0xFB39, /* YOD */ + 0xFB3A, /* FINAL KAF */ + 0xFB3B, /* KAF */ + 0xFB3C, /* LAMED */ + 0x0000, /* FINAL MEM */ + 0xFB3E, /* MEM */ + 0x0000, /* FINAL NUN */ + 0xFB40, /* NUN */ + 0xFB41, /* SAMEKH */ + 0x0000, /* AYIN */ + 0xFB43, /* FINAL PE */ + 0xFB44, /* PE */ + 0x0000, /* FINAL TSADI */ + 0xFB46, /* TSADI */ + 0xFB47, /* QOF */ + 0xFB48, /* RESH */ + 0xFB49, /* SHIN */ + 0xFB4A /* TAV */ }; bool found = c->unicode->compose (a, b, ab); if (!found && (b & ~0x7F) == 0x0580) { - // special-case Hebrew presentation forms that are excluded from - // standard normalization, but wanted for old fonts + /* Special-case Hebrew presentation forms that are excluded from + * standard normalization, but wanted for old fonts. */ switch (b) { - case 0x05B4: // HIRIQ - if (a == 0x05D9) { // YOD + case 0x05B4: /* HIRIQ */ + if (a == 0x05D9) { /* YOD */ *ab = 0xFB1D; found = true; } break; - case 0x05B7: // patah - if (a == 0x05F2) { // YIDDISH YOD YOD + case 0x05B7: /* patah */ + if (a == 0x05F2) { /* YIDDISH YOD YOD */ *ab = 0xFB1F; found = true; - } else if (a == 0x05D0) { // ALEF + } else if (a == 0x05D0) { /* ALEF */ *ab = 0xFB2E; found = true; } break; - case 0x05B8: // QAMATS - if (a == 0x05D0) { // ALEF + case 0x05B8: /* QAMATS */ + if (a == 0x05D0) { /* ALEF */ *ab = 0xFB2F; found = true; } break; - case 0x05B9: // HOLAM - if (a == 0x05D5) { // VAV + case 0x05B9: /* HOLAM */ + if (a == 0x05D5) { /* VAV */ *ab = 0xFB4B; found = true; } break; - case 0x05BC: // DAGESH + case 0x05BC: /* DAGESH */ if (a >= 0x05D0 && a <= 0x05EA) { *ab = sDageshForms[a - 0x05D0]; found = (*ab != 0); - } else if (a == 0xFB2A) { // SHIN WITH SHIN DOT + } else if (a == 0xFB2A) { /* SHIN WITH SHIN DOT */ *ab = 0xFB2C; found = true; - } else if (a == 0xFB2B) { // SHIN WITH SIN DOT + } else if (a == 0xFB2B) { /* SHIN WITH SIN DOT */ *ab = 0xFB2D; found = true; } break; - case 0x05BF: // RAFE + case 0x05BF: /* RAFE */ switch (a) { - case 0x05D1: // BET + case 0x05D1: /* BET */ *ab = 0xFB4C; found = true; break; - case 0x05DB: // KAF + case 0x05DB: /* KAF */ *ab = 0xFB4D; found = true; break; - case 0x05E4: // PE + case 0x05E4: /* PE */ *ab = 0xFB4E; found = true; break; } break; - case 0x05C1: // SHIN DOT - if (a == 0x05E9) { // SHIN + case 0x05C1: /* SHIN DOT */ + if (a == 0x05E9) { /* SHIN */ *ab = 0xFB2A; found = true; - } else if (a == 0xFB49) { // SHIN WITH DAGESH + } else if (a == 0xFB49) { /* SHIN WITH DAGESH */ *ab = 0xFB2C; found = true; } break; - case 0x05C2: // SIN DOT - if (a == 0x05E9) { // SHIN + case 0x05C2: /* SIN DOT */ + if (a == 0x05E9) { /* SHIN */ *ab = 0xFB2B; found = true; - } else if (a == 0xFB49) { // SHIN WITH DAGESH + } else if (a == 0xFB49) { /* SHIN WITH DAGESH */ *ab = 0xFB2D; found = true; } diff --git a/src/hb-tt-font.cc b/src/hb-tt-font.cc index b7198ef..c503a40 100644 --- a/src/hb-tt-font.cc +++ b/src/hb-tt-font.cc @@ -68,7 +68,7 @@ _hb_tt_font_destroy (hb_tt_font_t *tt) static inline const hhea& _get_hhea (hb_face_t *face) { -// return likely (face->tt && face->tt->hhea) ? *face->tt->hhea : Null(hhea); + return likely (face->tt && face->tt->hhea) ? *face->tt->hhea : Null(hhea); } commit 51bb498b7b07bff4a447405b72f09b68d07a3e95 Author: Behdad Esfahbod <beh...@behdad.org> Date: Fri Nov 16 14:08:05 2012 -0800 Minor diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 2259b94..96461d7 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -577,6 +577,7 @@ hb_ot_shape_plan_collect_lookups (hb_shape_plan_t *shape_plan, hb_tag_t table_tag, hb_set_t *lookup_indexes /* OUT */) { + /* XXX Does the first part always succeed? */ HB_SHAPER_DATA_GET (shape_plan)->collect_lookups (table_tag, lookup_indexes); } commit 89ca8eeb83fedde06727d386369a0a39d410f12b Author: Behdad Esfahbod <beh...@behdad.org> Date: Fri Nov 16 13:53:40 2012 -0800 Implement hb_ot_layout_get_glyphs_in_class() diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh index bfb3bdb..0696e47 100644 --- a/src/hb-ot-layout-common-private.hh +++ b/src/hb-ot-layout-common-private.hh @@ -686,6 +686,14 @@ struct ClassDefFormat1 return TRACE_RETURN (c->check_struct (this) && classValue.sanitize (c)); } + template <typename set_t> + inline void add_class (set_t *glyphs, unsigned int klass) const { + unsigned int count = classValue.len; + for (unsigned int i = 0; i < count; i++) + if (classValue[i] == klass) + glyphs->add (startGlyph + i); + } + inline bool intersects_class (const hb_set_t *glyphs, unsigned int klass) const { unsigned int count = classValue.len; for (unsigned int i = 0; i < count; i++) @@ -721,6 +729,14 @@ struct ClassDefFormat2 return TRACE_RETURN (rangeRecord.sanitize (c)); } + template <typename set_t> + inline void add_class (set_t *glyphs, unsigned int klass) const { + unsigned int count = rangeRecord.len; + for (unsigned int i = 0; i < count; i++) + if (rangeRecord[i].value == klass) + rangeRecord[i].add_coverage (glyphs); + } + inline bool intersects_class (const hb_set_t *glyphs, unsigned int klass) const { unsigned int count = rangeRecord.len; for (unsigned int i = 0; i < count; i++) @@ -761,6 +777,14 @@ struct ClassDef } } + inline void add_class (hb_set_t *glyphs, unsigned int klass) const { + switch (u.format) { + case 1: u.format1.add_class (glyphs, klass); return; + case 2: u.format2.add_class (glyphs, klass); return; + default:return; + } + } + inline bool intersects_class (const hb_set_t *glyphs, unsigned int klass) const { switch (u.format) { case 1: return u.format1.intersects_class (glyphs, klass); diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh index e7fb42f..0ab2bc2 100644 --- a/src/hb-ot-layout-gdef-table.hh +++ b/src/hb-ot-layout-gdef-table.hh @@ -337,6 +337,8 @@ struct GDEF inline bool has_glyph_classes (void) const { return glyphClassDef != 0; } inline unsigned int get_glyph_class (hb_codepoint_t glyph) const { return (this+glyphClassDef).get_class (glyph); } + inline void get_glyphs_in_class (unsigned int klass, hb_set_t *glyphs) const + { (this+glyphClassDef).add_class (glyphs, klass); } inline bool has_mark_attachment_types (void) const { return markAttachClassDef != 0; } inline unsigned int get_mark_attachment_type (hb_codepoint_t glyph) const diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 8b827a6..a0c9fe8 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -128,6 +128,14 @@ hb_ot_layout_get_glyph_class (hb_face_t *face, return (hb_ot_layout_glyph_class_t) _get_gdef (face).get_glyph_class (glyph); } +void +hb_ot_layout_get_glyphs_in_class (hb_face_t *face, + hb_ot_layout_glyph_class_t klass, + hb_set_t *glyphs /* OUT */) +{ + return _get_gdef (face).get_glyphs_in_class (klass, glyphs); +} + unsigned int hb_ot_layout_get_attach_points (hb_face_t *face, hb_codepoint_t glyph, diff --git a/src/hb-ot-layout.h b/src/hb-ot-layout.h index 0128534..4a023c4 100644 --- a/src/hb-ot-layout.h +++ b/src/hb-ot-layout.h @@ -62,11 +62,10 @@ hb_ot_layout_glyph_class_t hb_ot_layout_get_glyph_class (hb_face_t *face, hb_codepoint_t glyph); -#ifdef HB_NOT_IMPLEMENTED -Xhb_ot_layout_get_glyphs_in_class (hb_face_t *face, +void +hb_ot_layout_get_glyphs_in_class (hb_face_t *face, hb_ot_layout_glyph_class_t klass, hb_set_t *glyphs /* OUT */); -#endif /* Not that useful. Provides list of attach points for a glyph that a commit 5a08ecf9200a6ac9b4ebb7ec5c13dcb42d8820ce Author: Behdad Esfahbod <beh...@behdad.org> Date: Fri Nov 16 13:34:29 2012 -0800 Implement hb_ot_layout_get_glyph_class() diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh index 92ae1cf..e7fb42f 100644 --- a/src/hb-ot-layout-gdef-table.hh +++ b/src/hb-ot-layout-gdef-table.hh @@ -383,13 +383,13 @@ struct GDEF switch (klass) { default: - case UnclassifiedGlyph: return HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED; - case BaseGlyph: return HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH; - case LigatureGlyph: return HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE; - case ComponentGlyph: return HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT; + case UnclassifiedGlyph: return HB_OT_LAYOUT_GLYPH_PROPS_UNCLASSIFIED; + case BaseGlyph: return HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH; + case LigatureGlyph: return HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE; + case ComponentGlyph: return HB_OT_LAYOUT_GLYPH_PROPS_COMPONENT; case MarkGlyph: klass = get_mark_attachment_type (glyph); - return HB_OT_LAYOUT_GLYPH_CLASS_MARK | (klass << 8); + return HB_OT_LAYOUT_GLYPH_PROPS_MARK | (klass << 8); } } diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 41cb93d..d0f228d 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -863,7 +863,7 @@ struct CursivePosFormat1 TRACE_APPLY (); /* We don't handle mark glyphs here. */ - if (c->property & HB_OT_LAYOUT_GLYPH_CLASS_MARK) return TRACE_RETURN (false); + if (c->property & HB_OT_LAYOUT_GLYPH_PROPS_MARK) return TRACE_RETURN (false); hb_apply_context_t::mark_skipping_forward_iterator_t skippy_iter (c, c->buffer->idx, 1); if (skippy_iter.has_no_chance ()) return TRACE_RETURN (false); @@ -1030,7 +1030,7 @@ struct MarkBasePosFormat1 } while (1); /* The following assertion is too strong, so we've disabled it. */ - if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH)) {/*return TRACE_RETURN (false);*/} + if (!(property & HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH)) {/*return TRACE_RETURN (false);*/} unsigned int base_index = (this+baseCoverage) (c->buffer->info[skippy_iter.idx].codepoint); if (base_index == NOT_COVERED) return TRACE_RETURN (false); @@ -1136,7 +1136,7 @@ struct MarkLigPosFormat1 if (!skippy_iter.prev (&property, LookupFlag::IgnoreMarks)) return TRACE_RETURN (false); /* The following assertion is too strong, so we've disabled it. */ - if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE)) {/*return TRACE_RETURN (false);*/} + if (!(property & HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE)) {/*return TRACE_RETURN (false);*/} unsigned int j = skippy_iter.idx; unsigned int lig_index = (this+ligatureCoverage) (c->buffer->info[j].codepoint); @@ -1258,7 +1258,7 @@ struct MarkMarkPosFormat1 hb_apply_context_t::mark_skipping_backward_iterator_t skippy_iter (c, c->buffer->idx, 1); if (!skippy_iter.prev (&property)) return TRACE_RETURN (false); - if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK)) return TRACE_RETURN (false); + if (!(property & HB_OT_LAYOUT_GLYPH_PROPS_MARK)) return TRACE_RETURN (false); unsigned int j = skippy_iter.idx; diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 05b18cc..e5058c6 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -266,7 +266,7 @@ struct Sequence TRACE_APPLY (); if (unlikely (!substitute.len)) return TRACE_RETURN (false); - unsigned int klass = c->property & HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE ? HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH : 0; + unsigned int klass = c->property & HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE ? HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH : 0; unsigned int count = substitute.len; for (unsigned int i = 0; i < count; i++) { set_lig_props_for_component (c->buffer->cur(), i); diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index dd7bdd3..dd0ef63 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -264,7 +264,7 @@ struct hb_apply_context_t if (glyph_props & lookup_props & LookupFlag::IgnoreFlags) return false; - if (unlikely (glyph_props & HB_OT_LAYOUT_GLYPH_CLASS_MARK)) + if (unlikely (glyph_props & HB_OT_LAYOUT_GLYPH_PROPS_MARK)) return match_properties_mark (glyph, glyph_props, lookup_props); return true; @@ -295,7 +295,7 @@ struct hb_apply_context_t *property_out = property; /* If it's a mark, skip it if we don't accept it. */ - if (unlikely (property & HB_OT_LAYOUT_GLYPH_CLASS_MARK)) + if (unlikely (property & HB_OT_LAYOUT_GLYPH_PROPS_MARK)) return !match_properties (info->codepoint, property, lookup_props); /* If not a mark, don't skip. */ @@ -445,7 +445,7 @@ static inline bool match_input (hb_apply_context_t *c, * ligate with a conjunct...) */ - bool is_mark_ligature = !!(c->property & HB_OT_LAYOUT_GLYPH_CLASS_MARK); + bool is_mark_ligature = !!(c->property & HB_OT_LAYOUT_GLYPH_PROPS_MARK); unsigned int total_component_count = 0; total_component_count += get_lig_num_comps (c->buffer->cur()); @@ -478,7 +478,7 @@ static inline bool match_input (hb_apply_context_t *c, return TRACE_RETURN (false); } - is_mark_ligature = is_mark_ligature && (property & HB_OT_LAYOUT_GLYPH_CLASS_MARK); + is_mark_ligature = is_mark_ligature && (property & HB_OT_LAYOUT_GLYPH_PROPS_MARK); total_component_count += get_lig_num_comps (c->buffer->info[skippy_iter.idx]); } @@ -530,7 +530,7 @@ static inline void ligate_input (hb_apply_context_t *c, * https://bugzilla.gnome.org/show_bug.cgi?id=437633 */ - unsigned int klass = is_mark_ligature ? 0 : HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE; + unsigned int klass = is_mark_ligature ? 0 : HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE; unsigned int lig_id = is_mark_ligature ? 0 : allocate_lig_id (c->buffer); unsigned int last_lig_id = get_lig_id (c->buffer->cur()); unsigned int last_num_components = get_lig_num_comps (c->buffer->cur()); diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh index 055933f..49093de 100644 --- a/src/hb-ot-layout-private.hh +++ b/src/hb-ot-layout-private.hh @@ -49,6 +49,14 @@ * GDEF */ +typedef enum { + HB_OT_LAYOUT_GLYPH_PROPS_UNCLASSIFIED = 0x0001, + HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH = 0x0002, + HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE = 0x0004, + HB_OT_LAYOUT_GLYPH_PROPS_MARK = 0x0008, + HB_OT_LAYOUT_GLYPH_PROPS_COMPONENT = 0x0010 +} hb_ot_layout_glyph_class_mask_t; + /* @@ -115,7 +123,7 @@ get_lig_comp (const hb_glyph_info_t &info) static inline unsigned int get_lig_num_comps (const hb_glyph_info_t &info) { - if ((info.glyph_props() & HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE) && is_a_ligature (info)) + if ((info.glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE) && is_a_ligature (info)) return info.lig_props() & 0x0F; else return 1; diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index e57b765..8b827a6 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -121,6 +121,12 @@ hb_ot_layout_has_glyph_classes (hb_face_t *face) return _get_gdef (face).has_glyph_classes (); } +hb_ot_layout_glyph_class_t +hb_ot_layout_get_glyph_class (hb_face_t *face, + hb_codepoint_t glyph) +{ + return (hb_ot_layout_glyph_class_t) _get_gdef (face).get_glyph_class (glyph); +} unsigned int hb_ot_layout_get_attach_points (hb_face_t *face, diff --git a/src/hb-ot-layout.h b/src/hb-ot-layout.h index 7b53367..0128534 100644 --- a/src/hb-ot-layout.h +++ b/src/hb-ot-layout.h @@ -51,18 +51,16 @@ hb_bool_t hb_ot_layout_has_glyph_classes (hb_face_t *face); typedef enum { - HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED = 0x0001, - HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH = 0x0002, - HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE = 0x0004, - HB_OT_LAYOUT_GLYPH_CLASS_MARK = 0x0008, - HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT = 0x0010 + HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED = 0, + HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH = 1, + HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE = 2, + HB_OT_LAYOUT_GLYPH_CLASS_MARK = 3, + HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT = 4 } hb_ot_layout_glyph_class_t; -#ifdef HB_NOT_IMPLEMENTED hb_ot_layout_glyph_class_t -Xhb_ot_layout_get_glyph_class (hb_face_t *face, +hb_ot_layout_get_glyph_class (hb_face_t *face, hb_codepoint_t glyph); -#endif #ifdef HB_NOT_IMPLEMENTED Xhb_ot_layout_get_glyphs_in_class (hb_face_t *face, diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 8601127..2259b94 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -348,8 +348,8 @@ hb_synthesize_glyph_classes (hb_ot_shape_context_t *c) unsigned int count = c->buffer->len; for (unsigned int i = 0; i < count; i++) c->buffer->info[i].glyph_props() = _hb_glyph_info_get_general_category (&c->buffer->info[i]) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK ? - HB_OT_LAYOUT_GLYPH_CLASS_MARK : - HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH; + HB_OT_LAYOUT_GLYPH_PROPS_MARK : + HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH; } static inline void commit f9edd5d56bd219625f5b16b23eac53b4c4a8b194 Author: Behdad Esfahbod <beh...@behdad.org> Date: Fri Nov 16 13:23:37 2012 -0800 Implement hb_shape_plan_get_shaper() Untested. diff --git a/src/hb-shape-plan-private.hh b/src/hb-shape-plan-private.hh index c5a9927..dd014e3 100644 --- a/src/hb-shape-plan-private.hh +++ b/src/hb-shape-plan-private.hh @@ -43,6 +43,7 @@ struct hb_shape_plan_t hb_segment_properties_t props; hb_shape_func_t *shaper_func; + const char *shaper_name; struct hb_shaper_data_t shaper_data; }; diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc index d73a828..7735d4e 100644 --- a/src/hb-shape-plan.cc +++ b/src/hb-shape-plan.cc @@ -49,6 +49,7 @@ hb_shape_plan_plan (hb_shape_plan_t *shape_plan, HB_SHAPER_DATA (shaper, shape_plan) = \ HB_SHAPER_DATA_CREATE_FUNC (shaper, shape_plan) (shape_plan, user_features, num_user_features); \ shape_plan->shaper_func = _hb_##shaper##_shape; \ + shape_plan->shaper_name = #shaper; \ return; \ } \ } HB_STMT_END @@ -120,6 +121,7 @@ hb_shape_plan_get_empty (void) HB_SEGMENT_PROPERTIES_DEFAULT, /* props */ NULL, /* shaper_func */ + NULL, /* shaper_name */ { #define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID, @@ -298,3 +300,8 @@ retry: return hb_shape_plan_reference (shape_plan); } + +const char * +hb_shape_plan_get_shaper (hb_shape_plan_t *shape_plan) +{ +} diff --git a/src/hb-shape-plan.h b/src/hb-shape-plan.h index e4ea94b..8f54552 100644 --- a/src/hb-shape-plan.h +++ b/src/hb-shape-plan.h @@ -80,10 +80,8 @@ hb_shape_plan_execute (hb_shape_plan_t *shape_plan, const hb_feature_t *features, unsigned int num_features); -#ifdef HB_NOT_IMPLEMENTED const char * -Xhb_shape_plan_get_shaper (hb_shape_plan_t *shape_plan); -#endif +hb_shape_plan_get_shaper (hb_shape_plan_t *shape_plan); HB_END_DECLS _______________________________________________ HarfBuzz mailing list HarfBuzz@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/harfbuzz