Commit 35222ff7bb7000298af514e7693af5f1ff1c8417

Wu, Chia-I (吳佳一) 2006-02-14T07:25:57

Clean up the SFNT_Interface. In this final pass, `load_hmtx' is splitted from `load_hhea'. * include/freetype/internal/sfnt.h, src/sfnt/sfdriver.c, src/sfnt/ttmtx.c, src/sfnt/ttmtx.h: Split `hmtx' from `hhea'. * src/sfnt/sfobjs.c (sfnt_load_face): Update.

diff --git a/ChangeLog b/ChangeLog
index 6bbe779..bcd15cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2006-02-13  Chia-I Wu  <b90201047@ntu.edu.tw>
 
+	Clean up the SFNT_Interface.  In this final pass, `load_hmtx' is
+	splitted from `load_hhea'.
+
+	* include/freetype/internal/sfnt.h, src/sfnt/sfdriver.c,
+	src/sfnt/ttmtx.c, src/sfnt/ttmtx.h: Split `hmtx' from `hhea'.
+
+	* src/sfnt/sfobjs.c (sfnt_load_face): Update.
+
+2006-02-13  Chia-I Wu  <b90201047@ntu.edu.tw>
+
 	* src/sfnt/ttmtx.h, src/sfnt/ttmtx.c: Why are there two copies of
 	code...
 
diff --git a/include/freetype/internal/sfnt.h b/include/freetype/internal/sfnt.h
index 4d54fb3..e49e023 100644
--- a/include/freetype/internal/sfnt.h
+++ b/include/freetype/internal/sfnt.h
@@ -512,6 +512,7 @@ FT_BEGIN_HEADER
     /* be called from external modules, if there is a need to do so */
     TT_Load_Table_Func           load_head;
     TT_Load_Metrics_Func         load_hhea;
+    TT_Load_Metrics_Func         load_hmtx;
     TT_Load_Table_Func           load_cmap;
     TT_Load_Table_Func           load_maxp;
     TT_Load_Table_Func           load_os2;
diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c
index f451950..8a8b3e8 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -390,6 +390,7 @@
 
     tt_face_load_head,
     tt_face_load_hhea,
+    tt_face_load_hmtx,
     tt_face_load_cmap,
     tt_face_load_maxp,
     tt_face_load_os2,
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index e16cc94..169fba2 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -561,12 +561,14 @@
     if ( !is_apple_sbit )
     {
       /* load the `hhea' and `hmtx' tables at once */
-      error = sfnt->load_hhea( face, stream, 0 );
+      error = sfnt->load_hhea( face, stream, 0 ) ||
+              sfnt->load_hmtx( face, stream, 0 );
       if ( error )
         goto Exit;
 
       /* try to load the `vhea' and `vmtx' tables at once */
-      error = sfnt->load_hhea( face, stream, 1 );
+      error = sfnt->load_hhea( face, stream, 1 ) ||
+              sfnt->load_hmtx( face, stream, 1 );
       if ( error )
         goto Exit;
 
diff --git a/src/sfnt/ttmtx.c b/src/sfnt/ttmtx.c
index 86436ed..43a1953 100644
--- a/src/sfnt/ttmtx.c
+++ b/src/sfnt/ttmtx.c
@@ -55,7 +55,7 @@
   /*                                                                       */
 #ifdef FT_OPTIMIZE_MEMORY
 
-  static FT_Error
+  FT_LOCAL_DEF( FT_Error )
   tt_face_load_hmtx( TT_Face    face,
                      FT_Stream  stream,
                      FT_Bool    vertical )
@@ -130,7 +130,7 @@
 
 #else /* !OPTIMIZE_MEMORY */
 
-  static FT_Error
+  FT_LOCAL_DEF( FT_Error )
   tt_face_load_hmtx( TT_Face    face,
                      FT_Stream  stream,
                      FT_Bool    vertical )
@@ -378,9 +378,7 @@
 
     FT_TRACE2(( "loaded\n" ));
 
-    /* Now try to load the corresponding metrics */
-
-    error = tt_face_load_hmtx( face, stream, vertical );
+    return SFNT_Err_Ok;
 
   Exit:
     return error;
diff --git a/src/sfnt/ttmtx.h b/src/sfnt/ttmtx.h
index 425a616..8b91a11 100644
--- a/src/sfnt/ttmtx.h
+++ b/src/sfnt/ttmtx.h
@@ -35,6 +35,12 @@ FT_BEGIN_HEADER
 
 
   FT_LOCAL( FT_Error )
+  tt_face_load_hmtx( TT_Face    face,
+                     FT_Stream  stream,
+                     FT_Bool    vertical );
+
+
+  FT_LOCAL( FT_Error )
   tt_face_get_metrics( TT_Face     face,
                        FT_Bool     vertical,
                        FT_UInt     gindex,