shithub: freetype+ttf2subf

Download patch

ref: c06aba285fc2223885288dfaab1cd0a8342ae939
parent: f9ca2bb58a3c8e70cf5e0e0d2580c50385c48df0
author: David Turner <[email protected]>
date: Fri Jun 30 19:38:23 EDT 2000

updated the CHANGES file, plus a few fix in "ftstring" to
display monochrome glyphs too

git/fs: mount .git/fs: mount/attach disallowed
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,43 @@
 LATEST CHANGES
 
+  - CHANGES TO THE HIGH-LEVEL API
+  
+    o FT_Get_Kerning has a new parameter that allows you to select
+      the coordinates of the kerning vector ( font units, scaled,
+      scaled + grid-fitted ).
+      
+    o the outline functions are now in <freetype/ftoutln.h> and not
+      part of <freetype/freetype.h> anymore
+      
+    o <freetype/ftmodule.h> now contains declarations for
+       FT_New_Library, FT_Done_Library, FT_Add_Default_Modules
+
+    o the so-called convenience functions have moved from "ftoutln.c"
+      to "ftglyph.c", and are thus available with this optional component
+      of the library. They are declared in <freetype/ftglyph.h> now..
+
+    o anti-aliased rendering is now the default for FT_Render_Glyph
+      (i.e. corresponds to render_mode == 0 == ft_render_mode_normal).
+      To generate a monochrome bitmap, use ft_render_mode_mono, or the
+      FT_LOAD_MONOCHROME flag in FT_Load_Glyph/FT_Load_Char.
+      
+      FT_LOAD_ANTI_ALIAS is still defined, but values to 0.
+      
+    o <freetype/freetype.h> now include <freetype/config/ftconfig.h>,
+      solving a few headaches :-)
+
+    o the type FT_GlyphSlotRec has now a "library" field.
+
+
+
+  - CHANGES TO THE "ftglyph.h" API
+  
+    This API has been severely modified in order to make it simpler,
+    clearer, and more efficient. It certainly now looks like a real
+    "glyph factory" object, and allows client applications to manage
+    (i.e. transform, bbox and render) glyph images without ever knowing
+    their original format.
+
   - added support for CID-keyed fonts to the CFF driver.
     maybe support for pure CFF + CEF fonts should come in ??
 
@@ -13,6 +51,22 @@
     Also removed the use of "cidafm" for now, even if the source files
     are still there. This functionality will certainly go into a specific
     module..
+
+
+
+  - ADDED SUPPORT FOR THE AUTO-HINTER    
+  
+    It works :-) I have a demo program which simply is a copy of "ftview"
+    that does a FT_Add_Module( library, &autohinter_module_class ) after
+    library initialisation, and Type 1 & OpenType/CFF fonts are now hinted.
+    
+    CID fonts are not hinted, as they include no charmap and the auto-hinter
+    doesn't include "generic" global metrics computations yet..
+    
+    Now, I need to release this thing to the FreeType 2 source..
+
+
+  
     
 
   - CHANGES TO THE RENDERER MODULES
--- a/demos/src/ftstring.c
+++ b/demos/src/ftstring.c
@@ -190,48 +190,6 @@
 
  /**************************************************************
   *
-  *  Compute the dimension of a string of glyphs in pixels
-  *
-  */
-  static void  compute_bbox( FT_BBox*  abbox )
-  {
-    PGlyph  glyph = glyphs;
-    FT_BBox bbox;
-    int     n;
-
-    bbox.xMin = 32000; bbox.xMax = -32000;
-    bbox.yMin = 32000; bbox.yMax = -32000;
-
-    for ( n = 0; n < num_glyphs; n++, glyph++ )
-    {
-      FT_BBox  cbox;
-      FT_Pos   x, y;
-
-      if (!glyph->image) continue;
-
-      x = glyph->pos.x;
-      y = glyph->pos.y;
-
-      FT_Glyph_Get_CBox( glyph->image,
-                         ft_glyph_bbox_gridfit,
-                         &cbox );
-
-      cbox.xMin += x;
-      cbox.yMin += y;
-      cbox.xMax += x;
-      cbox.yMax += y;
-
-      if (cbox.xMin < bbox.xMin) bbox.xMin = cbox.xMin;
-      if (cbox.xMax > bbox.xMax) bbox.xMax = cbox.xMax;
-      if (cbox.yMin < bbox.yMin) bbox.yMin = cbox.yMin;
-      if (cbox.yMax > bbox.yMax) bbox.yMax = cbox.yMax;
-    }
-    *abbox = bbox;
-  }
-
-
- /**************************************************************
-  *
   *  Layout a string of glyphs, the glyphs are untransformed..
   *
   */
@@ -346,7 +304,8 @@
         {             
           /* convert to a bitmap - destroy native image */
           error = FT_Glyph_To_Bitmap( &image,
-                                      ft_render_mode_normal,
+                                      antialias ? ft_render_mode_normal
+                                                : ft_render_mode_mono,
                                       0, 1 );
           if (!error)
           {
@@ -586,8 +545,8 @@
   static void  usage( char*  execname )
   {
     fprintf( stderr,  "\n" );
-    fprintf( stderr,  "ftview: simple string viewer -- part of the FreeType project\n" );
-    fprintf( stderr,  "------------------------------------------------------------\n" );
+    fprintf( stderr,  "ftstring: string viewer -- part of the FreeType project\n" );
+    fprintf( stderr,  "-------------------------------------------------------\n" );
     fprintf( stderr,  "\n" );
     fprintf( stderr,  "Usage: %s [options below] ppem fontname[.ttf|.ttc] ...\n",
              execname );
@@ -679,6 +638,10 @@
     strncpy( filename, argv[file], 128 );
     strncpy( alt_filename, argv[file], 128 );
 
+   /* first, try to load the glyph name as-is */
+    error = FT_New_Face( library, filename, 0, &face );
+    if (!error) goto Success;
+
 #ifndef macintosh
     if ( i >= 0 )
     {
@@ -687,11 +650,11 @@
     }
 #endif
 
-    /* Load face */
-
+   /* if it didn't work, try to add ".ttf" at the end */
     error = FT_New_Face( library, filename, 0, &face );
     if (error) goto Display_Font;
 
+  Success:
     /* prepare the text to be rendered */
     prepare_text( (unsigned char*)Text );
 
@@ -733,11 +696,8 @@
       {
         /* layout & render string */
         {
-          FT_BBox  bbox;
-
           reset_transform();
           layout_glyphs();
-          compute_bbox( &bbox );
           render_string( bit.width/2, bit.rows/2 );
         }
 
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -1822,7 +1822,7 @@
   /*    FT_Render_Glyph.                                                   */
   /*                                                                       */
   /*                                                                       */
-#define FT_LOAD_MONOCHROME  0  /* this is the default */
+#define FT_LOAD_MONOCHROME  4096
 
 
   /*************************************************************************/