Code

* src/libnrtype/FontInstance.cpp: patch from David Turner of the
authormjwybrow <mjwybrow@users.sourceforge.net>
Sat, 20 May 2006 00:07:15 +0000 (00:07 +0000)
committermjwybrow <mjwybrow@users.sourceforge.net>
Sat, 20 May 2006 00:07:15 +0000 (00:07 +0000)
      FreeType Project.  Fixes a compilation problem and a possible
      segmentation fault.

ChangeLog
src/libnrtype/FontInstance.cpp

index 5bf5721a563bf554dde0951a1e2f43181f1bb7c1..b1fad2013549b70cc0c5a2a10f3a8a58eb2d1673 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-05-20  Michael Wybrow  <mjwybrow@users.sourceforge.net>
+
+       * src/libnrtype/FontInstance.cpp: patch from David Turner of the
+         FreeType Project.  Fixes a compilation problem and a possible
+         segmentation fault.
+
 2006-05-18  Jon A. Cruz  <jon@joncruz.org>
        * src/layer-manager.cpp, src/dialogs/layers-panel.h,
          src/dialogs/layers-panel.cpp:
index b06b74d90a0c8a02e0866b2f35ac8d424cbbee1a..504cab76aa1a08c4c26137e6f53a091f6739b8e2 100644 (file)
 #include "RasterFont.h"
 
 /* Freetype 2 */
-# include <freetype/ftoutln.h>
-# include <freetype/ftbbox.h>
-# include <freetype/tttags.h>
+# include <ft2build.h>
+# include FT_OUTLINE_H
+# include FT_BBOX_H
+# include FT_TRUETYPE_TAGS_H
+# include FT_TRUETYPE_TABLES_H
 # include <pango/pangoft2.h>
 
 
@@ -402,7 +404,7 @@ void font_instance::LoadGlyph(int glyph_id)
        if ( pFont == NULL ) return;
     InitTheFace();
 #ifndef USE_PANGO_WIN32
-       if ( theFace->units_per_EM == 0 ) return; // bitmap font
+       if ( !FT_IS_SCALABLE(theFace) ) return; // bitmap font
 #endif
 
        if ( id_to_no.find(glyph_id) == id_to_no.end() ) {
@@ -514,10 +516,10 @@ void font_instance::LoadGlyph(int glyph_id)
                        }
                        if ( theFace->glyph->format == ft_glyph_format_outline ) {
                                FT_Outline_Funcs ft2_outline_funcs = {
-                                       ft2_move_to,
-                                       ft2_line_to,
-                                       ft2_conic_to,
-                                       ft2_cubic_to,
+                                       (FT_Outline_MoveToFunc)  ft2_move_to,
+                                       (FT_Outline_LineToFunc)  ft2_line_to,
+                                       (FT_Outline_ConicToFunc) ft2_conic_to,
+                                       (FT_Outline_CubicToFunc) ft2_cubic_to,
                                        0, 0
                                };
                                n_g.outline=new Path;
@@ -557,7 +559,7 @@ bool font_instance::FontMetrics(double &ascent,double &descent,double &leading)
     descent=fabs(otm.otmDescent*scale);
     leading=fabs(otm.otmLineGap*scale);
 #else
-       if ( theFace->units_per_EM == 0 ) return false; // bitmap font
+       if ( !FT_IS_SCALABLE(theFace) ) return false; // bitmap font
        ascent=fabs(((double)theFace->ascender)/((double)theFace->units_per_EM));
        descent=fabs(((double)theFace->descender)/((double)theFace->units_per_EM));
        leading=fabs(((double)theFace->height)/((double)theFace->units_per_EM));
@@ -581,7 +583,7 @@ bool font_instance::FontSlope(double &run, double &rise)
     run=otm.otmsCharSlopeRun;
     rise=otm.otmsCharSlopeRise;
 #else
-       if ( theFace->units_per_EM == 0 ) return false; // bitmap font
+       if ( !FT_IS_SCALABLE(theFace) ) return false; // bitmap font
        
     TT_HoriHeader *hhea = (TT_HoriHeader*)FT_Get_Sfnt_Table(theFace, ft_sfnt_hhea);
     if (hhea == NULL) return false;