summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <andreas.kling@nokia.com>2010-06-15 09:45:13 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2010-06-15 14:58:19 +0200
commitce1f5b080dc944c05fbf16ee1b3669add709b427 (patch)
tree6918bef599c3ee089b8dce4aea2219948a9c6e83
parent40fb1998d0a47f2577855a9b076c0fbe2f676fcf (diff)
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@nokia.com> Signed-off-by: Lars Knoll <lars.knoll@nokia.com>
-rw-r--r--src/harfbuzz-dump.c2
-rw-r--r--src/harfbuzz-gdef-private.h4
-rw-r--r--src/harfbuzz-gdef.c4
-rw-r--r--src/harfbuzz-gpos-private.h6
-rw-r--r--src/harfbuzz-gpos.c49
-rw-r--r--src/harfbuzz-gpos.h6
6 files changed, 68 insertions, 3 deletions
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. */