提交 f45107fe 编写于 作者: B Behdad Esfahbod

[HB] More shuffling

上级 f8dc67b3
...@@ -29,6 +29,16 @@ ...@@ -29,6 +29,16 @@
#include "hb-ot-layout-gsubgpos-private.h" #include "hb-ot-layout-gsubgpos-private.h"
/* XXX */
#include "harfbuzz-impl.h"
HB_INTERNAL HB_Error
_hb_buffer_add_output_glyph_ids( HB_Buffer buffer,
HB_UShort num_in,
HB_UShort num_out,
const GlyphID *glyph_data,
HB_UShort component,
HB_UShort ligID );
struct SingleSubstFormat1 { struct SingleSubstFormat1 {
friend struct SingleSubst; friend struct SingleSubst;
...@@ -47,7 +57,7 @@ struct SingleSubstFormat1 { ...@@ -47,7 +57,7 @@ struct SingleSubstFormat1 {
} }
private: private:
USHORT substFormat; /* Format identifier--format = 1 */ USHORT format; /* Format identifier--format = 1 */
OffsetTo<Coverage> OffsetTo<Coverage>
coverage; /* Offset to Coverage table--from coverage; /* Offset to Coverage table--from
* beginning of Substitution table */ * beginning of Substitution table */
...@@ -74,7 +84,7 @@ struct SingleSubstFormat2 { ...@@ -74,7 +84,7 @@ struct SingleSubstFormat2 {
} }
private: private:
USHORT substFormat; /* Format identifier--format = 2 */ USHORT format; /* Format identifier--format = 2 */
OffsetTo<Coverage> OffsetTo<Coverage>
coverage; /* Offset to Coverage table--from coverage; /* Offset to Coverage table--from
* beginning of Substitution table */ * beginning of Substitution table */
...@@ -180,7 +190,7 @@ struct MultipleSubstFormat1 { ...@@ -180,7 +190,7 @@ struct MultipleSubstFormat1 {
} }
private: private:
USHORT substFormat; /* Format identifier--format = 1 */ USHORT format; /* Format identifier--format = 1 */
OffsetTo<Coverage> OffsetTo<Coverage>
coverage; /* Offset to Coverage table--from coverage; /* Offset to Coverage table--from
* beginning of Substitution table */ * beginning of Substitution table */
...@@ -258,7 +268,7 @@ struct AlternateSubstFormat1 { ...@@ -258,7 +268,7 @@ struct AlternateSubstFormat1 {
} }
private: private:
USHORT substFormat; /* Format identifier--format = 1 */ USHORT format; /* Format identifier--format = 1 */
OffsetTo<Coverage> OffsetTo<Coverage>
coverage; /* Offset to Coverage table--from coverage; /* Offset to Coverage table--from
* beginning of Substitution table */ * beginning of Substitution table */
...@@ -415,7 +425,7 @@ struct LigatureSubstFormat1 { ...@@ -415,7 +425,7 @@ struct LigatureSubstFormat1 {
} }
private: private:
USHORT substFormat; /* Format identifier--format = 1 */ USHORT format; /* Format identifier--format = 1 */
OffsetTo<Coverage> OffsetTo<Coverage>
coverage; /* Offset to Coverage table--from coverage; /* Offset to Coverage table--from
* beginning of Substitution table */ * beginning of Substitution table */
...@@ -504,7 +514,7 @@ struct ChainContextSubstFormat1 { ...@@ -504,7 +514,7 @@ struct ChainContextSubstFormat1 {
} }
private: private:
USHORT substFormat; /* Format identifier--format = 1 */ USHORT format; /* Format identifier--format = 1 */
Offset coverage; /* Offset to Coverage table--from Offset coverage; /* Offset to Coverage table--from
* beginning of Substitution table */ * beginning of Substitution table */
USHORT chainSubRuleSetCount; /* Number of ChainSubRuleSet USHORT chainSubRuleSetCount; /* Number of ChainSubRuleSet
...@@ -564,7 +574,7 @@ struct ChainContextSubstFormat2 { ...@@ -564,7 +574,7 @@ struct ChainContextSubstFormat2 {
} }
private: private:
USHORT substFormat; /* Format identifier--format = 2 */ USHORT format; /* Format identifier--format = 2 */
Offset coverage; /* Offset to Coverage table--from Offset coverage; /* Offset to Coverage table--from
* beginning of Substitution table */ * beginning of Substitution table */
Offset backtrackClassDef; /* Offset to glyph ClassDef table Offset backtrackClassDef; /* Offset to glyph ClassDef table
...@@ -594,7 +604,7 @@ struct ChainContextSubstFormat3 { ...@@ -594,7 +604,7 @@ struct ChainContextSubstFormat3 {
} }
private: private:
USHORT substFormat; /* Format identifier--format = 3 */ USHORT format; /* Format identifier--format = 3 */
USHORT backtrackGlyphCount; /* Number of glyphs in the backtracking USHORT backtrackGlyphCount; /* Number of glyphs in the backtracking
* sequence */ * sequence */
Offset backtrackCoverage[]; /* Array of offsets to coverage tables Offset backtrackCoverage[]; /* Array of offsets to coverage tables
...@@ -651,7 +661,7 @@ struct ExtensionSubstFormat1 { ...@@ -651,7 +661,7 @@ struct ExtensionSubstFormat1 {
inline bool substitute (LOOKUP_ARGS_DEF) const; inline bool substitute (LOOKUP_ARGS_DEF) const;
private: private:
USHORT substFormat; /* Format identifier. Set to 1. */ USHORT format; /* Format identifier. Set to 1. */
USHORT extensionLookupType; /* Lookup type of subtable referenced USHORT extensionLookupType; /* Lookup type of subtable referenced
* by ExtensionOffset (i.e. the * by ExtensionOffset (i.e. the
* extension subtable). */ * extension subtable). */
...@@ -697,7 +707,7 @@ struct ReverseChainSingleSubstFormat1 { ...@@ -697,7 +707,7 @@ struct ReverseChainSingleSubstFormat1 {
/* TODO */ /* TODO */
private: private:
USHORT substFormat; /* Format identifier--format = 1 */ USHORT format; /* Format identifier--format = 1 */
Offset coverage; /* Offset to Coverage table -- from Offset coverage; /* Offset to Coverage table -- from
* beginning of Substitution table */ * beginning of Substitution table */
USHORT backtrackGlyphCount; /* Number of glyphs in the backtracking USHORT backtrackGlyphCount; /* Number of glyphs in the backtracking
...@@ -740,17 +750,17 @@ struct SubstLookupSubTable { ...@@ -740,17 +750,17 @@ struct SubstLookupSubTable {
unsigned int lookup_type) const { unsigned int lookup_type) const {
switch (lookup_type) { switch (lookup_type) {
case GSUB_Single: return u.single.substitute (LOOKUP_ARGS); case GSUB_Single: return u.single->substitute (LOOKUP_ARGS);
case GSUB_Multiple: return u.multiple.substitute (LOOKUP_ARGS); case GSUB_Multiple: return u.multiple->substitute (LOOKUP_ARGS);
case GSUB_Alternate: return u.alternate.substitute (LOOKUP_ARGS); case GSUB_Alternate: return u.alternate->substitute (LOOKUP_ARGS);
case GSUB_Ligature: return u.ligature.substitute (LOOKUP_ARGS); case GSUB_Ligature: return u.ligature->substitute (LOOKUP_ARGS);
case GSUB_Context: return u.context.substitute (LOOKUP_ARGS); case GSUB_Context: return u.context->substitute (LOOKUP_ARGS);
/* /*
case GSUB_ChainingContext: return u.chainingContext.substitute (LOOKUP_ARGS); case GSUB_ChainingContext: return u.chainingContext->substitute (LOOKUP_ARGS);
*/ */
case GSUB_Extension: return u.extension.substitute (LOOKUP_ARGS); case GSUB_Extension: return u.extension->substitute (LOOKUP_ARGS);
/* /*
case GSUB_ReverseChainingContextSingle: return u.reverseChainingContextSingle.substitute (LOOKUP_ARGS); case GSUB_ReverseChainingContextSingle: return u.reverseChainingContextSingle->substitute (LOOKUP_ARGS);
*/ */
default:return false; default:return false;
} }
...@@ -758,21 +768,22 @@ struct SubstLookupSubTable { ...@@ -758,21 +768,22 @@ struct SubstLookupSubTable {
private: private:
union { union {
USHORT substFormat; USHORT format;
SingleSubst single; SingleSubst single[];
MultipleSubst multiple; MultipleSubst multiple[];
AlternateSubst alternate; AlternateSubst alternate[];
LigatureSubst ligature; LigatureSubst ligature[];
ContextSubst context; ContextSubst context[];
/* /*
ChainingContextSubst chainingContext; ChainingContextSubst chainingContext[];
*/ */
ExtensionSubst extension; ExtensionSubst extension[];
/* /*
ReverseChainingContextSingleSubst reverseChainingContextSingle; ReverseChainingContextSingleSubst reverseChainingContextSingle[];
*/ */
} u; } u;
}; };
ASSERT_SIZE (SubstLookupSubTable, 2);
struct SubstLookup : Lookup { struct SubstLookup : Lookup {
...@@ -790,7 +801,7 @@ struct SubstLookup : Lookup { ...@@ -790,7 +801,7 @@ struct SubstLookup : Lookup {
/* Return lookup type of first extension subtable. /* Return lookup type of first extension subtable.
* The spec says all of them should have the same type. * The spec says all of them should have the same type.
* XXX check for that somehow */ * XXX check for that somehow */
type = get_subtable(0).u.extension.get_type (); type = get_subtable(0).u.extension->get_type ();
} }
return type; return type;
...@@ -875,6 +886,7 @@ struct SubstLookup : Lookup { ...@@ -875,6 +886,7 @@ struct SubstLookup : Lookup {
return ret; return ret;
} }
}; };
ASSERT_SIZE (SubstLookup, 6);
/* /*
...@@ -899,8 +911,7 @@ struct GSUB : GSUBGPOS { ...@@ -899,8 +911,7 @@ struct GSUB : GSUBGPOS {
} }
}; };
ASSERT_SIZE (GSUB, 10);
/* Out-of-class implementation for methods chaining */ /* Out-of-class implementation for methods chaining */
......
...@@ -332,5 +332,35 @@ struct Context { ...@@ -332,5 +332,35 @@ struct Context {
}; };
ASSERT_SIZE (Context, 2); ASSERT_SIZE (Context, 2);
/*
* GSUB/GPOS Common
*/
struct GSUBGPOS {
static const hb_tag_t GSUBTag = HB_TAG ('G','S','U','B');
static const hb_tag_t GPOSTag = HB_TAG ('G','P','O','S');
STATIC_DEFINE_GET_FOR_DATA (GSUBGPOS);
/* XXX check version here? */
DEFINE_TAG_LIST_INTERFACE (Script, script ); /* get_script_count (), get_script (i), get_script_tag (i) */
DEFINE_TAG_LIST_INTERFACE (Feature, feature); /* get_feature_count(), get_feature(i), get_feature_tag(i) */
DEFINE_LIST_INTERFACE (Lookup, lookup ); /* get_lookup_count (), get_lookup (i) */
// LONGTERMTODO bsearch
DEFINE_TAG_FIND_INTERFACE (Script, script ); /* find_script_index (), get_script_by_tag (tag) */
DEFINE_TAG_FIND_INTERFACE (Feature, feature); /* find_feature_index(), get_feature_by_tag(tag) */
private:
Fixed_Version version; /* Version of the GSUB/GPOS table--initially set
* to 0x00010000 */
OffsetTo<ScriptList>
scriptList; /* ScriptList table */
OffsetTo<FeatureList>
featureList; /* FeatureList table */
OffsetTo<LookupList>
lookupList; /* LookupList table */
};
ASSERT_SIZE (GSUBGPOS, 10);
#endif /* HB_OT_LAYOUT_GSUBGPOS_PRIVATE_H */ #endif /* HB_OT_LAYOUT_GSUBGPOS_PRIVATE_H */
...@@ -908,45 +908,4 @@ struct Device { ...@@ -908,45 +908,4 @@ struct Device {
}; };
ASSERT_SIZE (Device, 6); ASSERT_SIZE (Device, 6);
/*
* GSUB/GPOS Common
*/
struct GSUBGPOS {
static const hb_tag_t GSUBTag = HB_TAG ('G','S','U','B');
static const hb_tag_t GPOSTag = HB_TAG ('G','P','O','S');
STATIC_DEFINE_GET_FOR_DATA (GSUBGPOS);
/* XXX check version here? */
DEFINE_TAG_LIST_INTERFACE (Script, script ); /* get_script_count (), get_script (i), get_script_tag (i) */
DEFINE_TAG_LIST_INTERFACE (Feature, feature); /* get_feature_count(), get_feature(i), get_feature_tag(i) */
DEFINE_LIST_INTERFACE (Lookup, lookup ); /* get_lookup_count (), get_lookup (i) */
// LONGTERMTODO bsearch
DEFINE_TAG_FIND_INTERFACE (Script, script ); /* find_script_index (), get_script_by_tag (tag) */
DEFINE_TAG_FIND_INTERFACE (Feature, feature); /* find_feature_index(), get_feature_by_tag(tag) */
private:
Fixed_Version version; /* Version of the GSUB/GPOS table--initially set
* to 0x00010000 */
OffsetTo<ScriptList>
scriptList; /* ScriptList table */
OffsetTo<FeatureList>
featureList; /* FeatureList table */
OffsetTo<LookupList>
lookupList; /* LookupList table */
};
ASSERT_SIZE (GSUBGPOS, 10);
/* XXX */
#include "harfbuzz-impl.h"
HB_INTERNAL HB_Error
_hb_buffer_add_output_glyph_ids( HB_Buffer buffer,
HB_UShort num_in,
HB_UShort num_out,
const GlyphID *glyph_data,
HB_UShort component,
HB_UShort ligID );
#endif /* HB_OT_LAYOUT_OPEN_PRIVATE_H */ #endif /* HB_OT_LAYOUT_OPEN_PRIVATE_H */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册