[HarfBuzz] harfbuzz: Branch 'master' - 5 commits
Simon Hausmann
hausmann at kemper.freedesktop.org
Tue Jun 15 05:58:53 PDT 2010
src/harfbuzz-buffer.h | 16 +++-
src/harfbuzz-dump.c | 10 +-
src/harfbuzz-gdef-private.h | 25 +++++--
src/harfbuzz-gdef.c | 4 +
src/harfbuzz-gdef.h | 21 +++---
src/harfbuzz-global.h | 4 +
src/harfbuzz-gpos-private.h | 35 ++++++----
src/harfbuzz-gpos.c | 73 +++++++++++++++------
src/harfbuzz-gpos.h | 6 +
src/harfbuzz-gsub-private.h | 151 +++++++++++++++++++++++---------------------
src/harfbuzz-gsub.h | 23 ++++--
src/harfbuzz-open-private.h | 6 -
src/harfbuzz-open.c | 36 +++++++++-
src/harfbuzz-open.h | 48 +++++++------
src/harfbuzz-shaper.h | 8 ++
src/harfbuzz-stream.h | 10 ++
16 files changed, 311 insertions(+), 165 deletions(-)
New commits:
commit 96a637dcc3399d5298ed458abdaa4e1317e9a46e
Author: Andreas Kling <andreas.kling at nokia.com>
Date: Tue Jun 15 11:32:13 2010 +0200
Reorder all internal Harfbuzz structures by member size.
Signed-off-by: Simon Hausmann <simon.hausmann at nokia.com>
Signed-off-by: Lars Knoll <lars.knoll at nokia.com>
diff --git a/src/harfbuzz-buffer.h b/src/harfbuzz-buffer.h
index 7e6ad83..0d7c2c2 100644
--- a/src/harfbuzz-buffer.h
+++ b/src/harfbuzz-buffer.h
@@ -52,13 +52,13 @@ typedef struct HB_PositionRec_ {
HB_Fixed y_advance;
HB_UShort back; /* number of glyphs to go back
for drawing current glyph */
+ HB_Short cursive_chain; /* character to which this connects,
+ may be positive or negative; used
+ only internally */
HB_Bool new_advance; /* if set, the advance width values are
absolute, i.e., they won't be
added to the original glyph's value
but rather replace them. */
- HB_Short cursive_chain; /* character to which this connects,
- may be positive or negative; used
- only internally */
} HB_PositionRec, *HB_Position;
@@ -70,12 +70,12 @@ typedef struct HB_BufferRec_{
HB_UInt in_pos;
HB_UInt out_pos;
- HB_Bool separate_out;
HB_GlyphItem in_string;
HB_GlyphItem out_string;
HB_GlyphItem alt_string;
HB_Position positions;
HB_UShort max_ligID;
+ HB_Bool separate_out;
} HB_BufferRec, *HB_Buffer;
HB_Error
diff --git a/src/harfbuzz-gdef-private.h b/src/harfbuzz-gdef-private.h
index da29d99..2a6d958 100644
--- a/src/harfbuzz-gdef-private.h
+++ b/src/harfbuzz-gdef-private.h
@@ -42,8 +42,8 @@ HB_BEGIN_HEADER
struct HB_AttachPoint_
{
- HB_UShort PointCount; /* size of the PointIndex array */
HB_UShort* PointIndex; /* array of contour points */
+ HB_UShort PointCount; /* size of the PointIndex array */
};
/* Ligature Caret related structures */
@@ -66,8 +66,8 @@ typedef struct HB_CaretValueFormat2_ HB_CaretValueFormat2;
struct HB_CaretValueFormat3_
{
- HB_Short Coordinate; /* x or y value (in design units) */
HB_Device* Device; /* Device table for x or y value */
+ HB_Short Coordinate; /* x or y value (in design units) */
};
typedef struct HB_CaretValueFormat3_ HB_CaretValueFormat3;
@@ -85,8 +85,6 @@ typedef struct HB_CaretValueFormat4_ HB_CaretValueFormat4;
struct HB_CaretValue_
{
- HB_Byte CaretValueFormat; /* 1, 2, 3, or 4 */
-
union
{
HB_CaretValueFormat1 cvf1;
@@ -96,6 +94,8 @@ struct HB_CaretValue_
HB_CaretValueFormat4 cvf4;
#endif
} cvf;
+
+ HB_Byte CaretValueFormat; /* 1, 2, 3, or 4 */
};
typedef struct HB_CaretValue_ HB_CaretValue;
@@ -103,10 +103,9 @@ typedef struct HB_CaretValue_ HB_CaretValue;
struct HB_LigGlyph_
{
- HB_Bool loaded;
-
- HB_UShort CaretCount; /* number of caret values */
HB_CaretValue* CaretValue; /* array of caret values */
+ HB_UShort CaretCount; /* number of caret values */
+ HB_Bool loaded;
};
diff --git a/src/harfbuzz-gdef.h b/src/harfbuzz-gdef.h
index 9b5dee0..f9a03dd 100644
--- a/src/harfbuzz-gdef.h
+++ b/src/harfbuzz-gdef.h
@@ -48,12 +48,11 @@ typedef struct HB_AttachPoint_ HB_AttachPoint;
struct HB_AttachList_
{
- HB_Bool loaded;
-
+ HB_AttachPoint* AttachPoint; /* array of AttachPoint tables */
HB_Coverage Coverage; /* Coverage table */
HB_UShort GlyphCount; /* number of glyphs with
attachments */
- HB_AttachPoint* AttachPoint; /* array of AttachPoint tables */
+ HB_Bool loaded;
};
typedef struct HB_AttachList_ HB_AttachList;
@@ -62,11 +61,10 @@ typedef struct HB_LigGlyph_ HB_LigGlyph;
struct HB_LigCaretList_
{
- HB_Bool loaded;
-
+ HB_LigGlyph* LigGlyph; /* array of LigGlyph tables */
HB_Coverage Coverage; /* Coverage table */
HB_UShort LigGlyphCount; /* number of ligature glyphs */
- HB_LigGlyph* LigGlyph; /* array of LigGlyph tables */
+ HB_Bool loaded;
};
typedef struct HB_LigCaretList_ HB_LigCaretList;
@@ -95,18 +93,18 @@ typedef struct HB_LigCaretList_ HB_LigCaretList;
struct HB_GDEFHeader_
{
+ HB_UShort** NewGlyphClasses;
HB_UInt offset;
+ HB_UInt MarkAttachClassDef_offset;
HB_16Dot16 Version;
HB_ClassDefinition GlyphClassDef;
HB_AttachList AttachList;
HB_LigCaretList LigCaretList;
- HB_UInt MarkAttachClassDef_offset;
HB_ClassDefinition MarkAttachClassDef; /* new in OT 1.2 */
HB_UShort LastGlyph;
- HB_UShort** NewGlyphClasses;
};
typedef struct HB_GDEFHeader_ HB_GDEFHeader;
diff --git a/src/harfbuzz-gsub-private.h b/src/harfbuzz-gsub-private.h
index 9f16546..7eb329e 100644
--- a/src/harfbuzz-gsub-private.h
+++ b/src/harfbuzz-gsub-private.h
@@ -51,9 +51,9 @@ typedef struct HB_SingleSubstFormat1_ HB_SingleSubstFormat1;
struct HB_SingleSubstFormat2_
{
+ HB_UShort* Substitute; /* array of substitute glyph IDs */
HB_UShort GlyphCount; /* number of glyph IDs in
Substitute array */
- HB_UShort* Substitute; /* array of substitute glyph IDs */
};
typedef struct HB_SingleSubstFormat2_ HB_SingleSubstFormat2;
@@ -61,14 +61,14 @@ typedef struct HB_SingleSubstFormat2_ HB_SingleSubstFormat2;
struct HB_SingleSubst_
{
- HB_Byte SubstFormat; /* 1 or 2 */
- HB_Coverage Coverage; /* Coverage table */
-
union
{
HB_SingleSubstFormat1 ssf1;
HB_SingleSubstFormat2 ssf2;
} ssf;
+
+ HB_Coverage Coverage; /* Coverage table */
+ HB_Byte SubstFormat; /* 1 or 2 */
};
typedef struct HB_SingleSubst_ HB_SingleSubst;
@@ -78,10 +78,10 @@ typedef struct HB_SingleSubst_ HB_SingleSubst;
struct HB_Sequence_
{
- HB_UShort GlyphCount; /* number of glyph IDs in the
- Substitute array */
HB_UShort* Substitute; /* string of glyph IDs to
substitute */
+ HB_UShort GlyphCount; /* number of glyph IDs in the
+ Substitute array */
};
typedef struct HB_Sequence_ HB_Sequence;
@@ -89,10 +89,10 @@ typedef struct HB_Sequence_ HB_Sequence;
struct HB_MultipleSubst_
{
- HB_UShort SubstFormat; /* always 1 */
+ HB_Sequence* Sequence; /* array of Sequence tables */
HB_Coverage Coverage; /* Coverage table */
+ HB_UShort SubstFormat; /* always 1 */
HB_UShort SequenceCount; /* number of Sequence tables */
- HB_Sequence* Sequence; /* array of Sequence tables */
};
typedef struct HB_MultipleSubst_ HB_MultipleSubst;
@@ -102,9 +102,9 @@ typedef struct HB_MultipleSubst_ HB_MultipleSubst;
struct HB_AlternateSet_
{
+ HB_UShort* Alternate; /* array of alternate glyph IDs */
HB_UShort GlyphCount; /* number of glyph IDs in the
Alternate array */
- HB_UShort* Alternate; /* array of alternate glyph IDs */
};
typedef struct HB_AlternateSet_ HB_AlternateSet;
@@ -112,11 +112,11 @@ typedef struct HB_AlternateSet_ HB_AlternateSet;
struct HB_AlternateSubst_
{
- HB_UShort SubstFormat; /* always 1 */
+ HB_AlternateSet* AlternateSet; /* array of AlternateSet tables */
HB_Coverage Coverage; /* Coverage table */
+ HB_UShort SubstFormat; /* always 1 */
HB_UShort AlternateSetCount;
/* number of AlternateSet tables */
- HB_AlternateSet* AlternateSet; /* array of AlternateSet tables */
};
typedef struct HB_AlternateSubst_ HB_AlternateSubst;
@@ -126,10 +126,10 @@ typedef struct HB_AlternateSubst_ HB_AlternateSubst;
struct HB_Ligature_
{
+ HB_UShort* Component; /* array of component glyph IDs */
HB_UShort LigGlyph; /* glyphID of ligature
to substitute */
HB_UShort ComponentCount; /* number of components in ligature */
- HB_UShort* Component; /* array of component glyph IDs */
};
typedef struct HB_Ligature_ HB_Ligature;
@@ -137,8 +137,8 @@ typedef struct HB_Ligature_ HB_Ligature;
struct HB_LigatureSet_
{
- HB_UShort LigatureCount; /* number of Ligature tables */
HB_Ligature* Ligature; /* array of Ligature tables */
+ HB_UShort LigatureCount; /* number of Ligature tables */
};
typedef struct HB_LigatureSet_ HB_LigatureSet;
@@ -146,10 +146,10 @@ typedef struct HB_LigatureSet_ HB_LigatureSet;
struct HB_LigatureSubst_
{
- HB_UShort SubstFormat; /* always 1 */
+ HB_LigatureSet* LigatureSet; /* array of LigatureSet tables */
HB_Coverage Coverage; /* Coverage table */
+ HB_UShort SubstFormat; /* always 1 */
HB_UShort LigatureSetCount; /* number of LigatureSet tables */
- HB_LigatureSet* LigatureSet; /* array of LigatureSet tables */
};
typedef struct HB_LigatureSubst_ HB_LigatureSubst;
@@ -171,13 +171,13 @@ typedef struct HB_SubstLookupRecord_ HB_SubstLookupRecord;
struct HB_SubRule_
{
- HB_UShort GlyphCount; /* total number of input glyphs */
- HB_UShort SubstCount; /* number of SubstLookupRecord
- tables */
HB_UShort* Input; /* array of input glyph IDs */
HB_SubstLookupRecord* SubstLookupRecord;
/* array of SubstLookupRecord
tables */
+ HB_UShort GlyphCount; /* total number of input glyphs */
+ HB_UShort SubstCount; /* number of SubstLookupRecord
+ tables */
};
typedef struct HB_SubRule_ HB_SubRule;
@@ -185,8 +185,8 @@ typedef struct HB_SubRule_ HB_SubRule;
struct HB_SubRuleSet_
{
- HB_UShort SubRuleCount; /* number of SubRule tables */
HB_SubRule* SubRule; /* array of SubRule tables */
+ HB_UShort SubRuleCount; /* number of SubRule tables */
};
typedef struct HB_SubRuleSet_ HB_SubRuleSet;
@@ -194,9 +194,9 @@ typedef struct HB_SubRuleSet_ HB_SubRuleSet;
struct HB_ContextSubstFormat1_
{
+ HB_SubRuleSet* SubRuleSet; /* array of SubRuleSet tables */
HB_Coverage Coverage; /* Coverage table */
HB_UShort SubRuleSetCount; /* number of SubRuleSet tables */
- HB_SubRuleSet* SubRuleSet; /* array of SubRuleSet tables */
};
typedef struct HB_ContextSubstFormat1_ HB_ContextSubstFormat1;
@@ -204,13 +204,13 @@ typedef struct HB_ContextSubstFormat1_ HB_ContextSubstFormat1;
struct HB_SubClassRule_
{
- HB_UShort GlyphCount; /* total number of context classes */
- HB_UShort SubstCount; /* number of SubstLookupRecord
- tables */
HB_UShort* Class; /* array of classes */
HB_SubstLookupRecord* SubstLookupRecord;
/* array of SubstLookupRecord
tables */
+ HB_UShort GlyphCount; /* total number of context classes */
+ HB_UShort SubstCount; /* number of SubstLookupRecord
+ tables */
};
typedef struct HB_SubClassRule_ HB_SubClassRule;
@@ -218,9 +218,9 @@ typedef struct HB_SubClassRule_ HB_SubClassRule;
struct HB_SubClassSet_
{
+ HB_SubClassRule* SubClassRule; /* array of SubClassRule tables */
HB_UShort SubClassRuleCount;
/* number of SubClassRule tables */
- HB_SubClassRule* SubClassRule; /* array of SubClassRule tables */
};
typedef struct HB_SubClassSet_ HB_SubClassSet;
@@ -232,13 +232,13 @@ typedef struct HB_SubClassSet_ HB_SubClassSet;
struct HB_ContextSubstFormat2_
{
- HB_UShort MaxContextLength;
- /* maximal context length */
+ HB_SubClassSet* SubClassSet; /* array of SubClassSet tables */
HB_Coverage Coverage; /* Coverage table */
HB_ClassDefinition ClassDef; /* ClassDef table */
HB_UShort SubClassSetCount;
/* number of SubClassSet tables */
- HB_SubClassSet* SubClassSet; /* array of SubClassSet tables */
+ HB_UShort MaxContextLength;
+ /* maximal context length */
};
typedef struct HB_ContextSubstFormat2_ HB_ContextSubstFormat2;
@@ -246,11 +246,11 @@ typedef struct HB_ContextSubstFormat2_ HB_ContextSubstFormat2;
struct HB_ContextSubstFormat3_
{
- HB_UShort GlyphCount; /* number of input glyphs */
- HB_UShort SubstCount; /* number of SubstLookupRecords */
HB_Coverage* Coverage; /* array of Coverage tables */
HB_SubstLookupRecord* SubstLookupRecord;
/* array of substitution lookups */
+ HB_UShort GlyphCount; /* number of input glyphs */
+ HB_UShort SubstCount; /* number of SubstLookupRecords */
};
typedef struct HB_ContextSubstFormat3_ HB_ContextSubstFormat3;
@@ -258,14 +258,14 @@ typedef struct HB_ContextSubstFormat3_ HB_ContextSubstFormat3;
struct HB_ContextSubst_
{
- HB_Byte SubstFormat; /* 1, 2, or 3 */
-
union
{
HB_ContextSubstFormat1 csf1;
HB_ContextSubstFormat2 csf2;
HB_ContextSubstFormat3 csf3;
} csf;
+
+ HB_Byte SubstFormat; /* 1, 2, or 3 */
};
typedef struct HB_ContextSubst_ HB_ContextSubst;
@@ -275,18 +275,18 @@ typedef struct HB_ContextSubst_ HB_ContextSubst;
struct HB_ChainSubRule_
{
+ HB_UShort* Backtrack; /* array of backtrack glyph IDs */
+ HB_UShort* Input; /* array of input glyph IDs */
+ HB_UShort* Lookahead; /* array of lookahead glyph IDs */
+ HB_SubstLookupRecord* SubstLookupRecord;
+ /* array of SubstLookupRecords */
HB_UShort BacktrackGlyphCount;
/* total number of backtrack glyphs */
- HB_UShort* Backtrack; /* array of backtrack glyph IDs */
HB_UShort InputGlyphCount;
/* total number of input glyphs */
- HB_UShort* Input; /* array of input glyph IDs */
HB_UShort LookaheadGlyphCount;
/* total number of lookahead glyphs */
- HB_UShort* Lookahead; /* array of lookahead glyph IDs */
HB_UShort SubstCount; /* number of SubstLookupRecords */
- HB_SubstLookupRecord* SubstLookupRecord;
- /* array of SubstLookupRecords */
};
typedef struct HB_ChainSubRule_ HB_ChainSubRule;
@@ -294,9 +294,9 @@ typedef struct HB_ChainSubRule_ HB_ChainSubRule;
struct HB_ChainSubRuleSet_
{
+ HB_ChainSubRule* ChainSubRule; /* array of ChainSubRule tables */
HB_UShort ChainSubRuleCount;
/* number of ChainSubRule tables */
- HB_ChainSubRule* ChainSubRule; /* array of ChainSubRule tables */
};
typedef struct HB_ChainSubRuleSet_ HB_ChainSubRuleSet;
@@ -304,11 +304,11 @@ typedef struct HB_ChainSubRuleSet_ HB_ChainSubRuleSet;
struct HB_ChainContextSubstFormat1_
{
+ HB_ChainSubRuleSet* ChainSubRuleSet;
+ /* array of ChainSubRuleSet tables */
HB_Coverage Coverage; /* Coverage table */
HB_UShort ChainSubRuleSetCount;
/* number of ChainSubRuleSet tables */
- HB_ChainSubRuleSet* ChainSubRuleSet;
- /* array of ChainSubRuleSet tables */
};
typedef struct HB_ChainContextSubstFormat1_ HB_ChainContextSubstFormat1;
@@ -316,20 +316,20 @@ typedef struct HB_ChainContextSubstFormat1_ HB_ChainContextSubstFormat1;
struct HB_ChainSubClassRule_
{
+ HB_UShort* Backtrack; /* array of backtrack classes */
+ HB_UShort* Input; /* array of context classes */
+ HB_UShort* Lookahead; /* array of lookahead classes */
+ HB_SubstLookupRecord* SubstLookupRecord;
+ /* array of substitution lookups */
HB_UShort BacktrackGlyphCount;
/* total number of backtrack
classes */
- HB_UShort* Backtrack; /* array of backtrack classes */
HB_UShort InputGlyphCount;
/* total number of context classes */
- HB_UShort* Input; /* array of context classes */
HB_UShort LookaheadGlyphCount;
/* total number of lookahead
classes */
- HB_UShort* Lookahead; /* array of lookahead classes */
HB_UShort SubstCount; /* number of SubstLookupRecords */
- HB_SubstLookupRecord* SubstLookupRecord;
- /* array of substitution lookups */
};
typedef struct HB_ChainSubClassRule_ HB_ChainSubClassRule;
@@ -337,12 +337,12 @@ typedef struct HB_ChainSubClassRule_ HB_ChainSubClassRule;
struct HB_ChainSubClassSet_
{
- HB_UShort ChainSubClassRuleCount;
- /* number of ChainSubClassRule
- tables */
HB_ChainSubClassRule* ChainSubClassRule;
/* array of ChainSubClassRule
tables */
+ HB_UShort ChainSubClassRuleCount;
+ /* number of ChainSubClassRule
+ tables */
};
typedef struct HB_ChainSubClassSet_ HB_ChainSubClassSet;
@@ -354,27 +354,27 @@ typedef struct HB_ChainSubClassSet_ HB_ChainSubClassSet;
struct HB_ChainContextSubstFormat2_
{
+ HB_ChainSubClassSet* ChainSubClassSet;
+ /* array of ChainSubClassSet
+ tables */
HB_Coverage Coverage; /* Coverage table */
- HB_UShort MaxBacktrackLength;
- /* maximal backtrack length */
HB_ClassDefinition BacktrackClassDef;
/* BacktrackClassDef table */
- HB_UShort MaxInputLength;
- /* maximal input length */
HB_ClassDefinition InputClassDef;
/* InputClassDef table */
- HB_UShort MaxLookaheadLength;
- /* maximal lookahead length */
HB_ClassDefinition LookaheadClassDef;
/* LookaheadClassDef table */
HB_UShort ChainSubClassSetCount;
/* number of ChainSubClassSet
tables */
- HB_ChainSubClassSet* ChainSubClassSet;
- /* array of ChainSubClassSet
- tables */
+ HB_UShort MaxBacktrackLength;
+ /* maximal backtrack length */
+ HB_UShort MaxLookaheadLength;
+ /* maximal lookahead length */
+ HB_UShort MaxInputLength;
+ /* maximal input length */
};
typedef struct HB_ChainContextSubstFormat2_ HB_ChainContextSubstFormat2;
@@ -382,24 +382,24 @@ typedef struct HB_ChainContextSubstFormat2_ HB_ChainContextSubstFormat2;
struct HB_ChainContextSubstFormat3_
{
- HB_UShort BacktrackGlyphCount;
- /* number of backtrack glyphs */
HB_Coverage* BacktrackCoverage;
/* array of backtrack Coverage
tables */
- HB_UShort InputGlyphCount;
- /* number of input glyphs */
HB_Coverage* InputCoverage;
/* array of input coverage
tables */
- HB_UShort LookaheadGlyphCount;
- /* number of lookahead glyphs */
HB_Coverage* LookaheadCoverage;
/* array of lookahead coverage
tables */
- HB_UShort SubstCount; /* number of SubstLookupRecords */
HB_SubstLookupRecord* SubstLookupRecord;
/* array of substitution lookups */
+ HB_UShort BacktrackGlyphCount;
+ /* number of backtrack glyphs */
+ HB_UShort InputGlyphCount;
+ /* number of input glyphs */
+ HB_UShort LookaheadGlyphCount;
+ /* number of lookahead glyphs */
+ HB_UShort SubstCount; /* number of SubstLookupRecords */
};
typedef struct HB_ChainContextSubstFormat3_ HB_ChainContextSubstFormat3;
@@ -407,14 +407,14 @@ typedef struct HB_ChainContextSubstFormat3_ HB_ChainContextSubstFormat3;
struct HB_ChainContextSubst_
{
- HB_Byte SubstFormat; /* 1, 2, or 3 */
-
union
{
HB_ChainContextSubstFormat1 ccsf1;
HB_ChainContextSubstFormat2 ccsf2;
HB_ChainContextSubstFormat3 ccsf3;
} ccsf;
+
+ HB_Byte SubstFormat; /* 1, 2, or 3 */
};
typedef struct HB_ChainContextSubst_ HB_ChainContextSubst;
@@ -424,9 +424,9 @@ typedef struct HB_ChainContextSubst_ HB_ChainContextSubst;
/* LookupType 7 */
struct HB_ExtensionSubst_
{
+ HB_GSUB_SubTable *subtable; /* referenced subtable */
HB_UShort SubstFormat; /* always 1 */
HB_UShort LookuptType; /* lookup-type of referenced subtable */
- HB_GSUB_SubTable *subtable; /* referenced subtable */
};
typedef struct HB_ExtensionSubst_ HB_ExtensionSubst;
@@ -436,16 +436,16 @@ typedef struct HB_ExtensionSubst_ HB_ExtensionSubst;
/* LookupType 8 */
struct HB_ReverseChainContextSubst_
{
- HB_UShort SubstFormat; /* always 1 */
- HB_Coverage Coverage; /* coverage table for input glyphs */
- HB_UShort BacktrackGlyphCount; /* number of backtrack glyphs */
+ HB_Coverage* LookaheadCoverage; /* array of lookahead Coverage
+ tables */
+ HB_UShort* Substitute; /* array of substitute Glyph ID */
HB_Coverage* BacktrackCoverage; /* array of backtrack Coverage
tables */
+ HB_Coverage Coverage; /* coverage table for input glyphs */
+ HB_UShort SubstFormat; /* always 1 */
+ HB_UShort BacktrackGlyphCount; /* number of backtrack glyphs */
HB_UShort LookaheadGlyphCount; /* number of lookahead glyphs */
- HB_Coverage* LookaheadCoverage; /* array of lookahead Coverage
- tables */
HB_UShort GlyphCount; /* number of Glyph IDs */
- HB_UShort* Substitute; /* array of substitute Glyph ID */
};
typedef struct HB_ReverseChainContextSubst_ HB_ReverseChainContextSubst;
diff --git a/src/harfbuzz-gsub.h b/src/harfbuzz-gsub.h
index 5b989ee..b00df44 100644
--- a/src/harfbuzz-gsub.h
+++ b/src/harfbuzz-gsub.h
@@ -64,6 +64,14 @@ typedef HB_UShort (*HB_AltFunction)(HB_UInt pos,
struct HB_GSUBHeader_
{
+ HB_GDEFHeader* gdef;
+
+ /* the next two fields are used for an alternate substitution callback
+ function to select the proper alternate glyph. */
+
+ void* data;
+ HB_AltFunction altfunc;
+
HB_UInt offset;
HB_16Dot16 Version;
@@ -71,14 +79,6 @@ struct HB_GSUBHeader_
HB_ScriptList ScriptList;
HB_FeatureList FeatureList;
HB_LookupList LookupList;
-
- HB_GDEFHeader* gdef;
-
- /* the next two fields are used for an alternate substitution callback
- function to select the proper alternate glyph. */
-
- HB_AltFunction altfunc;
- void* data;
};
typedef struct HB_GSUBHeader_ HB_GSUBHeader;
diff --git a/src/harfbuzz-open.h b/src/harfbuzz-open.h
index 752f17d..4ba6cf5 100644
--- a/src/harfbuzz-open.h
+++ b/src/harfbuzz-open.h
@@ -46,10 +46,10 @@ HB_BEGIN_HEADER
struct HB_LangSys_
{
+ HB_UShort* FeatureIndex; /* array of Feature indices */
HB_UShort LookupOrderOffset; /* always 0 for TT Open 1.0 */
HB_UShort ReqFeatureIndex; /* required FeatureIndex */
HB_UShort FeatureCount; /* number of Feature indices */
- HB_UShort* FeatureIndex; /* array of Feature indices */
};
typedef struct HB_LangSys_ HB_LangSys;
@@ -57,8 +57,8 @@ typedef struct HB_LangSys_ HB_LangSys;
struct HB_LangSysRecord_
{
- HB_UInt LangSysTag; /* LangSysTag identifier */
HB_LangSys LangSys; /* LangSys table */
+ HB_UInt LangSysTag; /* LangSysTag identifier */
};
typedef struct HB_LangSysRecord_ HB_LangSysRecord;
@@ -66,9 +66,9 @@ typedef struct HB_LangSysRecord_ HB_LangSysRecord;
struct HB_ScriptTable_
{
+ HB_LangSysRecord* LangSysRecord; /* array of LangSysRecords */
HB_LangSys DefaultLangSys; /* DefaultLangSys table */
HB_UShort LangSysCount; /* number of LangSysRecords */
- HB_LangSysRecord* LangSysRecord; /* array of LangSysRecords */
};
typedef struct HB_ScriptTable_ HB_ScriptTable;
@@ -85,8 +85,8 @@ typedef struct HB_ScriptRecord_ HB_ScriptRecord;
struct HB_ScriptList_
{
- HB_UShort ScriptCount; /* number of ScriptRecords */
HB_ScriptRecord* ScriptRecord; /* array of ScriptRecords */
+ HB_UShort ScriptCount; /* number of ScriptRecords */
};
typedef struct HB_ScriptList_ HB_ScriptList;
@@ -96,9 +96,9 @@ typedef struct HB_ScriptList_ HB_ScriptList;
struct HB_Feature_
{
+ HB_UShort* LookupListIndex; /* array of LookupList indices */
HB_UShort FeatureParams; /* always 0 for TT Open 1.0 */
HB_UShort LookupListCount; /* number of LookupList indices */
- HB_UShort* LookupListIndex; /* array of LookupList indices */
};
typedef struct HB_Feature_ HB_Feature;
@@ -115,9 +115,9 @@ typedef struct HB_FeatureRecord_ HB_FeatureRecord;
struct HB_FeatureList_
{
- HB_UShort FeatureCount; /* number of FeatureRecords */
- HB_FeatureRecord* FeatureRecord; /* array of FeatureRecords */
HB_UShort* ApplyOrder; /* order to apply features */
+ HB_FeatureRecord* FeatureRecord; /* array of FeatureRecords */
+ HB_UShort FeatureCount; /* number of FeatureRecords */
HB_UShort ApplyCount; /* number of elements in ApplyOrder */
};
@@ -131,10 +131,10 @@ typedef struct HB_SubTable_ HB_SubTable;
struct HB_Lookup_
{
+ HB_SubTable* SubTable; /* array of SubTables */
HB_UShort LookupType; /* Lookup type */
HB_UShort LookupFlag; /* Lookup qualifiers */
HB_UShort SubTableCount; /* number of SubTables */
- HB_SubTable* SubTable; /* array of SubTables */
};
typedef struct HB_Lookup_ HB_Lookup;
@@ -148,9 +148,9 @@ typedef struct HB_Lookup_ HB_Lookup;
struct HB_LookupList_
{
- HB_UShort LookupCount; /* number of Lookups */
HB_Lookup* Lookup; /* array of Lookup records */
HB_UInt* Properties; /* array of flags */
+ HB_UShort LookupCount; /* number of Lookups */
};
typedef struct HB_LookupList_ HB_LookupList;
@@ -171,8 +171,8 @@ typedef struct HB_LookupList_ HB_LookupList;
struct HB_CoverageFormat1_
{
- HB_UShort GlyphCount; /* number of glyphs in GlyphArray */
HB_UShort* GlyphArray; /* array of glyph IDs */
+ HB_UShort GlyphCount; /* number of glyphs in GlyphArray */
};
typedef struct HB_CoverageFormat1_ HB_CoverageFormat1;
@@ -191,8 +191,8 @@ typedef struct HB_RangeRecord_ HB_RangeRecord;
struct HB_CoverageFormat2_
{
- HB_UShort RangeCount; /* number of RangeRecords */
HB_RangeRecord* RangeRecord; /* array of RangeRecords */
+ HB_UShort RangeCount; /* number of RangeRecords */
};
typedef struct HB_CoverageFormat2_ HB_CoverageFormat2;
@@ -214,10 +214,10 @@ typedef struct HB_Coverage_ HB_Coverage;
struct HB_ClassDefFormat1_
{
+ HB_UShort* ClassValueArray; /* array of class values */
HB_UShort StartGlyph; /* first glyph ID of the
ClassValueArray */
HB_UShort GlyphCount; /* size of the ClassValueArray */
- HB_UShort* ClassValueArray; /* array of class values */
};
typedef struct HB_ClassDefFormat1_ HB_ClassDefFormat1;
@@ -235,10 +235,10 @@ typedef struct HB_ClassRangeRecord_ HB_ClassRangeRecord;
struct HB_ClassDefFormat2_
{
- HB_UShort ClassRangeCount;
- /* number of ClassRangeRecords */
HB_ClassRangeRecord* ClassRangeRecord;
/* array of ClassRangeRecords */
+ HB_UShort ClassRangeCount;
+ /* number of ClassRangeRecords */
};
typedef struct HB_ClassDefFormat2_ HB_ClassDefFormat2;
@@ -246,15 +246,14 @@ typedef struct HB_ClassDefFormat2_ HB_ClassDefFormat2;
struct HB_ClassDefinition_
{
- HB_Bool loaded;
-
- HB_Byte ClassFormat; /* 1 or 2 */
-
union
{
HB_ClassDefFormat1 cd1;
HB_ClassDefFormat2 cd2;
} cd;
+
+ HB_Byte ClassFormat; /* 1 or 2 */
+ HB_Bool loaded;
};
typedef struct HB_ClassDefinition_ HB_ClassDefinition;
@@ -262,11 +261,11 @@ typedef struct HB_ClassDefinition_ HB_ClassDefinition;
struct HB_Device_
{
+ HB_UShort* DeltaValue; /* array of compressed data */
HB_UShort StartSize; /* smallest size to correct */
HB_UShort EndSize; /* largest size to correct */
HB_Byte DeltaFormat; /* DeltaValue array data format:
1, 2, or 3 */
- HB_UShort* DeltaValue; /* array of compressed data */
};
typedef struct HB_Device_ HB_Device;
diff --git a/src/harfbuzz-stream.h b/src/harfbuzz-stream.h
index 0670804..a155cc2 100644
--- a/src/harfbuzz-stream.h
+++ b/src/harfbuzz-stream.h
@@ -37,10 +37,9 @@ HB_BEGIN_HEADER
typedef struct HB_StreamRec_
{
HB_Byte* base;
+ HB_Byte* cursor;
HB_UInt size;
HB_UInt pos;
-
- HB_Byte* cursor;
} HB_StreamRec;
#ifdef HB_USE_PACKED_STRUCTS
commit e9ba90f8633d44fa251166d6fe4e1e12949a2ae7
Author: Andreas Kling <andreas.kling at nokia.com>
Date: Tue Jun 15 09:44:11 2010 +0200
Pack all internal Harfbuzz structures.
This cuts persistent memory consumption by over 1MB when simply browsing
some popular websites with QtWebKit.
Signed-off-by: Simon Hausmann <simon.hausmann at nokia.com>
Signed-off-by: Lars Knoll <lars.knoll at nokia.com>
diff --git a/src/harfbuzz-buffer.h b/src/harfbuzz-buffer.h
index b134407..7e6ad83 100644
--- a/src/harfbuzz-buffer.h
+++ b/src/harfbuzz-buffer.h
@@ -32,6 +32,10 @@
HB_BEGIN_HEADER
+#ifdef HB_USE_PACKED_STRUCTS
+#pragma pack(push, 1)
+#endif
+
typedef struct HB_GlyphItemRec_ {
HB_UInt gindex;
HB_UInt properties;
@@ -89,6 +93,10 @@ hb_buffer_add_glyph( HB_Buffer buffer,
HB_UInt properties,
HB_UInt cluster );
+#ifdef HB_USE_PACKED_STRUCTS
+#pragma pack(pop)
+#endif
+
HB_END_HEADER
#endif /* HARFBUZZ_BUFFER_H */
diff --git a/src/harfbuzz-gdef-private.h b/src/harfbuzz-gdef-private.h
index 0e9c03c..da29d99 100644
--- a/src/harfbuzz-gdef-private.h
+++ b/src/harfbuzz-gdef-private.h
@@ -34,6 +34,10 @@
HB_BEGIN_HEADER
+#ifdef HB_USE_PACKED_STRUCTS
+#pragma pack(push, 1)
+#endif
+
/* Attachment related structures */
struct HB_AttachPoint_
@@ -123,6 +127,10 @@ _HB_GDEF_LoadMarkAttachClassDef_From_LookupFlags( HB_GDEFHeader* gdef,
HB_Lookup* lo,
HB_UShort num_lookups );
+#ifdef HB_USE_PACKED_STRUCTS
+#pragma pack(pop)
+#endif
+
HB_END_HEADER
#endif /* HARFBUZZ_GDEF_PRIVATE_H */
diff --git a/src/harfbuzz-gdef.h b/src/harfbuzz-gdef.h
index b6dcadc..9b5dee0 100644
--- a/src/harfbuzz-gdef.h
+++ b/src/harfbuzz-gdef.h
@@ -31,6 +31,10 @@
HB_BEGIN_HEADER
+#ifdef HB_USE_PACKED_STRUCTS
+#pragma pack(push, 1)
+#endif
+
/* GDEF glyph properties. Note that HB_GDEF_COMPONENT has no corresponding
* flag in the LookupFlag field. */
#define HB_GDEF_BASE_GLYPH 0x0002
@@ -129,6 +133,9 @@ HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef,
HB_UShort* glyph_array,
HB_UShort* class_array );
+#ifdef HB_USE_PACKED_STRUCTS
+#pragma pack(pop)
+#endif
HB_END_HEADER
diff --git a/src/harfbuzz-global.h b/src/harfbuzz-global.h
index d4e6b46..5b2b679 100644
--- a/src/harfbuzz-global.h
+++ b/src/harfbuzz-global.h
@@ -39,6 +39,10 @@
#define HB_END_HEADER /* nothing */
#endif
+#if defined(__GNUC__) || defined(__ARMCC__) || defined(__CC_ARM) || defined(_MSC_VER)
+#define HB_USE_PACKED_STRUCTS
+#endif
+
HB_BEGIN_HEADER
#ifndef FALSE
diff --git a/src/harfbuzz-gpos-private.h b/src/harfbuzz-gpos-private.h
index 6408b84..d513c27 100644
--- a/src/harfbuzz-gpos-private.h
+++ b/src/harfbuzz-gpos-private.h
@@ -32,6 +32,9 @@
HB_BEGIN_HEADER
+#ifdef HB_USE_PACKED_STRUCTS
+#pragma pack(push, 1)
+#endif
/* shared tables */
@@ -713,6 +716,10 @@ HB_INTERNAL void
_HB_GPOS_Free_SubTable( HB_GPOS_SubTable* st,
HB_UShort lookup_type );
+#ifdef HB_USE_PACKED_STRUCTS
+#pragma pack(pop)
+#endif
+
HB_END_HEADER
#endif /* HARFBUZZ_GPOS_PRIVATE_H */
diff --git a/src/harfbuzz-gsub-private.h b/src/harfbuzz-gsub-private.h
index 4e08839..9f16546 100644
--- a/src/harfbuzz-gsub-private.h
+++ b/src/harfbuzz-gsub-private.h
@@ -32,6 +32,9 @@
HB_BEGIN_HEADER
+#ifdef HB_USE_PACKED_STRUCTS
+#pragma pack(push, 1)
+#endif
typedef union HB_GSUB_SubTable_ HB_GSUB_SubTable;
@@ -471,6 +474,10 @@ HB_INTERNAL void
_HB_GSUB_Free_SubTable( HB_GSUB_SubTable* st,
HB_UShort lookup_type );
+#ifdef HB_USE_PACKED_STRUCTS
+#pragma pack(pop)
+#endif
+
HB_END_HEADER
#endif /* HARFBUZZ_GSUB_PRIVATE_H */
diff --git a/src/harfbuzz-gsub.h b/src/harfbuzz-gsub.h
index 1ca3f0c..5b989ee 100644
--- a/src/harfbuzz-gsub.h
+++ b/src/harfbuzz-gsub.h
@@ -32,6 +32,10 @@
HB_BEGIN_HEADER
+#ifdef HB_USE_PACKED_STRUCTS
+#pragma pack(push, 1)
+#endif
+
/* Lookup types for glyph substitution */
#define HB_GSUB_LOOKUP_SINGLE 1
@@ -135,6 +139,9 @@ HB_Error HB_GSUB_Register_Alternate_Function( HB_GSUBHeader* gsub,
HB_Error HB_GSUB_Apply_String( HB_GSUBHeader* gsub,
HB_Buffer buffer );
+#ifdef HB_USE_PACKED_STRUCTS
+#pragma pack(pop)
+#endif
HB_END_HEADER
diff --git a/src/harfbuzz-open.h b/src/harfbuzz-open.h
index 7d3bc1b..752f17d 100644
--- a/src/harfbuzz-open.h
+++ b/src/harfbuzz-open.h
@@ -30,6 +30,10 @@
HB_BEGIN_HEADER
+#ifdef HB_USE_PACKED_STRUCTS
+#pragma pack(push, 1)
+#endif
+
/* Use this if a feature applies to all glyphs */
#define HB_ALL_GLYPHS 0xFFFF
@@ -276,6 +280,9 @@ enum HB_Type_
typedef enum HB_Type_ HB_Type;
+#ifdef HB_USE_PACKED_STRUCTS
+#pragma pack(pop)
+#endif
HB_END_HEADER
diff --git a/src/harfbuzz-shaper.h b/src/harfbuzz-shaper.h
index 470e27b..32f5781 100644
--- a/src/harfbuzz-shaper.h
+++ b/src/harfbuzz-shaper.h
@@ -34,6 +34,10 @@
HB_BEGIN_HEADER
+#ifdef HB_USE_PACKED_STRUCTS
+#pragma pack(push, 1)
+#endif
+
/*
using anything else than signed or unsigned for bitfields in C is non standard,
but accepted by almost all compilers. And it gives a significant reduction in
@@ -281,6 +285,10 @@ struct HB_ShaperItem_ {
HB_Bool HB_ShapeItem(HB_ShaperItem *item);
+#ifdef HB_USE_PACKED_STRUCTS
+#pragma pack(pop)
+#endif
+
HB_END_HEADER
#endif
diff --git a/src/harfbuzz-stream.h b/src/harfbuzz-stream.h
index 9991936..0670804 100644
--- a/src/harfbuzz-stream.h
+++ b/src/harfbuzz-stream.h
@@ -30,6 +30,10 @@
HB_BEGIN_HEADER
+#ifdef HB_USE_PACKED_STRUCTS
+#pragma pack(push, 1)
+#endif
+
typedef struct HB_StreamRec_
{
HB_Byte* base;
@@ -39,6 +43,9 @@ typedef struct HB_StreamRec_
HB_Byte* cursor;
} HB_StreamRec;
+#ifdef HB_USE_PACKED_STRUCTS
+#pragma pack(pop)
+#endif
HB_END_HEADER
commit 5ab1e41c5b7d5dbe8d1a0d31dfcde582c5b2f390
Author: Andreas Kling <andreas.kling at nokia.com>
Date: Tue Jun 15 09:45:57 2010 +0200
Always allocate HB_Device structs dynamically.
These are often unnecessary and allocating them dynamically will save
5 bytes per instance.
Signed-off-by: Simon Hausmann <simon.hausmann at nokia.com>
Signed-off-by: Lars Knoll <lars.knoll at nokia.com>
diff --git a/src/harfbuzz-dump.c b/src/harfbuzz-dump.c
index 918fd56..a1ef6b6 100644
--- a/src/harfbuzz-dump.c
+++ b/src/harfbuzz-dump.c
@@ -519,15 +519,15 @@ Dump_ValueRecord (HB_ValueRecord *ValueRecord, FILE *stream, int indent, HB_Type
if (value_format & HB_GPOS_FORMAT_HAVE_Y_ADVANCE)
DUMP_FINT (ValueRecord, XAdvance);
if (value_format & HB_GPOS_FORMAT_HAVE_X_PLACEMENT_DEVICE)
- RECURSE (Device, Device, &ValueRecord->XPlacementDevice);
+ RECURSE (Device, Device, &*ValueRecord->XPlacementDevice);
if (value_format & HB_GPOS_FORMAT_HAVE_Y_PLACEMENT_DEVICE)
- RECURSE (Device, Device, &ValueRecord->YPlacementDevice);
+ RECURSE (Device, Device, &*ValueRecord->YPlacementDevice);
if (value_format & HB_GPOS_FORMAT_HAVE_X_ADVANCE_DEVICE)
- RECURSE (Device, Device, &ValueRecord->XAdvanceDevice);
+ RECURSE (Device, Device, &*ValueRecord->XAdvanceDevice);
if (value_format & HB_GPOS_FORMAT_HAVE_Y_ADVANCE_DEVICE)
- RECURSE (Device, Device, &ValueRecord->YAdvanceDevice);
- if (value_format & HB_GPOS_FORMAT_HAVE_X_ID_PLACEMENT)
+ RECURSE (Device, Device, &*ValueRecord->YAdvanceDevice);
#ifdef HB_SUPPORT_MULTIPLE_MASTER
+ if (value_format & HB_GPOS_FORMAT_HAVE_X_ID_PLACEMENT)
DUMP_FUINT (ValueRecord, XIdPlacement);
if (value_format & HB_GPOS_FORMAT_HAVE_Y_ID_PLACEMENT)
DUMP_FUINT (ValueRecord, YIdPlacement);
diff --git a/src/harfbuzz-gdef-private.h b/src/harfbuzz-gdef-private.h
index 3d1d4c2..0e9c03c 100644
--- a/src/harfbuzz-gdef-private.h
+++ b/src/harfbuzz-gdef-private.h
@@ -63,7 +63,7 @@ typedef struct HB_CaretValueFormat2_ HB_CaretValueFormat2;
struct HB_CaretValueFormat3_
{
HB_Short Coordinate; /* x or y value (in design units) */
- HB_Device Device; /* Device table for x or y value */
+ HB_Device* Device; /* Device table for x or y value */
};
typedef struct HB_CaretValueFormat3_ HB_CaretValueFormat3;
diff --git a/src/harfbuzz-gpos-private.h b/src/harfbuzz-gpos-private.h
index 50fd252..6408b84 100644
--- a/src/harfbuzz-gpos-private.h
+++ b/src/harfbuzz-gpos-private.h
@@ -45,13 +45,13 @@ struct HB_ValueRecord_
advance */
HB_Short YAdvance; /* vertical adjustment for
advance */
- HB_Device XPlacementDevice; /* device table for horizontal
+ HB_Device* XPlacementDevice; /* device table for horizontal
placement */
- HB_Device YPlacementDevice; /* device table for vertical
+ HB_Device* YPlacementDevice; /* device table for vertical
placement */
- HB_Device XAdvanceDevice; /* device table for horizontal
+ HB_Device* XAdvanceDevice; /* device table for horizontal
advance */
- HB_Device YAdvanceDevice; /* device table for vertical
+ HB_Device* YAdvanceDevice; /* device table for vertical
advance */
#ifdef HB_SUPPORT_MULTIPLE_MASTER
HB_UShort XIdPlacement; /* horizontal placement metric ID */
@@ -104,8 +104,8 @@ struct HB_AnchorFormat3_
{
HB_Short XCoordinate; /* horizontal value */
HB_Short YCoordinate; /* vertical value */
- HB_Device XDeviceTable; /* device table for X coordinate */
- HB_Device YDeviceTable; /* device table for Y coordinate */
+ HB_Device* XDeviceTable; /* device table for X coordinate */
+ HB_Device* YDeviceTable; /* device table for Y coordinate */
};
typedef struct HB_AnchorFormat3_ HB_AnchorFormat3;
diff --git a/src/harfbuzz-gpos.c b/src/harfbuzz-gpos.c
index a105ce0..61e42fd 100644
--- a/src/harfbuzz-gpos.c
+++ b/src/harfbuzz-gpos.c
@@ -282,9 +282,7 @@ static HB_Error Load_ValueRecord( HB_ValueRecord* vr,
else
{
empty1:
- vr->XPlacementDevice.StartSize = 0;
- vr->XPlacementDevice.EndSize = 0;
- vr->XPlacementDevice.DeltaValue = NULL;
+ vr->XPlacementDevice = 0;
}
if ( format & HB_GPOS_FORMAT_HAVE_Y_PLACEMENT_DEVICE )
@@ -313,9 +311,7 @@ static HB_Error Load_ValueRecord( HB_ValueRecord* vr,
else
{
empty2:
- vr->YPlacementDevice.StartSize = 0;
- vr->YPlacementDevice.EndSize = 0;
- vr->YPlacementDevice.DeltaValue = NULL;
+ vr->YPlacementDevice = 0;
}
if ( format & HB_GPOS_FORMAT_HAVE_X_ADVANCE_DEVICE )
@@ -344,9 +340,7 @@ static HB_Error Load_ValueRecord( HB_ValueRecord* vr,
else
{
empty3:
- vr->XAdvanceDevice.StartSize = 0;
- vr->XAdvanceDevice.EndSize = 0;
- vr->XAdvanceDevice.DeltaValue = NULL;
+ vr->XAdvanceDevice = 0;
}
if ( format & HB_GPOS_FORMAT_HAVE_Y_ADVANCE_DEVICE )
@@ -375,9 +369,7 @@ static HB_Error Load_ValueRecord( HB_ValueRecord* vr,
else
{
empty4:
- vr->YAdvanceDevice.StartSize = 0;
- vr->YAdvanceDevice.EndSize = 0;
- vr->YAdvanceDevice.DeltaValue = NULL;
+ vr->YAdvanceDevice = 0;
}
if ( format & HB_GPOS_FORMAT_HAVE_X_ID_PLACEMENT )
@@ -651,9 +643,7 @@ static HB_Error Load_Anchor( HB_Anchor* an,
}
else
{
- an->af.af3.XDeviceTable.StartSize = 0;
- an->af.af3.XDeviceTable.EndSize = 0;
- an->af.af3.XDeviceTable.DeltaValue = NULL;
+ an->af.af3.XDeviceTable = 0;
}
if ( ACCESS_Frame( 2L ) )
@@ -676,9 +666,7 @@ static HB_Error Load_Anchor( HB_Anchor* an,
}
else
{
- an->af.af3.YDeviceTable.StartSize = 0;
- an->af.af3.YDeviceTable.EndSize = 0;
- an->af.af3.YDeviceTable.DeltaValue = NULL;
+ an->af.af3.YDeviceTable = 0;
}
break;
diff --git a/src/harfbuzz-open-private.h b/src/harfbuzz-open-private.h
index 73dd383..1f7b353 100644
--- a/src/harfbuzz-open-private.h
+++ b/src/harfbuzz-open-private.h
@@ -69,7 +69,7 @@ _HB_OPEN_Load_EmptyOrClassDefinition( HB_ClassDefinition* cd,
HB_UInt base_offset,
HB_Stream input );
HB_INTERNAL HB_Error
-_HB_OPEN_Load_Device( HB_Device* d,
+_HB_OPEN_Load_Device( HB_Device** d,
HB_Stream input );
HB_INTERNAL void _HB_OPEN_Free_ScriptList( HB_ScriptList* sl );
@@ -79,7 +79,7 @@ HB_INTERNAL void _HB_OPEN_Free_LookupList( HB_LookupList* ll,
HB_INTERNAL void _HB_OPEN_Free_Coverage( HB_Coverage* c );
HB_INTERNAL void _HB_OPEN_Free_ClassDefinition( HB_ClassDefinition* cd );
-HB_INTERNAL void _HB_OPEN_Free_Device( HB_Device* d );
+HB_INTERNAL void _HB_OPEN_Free_Device( HB_Device** d );
@@ -93,7 +93,7 @@ _HB_OPEN_Get_Class( HB_ClassDefinition* cd,
HB_UShort* klass,
HB_UShort* index );
HB_INTERNAL HB_Error
-_HB_OPEN_Get_Device( HB_Device* d,
+_HB_OPEN_Get_Device( HB_Device** d,
HB_UShort size,
HB_Short* value );
diff --git a/src/harfbuzz-open.c b/src/harfbuzz-open.c
index 0fe1e4d..4fc6ed1 100644
--- a/src/harfbuzz-open.c
+++ b/src/harfbuzz-open.c
@@ -1282,7 +1282,7 @@ _HB_OPEN_Get_Class( HB_ClassDefinition* cd,
HB_INTERNAL HB_Error
-_HB_OPEN_Load_Device( HB_Device* d,
+_HB_OPEN_Load_Device( HB_Device** device,
HB_Stream stream )
{
HB_Error error;
@@ -1295,6 +1295,14 @@ _HB_OPEN_Load_Device( HB_Device* d,
if ( ACCESS_Frame( 6L ) )
return error;
+ if ( ALLOC( *device, sizeof(HB_Device)) )
+ {
+ *device = 0;
+ return error;
+ }
+
+ HB_Device* d = *device;
+
d->StartSize = GET_UShort();
d->EndSize = GET_UShort();
d->DeltaFormat = GET_UShort();
@@ -1318,11 +1326,17 @@ _HB_OPEN_Load_Device( HB_Device* d,
( 4 - d->DeltaFormat ) ) + 1;
if ( ALLOC_ARRAY( d->DeltaValue, count, HB_UShort ) )
+ {
+ FREE( *device );
+ *device = 0;
return error;
+ }
if ( ACCESS_Frame( count * 2L ) )
{
FREE( d->DeltaValue );
+ FREE( *device );
+ *device = 0;
return error;
}
@@ -1338,9 +1352,13 @@ _HB_OPEN_Load_Device( HB_Device* d,
HB_INTERNAL void
-_HB_OPEN_Free_Device( HB_Device* d )
+_HB_OPEN_Free_Device( HB_Device** d )
{
- FREE( d->DeltaValue );
+ if ( *d )
+ {
+ FREE( (*d)->DeltaValue );
+ FREE( *d );
+ }
}
@@ -1380,12 +1398,20 @@ _HB_OPEN_Free_Device( HB_Device* d )
mask = 0x00FF */
HB_INTERNAL HB_Error
-_HB_OPEN_Get_Device( HB_Device* d,
+_HB_OPEN_Get_Device( HB_Device** device,
HB_UShort size,
HB_Short* value )
{
HB_UShort byte, bits, mask, f, s;
+ HB_Error error;
+
+ if ( ALLOC( *device, sizeof(HB_Device)) )
+ {
+ *device = 0;
+ return error;
+ }
+ HB_Device* d = *device;
f = d->DeltaFormat;
@@ -1408,6 +1434,8 @@ _HB_OPEN_Get_Device( HB_Device* d,
else
{
*value = 0;
+ FREE( *device );
+ *device = 0;
return HB_Err_Not_Covered;
}
}
commit ce1f5b080dc944c05fbf16ee1b3669add709b427
Author: Andreas Kling <andreas.kling at nokia.com>
Date: Tue Jun 15 09:45:13 2010 +0200
Disable support for Multiple Master fonts by default.
Support for MM fonts was discontinued in OpenType 1.3 (April 2001) and
we can save 8 bytes per ValueRecord by ignoring them.
This does not introduce any behavior change, since Qt never installed a
handler for MM fonts.
Signed-off-by: Simon Hausmann <simon.hausmann at nokia.com>
Signed-off-by: Lars Knoll <lars.knoll at nokia.com>
diff --git a/src/harfbuzz-dump.c b/src/harfbuzz-dump.c
index 8c81da1..918fd56 100644
--- a/src/harfbuzz-dump.c
+++ b/src/harfbuzz-dump.c
@@ -527,6 +527,7 @@ Dump_ValueRecord (HB_ValueRecord *ValueRecord, FILE *stream, int indent, HB_Type
if (value_format & HB_GPOS_FORMAT_HAVE_Y_ADVANCE_DEVICE)
RECURSE (Device, Device, &ValueRecord->YAdvanceDevice);
if (value_format & HB_GPOS_FORMAT_HAVE_X_ID_PLACEMENT)
+#ifdef HB_SUPPORT_MULTIPLE_MASTER
DUMP_FUINT (ValueRecord, XIdPlacement);
if (value_format & HB_GPOS_FORMAT_HAVE_Y_ID_PLACEMENT)
DUMP_FUINT (ValueRecord, YIdPlacement);
@@ -534,6 +535,7 @@ Dump_ValueRecord (HB_ValueRecord *ValueRecord, FILE *stream, int indent, HB_Type
DUMP_FUINT (ValueRecord, XIdAdvance);
if (value_format & HB_GPOS_FORMAT_HAVE_Y_ID_ADVANCE)
DUMP_FUINT (ValueRecord, XIdAdvance);
+#endif
}
static void
diff --git a/src/harfbuzz-gdef-private.h b/src/harfbuzz-gdef-private.h
index 31d68f7..3d1d4c2 100644
--- a/src/harfbuzz-gdef-private.h
+++ b/src/harfbuzz-gdef-private.h
@@ -69,12 +69,14 @@ struct HB_CaretValueFormat3_
typedef struct HB_CaretValueFormat3_ HB_CaretValueFormat3;
+#ifdef HB_SUPPORT_MULTIPLE_MASTER
struct HB_CaretValueFormat4_
{
HB_UShort IdCaretValue; /* metric ID */
};
typedef struct HB_CaretValueFormat4_ HB_CaretValueFormat4;
+#endif
struct HB_CaretValue_
@@ -86,7 +88,9 @@ struct HB_CaretValue_
HB_CaretValueFormat1 cvf1;
HB_CaretValueFormat2 cvf2;
HB_CaretValueFormat3 cvf3;
+#ifdef HB_SUPPORT_MULTIPLE_MASTER
HB_CaretValueFormat4 cvf4;
+#endif
} cvf;
};
diff --git a/src/harfbuzz-gdef.c b/src/harfbuzz-gdef.c
index ff3a1f4..c0c6f2c 100644
--- a/src/harfbuzz-gdef.c
+++ b/src/harfbuzz-gdef.c
@@ -442,7 +442,11 @@ static HB_Error Load_CaretValue( HB_CaretValue* cv,
if ( ACCESS_Frame( 2L ) )
return error;
+#ifdef HB_SUPPORT_MULTIPLE_MASTER
cv->cvf.cvf4.IdCaretValue = GET_UShort();
+#else
+ (void) GET_UShort();
+#endif
FORGET_Frame();
break;
diff --git a/src/harfbuzz-gpos-private.h b/src/harfbuzz-gpos-private.h
index 54bbe01..50fd252 100644
--- a/src/harfbuzz-gpos-private.h
+++ b/src/harfbuzz-gpos-private.h
@@ -53,10 +53,12 @@ struct HB_ValueRecord_
advance */
HB_Device YAdvanceDevice; /* device table for vertical
advance */
+#ifdef HB_SUPPORT_MULTIPLE_MASTER
HB_UShort XIdPlacement; /* horizontal placement metric ID */
HB_UShort YIdPlacement; /* vertical placement metric ID */
HB_UShort XIdAdvance; /* horizontal advance metric ID */
HB_UShort YIdAdvance; /* vertical advance metric ID */
+#endif
};
typedef struct HB_ValueRecord_ HB_ValueRecord;
@@ -109,6 +111,7 @@ struct HB_AnchorFormat3_
typedef struct HB_AnchorFormat3_ HB_AnchorFormat3;
+#ifdef HB_SUPPORT_MULTIPLE_MASTER
struct HB_AnchorFormat4_
{
HB_UShort XIdAnchor; /* horizontal metric ID */
@@ -116,6 +119,7 @@ struct HB_AnchorFormat4_
};
typedef struct HB_AnchorFormat4_ HB_AnchorFormat4;
+#endif
struct HB_Anchor_
@@ -128,7 +132,9 @@ struct HB_Anchor_
HB_AnchorFormat1 af1;
HB_AnchorFormat2 af2;
HB_AnchorFormat3 af3;
+#ifdef HB_SUPPORT_MULTIPLE_MASTER
HB_AnchorFormat4 af4;
+#endif
} af;
};
diff --git a/src/harfbuzz-gpos.c b/src/harfbuzz-gpos.c
index 356dc01..a105ce0 100644
--- a/src/harfbuzz-gpos.c
+++ b/src/harfbuzz-gpos.c
@@ -57,6 +57,7 @@ static HB_Error GPOS_Do_Glyph_Lookup( GPOS_Instance* gpi,
+#ifdef HB_SUPPORT_MULTIPLE_MASTER
/* the client application must replace this with something more
meaningful if multiple master fonts are to be supported. */
@@ -71,6 +72,7 @@ static HB_Error default_mmfunc( HB_Font font,
HB_UNUSED(data);
return ERR(HB_Err_Not_Covered); /* ERR() call intended */
}
+#endif
@@ -97,7 +99,9 @@ HB_Error HB_Load_GPOS_Table( HB_Stream stream,
if ( ALLOC ( gpos, sizeof( *gpos ) ) )
return error;
+#ifdef HB_SUPPORT_MULTIPLE_MASTER
gpos->mmfunc = default_mmfunc;
+#endif
/* skip version */
@@ -381,48 +385,72 @@ static HB_Error Load_ValueRecord( HB_ValueRecord* vr,
if ( ACCESS_Frame( 2L ) )
goto Fail1;
+#ifdef HB_SUPPORT_MULTIPLE_MASTER
vr->XIdPlacement = GET_UShort();
+#else
+ (void) GET_UShort();
+#endif
FORGET_Frame();
}
+#ifdef HB_SUPPORT_MULTIPLE_MASTER
else
vr->XIdPlacement = 0;
+#endif
if ( format & HB_GPOS_FORMAT_HAVE_Y_ID_PLACEMENT )
{
if ( ACCESS_Frame( 2L ) )
goto Fail1;
+#ifdef HB_SUPPORT_MULTIPLE_MASTER
vr->YIdPlacement = GET_UShort();
+#else
+ (void) GET_UShort();
+#endif
FORGET_Frame();
}
+#ifdef HB_SUPPORT_MULTIPLE_MASTER
else
vr->YIdPlacement = 0;
+#endif
if ( format & HB_GPOS_FORMAT_HAVE_X_ID_ADVANCE )
{
if ( ACCESS_Frame( 2L ) )
goto Fail1;
+#ifdef HB_SUPPORT_MULTIPLE_MASTER
vr->XIdAdvance = GET_UShort();
+#else
+ (void) GET_UShort();
+#endif
FORGET_Frame();
}
+#ifdef HB_SUPPORT_MULTIPLE_MASTER
else
vr->XIdAdvance = 0;
+#endif
if ( format & HB_GPOS_FORMAT_HAVE_Y_ID_ADVANCE )
{
if ( ACCESS_Frame( 2L ) )
goto Fail1;
+#ifdef HB_SUPPORT_MULTIPLE_MASTER
vr->YIdAdvance = GET_UShort();
+#else
+ (void) GET_UShort();
+#endif
FORGET_Frame();
}
+#ifdef HB_SUPPORT_MULTIPLE_MASTER
else
vr->YIdAdvance = 0;
+#endif
return HB_Err_Ok;
@@ -457,10 +485,12 @@ static HB_Error Get_ValueRecord( GPOS_Instance* gpi,
HB_UShort format,
HB_Position gd )
{
- HB_Fixed value;
HB_Short pixel_value;
HB_Error error = HB_Err_Ok;
+#ifdef HB_SUPPORT_MULTIPLE_MASTER
HB_GPOSHeader* gpos = gpi->gpos;
+ HB_Fixed value;
+#endif
HB_UShort x_ppem, y_ppem;
HB_16Dot16 x_scale, y_scale;
@@ -511,6 +541,7 @@ static HB_Error Get_ValueRecord( GPOS_Instance* gpi,
}
}
+#ifdef HB_SUPPORT_MULTIPLE_MASTER
/* values returned from mmfunc() are already in fractional pixels */
if ( format & HB_GPOS_FORMAT_HAVE_X_ID_PLACEMENT )
@@ -545,6 +576,7 @@ static HB_Error Get_ValueRecord( GPOS_Instance* gpi,
return error;
gd->y_advance += value;
}
+#endif
return error;
}
@@ -654,8 +686,13 @@ static HB_Error Load_Anchor( HB_Anchor* an,
if ( ACCESS_Frame( 4L ) )
return error;
+#ifdef HB_SUPPORT_MULTIPLE_MASTER
an->af.af4.XIdAnchor = GET_UShort();
an->af.af4.YIdAnchor = GET_UShort();
+#else
+ (void) GET_UShort();
+ (void) GET_UShort();
+#endif
FORGET_Frame();
break;
@@ -690,7 +727,9 @@ static HB_Error Get_Anchor( GPOS_Instance* gpi,
{
HB_Error error = HB_Err_Ok;
+#ifdef HB_SUPPORT_MULTIPLE_MASTER
HB_GPOSHeader* gpos = gpi->gpos;
+#endif
HB_UShort ap;
HB_Short pixel_value;
@@ -756,6 +795,7 @@ static HB_Error Get_Anchor( GPOS_Instance* gpi,
break;
case 4:
+#ifdef HB_SUPPORT_MULTIPLE_MASTER
error = (gpos->mmfunc)( gpi->font, an->af.af4.XIdAnchor,
x_value, gpos->data );
if ( error )
@@ -766,6 +806,9 @@ static HB_Error Get_Anchor( GPOS_Instance* gpi,
if ( error )
return error;
break;
+#else
+ return ERR(HB_Err_Not_Covered);
+#endif
}
return error;
@@ -5966,8 +6009,7 @@ HB_Error HB_GPOS_Clear_Features( HB_GPOSHeader* gpos )
return HB_Err_Ok;
}
-
-
+#ifdef HB_SUPPORT_MULTIPLE_MASTER
HB_Error HB_GPOS_Register_MM_Function( HB_GPOSHeader* gpos,
HB_MMFunction mmfunc,
void* data )
@@ -5980,6 +6022,7 @@ HB_Error HB_GPOS_Register_MM_Function( HB_GPOSHeader* gpos,
return HB_Err_Ok;
}
+#endif
/* If `dvi' is TRUE, glyph contour points for anchor points and device
tables are ignored -- you will get device independent values. */
diff --git a/src/harfbuzz-gpos.h b/src/harfbuzz-gpos.h
index 2840dae..92bff84 100644
--- a/src/harfbuzz-gpos.h
+++ b/src/harfbuzz-gpos.h
@@ -44,6 +44,7 @@ HB_BEGIN_HEADER
#define HB_GPOS_LOOKUP_CHAIN 8
#define HB_GPOS_LOOKUP_EXTENSION 9
+#ifdef HB_SUPPORT_MULTIPLE_MASTER
/* A pointer to a function which accesses the PostScript interpreter.
Multiple Master fonts need this interface to convert a metric ID
(as stored in an OpenType font version 1.2 or higher) `metric_id'
@@ -59,6 +60,7 @@ typedef HB_Error (*HB_MMFunction)(HB_Font font,
HB_UShort metric_id,
HB_Fixed* metric_value,
void* data );
+#endif
struct HB_GPOSHeader_
@@ -71,12 +73,14 @@ struct HB_GPOSHeader_
HB_GDEFHeader* gdef;
+#ifdef HB_SUPPORT_MULTIPLE_MASTER
/* this is OpenType 1.2 -- Multiple Master fonts need this
callback function to get various metric values from the
PostScript interpreter. */
HB_MMFunction mmfunc;
void* data;
+#endif
};
typedef struct HB_GPOSHeader_ HB_GPOSHeader;
@@ -129,9 +133,11 @@ HB_Error HB_GPOS_Add_Feature( HB_GPOSHeader* gpos,
HB_Error HB_GPOS_Clear_Features( HB_GPOSHeader* gpos );
+#ifdef HB_SUPPORT_MULTIPLE_MASTER
HB_Error HB_GPOS_Register_MM_Function( HB_GPOSHeader* gpos,
HB_MMFunction mmfunc,
void* data );
+#endif
/* If `dvi' is TRUE, glyph contour points for anchor points and device
tables are ignored -- you will get device independent values. */
commit 40fb1998d0a47f2577855a9b076c0fbe2f676fcf
Author: Andreas Kling <andreas.kling at nokia.com>
Date: Tue Jun 15 09:44:51 2010 +0200
Shrink twelve HB_UShorts that only need to contain HB_Bytes.
Signed-off-by: Simon Hausmann <simon.hausmann at nokia.com>
Signed-off-by: Lars Knoll <lars.knoll at nokia.com>
diff --git a/src/harfbuzz-gdef-private.h b/src/harfbuzz-gdef-private.h
index da06b6f..31d68f7 100644
--- a/src/harfbuzz-gdef-private.h
+++ b/src/harfbuzz-gdef-private.h
@@ -79,7 +79,7 @@ typedef struct HB_CaretValueFormat4_ HB_CaretValueFormat4;
struct HB_CaretValue_
{
- HB_UShort CaretValueFormat; /* 1, 2, 3, or 4 */
+ HB_Byte CaretValueFormat; /* 1, 2, 3, or 4 */
union
{
diff --git a/src/harfbuzz-gpos-private.h b/src/harfbuzz-gpos-private.h
index 4110700..54bbe01 100644
--- a/src/harfbuzz-gpos-private.h
+++ b/src/harfbuzz-gpos-private.h
@@ -120,7 +120,7 @@ typedef struct HB_AnchorFormat4_ HB_AnchorFormat4;
struct HB_Anchor_
{
- HB_UShort PosFormat; /* 1, 2, 3, or 4 -- 0 indicates
+ HB_Byte PosFormat; /* 1, 2, 3, or 4 -- 0 indicates
that there is no Anchor table */
union
@@ -175,7 +175,7 @@ typedef struct HB_SinglePosFormat2_ HB_SinglePosFormat2;
struct HB_SinglePos_
{
- HB_UShort PosFormat; /* 1 or 2 */
+ HB_Byte PosFormat; /* 1 or 2 */
HB_Coverage Coverage; /* Coverage table */
HB_UShort ValueFormat; /* format of ValueRecord table */
@@ -255,7 +255,7 @@ typedef struct HB_PairPosFormat2_ HB_PairPosFormat2;
struct HB_PairPos_
{
- HB_UShort PosFormat; /* 1 or 2 */
+ HB_Byte PosFormat; /* 1 or 2 */
HB_Coverage Coverage; /* Coverage table */
HB_UShort ValueFormat1; /* format of ValueRecord table
for first glyph */
@@ -507,7 +507,7 @@ typedef struct HB_ContextPosFormat3_ HB_ContextPosFormat3;
struct HB_ContextPos_
{
- HB_UShort PosFormat; /* 1, 2, or 3 */
+ HB_Byte PosFormat; /* 1, 2, or 3 */
union
{
@@ -656,7 +656,7 @@ typedef struct HB_ChainContextPosFormat3_ HB_ChainContextPosFormat3;
struct HB_ChainContextPos_
{
- HB_UShort PosFormat; /* 1, 2, or 3 */
+ HB_Byte PosFormat; /* 1, 2, or 3 */
union
{
diff --git a/src/harfbuzz-gsub-private.h b/src/harfbuzz-gsub-private.h
index dd5ffdf..4e08839 100644
--- a/src/harfbuzz-gsub-private.h
+++ b/src/harfbuzz-gsub-private.h
@@ -58,7 +58,7 @@ typedef struct HB_SingleSubstFormat2_ HB_SingleSubstFormat2;
struct HB_SingleSubst_
{
- HB_UShort SubstFormat; /* 1 or 2 */
+ HB_Byte SubstFormat; /* 1 or 2 */
HB_Coverage Coverage; /* Coverage table */
union
@@ -255,7 +255,7 @@ typedef struct HB_ContextSubstFormat3_ HB_ContextSubstFormat3;
struct HB_ContextSubst_
{
- HB_UShort SubstFormat; /* 1, 2, or 3 */
+ HB_Byte SubstFormat; /* 1, 2, or 3 */
union
{
@@ -404,7 +404,7 @@ typedef struct HB_ChainContextSubstFormat3_ HB_ChainContextSubstFormat3;
struct HB_ChainContextSubst_
{
- HB_UShort SubstFormat; /* 1, 2, or 3 */
+ HB_Byte SubstFormat; /* 1, 2, or 3 */
union
{
diff --git a/src/harfbuzz-open.h b/src/harfbuzz-open.h
index bdc6358..7d3bc1b 100644
--- a/src/harfbuzz-open.h
+++ b/src/harfbuzz-open.h
@@ -196,7 +196,7 @@ typedef struct HB_CoverageFormat2_ HB_CoverageFormat2;
struct HB_Coverage_
{
- HB_UShort CoverageFormat; /* 1 or 2 */
+ HB_Byte CoverageFormat; /* 1 or 2 */
union
{
@@ -244,7 +244,7 @@ struct HB_ClassDefinition_
{
HB_Bool loaded;
- HB_UShort ClassFormat; /* 1 or 2 */
+ HB_Byte ClassFormat; /* 1 or 2 */
union
{
@@ -260,7 +260,7 @@ struct HB_Device_
{
HB_UShort StartSize; /* smallest size to correct */
HB_UShort EndSize; /* largest size to correct */
- HB_UShort DeltaFormat; /* DeltaValue array data format:
+ HB_Byte DeltaFormat; /* DeltaValue array data format:
1, 2, or 3 */
HB_UShort* DeltaValue; /* array of compressed data */
};
More information about the HarfBuzz
mailing list