Browse Source

Delete unused source.

Signed-off-by: John Floren <john@jfloren.net>
John Floren 7 years ago
parent
commit
14d77f7c4c
100 changed files with 0 additions and 16192 deletions
  1. 0 17
      sys/src/libfreetype/src/Jamfile
  2. 0 123
      sys/src/libfreetype/src/autohint/CatharonLicense.txt
  3. 0 21
      sys/src/libfreetype/src/autohint/Jamfile
  4. 0 882
      sys/src/libfreetype/src/autohint/ahoptim.c
  5. 0 32
      sys/src/libfreetype/src/autohint/autohint.c
  6. 0 25
      sys/src/libfreetype/src/autohint/descrip.mms
  7. 0 78
      sys/src/libfreetype/src/autohint/mather.py
  8. 0 25
      sys/src/libfreetype/src/autohint/module.mk
  9. 0 78
      sys/src/libfreetype/src/autohint/rules.mk
  10. 0 37
      sys/src/libfreetype/src/base/Jamfile
  11. 0 23
      sys/src/libfreetype/src/base/descrip.mms
  12. 0 34
      sys/src/libfreetype/src/base/ftbase.c
  13. 0 197
      sys/src/libfreetype/src/base/ftexcept.c
  14. 0 246
      sys/src/libfreetype/src/base/fthash.c
  15. 0 217
      sys/src/libfreetype/src/base/ftlist.c
  16. 0 919
      sys/src/libfreetype/src/base/ftmac.c
  17. 0 396
      sys/src/libfreetype/src/base/ftobject.c
  18. 0 286
      sys/src/libfreetype/src/base/ftsynth.c
  19. 0 131
      sys/src/libfreetype/src/base/ftsysio.c
  20. 0 30
      sys/src/libfreetype/src/base/ftsysmem.c
  21. 0 94
      sys/src/libfreetype/src/base/rules.mk
  22. 0 21
      sys/src/libfreetype/src/bdf/Jamfile
  23. 0 148
      sys/src/libfreetype/src/bdf/README
  24. 0 34
      sys/src/libfreetype/src/bdf/bdf.c
  25. 0 23
      sys/src/libfreetype/src/bdf/descrip.mms
  26. 0 31
      sys/src/libfreetype/src/bdf/module.mk
  27. 0 79
      sys/src/libfreetype/src/bdf/rules.mk
  28. 0 27
      sys/src/libfreetype/src/cache/Jamfile
  29. 0 26
      sys/src/libfreetype/src/cache/descrip.mms
  30. 0 31
      sys/src/libfreetype/src/cache/ftcache.c
  31. 0 80
      sys/src/libfreetype/src/cache/rules.mk
  32. 0 21
      sys/src/libfreetype/src/cff/Jamfile
  33. 0 29
      sys/src/libfreetype/src/cff/cff.c
  34. 0 23
      sys/src/libfreetype/src/cff/descrip.mms
  35. 0 22
      sys/src/libfreetype/src/cff/module.mk
  36. 0 71
      sys/src/libfreetype/src/cff/rules.mk
  37. 0 21
      sys/src/libfreetype/src/cid/Jamfile
  38. 0 23
      sys/src/libfreetype/src/cid/descrip.mms
  39. 0 21
      sys/src/libfreetype/src/cid/module.mk
  40. 0 70
      sys/src/libfreetype/src/cid/rules.mk
  41. 0 29
      sys/src/libfreetype/src/cid/type1cid.c
  42. 0 8
      sys/src/libfreetype/src/gzip/Jamfile
  43. 0 48
      sys/src/libfreetype/src/gzip/adler32.c
  44. 0 23
      sys/src/libfreetype/src/gzip/descrip.mms
  45. 0 563
      sys/src/libfreetype/src/gzip/ftgzip.c
  46. 0 386
      sys/src/libfreetype/src/gzip/infblock.c
  47. 0 36
      sys/src/libfreetype/src/gzip/infblock.h
  48. 0 250
      sys/src/libfreetype/src/gzip/infcodes.c
  49. 0 31
      sys/src/libfreetype/src/gzip/infcodes.h
  50. 0 151
      sys/src/libfreetype/src/gzip/inffixed.h
  51. 0 273
      sys/src/libfreetype/src/gzip/inflate.c
  52. 0 460
      sys/src/libfreetype/src/gzip/inftrees.c
  53. 0 63
      sys/src/libfreetype/src/gzip/inftrees.h
  54. 0 86
      sys/src/libfreetype/src/gzip/infutil.c
  55. 0 96
      sys/src/libfreetype/src/gzip/infutil.h
  56. 0 74
      sys/src/libfreetype/src/gzip/rules.mk
  57. 0 278
      sys/src/libfreetype/src/gzip/zconf.h
  58. 0 830
      sys/src/libfreetype/src/gzip/zlib.h
  59. 0 181
      sys/src/libfreetype/src/gzip/zutil.c
  60. 0 211
      sys/src/libfreetype/src/gzip/zutil.h
  61. 0 205
      sys/src/libfreetype/src/otlayout/otlayout.h
  62. 0 181
      sys/src/libfreetype/src/otlayout/otlbase.c
  63. 0 14
      sys/src/libfreetype/src/otlayout/otlbase.h
  64. 0 940
      sys/src/libfreetype/src/otlayout/otlcommn.c
  65. 0 277
      sys/src/libfreetype/src/otlayout/otlcommn.h
  66. 0 78
      sys/src/libfreetype/src/otlayout/otlconf.h
  67. 0 175
      sys/src/libfreetype/src/otlayout/otlgdef.c
  68. 0 14
      sys/src/libfreetype/src/otlayout/otlgdef.h
  69. 0 980
      sys/src/libfreetype/src/otlayout/otlgpos.c
  70. 0 14
      sys/src/libfreetype/src/otlayout/otlgpos.h
  71. 0 867
      sys/src/libfreetype/src/otlayout/otlgsub.c
  72. 0 26
      sys/src/libfreetype/src/otlayout/otlgsub.h
  73. 0 189
      sys/src/libfreetype/src/otlayout/otljstf.c
  74. 0 14
      sys/src/libfreetype/src/otlayout/otljstf.h
  75. 0 142
      sys/src/libfreetype/src/otlayout/otlparse.c
  76. 0 99
      sys/src/libfreetype/src/otlayout/otlparse.h
  77. 0 60
      sys/src/libfreetype/src/otlayout/otltable.h
  78. 0 88
      sys/src/libfreetype/src/otlayout/otltags.h
  79. 0 33
      sys/src/libfreetype/src/otlayout/otlutils.h
  80. 0 21
      sys/src/libfreetype/src/pcf/Jamfile
  81. 0 35
      sys/src/libfreetype/src/pcf/descrip.mms
  82. 0 32
      sys/src/libfreetype/src/pcf/module.mk
  83. 0 36
      sys/src/libfreetype/src/pcf/pcf.c
  84. 0 237
      sys/src/libfreetype/src/pcf/pcf.h
  85. 0 545
      sys/src/libfreetype/src/pcf/pcfdriver.c
  86. 0 44
      sys/src/libfreetype/src/pcf/pcfdriver.h
  87. 0 40
      sys/src/libfreetype/src/pcf/pcferror.h
  88. 0 1058
      sys/src/libfreetype/src/pcf/pcfread.c
  89. 0 45
      sys/src/libfreetype/src/pcf/pcfread.h
  90. 0 215
      sys/src/libfreetype/src/pcf/pcfutil.c
  91. 0 58
      sys/src/libfreetype/src/pcf/pcfutil.h
  92. 0 114
      sys/src/libfreetype/src/pcf/readme
  93. 0 80
      sys/src/libfreetype/src/pcf/rules.mk
  94. 0 21
      sys/src/libfreetype/src/pfr/Jamfile
  95. 0 23
      sys/src/libfreetype/src/pfr/descrip.mms
  96. 0 22
      sys/src/libfreetype/src/pfr/module.mk
  97. 0 29
      sys/src/libfreetype/src/pfr/pfr.c
  98. 0 158
      sys/src/libfreetype/src/pfr/pfrcmap.c
  99. 0 46
      sys/src/libfreetype/src/pfr/pfrcmap.h
  100. 0 168
      sys/src/libfreetype/src/pfr/pfrdrivr.c

+ 0 - 17
sys/src/libfreetype/src/Jamfile

@@ -1,17 +0,0 @@
-# FreeType 2 src Jamfile (c) 2001, 2002 David Turner
-#
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) ;
-
-# The file <freetype/internal/internal.h> is used to define macros that are
-# later used in #include statements.  It needs to be parsed in order to
-# record these definitions.
-#
-HDRMACRO  [ FT2_SubDir $(FT2_INCLUDE_DIR) internal internal.h ] ;
-
-for xx in $(FT2_COMPONENTS)
-{
-  SubInclude FT2_TOP $(FT2_SRC_DIR) $(xx) ;
-}
-
-# end of src Jamfile

+ 0 - 123
sys/src/libfreetype/src/autohint/CatharonLicense.txt

@@ -1,123 +0,0 @@
-                  The Catharon Open Source LICENSE
-                    ----------------------------
-
-                            2000-Jul-04
-
-          Copyright (C) 2000 by Catharon Productions, Inc.
-
-
-
-Introduction
-============
-
-  This  license  applies to  source  files  distributed by  Catharon
-  Productions,  Inc.  in  several  archive packages.   This  license
-  applies  to all files  found in  such packages  which do  not fall
-  under their own explicit license.
-
-  This  license   was  inspired  by  the  BSD,   Artistic,  and  IJG
-  (Independent JPEG  Group) licenses, which  all encourage inclusion
-  and  use of  free  software in  commercial  and freeware  products
-  alike.  As a consequence, its main points are that:
-
-    o We  don't promise that  this software works.  However,  we are
-      interested in any kind of bug reports. (`as is' distribution)
-
-    o You can  use this software for whatever you  want, in parts or
-      full form, without having to pay us. (`royalty-free' usage)
-
-    o You may not pretend that  you wrote this software.  If you use
-      it, or  only parts of it,  in a program,  you must acknowledge
-      somewhere  in  your  documentation  that  you  have  used  the
-      Catharon Code. (`credits')
-
-  We  specifically  permit  and  encourage  the  inclusion  of  this
-  software, with  or without modifications,  in commercial products.
-  We disclaim  all warranties  covering the packages  distributed by
-  Catharon  Productions, Inc.  and  assume no  liability related  to
-  their use.
-
-
-Legal Terms
-===========
-
-0. Definitions
---------------
-
-  Throughout this license,  the terms `Catharon Package', `package',
-  and  `Catharon  Code'  refer   to  the  set  of  files  originally
-  distributed by Catharon Productions, Inc.
-
-  `You' refers to  the licensee, or person using  the project, where
-  `using' is a generic term including compiling the project's source
-  code as  well as linking it  to form a  `program' or `executable'.
-  This  program  is referred  to  as `a  program  using  one of  the
-  Catharon Packages'.
-
-  This  license applies  to all  files distributed  in  the original
-  Catharon  Package(s),  including  all  source code,  binaries  and
-  documentation,  unless  otherwise  stated   in  the  file  in  its
-  original, unmodified form as  distributed in the original archive.
-  If you are  unsure whether or not a particular  file is covered by
-  this license, you must contact us to verify this.
-
-  The  Catharon   Packages  are  copyright  (C)   2000  by  Catharon
-  Productions, Inc.  All rights reserved except as specified below.
-
-1. No Warranty
---------------
-
-  THE CATHARON PACKAGES ARE PROVIDED `AS IS' WITHOUT WARRANTY OF ANY
-  KIND, EITHER  EXPRESS OR IMPLIED,  INCLUDING, BUT NOT  LIMITED TO,
-  WARRANTIES  OF  MERCHANTABILITY   AND  FITNESS  FOR  A  PARTICULAR
-  PURPOSE.  IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS
-  BE LIABLE FOR ANY DAMAGES CAUSED BY THE USE OF OR THE INABILITY TO
-  USE THE CATHARON PACKAGE.
-
-2. Redistribution
------------------
-
-  This  license  grants  a  worldwide, royalty-free,  perpetual  and
-  irrevocable right  and license to use,  execute, perform, compile,
-  display,  copy,   create  derivative  works   of,  distribute  and
-  sublicense the  Catharon Packages (in both source  and object code
-  forms)  and  derivative works  thereof  for  any  purpose; and  to
-  authorize others  to exercise  some or all  of the  rights granted
-  herein, subject to the following conditions:
-
-    o Redistribution  of source code  must retain this  license file
-      (`license.txt') unaltered; any additions, deletions or changes
-      to   the  original   files  must   be  clearly   indicated  in
-      accompanying  documentation.   The  copyright notices  of  the
-      unaltered, original  files must be preserved in  all copies of
-      source files.
-
-    o Redistribution  in binary form must provide  a disclaimer that
-      states  that the  software is  based in  part on  the  work of
-      Catharon Productions, Inc. in the distribution documentation.
-
-  These conditions  apply to any  software derived from or  based on
-  the Catharon Packages, not just  the unmodified files.  If you use
-  our work, you  must acknowledge us.  However, no  fee need be paid
-  to us.
-
-3. Advertising
---------------
-
-  Neither Catharon Productions, Inc.  and contributors nor you shall
-  use  the  name  of  the  other  for  commercial,  advertising,  or
-  promotional purposes without specific prior written permission.
-
-  We suggest, but do not  require, that you use the following phrase
-  to refer to this software in your documentation: 'this software is
-  based in part on the Catharon Typography Project'.
-
-  As  you have  not signed  this license,  you are  not  required to
-  accept  it.  However,  as  the Catharon  Packages are  copyrighted
-  material, only  this license, or  another one contracted  with the
-  authors, grants you  the right to use, distribute,  and modify it.
-  Therefore,  by  using,  distributing,  or modifying  the  Catharon
-  Packages,  you indicate  that you  understand and  accept  all the
-  terms of this license.
-
---- end of license.txt ---

+ 0 - 21
sys/src/libfreetype/src/autohint/Jamfile

@@ -1,21 +0,0 @@
-# FreeType 2 src/autohint Jamfile (c) 2001 David Turner
-#
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) autohint ;
-
-{
-  local  _sources ;
-
-  if $(FT2_MULTI)
-  {
-    _sources = ahangles ahglobal ahglyph ahhint ahmodule ;
-  }
-  else
-  {
-    _sources = autohint ;
-  }
-
-  Library  $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/autohint Jamfile

+ 0 - 882
sys/src/libfreetype/src/autohint/ahoptim.c

@@ -1,882 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  ahoptim.c                                                              */
-/*                                                                         */
-/*    FreeType auto hinting outline optimization (body).                   */
-/*                                                                         */
-/*  Copyright 2000-2001, 2002 Catharon Productions Inc.                    */
-/*  Author: David Turner                                                   */
-/*                                                                         */
-/*  This file is part of the Catharon Typography Project and shall only    */
-/*  be used, modified, and distributed under the terms of the Catharon     */
-/*  Open Source License that should come with this file under the name     */
-/*  `CatharonLicense.txt'.  By continuing to use, modify, or distribute    */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/*  Note that this license is compatible with the FreeType license.        */
-/*                                                                         */
-/***************************************************************************/
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* This module is in charge of optimising the outlines produced by the   */
-  /* auto-hinter in direct mode. This is required at small pixel sizes in  */
-  /* order to ensure coherent spacing, among other things..                */
-  /*                                                                       */
-  /* The technique used in this module is a simplified simulated           */
-  /* annealing.                                                            */
-  /*                                                                       */
-  /*************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H       /* for FT_ALLOC_ARRAY() and FT_FREE() */
-#include "ahoptim.h"
-
-
-  /* define this macro to use brute force optimization -- this is slow,  */
-  /* but a good way to perfect the distortion function `by hand' through */
-  /* tweaking                                                            */
-#define AH_BRUTE_FORCE
-
-
-#define xxxAH_DEBUG_OPTIM
-
-
-#undef LOG
-#ifdef AH_DEBUG_OPTIM
-
-#define LOG( x )  optim_log ## x
-
-#else
-
-#define LOG( x )
-
-#endif /* AH_DEBUG_OPTIM */
-
-
-#ifdef AH_DEBUG_OPTIM
-
-#include <stdarg.h>
-#include <stdlib.h>
-
-#define FLOAT( x )  ( (float)( (x) / 64.0 ) )
-
-
-  static void
-  optim_log( const char*  fmt, ... )
-  {
-    va_list  ap;
-
-
-    va_start( ap, fmt );
-    vprintf( fmt, ap );
-    va_end( ap );
-  }
-
-
-  static void
-  AH_Dump_Stems( AH_Optimizer*  optimizer )
-  {
-    int       n;
-    AH_Stem*  stem;
-
-
-    stem = optimizer->stems;
-    for ( n = 0; n < optimizer->num_stems; n++, stem++ )
-    {
-      LOG(( " %c%2d [%.1f:%.1f]={%.1f:%.1f}="
-            "<%1.f..%1.f> force=%.1f speed=%.1f\n",
-            optimizer->vertical ? 'V' : 'H', n,
-            FLOAT( stem->edge1->opos ), FLOAT( stem->edge2->opos ),
-            FLOAT( stem->edge1->pos ),  FLOAT( stem->edge2->pos ),
-            FLOAT( stem->min_pos ),     FLOAT( stem->max_pos ),
-            FLOAT( stem->force ),       FLOAT( stem->velocity ) ));
-    }
-  }
-
-
-  static void
-  AH_Dump_Stems2( AH_Optimizer*  optimizer )
-  {
-    int       n;
-    AH_Stem*  stem;
-
-
-    stem = optimizer->stems;
-    for ( n = 0; n < optimizer->num_stems; n++, stem++ )
-    {
-      LOG(( " %c%2d [%.1f]=<%1.f..%1.f> force=%.1f speed=%.1f\n",
-            optimizer->vertical ? 'V' : 'H', n,
-            FLOAT( stem->pos ),
-            FLOAT( stem->min_pos ), FLOAT( stem->max_pos ),
-            FLOAT( stem->force ),   FLOAT( stem->velocity ) ));
-    }
-  }
-
-
-  static void
-  AH_Dump_Springs( AH_Optimizer*  optimizer )
-  {
-    int  n;
-    AH_Spring*  spring;
-    AH_Stem*    stems;
-
-
-    spring = optimizer->springs;
-    stems  = optimizer->stems;
-    LOG(( "%cSprings ", optimizer->vertical ? 'V' : 'H' ));
-
-    for ( n = 0; n < optimizer->num_springs; n++, spring++ )
-    {
-      LOG(( " [%d-%d:%.1f:%1.f:%.1f]",
-            spring->stem1 - stems, spring->stem2 - stems,
-            FLOAT( spring->owidth ),
-            FLOAT( spring->stem2->pos -
-                   ( spring->stem1->pos + spring->stem1->width ) ),
-            FLOAT( spring->tension ) ));
-    }
-
-    LOG(( "\n" ));
-  }
-
-#endif /* AH_DEBUG_OPTIM */
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-  /****                                                                 ****/
-  /****   COMPUTE STEMS AND SPRINGS IN AN OUTLINE                       ****/
-  /****                                                                 ****/
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-
-
-  static int
-  valid_stem_segments( AH_Segment  seg1,
-                       AH_Segment  seg2 )
-  {
-    return seg1->serif == 0                   &&
-           seg2                               &&
-           seg2->link == seg1                 &&
-           seg1->pos < seg2->pos              &&
-           seg1->min_coord <= seg2->max_coord &&
-           seg2->min_coord <= seg1->max_coord;
-  }
-
-
-  /* compute all stems in an outline */
-  static int
-  optim_compute_stems( AH_Optimizer*  optimizer )
-  {
-    AH_Outline  outline = optimizer->outline;
-    FT_Fixed    scale;
-    FT_Memory   memory  = optimizer->memory;
-    FT_Error    error   = 0;
-    FT_Int      dimension;
-    AH_Edge     edges;
-    AH_Edge     edge_limit;
-    AH_Stem**   p_stems;
-    FT_Int*     p_num_stems;
-
-
-    edges      = outline->horz_edges;
-    edge_limit = edges + outline->num_hedges;
-    scale      = outline->y_scale;
-
-    p_stems     = &optimizer->horz_stems;
-    p_num_stems = &optimizer->num_hstems;
-
-    for ( dimension = 1; dimension >= 0; dimension-- )
-    {
-      AH_Stem*  stems     = 0;
-      FT_Int    num_stems = 0;
-      AH_Edge   edge;
-
-
-      /* first of all, count the number of stems in this direction */
-      for ( edge = edges; edge < edge_limit; edge++ )
-      {
-        AH_Segment  seg = edge->first;
-
-
-        do
-        {
-          if (valid_stem_segments( seg, seg->link ) )
-            num_stems++;
-
-          seg = seg->edge_next;
-
-        } while ( seg != edge->first );
-      }
-
-      /* now allocate the stems and build their table */
-      if ( num_stems > 0 )
-      {
-        AH_Stem*  stem;
-
-
-        if ( FT_NEW_ARRAY( stems, num_stems ) )
-          goto Exit;
-
-        stem = stems;
-        for ( edge = edges; edge < edge_limit; edge++ )
-        {
-          AH_Segment  seg = edge->first;
-          AH_Segment  seg2;
-
-
-          do
-          {
-            seg2 = seg->link;
-            if ( valid_stem_segments( seg, seg2 ) )
-            {
-              AH_Edge  edge1 = seg->edge;
-              AH_Edge  edge2 = seg2->edge;
-
-
-              stem->edge1  = edge1;
-              stem->edge2  = edge2;
-              stem->opos   = edge1->opos;
-              stem->pos    = edge1->pos;
-              stem->owidth = edge2->opos - edge1->opos;
-              stem->width  = edge2->pos  - edge1->pos;
-
-              /* compute min_coord and max_coord */
-              {
-                FT_Pos  min_coord = seg->min_coord;
-                FT_Pos  max_coord = seg->max_coord;
-
-
-                if ( seg2->min_coord > min_coord )
-                  min_coord = seg2->min_coord;
-
-                if ( seg2->max_coord < max_coord )
-                  max_coord = seg2->max_coord;
-
-                stem->min_coord = min_coord;
-                stem->max_coord = max_coord;
-              }
-
-              /* compute minimum and maximum positions for stem --   */
-              /* note that the left-most/bottom-most stem has always */
-              /* a fixed position                                    */
-              if ( stem == stems || edge1->blue_edge || edge2->blue_edge )
-              {
-                /* this stem cannot move; it is snapped to a blue edge */
-                stem->min_pos = stem->pos;
-                stem->max_pos = stem->pos;
-              }
-              else
-              {
-                /* this edge can move; compute its min and max positions */
-                FT_Pos  pos1 = stem->opos;
-                FT_Pos  pos2 = pos1 + stem->owidth - stem->width;
-                FT_Pos  min1 = pos1 & -64;
-                FT_Pos  min2 = pos2 & -64;
-
-
-                stem->min_pos = min1;
-                stem->max_pos = min1 + 64;
-                if ( min2 < min1 )
-                  stem->min_pos = min2;
-                else
-                  stem->max_pos = min2 + 64;
-
-                /* XXX: just to see what it does */
-                stem->max_pos += 64;
-
-                /* just for the case where direct hinting did some */
-                /* incredible things (e.g. blue edge shifts)       */
-                if ( stem->min_pos > stem->pos )
-                  stem->min_pos = stem->pos;
-
-                if ( stem->max_pos < stem->pos )
-                  stem->max_pos = stem->pos;
-              }
-
-              stem->velocity = 0;
-              stem->force    = 0;
-
-              stem++;
-            }
-            seg = seg->edge_next;
-
-          } while ( seg != edge->first );
-        }
-      }
-
-      *p_stems     = stems;
-      *p_num_stems = num_stems;
-
-      edges      = outline->vert_edges;
-      edge_limit = edges + outline->num_vedges;
-      scale      = outline->x_scale;
-
-      p_stems     = &optimizer->vert_stems;
-      p_num_stems = &optimizer->num_vstems;
-    }
-
-  Exit:
-
-#ifdef AH_DEBUG_OPTIM
-    AH_Dump_Stems( optimizer );
-#endif
-
-    return error;
-  }
-
-
-  /* returns the spring area between two stems, 0 if none */
-  static FT_Pos
-  stem_spring_area( AH_Stem*  stem1,
-                    AH_Stem*  stem2 )
-  {
-    FT_Pos  area1 = stem1->max_coord - stem1->min_coord;
-    FT_Pos  area2 = stem2->max_coord - stem2->min_coord;
-    FT_Pos  min   = stem1->min_coord;
-    FT_Pos  max   = stem1->max_coord;
-    FT_Pos  area;
-
-
-    /* order stems */
-    if ( stem2->opos <= stem1->opos + stem1->owidth )
-      return 0;
-
-    if ( min < stem2->min_coord )
-      min = stem2->min_coord;
-
-    if ( max < stem2->max_coord )
-      max = stem2->max_coord;
-
-    area = ( max-min );
-    if ( 2 * area < area1 && 2 * area < area2 )
-      area = 0;
-
-    return area;
-  }
-
-
-  /* compute all springs in an outline */
-  static int
-  optim_compute_springs( AH_Optimizer*  optimizer )
-  {
-    /* basically, a spring exists between two stems if most of their */
-    /* surface is aligned                                            */
-    FT_Memory    memory  = optimizer->memory;
-
-    AH_Stem*     stems;
-    AH_Stem*     stem_limit;
-    AH_Stem*     stem;
-    int          dimension;
-    int          error = 0;
-
-    FT_Int*      p_num_springs;
-    AH_Spring**  p_springs;
-
-
-    stems      = optimizer->horz_stems;
-    stem_limit = stems + optimizer->num_hstems;
-
-    p_springs     = &optimizer->horz_springs;
-    p_num_springs = &optimizer->num_hsprings;
-
-    for ( dimension = 1; dimension >= 0; dimension-- )
-    {
-      FT_Int      num_springs = 0;
-      AH_Spring*  springs     = 0;
-
-
-      /* first of all, count stem springs */
-      for ( stem = stems; stem + 1 < stem_limit; stem++ )
-      {
-        AH_Stem*  stem2;
-
-
-        for ( stem2 = stem+1; stem2 < stem_limit; stem2++ )
-          if ( stem_spring_area( stem, stem2 ) )
-            num_springs++;
-      }
-
-      /* then allocate and build the springs table */
-      if ( num_springs > 0 )
-      {
-        AH_Spring*  spring;
-
-
-        /* allocate table of springs */
-        if ( FT_NEW_ARRAY( springs, num_springs ) )
-          goto Exit;
-
-        /* fill the springs table */
-        spring = springs;
-        for ( stem = stems; stem+1 < stem_limit; stem++ )
-        {
-          AH_Stem*  stem2;
-          FT_Pos    area;
-
-
-          for ( stem2 = stem + 1; stem2 < stem_limit; stem2++ )
-          {
-            area = stem_spring_area( stem, stem2 );
-            if ( area )
-            {
-              /* add a new spring here */
-              spring->stem1   = stem;
-              spring->stem2   = stem2;
-              spring->owidth  = stem2->opos - ( stem->opos + stem->owidth );
-              spring->tension = 0;
-
-              spring++;
-            }
-          }
-        }
-      }
-      *p_num_springs = num_springs;
-      *p_springs     = springs;
-
-      stems      = optimizer->vert_stems;
-      stem_limit = stems + optimizer->num_vstems;
-
-      p_springs     = &optimizer->vert_springs;
-      p_num_springs = &optimizer->num_vsprings;
-    }
-
-  Exit:
-
-#ifdef AH_DEBUG_OPTIM
-    AH_Dump_Springs( optimizer );
-#endif
-
-    return error;
-  }
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-  /****                                                                 ****/
-  /****   OPTIMIZE THROUGH MY STRANGE SIMULATED ANNEALING ALGO ;-)      ****/
-  /****                                                                 ****/
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-
-#ifndef AH_BRUTE_FORCE
-
-  /* compute all spring tensions */
-  static void
-  optim_compute_tensions( AH_Optimizer*  optimizer )
-  {
-    AH_Spring*  spring = optimizer->springs;
-    AH_Spring*  limit  = spring + optimizer->num_springs;
-
-
-    for ( ; spring < limit; spring++ )
-    {
-      AH_Stem*  stem1 = spring->stem1;
-      AH_Stem*  stem2 = spring->stem2;
-      FT_Int    status;
-
-      FT_Pos  width;
-      FT_Pos  tension;
-      FT_Pos  sign;
-
-
-      /* compute the tension; it simply is -K*(new_width-old_width) */
-      width   = stem2->pos - ( stem1->pos + stem1->width );
-      tension = width - spring->owidth;
-
-      sign = 1;
-      if ( tension < 0 )
-      {
-        sign    = -1;
-        tension = -tension;
-      }
-
-      if ( width <= 0 )
-        tension = 32000;
-      else
-        tension = ( tension << 10 ) / width;
-
-      tension = -sign * FT_MulFix( tension, optimizer->tension_scale );
-      spring->tension = tension;
-
-      /* now, distribute tension among the englobing stems, if they */
-      /* are able to move                                           */
-      status = 0;
-      if ( stem1->pos <= stem1->min_pos )
-        status |= 1;
-      if ( stem2->pos >= stem2->max_pos )
-        status |= 2;
-
-      if ( !status )
-        tension /= 2;
-
-      if ( ( status & 1 ) == 0 )
-        stem1->force -= tension;
-
-      if ( ( status & 2 ) == 0 )
-        stem2->force += tension;
-    }
-  }
-
-
-  /* compute all stem movements -- returns 0 if nothing moved */
-  static int
-  optim_compute_stem_movements( AH_Optimizer*  optimizer )
-  {
-    AH_Stem*  stems = optimizer->stems;
-    AH_Stem*  limit = stems + optimizer->num_stems;
-    AH_Stem*  stem  = stems;
-    int       moved = 0;
-
-
-    /* set initial forces to velocity */
-    for ( stem = stems; stem < limit; stem++ )
-    {
-      stem->force     = stem->velocity;
-      stem->velocity /= 2;                  /* XXX: Heuristics */
-    }
-
-    /* compute the sum of forces applied on each stem */
-    optim_compute_tensions( optimizer );
-
-#ifdef AH_DEBUG_OPTIM
-    AH_Dump_Springs( optimizer );
-    AH_Dump_Stems2( optimizer );
-#endif
-
-    /* now, see whether something can move */
-    for ( stem = stems; stem < limit; stem++ )
-    {
-      if ( stem->force > optimizer->tension_threshold )
-      {
-        /* there is enough tension to move the stem to the right */
-        if ( stem->pos < stem->max_pos )
-        {
-          stem->pos     += 64;
-          stem->velocity = stem->force / 2;
-          moved          = 1;
-        }
-        else
-          stem->velocity = 0;
-      }
-      else if ( stem->force < optimizer->tension_threshold )
-      {
-        /* there is enough tension to move the stem to the left */
-        if ( stem->pos > stem->min_pos )
-        {
-          stem->pos     -= 64;
-          stem->velocity = stem->force / 2;
-          moved          = 1;
-        }
-        else
-          stem->velocity = 0;
-      }
-    }
-
-    /* return 0 if nothing moved */
-    return moved;
-  }
-
-#endif /* AH_BRUTE_FORCE */
-
-
-  /* compute current global distortion from springs */
-  static FT_Pos
-  optim_compute_distortion( AH_Optimizer*  optimizer )
-  {
-    AH_Spring*  spring = optimizer->springs;
-    AH_Spring*  limit  = spring + optimizer->num_springs;
-    FT_Pos      distortion = 0;
-
-
-    for ( ; spring < limit; spring++ )
-    {
-      AH_Stem*  stem1 = spring->stem1;
-      AH_Stem*  stem2 = spring->stem2;
-      FT_Pos  width;
-
-      width  = stem2->pos - ( stem1->pos + stem1->width );
-      width -= spring->owidth;
-      if ( width < 0 )
-        width = -width;
-
-      distortion += width;
-    }
-
-    return distortion;
-  }
-
-
-  /* record stems configuration in `best of' history */
-  static void
-  optim_record_configuration( AH_Optimizer*  optimizer )
-  {
-    FT_Pos             distortion;
-    AH_Configuration*  configs = optimizer->configs;
-    AH_Configuration*  limit   = configs + optimizer->num_configs;
-    AH_Configuration*  config;
-
-
-    distortion = optim_compute_distortion( optimizer );
-    LOG(( "config distortion = %.1f ", FLOAT( distortion * 64 ) ));
-
-    /* check that we really need to add this configuration to our */
-    /* sorted history                                             */
-    if ( limit > configs && limit[-1].distortion < distortion )
-    {
-      LOG(( "ejected\n" ));
-      return;
-    }
-
-    /* add new configuration at the end of the table */
-    {
-      int  n;
-
-
-      config = limit;
-      if ( optimizer->num_configs < AH_MAX_CONFIGS )
-        optimizer->num_configs++;
-      else
-        config--;
-
-      config->distortion = distortion;
-
-      for ( n = 0; n < optimizer->num_stems; n++ )
-        config->positions[n] = optimizer->stems[n].pos;
-    }
-
-    /* move the current configuration towards the front of the list */
-    /* when necessary -- yes this is slow bubble sort ;-)           */
-    while ( config > configs && config[0].distortion < config[-1].distortion )
-    {
-      AH_Configuration  temp;
-
-
-      config--;
-      temp      = config[0];
-      config[0] = config[1];
-      config[1] = temp;
-    }
-    LOG(( "recorded!\n" ));
-  }
-
-
-#ifdef AH_BRUTE_FORCE
-
-  /* optimize outline in a single direction */
-  static void
-  optim_compute( AH_Optimizer*  optimizer )
-  {
-    int       n;
-    FT_Bool   moved;
-
-    AH_Stem*  stem  = optimizer->stems;
-    AH_Stem*  limit = stem + optimizer->num_stems;
-
-
-    /* empty, exit */
-    if ( stem >= limit )
-      return;
-
-    optimizer->num_configs = 0;
-
-    stem = optimizer->stems;
-    for ( ; stem < limit; stem++ )
-      stem->pos = stem->min_pos;
-
-    do
-    {
-      /* record current configuration */
-      optim_record_configuration( optimizer );
-
-      /* now change configuration */
-      moved = 0;
-      for ( stem = optimizer->stems; stem < limit; stem++ )
-      {
-        if ( stem->pos < stem->max_pos )
-        {
-          stem->pos += 64;
-          moved      = 1;
-          break;
-        }
-
-        stem->pos = stem->min_pos;
-      }
-    } while ( moved );
-
-    /* now, set the best stem positions */
-    for ( n = 0; n < optimizer->num_stems; n++ )
-    {
-      AH_Stem*  stem = optimizer->stems + n;
-      FT_Pos    pos  = optimizer->configs[0].positions[n];
-
-
-      stem->edge1->pos = pos;
-      stem->edge2->pos = pos + stem->width;
-
-      stem->edge1->flags |= AH_EDGE_DONE;
-      stem->edge2->flags |= AH_EDGE_DONE;
-    }
-  }
-
-#else /* AH_BRUTE_FORCE */
-
-  /* optimize outline in a single direction */
-  static void
-  optim_compute( AH_Optimizer*  optimizer )
-  {
-    int  n, counter, counter2;
-
-
-    optimizer->num_configs       = 0;
-    optimizer->tension_scale     = 0x80000L;
-    optimizer->tension_threshold = 64;
-
-    /* record initial configuration threshold */
-    optim_record_configuration( optimizer );
-
-    counter = 0;
-    for ( counter2 = optimizer->num_stems*8; counter2 >= 0; counter2-- )
-    {
-      if ( counter == 0 )
-        counter = 2 * optimizer->num_stems;
-
-      if ( !optim_compute_stem_movements( optimizer ) )
-        break;
-
-      optim_record_configuration( optimizer );
-
-      counter--;
-      if ( counter == 0 )
-        optimizer->tension_scale /= 2;
-    }
-
-    /* now, set the best stem positions */
-    for ( n = 0; n < optimizer->num_stems; n++ )
-    {
-      AH_Stem*  stem = optimizer->stems + n;
-      FT_Pos    pos  = optimizer->configs[0].positions[n];
-
-
-      stem->edge1->pos = pos;
-      stem->edge2->pos = pos + stem->width;
-
-      stem->edge1->flags |= AH_EDGE_DONE;
-      stem->edge2->flags |= AH_EDGE_DONE;
-    }
-  }
-
-#endif /* AH_BRUTE_FORCE */
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-  /****                                                                 ****/
-  /****   HIGH-LEVEL OPTIMIZER API                                      ****/
-  /****                                                                 ****/
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-
-
-  /* releases the optimization data */
-  void
-  AH_Optimizer_Done( AH_Optimizer*  optimizer )
-  {
-    if ( optimizer )
-    {
-      FT_Memory  memory = optimizer->memory;
-
-
-      FT_FREE( optimizer->horz_stems );
-      FT_FREE( optimizer->vert_stems );
-      FT_FREE( optimizer->horz_springs );
-      FT_FREE( optimizer->vert_springs );
-      FT_FREE( optimizer->positions );
-    }
-  }
-
-
-  /* loads the outline into the optimizer */
-  int
-  AH_Optimizer_Init( AH_Optimizer*  optimizer,
-                     AH_Outline     outline,
-                     FT_Memory      memory )
-  {
-    FT_Error  error;
-
-
-    FT_MEM_ZERO( optimizer, sizeof ( *optimizer ) );
-    optimizer->outline = outline;
-    optimizer->memory  = memory;
-
-    LOG(( "initializing new optimizer\n" ));
-    /* compute stems and springs */
-    error = optim_compute_stems  ( optimizer ) ||
-            optim_compute_springs( optimizer );
-    if ( error )
-      goto Fail;
-
-    /* allocate stem positions history and configurations */
-    {
-      int  n, max_stems;
-
-
-      max_stems = optimizer->num_hstems;
-      if ( max_stems < optimizer->num_vstems )
-        max_stems = optimizer->num_vstems;
-
-      if ( FT_NEW_ARRAY( optimizer->positions, max_stems * AH_MAX_CONFIGS ) )
-        goto Fail;
-
-      optimizer->num_configs = 0;
-      for ( n = 0; n < AH_MAX_CONFIGS; n++ )
-        optimizer->configs[n].positions = optimizer->positions +
-                                          n * max_stems;
-    }
-
-    return error;
-
-  Fail:
-    AH_Optimizer_Done( optimizer );
-    return error;
-  }
-
-
-  /* compute optimal outline */
-  void
-  AH_Optimizer_Compute( AH_Optimizer*  optimizer )
-  {
-    optimizer->num_stems   = optimizer->num_hstems;
-    optimizer->stems       = optimizer->horz_stems;
-    optimizer->num_springs = optimizer->num_hsprings;
-    optimizer->springs     = optimizer->horz_springs;
-
-    if ( optimizer->num_springs > 0 )
-    {
-      LOG(( "horizontal optimization ------------------------\n" ));
-      optim_compute( optimizer );
-    }
-
-    optimizer->num_stems   = optimizer->num_vstems;
-    optimizer->stems       = optimizer->vert_stems;
-    optimizer->num_springs = optimizer->num_vsprings;
-    optimizer->springs     = optimizer->vert_springs;
-
-    if ( optimizer->num_springs )
-    {
-      LOG(( "vertical optimization --------------------------\n" ));
-      optim_compute( optimizer );
-    }
-  }
-
-
-/* END */

+ 0 - 32
sys/src/libfreetype/src/autohint/autohint.c

@@ -1,32 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  autohint.c                                                             */
-/*                                                                         */
-/*    Automatic Hinting wrapper (body only).                               */
-/*                                                                         */
-/*  Copyright 2000-2001 Catharon Productions Inc.                          */
-/*  Author: David Turner                                                   */
-/*                                                                         */
-/*  This file is part of the Catharon Typography Project and shall only    */
-/*  be used, modified, and distributed under the terms of the Catharon     */
-/*  Open Source License that should come with this file under the name     */
-/*  `CatharonLicense.txt'.  By continuing to use, modify, or distribute    */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/*  Note that this license is compatible with the FreeType license.        */
-/*                                                                         */
-/***************************************************************************/
-
-
-#define FT_MAKE_OPTION_SINGLE_OBJECT
-
-#include <ft2build.h>
-#include "ahangles.c"
-#include "ahglyph.c"
-#include "ahglobal.c"
-#include "ahhint.c"
-#include "ahmodule.c"
-
-
-/* END */

+ 0 - 25
sys/src/libfreetype/src/autohint/descrip.mms

@@ -1,25 +0,0 @@
-#
-# FreeType 2 auto-hinter module compilation rules for VMS
-#
-
-
-# Copyright 2001, 2002 Catharon Productions Inc.
-#
-# This file is part of the Catharon Typography Project and shall only
-# be used, modified, and distributed under the terms of the Catharon
-# Open Source License that should come with this file under the name
-# `CatharonLicense.txt'.  By continuing to use, modify, or distribute
-# this file you indicate that you have read the license and
-# understand and accept it fully.
-#
-# Note that this license is compatible with the FreeType license.
-
-
-CFLAGS=$(COMP_FLAGS)$(DEBUG)/incl=([--.include],[--.src.autohint])
-
-OBJS=autohint.obj
-
-all : $(OBJS)
-        library [--.lib]freetype.olb $(OBJS)
-
-# EOF

+ 0 - 78
sys/src/libfreetype/src/autohint/mather.py

@@ -1,78 +0,0 @@
-#!/usr/bin/env python
-#
-
-#
-# autohint math table builder
-#
-
-
-# Copyright 1996-2000 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-
-import math
-
-ag_pi = 256
-
-def print_arctan( atan_bits ):
-    atan_base = 1 << atan_bits
-
-    print "  static AH_Angle  ag_arctan[1L << AG_ATAN_BITS] ="
-    print "  {"
-
-    count = 0
-    line  = "   "
-
-    for n in range( atan_base ):
-        comma = ","
-        if ( n == atan_base - 1 ):
-            comma = ""
-
-        angle = math.atan( n * 1.0 / atan_base ) / math.pi * ag_pi
-        line  = line + " " + repr( int( angle + 0.5 ) ) + comma
-        count = count + 1;
-        if ( count == 8 ):
-            count = 0
-            print line
-            line = "   "
-
-    if ( count > 0 ):
-        print line
-    print "  };"
-
-
-# This routine is not used currently.
-#
-def print_sines():
-    print "  static FT_Fixed  ah_sines[AG_HALF_PI + 1] ="
-    print "  {"
-
-    count = 0
-    line  = "   "
-
-    for n in range( ag_pi / 2 ):
-        sinus = math.sin( n * math.pi / ag_pi )
-        line  = line + " " + repr( int( 65536.0 * sinus ) ) + ","
-        count = count + 1
-        if ( count == 8 ):
-            count = 0
-            print line
-            line = "   "
-
-    if ( count > 0 ):
-        print line
-    print "   65536"
-    print "  };"
-
-
-print_arctan( 8 )
-print
-
-
-# END

+ 0 - 25
sys/src/libfreetype/src/autohint/module.mk

@@ -1,25 +0,0 @@
-#
-# FreeType 2 auto-hinter module definition
-#
-
-
-# Copyright 2000 Catharon Productions Inc.
-# Author: David Turner
-#
-# This file is part of the Catharon Typography Project and shall only
-# be used, modified, and distributed under the terms of the Catharon
-# Open Source License that should come with this file under the name
-# `CatharonLicense.txt'.  By continuing to use, modify, or distribute
-# this file you indicate that you have read the license and
-# understand and accept it fully.
-#
-# Note that this license is compatible with the FreeType license.
-
-
-make_module_list: add_autohint_module
-
-add_autohint_module:
-	$(OPEN_DRIVER)autohint_module_class$(CLOSE_DRIVER)
-	$(ECHO_DRIVER)autohint  $(ECHO_DRIVER_DESC)automatic hinting module$(ECHO_DRIVER_DONE)
-
-# EOF

+ 0 - 78
sys/src/libfreetype/src/autohint/rules.mk

@@ -1,78 +0,0 @@
-#
-# FreeType 2 auto-hinter module configuration rules
-#
-
-
-# Copyright 2000, 2001 Catharon Productions Inc.
-# Author: David Turner
-#
-# This file is part of the Catharon Typography Project and shall only
-# be used, modified, and distributed under the terms of the Catharon
-# Open Source License that should come with this file under the name
-# `CatharonLicense.txt'.  By continuing to use, modify, or distribute
-# this file you indicate that you have read the license and
-# understand and accept it fully.
-#
-# Note that this license is compatible with the FreeType license.
-
-
-# AUTO driver directory
-#
-AUTO_DIR  := $(SRC_)autohint
-AUTO_DIR_ := $(AUTO_DIR)$(SEP)
-
-
-# compilation flags for the driver
-#
-AUTO_COMPILE := $(FT_COMPILE) $I$(AUTO_DIR)
-
-
-# AUTO driver sources (i.e., C files)
-#
-AUTO_DRV_SRC := $(AUTO_DIR_)ahangles.c  \
-                $(AUTO_DIR_)ahglobal.c  \
-                $(AUTO_DIR_)ahglyph.c   \
-                $(AUTO_DIR_)ahhint.c    \
-                $(AUTO_DIR_)ahmodule.c
-
-# AUTO driver headers
-#
-AUTO_DRV_H := $(AUTO_DRV_SRC:%c=%h)  \
-              $(AUTO_DIR_)ahloader.h \
-              $(AUTO_DIR_)ahtypes.h \
-              $(AUTO_DIR_)aherrors.h
-
-
-# AUTO driver object(s)
-#
-#   AUTO_DRV_OBJ_M is used during `multi' builds.
-#   AUTO_DRV_OBJ_S is used during `single' builds.
-#
-AUTO_DRV_OBJ_M := $(AUTO_DRV_SRC:$(AUTO_DIR_)%.c=$(OBJ_)%.$O)
-AUTO_DRV_OBJ_S := $(OBJ_)autohint.$O
-
-# AUTO driver source file for single build
-#
-AUTO_DRV_SRC_S := $(AUTO_DIR_)autohint.c
-
-
-# AUTO driver - single object
-#
-$(AUTO_DRV_OBJ_S): $(AUTO_DRV_SRC_S) $(AUTO_DRV_SRC) \
-                   $(FREETYPE_H) $(AUTO_DRV_H)
-	$(AUTO_COMPILE) $T$@ $(AUTO_DRV_SRC_S)
-
-
-# AUTO driver - multiple objects
-#
-$(OBJ_)%.$O: $(AUTO_DIR_)%.c $(FREETYPE_H) $(AUTO_DRV_H)
-	$(AUTO_COMPILE) $T$@ $<
-
-
-# update main driver object lists
-#
-DRV_OBJS_S += $(AUTO_DRV_OBJ_S)
-DRV_OBJS_M += $(AUTO_DRV_OBJ_M)
-
-
-# EOF

+ 0 - 37
sys/src/libfreetype/src/base/Jamfile

@@ -1,37 +0,0 @@
-# FreeType 2 src/base Jamfile (c) 2001, 2002 David Turner
-#
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) base ;
-
-
-{
-  local  _sources ;
-
-  if $(FT2_MULTI)
-  {
-    _sources = ftutil ftdbgmem ftstream ftcalc fttrigon ftgloadr ftoutln
-               ftobjs ftnames ;
-  }
-  else
-  {
-    _sources = ftbase ;
-  }
-
-  Library  $(FT2_LIB) : $(_sources).c ;
-}
-
-# Add the optional/replaceable files.
-#
-Library  $(FT2_LIB) : ftsystem.c   ftinit.c    ftglyph.c  ftmm.c     ftbdf.c
-                      ftbbox.c     ftdebug.c   ftxf86.c   fttype1.c  ftpfr.c
-                      ftstroker.c  ftwinfnt.c
-                      ;
-
-# Add Macintosh-specific file to the library when necessary.
-#
-if $(MAC)
-{
-  Library  $(FT2_LIB) : ftmac.c ;
-}
-
-# end of src/base Jamfile

+ 0 - 23
sys/src/libfreetype/src/base/descrip.mms

@@ -1,23 +0,0 @@
-#
-# FreeType 2 base layer compilation rules for VMS
-#
-
-
-# Copyright 2001 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-
-CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.builds.vms],[--.include],[--.src.base])
-
-OBJS=ftbase.obj,ftinit.obj,ftglyph.obj,ftdebug.obj,ftbdf.obj,ftmm.obj,fttype1.obj,ftxf86.obj,ftpfr.obj,ftstroker.obj,ftwinfnt.obj
-
-all : $(OBJS)
-        library [--.lib]freetype.olb $(OBJS)
-
-# EOF

+ 0 - 34
sys/src/libfreetype/src/base/ftbase.c

@@ -1,34 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  ftbase.c                                                               */
-/*                                                                         */
-/*    Single object library component (body only).                         */
-/*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-
-#define  FT_MAKE_OPTION_SINGLE_OBJECT
-
-#include "ftutil.c"
-#include "ftdbgmem.c"
-#include "ftstream.c"
-#include "ftcalc.c"
-#include "fttrigon.c"
-#include "ftoutln.c"
-#include "ftgloadr.c"
-#include "ftobjs.c"
-#include "ftnames.c"
-
-
-/* END */

+ 0 - 197
sys/src/libfreetype/src/base/ftexcept.c

@@ -1,197 +0,0 @@
-#include <ft2build.h>
-#include FT_EXCEPT_H
-
-
-  FT_BASE_DEF( void )
-  ft_cleanup_stack_init( FT_CleanupStack  stack,
-                         FT_Memory        memory )
-  {
-    stack->chunk = &stack->chunk_0;
-    stack->top   = stack->chunk->items;
-    stack->limit = stack->top + FT_CLEANUP_CHUNK_SIZE;
-    stack->chunk_0.link = NULL;
-
-    stack->memory = memory;
-  }
-
-
-
-  FT_BASE_DEF( void )
-  ft_cleanup_stack_done( FT_CleanupStack  stack )
-  {
-    FT_Memory        memory = stack->memory;
-    FT_CleanupChunk  chunk, next;
-
-    for (;;)
-    {
-      chunk = stack->chunk;
-      if ( chunk == &stack->chunk_0 )
-        break;
-
-      stack->chunk = chunk->link;
-
-      FT_Free( chunk, memory );
-    }
-
-    stack->memory = NULL;
-  }
-
-
-
-  FT_BASE_DEF( void )
-  ft_cleanup_stack_push( FT_CleanupStack  stack,
-                         FT_Pointer       item,
-                         FT_CleanupFunc   item_func,
-                         FT_Pointer       item_data )
-  {
-    FT_CleanupItem  top;
-
-
-    FT_ASSERT( stack && stack->chunk && stack->top );
-    FT_ASSERT( item  && item_func );
-
-    top = stack->top;
-
-    top->item      = item;
-    top->item_func = item_func;
-    top->item_data = item_data;
-
-    top ++;
-
-    if ( top == stack->limit )
-    {
-      FT_CleanupChunk  chunk;
-
-      chunk = FT_QAlloc( sizeof(*chunk), stack->memory );
-
-      chunk->link  = stack->chunk;
-      stack->chunk = chunk;
-      stack->limit = chunk->items + FT_CLEANUP_CHUNK_SIZE;
-      top          = chunk->items;
-    }
-
-    stack->top = top;
-  }
-
-
-
-  FT_BASE_DEF( void )
-  ft_cleanup_stack_pop( FT_CleanupStack   stack,
-                        FT_Int            destroy )
-  {
-    FT_CleanupItem  top;
-
-
-    FT_ASSERT( stack && stack->chunk && stack->top );
-    top = stack->top;
-
-    if ( top == stack->chunk->items )
-    {
-      FT_CleanupChunk  chunk;
-
-      chunk = stack->chunk;
-
-      if ( chunk == &stack->chunk_0 )
-      {
-        FT_ERROR(( "cleanup.pop: empty cleanup stack !!\n" ));
-        ft_cleanup_throw( stack, FT_Err_EmptyCleanupStack );
-      }
-
-      chunk = chunk->link;
-      FT_QFree( stack->chunk, stack->memory );
-
-      stack->chunk = chunk;
-      stack->limit = chunk->items + FT_CLEANUP_CHUNK_SIZE;
-      top          = stack->limit;
-    }
-
-    top --;
-
-    if ( destroy )
-      top->item_func( top->item, top->item_data );
-
-    top->item      = NULL;
-    top->item_func = NULL;
-    top->item_data = NULL;
-
-    stack->top = top;
-  }
-
-
-
-  FT_BASE_DEF( FT_CleanupItem )
-  ft_cleanup_stack_peek( FT_CleanupStack  stack )
-  {
-    FT_CleanupItem   top;
-    FT_CleanupChunk  chunk;
-
-
-    FT_ASSERT( stack && stack->chunk && stack->top );
-
-    top   = stack->top;
-    chunk = stack->chunk;
-
-    if ( top > chunk->items )
-      top--;
-    else
-    {
-      chunk = chunk->link;
-      top   = NULL;
-      if ( chunk != NULL )
-        top = chunk->items + FT_CLEANUP_CHUNK_SIZE - 1;
-    }
-    return top;
-  }
-
-
-
-  FT_BASE_DEF( void )
-  ft_xhandler_enter( FT_XHandler  xhandler,
-                     FT_Memory    memory )
-  {
-    FT_CleanupStack  stack = FT_MEMORY__CLEANUP(memory);
-
-    xhandler->previous = stack->xhandler;
-    xhandler->cleanup  = stack->top;
-    xhandler->error    = 0;
-    stack->xhandler    = xhandler;
-  }
-
-
-
-  FT_BASE_DEF( void )
-  ft_xhandler_exit( FT_XHandler  xhandler )
-  {
-    FT_CleanupStack  stack = FT_MEMORY__CLEANUP(memory);
-
-    stack->xhandler    = xhandler->previous;
-    xhandler->previous = NULL;
-    xhandler->error    = error;
-    xhandler->cleanup  = NULL;
-  }
-
-
-
-  FT_BASE_DEF( void )
-  ft_cleanup_throw( FT_CleanupStack  stack,
-                    FT_Error         error )
-  {
-    FT_XHandler  xhandler = stack->xhandler;
-
-    if ( xhandler == NULL )
-    {
-      /* no exception handler was registered. this  */
-      /* means that we have an un-handled exception */
-      /* the only thing we can do is _PANIC_ and    */
-      /* halt the current program..                 */
-      /*                                            */
-      FT_ERROR(( "FREETYPE PANIC: An un-handled exception occured. Program aborted" ));
-      ft_exit(1);
-    }
-
-    /* cleanup the stack until we reach the handler's */
-    /* starting stack location..                      */
-
-    xhandler->error = error;
-    longmp( xhandler->jump_buffer, 1 );
-  }                    

+ 0 - 246
sys/src/libfreetype/src/base/fthash.c

@@ -1,246 +0,0 @@
-#include <ft2build.h>
-#include FT_TYPES_H
-#include FT_INTERNAL_HASH_H
-#include FT_INTERNAL_MEMORY_H
-#include FT_INTERNAL_DEBUG_H
-
-#define  FT_HASH_MAX_LOAD  2
-#define  FT_HASH_MIN_LOAD  1
-#define  FT_HASH_SUB_LOAD  (FT_HASH_MAX_LOAD-FT_HASH_MIN_LOAD)
-
-/* this one _must_ be a power of 2 !! */
-#define  FT_HASH_INITIAL_SIZE  8
-
-
-  FT_BASE_DEF( void )
-  ft_hash_done( FT_Hash              table,
-                FT_Hash_ForeachFunc  node_func,
-                const FT_Pointer     node_data )
-  {
-    if ( table )
-    {
-      FT_Memory  memory = table->memory;
-
-      if ( node_func )
-        ft_hash_foreach( table, node_func, node_data );
-
-      FT_FREE( table->buckets );
-      table->p     = 0;
-      table->mask  = 0;
-      table->slack = 0;
-
-      table->node_equal = NULL;
-    }
-  }
-
-
-  FT_BASE_DEF( FT_UInt )
-  ft_hash_get_size( FT_Hash  table )
-  {
-    FT_UInt  result = 0;
-
-    if ( table )
-      result = (table->p + table->mask + 1)*FT_HASH_MAX_LOAD - table->slack;
-
-    return result;
-  }
-
-
-
-  FT_BASE_DEF( FT_Error )
-  ft_hash_init( FT_Hash            table,
-                FT_Hash_EqualFunc  equal,
-                FT_Memory          memory )
-  {
-    FT_Error  error;
-
-    table->memory     = memory;
-    table->p          = 0;
-    table->mask       = FT_HASH_INITIAL_SIZE-1;
-    table->slack      = FT_HASH_INITIAL_SIZE*FT_HASH_MAX_LOAD;
-    table->node_equal = equal;
-
-    (void)FT_NEW_ARRAY( table->buckets, FT_HASH_INITIAL_SIZE*2 );
-
-    return error;
-  }
-
-
-
-  FT_BASE_DEF( void )
-  ft_hash_foreach( FT_Hash              table,
-                   FT_Hash_ForeachFunc  foreach_func,
-                   const FT_Pointer     foreach_data )
-  {
-    FT_UInt       count = table->p + table->mask + 1;
-    FT_HashNode*  pnode = table->buckets;
-    FT_HashNode   node, next;
-
-    for ( ; count > 0; count--, pnode++ )
-    {
-      node = *pnode;
-      while ( node )
-      {
-        next = node->link;
-        foreach_func( node, foreach_data );
-        node = next;
-      }
-    }
-  }
-
-
-
-  FT_BASE_DEF( FT_HashLookup )
-  ft_hash_lookup( FT_Hash      table,
-                  FT_HashNode  keynode )
-  {
-    FT_UInt       index;
-    FT_UInt32     hash = keynode->hash;
-    FT_HashNode   node, *pnode;
-
-    index = (FT_UInt)(hash & table->mask);
-    if ( index < table->p )
-      index = (FT_UInt)(hash & (2*table->mask+1));
-
-    pnode = &table->buckets[index];
-    for (;;)
-    {
-      node = *pnode;
-      if ( node == NULL )
-        break;
-
-      if ( node->hash == hash && table->node_equal( node, keynode ) )
-        break;
-
-      pnode = &node->link;
-    }
-
-    return pnode;
-  }
-
-
-
-
-  FT_BASE_DEF( FT_Error )
-  ft_hash_add( FT_Hash        table,
-               FT_HashLookup  lookup,
-               FT_HashNode    new_node )
-  {
-    FT_Error     error = 0;
-
-    /* add it to the hash table */
-    new_node->link = *lookup;
-    *lookup        = new_node;
-
-    if ( --table->slack < 0 )
-    {
-      FT_UInt       p     = table->p;
-      FT_UInt       mask  = table->mask;
-      FT_HashNode   new_list, node, *pnode;
-
-      /* split a single bucket */
-      new_list = NULL;
-      pnode    = table->buckets + p;
-      for (;;)
-      {
-        node = *pnode;
-        if ( node == NULL )
-          break;
-
-        if ( node->hash & mask )
-        {
-          *pnode     = node->link;
-          node->link = new_list;
-          new_list   = node;
-        }
-        else
-          pnode = &node->link;
-      }
-
-      table->buckets[ p + mask + 1 ] = new_list;
-
-      table->slack += FT_HASH_MAX_LOAD;
-
-      if ( p >= mask )
-      {
-        FT_Memory  memory = table->memory;
-
-
-        if (FT_RENEW_ARRAY( table->buckets, (mask+1)*2, (mask+1)*4 ))
-          goto Exit;
-
-        table->mask = 2*mask + 1;
-        table->p    = 0;
-      }
-      else
-        table->p = p + 1;
-    }
-  Exit:
-    return error;
-  }
-
-
-
-  FT_BASE_DEF( FT_Error )
-  ft_hash_remove( FT_Hash        table,
-                  FT_HashLookup  lookup )
-  {
-    FT_HashNode  node;
-    FT_UInt      num_buckets;
-    FT_Error     error = 0;
-
-    FT_ASSERT( pnode != NULL && node != NULL );
-
-    node       = *lookup;
-    *lookup    = node->link;
-    node->link = NULL;
-
-    num_buckets = ( table->p + table->mask + 1) ;
-
-    if ( ++ table->slack > (FT_Long)num_buckets*FT_HASH_SUB_LOAD )
-    {
-      FT_UInt       p         = table->p;
-      FT_UInt       mask      = table->mask;
-      FT_UInt       old_index = p + mask;
-      FT_HashNode*  pnode;
-      FT_HashNode*  pold;
-
-      if ( old_index < FT_HASH_INITIAL_SIZE )
-        goto Exit;
-
-      if ( p == 0 )
-      {
-        FT_Memory  memory = table->memory;
-
-        table->mask >>= 1;
-        p             = table->mask;
-
-        if ( FT_RENEW_ARRAY( table->buckets, (mask+1)*2, (mask+1) ) )
-        {
-          /* this should never happen normally, but who knows :-)   */
-          /* we need to re-inject the node in the hash table before */
-          /* returning there, since it's safer                      */
-          pnode      = table->buckets;
-          node->link = *pnode;
-          *pnode     = node;
-
-          goto Exit;
-        }
-      }
-      else
-        p--;
-
-      pnode = table->buckets + p;
-      while ( *pnode )
-        pnode = &(*pnode)->link;
-
-      pold   = table->buckets + old_index;
-      *pnode = *pold;
-      *pold  = NULL;
-
-      table->slack -= FT_HASH_MAX_LOAD;
-      table->p      = p;
-    }
-  Exit:
-    return error;
-  }

+ 0 - 217
sys/src/libfreetype/src/base/ftlist.c

@@ -1,217 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  ftlist.c                                                               */
-/*                                                                         */
-/*    Generic list support for FreeType (body).                            */
-/*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-  /*************************************************************************/
-  /*                                                                       */
-  /*  This file implements functions relative to list processing.  Its     */
-  /*  data structures are defined in `freetype/internal/ftlist.h'.         */
-  /*                                                                       */
-  /*************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_LIST_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
-  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */
-  /* messages during execution.                                            */
-  /*                                                                       */
-#undef  FT_COMPONENT
-#define FT_COMPONENT  trace_list
-
-
-  /* documentation is in ftlist.h */
-
-  FT_EXPORT_DEF( FT_ListNode )
-  FT_List_Find( FT_List  list,
-                void*    data )
-  {
-    FT_ListNode  cur;
-
-
-    cur = list->head;
-    while ( cur )
-    {
-      if ( cur->data == data )
-        return cur;
-
-      cur = cur->next;
-    }
-
-    return (FT_ListNode)0;
-  }
-
-
-  /* documentation is in ftlist.h */
-
-  FT_EXPORT_DEF( void )
-  FT_List_Add( FT_List      list,
-               FT_ListNode  node )
-  {
-    FT_ListNode  before = list->tail;
-
-
-    node->next = 0;
-    node->prev = before;
-
-    if ( before )
-      before->next = node;
-    else
-      list->head = node;
-
-    list->tail = node;
-  }
-
-
-  /* documentation is in ftlist.h */
-
-  FT_EXPORT_DEF( void )
-  FT_List_Insert( FT_List      list,
-                  FT_ListNode  node )
-  {
-    FT_ListNode  after = list->head;
-
-
-    node->next = after;
-    node->prev = 0;
-
-    if ( !after )
-      list->tail = node;
-    else
-      after->prev = node;
-
-    list->head = node;
-  }
-
-
-  /* documentation is in ftlist.h */
-
-  FT_EXPORT_DEF( void )
-  FT_List_Remove( FT_List      list,
-                  FT_ListNode  node )
-  {
-    FT_ListNode  before, after;
-
-
-    before = node->prev;
-    after  = node->next;
-
-    if ( before )
-      before->next = after;
-    else
-      list->head = after;
-
-    if ( after )
-      after->prev = before;
-    else
-      list->tail = before;
-  }
-
-
-  /* documentation is in ftlist.h */
-
-  FT_EXPORT_DEF( void )
-  FT_List_Up( FT_List      list,
-              FT_ListNode  node )
-  {
-    FT_ListNode  before, after;
-
-
-    before = node->prev;
-    after  = node->next;
-
-    /* check whether we are already on top of the list */
-    if ( !before )
-      return;
-
-    before->next = after;
-
-    if ( after )
-      after->prev = before;
-    else
-      list->tail = before;
-
-    node->prev       = 0;
-    node->next       = list->head;
-    list->head->prev = node;
-    list->head       = node;
-  }
-
-
-  /* documentation is in ftlist.h */
-
-  FT_EXPORT_DEF( FT_Error )
-  FT_List_Iterate( FT_List            list,
-                   FT_List_Iterator   iterator,
-                   void*              user )
-  {
-    FT_ListNode  cur   = list->head;
-    FT_Error     error = FT_Err_Ok;
-
-
-    while ( cur )
-    {
-      FT_ListNode  next = cur->next;
-
-
-      error = iterator( cur, user );
-      if ( error )
-        break;
-
-      cur = next;
-    }
-
-    return error;
-  }
-
-
-  /* documentation is in ftlist.h */
-
-  FT_EXPORT_DEF( void )
-  FT_List_Finalize( FT_List             list,
-                    FT_List_Destructor  destroy,
-                    FT_Memory           memory,
-                    void*               user )
-  {
-    FT_ListNode  cur;
-
-
-    cur = list->head;
-    while ( cur )
-    {
-      FT_ListNode  next = cur->next;
-      void*        data = cur->data;
-
-
-      if ( destroy )
-        destroy( memory, data, user );
-
-      FT_FREE( cur );
-      cur = next;
-    }
-
-    list->head = 0;
-    list->tail = 0;
-  }
-
-
-/* END */

+ 0 - 919
sys/src/libfreetype/src/base/ftmac.c

@@ -1,919 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  ftmac.c                                                                */
-/*                                                                         */
-/*    Mac FOND support.  Written by just@letterror.com.                    */
-/*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
-/*  Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg.     */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-
-  /*
-    Notes
-
-    Mac suitcase files can (and often do!) contain multiple fonts.  To
-    support this I use the face_index argument of FT_(Open|New)_Face()
-    functions, and pretend the suitcase file is a collection.
-
-    Warning: Although the FOND driver sets face->num_faces field to the
-    number of available fonts, but the Type 1 driver sets it to 1 anyway.
-    So this field is currently not reliable, and I don't see a clean way
-    to  resolve that.  The face_index argument translates to
-
-      Get1IndResource( 'FOND', face_index + 1 );
-
-    so clients should figure out the resource index of the FOND.
-    (I'll try to provide some example code for this at some point.)
-
-    The Mac FOND support works roughly like this:
-
-    - Check whether the offered stream points to a Mac suitcase file.
-      This is done by checking the file type: it has to be 'FFIL' or 'tfil'.
-      The stream that gets passed to our init_face() routine is a stdio
-      stream, which isn't usable for us, since the FOND resources live
-      in the resource fork.  So we just grab the stream->pathname field.
-
-    - Read the FOND resource into memory, then check whether there is
-      a TrueType font and/or(!) a Type 1 font available.
-
-    - If there is a Type 1 font available (as a separate 'LWFN' file),
-      read its data into memory, massage it slightly so it becomes
-      PFB data, wrap it into a memory stream, load the Type 1 driver
-      and delegate the rest of the work to it by calling FT_Open_Face().
-      (XXX TODO: after this has been done, the kerning data from the FOND
-      resource should be appended to the face: On the Mac there are usually
-      no AFM files available.  However, this is tricky since we need to map
-      Mac char codes to ps glyph names to glyph ID's...)
-
-    - If there is a TrueType font (an 'sfnt' resource), read it into
-      memory, wrap it into a memory stream, load the TrueType driver
-      and delegate the rest of the work to it, by calling FT_Open_Face().
-  */
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_STREAM_H
-#include "truetype/ttobjs.h"
-#include "type1/t1objs.h"
-
-#include <Resources.h>
-#include <Fonts.h>
-#include <Errors.h>
-#include <Files.h>
-#include <TextUtils.h>
-
-
-#include FT_MAC_H
-
-
-  /* Set PREFER_LWFN to 1 if LWFN (Type 1) is preferred over
-     TrueType in case *both* are available (this is not common,
-     but it *is* possible). */
-#ifndef PREFER_LWFN
-#define PREFER_LWFN 1
-#endif
-
-  /* Given a pathname, fill in a file spec. */
-  static int
-  file_spec_from_path( const char*  pathname,
-                       FSSpec*      spec )
-  {
-#if TARGET_API_MAC_CARBON
-
-    OSErr  e;
-    FSRef  ref;
-
-
-    e = FSPathMakeRef( (UInt8 *)pathname, &ref, false /* not a directory */ );
-    if ( e == noErr )
-      e = FSGetCatalogInfo( &ref, kFSCatInfoNone, NULL, NULL, spec, NULL );
-
-    return ( e == noErr ) ? 0 : (-1);
-
-#else
-
-    Str255    p_path;
-    FT_ULong  path_len;
-
-
-    /* convert path to a pascal string */
-    path_len = ft_strlen( pathname );
-    if ( path_len > 255 )
-      return -1;
-    p_path[0] = (unsigned char)path_len;
-    ft_strncpy( (char*)p_path + 1, pathname, path_len );
-
-    if ( FSMakeFSSpec( 0, 0, p_path, spec ) != noErr )
-      return -1;
-    else
-      return 0;
-
-#endif
-  }
-
-
-  /* Return the file type of the file specified by spec. */
-  static OSType
-  get_file_type( FSSpec*  spec )
-  {
-    FInfo  finfo;
-
-
-    if ( FSpGetFInfo( spec, &finfo ) != noErr )
-      return 0;  /* file might not exist */
-
-    return finfo.fdType;
-  }
-
-
-#if TARGET_API_MAC_CARBON
-
-  /* is this a Mac OS X .dfont file */
-  static Boolean
-  is_dfont( FSSpec*  spec )
-  {
-    int  nameLen = spec->name[0];
-
-
-    return nameLen >= 6                                   &&
-           !memcmp( spec->name + nameLen - 5, ".dfont", 6 );
-  }
-
-#endif
-
-
-  /* Given a PostScript font name, create the Macintosh LWFN file name. */
-  static void
-  create_lwfn_name( char*   ps_name,
-                    Str255  lwfn_file_name )
-  {
-    int       max = 5, count = 0;
-    FT_Byte*  p = lwfn_file_name;
-    FT_Byte*  q = (FT_Byte*)ps_name;
-
-
-    lwfn_file_name[0] = 0;
-
-    while ( *q )
-    {
-      if ( isupper( *q ) )
-      {
-        if ( count )
-          max = 3;
-        count = 0;
-      }
-      if ( count < max && ( ft_isalnum( *q ) || *q == '_' ) )
-      {
-        *++p = *q;
-        lwfn_file_name[0]++;
-        count++;
-      }
-      q++;
-    }
-  }
-
-
-  /* Given a file reference, answer its location as a vRefNum
-     and a dirID. */
-  static FT_Error
-  get_file_location(int16_t           ref_num,
-                     int16_t*          v_ref_num,
-                     int32_t*           dir_id,
-                     unsigned char*  file_name )
-  {
-    FCBPBRec  pb;
-    OSErr     error;
-
-
-    pb.ioNamePtr = file_name;
-    pb.ioVRefNum = 0;
-    pb.ioRefNum  = ref_num;
-    pb.ioFCBIndx = 0;
-
-    error = PBGetFCBInfoSync( &pb );
-    if ( error == noErr )
-    {
-      *v_ref_num = pb.ioFCBVRefNum;
-      *dir_id    = pb.ioFCBParID;
-    }
-    return error;
-  }
-
-
-  /* Make a file spec for an LWFN file from a FOND resource and
-     a file name. */
-  static FT_Error
-  make_lwfn_spec( Handle          fond,
-                  unsigned char*  file_name,
-                  FSSpec*         spec )
-  {
-    FT_Error  error;
-    int16_t     ref_num, v_ref_num;
-    int32_t      dir_id;
-    Str255    fond_file_name;
-
-
-    ref_num = HomeResFile( fond );
-
-    error = ResError();
-    if ( !error )
-      error = get_file_location( ref_num, &v_ref_num,
-                                 &dir_id, fond_file_name );
-    if ( !error )
-      error = FSMakeFSSpec( v_ref_num, dir_id, file_name, spec );
-
-    return error;
-  }
-
-
-  /* Look inside the FOND data, answer whether there should be an SFNT
-     resource, and answer the name of a possible LWFN Type 1 file.
-
-     Thanks to Paul Miller (paulm@profoundeffects.com) for the fix
-     to load a face OTHER than the first one in the FOND!
-  */
-  static void
-  parse_fond( char*   fond_data,
-              int16_t*  have_sfnt,
-              int16_t*  sfnt_id,
-              Str255  lwfn_file_name,
-              int16_t   face_index )
-  {
-    AsscEntry*  assoc;
-    AsscEntry*  base_assoc;
-    FamRec*     fond;
-
-
-    *sfnt_id          = 0;
-    *have_sfnt        = 0;
-    lwfn_file_name[0] = 0;
-
-    fond       = (FamRec*)fond_data;
-    assoc      = (AsscEntry*)( fond_data + sizeof ( FamRec ) + 2 );
-    base_assoc = assoc;
-    assoc     += face_index;        /* add on the face_index! */
-
-    /* if the face at this index is not scalable,
-       fall back to the first one (old behavior) */
-    if ( assoc->fontSize == 0 )
-    {
-      *have_sfnt = 1;
-      *sfnt_id   = assoc->fontID;
-    }
-    else if ( base_assoc->fontSize == 0 )
-    {
-      *have_sfnt = 1;
-      *sfnt_id   = base_assoc->fontID;
-    }
-
-    if ( fond->ffStylOff )
-    {
-      unsigned char*  p = (unsigned char*)fond_data;
-      StyleTable*     style;
-      unsigned short  string_count;
-      char            ps_name[256];
-      unsigned char*  names[64];
-      int             i;
-
-
-      p += fond->ffStylOff;
-      style = (StyleTable*)p;
-      p += sizeof ( StyleTable );
-      string_count = *(unsigned short*)(p);
-      p += sizeof (int16_t );
-
-      for ( i = 0 ; i < string_count && i < 64; i++ )
-      {
-        names[i] = p;
-        p += names[i][0];
-        p++;
-      }
-
-      {
-        size_t  ps_name_len = (size_t)names[0][0];
-
-
-        if ( ps_name_len != 0 )
-        {
-          memcpy(ps_name, names[0] + 1, ps_name_len);
-          ps_name[ps_name_len] = 0;
-        }
-        if ( style->indexes[0] > 1 )
-        {
-          unsigned char*  suffixes = names[style->indexes[0] - 1];
-
-
-          for ( i = 1; i < suffixes[0]; i++ )
-          {
-            unsigned char*  s;
-            size_t          j = suffixes[i] - 1;
-
-
-            if ( j < string_count && ( s = names[j] ) != NULL )
-            {
-              size_t  s_len = (size_t)s[0];
-
-
-              if ( s_len != 0 && ps_name_len + s_len < sizeof ( ps_name ) )
-              {
-                memcpy( ps_name + ps_name_len, s + 1, s_len );
-                ps_name_len += s_len;
-                ps_name[ps_name_len] = 0;
-              }
-            }
-          }
-        }
-      }
-
-      create_lwfn_name( ps_name, lwfn_file_name );
-    }
-  }
-
-
-  /* Read Type 1 data from the POST resources inside the LWFN file,
-     return a PFB buffer. This is somewhat convoluted because the FT2
-     PFB parser wants the ASCII header as one chunk, and the LWFN
-     chunks are often not organized that way, so we'll glue chunks
-     of the same type together. */
-  static FT_Error
-  read_lwfn( FT_Memory  memory,
-             FSSpec*    lwfn_spec,
-             FT_Byte**  pfb_data,
-             FT_ULong*  size )
-  {
-    FT_Error       error = FT_Err_Ok;
-    int16_t          res_ref, res_id;
-    unsigned char  *buffer, *p, *size_p = NULL;
-    FT_ULong       total_size = 0;
-    FT_ULong       post_size, pfb_chunk_size;
-    Handle         post_data;
-    char           code, last_code;
-
-
-    res_ref = FSpOpenResFile( lwfn_spec, fsRdPerm );
-    if ( ResError() )
-      return FT_Err_Out_Of_Memory;
-    UseResFile( res_ref );
-
-    /* First pass: load all POST resources, and determine the size of
-       the output buffer. */
-    res_id    = 501;
-    last_code = -1;
-
-    for (;;)
-    {
-      post_data = Get1Resource( 'POST', res_id++ );
-      if ( post_data == NULL )
-        break;  /* we're done */
-
-      code = (*post_data)[0];
-
-      if ( code != last_code )
-      {
-        if ( code == 5 )
-          total_size += 2; /* just the end code */
-        else
-          total_size += 6; /* code + 4 bytes chunk length */
-      }
-
-      total_size += GetHandleSize( post_data ) - 2;
-      last_code = code;
-    }
-
-    if ( FT_ALLOC( buffer, (FT_Long)total_size ) )
-      goto Error;
-
-    /* Second pass: append all POST data to the buffer, add PFB fields.
-       Glue all consecutive chunks of the same type together. */
-    p              = buffer;
-    res_id         = 501;
-    last_code      = -1;
-    pfb_chunk_size = 0;
-
-    for (;;)
-    {
-      post_data = Get1Resource( 'POST', res_id++ );
-      if ( post_data == NULL )
-        break;  /* we're done */
-
-      post_size = (FT_ULong)GetHandleSize( post_data ) - 2;
-      code = (*post_data)[0];
-
-      if ( code != last_code )
-      {
-        if ( last_code != -1 )
-        {
-          /* we're done adding a chunk, fill in the size field */
-          if ( size_p != NULL )
-          {
-            *size_p++ = (FT_Byte)(   pfb_chunk_size         & 0xFF );
-            *size_p++ = (FT_Byte)( ( pfb_chunk_size >> 8  ) & 0xFF );
-            *size_p++ = (FT_Byte)( ( pfb_chunk_size >> 16 ) & 0xFF );
-            *size_p++ = (FT_Byte)( ( pfb_chunk_size >> 24 ) & 0xFF );
-          }
-          pfb_chunk_size = 0;
-        }
-
-        *p++ = 0x80;
-        if ( code == 5 )
-          *p++ = 0x03;  /* the end */
-        else if ( code == 2 )
-          *p++ = 0x02;  /* binary segment */
-        else
-          *p++ = 0x01;  /* ASCII segment */
-
-        if ( code != 5 )
-        {
-          size_p = p;   /* save for later */
-          p += 4;       /* make space for size field */
-        }
-      }
-
-      ft_memcpy( p, *post_data + 2, post_size );
-      pfb_chunk_size += post_size;
-      p += post_size;
-      last_code = code;
-    }
-
-    *pfb_data = buffer;
-    *size = total_size;
-
-  Error:
-    CloseResFile( res_ref );
-    return error;
-  }
-
-
-  /* Finalizer for a memory stream; gets called by FT_Done_Face().
-     It frees the memory it uses. */
-  static void
-  memory_stream_close( FT_Stream  stream )
-  {
-    FT_Memory  memory = stream->memory;
-
-
-    FT_FREE( stream->base );
-
-    stream->size  = 0;
-    stream->base  = 0;
-    stream->close = 0;
-  }
-
-
-  /* Create a new memory stream from a buffer and a size. */
-  static FT_Error
-  new_memory_stream( FT_Library           library,
-                     FT_Byte*             base,
-                     FT_ULong             size,
-                     FT_Stream_CloseFunc  close,
-                     FT_Stream           *astream )
-  {
-    FT_Error   error;
-    FT_Memory  memory;
-    FT_Stream  stream;
-
-
-    if ( !library )
-      return FT_Err_Invalid_Library_Handle;
-
-    if ( !base )
-      return FT_Err_Invalid_Argument;
-
-    *astream = 0;
-    memory = library->memory;
-    if ( FT_NEW( stream ) )
-      goto Exit;
-
-    FT_Stream_OpenMemory( stream, base, size );
-
-    stream->close = close;
-
-    *astream = stream;
-
-  Exit:
-    return error;
-  }
-
-
-  /* Create a new FT_Face given a buffer and a driver name. */
-  static FT_Error
-  open_face_from_buffer( FT_Library  library,
-                         FT_Byte*    base,
-                         FT_ULong    size,
-                         FT_Long     face_index,
-                         char*       driver_name,
-                         FT_Face    *aface )
-  {
-    FT_Open_Args  args;
-    FT_Error      error;
-    FT_Stream     stream;
-    FT_Memory     memory = library->memory;
-
-
-    error = new_memory_stream( library,
-                               base,
-                               size,
-                               memory_stream_close,
-                               &stream );
-    if ( error )
-    {
-      FT_FREE( base );
-      return error;
-    }
-
-    args.flags = FT_OPEN_STREAM;
-    args.stream = stream;
-    if ( driver_name )
-    {
-      args.flags = args.flags | FT_OPEN_DRIVER;
-      args.driver = FT_Get_Module( library, driver_name );
-    }
-
-    error = FT_Open_Face( library, &args, face_index, aface );
-    if ( error == FT_Err_Ok )
-      (*aface)->face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM;
-    else
-    {
-      FT_Stream_CloseFunc( stream );
-      FT_FREE( stream );
-    }
-
-    return error;
-  }
-
-
-  /* Create a new FT_Face from a file spec to an LWFN file. */
-  static FT_Error
-  FT_New_Face_From_LWFN( FT_Library  library,
-                         FSSpec*     spec,
-                         FT_Long     face_index,
-                         FT_Face    *aface )
-  {
-    FT_Byte*  pfb_data;
-    FT_ULong  pfb_size;
-    FT_Error  error;
-
-
-    error = read_lwfn( library->memory, spec, &pfb_data, &pfb_size );
-    if ( error )
-      return error;
-
-    return open_face_from_buffer( library,
-                                  pfb_data,
-                                  pfb_size,
-                                  face_index,
-                                  "type1",
-                                  aface );
-  }
-
-
-  /* Create a new FT_Face from an SFNT resource, specified by res ID. */
-  static FT_Error
-  FT_New_Face_From_SFNT( FT_Library  library,
-                         int16_t       sfnt_id,
-                         FT_Long     face_index,
-                         FT_Face    *aface )
-  {
-    Handle     sfnt = NULL;
-    FT_Byte*   sfnt_data;
-    size_t     sfnt_size;
-    FT_Error   error = 0;
-    FT_Memory  memory = library->memory;
-
-
-    sfnt = GetResource( 'sfnt', sfnt_id );
-    if ( ResError() )
-      return FT_Err_Invalid_Handle;
-
-    sfnt_size = (FT_ULong)GetHandleSize( sfnt );
-    if ( FT_ALLOC( sfnt_data, (FT_Long)sfnt_size ) )
-    {
-      ReleaseResource( sfnt );
-      return error;
-    }
-
-    HLock( sfnt );
-    ft_memcpy( sfnt_data, *sfnt, sfnt_size );
-    HUnlock( sfnt );
-    ReleaseResource( sfnt );
-
-    return open_face_from_buffer( library,
-                                  sfnt_data,
-                                  sfnt_size,
-                                  face_index,
-                                  "truetype",
-                                  aface );
-  }
-
-
-  /* Create a new FT_Face from a file spec to a suitcase file. */
-  static FT_Error
-  FT_New_Face_From_Suitcase( FT_Library  library,
-                             FSSpec*     spec,
-                             FT_Long     face_index,
-                             FT_Face    *aface )
-  {
-    FT_Error  error = FT_Err_Ok;
-    int16_t     res_ref, res_index;
-    Handle    fond;
-
-
-    res_ref = FSpOpenResFile( spec, fsRdPerm );
-    if ( ResError() )
-      return FT_Err_Cannot_Open_Resource;
-    UseResFile( res_ref );
-
-    /* face_index may be -1, in which case we
-       just need to do a sanity check */
-    if ( face_index < 0 )
-      res_index = 1;
-    else
-    {
-      res_index = (int16_t)( face_index + 1 );
-      face_index = 0;
-    }
-    fond = Get1IndResource( 'FOND', res_index );
-    if ( ResError() )
-    {
-      error = FT_Err_Cannot_Open_Resource;
-      goto Error;
-    }
-
-    error = FT_New_Face_From_FOND( library, fond, face_index, aface );
-
-  Error:
-    CloseResFile( res_ref );
-    return error;
-  }
-
-
-#if TARGET_API_MAC_CARBON
-
-  /* Create a new FT_Face from a file spec to a suitcase file. */
-  static FT_Error
-  FT_New_Face_From_dfont( FT_Library  library,
-                          FSSpec*     spec,
-                          FT_Long     face_index,
-                          FT_Face*    aface )
-  {
-    FT_Error  error = FT_Err_Ok;
-    int16_t     res_ref, res_index;
-    Handle    fond;
-    FSRef     hostContainerRef;
-
-
-    error = FSpMakeFSRef( spec, &hostContainerRef );
-    if ( error == noErr )
-      error = FSOpenResourceFile( &hostContainerRef,
-                                  0, NULL, fsRdPerm, &res_ref );
-
-    if ( error != noErr )
-      return FT_Err_Cannot_Open_Resource;
-
-    UseResFile( res_ref );
-
-    /* face_index may be -1, in which case we
-       just need to do a sanity check */
-    if ( face_index < 0 )
-      res_index = 1;
-    else
-    {
-      res_index = (int16_t)( face_index + 1 );
-      face_index = 0;
-    }
-    fond = Get1IndResource( 'FOND', res_index );
-    if ( ResError() )
-    {
-      error = FT_Err_Cannot_Open_Resource;
-      goto Error;
-    }
-
-    error = FT_New_Face_From_FOND( library, fond, face_index, aface );
-
-  Error:
-    CloseResFile( res_ref );
-    return error;
-  }
-
-#endif
-
-
-  /* documentation is in ftmac.h */
-
-  FT_EXPORT_DEF( FT_Error )
-  FT_New_Face_From_FOND( FT_Library  library,
-                         Handle      fond,
-                         FT_Long     face_index,
-                         FT_Face    *aface )
-  {
-    short   sfnt_id, have_sfnt, have_lwfn = 0;
-    Str255  lwfn_file_name;
-    short   fond_id;
-    OSType  fond_type;
-    Str255  fond_name;
-    FSSpec  lwfn_spec;
-
-
-    GetResInfo( fond, &fond_id, &fond_type, fond_name );
-    if ( ResError() != noErr || fond_type != 'FOND' )
-      return FT_Err_Invalid_File_Format;
-
-    HLock( fond );
-    parse_fond( *fond, &have_sfnt, &sfnt_id, lwfn_file_name, face_index );
-    HUnlock( fond );
-
-    if ( lwfn_file_name[0] )
-    {
-      if ( make_lwfn_spec( fond, lwfn_file_name, &lwfn_spec ) == FT_Err_Ok )
-        have_lwfn = 1;  /* yeah, we got one! */
-      else
-        have_lwfn = 0;  /* no LWFN file found */
-    }
-
-    if ( have_lwfn && ( !have_sfnt || PREFER_LWFN ) )
-      return FT_New_Face_From_LWFN( library,
-                                    &lwfn_spec,
-                                    face_index,
-                                    aface );
-    else if ( have_sfnt )
-      return FT_New_Face_From_SFNT( library,
-                                    sfnt_id,
-                                    face_index,
-                                    aface );
-
-    return FT_Err_Unknown_File_Format;
-  }
-
-
-  /* documentation is in ftmac.h */
-
-  FT_EXPORT_DEF( FT_Error )
-  FT_GetFile_From_Mac_Name( char*     fontName,
-                            FSSpec*   pathSpec,
-                            FT_Long*  face_index )
-  {
-    OptionBits            options = kFMUseGlobalScopeOption;
-
-    FMFontFamilyIterator  famIter;
-    OSStatus              status = FMCreateFontFamilyIterator( NULL, NULL,
-                                                               options,
-                                                               &famIter );
-    FMFont                the_font = NULL;
-    FMFontFamily          family   = NULL;
-
-
-    *face_index = 0;
-    while ( status == 0 && !the_font )
-    {
-      status = FMGetNextFontFamily( &famIter, &family );
-      if ( status == 0 )
-      {
-        int                           stat2;
-        FMFontFamilyInstanceIterator  instIter;
-        Str255                        famNameStr;
-        char                          famName[256];
-
-
-        /* get the family name */
-        FMGetFontFamilyName( family, famNameStr );
-        CopyPascalStringToC( famNameStr, famName );
-
-        /* iterate through the styles */
-        FMCreateFontFamilyInstanceIterator( family, &instIter );
-
-        *face_index = 0;
-        stat2 = 0;
-        while ( stat2 == 0 && !the_font )
-        {
-          FMFontStyle  style;
-          FMFontSize   size;
-          FMFont       font;
-
-
-          stat2 = FMGetNextFontFamilyInstance( &instIter, &font,
-                                               &style, &size );
-          if ( stat2 == 0 && size == 0 )
-          {
-            char  fullName[256];
-
-
-            /* build up a complete face name */
-            ft_strcpy( fullName, famName );
-            if ( style & bold )
-              strcat( fullName, " Bold" );
-            if ( style & italic )
-              strcat( fullName, " Italic" );
-
-            /* compare with the name we are looking for */
-            if ( ft_strcmp( fullName, fontName ) == 0 )
-            {
-              /* found it! */
-              the_font = font;
-            }
-            else
-               ++(*face_index);
-          }
-        }
-
-        FMDisposeFontFamilyInstanceIterator( &instIter );
-      }
-    }
-
-    FMDisposeFontFamilyIterator( &famIter );
-
-    if ( the_font )
-    {
-      FMGetFontContainer( the_font, pathSpec );
-      return FT_Err_Ok;
-    }
-    else
-      return FT_Err_Unknown_File_Format;
-  }
-
-
-  static long
-  ResourceForkSize(FSSpec*  spec)
-  {
-    long   len;
-    short  refNum;
-    OSErr  e;
-
-
-    e = FSpOpenRF( spec, fsRdPerm, &refNum ); /* I.M. Files 2-155 */
-    if ( e == noErr )
-    {
-      e = GetEOF( refNum, &len );
-      FSClose( refNum );
-    }
-
-    return ( e == noErr ) ? len : 0;
-  }
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_New_Face                                                        */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    This is the Mac-specific implementation of FT_New_Face.  In        */
-  /*    addition to the standard FT_New_Face() functionality, it also      */
-  /*    accepts pathnames to Mac suitcase files.  For further              */
-  /*    documentation see the original FT_New_Face() in freetype.h.        */
-  /*                                                                       */
-  FT_EXPORT_DEF( FT_Error )
-  FT_New_Face( FT_Library   library,
-               const char*  pathname,
-               FT_Long      face_index,
-               FT_Face     *aface )
-  {
-    FT_Open_Args  args;
-    FSSpec        spec;
-    OSType        file_type;
-
-
-    /* test for valid `library' and `aface' delayed to FT_Open_Face() */
-    if ( !pathname )
-      return FT_Err_Invalid_Argument;
-
-    if ( file_spec_from_path( pathname, &spec ) )
-      return FT_Err_Invalid_Argument;
-
-    /* Regardless of type, don't try to use the resource fork if it is */
-    /* empty.  Some TTF fonts have type `FFIL', for example, but they  */
-    /* only have data forks.                                           */
-
-    if ( ResourceForkSize( &spec ) != 0 )
-    {
-      file_type = get_file_type( &spec );
-      if ( file_type == 'FFIL' || file_type == 'tfil' )
-        return FT_New_Face_From_Suitcase( library, &spec, face_index, aface );
-
-      if ( file_type == 'LWFN' )
-        return FT_New_Face_From_LWFN( library, &spec, face_index, aface );
-    }
-
-#if TARGET_API_MAC_CARBON
-
-    if ( is_dfont( &spec ) )
-      return FT_New_Face_From_dfont( library, &spec, face_index, aface );
-
-#endif
-
-    /* let it fall through to normal loader (.ttf, .otf, etc.) */
-    args.flags    = FT_OPEN_PATHNAME;
-    args.pathname = (char*)pathname;
-    return FT_Open_Face( library, &args, face_index, aface );
-  }
-
-
-/* END */

+ 0 - 396
sys/src/libfreetype/src/base/ftobject.c

@@ -1,396 +0,0 @@
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECT_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-
-#define  FT_MAGIC_DEATH   0xDEADdead
-#define  FT_MAGIC_CLASS   0x12345678
-
-#define  FT_TYPE_HASH(x)  (( (FT_UInt32)(x) >> 2 )^( (FT_UInt32)(x) >> 10 ))
-
-#define  FT_OBJECT_CHECK(o)                                  \
-           ( FT_OBJECT(o)               != NULL           && \
-             FT_OBJECT(o)->clazz        != NULL           && \
-             FT_OBJECT(o)->ref_count    >= 1              && \
-             FT_OBJECT(o)->clazz->magic == FT_MAGIC_CLASS )
-
-#define  FT_CLASS_CHECK(c)  \
-           ( FT_CLASS(c) != NULL && FT_CLASS(c)->magic == FT_MAGIC_CLASS )
-
-#define  FT_ASSERT_IS_CLASS(c)  FT_ASSERT( FT_CLASS_CHECK(c) )
-
- /*******************************************************************/
- /*******************************************************************/
- /*****                                                         *****/
- /*****                                                         *****/
- /*****                  M E T A - C L A S S                    *****/
- /*****                                                         *****/
- /*****                                                         *****/
- /*******************************************************************/
- /*******************************************************************/
-
- /* forward declaration */
-  FT_BASE_DEF( FT_Error )
-  ft_metaclass_init( FT_MetaClass  meta,
-                     FT_Library    library );
-
-  /* forward declaration */
-  FT_BASE_DEF( void )
-  ft_metaclass_done( FT_MetaClass  meta );
-
-
-  /* class type for the meta-class itself */
-  static const FT_TypeRec  ft_meta_class_type =
-  {
-    "FT2.MetaClass",
-    NULL,
-
-    sizeof( FT_MetaClassRec ),
-    (FT_Object_InitFunc)  ft_metaclass_init,
-    (FT_Object_DoneFunc)  ft_metaclass_done,
-
-    sizeof( FT_ClassRec ),
-    (FT_Object_InitFunc)  NULL,
-    (FT_Object_DoneFunc)  NULL
-  };
-
-
-
-
- /* destroy a given class */
-  static void
-  ft_class_hnode_destroy( FT_ClassHNode  node )
-  {
-    FT_Class   clazz  = node->clazz;
-    FT_Memory  memory = clazz->memory;
-
-    if ( clazz->class_done )
-      clazz->class_done( (FT_Object) clazz );
-
-    FT_FREE( clazz );
-
-    node->clazz = NULL;
-    node->type  = NULL;
-
-    FT_FREE( node );
-  }
-
-
-  static FT_Int
-  ft_type_equal( FT_Type  type1,
-                 FT_Type  type2 )
-  {
-    if ( type1 == type2 )
-      goto Ok;
-
-    if ( type1 == NULL || type2 == NULL )
-      goto Fail;
-
-    /* compare parent types */
-    if ( type1->super != type2->super )
-    {
-      if ( type1->super == NULL           ||
-           type2->super == NULL           ||
-           !ft_type_equal( type1, type2 ) )
-        goto Fail;
-    }
-
-    /* compare type names */
-    if ( type1->name != type2->name )
-    {
-      if ( type1->name == NULL                        ||
-           type2->name == NULL                        ||
-           ft_strcmp( type1->name, type2->name ) != 0 )
-        goto Fail;
-    }
-
-    /* compare the other type fields */
-    if ( type1->class_size != type2->class_size ||
-         type1->class_init != type2->class_init ||
-         type1->class_done != type2->class_done ||
-         type1->obj_size   != type2->obj_size   ||
-         type1->obj_init   != type2->obj_init   ||
-         type1->obj_done   != type2->obj_done   )
-      goto Fail;
-
-  Ok:
-    return 1;
-
-  Fail:
-    return 0;
-  }
-
-
-  static FT_Int
-  ft_class_hnode_equal( const FT_ClassHNode  node1,
-                        const FT_ClassHNode  node2 )
-  {
-    FT_Type  type1 = node1->type;
-    FT_Type  type2 = node2->type;
-
-    /* comparing the pointers should work in 99% of cases */
-    return ( type1 == type2 ) ? 1 : ft_type_equal( type1, type2 );
-  }
-
-
-  FT_BASE_DEF( void )
-  ft_metaclass_done( FT_MetaClass  meta )
-  {
-    /* clear all classes */
-    ft_hash_done( &meta->type_to_class,
-                  (FT_Hash_ForeachFunc) ft_class_hnode_destroy,
-                   NULL );
-
-    meta->clazz.object.clazz     = NULL;
-    meta->clazz.object.ref_count = 0;
-    meta->clazz.magic            = FT_MAGIC_DEATH;
-  }
-
-
-  FT_BASE_DEF( FT_Error )
-  ft_metaclass_init( FT_MetaClass  meta,
-                     FT_Library    library )
-  {
-    FT_ClassRec*  clazz = (FT_ClassRec*) &meta->clazz;
-
-    /* the meta-class is its OWN class !! */
-    clazz->object.clazz     = (FT_Class) clazz;
-    clazz->object.ref_count = 1;
-    clazz->magic            = FT_MAGIC_CLASS;
-    clazz->library          = library;
-    clazz->memory           = library->memory;
-    clazz->type             = &ft_meta_class_type;
-    clazz->info             = NULL;
-
-    clazz->class_done       = (FT_Object_DoneFunc) ft_metaclass_done;
-
-    clazz->obj_size         = sizeof( FT_ClassRec );
-    clazz->obj_init         = NULL;
-    clazz->obj_done         = NULL;
-
-    return ft_hash_init( &meta->type_to_class,
-                        (FT_Hash_EqualFunc) ft_class_hnode_equal,
-                        library->memory );
-  }
-
-
- /* find or create the class corresponding to a given type */
- /* note that this function will retunr NULL in case of    */
- /* memory overflow                                        */
- /*                                                        */
-  static FT_Class
-  ft_metaclass_get_class( FT_MetaClass  meta,
-                          FT_Type       ctype )
-  {
-    FT_ClassHNodeRec   keynode, *node, **pnode;
-    FT_Memory          memory;
-    FT_ClassRec*       clazz;
-    FT_Class           parent;
-    FT_Error           error;
-
-    keynode.hnode.hash = FT_TYPE_HASH( ctype );
-    keynode.type       = ctype;
-
-    pnode = (FT_ClassHNode*) ft_hash_lookup( &meta->type_to_class,
-                                             (FT_HashNode) &keynode );
-    node  = *pnode;
-    if ( node != NULL )
-    {
-      clazz = (FT_ClassRec*) node->clazz;
-      goto Exit;
-    }
-
-    memory = FT_CLASS__MEMORY(meta);
-    clazz  = NULL;
-    parent = NULL;
-    if ( ctype->super != NULL )
-    {
-      FT_ASSERT( ctype->super->class_size <= ctype->class_size );
-      FT_ASSERT( ctype->super->obj_size   <= ctype->obj_size   );
-
-      parent = ft_metaclass_get_class( meta, ctype->super );
-    }
-
-    if ( !FT_NEW( node ) )
-    {
-      if ( !FT_ALLOC( clazz, ctype->class_size ) )
-      {
-        if ( parent )
-          FT_MEM_COPY( (FT_ClassRec*)clazz, parent, parent->type->class_size );
-
-        clazz->object.clazz     = (FT_Class) meta;
-        clazz->object.ref_count = 1;
-
-        clazz->memory  = memory;
-        clazz->library = FT_CLASS__LIBRARY(meta);
-        clazz->super   = parent;
-        clazz->type    = ctype;
-        clazz->info    = NULL;
-        clazz->magic   = FT_MAGIC_CLASS;
-
-        clazz->class_done = ctype->class_done;
-        clazz->obj_size   = ctype->obj_size;
-        clazz->obj_init   = ctype->obj_init;
-        clazz->obj_done   = ctype->obj_done;
-
-        if ( parent )
-        {
-          if ( clazz->class_done == NULL )
-            clazz->class_done = parent->class_done;
-
-          if ( clazz->obj_init == NULL )
-            clazz->obj_init = parent->obj_init;
-
-          if ( clazz->obj_done == NULL )
-            clazz->obj_done = parent->obj_done;
-        }
-
-        /* find class initializer, if any */
-        {
-          FT_Type             ztype = ctype;
-          FT_Object_InitFunc  cinit = NULL;
-
-          do
-          {
-            cinit = ztype->class_init;
-            if ( cinit != NULL )
-              break;
-
-            ztype = ztype->super;
-          }
-          while ( ztype != NULL );
-
-          /* then call it when needed */
-          if ( cinit != NULL )
-            error = cinit( (FT_Object) clazz, NULL );
-        }
-      }
-
-      if (error)
-      {
-        if ( clazz )
-        {
-          /* we always call the class destructor when    */
-          /* an error was detected in the constructor !! */
-          if ( clazz->class_done )
-            clazz->class_done( (FT_Object) clazz );
-
-          FT_FREE( clazz );
-        }
-        FT_FREE( node );
-      }
-    }
-
-  Exit:
-    return  (FT_Class) clazz;
-  }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-  FT_BASE_DEF( FT_Int )
-  ft_object_check( FT_Pointer  obj )
-  {
-    return FT_OBJECT_CHECK(obj);
-  }
-
-
-  FT_BASE_DEF( FT_Int )
-  ft_object_is_a( FT_Pointer  obj,
-                  FT_Class    clazz )
-  {
-    if ( FT_OBJECT_CHECK(obj) )
-    {
-      FT_Class   c = FT_OBJECT__CLASS(obj);
-
-      do
-      {
-        if ( c == clazz )
-          return 1;
-
-        c = c->super;
-      }
-      while ( c == NULL );
-
-      return (clazz == NULL);
-    }
-    return 0;
-  }
-
-
-  FT_BASE_DEF( FT_Error )
-  ft_object_create( FT_Object  *pobject,
-                    FT_Class    clazz,
-                    FT_Pointer  init_data )
-  {
-    FT_Memory  memory;
-    FT_Error   error;
-    FT_Object  obj;
-
-    FT_ASSERT_IS_CLASS(clazz);
-
-    memory = FT_CLASS__MEMORY(clazz);
-    if ( !FT_ALLOC( obj, clazz->obj_size ) )
-    {
-      obj->clazz     = clazz;
-      obj->ref_count = 1;
-
-      if ( clazz->obj_init )
-      {
-        error = clazz->obj_init( obj, init_data );
-        if ( error )
-        {
-          /* IMPORTANT: call the destructor when an error  */
-          /*            was detected in the constructor !! */
-          if ( clazz->obj_done )
-            clazz->obj_done( obj );
-
-          FT_FREE( obj );
-        }
-      }
-    }
-    *pobject = obj;
-    return error;
-  }
-
-
-  FT_BASE_DEF( FT_Class )
-  ft_class_find_by_type( FT_Type     type,
-                         FT_Library  library )
-  {
-    FT_MetaClass  meta = &library->meta_class;
-
-    return ft_metaclass_get_class( meta, type );
-  }
-
-
-  FT_BASE_DEF( FT_Error )
-  ft_object_create_from_type( FT_Object  *pobject,
-                              FT_Type     type,
-                              FT_Pointer  init_data,
-                              FT_Library  library )
-  {
-    FT_Class  clazz;
-    FT_Error  error;
-
-    clazz = ft_class_find_by_type( type, library );
-    if ( clazz )
-      error = ft_object_create( pobject, clazz, init_data );
-    else
-    {
-      *pobject = NULL;
-      error    = FT_Err_Out_Of_Memory;
-    }
-
-    return error;
-  }

+ 0 - 286
sys/src/libfreetype/src/base/ftsynth.c

@@ -1,286 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  ftsynth.c                                                              */
-/*                                                                         */
-/*    FreeType synthesizing code for emboldening and slanting (body).      */
-/*                                                                         */
-/*  Copyright 2000-2001 by                                                 */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_CALC_H
-#include FT_OUTLINE_H
-#include FT_TRIGONOMETRY_H
-#include FT_SYNTHESIS_H
-
-
-#define FT_BOLD_THRESHOLD  0x0100
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /****                                                                 ****/
-  /****   EXPERIMENTAL OBLIQUING SUPPORT                                ****/
-  /****                                                                 ****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-  FT_EXPORT_DEF( void )
-  FT_GlyphSlot_Oblique( FT_GlyphSlot  slot )
-  {
-    FT_Matrix    transform;
-    FT_Outline*  outline = &slot->outline;
-
-
-    /* only oblique outline glyphs */
-    if ( slot->format != FT_GLYPH_FORMAT_OUTLINE )
-      return;
-
-    /* we don't touch the advance width */
-
-    /* For italic, simply apply a shear transform, with an angle */
-    /* of about 12 degrees.                                      */
-
-    transform.xx = 0x10000L;
-    transform.yx = 0x00000L;
-
-    transform.xy = 0x06000L;
-    transform.yy = 0x10000L;
-
-    FT_Outline_Transform( outline, &transform );
-  }
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /****                                                                 ****/
-  /****   EXPERIMENTAL EMBOLDENING/OUTLINING SUPPORT                    ****/
-  /****                                                                 ****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-
-
-  static int
-  ft_test_extrema( FT_Outline*  outline,
-                   int          n )
-  {
-    FT_Vector  *prev, *cur, *next;
-    FT_Pos      product;
-    FT_Int      c, first, last;
-
-
-    /* we need to compute the `previous' and `next' point */
-    /* for these extrema.                                 */
-    cur   = outline->points + n;
-    prev  = cur - 1;
-    next  = cur + 1;
-
-    first = 0;
-    for ( c = 0; c < outline->n_contours; c++ )
-    {
-      last  = outline->contours[c];
-
-      if ( n == first )
-        prev = outline->points + last;
-
-      if ( n == last )
-        next = outline->points + first;
-
-      first = last + 1;
-    }
-
-    product = FT_MulDiv( cur->x - prev->x,   /* in.x  */
-                         next->y - cur->y,   /* out.y */
-                         0x40 )
-              -
-              FT_MulDiv( cur->y - prev->y,   /* in.y  */
-                         next->x - cur->x,   /* out.x */
-                         0x40 );
-
-    if ( product )
-      product = product > 0 ? 1 : -1;
-
-    return product;
-  }
-
-
-  /* Compute the orientation of path filling.  It differs between TrueType */
-  /* and Type1 formats.  We could use the `FT_OUTLINE_REVERSE_FILL' flag,  */
-  /* but it is better to re-compute it directly (it seems that this flag   */
-  /* isn't correctly set for some weird composite glyphs currently).       */
-  /*                                                                       */
-  /* We do this by computing bounding box points, and computing their      */
-  /* curvature.                                                            */
-  /*                                                                       */
-  /* The function returns either 1 or -1.                                  */
-  /*                                                                       */
-  static int
-  ft_get_orientation( FT_Outline*  outline )
-  {
-    FT_BBox  box;
-    FT_BBox  indices;
-    int      n, last;
-
-
-    indices.xMin = -1;
-    indices.yMin = -1;
-    indices.xMax = -1;
-    indices.yMax = -1;
-
-    box.xMin = box.yMin =  32767;
-    box.xMax = box.yMax = -32768;
-
-    /* is it empty ? */
-    if ( outline->n_contours < 1 )
-      return 1;
-
-    last = outline->contours[outline->n_contours - 1];
-
-    for ( n = 0; n <= last; n++ )
-    {
-      FT_Pos  x, y;
-
-
-      x = outline->points[n].x;
-      if ( x < box.xMin )
-      {
-        box.xMin     = x;
-        indices.xMin = n;
-      }
-      if ( x > box.xMax )
-      {
-        box.xMax     = x;
-        indices.xMax = n;
-      }
-
-      y = outline->points[n].y;
-      if ( y < box.yMin )
-      {
-        box.yMin     = y;
-        indices.yMin = n;
-      }
-      if ( y > box.yMax )
-      {
-        box.yMax     = y;
-        indices.yMax = n;
-      }
-    }
-
-    /* test orientation of the xmin */
-    n = ft_test_extrema( outline, indices.xMin );
-    if ( n )
-      goto Exit;
-
-    n = ft_test_extrema( outline, indices.yMin );
-    if ( n )
-      goto Exit;
-
-    n = ft_test_extrema( outline, indices.xMax );
-    if ( n )
-      goto Exit;
-
-    n = ft_test_extrema( outline, indices.yMax );
-    if ( !n )
-      n = 1;
-
-  Exit:
-    return n;
-  }
-
-
-  FT_EXPORT_DEF( void )
-  FT_GlyphSlot_Embolden( FT_GlyphSlot  slot )
-  {
-    FT_Vector*   points;
-    FT_Vector    v_prev, v_first, v_next, v_cur;
-    FT_Pos       distance;
-    FT_Outline*  outline = &slot->outline;
-    FT_Face      face = FT_SLOT_FACE( slot );
-    FT_Angle     rotate, angle_in, angle_out;
-    FT_Int       c, n, first, orientation;
-
-
-    /* only embolden outline glyph images */
-    if ( slot->format != FT_GLYPH_FORMAT_OUTLINE )
-      return;
-
-    /* compute control distance */
-    distance = FT_MulFix( face->units_per_EM / 60,
-                          face->size->metrics.y_scale );
-
-    orientation = ft_get_orientation( outline );
-    rotate      = FT_ANGLE_PI2*orientation;
-
-    points = outline->points;
-
-    first = 0;
-    for ( c = 0; c < outline->n_contours; c++ )
-    {
-      int  last = outline->contours[c];
-
-
-      v_first = points[first];
-      v_prev  = points[last];
-      v_cur   = v_first;
-
-      for ( n = first; n <= last; n++ )
-      {
-        FT_Pos     d;
-        FT_Vector  in, out;
-        FT_Fixed   scale;
-        FT_Angle   angle_diff;
-
-
-        if ( n < last ) v_next = points[n + 1];
-        else            v_next = v_first;
-
-        /* compute the in and out vectors */
-        in.x  = v_cur.x - v_prev.x;
-        in.y  = v_cur.y - v_prev.y;
-
-        out.x = v_next.x - v_cur.x;
-        out.y = v_next.y - v_cur.y;
-
-        angle_in   = FT_Atan2( in.x, in.y );
-        angle_out  = FT_Atan2( out.x, out.y );
-        angle_diff = FT_Angle_Diff( angle_in, angle_out );
-        scale      = FT_Cos( angle_diff/2 );
-
-        if ( scale < 0x400L && scale > -0x400L )
-        {
-          if ( scale >= 0 )
-            scale = 0x400L;
-          else
-            scale = -0x400L;
-        }
-
-        d = FT_DivFix( distance, scale );
-
-        FT_Vector_From_Polar( &in, d, angle_in + angle_diff/2 - rotate );
-
-        outline->points[n].x = v_cur.x + distance + in.x;
-        outline->points[n].y = v_cur.y + distance + in.y;
-
-        v_prev = v_cur;
-        v_cur  = v_next;
-      }
-
-      first = last + 1;
-    }
-
-    slot->metrics.horiAdvance = ( slot->metrics.horiAdvance + distance*4 ) & -64;
-  }
-
-
-/* END */

+ 0 - 131
sys/src/libfreetype/src/base/ftsysio.c

@@ -1,131 +0,0 @@
-#include <ft2build.h>
-#include FT_SYSTEM_STREAM_H
-
-#include <stdio.h>
-
- /* the ISO/ANSI standard stream object */
-  typedef struct FT_StdStreamRec_
-  {
-    FT_StreamRec  stream;
-    FILE*         file;
-    const char*   pathname;
-  
-  } FT_StdStreamRec, *FT_StdStream;
-
-
-
- /* read bytes from a standard stream */
-  static FT_ULong
-  ft_std_stream_read( FT_StdStream   stream,
-                      FT_Byte*       buffer,
-                      FT_ULong       size )
-  {
-    int32_t   read_bytes;
-    
-    read_bytes = fread( buffer, 1, size, stream->file );
-    if ( read_bytes < 0 )
-      read_bytes = 0;
-      
-    return (FT_ULong) read_bytes;
-  }
-
-
- /* seek the standard stream to a new position */
-  static FT_Error
-  ft_std_stream_seek( FT_StdStream   stream,
-                      FT_ULong       pos )
-  {
-    return ( fseek( stream->file, pos, SEEK_SET ) < 0 )
-         ? FT_Err_Stream_Seek
-         : FT_Err_Ok;
-  }
-  
-  
- /* close a standard stream */  
-  static void
-  ft_std_stream_done( FT_StdStream  stream )
-  {
-    fclose( stream->file );
-    stream->file     = NULL;
-    stream->pathname = NULL;
-  }
-
-
- /* open a standard stream from a given pathname */
-  static void
-  ft_std_stream_init( FT_StdStream  stream,
-                      const char*   pathname )
-  {
-    FT_ASSERT( pathname != NULL );
-
-    stream->file = fopen( pathname, "rb" );
-    if ( stream->file == NULL )
-    {
-      FT_ERROR(( "iso.stream.init: could not open '%s'\n", pathname ));
-      FT_XTHROW( FT_Err_Stream_Open );
-    }
-    
-    /* compute total size in bytes */
-    fseek( file, 0, SEEK_END );
-    FT_STREAM__SIZE(stream) = ftell( file );
-    fseek( file, 0, SEEK_SET );
-    
-    stream->pathname = pathname;
-    stream->pos      = 0;
-    
-    FT_TRACE1(( "iso.stream.init: opened '%s' (%ld bytes) succesfully\n",
-                 pathname, FT_STREAM__SIZE(stream) ));
-  }                 
-
-
-  static void
-  ft_std_stream_class_init( FT_ClassRec*  _clazz )
-  {
-    FT_StreamClassRec*  clazz = FT_STREAM_CLASS(_clazz);
-    
-    clazz->stream_read = (FT_Stream_ReadFunc) ft_std_stream_read;
-    clazz->stream_seek = (FT_Stream_SeekFunc) ft_std_stream_seek;
-  }
-
-
-  static const FT_TypeRec  ft_std_stream_type;
-  {
-    "StreamClass",
-    NULL,
-    
-    sizeof( FT_ClassRec ),
-    ft_stream_class_init,
-    NULL,
-    
-    sizeof( FT_StdStreamRec ),
-    ft_std_stream_init,
-    ft_std_stream_done,
-    NULL,
-  };
-  
-
-
-  FT_EXPORT_DEF( FT_Stream )
-  ft_std_stream_new( FT_Memory    memory,
-                     const char*  pathname )
-  {
-    FT_Class  clazz;
-    
-    clazz = ft_class_from_type( memory, &ft_std_stream_type );
-    
-    return (FT_Stream) ft_object_new( clazz, pathname );
-  }                     
-
-
-  FT_EXPORT_DEF( void )
-  ft_std_stream_create( FT_Memory    memory,
-                        const char*  pathname,
-                        FT_Stream*   astream )
-  {
-    FT_Class  clazz;
-    
-    clazz = ft_class_from_type( memory, &ft_std_stream_type );
-    
-    ft_object_create( clazz, pathname, FT_OBJECT_P(astream) );
-  }                        
-

+ 0 - 30
sys/src/libfreetype/src/base/ftsysmem.c

@@ -1,30 +0,0 @@
-#include <ft2build.h>
-#include FT_SYSTEM_MEMORY_H
-
-  static FT_Memory
-  ft_memory_new_default( FT_ULong  size )
-  {
-    return (FT_Memory) ft_malloc( size );
-  }
-  
-  static void
-  ft_memory_destroy_default( FT_Memory  memory )
-  {
-    ft_free( memory );
-  }
-
-  
- /* notice that in normal builds, we use the ISO C library functions */
- /* 'malloc', 'free' and 'realloc' directly..                        */
- /*                                                                  */
-  static const FT_Memory_FuncsRec  ft_memory_funcs_default_rec = 
-  {
-    (FT_Memory_CreateFunc)  ft_memory_new_iso,
-    (FT_Memory_DestroyFunc) ft_memory_destroy_iso,
-    (FT_Memory_AllocFunc)   ft_malloc,
-    (FT_Memory_FreeFunc)    ft_free,
-    (FT_Memory_ReallocFunc) ft_realloc
-  };
-  
-  FT_APIVAR_DEF( const FT_Memory_Funcs )
-  ft_memory_funcs_default = &ft_memory_funcs_defaults_rec;

+ 0 - 94
sys/src/libfreetype/src/base/rules.mk

@@ -1,94 +0,0 @@
-#
-# FreeType 2 base layer configuration rules
-#
-
-
-# Copyright 1996-2000, 2002 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-
-# It sets the following variables which are used by the master Makefile
-# after the call:
-#
-#   BASE_OBJ_S:   The single-object base layer.
-#   BASE_OBJ_M:   A list of all objects for a multiple-objects build.
-#   BASE_EXT_OBJ: A list of base layer extensions, i.e., components found
-#                 in `freetype/src/base' which are not compiled within the
-#                 base layer proper.
-#
-# BASE_H is defined in freetype.mk to simplify the dependency rules.
-
-
-BASE_COMPILE := $(FT_COMPILE) $I$(SRC_)base
-
-
-# Base layer sources
-#
-#   ftsystem, ftinit, and ftdebug are handled by freetype.mk
-#
-BASE_SRC := $(BASE_)ftcalc.c   \
-            $(BASE_)fttrigon.c \
-            $(BASE_)ftutil.c   \
-            $(BASE_)ftstream.c \
-            $(BASE_)ftgloadr.c \
-            $(BASE_)ftoutln.c  \
-            $(BASE_)ftobjs.c   \
-            $(BASE_)ftapi.c    \
-            $(BASE_)ftnames.c  \
-            $(BASE_)ftdbgmem.c
-
-# Base layer `extensions' sources
-#
-# An extension is added to the library file (.a or .lib) as a separate
-# object.  It will then be linked to the final executable only if one of its
-# symbols is used by the application.
-#
-BASE_EXT_SRC := $(BASE_)ftglyph.c   \
-                $(BASE_)ftmm.c      \
-                $(BASE_)ftbdf.c     \
-                $(BASE_)fttype1.c   \
-                $(BASE_)ftxf86.c    \
-                $(BASE_)ftpfr.c     \
-                $(BASE_)ftstroker.c \
-                $(BASE_)ftwinfnt.c  \
-                $(BASE_)ftbbox.c
-
-# Default extensions objects
-#
-BASE_EXT_OBJ := $(BASE_EXT_SRC:$(BASE_)%.c=$(OBJ_)%.$O)
-
-
-# Base layer object(s)
-#
-#   BASE_OBJ_M is used during `multi' builds (each base source file compiles
-#   to a single object file).
-#
-#   BASE_OBJ_S is used during `single' builds (the whole base layer is
-#   compiled as a single object file using ftbase.c).
-#
-BASE_OBJ_M := $(BASE_SRC:$(BASE_)%.c=$(OBJ_)%.$O)
-BASE_OBJ_S := $(OBJ_)ftbase.$O
-
-# Base layer root source file for single build
-#
-BASE_SRC_S := $(BASE_)ftbase.c
-
-
-# Base layer - single object build
-#
-$(BASE_OBJ_S): $(BASE_SRC_S) $(BASE_SRC) $(FREETYPE_H)
-	$(BASE_COMPILE) $T$@ $(BASE_SRC_S)
-
-
-# Multiple objects build + extensions
-#
-$(OBJ_)%.$O: $(BASE_)%.c $(FREETYPE_H)
-	$(BASE_COMPILE) $T$@ $<
-
-# EOF

+ 0 - 21
sys/src/libfreetype/src/bdf/Jamfile

@@ -1,21 +0,0 @@
-# FreeType 2 src/bdf Jamfile (c) 2002 David Turner
-#
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) bdf ;
-
-{
-  local  _sources ;
-
-  if $(FT2_MULTI)
-  {
-    _sources = bdfdrivr bdflib ;
-  }
-  else
-  {
-    _sources = bdf ;
-  }
-
-  Library  $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/bdf Jamfile

+ 0 - 148
sys/src/libfreetype/src/bdf/README

@@ -1,148 +0,0 @@
-                  FreeType font driver for BDF fonts
-
-                       Francesco Zappa Nardelli
-                  <francesco.zappa.nardelli@ens.fr>
-
-
-Introduction
-************
-
-BDF (Bitmap Distribution Format) is a bitmap font format defined by Adobe,
-which is intended to be easily understood by both humans and computers. 
-This code implements a BDF driver for the FreeType library, following the
-Adobe Specification V 2.2.  The specification of the BDF font format is
-available from Adobe's web site:
-
-  http://partners.adobe.com/asn/developer/PDFS/TN/5005.BDF_Spec.pdf
-
-Many good bitmap fonts in bdf format come with XFree86 (www.XFree86.org). 
-They do not define vertical metrics, because the X Consortium BDF
-specification has removed them.
-
-
-Encodings
-*********
-
-The variety of encodings that accompanies bdf fonts appears to encompass the
-small set defined in freetype.h.  On the other hand, two properties that
-specify encoding and registry are usually defined in bdf fonts.
-
-I decided to make these two properties directly accessible, leaving to the
-client application the work of interpreting them.  For instance:
-
-
-  #include FT_INTERNAL_BDF_TYPES_H
-
-  FT_Face          face;
-  BDF_Public_Face  bdfface;
-
-
-  FT_New_Face( library, ..., &face );
-
-  bdfface = (BDF_Public_Face)face;
-  
-  if ( ( bdfface->charset_registry == "ISO10646" ) && 
-       ( bdfface->charset_encoding == "1" )        )
-    [..]
-
-
-Thus the driver always exports `ft_encoding_none' as face->charmap.encoding. 
-FT_Get_Char_Index's behavior is unmodified, that is, it converts the ULong
-value given as argument into the corresponding glyph number.
-
-If the two properties are not available, Adobe Standard Encoding should be
-assumed.
-
-
-Anti-Aliased Bitmaps
-********************
-
-The driver supports an extension to the BDF format as used in Mark Leisher's
-xmbdfed bitmap font editor.  Microsoft's SBIT tool expects bitmap fonts in
-that format for adding anti-aliased them to TrueType fonts.  It introduces a
-fourth field to the `SIZE' keyword which gives the bpp value (bits per
-pixel) of the glyph data in the font.  Possible values are 1 (the default),
-2 (four gray levels), 4 (16 gray levels), and 8 (256 gray levels).  The
-driver returns either a bitmap with 1 bit per pixel or a pixmap with 8bits
-per pixel (using 4, 16, and 256 gray levels, respectively).
-
-
-Known problems
-**************
-
-- A font is entirely loaded into memory.  Obviously, this is not the Right
-  Thing(TM).  If you have big fonts I suggest you convert them into PCF
-  format (using the bdftopcf utility): the PCF font drive of FreeType can
-  perform incremental glyph loading.
-
-When I have some time, I will implement on-demand glyph parsing.
-
-- Except for encodings properties, client applications have no visibility of
-  the PCF_Face object.  This means that applications cannot directly access
-  font tables and must trust FreeType.
-
-- Currently, glyph names are ignored.
-
-  I plan to give full visibility of the BDF_Face object in an upcoming
-  revision of the driver, thus implementing also glyph names.
-
-- As I have never seen a BDF font that defines vertical metrics, vertical
-  metrics are (parsed and) discarded.  If you own a BDF font that defines
-  vertical metrics, please let me know (I will implement them in 5-10
-  minutes).
-
-
-License
-*******
-
-Copyright (C) 2001-2002 by Francesco Zappa Nardelli
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-*** Portions of the driver (that is, bdflib.c and bdf.h):
-
-Copyright 2000 Computing Research Labs, New Mexico State University
-Copyright 2001-2002 Francesco Zappa Nardelli
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-the rights to use, copy, modify, merge, publish, distribute, sublicense,
-and/or sell copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
-THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
-OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
-THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-Credits
-*******
-
-This driver is based on excellent Mark Leisher's bdf library.  If you
-find something good in this driver you should probably thank him, not
-me.

+ 0 - 34
sys/src/libfreetype/src/bdf/bdf.c

@@ -1,34 +0,0 @@
-/*  bdf.c
-
-    FreeType font driver for bdf files
-
-    Copyright (C) 2001, 2002 by
-    Francesco Zappa Nardelli 
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#define FT_MAKE_OPTION_SINGLE_OBJECT
-
-#include <ft2build.h>
-#include "bdflib.c"
-#include "bdfdrivr.c"
-
-
-/* END */

+ 0 - 23
sys/src/libfreetype/src/bdf/descrip.mms

@@ -1,23 +0,0 @@
-#
-# FreeType 2 BDF driver compilation rules for VMS
-#
-
-
-# Copyright 2002 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-
-CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.bdf])
-
-OBJS=bdf.obj
-
-all : $(OBJS)
-        library [--.lib]freetype.olb $(OBJS)
-
-# EOF

+ 0 - 31
sys/src/libfreetype/src/bdf/module.mk

@@ -1,31 +0,0 @@
-#
-# FreeType 2 BDF module definition
-#
-
-# Copyright 2001, 2002 by
-# Francesco Zappa Nardelli
-# 
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-make_module_list: add_bdf_driver
-
-add_bdf_driver:
-	$(OPEN_DRIVER)bdf_driver_class$(CLOSE_DRIVER)
-	$(ECHO_DRIVER)bdf    $(ECHO_DRIVER_DESC)bdf bitmap fonts$(ECHO_DRIVER_DONE)
-

+ 0 - 79
sys/src/libfreetype/src/bdf/rules.mk

@@ -1,79 +0,0 @@
-#
-# FreeType 2 bdf driver configuration rules
-#
-
-
-# Copyright (C) 2001, 2002 by
-# Francesco Zappa Nardelli
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-
-
-
-# bdf driver directory
-#
-BDF_DIR  := $(SRC_)bdf
-BDF_DIR_ := $(BDF_DIR)$(SEP)
-
-
-BDF_COMPILE := $(FT_COMPILE) $I$(BDF_DIR)
-
-
-# bdf driver sources (i.e., C files)
-#
-BDF_DRV_SRC := $(BDF_DIR_)bdflib.c $(BDF_DIR_)bdfdrivr.c
-
-
-# bdf driver headers
-#
-BDF_DRV_H := $(BDF_DIR_)bdf.h \
-             $(BDF_DIR_)bdfdrivr.h
-
-# bdf driver object(s)
-#
-#   BDF_DRV_OBJ_M is used during `multi' builds
-#   BDF_DRV_OBJ_S is used during `single' builds
-#
-BDF_DRV_OBJ_M := $(BDF_DRV_SRC:$(BDF_DIR_)%.c=$(OBJ_)%.$O)
-BDF_DRV_OBJ_S := $(OBJ_)bdf.$O
-
-# bdf driver source file for single build
-#
-BDF_DRV_SRC_S := $(BDF_DIR_)bdf.c
-
-
-# bdf driver - single object
-#
-$(BDF_DRV_OBJ_S): $(BDF_DRV_SRC_S) $(BDF_DRV_SRC) $(FREETYPE_H) $(BDF_DRV_H)
-	$(BDF_COMPILE) $T$@ $(BDF_DRV_SRC_S)
-
-
-# bdf driver - multiple objects
-#
-$(OBJ_)%.$O: $(BDF_DIR_)%.c $(FREETYPE_H) $(BDF_DRV_H)
-	$(BDF_COMPILE) $T$@ $<
-
-
-# update main driver object lists
-#
-DRV_OBJS_S += $(BDF_DRV_OBJ_S)
-DRV_OBJS_M += $(BDF_DRV_OBJ_M)
-
-# EOF

+ 0 - 27
sys/src/libfreetype/src/cache/Jamfile

@@ -1,27 +0,0 @@
-# FreeType 2 src/cache Jamfile (c) 2001 David Turner
-#
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) cache ;
-
-# The file <freetype/ftcache.h> contains some macro definitions that are
-# later used in #include statements related to the cache sub-system.  It
-# needs to be parsed through a HDRMACRO rule for macro definitions.
-#
-HDRMACRO  [ FT2_SubDir  include ftcache.h ] ;
-
-{
-  local  _sources ;
-
-  if $(FT2_MULTI)
-  {
-    _sources = ftlru ftcmanag ftccache ftcglyph ftcsbits ftcimage ftccmap ;
-  }
-  else
-  {
-    _sources = ftcache ;
-  }
-
-  Library  $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/cache Jamfile

+ 0 - 26
sys/src/libfreetype/src/cache/descrip.mms

@@ -1,26 +0,0 @@
-#
-# FreeType 2 Cache compilation rules for VMS
-#
-
-
-# Copyright 2001, 2002 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-
-CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.cache])
-
-OBJS=ftcache.obj
-
-all : $(OBJS)
-        library [--.lib]freetype.olb $(OBJS)
-
-ftcache.obj : ftcache.c ftlru.c ftcmanag.c ftccache.c ftcglyph.c ftcimage.c \
-              ftcsbits.c ftccmap.c 
-
-# EOF

+ 0 - 31
sys/src/libfreetype/src/cache/ftcache.c

@@ -1,31 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  ftcache.c                                                              */
-/*                                                                         */
-/*    The FreeType Caching sub-system (body only).                         */
-/*                                                                         */
-/*  Copyright 2000-2001 by                                                 */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-
-#define FT_MAKE_OPTION_SINGLE_OBJECT
-
-#include <ft2build.h>
-#include "ftlru.c"
-#include "ftcmanag.c"
-#include "ftccache.c"
-#include "ftcglyph.c"
-#include "ftcimage.c"
-#include "ftcsbits.c"
-#include "ftccmap.c"
-
-
-/* END */

+ 0 - 80
sys/src/libfreetype/src/cache/rules.mk

@@ -1,80 +0,0 @@
-#
-# FreeType 2 Cache configuration rules
-#
-
-
-# Copyright 2000, 2001 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-
-# Cache driver directory
-#
-CACHE_DIR  := $(SRC_)cache
-CACHE_DIR_ := $(CACHE_DIR)$(SEP)
-
-CACHE_H_DIR  := $(PUBLIC_)cache
-CACHE_H_DIR_ := $(CACHE_H_DIR)$(SEP)
-
-# compilation flags for the driver
-#
-Cache_COMPILE := $(FT_COMPILE) $I$(CACHE_DIR)
-
-
-# Cache driver sources (i.e., C files)
-#
-Cache_DRV_SRC := $(CACHE_DIR_)ftlru.c    \
-                 $(CACHE_DIR_)ftcmanag.c \
-                 $(CACHE_DIR_)ftccache.c \
-                 $(CACHE_DIR_)ftcglyph.c \
-                 $(CACHE_DIR_)ftcsbits.c \
-                 $(CACHE_DIR_)ftcimage.c \
-                 $(CACHE_DIR_)ftccmap.c
-
-# Cache driver headers
-#
-Cache_DRV_H := $(CACHE_H_DIR_)ftlru.h    \
-               $(CACHE_H_DIR_)ftcmanag.h \
-               $(CACHE_H_DIR_)ftcglyph.h \
-               $(CACHE_H_DIR_)ftcimage.h \
-               $(CACHE_DIR_)ftcerror.h
-
-
-# Cache driver object(s)
-#
-#   Cache_DRV_OBJ_M is used during `multi' builds.
-#   Cache_DRV_OBJ_S is used during `single' builds.
-#
-Cache_DRV_OBJ_M := $(Cache_DRV_SRC:$(CACHE_DIR_)%.c=$(OBJ_)%.$O)
-Cache_DRV_OBJ_S := $(OBJ_)ftcache.$O
-
-# Cache driver source file for single build
-#
-Cache_DRV_SRC_S := $(CACHE_DIR_)ftcache.c
-
-
-# Cache driver - single object
-#
-$(Cache_DRV_OBJ_S): $(Cache_DRV_SRC_S) $(Cache_DRV_SRC) \
-                   $(FREETYPE_H) $(Cache_DRV_H)
-	$(Cache_COMPILE) $T$@ $(Cache_DRV_SRC_S)
-
-
-# Cache driver - multiple objects
-#
-$(OBJ_)%.$O: $(CACHE_DIR_)%.c $(FREETYPE_H) $(Cache_DRV_H)
-	$(Cache_COMPILE) $T$@ $<
-
-
-# update main driver object lists
-#
-DRV_OBJS_S += $(Cache_DRV_OBJ_S)
-DRV_OBJS_M += $(Cache_DRV_OBJ_M)
-
-
-# EOF

+ 0 - 21
sys/src/libfreetype/src/cff/Jamfile

@@ -1,21 +0,0 @@
-# FreeType 2 src/cff Jamfile (c) 2001 David Turner
-#
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) cff ;
-
-{
-  local  _sources ;
-
-  if $(FT2_MULTI)
-  {
-    _sources = cffdrivr cffgload cffload cffobjs cffparse cffcmap ;
-  }
-  else
-  {
-    _sources = cff ;
-  }
-
-  Library  $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/cff Jamfile

+ 0 - 29
sys/src/libfreetype/src/cff/cff.c

@@ -1,29 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  cff.c                                                                  */
-/*                                                                         */
-/*    FreeType OpenType driver component (body only).                      */
-/*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-
-#define FT_MAKE_OPTION_SINGLE_OBJECT
-
-#include <ft2build.h>
-#include "cffdrivr.c"
-#include "cffparse.c"
-#include "cffload.c"
-#include "cffobjs.c"
-#include "cffgload.c"
-#include "cffcmap.c"
-
-/* END */

+ 0 - 23
sys/src/libfreetype/src/cff/descrip.mms

@@ -1,23 +0,0 @@
-#
-# FreeType 2 OpenType/CFF driver compilation rules for VMS
-#
-
-
-# Copyright 2001, 2002 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-
-CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.cff])
-
-OBJS=cff.obj
-
-all : $(OBJS)
-        library [--.lib]freetype.olb $(OBJS)
-
-# EOF

+ 0 - 22
sys/src/libfreetype/src/cff/module.mk

@@ -1,22 +0,0 @@
-#
-# FreeType 2 CFF module definition
-#
-
-
-# Copyright 1996-2000 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-
-make_module_list: add_cff_driver
-
-add_cff_driver:
-	$(OPEN_DRIVER)cff_driver_class$(CLOSE_DRIVER)
-	$(ECHO_DRIVER)cff       $(ECHO_DRIVER_DESC)OpenType fonts with extension *.otf$(ECHO_DRIVER_DONE)
-
-# EOF

+ 0 - 71
sys/src/libfreetype/src/cff/rules.mk

@@ -1,71 +0,0 @@
-#
-# FreeType 2 OpenType/CFF driver configuration rules
-#
-
-
-# Copyright 1996-2000, 2001 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-
-# OpenType driver directory
-#
-CFF_DIR  := $(SRC_)cff
-CFF_DIR_ := $(CFF_DIR)$(SEP)
-
-
-CFF_COMPILE := $(FT_COMPILE) $I$(CFF_DIR)
-
-
-# CFF driver sources (i.e., C files)
-#
-CFF_DRV_SRC := $(CFF_DIR_)cffobjs.c   \
-               $(CFF_DIR_)cffload.c   \
-               $(CFF_DIR_)cffgload.c  \
-               $(CFF_DIR_)cffparse.c  \
-               $(CFF_DIR_)cffcmap.c   \
-               $(CFF_DIR_)cffdrivr.c
-
-# CFF driver headers
-#
-CFF_DRV_H := $(CFF_DRV_SRC:%.c=%.h) \
-             $(CFF_DIR_)cfftoken.h \
-             $(CFF_DIR_)cfferrs.h
-
-
-# CFF driver object(s)
-#
-#   CFF_DRV_OBJ_M is used during `multi' builds
-#   CFF_DRV_OBJ_S is used during `single' builds
-#
-CFF_DRV_OBJ_M := $(CFF_DRV_SRC:$(CFF_DIR_)%.c=$(OBJ_)%.$O)
-CFF_DRV_OBJ_S := $(OBJ_)cff.$O
-
-# CFF driver source file for single build
-#
-CFF_DRV_SRC_S := $(CFF_DIR_)cff.c
-
-
-# CFF driver - single object
-#
-$(CFF_DRV_OBJ_S): $(CFF_DRV_SRC_S) $(CFF_DRV_SRC) $(FREETYPE_H) $(CFF_DRV_H)
-	$(CFF_COMPILE) $T$@ $(CFF_DRV_SRC_S)
-
-
-# CFF driver - multiple objects
-#
-$(OBJ_)%.$O: $(CFF_DIR_)%.c $(FREETYPE_H) $(CFF_DRV_H)
-	$(CFF_COMPILE) $T$@ $<
-
-
-# update main driver object lists
-#
-DRV_OBJS_S += $(CFF_DRV_OBJ_S)
-DRV_OBJS_M += $(CFF_DRV_OBJ_M)
-
-# EOF

+ 0 - 21
sys/src/libfreetype/src/cid/Jamfile

@@ -1,21 +0,0 @@
-# FreeType 2 src/cid Jamfile (c) 2001 David Turner
-#
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) cid ;
-
-{
-  local  _sources ;
-
-  if $(FT2_MULTI)
-  {
-    _sources = cidobjs cidload cidgload cidriver cidparse ;
-  }
-  else
-  {
-    _sources = type1cid ;
-  }
-
-  Library  $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/cid Jamfile

+ 0 - 23
sys/src/libfreetype/src/cid/descrip.mms

@@ -1,23 +0,0 @@
-#
-# FreeType 2 CID driver compilation rules for VMS
-#
-
-
-# Copyright 2001 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-
-CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.cid])
-
-OBJS=type1cid.obj
-
-all : $(OBJS)
-        library [--.lib]freetype.olb $(OBJS)
-
-# EOF

+ 0 - 21
sys/src/libfreetype/src/cid/module.mk

@@ -1,21 +0,0 @@
-#
-# FreeType 2 CID module definition
-#
-
-
-# Copyright 1996-2000 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-
-make_module_list: add_type1cid_driver
-
-add_type1cid_driver:
-	$(OPEN_DRIVER)t1cid_driver_class$(CLOSE_DRIVER)
-	$(ECHO_DRIVER)cid       $(ECHO_DRIVER_DESC)Postscript CID-keyed fonts, no known extension$(ECHO_DRIVER_DONE)
-# EOF

+ 0 - 70
sys/src/libfreetype/src/cid/rules.mk

@@ -1,70 +0,0 @@
-#
-# FreeType 2 CID driver configuration rules
-#
-
-
-# Copyright 1996-2000, 2001 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-
-# CID driver directory
-#
-CID_DIR  := $(SRC_)cid
-CID_DIR_ := $(CID_DIR)$(SEP)
-
-
-CID_COMPILE := $(FT_COMPILE) $I$(CID_DIR)
-
-
-# CID driver sources (i.e., C files)
-#
-CID_DRV_SRC := $(CID_DIR_)cidparse.c \
-               $(CID_DIR_)cidload.c  \
-               $(CID_DIR_)cidriver.c \
-               $(CID_DIR_)cidgload.c \
-               $(CID_DIR_)cidobjs.c
-
-# CID driver headers
-#
-CID_DRV_H := $(CID_DRV_SRC:%.c=%.h) \
-             $(CID_DIR_)cidtoken.h  \
-             $(CID_DIR_)ciderrs.h
-
-
-# CID driver object(s)
-#
-#   CID_DRV_OBJ_M is used during `multi' builds
-#   CID_DRV_OBJ_S is used during `single' builds
-#
-CID_DRV_OBJ_M := $(CID_DRV_SRC:$(CID_DIR_)%.c=$(OBJ_)%.$O)
-CID_DRV_OBJ_S := $(OBJ_)type1cid.$O
-
-# CID driver source file for single build
-#
-CID_DRV_SRC_S := $(CID_DIR_)type1cid.c
-
-
-# CID driver - single object
-#
-$(CID_DRV_OBJ_S): $(CID_DRV_SRC_S) $(CID_DRV_SRC) $(FREETYPE_H) $(CID_DRV_H)
-	$(CID_COMPILE) $T$@ $(CID_DRV_SRC_S)
-
-
-# CID driver - multiple objects
-#
-$(OBJ_)%.$O: $(CID_DIR_)%.c $(FREETYPE_H) $(CID_DRV_H)
-	$(CID_COMPILE) $T$@ $<
-
-
-# update main driver object lists
-#
-DRV_OBJS_S += $(CID_DRV_OBJ_S)
-DRV_OBJS_M += $(CID_DRV_OBJ_M)
-
-# EOF

+ 0 - 29
sys/src/libfreetype/src/cid/type1cid.c

@@ -1,29 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  type1cid.c                                                             */
-/*                                                                         */
-/*    FreeType OpenType driver component (body only).                      */
-/*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-
-#define FT_MAKE_OPTION_SINGLE_OBJECT
-
-#include <ft2build.h>
-#include "cidparse.c"
-#include "cidload.c"
-#include "cidobjs.c"
-#include "cidriver.c"
-#include "cidgload.c"
-
-
-/* END */

+ 0 - 8
sys/src/libfreetype/src/gzip/Jamfile

@@ -1,8 +0,0 @@
-# FreeType 2 src/gzip Jamfile (c) 2001 David Turner
-#
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) gzip ;
-
-Library  $(FT2_LIB) : ftgzip.c ;
-
-# end of src/pcf Jamfile

+ 0 - 48
sys/src/libfreetype/src/gzip/adler32.c

@@ -1,48 +0,0 @@
-/* adler32.c -- compute the Adler-32 checksum of a data stream
- * Copyright (C) 1995-2002 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id: adler32.c,v 1.4 2003/01/30 23:24:18 davidT Exp $ */
-
-#include "zlib.h"
-
-#define BASE 65521L /* largest prime smaller than 65536 */
-#define NMAX 5552
-/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
-
-#define DO1(buf,i)  {s1 += buf[i]; s2 += s1;}
-#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
-#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
-#define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
-#define DO16(buf)   DO8(buf,0); DO8(buf,8);
-
-/* ========================================================================= */
-ZEXPORT(uLong) adler32( /* adler, buf, len) */
-    uLong adler,
-    const Bytef *buf,
-    uInt len )
-{
-    unsigned long s1 = adler & 0xffff;
-    unsigned long s2 = (adler >> 16) & 0xffff;
-    int k;
-
-    if (buf == Z_NULL) return 1L;
-
-    while (len > 0) {
-        k = len < NMAX ? len : NMAX;
-        len -= k;
-        while (k >= 16) {
-            DO16(buf);
-	    buf += 16;
-            k -= 16;
-        }
-        if (k != 0) do {
-            s1 += *buf++;
-	    s2 += s1;
-        } while (--k);
-        s1 %= BASE;
-        s2 %= BASE;
-    }
-    return (s2 << 16) | s1;
-}

+ 0 - 23
sys/src/libfreetype/src/gzip/descrip.mms

@@ -1,23 +0,0 @@
-#
-# FreeType 2 GZip support compilation rules for VMS
-#
-
-
-# Copyright 2002 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-
-CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.gzip])
-
-OBJS=ftgzip.obj
-
-all : $(OBJS)
-        library [--.lib]freetype.olb $(OBJS)
-
-# EOF

+ 0 - 563
sys/src/libfreetype/src/gzip/ftgzip.c

@@ -1,563 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  ftgzip.c                                                               */
-/*                                                                         */
-/*    FreeType support for .gz compressed fileds                           */
-/*                                                                         */
-/*  this optional component relies on zlib. It should mainly be used to    */
-/*  parse compressed PCF fonts, as found with many X11 server              */
-/*  distributions.                                                         */
-/*                                                                         */
-/*  Copyright 2002 by                                                      */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-#include <ft2build.h>
-#include FT_INTERNAL_MEMORY_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_DEBUG_H
-
-#ifdef FT_CONFIG_OPTION_USE_ZLIB
-
-#ifdef FT_CONFIG_OPTION_SYSTEM_ZLIB
-
-#  include <zlib.h>
-
-#else /* !SYSTEM_ZLIB */
-
- /* in this case, we include our own modified sources of the ZLib   */
- /* within the "ftgzip" component. The modifications were necessary */
- /* to #include all files without conflicts, as well as preventing  */
- /* the definition of "extern" functions that may cause linking     */
- /* conflicts when a program is linked with both FreeType and the   */
- /* original ZLib                                                   */
-
-#  define  NO_DUMMY_DECL
-#  define  BUILDFIXED    /* save code size */
-#  define  MY_ZCALLOC
-
-#  include "zlib.h"
-
-#    undef   SLOW
-#    define  SLOW  1  /* we can't use asm-optimized sources here !! */
-
-#    include "zutil.c"
-#    include "inftrees.c"
-#    include "infcodes.c"
-#    include "infutil.c"
-#    include "infblock.c"
-#    include "inflate.c"
-#    include "adler32.c"
-
-#endif /* !SYSTEM_ZLIB */
-
-
-/***************************************************************************/
-/***************************************************************************/
-/*****                                                                 *****/
-/*****            Z L I B   M E M O R Y   M A N A G E M E N T          *****/
-/*****                                                                 *****/
-/***************************************************************************/
-/***************************************************************************/
-
- /* it's better to use FreeType memory routines instead of raw 'malloc/free' */
-
-
- static voidpf
- ft_gzip_alloc( FT_Memory  memory,
-                uInt       items,
-                uInt       size )
- {
-   FT_ULong    sz = (FT_ULong)size * items;
-   FT_Pointer  p;
-
-   FT_MEM_ALLOC( p, sz );
-
-   return (voidpf) p;
- }
-
-
- static void
- ft_gzip_free( FT_Memory  memory,
-               voidpf     address )
- {
-   FT_MEM_FREE( address );
- }
-
-
-#ifndef FT_CONFIG_OPTION_SYSTEM_ZLIB
-
- local voidpf
- zcalloc ( /* opaque, items, size) */
-    voidpf opaque,
-    unsigned items,
-    unsigned size )
- {
-   return ft_gzip_alloc( opaque, items, size );
- }
-
- local void
- zcfree( voidpf  opaque,
-         voidpf  ptr )
- {
-   ft_gzip_free( opaque, ptr );
- }
-
-#endif /* !SYSTEM_ZLIB */
-
-
-/***************************************************************************/
-/***************************************************************************/
-/*****                                                                 *****/
-/*****               Z L I B   F I L E   D E S C R I P T O R           *****/
-/*****                                                                 *****/
-/***************************************************************************/
-/***************************************************************************/
-
-#define  FT_GZIP_BUFFER_SIZE          4096
-
-  typedef struct FT_GZipFileRec_
-  {
-    FT_Stream    source;         /* parent/source stream        */
-    FT_Stream    stream;         /* embedding stream            */
-    FT_Memory    memory;         /* memory allocator            */
-    z_stream     zstream;        /* zlib input stream           */
-
-    FT_ULong     start;          /* starting position, after .gz header */
-    FT_Byte      input[ FT_GZIP_BUFFER_SIZE ];  /* input read buffer */
-
-    FT_Byte      buffer[ FT_GZIP_BUFFER_SIZE ];  /* output buffer      */
-    FT_ULong     pos;                            /* position in output */
-    FT_Byte*     cursor;
-    FT_Byte*     limit;
-
-  } FT_GZipFileRec, *FT_GZipFile;
-
-
-/* gzip flag byte */
-#define FT_GZIP_ASCII_FLAG   0x01 /* bit 0 set: file probably ascii text */
-#define FT_GZIP_HEAD_CRC     0x02 /* bit 1 set: header CRC present */
-#define FT_GZIP_EXTRA_FIELD  0x04 /* bit 2 set: extra field present */
-#define FT_GZIP_ORIG_NAME    0x08 /* bit 3 set: original file name present */
-#define FT_GZIP_COMMENT      0x10 /* bit 4 set: file comment present */
-#define FT_GZIP_RESERVED     0xE0 /* bits 5..7: reserved */
-
-
- /* check and skip .gz header - we don't support "transparent" compression */
-  static FT_Error
-  ft_gzip_check_header( FT_Stream  stream )
-  {
-    FT_Error  error;
-    FT_Byte   head[4];
-
-    if ( FT_STREAM_SEEK( 0 )       ||
-         FT_STREAM_READ( head, 4 ) )
-      goto Exit;
-
-    /* head[0] && head[1] are the magic numbers     */
-    /* head[2] is the method, and head[3] the flags */
-    if ( head[0] != 0x1f              ||
-         head[1] != 0x8b              ||
-         head[2] != Z_DEFLATED        ||
-        (head[3] & FT_GZIP_RESERVED)  )
-    {
-      error = FT_Err_Invalid_File_Format;
-      goto Exit;
-    }
-
-    /* skip time, xflags and os code */
-    (void)FT_STREAM_SKIP( 6 );
-
-    /* skip the extra field */
-    if ( head[3] & FT_GZIP_EXTRA_FIELD )
-    {
-      FT_UInt  len;
-
-      if ( FT_READ_USHORT_LE( len ) ||
-           FT_STREAM_SKIP( len )    )
-        goto Exit;
-    }
-
-    /* skip original file name */
-    if ( head[3] & FT_GZIP_ORIG_NAME )
-      for (;;)
-      {
-        FT_UInt  c;
-
-        if ( FT_READ_BYTE( c) )
-          goto Exit;
-
-        if ( c == 0 )
-          break;
-      }
-
-    /* skip .gz comment */
-    if ( head[3] & FT_GZIP_COMMENT )
-      for (;;)
-      {
-        FT_UInt  c;
-
-        if ( FT_READ_BYTE( c) )
-          goto Exit;
-
-        if ( c == 0 )
-          break;
-      }
-
-    /* skip CRC */
-    if ( head[3] & FT_GZIP_HEAD_CRC )
-      if ( FT_STREAM_SKIP( 2 ) )
-        goto Exit;
-
-  Exit:
-    return error;
-  }
-
-
-
-  static FT_Error
-  ft_gzip_file_init( FT_GZipFile   zip,
-                     FT_Stream     stream,
-                     FT_Stream     source )
-  {
-    z_stream*  zstream = &zip->zstream;
-    FT_Error   error   = 0;
-
-    zip->stream = stream;
-    zip->source = source;
-    zip->memory = stream->memory;
-
-    zip->limit  = zip->buffer + FT_GZIP_BUFFER_SIZE;
-    zip->cursor = zip->limit;
-    zip->pos    = 0;
-
-    /* check and skip .gz header */
-    {
-      stream = source;
-
-      error = ft_gzip_check_header( stream );
-      if (error)
-        goto Exit;
-
-      zip->start = FT_STREAM_POS();
-    }
-
-    /* initialize zlib - there is no zlib header in the compressed stream */
-    zstream->zalloc = (alloc_func) ft_gzip_alloc;
-    zstream->zfree  = (free_func)  ft_gzip_free;
-    zstream->opaque = stream->memory;
-
-    zstream->avail_in = 0;
-    zstream->next_in  = zip->buffer;
-
-    if ( inflateInit2( zstream, -MAX_WBITS ) != Z_OK ||
-         zstream->next_in == NULL                     )
-    {
-      error = FT_Err_Invalid_File_Format;
-      goto Exit;
-    }
-
-  Exit:
-    return error;
-  }
-
-
-
-  static void
-  ft_gzip_file_done( FT_GZipFile  zip )
-  {
-    z_stream*  zstream = &zip->zstream;
-
-    inflateEnd( zstream );
-
-    /* clear the rest */
-    zstream->zalloc    = NULL;
-    zstream->zfree     = NULL;
-    zstream->opaque    = NULL;
-    zstream->next_in   = NULL;
-    zstream->next_out  = NULL;
-    zstream->avail_in  = 0;
-    zstream->avail_out = 0;
-
-    zip->memory = NULL;
-    zip->source = NULL;
-    zip->stream = NULL;
-  }
-
-
-  static FT_Error
-  ft_gzip_file_reset( FT_GZipFile  zip )
-  {
-    FT_Stream  stream = zip->source;
-    FT_Error   error;
-
-    if ( !FT_STREAM_SEEK( zip->start ) )
-    {
-      z_stream*  zstream = &zip->zstream;
-
-      inflateReset( zstream );
-
-      zstream->avail_in  = 0;
-      zstream->next_in   = zip->input;
-      zstream->avail_out = 0;
-      zstream->next_out  = zip->buffer;
-
-      zip->limit  = zip->buffer + FT_GZIP_BUFFER_SIZE;
-      zip->cursor = zip->limit;
-      zip->pos    = 0;
-    }
-    return  error;
-  }
-
-
-  static FT_Error
-  ft_gzip_file_fill_input( FT_GZipFile  zip )
-  {
-    z_stream*  zstream = &zip->zstream;
-    FT_Stream  stream  = zip->source;
-    FT_ULong   size;
-
-    if ( stream->read )
-    {
-      size = stream->read( stream, stream->pos, zip->input, FT_GZIP_BUFFER_SIZE );
-      if ( size == 0 )
-        return FT_Err_Invalid_Stream_Operation;
-    }
-    else
-    {
-      size = stream->size - stream->pos;
-      if ( size > FT_GZIP_BUFFER_SIZE )
-        size = FT_GZIP_BUFFER_SIZE;
-
-      if ( size == 0 )
-       return FT_Err_Invalid_Stream_Operation;
-
-      FT_MEM_COPY( zip->input, stream->base + stream->pos, size );
-    }
-    stream->pos += size;
-
-    zstream->next_in  = zip->input;
-    zstream->avail_in = size;
-
-    return 0;
-  }
-
-
-
-  static FT_Error
-  ft_gzip_file_fill_output( FT_GZipFile  zip )
-  {
-    z_stream*  zstream = &zip->zstream;
-    FT_Error   error   = 0;
-
-    zip->cursor        = zip->buffer;
-    zstream->next_out  = zip->cursor;
-    zstream->avail_out = FT_GZIP_BUFFER_SIZE;
-
-    while ( zstream->avail_out > 0 )
-    {
-      int  err;
-
-      if ( zstream->avail_in == 0 )
-      {
-        error = ft_gzip_file_fill_input( zip );
-        if ( error )
-          break;
-      }
-
-      err = inflate( zstream, Z_NO_FLUSH );
-
-      if ( err == Z_STREAM_END )
-      {
-        zip->limit = zstream->next_out;
-        error      = FT_Err_Invalid_Stream_Operation;
-        break;
-      }
-      else if ( err != Z_OK )
-      {
-        error = FT_Err_Invalid_Stream_Operation;
-        break;
-      }
-    }
-    return error;
-  }
-
-
- /* fill output buffer, 'count' must be <= FT_GZIP_BUFFER_SIZE */
-  static FT_Error
-  ft_gzip_file_skip_output( FT_GZipFile  zip,
-                            FT_ULong     count )
-  {
-    FT_Error   error   = 0;
-    FT_ULong   delta;
-
-    for (;;)
-    {
-      delta = (FT_ULong)( zip->limit - zip->cursor );
-      if ( delta >= count )
-        delta = count;
-
-      zip->cursor += delta;
-      zip->pos    += delta;
-
-      count -= delta;
-      if ( count == 0 )
-        break;
-
-      error = ft_gzip_file_fill_output( zip );
-      if ( error )
-        break;
-    }
-
-    return error;
-  }
-
-
-  static FT_ULong
-  ft_gzip_file_io( FT_GZipFile   zip,
-                   FT_ULong      pos,
-                   FT_Byte*      buffer,
-                   FT_ULong      count )
-  {
-    FT_ULong   result = 0;
-    FT_Error   error;
-
-    /* reset inflate stream if we're seeking backwards        */
-    /* yes, that's not too efficient, but it saves memory :-) */
-    if ( pos < zip->pos )
-    {
-      error = ft_gzip_file_reset( zip );
-      if ( error ) goto Exit;
-    }
-
-    /* skip unwanted bytes */
-    if ( pos > zip->pos )
-    {
-      error = ft_gzip_file_skip_output( zip, (FT_ULong)( pos - zip->pos ) );
-      if (error)
-        goto Exit;
-    }
-
-    if ( count == 0 )
-      goto Exit;
-
-    /* now read the data */
-    for (;;)
-    {
-      FT_ULong   delta;
-
-      delta = (FT_ULong)( zip->limit - zip->cursor );
-      if ( delta >= count )
-        delta = count;
-
-      FT_MEM_COPY( buffer, zip->cursor, delta );
-      buffer      += delta;
-      result      += delta;
-      zip->cursor += delta;
-      zip->pos    += delta;
-
-      count -= delta;
-      if ( count == 0 )
-        break;
-
-      error = ft_gzip_file_fill_output( zip );
-      if (error)
-        break;
-    }
-
-  Exit:
-    return result;
-  }
-
-
-/***************************************************************************/
-/***************************************************************************/
-/*****                                                                 *****/
-/*****               G Z   E M B E D D I N G   S T R E A M             *****/
-/*****                                                                 *****/
-/***************************************************************************/
-/***************************************************************************/
-
-  static void
-  ft_gzip_stream_close( FT_Stream  stream )
-  {
-    FT_GZipFile  zip    = stream->descriptor.pointer;
-    FT_Memory    memory = stream->memory;
-
-    if ( zip )
-    {
-      /* finalize gzip file descriptor */
-      ft_gzip_file_done( zip );
-
-      FT_FREE( zip );
-
-      stream->descriptor.pointer = NULL;
-    }
-  }
-
-
-  static FT_ULong
-  ft_gzip_stream_io( FT_Stream   stream,
-                     FT_ULong    pos,
-                     FT_Byte*    buffer,
-                     FT_ULong    count )
-  {
-    FT_GZipFile  zip = stream->descriptor.pointer;
-
-    return ft_gzip_file_io( zip, pos, buffer, count );
-  }
-
-
-  FT_EXPORT_DEF( FT_Error )
-  FT_Stream_OpenGzip( FT_Stream    stream,
-                      FT_Stream    source )
-  {
-    FT_Error     error;
-    FT_Memory    memory = source->memory;
-    FT_GZipFile  zip;
-
-    FT_ZERO( stream );
-    stream->memory = memory;
-
-    if ( !FT_NEW( zip ) )
-    {
-      error = ft_gzip_file_init( zip, stream, source );
-      if ( error )
-      {
-        FT_FREE( zip );
-        goto Exit;
-      }
-
-      stream->descriptor.pointer = zip;
-    }
-
-     stream->size = 0x7FFFFFFF;  /* don't know the real size !! */
-    stream->pos   = 0;
-    stream->base  = 0;
-    stream->read  = ft_gzip_stream_io;
-    stream->close = ft_gzip_stream_close;
-
-  Exit:
-    return error;
-  }
-
-#else  /* !FT_CONFIG_OPTION_USE_ZLIB */
-
-  FT_EXPORT_DEF( FT_Error )
-  FT_Stream_OpenGzip( FT_Stream    stream,
-                      FT_Stream    source )
-  {
-    FT_UNUSED( stream );
-    FT_UNUSED( source );
-
-    return FT_Err_Unimplemented_Feature;
-  }
-
-#endif /* !FT_CONFIG_OPTION_USE_ZLIB */

+ 0 - 386
sys/src/libfreetype/src/gzip/infblock.c

@@ -1,386 +0,0 @@
-/* infblock.c -- interpret and process block types to last block
- * Copyright (C) 1995-2002 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include "zutil.h"
-#include "infblock.h"
-#include "inftrees.h"
-#include "infcodes.h"
-#include "infutil.h"
-
-
-/* simplify the use of the inflate_huft type with some defines */
-#define exop word.what.Exop
-#define bits word.what.Bits
-
-/* Table for deflate from PKZIP's appnote.txt. */
-local const uInt border[] = { /* Order of the bit length code lengths */
-        16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
-
-/*
-   Notes beyond the 1.93a appnote.txt:
-
-   1. Distance pointers never point before the beginning of the output
-      stream.
-   2. Distance pointers can point back across blocks, up to 32k away.
-   3. There is an implied maximum of 7 bits for the bit length table and
-      15 bits for the actual data.
-   4. If only one code exists, then it is encoded using one bit.  (Zero
-      would be more efficient, but perhaps a little confusing.)  If two
-      codes exist, they are coded using one bit each (0 and 1).
-   5. There is no way of sending zero distance codes--a dummy must be
-      sent if there are none.  (History: a pre 2.0 version of PKZIP would
-      store blocks with no distance codes, but this was discovered to be
-      too harsh a criterion.)  Valid only for 1.93a.  2.04c does allow
-      zero distance codes, which is sent as one code of zero bits in
-      length.
-   6. There are up to 286 literal/length codes.  Code 256 represents the
-      end-of-block.  Note however that the static length tree defines
-      288 codes just to fill out the Huffman codes.  Codes 286 and 287
-      cannot be used though, since there is no length base or extra bits
-      defined for them.  Similarily, there are up to 30 distance codes.
-      However, static trees define 32 codes (all 5 bits) to fill out the
-      Huffman codes, but the last two had better not show up in the data.
-   7. Unzip can check dynamic Huffman blocks for complete code sets.
-      The exception is that a single code would not be complete (see #4).
-   8. The five bits following the block type is really the number of
-      literal codes sent minus 257.
-   9. Length codes 8,16,16 are interpreted as 13 length codes of 8 bits
-      (1+6+6).  Therefore, to output three times the length, you output
-      three codes (1+1+1), whereas to output four times the same length,
-      you only need two codes (1+3).  Hmm.
-  10. In the tree reconstruction algorithm, Code = Code + Increment
-      only if BitLength(i) is not zero.  (Pretty obvious.)
-  11. Correction: 4 Bits: # of Bit Length codes - 4     (4 - 19)
-  12. Note: length code 284 can represent 227-258, but length code 285
-      really is 258.  The last length deserves its own, short code
-      since it gets used a lot in very redundant files.  The length
-      258 is special since 258 - 3 (the min match length) is 255.
-  13. The literal/length and distance code bit lengths are read as a
-      single stream of lengths.  It is possible (and advantageous) for
-      a repeat code (16, 17, or 18) to go across the boundary between
-      the two sets of lengths.
- */
-
-
-local void inflate_blocks_reset( /* s, z, c) */
-inflate_blocks_statef *s,
-z_streamp z,
-uLongf *c )
-{
-  if (c != Z_NULL)
-    *c = s->check;
-  if (s->mode == BTREE || s->mode == DTREE)
-    ZFREE(z, s->sub.trees.blens);
-  if (s->mode == CODES)
-    inflate_codes_free(s->sub.decode.codes, z);
-  s->mode = TYPE;
-  s->bitk = 0;
-  s->bitb = 0;
-  s->read = s->write = s->window;
-  if (s->checkfn != Z_NULL)
-    z->adler = s->check = (*s->checkfn)(0L, (const Bytef *)Z_NULL, 0);
-  Tracev((stderr, "inflate:   blocks reset\n"));
-}
-
-
-local inflate_blocks_statef *inflate_blocks_new( /* z, c, w) */
-z_streamp z,
-check_func c,
-uInt w )
-{
-  inflate_blocks_statef *s;
-
-  if ((s = (inflate_blocks_statef *)ZALLOC
-       (z,1,sizeof(struct inflate_blocks_state))) == Z_NULL)
-    return s;
-  if ((s->hufts =
-       (inflate_huft *)ZALLOC(z, sizeof(inflate_huft), MANY)) == Z_NULL)
-  {
-    ZFREE(z, s);
-    return Z_NULL;
-  }
-  if ((s->window = (Bytef *)ZALLOC(z, 1, w)) == Z_NULL)
-  {
-    ZFREE(z, s->hufts);
-    ZFREE(z, s);
-    return Z_NULL;
-  }
-  s->end = s->window + w;
-  s->checkfn = c;
-  s->mode = TYPE;
-  Tracev((stderr, "inflate:   blocks allocated\n"));
-  inflate_blocks_reset(s, z, Z_NULL);
-  return s;
-}
-
-
-local int inflate_blocks( /* s, z, r) */
-inflate_blocks_statef *s,
-z_streamp z,
-int r )
-{
-  uInt t;               /* temporary storage */
-  uLong b;              /* bit buffer */
-  uInt k;               /* bits in bit buffer */
-  Bytef *p;             /* input data pointer */
-  uInt n;               /* bytes available there */
-  Bytef *q;             /* output window write pointer */
-  uInt m;               /* bytes to end of window or read pointer */
-
-  /* copy input/output information to locals (UPDATE macro restores) */
-  LOAD
-
-  /* process input based on current state */
-  while (1) switch (s->mode)
-  {
-    case TYPE:
-      NEEDBITS(3)
-      t = (uInt)b & 7;
-      s->last = t & 1;
-      switch (t >> 1)
-      {
-        case 0:                         /* stored */
-          Tracev((stderr, "inflate:     stored block%s\n",
-                 s->last ? " (last)" : ""));
-          DUMPBITS(3)
-          t = k & 7;                    /* go to byte boundary */
-          DUMPBITS(t)
-          s->mode = LENS;               /* get length of stored block */
-          break;
-        case 1:                         /* fixed */
-          Tracev((stderr, "inflate:     fixed codes block%s\n",
-                 s->last ? " (last)" : ""));
-          {
-            uInt bl, bd;
-            inflate_huft *tl, *td;
-
-            inflate_trees_fixed(&bl, &bd, &tl, &td, z);
-            s->sub.decode.codes = inflate_codes_new(bl, bd, tl, td, z);
-            if (s->sub.decode.codes == Z_NULL)
-            {
-              r = Z_MEM_ERROR;
-              LEAVE
-            }
-          }
-          DUMPBITS(3)
-          s->mode = CODES;
-          break;
-        case 2:                         /* dynamic */
-          Tracev((stderr, "inflate:     dynamic codes block%s\n",
-                 s->last ? " (last)" : ""));
-          DUMPBITS(3)
-          s->mode = TABLE;
-          break;
-        case 3:                         /* illegal */
-          DUMPBITS(3)
-          s->mode = BAD;
-          z->msg = (char*)"invalid block type";
-          r = Z_DATA_ERROR;
-          LEAVE
-      }
-      break;
-    case LENS:
-      NEEDBITS(32)
-      if ((((~b) >> 16) & 0xffff) != (b & 0xffff))
-      {
-        s->mode = BAD;
-        z->msg = (char*)"invalid stored block lengths";
-        r = Z_DATA_ERROR;
-        LEAVE
-      }
-      s->sub.left = (uInt)b & 0xffff;
-      b = k = 0;                      /* dump bits */
-      Tracev((stderr, "inflate:       stored length %u\n", s->sub.left));
-      s->mode = s->sub.left ? STORED : (s->last ? DRY : TYPE);
-      break;
-    case STORED:
-      if (n == 0)
-        LEAVE
-      NEEDOUT
-      t = s->sub.left;
-      if (t > n) t = n;
-      if (t > m) t = m;
-      zmemcpy(q, p, t);
-      p += t;  n -= t;
-      q += t;  m -= t;
-      if ((s->sub.left -= t) != 0)
-        break;
-      Tracev((stderr, "inflate:       stored end, %lu total out\n",
-              z->total_out + (q >= s->read ? q - s->read :
-              (s->end - s->read) + (q - s->window))));
-      s->mode = s->last ? DRY : TYPE;
-      break;
-    case TABLE:
-      NEEDBITS(14)
-      s->sub.trees.table = t = (uInt)b & 0x3fff;
-#ifndef PKZIP_BUG_WORKAROUND
-      if ((t & 0x1f) > 29 || ((t >> 5) & 0x1f) > 29)
-      {
-        s->mode = BAD;
-        z->msg = (char*)"too many length or distance symbols";
-        r = Z_DATA_ERROR;
-        LEAVE
-      }
-#endif
-      t = 258 + (t & 0x1f) + ((t >> 5) & 0x1f);
-      if ((s->sub.trees.blens = (uIntf*)ZALLOC(z, t, sizeof(uInt))) == Z_NULL)
-      {
-        r = Z_MEM_ERROR;
-        LEAVE
-      }
-      DUMPBITS(14)
-      s->sub.trees.index = 0;
-      Tracev((stderr, "inflate:       table sizes ok\n"));
-      s->mode = BTREE;
-    case BTREE:
-      while (s->sub.trees.index < 4 + (s->sub.trees.table >> 10))
-      {
-        NEEDBITS(3)
-        s->sub.trees.blens[border[s->sub.trees.index++]] = (uInt)b & 7;
-        DUMPBITS(3)
-      }
-      while (s->sub.trees.index < 19)
-        s->sub.trees.blens[border[s->sub.trees.index++]] = 0;
-      s->sub.trees.bb = 7;
-      t = inflate_trees_bits(s->sub.trees.blens, &s->sub.trees.bb,
-                             &s->sub.trees.tb, s->hufts, z);
-      if (t != Z_OK)
-      {
-        r = t;
-        if (r == Z_DATA_ERROR)
-        {
-          ZFREE(z, s->sub.trees.blens);
-          s->mode = BAD;
-        }
-        LEAVE
-      }
-      s->sub.trees.index = 0;
-      Tracev((stderr, "inflate:       bits tree ok\n"));
-      s->mode = DTREE;
-    case DTREE:
-      while (t = s->sub.trees.table,
-             s->sub.trees.index < 258 + (t & 0x1f) + ((t >> 5) & 0x1f))
-      {
-        inflate_huft *h;
-        uInt i, j, c;
-
-        t = s->sub.trees.bb;
-        NEEDBITS(t)
-        h = s->sub.trees.tb + ((uInt)b & inflate_mask[t]);
-        t = h->bits;
-        c = h->base;
-        if (c < 16)
-        {
-          DUMPBITS(t)
-          s->sub.trees.blens[s->sub.trees.index++] = c;
-        }
-        else /* c == 16..18 */
-        {
-          i = c == 18 ? 7 : c - 14;
-          j = c == 18 ? 11 : 3;
-          NEEDBITS(t + i)
-          DUMPBITS(t)
-          j += (uInt)b & inflate_mask[i];
-          DUMPBITS(i)
-          i = s->sub.trees.index;
-          t = s->sub.trees.table;
-          if (i + j > 258 + (t & 0x1f) + ((t >> 5) & 0x1f) ||
-              (c == 16 && i < 1))
-          {
-            ZFREE(z, s->sub.trees.blens);
-            s->mode = BAD;
-            z->msg = (char*)"invalid bit length repeat";
-            r = Z_DATA_ERROR;
-            LEAVE
-          }
-          c = c == 16 ? s->sub.trees.blens[i - 1] : 0;
-          do {
-            s->sub.trees.blens[i++] = c;
-          } while (--j);
-          s->sub.trees.index = i;
-        }
-      }
-      s->sub.trees.tb = Z_NULL;
-      {
-        uInt bl, bd;
-        inflate_huft *tl, *td;
-        inflate_codes_statef *c;
-
-        bl = 9;         /* must be <= 9 for lookahead assumptions */
-        bd = 6;         /* must be <= 9 for lookahead assumptions */
-        t = s->sub.trees.table;
-        t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f),
-                                  s->sub.trees.blens, &bl, &bd, &tl, &td,
-                                  s->hufts, z);
-        if (t != Z_OK)
-        {
-          if (t == (uInt)Z_DATA_ERROR)
-          {
-            ZFREE(z, s->sub.trees.blens);
-            s->mode = BAD;
-          }
-          r = t;
-          LEAVE
-        }
-        Tracev((stderr, "inflate:       trees ok\n"));
-        if ((c = inflate_codes_new(bl, bd, tl, td, z)) == Z_NULL)
-        {
-          r = Z_MEM_ERROR;
-          LEAVE
-        }
-        s->sub.decode.codes = c;
-      }
-      ZFREE(z, s->sub.trees.blens);
-      s->mode = CODES;
-    case CODES:
-      UPDATE
-      if ((r = inflate_codes(s, z, r)) != Z_STREAM_END)
-        return inflate_flush(s, z, r);
-      r = Z_OK;
-      inflate_codes_free(s->sub.decode.codes, z);
-      LOAD
-      Tracev((stderr, "inflate:       codes end, %lu total out\n",
-              z->total_out + (q >= s->read ? q - s->read :
-              (s->end - s->read) + (q - s->window))));
-      if (!s->last)
-      {
-        s->mode = TYPE;
-        break;
-      }
-      s->mode = DRY;
-    case DRY:
-      FLUSH
-      if (s->read != s->write)
-        LEAVE
-      s->mode = DONE;
-    case DONE:
-      r = Z_STREAM_END;
-      LEAVE
-    case BAD:
-      r = Z_DATA_ERROR;
-      LEAVE
-    default:
-      r = Z_STREAM_ERROR;
-      LEAVE
-  }
-#ifdef NEED_DUMMY_RETURN
-  return 0;
-#endif
-}
-
-
-local int inflate_blocks_free( /* s, z) */
-inflate_blocks_statef *s,
-z_streamp z )
-{
-  inflate_blocks_reset(s, z, Z_NULL);
-  ZFREE(z, s->window);
-  ZFREE(z, s->hufts);
-  ZFREE(z, s);
-  Tracev((stderr, "inflate:   blocks freed\n"));
-  return Z_OK;
-}
-
-

+ 0 - 36
sys/src/libfreetype/src/gzip/infblock.h

@@ -1,36 +0,0 @@
-/* infblock.h -- header to use infblock.c
- * Copyright (C) 1995-2002 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
-   part of the implementation of the compression library and is
-   subject to change. Applications should only use zlib.h.
- */
-
-#ifndef _INFBLOCK_H
-#define _INFBLOCK_H
-
-struct inflate_blocks_state;
-typedef struct inflate_blocks_state FAR inflate_blocks_statef;
-
-local  inflate_blocks_statef * inflate_blocks_new OF((
-    z_streamp z,
-    check_func c,               /* check function */
-    uInt w));                   /* window size */
-
-local  int inflate_blocks OF((
-    inflate_blocks_statef *,
-    z_streamp ,
-    int));                      /* initial return code */
-
-local  void inflate_blocks_reset OF((
-    inflate_blocks_statef *,
-    z_streamp ,
-    uLongf *));                  /* check value on output */
-
-local  int inflate_blocks_free OF((
-    inflate_blocks_statef *,
-    z_streamp));
-
-#endif /* _INFBLOCK_H */

+ 0 - 250
sys/src/libfreetype/src/gzip/infcodes.c

@@ -1,250 +0,0 @@
-/* infcodes.c -- process literals and length/distance pairs
- * Copyright (C) 1995-2002 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include "zutil.h"
-#include "inftrees.h"
-#include "infblock.h"
-#include "infcodes.h"
-#include "infutil.h"
-
-/* simplify the use of the inflate_huft type with some defines */
-#define exop word.what.Exop
-#define bits word.what.Bits
-
-typedef enum {        /* waiting for "i:"=input, "o:"=output, "x:"=nothing */
-      START,    /* x: set up for LEN */
-      LEN,      /* i: get length/literal/eob next */
-      LENEXT,   /* i: getting length extra (have base) */
-      DIST,     /* i: get distance next */
-      DISTEXT,  /* i: getting distance extra */
-      COPY,     /* o: copying bytes in window, waiting for space */
-      LIT,      /* o: got literal, waiting for output space */
-      WASH,     /* o: got eob, possibly still output waiting */
-      END,      /* x: got eob and all data flushed */
-      BADCODE}  /* x: got error */
-inflate_codes_mode;
-
-/* inflate codes private state */
-struct inflate_codes_state {
-
-  /* mode */
-  inflate_codes_mode mode;      /* current inflate_codes mode */
-
-  /* mode dependent information */
-  uInt len;
-  union {
-    struct {
-      inflate_huft *tree;       /* pointer into tree */
-      uInt need;                /* bits needed */
-    } code;             /* if LEN or DIST, where in tree */
-    uInt lit;           /* if LIT, literal */
-    struct {
-      uInt get;                 /* bits to get for extra */
-      uInt dist;                /* distance back to copy from */
-    } copy;             /* if EXT or COPY, where and how much */
-  } sub;                /* submode */
-
-  /* mode independent information */
-  Byte lbits;           /* ltree bits decoded per branch */
-  Byte dbits;           /* dtree bits decoder per branch */
-  inflate_huft *ltree;          /* literal/length/eob tree */
-  inflate_huft *dtree;          /* distance tree */
-
-};
-
-
-local inflate_codes_statef *inflate_codes_new( /* bl, bd, tl, td, z) */
-uInt bl, uInt bd,
-inflate_huft *tl,
-inflate_huft *td, /* need separate declaration for Borland C++ */
-z_streamp z )
-{
-  inflate_codes_statef *c;
-
-  if ((c = (inflate_codes_statef *)
-       ZALLOC(z,1,sizeof(struct inflate_codes_state))) != Z_NULL)
-  {
-    c->mode = START;
-    c->lbits = (Byte)bl;
-    c->dbits = (Byte)bd;
-    c->ltree = tl;
-    c->dtree = td;
-    Tracev((stderr, "inflate:       codes new\n"));
-  }
-  return c;
-}
-
-
-local int inflate_codes( /* s, z, r) */
-inflate_blocks_statef *s,
-z_streamp z,
-int r )
-{
-  uInt j;               /* temporary storage */
-  inflate_huft *t;      /* temporary pointer */
-  uInt e;               /* extra bits or operation */
-  uLong b;              /* bit buffer */
-  uInt k;               /* bits in bit buffer */
-  Bytef *p;             /* input data pointer */
-  uInt n;               /* bytes available there */
-  Bytef *q;             /* output window write pointer */
-  uInt m;               /* bytes to end of window or read pointer */
-  Bytef *f;             /* pointer to copy strings from */
-  inflate_codes_statef *c = s->sub.decode.codes;  /* codes state */
-
-  /* copy input/output information to locals (UPDATE macro restores) */
-  LOAD
-
-  /* process input and output based on current state */
-  while (1) switch (c->mode)
-  {             /* waiting for "i:"=input, "o:"=output, "x:"=nothing */
-    case START:         /* x: set up for LEN */
-#ifndef SLOW
-      if (m >= 258 && n >= 10)
-      {
-        UPDATE
-        r = inflate_fast(c->lbits, c->dbits, c->ltree, c->dtree, s, z);
-        LOAD
-        if (r != Z_OK)
-        {
-          c->mode = r == Z_STREAM_END ? WASH : BADCODE;
-          break;
-        }
-      }
-#endif /* !SLOW */
-      c->sub.code.need = c->lbits;
-      c->sub.code.tree = c->ltree;
-      c->mode = LEN;
-    case LEN:           /* i: get length/literal/eob next */
-      j = c->sub.code.need;
-      NEEDBITS(j)
-      t = c->sub.code.tree + ((uInt)b & inflate_mask[j]);
-      DUMPBITS(t->bits)
-      e = (uInt)(t->exop);
-      if (e == 0)               /* literal */
-      {
-        c->sub.lit = t->base;
-        Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?
-                 "inflate:         literal '%c'\n" :
-                 "inflate:         literal 0x%02x\n", t->base));
-        c->mode = LIT;
-        break;
-      }
-      if (e & 16)               /* length */
-      {
-        c->sub.copy.get = e & 15;
-        c->len = t->base;
-        c->mode = LENEXT;
-        break;
-      }
-      if ((e & 64) == 0)        /* next table */
-      {
-        c->sub.code.need = e;
-        c->sub.code.tree = t + t->base;
-        break;
-      }
-      if (e & 32)               /* end of block */
-      {
-        Tracevv((stderr, "inflate:         end of block\n"));
-        c->mode = WASH;
-        break;
-      }
-      c->mode = BADCODE;        /* invalid code */
-      z->msg = (char*)"invalid literal/length code";
-      r = Z_DATA_ERROR;
-      LEAVE
-    case LENEXT:        /* i: getting length extra (have base) */
-      j = c->sub.copy.get;
-      NEEDBITS(j)
-      c->len += (uInt)b & inflate_mask[j];
-      DUMPBITS(j)
-      c->sub.code.need = c->dbits;
-      c->sub.code.tree = c->dtree;
-      Tracevv((stderr, "inflate:         length %u\n", c->len));
-      c->mode = DIST;
-    case DIST:          /* i: get distance next */
-      j = c->sub.code.need;
-      NEEDBITS(j)
-      t = c->sub.code.tree + ((uInt)b & inflate_mask[j]);
-      DUMPBITS(t->bits)
-      e = (uInt)(t->exop);
-      if (e & 16)               /* distance */
-      {
-        c->sub.copy.get = e & 15;
-        c->sub.copy.dist = t->base;
-        c->mode = DISTEXT;
-        break;
-      }
-      if ((e & 64) == 0)        /* next table */
-      {
-        c->sub.code.need = e;
-        c->sub.code.tree = t + t->base;
-        break;
-      }
-      c->mode = BADCODE;        /* invalid code */
-      z->msg = (char*)"invalid distance code";
-      r = Z_DATA_ERROR;
-      LEAVE
-    case DISTEXT:       /* i: getting distance extra */
-      j = c->sub.copy.get;
-      NEEDBITS(j)
-      c->sub.copy.dist += (uInt)b & inflate_mask[j];
-      DUMPBITS(j)
-      Tracevv((stderr, "inflate:         distance %u\n", c->sub.copy.dist));
-      c->mode = COPY;
-    case COPY:          /* o: copying bytes in window, waiting for space */
-      f = q - c->sub.copy.dist;
-      while (f < s->window)             /* modulo window size-"while" instead */
-        f += s->end - s->window;        /* of "if" handles invalid distances */
-      while (c->len)
-      {
-        NEEDOUT
-        OUTBYTE(*f++)
-        if (f == s->end)
-          f = s->window;
-        c->len--;
-      }
-      c->mode = START;
-      break;
-    case LIT:           /* o: got literal, waiting for output space */
-      NEEDOUT
-      OUTBYTE(c->sub.lit)
-      c->mode = START;
-      break;
-    case WASH:          /* o: got eob, possibly more output */
-      if (k > 7)        /* return unused byte, if any */
-      {
-        Assert(k < 16, "inflate_codes grabbed too many bytes")
-        k -= 8;
-        n++;
-        p--;            /* can always return one */
-      }
-      FLUSH
-      if (s->read != s->write)
-        LEAVE
-      c->mode = END;
-    case END:
-      r = Z_STREAM_END;
-      LEAVE
-    case BADCODE:       /* x: got error */
-      r = Z_DATA_ERROR;
-      LEAVE
-    default:
-      r = Z_STREAM_ERROR;
-      LEAVE
-  }
-#ifdef NEED_DUMMY_RETURN
-  return Z_STREAM_ERROR;  /* Some dumb compilers complain without this */
-#endif
-}
-
-
-local void inflate_codes_free( /* c, z) */
-inflate_codes_statef *c,
-z_streamp z )
-{
-  ZFREE(z, c);
-  Tracev((stderr, "inflate:       codes free\n"));
-}

+ 0 - 31
sys/src/libfreetype/src/gzip/infcodes.h

@@ -1,31 +0,0 @@
-/* infcodes.h -- header to use infcodes.c
- * Copyright (C) 1995-2002 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
-   part of the implementation of the compression library and is
-   subject to change. Applications should only use zlib.h.
- */
-
-#ifndef _INFCODES_H
-#define _INFCODES_H
-
-struct inflate_codes_state;
-typedef struct inflate_codes_state FAR inflate_codes_statef;
-
-local inflate_codes_statef *inflate_codes_new OF((
-    uInt, uInt,
-    inflate_huft *, inflate_huft *,
-    z_streamp ));
-
-local int inflate_codes OF((
-    inflate_blocks_statef *,
-    z_streamp ,
-    int));
-
-local void inflate_codes_free OF((
-    inflate_codes_statef *,
-    z_streamp ));
-
-#endif /* _INFCODES_H */

+ 0 - 151
sys/src/libfreetype/src/gzip/inffixed.h

@@ -1,151 +0,0 @@
-/* inffixed.h -- table for decoding fixed codes
- * Generated automatically by the maketree.c program
- */
-
-/* WARNING: this file should *not* be used by applications. It is
-   part of the implementation of the compression library and is
-   subject to change. Applications should only use zlib.h.
- */
-
-local uInt fixed_bl = 9;
-local uInt fixed_bd = 5;
-local inflate_huft fixed_tl[] = {
-    {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115},
-    {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},192},
-    {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},160},
-    {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},224},
-    {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},144},
-    {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},208},
-    {{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},176},
-    {{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},240},
-    {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227},
-    {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},200},
-    {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},168},
-    {{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},232},
-    {{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},152},
-    {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},216},
-    {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},184},
-    {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},248},
-    {{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163},
-    {{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},196},
-    {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},164},
-    {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},228},
-    {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},148},
-    {{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},212},
-    {{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},180},
-    {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},244},
-    {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0},
-    {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},204},
-    {{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},172},
-    {{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},236},
-    {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},156},
-    {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},220},
-    {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},188},
-    {{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},252},
-    {{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131},
-    {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},194},
-    {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},162},
-    {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},226},
-    {{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},146},
-    {{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},210},
-    {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},178},
-    {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},242},
-    {{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258},
-    {{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},202},
-    {{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},170},
-    {{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},234},
-    {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},154},
-    {{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},218},
-    {{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},186},
-    {{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},250},
-    {{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195},
-    {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},198},
-    {{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},166},
-    {{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},230},
-    {{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},150},
-    {{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},214},
-    {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},182},
-    {{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},246},
-    {{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0},
-    {{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},206},
-    {{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},174},
-    {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},238},
-    {{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},158},
-    {{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},222},
-    {{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},190},
-    {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},254},
-    {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115},
-    {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},193},
-    {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},161},
-    {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},225},
-    {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},145},
-    {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},209},
-    {{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},177},
-    {{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},241},
-    {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227},
-    {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},201},
-    {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},169},
-    {{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},233},
-    {{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},153},
-    {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},217},
-    {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},185},
-    {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},249},
-    {{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163},
-    {{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},197},
-    {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},165},
-    {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},229},
-    {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},149},
-    {{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},213},
-    {{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},181},
-    {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},245},
-    {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0},
-    {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},205},
-    {{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},173},
-    {{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},237},
-    {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},157},
-    {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},221},
-    {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},189},
-    {{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},253},
-    {{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131},
-    {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},195},
-    {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},163},
-    {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},227},
-    {{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},147},
-    {{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},211},
-    {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},179},
-    {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},243},
-    {{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258},
-    {{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},203},
-    {{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},171},
-    {{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},235},
-    {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},155},
-    {{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},219},
-    {{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},187},
-    {{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},251},
-    {{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195},
-    {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},199},
-    {{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},167},
-    {{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},231},
-    {{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},151},
-    {{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},215},
-    {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},183},
-    {{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},247},
-    {{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0},
-    {{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},207},
-    {{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},175},
-    {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},239},
-    {{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},159},
-    {{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},223},
-    {{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},191},
-    {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},255}
-  };
-local inflate_huft fixed_td[] = {
-    {{{80,5}},1}, {{{87,5}},257}, {{{83,5}},17}, {{{91,5}},4097},
-    {{{81,5}},5}, {{{89,5}},1025}, {{{85,5}},65}, {{{93,5}},16385},
-    {{{80,5}},3}, {{{88,5}},513}, {{{84,5}},33}, {{{92,5}},8193},
-    {{{82,5}},9}, {{{90,5}},2049}, {{{86,5}},129}, {{{192,5}},24577},
-    {{{80,5}},2}, {{{87,5}},385}, {{{83,5}},25}, {{{91,5}},6145},
-    {{{81,5}},7}, {{{89,5}},1537}, {{{85,5}},97}, {{{93,5}},24577},
-    {{{80,5}},4}, {{{88,5}},769}, {{{84,5}},49}, {{{92,5}},12289},
-    {{{82,5}},13}, {{{90,5}},3073}, {{{86,5}},193}, {{{192,5}},24577}
-  };

+ 0 - 273
sys/src/libfreetype/src/gzip/inflate.c

@@ -1,273 +0,0 @@
-/* inflate.c -- zlib interface to inflate modules
- * Copyright (C) 1995-2002 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include "zutil.h"
-#include "infblock.h"
-
-#define  DONE  INFLATE_DONE
-#define  BAD   INFLATE_BAD
-
-typedef enum {
-      METHOD,   /* waiting for method byte */
-      FLAG,     /* waiting for flag byte */
-      DICT4,    /* four dictionary check bytes to go */
-      DICT3,    /* three dictionary check bytes to go */
-      DICT2,    /* two dictionary check bytes to go */
-      DICT1,    /* one dictionary check byte to go */
-      DICT0,    /* waiting for inflateSetDictionary */
-      BLOCKS,   /* decompressing blocks */
-      CHECK4,   /* four check bytes to go */
-      CHECK3,   /* three check bytes to go */
-      CHECK2,   /* two check bytes to go */
-      CHECK1,   /* one check byte to go */
-      DONE,     /* finished check, done */
-      BAD}      /* got an error--stay here */
-inflate_mode;
-
-/* inflate private state */
-struct internal_state {
-
-  /* mode */
-  inflate_mode  mode;   /* current inflate mode */
-
-  /* mode dependent information */
-  union {
-    uInt method;        /* if FLAGS, method byte */
-    struct {
-      uLong was;                /* computed check value */
-      uLong need;               /* stream check value */
-    } check;            /* if CHECK, check values to compare */
-    uInt marker;        /* if BAD, inflateSync's marker bytes count */
-  } sub;        /* submode */
-
-  /* mode independent information */
-  int  nowrap;          /* flag for no wrapper */
-  uInt wbits;           /* log2(window size)  (8..15, defaults to 15) */
-  inflate_blocks_statef
-    *blocks;            /* current inflate_blocks state */
-
-};
-
-
-ZEXPORT(int) inflateReset( /* z) */
-z_streamp z )
-{
-  if (z == Z_NULL || z->state == Z_NULL)
-    return Z_STREAM_ERROR;
-  z->total_in = z->total_out = 0;
-  z->msg = Z_NULL;
-  z->state->mode = z->state->nowrap ? BLOCKS : METHOD;
-  inflate_blocks_reset(z->state->blocks, z, Z_NULL);
-  Tracev((stderr, "inflate: reset\n"));
-  return Z_OK;
-}
-
-
-ZEXPORT(int) inflateEnd( /* z) */
-z_streamp z )
-{
-  if (z == Z_NULL || z->state == Z_NULL || z->zfree == Z_NULL)
-    return Z_STREAM_ERROR;
-  if (z->state->blocks != Z_NULL)
-    inflate_blocks_free(z->state->blocks, z);
-  ZFREE(z, z->state);
-  z->state = Z_NULL;
-  Tracev((stderr, "inflate: end\n"));
-  return Z_OK;
-}
-
-
-ZEXPORT(int) inflateInit2_( /* z, w, version, stream_size) */
-z_streamp z,
-int w,
-const char *version,
-int stream_size )
-{
-  if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
-      stream_size != sizeof(z_stream))
-      return Z_VERSION_ERROR;
-
-  /* initialize state */
-  if (z == Z_NULL)
-    return Z_STREAM_ERROR;
-  z->msg = Z_NULL;
-  if (z->zalloc == Z_NULL)
-  {
-    z->zalloc = zcalloc;
-    z->opaque = (voidpf)0;
-  }
-  if (z->zfree == Z_NULL) z->zfree = zcfree;
-  if ((z->state = (struct internal_state FAR *)
-       ZALLOC(z,1,sizeof(struct internal_state))) == Z_NULL)
-    return Z_MEM_ERROR;
-  z->state->blocks = Z_NULL;
-
-  /* handle undocumented nowrap option (no zlib header or check) */
-  z->state->nowrap = 0;
-  if (w < 0)
-  {
-    w = - w;
-    z->state->nowrap = 1;
-  }
-
-  /* set window size */
-  if (w < 8 || w > 15)
-  {
-    inflateEnd(z);
-    return Z_STREAM_ERROR;
-  }
-  z->state->wbits = (uInt)w;
-
-  /* create inflate_blocks state */
-  if ((z->state->blocks =
-      inflate_blocks_new(z, z->state->nowrap ? Z_NULL : adler32, (uInt)1 << w))
-      == Z_NULL)
-  {
-    inflateEnd(z);
-    return Z_MEM_ERROR;
-  }
-  Tracev((stderr, "inflate: allocated\n"));
-
-  /* reset state */
-  inflateReset(z);
-  return Z_OK;
-}
-
-
-
-#undef  NEEDBYTE
-#define NEEDBYTE {if(z->avail_in==0)return r;r=f;}
-
-#undef  NEXTBYTE
-#define NEXTBYTE (z->avail_in--,z->total_in++,*z->next_in++)
-
-
-ZEXPORT(int) inflate( /* z, f) */
-z_streamp z,
-int f )
-{
-  int r;
-  uInt b;
-
-  if (z == Z_NULL || z->state == Z_NULL || z->next_in == Z_NULL)
-    return Z_STREAM_ERROR;
-  f = f == Z_FINISH ? Z_BUF_ERROR : Z_OK;
-  r = Z_BUF_ERROR;
-  while (1) switch (z->state->mode)
-  {
-    case METHOD:
-      NEEDBYTE
-      if (((z->state->sub.method = NEXTBYTE) & 0xf) != Z_DEFLATED)
-      {
-        z->state->mode = BAD;
-        z->msg = (char*)"unknown compression method";
-        z->state->sub.marker = 5;       /* can't try inflateSync */
-        break;
-      }
-      if ((z->state->sub.method >> 4) + 8 > z->state->wbits)
-      {
-        z->state->mode = BAD;
-        z->msg = (char*)"invalid window size";
-        z->state->sub.marker = 5;       /* can't try inflateSync */
-        break;
-      }
-      z->state->mode = FLAG;
-    case FLAG:
-      NEEDBYTE
-      b = NEXTBYTE;
-      if (((z->state->sub.method << 8) + b) % 31)
-      {
-        z->state->mode = BAD;
-        z->msg = (char*)"incorrect header check";
-        z->state->sub.marker = 5;       /* can't try inflateSync */
-        break;
-      }
-      Tracev((stderr, "inflate: zlib header ok\n"));
-      if (!(b & PRESET_DICT))
-      {
-        z->state->mode = BLOCKS;
-        break;
-      }
-      z->state->mode = DICT4;
-    case DICT4:
-      NEEDBYTE
-      z->state->sub.check.need = (uLong)NEXTBYTE << 24;
-      z->state->mode = DICT3;
-    case DICT3:
-      NEEDBYTE
-      z->state->sub.check.need += (uLong)NEXTBYTE << 16;
-      z->state->mode = DICT2;
-    case DICT2:
-      NEEDBYTE
-      z->state->sub.check.need += (uLong)NEXTBYTE << 8;
-      z->state->mode = DICT1;
-    case DICT1:
-      NEEDBYTE
-      z->state->sub.check.need += (uLong)NEXTBYTE;
-      z->adler = z->state->sub.check.need;
-      z->state->mode = DICT0;
-      return Z_NEED_DICT;
-    case DICT0:
-      z->state->mode = BAD;
-      z->msg = (char*)"need dictionary";
-      z->state->sub.marker = 0;       /* can try inflateSync */
-      return Z_STREAM_ERROR;
-    case BLOCKS:
-      r = inflate_blocks(z->state->blocks, z, r);
-      if (r == Z_DATA_ERROR)
-      {
-        z->state->mode = BAD;
-        z->state->sub.marker = 0;       /* can try inflateSync */
-        break;
-      }
-      if (r == Z_OK)
-        r = f;
-      if (r != Z_STREAM_END)
-        return r;
-      r = f;
-      inflate_blocks_reset(z->state->blocks, z, &z->state->sub.check.was);
-      if (z->state->nowrap)
-      {
-        z->state->mode = DONE;
-        break;
-      }
-      z->state->mode = CHECK4;
-    case CHECK4:
-      NEEDBYTE
-      z->state->sub.check.need = (uLong)NEXTBYTE << 24;
-      z->state->mode = CHECK3;
-    case CHECK3:
-      NEEDBYTE
-      z->state->sub.check.need += (uLong)NEXTBYTE << 16;
-      z->state->mode = CHECK2;
-    case CHECK2:
-      NEEDBYTE
-      z->state->sub.check.need += (uLong)NEXTBYTE << 8;
-      z->state->mode = CHECK1;
-    case CHECK1:
-      NEEDBYTE
-      z->state->sub.check.need += (uLong)NEXTBYTE;
-
-      if (z->state->sub.check.was != z->state->sub.check.need)
-      {
-        z->state->mode = BAD;
-        z->msg = (char*)"incorrect data check";
-        z->state->sub.marker = 5;       /* can't try inflateSync */
-        break;
-      }
-      Tracev((stderr, "inflate: zlib check ok\n"));
-      z->state->mode = DONE;
-    case DONE:
-      return Z_STREAM_END;
-    case BAD:
-      return Z_DATA_ERROR;
-    default:
-      return Z_STREAM_ERROR;
-  }
-#ifdef NEED_DUMMY_RETURN
-  return Z_STREAM_ERROR;  /* Some dumb compilers complain without this */
-#endif
-}
-

+ 0 - 460
sys/src/libfreetype/src/gzip/inftrees.c

@@ -1,460 +0,0 @@
-/* inftrees.c -- generate Huffman trees for efficient decoding
- * Copyright (C) 1995-2002 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include "zutil.h"
-#include "inftrees.h"
-
-#if !defined(BUILDFIXED) && !defined(STDC)
-#  define BUILDFIXED   /* non ANSI compilers may not accept inffixed.h */
-#endif
-
-
-#if 0
-local const char inflate_copyright[] =
-   " inflate 1.1.4 Copyright 1995-2002 Mark Adler ";
-#endif
-/*
-  If you use the zlib library in a product, an acknowledgment is welcome
-  in the documentation of your product. If for some reason you cannot
-  include such an acknowledgment, I would appreciate that you keep this
-  copyright string in the executable of your product.
- */
-
-/* simplify the use of the inflate_huft type with some defines */
-#define exop word.what.Exop
-#define bits word.what.Bits
-
-
-local int huft_build OF((
-    uIntf *,            /* code lengths in bits */
-    uInt,               /* number of codes */
-    uInt,               /* number of "simple" codes */
-    const uIntf *,      /* list of base values for non-simple codes */
-    const uIntf *,      /* list of extra bits for non-simple codes */
-    inflate_huft * FAR*,/* result: starting table */
-    uIntf *,            /* maximum lookup bits (returns actual) */
-    inflate_huft *,     /* space for trees */
-    uInt *,             /* hufts used in space */
-    uIntf * ));         /* space for values */
-
-/* Tables for deflate from PKZIP's appnote.txt. */
-local const uInt cplens[31] = { /* Copy lengths for literal codes 257..285 */
-        3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
-        35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
-        /* see note #13 above about 258 */
-local const uInt cplext[31] = { /* Extra bits for literal codes 257..285 */
-        0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
-        3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 112, 112}; /* 112==invalid */
-local const uInt cpdist[30] = { /* Copy offsets for distance codes 0..29 */
-        1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
-        257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
-        8193, 12289, 16385, 24577};
-local const uInt cpdext[30] = { /* Extra bits for distance codes */
-        0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
-        7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
-        12, 12, 13, 13};
-
-/*
-   Huffman code decoding is performed using a multi-level table lookup.
-   The fastest way to decode is to simply build a lookup table whose
-   size is determined by the longest code.  However, the time it takes
-   to build this table can also be a factor if the data being decoded
-   is not very long.  The most common codes are necessarily the
-   shortest codes, so those codes dominate the decoding time, and hence
-   the speed.  The idea is you can have a shorter table that decodes the
-   shorter, more probable codes, and then point to subsidiary tables for
-   the longer codes.  The time it costs to decode the longer codes is
-   then traded against the time it takes to make longer tables.
-
-   This results of this trade are in the variables lbits and dbits
-   below.  lbits is the number of bits the first level table for literal/
-   length codes can decode in one step, and dbits is the same thing for
-   the distance codes.  Subsequent tables are also less than or equal to
-   those sizes.  These values may be adjusted either when all of the
-   codes are shorter than that, in which case the longest code length in
-   bits is used, or when the shortest code is *longer* than the requested
-   table size, in which case the length of the shortest code in bits is
-   used.
-
-   There are two different values for the two tables, since they code a
-   different number of possibilities each.  The literal/length table
-   codes 286 possible values, or in a flat code, a little over eight
-   bits.  The distance table codes 30 possible values, or a little less
-   than five bits, flat.  The optimum values for speed end up being
-   about one bit more than those, so lbits is 8+1 and dbits is 5+1.
-   The optimum values may differ though from machine to machine, and
-   possibly even between compilers.  Your mileage may vary.
- */
-
-
-/* If BMAX needs to be larger than 16, then h and x[] should be uLong. */
-#define BMAX 15         /* maximum bit length of any code */
-
-local int huft_build( /* b, n, s, d, e, t, m, hp, hn, v) */
-uIntf *b,               /* code lengths in bits (all assumed <= BMAX) */
-uInt n,                 /* number of codes (assumed <= 288) */
-uInt s,                 /* number of simple-valued codes (0..s-1) */
-const uIntf *d,         /* list of base values for non-simple codes */
-const uIntf *e,         /* list of extra bits for non-simple codes */
-inflate_huft * FAR *t,  /* result: starting table */
-uIntf *m,               /* maximum lookup bits, returns actual */
-inflate_huft *hp,       /* space for trees */
-uInt *hn,               /* hufts used in space */
-uIntf *v                /* working area: values in order of bit length */
-/* Given a list of code lengths and a maximum table size, make a set of
-   tables to decode that set of codes.  Return Z_OK on success, Z_BUF_ERROR
-   if the given code set is incomplete (the tables are still built in this
-   case), or Z_DATA_ERROR if the input is invalid. */
-)
-{
-
-  uInt a;                       /* counter for codes of length k */
-  uInt c[BMAX+1];               /* bit length count table */
-  uInt f;                       /* i repeats in table every f entries */
-  int g;                        /* maximum code length */
-  int h;                        /* table level */
-  register uInt i;              /* counter, current code */
-  register uInt j;              /* counter */
-  register int k;               /* number of bits in current code */
-  int l;                        /* bits per table (returned in m) */
-  uInt mask;                    /* (1 << w) - 1, to avoid cc -O bug on HP */
-  register uIntf *p;            /* pointer into c[], b[], or v[] */
-  inflate_huft *q;              /* points to current table */
-  struct inflate_huft_s r;      /* table entry for structure assignment */
-  inflate_huft *u[BMAX];        /* table stack */
-  register int w;               /* bits before this table == (l * h) */
-  uInt x[BMAX+1];               /* bit offsets, then code stack */
-  uIntf *xp;                    /* pointer into x */
-  int y;                        /* number of dummy codes added */
-  uInt z;                       /* number of entries in current table */
-
-
-  /* Generate counts for each bit length */
-  p = c;
-#define C0 *p++ = 0;
-#define C2 C0 C0 C0 C0
-#define C4 C2 C2 C2 C2
-  C4                            /* clear c[]--assume BMAX+1 is 16 */
-  p = b;  i = n;
-  do {
-    c[*p++]++;                  /* assume all entries <= BMAX */
-  } while (--i);
-  if (c[0] == n)                /* null input--all zero length codes */
-  {
-    *t = (inflate_huft *)Z_NULL;
-    *m = 0;
-    return Z_OK;
-  }
-
-
-  /* Find minimum and maximum length, bound *m by those */
-  l = *m;
-  for (j = 1; j <= BMAX; j++)
-    if (c[j])
-      break;
-  k = j;                        /* minimum code length */
-  if ((uInt)l < j)
-    l = j;
-  for (i = BMAX; i; i--)
-    if (c[i])
-      break;
-  g = i;                        /* maximum code length */
-  if ((uInt)l > i)
-    l = i;
-  *m = l;
-
-
-  /* Adjust last length count to fill out codes, if needed */
-  for (y = 1 << j; j < i; j++, y <<= 1)
-    if ((y -= c[j]) < 0)
-      return Z_DATA_ERROR;
-  if ((y -= c[i]) < 0)
-    return Z_DATA_ERROR;
-  c[i] += y;
-
-
-  /* Generate starting offsets into the value table for each length */
-  x[1] = j = 0;
-  p = c + 1;  xp = x + 2;
-  while (--i) {                 /* note that i == g from above */
-    *xp++ = (j += *p++);
-  }
-
-
-  /* Make a table of values in order of bit lengths */
-  p = b;  i = 0;
-  do {
-    if ((j = *p++) != 0)
-      v[x[j]++] = i;
-  } while (++i < n);
-  n = x[g];                     /* set n to length of v */
-
-
-  /* Generate the Huffman codes and for each, make the table entries */
-  x[0] = i = 0;                 /* first Huffman code is zero */
-  p = v;                        /* grab values in bit order */
-  h = -1;                       /* no tables yet--level -1 */
-  w = -l;                       /* bits decoded == (l * h) */
-  u[0] = (inflate_huft *)Z_NULL;        /* just to keep compilers happy */
-  q = (inflate_huft *)Z_NULL;   /* ditto */
-  z = 0;                        /* ditto */
-
-  /* go through the bit lengths (k already is bits in shortest code) */
-  for (; k <= g; k++)
-  {
-    a = c[k];
-    while (a--)
-    {
-      /* here i is the Huffman code of length k bits for value *p */
-      /* make tables up to required level */
-      while (k > w + l)
-      {
-        h++;
-        w += l;                 /* previous table always l bits */
-
-        /* compute minimum size table less than or equal to l bits */
-        z = g - w;
-        z = z > (uInt)l ? (uInt)l : z;        /* table size upper limit */
-        if ((f = 1 << (j = k - w)) > a + 1)     /* try a k-w bit table */
-        {                       /* too few codes for k-w bit table */
-          f -= a + 1;           /* deduct codes from patterns left */
-          xp = c + k;
-          if (j < z)
-            while (++j < z)     /* try smaller tables up to z bits */
-            {
-              if ((f <<= 1) <= *++xp)
-                break;          /* enough codes to use up j bits */
-              f -= *xp;         /* else deduct codes from patterns */
-            }
-        }
-        z = 1 << j;             /* table entries for j-bit table */
-
-        /* allocate new table */
-        if (*hn + z > MANY)     /* (note: doesn't matter for fixed) */
-          return Z_DATA_ERROR;  /* overflow of MANY */
-        u[h] = q = hp + *hn;
-        *hn += z;
-
-        /* connect to last table, if there is one */
-        if (h)
-        {
-          x[h] = i;             /* save pattern for backing up */
-          r.bits = (Byte)l;     /* bits to dump before this table */
-          r.exop = (Byte)j;     /* bits in this table */
-          j = i >> (w - l);
-          r.base = (uInt)(q - u[h-1] - j);   /* offset to this table */
-          u[h-1][j] = r;        /* connect to last table */
-        }
-        else
-          *t = q;               /* first table is returned result */
-      }
-
-      /* set up table entry in r */
-      r.bits = (Byte)(k - w);
-      if (p >= v + n)
-        r.exop = 128 + 64;      /* out of values--invalid code */
-      else if (*p < s)
-      {
-        r.exop = (Byte)(*p < 256 ? 0 : 32 + 64);     /* 256 is end-of-block */
-        r.base = *p++;          /* simple code is just the value */
-      }
-      else
-      {
-        r.exop = (Byte)(e[*p - s] + 16 + 64);/* non-simple--look up in lists */
-        r.base = d[*p++ - s];
-      }
-
-      /* fill code-like entries with r */
-      f = 1 << (k - w);
-      for (j = i >> w; j < z; j += f)
-        q[j] = r;
-
-      /* backwards increment the k-bit code i */
-      for (j = 1 << (k - 1); i & j; j >>= 1)
-        i ^= j;
-      i ^= j;
-
-      /* backup over finished tables */
-      mask = (1 << w) - 1;      /* needed on HP, cc -O bug */
-      while ((i & mask) != x[h])
-      {
-        h--;                    /* don't need to update q */
-        w -= l;
-        mask = (1 << w) - 1;
-      }
-    }
-  }
-
-
-  /* Return Z_BUF_ERROR if we were given an incomplete table */
-  return y != 0 && g != 1 ? Z_BUF_ERROR : Z_OK;
-}
-
-
-local int inflate_trees_bits( /* c, bb, tb, hp, z) */
-uIntf *c,               /* 19 code lengths */
-uIntf *bb,              /* bits tree desired/actual depth */
-inflate_huft * FAR *tb, /* bits tree result */
-inflate_huft *hp,       /* space for trees */
-z_streamp z             /* for messages */
-)
-{
-  int r;
-  uInt hn = 0;          /* hufts used in space */
-  uIntf *v;             /* work area for huft_build */
-
-  if ((v = (uIntf*)ZALLOC(z, 19, sizeof(uInt))) == Z_NULL)
-    return Z_MEM_ERROR;
-  r = huft_build(c, 19, 19, (uIntf*)Z_NULL, (uIntf*)Z_NULL,
-                 tb, bb, hp, &hn, v);
-  if (r == Z_DATA_ERROR)
-    z->msg = (char*)"oversubscribed dynamic bit lengths tree";
-  else if (r == Z_BUF_ERROR || *bb == 0)
-  {
-    z->msg = (char*)"incomplete dynamic bit lengths tree";
-    r = Z_DATA_ERROR;
-  }
-  ZFREE(z, v);
-  return r;
-}
-
-
-local int inflate_trees_dynamic( /* nl, nd, c, bl, bd, tl, td, hp, z) */
-uInt nl,                /* number of literal/length codes */
-uInt nd,                /* number of distance codes */
-uIntf *c,               /* that many (total) code lengths */
-uIntf *bl,              /* literal desired/actual bit depth */
-uIntf *bd,              /* distance desired/actual bit depth */
-inflate_huft * FAR *tl, /* literal/length tree result */
-inflate_huft * FAR *td, /* distance tree result */
-inflate_huft *hp,       /* space for trees */
-z_streamp z             /* for messages */
-)
-{
-  int r;
-  uInt hn = 0;          /* hufts used in space */
-  uIntf *v;             /* work area for huft_build */
-
-  /* allocate work area */
-  if ((v = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL)
-    return Z_MEM_ERROR;
-
-  /* build literal/length tree */
-  r = huft_build(c, nl, 257, cplens, cplext, tl, bl, hp, &hn, v);
-  if (r != Z_OK || *bl == 0)
-  {
-    if (r == Z_DATA_ERROR)
-      z->msg = (char*)"oversubscribed literal/length tree";
-    else if (r != Z_MEM_ERROR)
-    {
-      z->msg = (char*)"incomplete literal/length tree";
-      r = Z_DATA_ERROR;
-    }
-    ZFREE(z, v);
-    return r;
-  }
-
-  /* build distance tree */
-  r = huft_build(c + nl, nd, 0, cpdist, cpdext, td, bd, hp, &hn, v);
-  if (r != Z_OK || (*bd == 0 && nl > 257))
-  {
-    if (r == Z_DATA_ERROR)
-      z->msg = (char*)"oversubscribed distance tree";
-    else if (r == Z_BUF_ERROR) {
-#ifdef PKZIP_BUG_WORKAROUND
-      r = Z_OK;
-    }
-#else
-      z->msg = (char*)"incomplete distance tree";
-      r = Z_DATA_ERROR;
-    }
-    else if (r != Z_MEM_ERROR)
-    {
-      z->msg = (char*)"empty distance tree with lengths";
-      r = Z_DATA_ERROR;
-    }
-    ZFREE(z, v);
-    return r;
-#endif
-  }
-
-  /* done */
-  ZFREE(z, v);
-  return Z_OK;
-}
-
-
-/* build fixed tables only once--keep them here */
-#ifdef BUILDFIXED
-local int fixed_built = 0;
-#define FIXEDH 544      /* number of hufts used by fixed tables */
-local inflate_huft fixed_mem[FIXEDH];
-local uInt fixed_bl;
-local uInt fixed_bd;
-local inflate_huft *fixed_tl;
-local inflate_huft *fixed_td;
-#else
-#include "inffixed.h"
-#endif
-
-
-local int inflate_trees_fixed( /* bl, bd, tl, td, z) */
-uIntf *bl,               /* literal desired/actual bit depth */
-uIntf *bd,               /* distance desired/actual bit depth */
-inflate_huft * FAR *tl,  /* literal/length tree result */
-inflate_huft * FAR *td,  /* distance tree result */
-z_streamp z              /* for memory allocation */
-)
-{
-#ifdef BUILDFIXED
-  /* build fixed tables if not already */
-  if (!fixed_built)
-  {
-    int k;              /* temporary variable */
-    uInt f = 0;         /* number of hufts used in fixed_mem */
-    uIntf *c;           /* length list for huft_build */
-    uIntf *v;           /* work area for huft_build */
-
-    /* allocate memory */
-    if ((c = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL)
-      return Z_MEM_ERROR;
-    if ((v = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL)
-    {
-      ZFREE(z, c);
-      return Z_MEM_ERROR;
-    }
-
-    /* literal table */
-    for (k = 0; k < 144; k++)
-      c[k] = 8;
-    for (; k < 256; k++)
-      c[k] = 9;
-    for (; k < 280; k++)
-      c[k] = 7;
-    for (; k < 288; k++)
-      c[k] = 8;
-    fixed_bl = 9;
-    huft_build(c, 288, 257, cplens, cplext, &fixed_tl, &fixed_bl,
-               fixed_mem, &f, v);
-
-    /* distance table */
-    for (k = 0; k < 30; k++)
-      c[k] = 5;
-    fixed_bd = 5;
-    huft_build(c, 30, 0, cpdist, cpdext, &fixed_td, &fixed_bd,
-               fixed_mem, &f, v);
-
-    /* done */
-    ZFREE(z, v);
-    ZFREE(z, c);
-    fixed_built = 1;
-  }
-#endif
-  *bl = fixed_bl;
-  *bd = fixed_bd;
-  *tl = fixed_tl;
-  *td = fixed_td;
-  return Z_OK;
-}

+ 0 - 63
sys/src/libfreetype/src/gzip/inftrees.h

@@ -1,63 +0,0 @@
-/* inftrees.h -- header to use inftrees.c
- * Copyright (C) 1995-2002 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
-   part of the implementation of the compression library and is
-   subject to change. Applications should only use zlib.h.
- */
-
-/* Huffman code lookup table entry--this entry is four bytes for machines
-   that have 16-bit pointers (e.g. PC's in the small or medium model). */
-
-#ifndef _INFTREES_H
-#define _INFTREES_H
-
-typedef struct inflate_huft_s FAR inflate_huft;
-
-struct inflate_huft_s {
-  union {
-    struct {
-      Byte Exop;        /* number of extra bits or operation */
-      Byte Bits;        /* number of bits in this code or subcode */
-    } what;
-    uInt pad;           /* pad structure to a power of 2 (4 bytes for */
-  } word;               /*  16-bit, 8 bytes for 32-bit int's) */
-  uInt base;            /* literal, length base, distance base,
-                           or table offset */
-};
-
-/* Maximum size of dynamic tree.  The maximum found in a long but non-
-   exhaustive search was 1004 huft structures (850 for length/literals
-   and 154 for distances, the latter actually the result of an
-   exhaustive search).  The actual maximum is not known, but the
-   value below is more than safe. */
-#define MANY 1440
-
-local  int inflate_trees_bits OF((
-    uIntf *,                    /* 19 code lengths */
-    uIntf *,                    /* bits tree desired/actual depth */
-    inflate_huft * FAR *,       /* bits tree result */
-    inflate_huft *,             /* space for trees */
-    z_streamp));                /* for messages */
-
-local  int inflate_trees_dynamic OF((
-    uInt,                       /* number of literal/length codes */
-    uInt,                       /* number of distance codes */
-    uIntf *,                    /* that many (total) code lengths */
-    uIntf *,                    /* literal desired/actual bit depth */
-    uIntf *,                    /* distance desired/actual bit depth */
-    inflate_huft * FAR *,       /* literal/length tree result */
-    inflate_huft * FAR *,       /* distance tree result */
-    inflate_huft *,             /* space for trees */
-    z_streamp));                /* for messages */
-
-local  int inflate_trees_fixed OF((
-    uIntf *,                    /* literal desired/actual bit depth */
-    uIntf *,                    /* distance desired/actual bit depth */
-    inflate_huft * FAR *,       /* literal/length tree result */
-    inflate_huft * FAR *,       /* distance tree result */
-    z_streamp));                /* for memory allocation */
-
-#endif /* _INFTREES_H */

+ 0 - 86
sys/src/libfreetype/src/gzip/infutil.c

@@ -1,86 +0,0 @@
-/* inflate_util.c -- data and routines common to blocks and codes
- * Copyright (C) 1995-2002 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include "zutil.h"
-#include "infblock.h"
-#include "inftrees.h"
-#include "infcodes.h"
-#include "infutil.h"
-
-
-/* And'ing with mask[n] masks the lower n bits */
-local uInt inflate_mask[17] = {
-    0x0000,
-    0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
-    0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
-};
-
-
-/* copy as much as possible from the sliding window to the output area */
-local int inflate_flush( /* s, z, r) */
-inflate_blocks_statef *s,
-z_streamp z,
-int r )
-{
-  uInt n;
-  Bytef *p;
-  Bytef *q;
-
-  /* local copies of source and destination pointers */
-  p = z->next_out;
-  q = s->read;
-
-  /* compute number of bytes to copy as far as end of window */
-  n = (uInt)((q <= s->write ? s->write : s->end) - q);
-  if (n > z->avail_out) n = z->avail_out;
-  if (n && r == Z_BUF_ERROR) r = Z_OK;
-
-  /* update counters */
-  z->avail_out -= n;
-  z->total_out += n;
-
-  /* update check information */
-  if (s->checkfn != Z_NULL)
-    z->adler = s->check = (*s->checkfn)(s->check, q, n);
-
-  /* copy as far as end of window */
-  zmemcpy(p, q, n);
-  p += n;
-  q += n;
-
-  /* see if more to copy at beginning of window */
-  if (q == s->end)
-  {
-    /* wrap pointers */
-    q = s->window;
-    if (s->write == s->end)
-      s->write = s->window;
-
-    /* compute bytes to copy */
-    n = (uInt)(s->write - q);
-    if (n > z->avail_out) n = z->avail_out;
-    if (n && r == Z_BUF_ERROR) r = Z_OK;
-
-    /* update counters */
-    z->avail_out -= n;
-    z->total_out += n;
-
-    /* update check information */
-    if (s->checkfn != Z_NULL)
-      z->adler = s->check = (*s->checkfn)(s->check, q, n);
-
-    /* copy */
-    zmemcpy(p, q, n);
-    p += n;
-    q += n;
-  }
-
-  /* update pointers */
-  z->next_out = p;
-  s->read = q;
-
-  /* done */
-  return r;
-}

+ 0 - 96
sys/src/libfreetype/src/gzip/infutil.h

@@ -1,96 +0,0 @@
-/* infutil.h -- types and macros common to blocks and codes
- * Copyright (C) 1995-2002 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
-   part of the implementation of the compression library and is
-   subject to change. Applications should only use zlib.h.
- */
-
-#ifndef _INFUTIL_H
-#define _INFUTIL_H
-
-typedef enum {
-      TYPE,     /* get type bits (3, including end bit) */
-      LENS,     /* get lengths for stored */
-      STORED,   /* processing stored block */
-      TABLE,    /* get table lengths */
-      BTREE,    /* get bit lengths tree for a dynamic block */
-      DTREE,    /* get length, distance trees for a dynamic block */
-      CODES,    /* processing fixed or dynamic block */
-      DRY,      /* output remaining window bytes */
-      DONE,     /* finished last block, done */
-      BAD}      /* got a data error--stuck here */
-inflate_block_mode;
-
-/* inflate blocks semi-private state */
-struct inflate_blocks_state {
-
-  /* mode */
-  inflate_block_mode  mode;     /* current inflate_block mode */
-
-  /* mode dependent information */
-  union {
-    uInt left;          /* if STORED, bytes left to copy */
-    struct {
-      uInt table;               /* table lengths (14 bits) */
-      uInt index;               /* index into blens (or border) */
-      uIntf *blens;             /* bit lengths of codes */
-      uInt bb;                  /* bit length tree depth */
-      inflate_huft *tb;         /* bit length decoding tree */
-    } trees;            /* if DTREE, decoding info for trees */
-    struct {
-      inflate_codes_statef
-         *codes;
-    } decode;           /* if CODES, current state */
-  } sub;                /* submode */
-  uInt last;            /* true if this block is the last block */
-
-  /* mode independent information */
-  uInt bitk;            /* bits in bit buffer */
-  uLong bitb;           /* bit buffer */
-  inflate_huft *hufts;  /* single malloc for tree space */
-  Bytef *window;        /* sliding window */
-  Bytef *end;           /* one byte after sliding window */
-  Bytef *read;          /* window read pointer */
-  Bytef *write;         /* window write pointer */
-  check_func checkfn;   /* check function */
-  uLong check;          /* check on output */
-
-};
-
-
-/* defines for inflate input/output */
-/*   update pointers and return */
-#define UPDBITS {s->bitb=b;s->bitk=k;}
-#define UPDIN {z->avail_in=n;z->total_in+=p-z->next_in;z->next_in=p;}
-#define UPDOUT {s->write=q;}
-#define UPDATE {UPDBITS UPDIN UPDOUT}
-#define LEAVE {UPDATE return inflate_flush(s,z,r);}
-/*   get bytes and bits */
-#define LOADIN {p=z->next_in;n=z->avail_in;b=s->bitb;k=s->bitk;}
-#define NEEDBYTE {if(n)r=Z_OK;else LEAVE}
-#define NEXTBYTE (n--,*p++)
-#define NEEDBITS(j) {while(k<(j)){NEEDBYTE;b|=((uLong)NEXTBYTE)<<k;k+=8;}}
-#define DUMPBITS(j) {b>>=(j);k-=(j);}
-/*   output bytes */
-#define WAVAIL (uInt)(q<s->read?s->read-q-1:s->end-q)
-#define LOADOUT {q=s->write;m=(uInt)WAVAIL;}
-#define WRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=(uInt)WAVAIL;}}
-#define FLUSH {UPDOUT r=inflate_flush(s,z,r); LOADOUT}
-#define NEEDOUT {if(m==0){WRAP if(m==0){FLUSH WRAP if(m==0) LEAVE}}r=Z_OK;}
-#define OUTBYTE(a) {*q++=(Byte)(a);m--;}
-/*   load local pointers */
-#define LOAD {LOADIN LOADOUT}
-
-/* masks for lower bits (size given to avoid silly warnings with Visual C++) */
-local uInt inflate_mask[17];
-
-/* copy as much as possible from the sliding window to the output area */
-local int inflate_flush OF((
-    inflate_blocks_statef *,
-    z_streamp ,
-    int));
-
-#endif

+ 0 - 74
sys/src/libfreetype/src/gzip/rules.mk

@@ -1,74 +0,0 @@
-#
-# FreeType 2 GZip support configuration rules
-#
-
-
-# Copyright 2002 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-
-# gzip driver directory
-#
-GZIP_DIR  := $(SRC_)gzip
-GZIP_DIR_ := $(GZIP_DIR)$(SEP)
-
-
-# compilation flags for the driver
-#
-ifeq ($(SYSTEM_ZLIB),)
-  GZIP_COMPILE := $(FT_COMPILE) $I$(GZIP_DIR)
-else
-  GZIP_COMPILE := $(FT_COMPILE)
-endif
-
-
-# gzip support sources (i.e., C files)
-#
-GZIP_DRV_SRC := $(GZIP_DIR_)ftgzip.c
-
-# gzip support headers
-#
-GZIP_DRV_H :=
-
-
-# gzip driver object(s)
-#
-#   GZIP_DRV_OBJ_M is used during `multi' builds
-#   GZIP_DRV_OBJ_S is used during `single' builds
-#
-ifeq ($(SYSTEM_ZLIB),)
-  GZIP_DRV_OBJ_M := $(GZIP_DRV_SRC:$(GZIP_DIR_)%.c=$(OBJ_)%.$O)
-else
-  GZIP_DRV_OBJ_M := $(OBJ_)ftgzip.$O
-endif
-GZIP_DRV_OBJ_S := $(OBJ_)ftgzip.$O
-
-# gzip support source file for single build
-#
-GZIP_DRV_SRC_S := $(GZIP_DIR_)ftgzip.c
-
-
-# gzip support - single object
-#
-$(GZIP_DRV_OBJ_S): $(GZIP_DRV_SRC_S) $(GZIP_DRV_SRC) $(FREETYPE_H) $(GZIP_DRV_H)
-	$(GZIP_COMPILE) $T$@ $(GZIP_DRV_SRC_S)
-
-
-# gzip support - multiple objects
-#
-$(OBJ_)%.$O: $(GZIP_DIR_)%.c $(FREETYPE_H) $(GZIP_DRV_H)
-	$(GZIP_COMPILE) $T$@ $<
-
-
-# update main driver object lists
-#
-DRV_OBJS_S += $(GZIP_DRV_OBJ_S)
-DRV_OBJS_M += $(GZIP_DRV_OBJ_M)
-
-# EOF

+ 0 - 278
sys/src/libfreetype/src/gzip/zconf.h

@@ -1,278 +0,0 @@
-/* zconf.h -- configuration of the zlib compression library
- * Copyright (C) 1995-2002 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id: zconf.h,v 1.3 2002/12/26 20:50:40 davidT Exp $ */
-
-#ifndef _ZCONF_H
-#define _ZCONF_H
-
-/*
- * If you *really* need a unique prefix for all types and library functions,
- * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
- */
-#ifdef Z_PREFIX
-#  define deflateInit_	z_deflateInit_
-#  define deflate	z_deflate
-#  define deflateEnd	z_deflateEnd
-#  define inflateInit_ 	z_inflateInit_
-#  define inflate	z_inflate
-#  define inflateEnd	z_inflateEnd
-#  define deflateInit2_	z_deflateInit2_
-#  define deflateSetDictionary z_deflateSetDictionary
-#  define deflateCopy	z_deflateCopy
-#  define deflateReset	z_deflateReset
-#  define deflateParams	z_deflateParams
-#  define inflateInit2_	z_inflateInit2_
-#  define inflateSetDictionary z_inflateSetDictionary
-#  define inflateSync	z_inflateSync
-#  define inflateSyncPoint z_inflateSyncPoint
-#  define inflateReset	z_inflateReset
-#  define compress	z_compress
-#  define compress2	z_compress2
-#  define uncompress	z_uncompress
-#  define adler32	z_adler32
-#  define crc32		z_crc32
-#  define get_crc_table z_get_crc_table
-
-#  define Byte		z_Byte
-#  define uInt		z_uInt
-#  define uLong		z_uLong
-#  define Bytef	        z_Bytef
-#  define charf		z_charf
-#  define intf		z_intf
-#  define uIntf		z_uIntf
-#  define uLongf	z_uLongf
-#  define voidpf	z_voidpf
-#  define voidp		z_voidp
-#endif
-
-#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
-#  define WIN32
-#endif
-#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386)
-#  ifndef __32BIT__
-#    define __32BIT__
-#  endif
-#endif
-#if defined(__MSDOS__) && !defined(MSDOS)
-#  define MSDOS
-#endif
-
-/*
- * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
- * than 64k bytes at a time (needed on systems with 16-bit int).
- */
-#if defined(MSDOS) && !defined(__32BIT__)
-#  define MAXSEG_64K
-#endif
-#ifdef MSDOS
-#  define UNALIGNED_OK
-#endif
-
-#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32))  && !defined(STDC)
-#  define STDC
-#endif
-#if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__)
-#  ifndef STDC
-#    define STDC
-#  endif
-#endif
-
-#ifndef STDC
-#  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
-#    define const
-#  endif
-#endif
-
-/* Some Mac compilers merge all .h files incorrectly: */
-#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__)
-#  define NO_DUMMY_DECL
-#endif
-
-/* Old Borland C and LCC incorrectly complains about missing returns: */
-#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
-#  define NEED_DUMMY_RETURN
-#endif
-
-#if defined(__LCC__)
-#  define  NEED_DUMMY_RETURN
-#endif
-
-/* Maximum value for memLevel in deflateInit2 */
-#ifndef MAX_MEM_LEVEL
-#  ifdef MAXSEG_64K
-#    define MAX_MEM_LEVEL 8
-#  else
-#    define MAX_MEM_LEVEL 9
-#  endif
-#endif
-
-/* Maximum value for windowBits in deflateInit2 and inflateInit2.
- * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
- * created by gzip. (Files created by minigzip can still be extracted by
- * gzip.)
- */
-#ifndef MAX_WBITS
-#  define MAX_WBITS   15 /* 32K LZ77 window */
-#endif
-
-/* The memory requirements for deflate are (in bytes):
-            (1 << (windowBits+2)) +  (1 << (memLevel+9))
- that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
- plus a few kilobytes for small objects. For example, if you want to reduce
- the default memory requirements from 256K to 128K, compile with
-     make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
- Of course this will generally degrade compression (there's no free lunch).
-
-   The memory requirements for inflate are (in bytes) 1 << windowBits
- that is, 32K for windowBits=15 (default value) plus a few kilobytes
- for small objects.
-*/
-
-                        /* Type declarations */
-
-#ifndef OF /* function prototypes */
-#  ifdef STDC
-#    define OF(args)  args
-#  else
-#    define OF(args)  ()
-#  endif
-#endif
-
-/* The following definitions for FAR are needed only for MSDOS mixed
- * model programming (small or medium model with some far allocations).
- * This was tested only with MSC; for other MSDOS compilers you may have
- * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
- * just define FAR to be empty.
- */
-#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__)
-   /* MSC small or medium model */
-#  define SMALL_MEDIUM
-#  ifdef _MSC_VER
-#    define FAR _far
-#  else
-#    define FAR far
-#  endif
-#endif
-#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__))
-#  ifndef __32BIT__
-#    define SMALL_MEDIUM
-#    define FAR _far
-#  endif
-#endif
-
-/* Compile with -DZLIB_DLL for Windows DLL support */
-#if defined(ZLIB_DLL)
-#  if defined(_WINDOWS) || defined(WINDOWS)
-#    ifdef FAR
-#      undef FAR
-#    endif
-#    include <windows.h>
-#    define ZEXPORT(x)  x WINAPI
-#    ifdef WIN32
-#      define ZEXPORTVA(x)  x WINAPIV
-#    else
-#      define ZEXPORTVA(x)  x FAR _cdecl _export
-#    endif
-#  endif
-#  if defined (__BORLANDC__)
-#    if (__BORLANDC__ >= 0x0500) && defined (WIN32)
-#      include <windows.h>
-#      define ZEXPORT(x) x __declspec(dllexport) WINAPI
-#      define ZEXPORTRVA(x)  x __declspec(dllexport) WINAPIV
-#    else
-#      if defined (_Windows) && defined (__DLL__)
-#        define ZEXPORT(x) x _export
-#        define ZEXPORTVA(x) x _export
-#      endif
-#    endif
-#  endif
-#endif
-
-
-#ifndef ZEXPORT
-#  define ZEXPORT(x)   static x
-#endif
-#ifndef ZEXPORTVA
-#  define ZEXPORTVA(x)   static x
-#endif
-#ifndef ZEXTERN
-#  define ZEXTERN(x) static x
-#endif
-#ifndef ZEXTERNDEF
-#  define ZEXTERNDEF(x)  static x
-#endif
-
-#ifndef FAR
-#   define FAR
-#endif
-
-#if !defined(MACOS) && !defined(TARGET_OS_MAC)
-typedef unsigned char  Byte;  /* 8 bits */
-#endif
-typedef unsigned int   uInt;  /* 16 bits or more */
-typedef unsigned long  uLong; /* 32 bits or more */
-
-#ifdef SMALL_MEDIUM
-   /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
-#  define Bytef Byte FAR
-#else
-   typedef Byte  FAR Bytef;
-#endif
-typedef char  FAR charf;
-typedef int   FAR intf;
-typedef uInt  FAR uIntf;
-typedef uLong FAR uLongf;
-
-#ifdef STDC
-   typedef void FAR *voidpf;
-   typedef void     *voidp;
-#else
-   typedef Byte FAR *voidpf;
-   typedef Byte     *voidp;
-#endif
-
-#ifdef HAVE_UNISTD_H
-#  include <sys/types.h> /* for off_t */
-#  include <unistd.h>    /* for SEEK_* and off_t */
-#  define z_off_t  off_t
-#endif
-#ifndef SEEK_SET
-#  define SEEK_SET        0       /* Seek from beginning of file.  */
-#  define SEEK_CUR        1       /* Seek from current position.  */
-#  define SEEK_END        2       /* Set file pointer to EOF plus "offset" */
-#endif
-#ifndef z_off_t
-#  define  z_off_t long
-#endif
-
-/* MVS linker does not support external names larger than 8 bytes */
-#if defined(__MVS__)
-#   pragma map(deflateInit_,"DEIN")
-#   pragma map(deflateInit2_,"DEIN2")
-#   pragma map(deflateEnd,"DEEND")
-#   pragma map(inflateInit_,"ININ")
-#   pragma map(inflateInit2_,"ININ2")
-#   pragma map(inflateEnd,"INEND")
-#   pragma map(inflateSync,"INSY")
-#   pragma map(inflateSetDictionary,"INSEDI")
-#   pragma map(inflate_blocks,"INBL")
-#   pragma map(inflate_blocks_new,"INBLNE")
-#   pragma map(inflate_blocks_free,"INBLFR")
-#   pragma map(inflate_blocks_reset,"INBLRE")
-#   pragma map(inflate_codes_free,"INCOFR")
-#   pragma map(inflate_codes,"INCO")
-#   pragma map(inflate_fast,"INFA")
-#   pragma map(inflate_flush,"INFLU")
-#   pragma map(inflate_mask,"INMA")
-#   pragma map(inflate_set_dictionary,"INSEDI2")
-#   pragma map(inflate_copyright,"INCOPY")
-#   pragma map(inflate_trees_bits,"INTRBI")
-#   pragma map(inflate_trees_dynamic,"INTRDY")
-#   pragma map(inflate_trees_fixed,"INTRFI")
-#   pragma map(inflate_trees_free,"INTRFR")
-#endif
-
-#endif /* _ZCONF_H */

+ 0 - 830
sys/src/libfreetype/src/gzip/zlib.h

@@ -1,830 +0,0 @@
-/* zlib.h -- interface of the 'zlib' general purpose compression library
-  version 1.1.4, March 11th, 2002
-
-  Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jean-loup Gailly        Mark Adler
-  jloup@gzip.org          madler@alumni.caltech.edu
-
-
-  The data format used by the zlib library is described by RFCs (Request for
-  Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt
-  (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
-*/
-
-#ifndef _ZLIB_H
-#define _ZLIB_H
-
-#include "zconf.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define ZLIB_VERSION "1.1.4"
-
-/*
-     The 'zlib' compression library provides in-memory compression and
-  decompression functions, including integrity checks of the uncompressed
-  data.  This version of the library supports only one compression method
-  (deflation) but other algorithms will be added later and will have the same
-  stream interface.
-
-     Compression can be done in a single step if the buffers are large
-  enough (for example if an input file is mmap'ed), or can be done by
-  repeated calls of the compression function.  In the latter case, the
-  application must provide more input and/or consume the output
-  (providing more output space) before each call.
-
-     The library also supports reading and writing files in gzip (.gz) format
-  with an interface similar to that of stdio.
-
-     The library does not install any signal handler. The decoder checks
-  the consistency of the compressed data, so the library should never
-  crash even in case of corrupted input.
-*/
-
-typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
-typedef void   (*free_func)  OF((voidpf opaque, voidpf address));
-
-struct internal_state;
-
-typedef struct z_stream_s {
-    Bytef    *next_in;  /* next input byte */
-    uInt     avail_in;  /* number of bytes available at next_in */
-    uLong    total_in;  /* total nb of input bytes read so far */
-
-    Bytef    *next_out; /* next output byte should be put there */
-    uInt     avail_out; /* remaining free space at next_out */
-    uLong    total_out; /* total nb of bytes output so far */
-
-    char     *msg;      /* last error message, NULL if no error */
-    struct internal_state FAR *state; /* not visible by applications */
-
-    alloc_func zalloc;  /* used to allocate the internal state */
-    free_func  zfree;   /* used to free the internal state */
-    voidpf     opaque;  /* private data object passed to zalloc and zfree */
-
-    int     data_type;  /* best guess about the data type: ascii or binary */
-    uLong   adler;      /* adler32 value of the uncompressed data */
-    uLong   reserved;   /* reserved for future use */
-} z_stream;
-
-typedef z_stream FAR *z_streamp;
-
-/*
-   The application must update next_in and avail_in when avail_in has
-   dropped to zero. It must update next_out and avail_out when avail_out
-   has dropped to zero. The application must initialize zalloc, zfree and
-   opaque before calling the init function. All other fields are set by the
-   compression library and must not be updated by the application.
-
-   The opaque value provided by the application will be passed as the first
-   parameter for calls of zalloc and zfree. This can be useful for custom
-   memory management. The compression library attaches no meaning to the
-   opaque value.
-
-   zalloc must return Z_NULL if there is not enough memory for the object.
-   If zlib is used in a multi-threaded application, zalloc and zfree must be
-   thread safe.
-
-   On 16-bit systems, the functions zalloc and zfree must be able to allocate
-   exactly 65536 bytes, but will not be required to allocate more than this
-   if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
-   pointers returned by zalloc for objects of exactly 65536 bytes *must*
-   have their offset normalized to zero. The default allocation function
-   provided by this library ensures this (see zutil.c). To reduce memory
-   requirements and avoid any allocation of 64K objects, at the expense of
-   compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
-
-   The fields total_in and total_out can be used for statistics or
-   progress reports. After compression, total_in holds the total size of
-   the uncompressed data and may be saved for use in the decompressor
-   (particularly if the decompressor wants to decompress everything in
-   a single step).
-*/
-
-                        /* constants */
-
-#define Z_NO_FLUSH      0
-#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */
-#define Z_SYNC_FLUSH    2
-#define Z_FULL_FLUSH    3
-#define Z_FINISH        4
-/* Allowed flush values; see deflate() below for details */
-
-#define Z_OK            0
-#define Z_STREAM_END    1
-#define Z_NEED_DICT     2
-#define Z_ERRNO        (-1)
-#define Z_STREAM_ERROR (-2)
-#define Z_DATA_ERROR   (-3)
-#define Z_MEM_ERROR    (-4)
-#define Z_BUF_ERROR    (-5)
-#define Z_VERSION_ERROR (-6)
-/* Return codes for the compression/decompression functions. Negative
- * values are errors, positive values are used for special but normal events.
- */
-
-#define Z_NO_COMPRESSION         0
-#define Z_BEST_SPEED             1
-#define Z_BEST_COMPRESSION       9
-#define Z_DEFAULT_COMPRESSION  (-1)
-/* compression levels */
-
-#define Z_FILTERED            1
-#define Z_HUFFMAN_ONLY        2
-#define Z_DEFAULT_STRATEGY    0
-/* compression strategy; see deflateInit2() below for details */
-
-#define Z_BINARY   0
-#define Z_ASCII    1
-#define Z_UNKNOWN  2
-/* Possible values of the data_type field */
-
-#define Z_DEFLATED   8
-/* The deflate compression method (the only one supported in this version) */
-
-#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
-
-
-                        /* basic functions */
-
-/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
-   If the first character differs, the library code actually used is
-   not compatible with the zlib.h header file used by the application.
-   This check is automatically made by deflateInit and inflateInit.
- */
-
-/*
-ZEXTERN(int)  deflateInit OF((z_streamp strm, int level));
-
-     Initializes the internal stream state for compression. The fields
-   zalloc, zfree and opaque must be initialized before by the caller.
-   If zalloc and zfree are set to Z_NULL, deflateInit updates them to
-   use default allocation functions.
-
-     The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
-   1 gives best speed, 9 gives best compression, 0 gives no compression at
-   all (the input data is simply copied a block at a time).
-   Z_DEFAULT_COMPRESSION requests a default compromise between speed and
-   compression (currently equivalent to level 6).
-
-     deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
-   enough memory, Z_STREAM_ERROR if level is not a valid compression level,
-   Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
-   with the version assumed by the caller (ZLIB_VERSION).
-   msg is set to null if there is no error message.  deflateInit does not
-   perform any compression: this will be done by deflate().
-*/
-
-
-/*
-    deflate compresses as much data as possible, and stops when the input
-  buffer becomes empty or the output buffer becomes full. It may introduce some
-  output latency (reading input without producing any output) except when
-  forced to flush.
-
-    The detailed semantics are as follows. deflate performs one or both of the
-  following actions:
-
-  - Compress more input starting at next_in and update next_in and avail_in
-    accordingly. If not all input can be processed (because there is not
-    enough room in the output buffer), next_in and avail_in are updated and
-    processing will resume at this point for the next call of deflate().
-
-  - Provide more output starting at next_out and update next_out and avail_out
-    accordingly. This action is forced if the parameter flush is non zero.
-    Forcing flush frequently degrades the compression ratio, so this parameter
-    should be set only when necessary (in interactive applications).
-    Some output may be provided even if flush is not set.
-
-  Before the call of deflate(), the application should ensure that at least
-  one of the actions is possible, by providing more input and/or consuming
-  more output, and updating avail_in or avail_out accordingly; avail_out
-  should never be zero before the call. The application can consume the
-  compressed output when it wants, for example when the output buffer is full
-  (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
-  and with zero avail_out, it must be called again after making room in the
-  output buffer because there might be more output pending.
-
-    If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
-  flushed to the output buffer and the output is aligned on a byte boundary, so
-  that the decompressor can get all input data available so far. (In particular
-  avail_in is zero after the call if enough output space has been provided
-  before the call.)  Flushing may degrade compression for some compression
-  algorithms and so it should be used only when necessary.
-
-    If flush is set to Z_FULL_FLUSH, all output is flushed as with
-  Z_SYNC_FLUSH, and the compression state is reset so that decompression can
-  restart from this point if previous compressed data has been damaged or if
-  random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
-  the compression.
-
-    If deflate returns with avail_out == 0, this function must be called again
-  with the same value of the flush parameter and more output space (updated
-  avail_out), until the flush is complete (deflate returns with non-zero
-  avail_out).
-
-    If the parameter flush is set to Z_FINISH, pending input is processed,
-  pending output is flushed and deflate returns with Z_STREAM_END if there
-  was enough output space; if deflate returns with Z_OK, this function must be
-  called again with Z_FINISH and more output space (updated avail_out) but no
-  more input data, until it returns with Z_STREAM_END or an error. After
-  deflate has returned Z_STREAM_END, the only possible operations on the
-  stream are deflateReset or deflateEnd.
-
-    Z_FINISH can be used immediately after deflateInit if all the compression
-  is to be done in a single step. In this case, avail_out must be at least
-  0.1% larger than avail_in plus 12 bytes.  If deflate does not return
-  Z_STREAM_END, then it must be called again as described above.
-
-    deflate() sets strm->adler to the adler32 checksum of all input read
-  so far (that is, total_in bytes).
-
-    deflate() may update data_type if it can make a good guess about
-  the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered
-  binary. This field is only for information purposes and does not affect
-  the compression algorithm in any manner.
-
-    deflate() returns Z_OK if some progress has been made (more input
-  processed or more output produced), Z_STREAM_END if all input has been
-  consumed and all output has been produced (only when flush is set to
-  Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
-  if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
-  (for example avail_in or avail_out was zero).
-*/
-
-
-/*
-     All dynamically allocated data structures for this stream are freed.
-   This function discards any unprocessed input and does not flush any
-   pending output.
-
-     deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
-   stream state was inconsistent, Z_DATA_ERROR if the stream was freed
-   prematurely (some input or output was discarded). In the error case,
-   msg may be set but then points to a static string (which must not be
-   deallocated).
-*/
-
-
-/*
-ZEXTERN(int)  inflateInit OF((z_streamp strm));
-
-     Initializes the internal stream state for decompression. The fields
-   next_in, avail_in, zalloc, zfree and opaque must be initialized before by
-   the caller. If next_in is not Z_NULL and avail_in is large enough (the exact
-   value depends on the compression method), inflateInit determines the
-   compression method from the zlib header and allocates all data structures
-   accordingly; otherwise the allocation will be deferred to the first call of
-   inflate.  If zalloc and zfree are set to Z_NULL, inflateInit updates them to
-   use default allocation functions.
-
-     inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
-   memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
-   version assumed by the caller.  msg is set to null if there is no error
-   message. inflateInit does not perform any decompression apart from reading
-   the zlib header if present: this will be done by inflate().  (So next_in and
-   avail_in may be modified, but next_out and avail_out are unchanged.)
-*/
-
-
-ZEXTERN(int) inflate OF((z_streamp strm, int flush));
-/*
-    inflate decompresses as much data as possible, and stops when the input
-  buffer becomes empty or the output buffer becomes full. It may some
-  introduce some output latency (reading input without producing any output)
-  except when forced to flush.
-
-  The detailed semantics are as follows. inflate performs one or both of the
-  following actions:
-
-  - Decompress more input starting at next_in and update next_in and avail_in
-    accordingly. If not all input can be processed (because there is not
-    enough room in the output buffer), next_in is updated and processing
-    will resume at this point for the next call of inflate().
-
-  - Provide more output starting at next_out and update next_out and avail_out
-    accordingly.  inflate() provides as much output as possible, until there
-    is no more input data or no more space in the output buffer (see below
-    about the flush parameter).
-
-  Before the call of inflate(), the application should ensure that at least
-  one of the actions is possible, by providing more input and/or consuming
-  more output, and updating the next_* and avail_* values accordingly.
-  The application can consume the uncompressed output when it wants, for
-  example when the output buffer is full (avail_out == 0), or after each
-  call of inflate(). If inflate returns Z_OK and with zero avail_out, it
-  must be called again after making room in the output buffer because there
-  might be more output pending.
-
-    If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much
-  output as possible to the output buffer. The flushing behavior of inflate is
-  not specified for values of the flush parameter other than Z_SYNC_FLUSH
-  and Z_FINISH, but the current implementation actually flushes as much output
-  as possible anyway.
-
-    inflate() should normally be called until it returns Z_STREAM_END or an
-  error. However if all decompression is to be performed in a single step
-  (a single call of inflate), the parameter flush should be set to
-  Z_FINISH. In this case all pending input is processed and all pending
-  output is flushed; avail_out must be large enough to hold all the
-  uncompressed data. (The size of the uncompressed data may have been saved
-  by the compressor for this purpose.) The next operation on this stream must
-  be inflateEnd to deallocate the decompression state. The use of Z_FINISH
-  is never required, but can be used to inform inflate that a faster routine
-  may be used for the single inflate() call.
-
-     If a preset dictionary is needed at this point (see inflateSetDictionary
-  below), inflate sets strm-adler to the adler32 checksum of the
-  dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise
-  it sets strm->adler to the adler32 checksum of all output produced
-  so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or
-  an error code as described below. At the end of the stream, inflate()
-  checks that its computed adler32 checksum is equal to that saved by the
-  compressor and returns Z_STREAM_END only if the checksum is correct.
-
-    inflate() returns Z_OK if some progress has been made (more input processed
-  or more output produced), Z_STREAM_END if the end of the compressed data has
-  been reached and all uncompressed output has been produced, Z_NEED_DICT if a
-  preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
-  corrupted (input stream not conforming to the zlib format or incorrect
-  adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent
-  (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not
-  enough memory, Z_BUF_ERROR if no progress is possible or if there was not
-  enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR
-  case, the application may then call inflateSync to look for a good
-  compression block.
-*/
-
-
-ZEXTERN(int)  inflateEnd OF((z_streamp strm));
-/*
-     All dynamically allocated data structures for this stream are freed.
-   This function discards any unprocessed input and does not flush any
-   pending output.
-
-     inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
-   was inconsistent. In the error case, msg may be set but then points to a
-   static string (which must not be deallocated).
-*/
-
-                        /* Advanced functions */
-
-/*
-    The following functions are needed only in some special applications.
-*/
-
-/*
-ZEXTERN(int)  deflateInit2 OF((z_streamp strm,
-                                     int  level,
-                                     int  method,
-                                     int  windowBits,
-                                     int  memLevel,
-                                     int  strategy));
-
-     This is another version of deflateInit with more compression options. The
-   fields next_in, zalloc, zfree and opaque must be initialized before by
-   the caller.
-
-     The method parameter is the compression method. It must be Z_DEFLATED in
-   this version of the library.
-
-     The windowBits parameter is the base two logarithm of the window size
-   (the size of the history buffer).  It should be in the range 8..15 for this
-   version of the library. Larger values of this parameter result in better
-   compression at the expense of memory usage. The default value is 15 if
-   deflateInit is used instead.
-
-     The memLevel parameter specifies how much memory should be allocated
-   for the internal compression state. memLevel=1 uses minimum memory but
-   is slow and reduces compression ratio; memLevel=9 uses maximum memory
-   for optimal speed. The default value is 8. See zconf.h for total memory
-   usage as a function of windowBits and memLevel.
-
-     The strategy parameter is used to tune the compression algorithm. Use the
-   value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
-   filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no
-   string match).  Filtered data consists mostly of small values with a
-   somewhat random distribution. In this case, the compression algorithm is
-   tuned to compress them better. The effect of Z_FILTERED is to force more
-   Huffman coding and less string matching; it is somewhat intermediate
-   between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects
-   the compression ratio but not the correctness of the compressed output even
-   if it is not set appropriately.
-
-      deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
-   memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
-   method). msg is set to null if there is no error message.  deflateInit2 does
-   not perform any compression: this will be done by deflate().
-*/
-
-/*
-     Initializes the compression dictionary from the given byte sequence
-   without producing any compressed output. This function must be called
-   immediately after deflateInit, deflateInit2 or deflateReset, before any
-   call of deflate. The compressor and decompressor must use exactly the same
-   dictionary (see inflateSetDictionary).
-
-     The dictionary should consist of strings (byte sequences) that are likely
-   to be encountered later in the data to be compressed, with the most commonly
-   used strings preferably put towards the end of the dictionary. Using a
-   dictionary is most useful when the data to be compressed is short and can be
-   predicted with good accuracy; the data can then be compressed better than
-   with the default empty dictionary.
-
-     Depending on the size of the compression data structures selected by
-   deflateInit or deflateInit2, a part of the dictionary may in effect be
-   discarded, for example if the dictionary is larger than the window size in
-   deflate or deflate2. Thus the strings most likely to be useful should be
-   put at the end of the dictionary, not at the front.
-
-     Upon return of this function, strm->adler is set to the Adler32 value
-   of the dictionary; the decompressor may later use this value to determine
-   which dictionary has been used by the compressor. (The Adler32 value
-   applies to the whole dictionary even if only a subset of the dictionary is
-   actually used by the compressor.)
-
-     deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
-   parameter is invalid (such as NULL dictionary) or the stream state is
-   inconsistent (for example if deflate has already been called for this stream
-   or if the compression method is bsort). deflateSetDictionary does not
-   perform any compression: this will be done by deflate().
-*/
-
-/*
-     Sets the destination stream as a complete copy of the source stream.
-
-     This function can be useful when several compression strategies will be
-   tried, for example when there are several ways of pre-processing the input
-   data with a filter. The streams that will be discarded should then be freed
-   by calling deflateEnd.  Note that deflateCopy duplicates the internal
-   compression state which can be quite large, so this strategy is slow and
-   can consume lots of memory.
-
-     deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
-   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
-   (such as zalloc being NULL). msg is left unchanged in both source and
-   destination.
-*/
-
-/*
-     This function is equivalent to deflateEnd followed by deflateInit,
-   but does not free and reallocate all the internal compression state.
-   The stream will keep the same compression level and any other attributes
-   that may have been set by deflateInit2.
-
-      deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
-   stream state was inconsistent (such as zalloc or state being NULL).
-*/
-
-/*
-     Dynamically update the compression level and compression strategy.  The
-   interpretation of level and strategy is as in deflateInit2.  This can be
-   used to switch between compression and straight copy of the input data, or
-   to switch to a different kind of input data requiring a different
-   strategy. If the compression level is changed, the input available so far
-   is compressed with the old level (and may be flushed); the new level will
-   take effect only at the next call of deflate().
-
-     Before the call of deflateParams, the stream state must be set as for
-   a call of deflate(), since the currently available input may have to
-   be compressed and flushed. In particular, strm->avail_out must be non-zero.
-
-     deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
-   stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
-   if strm->avail_out was zero.
-*/
-
-/*
-ZEXTERN(int)  inflateInit2 OF((z_streamp strm,
-                                     int  windowBits));
-
-     This is another version of inflateInit with an extra parameter. The
-   fields next_in, avail_in, zalloc, zfree and opaque must be initialized
-   before by the caller.
-
-     The windowBits parameter is the base two logarithm of the maximum window
-   size (the size of the history buffer).  It should be in the range 8..15 for
-   this version of the library. The default value is 15 if inflateInit is used
-   instead. If a compressed stream with a larger window size is given as
-   input, inflate() will return with the error code Z_DATA_ERROR instead of
-   trying to allocate a larger window.
-
-      inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
-   memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative
-   memLevel). msg is set to null if there is no error message.  inflateInit2
-   does not perform any decompression apart from reading the zlib header if
-   present: this will be done by inflate(). (So next_in and avail_in may be
-   modified, but next_out and avail_out are unchanged.)
-*/
-
-/*
-     Initializes the decompression dictionary from the given uncompressed byte
-   sequence. This function must be called immediately after a call of inflate
-   if this call returned Z_NEED_DICT. The dictionary chosen by the compressor
-   can be determined from the Adler32 value returned by this call of
-   inflate. The compressor and decompressor must use exactly the same
-   dictionary (see deflateSetDictionary).
-
-     inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
-   parameter is invalid (such as NULL dictionary) or the stream state is
-   inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
-   expected one (incorrect Adler32 value). inflateSetDictionary does not
-   perform any decompression: this will be done by subsequent calls of
-   inflate().
-*/
-
-/*
-    Skips invalid compressed data until a full flush point (see above the
-  description of deflate with Z_FULL_FLUSH) can be found, or until all
-  available input is skipped. No output is provided.
-
-    inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
-  if no more input was provided, Z_DATA_ERROR if no flush point has been found,
-  or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
-  case, the application may save the current current value of total_in which
-  indicates where valid compressed data was found. In the error case, the
-  application may repeatedly call inflateSync, providing more input each time,
-  until success or end of the input data.
-*/
-
-ZEXTERN(int)  inflateReset OF((z_streamp strm));
-/*
-     This function is equivalent to inflateEnd followed by inflateInit,
-   but does not free and reallocate all the internal decompression state.
-   The stream will keep attributes that may have been set by inflateInit2.
-
-      inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
-   stream state was inconsistent (such as zalloc or state being NULL).
-*/
-
-
-                        /* utility functions */
-
-/*
-     The following utility functions are implemented on top of the
-   basic stream-oriented functions. To simplify the interface, some
-   default options are assumed (compression level and memory usage,
-   standard memory allocation functions). The source code of these
-   utility functions can easily be modified if you need special options.
-*/
-
-/*
-     Compresses the source buffer into the destination buffer.  sourceLen is
-   the byte length of the source buffer. Upon entry, destLen is the total
-   size of the destination buffer, which must be at least 0.1% larger than
-   sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the
-   compressed buffer.
-     This function can be used to compress a whole file at once if the
-   input file is mmap'ed.
-     compress returns Z_OK if success, Z_MEM_ERROR if there was not
-   enough memory, Z_BUF_ERROR if there was not enough room in the output
-   buffer.
-*/
-
-/*
-     Compresses the source buffer into the destination buffer. The level
-   parameter has the same meaning as in deflateInit.  sourceLen is the byte
-   length of the source buffer. Upon entry, destLen is the total size of the
-   destination buffer, which must be at least 0.1% larger than sourceLen plus
-   12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
-
-     compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
-   memory, Z_BUF_ERROR if there was not enough room in the output buffer,
-   Z_STREAM_ERROR if the level parameter is invalid.
-*/
-
-/*
-     Decompresses the source buffer into the destination buffer.  sourceLen is
-   the byte length of the source buffer. Upon entry, destLen is the total
-   size of the destination buffer, which must be large enough to hold the
-   entire uncompressed data. (The size of the uncompressed data must have
-   been saved previously by the compressor and transmitted to the decompressor
-   by some mechanism outside the scope of this compression library.)
-   Upon exit, destLen is the actual size of the compressed buffer.
-     This function can be used to decompress a whole file at once if the
-   input file is mmap'ed.
-
-     uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
-   enough memory, Z_BUF_ERROR if there was not enough room in the output
-   buffer, or Z_DATA_ERROR if the input data was corrupted.
-*/
-
-
-/*
-     Opens a gzip (.gz) file for reading or writing. The mode parameter
-   is as in fopen ("rb" or "wb") but can also include a compression level
-   ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
-   Huffman only compression as in "wb1h". (See the description
-   of deflateInit2 for more information about the strategy parameter.)
-
-     gzopen can be used to read a file which is not in gzip format; in this
-   case gzread will directly read from the file without decompression.
-
-     gzopen returns NULL if the file could not be opened or if there was
-   insufficient memory to allocate the (de)compression state; errno
-   can be checked to distinguish the two cases (if errno is zero, the
-   zlib error is Z_MEM_ERROR).  */
-
-/*
-     gzdopen() associates a gzFile with the file descriptor fd.  File
-   descriptors are obtained from calls like open, dup, creat, pipe or
-   fileno (in the file has been previously opened with fopen).
-   The mode parameter is as in gzopen.
-     The next call of gzclose on the returned gzFile will also close the
-   file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
-   descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
-     gzdopen returns NULL if there was insufficient memory to allocate
-   the (de)compression state.
-*/
-
-/*
-     Dynamically update the compression level or strategy. See the description
-   of deflateInit2 for the meaning of these parameters.
-     gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
-   opened for writing.
-*/
-
-/*
-     Reads the given number of uncompressed bytes from the compressed file.
-   If the input file was not in gzip format, gzread copies the given number
-   of bytes into the buffer.
-     gzread returns the number of uncompressed bytes actually read (0 for
-   end of file, -1 for error). */
-
-/*
-     Writes the given number of uncompressed bytes into the compressed file.
-   gzwrite returns the number of uncompressed bytes actually written
-   (0 in case of error).
-*/
-
-/*
-     Converts, formats, and writes the args to the compressed file under
-   control of the format string, as in fprintf. gzprintf returns the number of
-   uncompressed bytes actually written (0 in case of error).
-*/
-
-/*
-      Writes the given null-terminated string to the compressed file, excluding
-   the terminating null character.
-      gzputs returns the number of characters written, or -1 in case of error.
-*/
-
-/*
-      Reads bytes from the compressed file until len-1 characters are read, or
-   a newline character is read and transferred to buf, or an end-of-file
-   condition is encountered.  The string is then terminated with a null
-   character.
-      gzgets returns buf, or Z_NULL in case of error.
-*/
-
-/*
-      Writes c, converted to an unsigned char, into the compressed file.
-   gzputc returns the value that was written, or -1 in case of error.
-*/
-
-/*
-      Reads one byte from the compressed file. gzgetc returns this byte
-   or -1 in case of end of file or error.
-*/
-
-/*
-     Flushes all pending output into the compressed file. The parameter
-   flush is as in the deflate() function. The return value is the zlib
-   error number (see function gzerror below). gzflush returns Z_OK if
-   the flush parameter is Z_FINISH and all output could be flushed.
-     gzflush should be called only when strictly necessary because it can
-   degrade compression.
-*/
-
-/*
-      Sets the starting position for the next gzread or gzwrite on the
-   given compressed file. The offset represents a number of bytes in the
-   uncompressed data stream. The whence parameter is defined as in lseek(2);
-   the value SEEK_END is not supported.
-     If the file is opened for reading, this function is emulated but can be
-   extremely slow. If the file is opened for writing, only forward seeks are
-   supported; gzseek then compresses a sequence of zeroes up to the new
-   starting position.
-
-      gzseek returns the resulting offset location as measured in bytes from
-   the beginning of the uncompressed stream, or -1 in case of error, in
-   particular if the file is opened for writing and the new starting position
-   would be before the current position.
-*/
-
-/*
-     Rewinds the given file. This function is supported only for reading.
-
-   gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
-*/
-
-/*
-     Returns the starting position for the next gzread or gzwrite on the
-   given compressed file. This position represents a number of bytes in the
-   uncompressed data stream.
-
-   gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
-*/
-
-/*
-     Returns 1 when EOF has previously been detected reading the given
-   input stream, otherwise zero.
-*/
-
-/*
-     Flushes all pending output if necessary, closes the compressed file
-   and deallocates all the (de)compression state. The return value is the zlib
-   error number (see function gzerror below).
-*/
-
-/*
-     Returns the error message for the last error which occurred on the
-   given compressed file. errnum is set to zlib error number. If an
-   error occurred in the file system and not in the compression library,
-   errnum is set to Z_ERRNO and the application may consult errno
-   to get the exact error code.
-*/
-
-                        /* checksum functions */
-
-/*
-     These functions are not related to compression but are exported
-   anyway because they might be useful in applications using the
-   compression library.
-*/
-
-ZEXTERN(uLong)  adler32 OF((uLong adler, const Bytef *buf, uInt len));
-
-/*
-     Update a running Adler-32 checksum with the bytes buf[0..len-1] and
-   return the updated checksum. If buf is NULL, this function returns
-   the required initial value for the checksum.
-   An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
-   much faster. Usage example:
-
-     uLong adler = adler32(0L, Z_NULL, 0);
-
-     while (read_buffer(buffer, length) != EOF) {
-       adler = adler32(adler, buffer, length);
-     }
-     if (adler != original_adler) error();
-*/
-
-/*
-     Update a running crc with the bytes buf[0..len-1] and return the updated
-   crc. If buf is NULL, this function returns the required initial value
-   for the crc. Pre- and post-conditioning (one's complement) is performed
-   within this function so it shouldn't be done by the application.
-   Usage example:
-
-     uLong crc = crc32(0L, Z_NULL, 0);
-
-     while (read_buffer(buffer, length) != EOF) {
-       crc = crc32(crc, buffer, length);
-     }
-     if (crc != original_crc) error();
-*/
-
-
-                        /* various hacks, don't look :) */
-
-/* deflateInit and inflateInit are macros to allow checking the zlib version
- * and the compiler's view of z_stream:
- */
-ZEXTERN(int)  inflateInit2_ OF((z_streamp strm, int  windowBits,
-                                      const char *version, int stream_size));
-#define deflateInit(strm, level) \
-        deflateInit_((strm), (level),       ZLIB_VERSION, sizeof(z_stream))
-#define inflateInit(strm) \
-        inflateInit_((strm),                ZLIB_VERSION, sizeof(z_stream))
-#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
-        deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
-                      (strategy),           ZLIB_VERSION, sizeof(z_stream))
-#define inflateInit2(strm, windowBits) \
-        inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _ZLIB_H */

+ 0 - 181
sys/src/libfreetype/src/gzip/zutil.c

@@ -1,181 +0,0 @@
-/* zutil.c -- target dependent utility functions for the compression library
- * Copyright (C) 1995-2002 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id: zutil.c,v 1.2 2002/11/06 22:32:54 davidT Exp $ */
-
-#include "zutil.h"
-
-#ifndef STDC
-extern void exit OF((int));
-#endif
-
-
-#ifndef HAVE_MEMCPY
-
-void zmemcpy(dest, source, len)
-    Bytef* dest;
-    const Bytef* source;
-    uInt  len;
-{
-    if (len == 0) return;
-    do {
-        *dest++ = *source++; /* ??? to be unrolled */
-    } while (--len != 0);
-}
-
-int zmemcmp(s1, s2, len)
-    const Bytef* s1;
-    const Bytef* s2;
-    uInt  len;
-{
-    uInt j;
-
-    for (j = 0; j < len; j++) {
-        if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
-    }
-    return 0;
-}
-
-void zmemzero(dest, len)
-    Bytef* dest;
-    uInt  len;
-{
-    if (len == 0) return;
-    do {
-        *dest++ = 0;  /* ??? to be unrolled */
-    } while (--len != 0);
-}
-#endif
-
-#ifdef __TURBOC__
-#if (defined( __BORLANDC__) || !defined(SMALL_MEDIUM)) && !defined(__32BIT__)
-/* Small and medium model in Turbo C are for now limited to near allocation
- * with reduced MAX_WBITS and MAX_MEM_LEVEL
- */
-#  define MY_ZCALLOC
-
-/* Turbo C malloc() does not allow dynamic allocation of 64K bytes
- * and farmalloc(64K) returns a pointer with an offset of 8, so we
- * must fix the pointer. Warning: the pointer must be put back to its
- * original form in order to free it, use zcfree().
- */
-
-#define MAX_PTR 10
-/* 10*64K = 640K */
-
-local int next_ptr = 0;
-
-typedef struct ptr_table_s {
-    voidpf org_ptr;
-    voidpf new_ptr;
-} ptr_table;
-
-local ptr_table table[MAX_PTR];
-/* This table is used to remember the original form of pointers
- * to large buffers (64K). Such pointers are normalized with a zero offset.
- * Since MSDOS is not a preemptive multitasking OS, this table is not
- * protected from concurrent access. This hack doesn't work anyway on
- * a protected system like OS/2. Use Microsoft C instead.
- */
-
-voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
-{
-    voidpf buf = opaque; /* just to make some compilers happy */
-    ulg bsize = (ulg)items*size;
-
-    /* If we allocate less than 65520 bytes, we assume that farmalloc
-     * will return a usable pointer which doesn't have to be normalized.
-     */
-    if (bsize < 65520L) {
-        buf = farmalloc(bsize);
-        if (*(ush*)&buf != 0) return buf;
-    } else {
-        buf = farmalloc(bsize + 16L);
-    }
-    if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
-    table[next_ptr].org_ptr = buf;
-
-    /* Normalize the pointer to seg:0 */
-    *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
-    *(ush*)&buf = 0;
-    table[next_ptr++].new_ptr = buf;
-    return buf;
-}
-
-void  zcfree (voidpf opaque, voidpf ptr)
-{
-    int n;
-    if (*(ush*)&ptr != 0) { /* object < 64K */
-        farfree(ptr);
-        return;
-    }
-    /* Find the original pointer */
-    for (n = 0; n < next_ptr; n++) {
-        if (ptr != table[n].new_ptr) continue;
-
-        farfree(table[n].org_ptr);
-        while (++n < next_ptr) {
-            table[n-1] = table[n];
-        }
-        next_ptr--;
-        return;
-    }
-    ptr = opaque; /* just to make some compilers happy */
-    Assert(0, "zcfree: ptr not found");
-}
-#endif
-#endif /* __TURBOC__ */
-
-
-#if defined(M_I86) && !defined(__32BIT__)
-/* Microsoft C in 16-bit mode */
-
-#  define MY_ZCALLOC
-
-#if (!defined(_MSC_VER) || (_MSC_VER <= 600))
-#  define _halloc  halloc
-#  define _hfree   hfree
-#endif
-
-voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
-{
-    if (opaque) opaque = 0; /* to make compiler happy */
-    return _halloc((int32_t)items, size);
-}
-
-void  zcfree (voidpf opaque, voidpf ptr)
-{
-    if (opaque) opaque = 0; /* to make compiler happy */
-    _hfree(ptr);
-}
-
-#endif /* MSC */
-
-
-#ifndef MY_ZCALLOC /* Any system without a special alloc function */
-
-#ifndef STDC
-extern voidp  calloc OF((uInt items, uInt size));
-extern void   free   OF((voidpf ptr));
-#endif
-
-voidpf zcalloc (opaque, items, size)
-    voidpf opaque;
-    unsigned items;
-    unsigned size;
-{
-    if (opaque) items += size - size; /* make compiler happy */
-    return (voidpf)calloc(items, size);
-}
-
-void  zcfree (opaque, ptr)
-    voidpf opaque;
-    voidpf ptr;
-{
-    free(ptr);
-    if (opaque) return; /* make compiler happy */
-}
-
-#endif /* MY_ZCALLOC */

+ 0 - 211
sys/src/libfreetype/src/gzip/zutil.h

@@ -1,211 +0,0 @@
-/* zutil.h -- internal interface and configuration of the compression library
- * Copyright (C) 1995-2002 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
-   part of the implementation of the compression library and is
-   subject to change. Applications should only use zlib.h.
- */
-
-/* @(#) $Id: zutil.h,v 1.3 2002/12/26 20:50:40 davidT Exp $ */
-
-#ifndef _Z_UTIL_H
-#define _Z_UTIL_H
-
-#include "zlib.h"
-
-#ifdef STDC
-#  include <stddef.h>
-#  include <string.h>
-#  include <stdlib.h>
-#endif
-
-#ifndef local
-#  define local static
-#endif
-/* compile with -Dlocal if your debugger can't find static symbols */
-
-typedef unsigned char  uch;
-typedef uch FAR uchf;
-typedef unsigned short ush;
-typedef ush FAR ushf;
-typedef unsigned long  ulg;
-
-
-#define ERR_RETURN(strm,err) \
-  return (strm->msg = (char*)ERR_MSG(err), (err))
-/* To be used only when the state is known to be valid */
-
-        /* common constants */
-
-#ifndef DEF_WBITS
-#  define DEF_WBITS MAX_WBITS
-#endif
-/* default windowBits for decompression. MAX_WBITS is for compression only */
-
-#if MAX_MEM_LEVEL >= 8
-#  define DEF_MEM_LEVEL 8
-#else
-#  define DEF_MEM_LEVEL  MAX_MEM_LEVEL
-#endif
-/* default memLevel */
-
-#define STORED_BLOCK 0
-#define STATIC_TREES 1
-#define DYN_TREES    2
-/* The three kinds of block type */
-
-#define MIN_MATCH  3
-#define MAX_MATCH  258
-/* The minimum and maximum match lengths */
-
-#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
-
-        /* target dependencies */
-
-#ifdef MSDOS
-#  define OS_CODE  0x00
-#  if defined(__TURBOC__) || defined(__BORLANDC__)
-#    if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
-       /* Allow compilation with ANSI keywords only enabled */
-       void _Cdecl farfree( void *block );
-       void *_Cdecl farmalloc( unsigned long nbytes );
-#    else
-#     include <alloc.h>
-#    endif
-#  else /* MSC or DJGPP */
-#    include <malloc.h>
-#  endif
-#endif
-
-#ifdef OS2
-#  define OS_CODE  0x06
-#endif
-
-#ifdef WIN32 /* Window 95 & Windows NT */
-#  define OS_CODE  0x0b
-#endif
-
-#if defined(VAXC) || defined(VMS)
-#  define OS_CODE  0x02
-#  define F_OPEN(name, mode) \
-     fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
-#endif
-
-#ifdef AMIGA
-#  define OS_CODE  0x01
-#endif
-
-#if defined(ATARI) || defined(atarist)
-#  define OS_CODE  0x05
-#endif
-
-#if defined(MACOS) || defined(TARGET_OS_MAC)
-#  define OS_CODE  0x07
-#  if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
-#    include <unix.h> /* for fdopen */
-#  else
-#    ifndef fdopen
-#      define fdopen(fd,mode) NULL /* No fdopen() */
-#    endif
-#  endif
-#endif
-
-#ifdef __50SERIES /* Prime/PRIMOS */
-#  define OS_CODE  0x0F
-#endif
-
-#ifdef TOPS20
-#  define OS_CODE  0x0a
-#endif
-
-#if defined(_BEOS_) || defined(RISCOS)
-#  define fdopen(fd,mode) NULL /* No fdopen() */
-#endif
-
-#if (defined(_MSC_VER) && (_MSC_VER > 600))
-#  define fdopen(fd,type)  _fdopen(fd,type)
-#endif
-
-
-        /* Common defaults */
-
-#ifndef OS_CODE
-#  define OS_CODE  0x03  /* assume Unix */
-#endif
-
-#ifndef F_OPEN
-#  define F_OPEN(name, mode) fopen((name), (mode))
-#endif
-
-         /* functions */
-
-#ifdef HAVE_STRERROR
-   extern char *strerror OF((int));
-#  define zstrerror(errnum) strerror(errnum)
-#else
-#  define zstrerror(errnum) ""
-#endif
-
-#if defined(pyr)
-#  define NO_MEMCPY
-#endif
-#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
- /* Use our own functions for small and medium model with MSC <= 5.0.
-  * You may have to use the same strategy for Borland C (untested).
-  * The __SC__ check is for Symantec.
-  */
-#  define NO_MEMCPY
-#endif
-#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
-#  define HAVE_MEMCPY
-#endif
-#ifdef HAVE_MEMCPY
-#  ifdef SMALL_MEDIUM /* MSDOS small or medium model */
-#    define zmemcpy _fmemcpy
-#    define zmemcmp _fmemcmp
-#    define zmemzero(dest, len) _fmemset(dest, 0, len)
-#  else
-#    define zmemcpy ft_memcpy
-#    define zmemcmp memcmp
-#    define zmemzero(dest, len) memset(dest, 0, len)
-#  endif
-#else
-   extern void zmemcpy  OF((Bytef* dest, const Bytef* source, uInt len));
-   extern int  zmemcmp  OF((const Bytef* s1, const Bytef* s2, uInt len));
-   extern void zmemzero OF((Bytef* dest, uInt len));
-#endif
-
-/* Diagnostic functions */
-#ifdef DEBUG
-#  include <stdio.h>
-   extern int z_verbose;
-   extern void z_error    OF((char *m));
-#  define Assert(cond,msg) {if(!(cond)) z_error(msg);}
-#  define Trace(x) {if (z_verbose>=0) fprintf x ;}
-#  define Tracev(x) {if (z_verbose>0) fprintf x ;}
-#  define Tracevv(x) {if (z_verbose>1) fprintf x ;}
-#  define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
-#  define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
-#else
-#  define Assert(cond,msg)
-#  define Trace(x)
-#  define Tracev(x)
-#  define Tracevv(x)
-#  define Tracec(c,x)
-#  define Tracecv(c,x)
-#endif
-
-
-typedef uLong (*check_func) OF((uLong check, const Bytef *buf,
-				       uInt len));
-local voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
-local void   zcfree  OF((voidpf opaque, voidpf ptr));
-
-#define ZALLOC(strm, items, size) \
-           (*((strm)->zalloc))((strm)->opaque, (items), (size))
-#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
-#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
-
-#endif /* _Z_UTIL_H */

+ 0 - 205
sys/src/libfreetype/src/otlayout/otlayout.h

@@ -1,205 +0,0 @@
-#ifndef __OT_LAYOUT_H__
-#define __OT_LAYOUT_H__
-
-
-#include "otlconf.h"
-
-OTL_BEGIN_HEADER
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                       BASE DATA TYPES                        *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-  typedef unsigned char     OTL_Byte;
-  typedef const OTL_Byte*   OTL_Bytes;
-
-  typedef int               OTL_Error;
-
-  typedef void*             OTL_Pointer;
-
-  typedef int               OTL_Int;
-  typedef unsigned int      OTL_UInt;
-
-  typedef long              OTL_Long;
-  typedef unsigned long     OTL_ULong;
-
-  typedef short             OTL_Int16;
-  typedef unsigned short    OTL_UInt16;
-
-
-#if OTL_SIZEOF_INT == 4
-
-  typedef int               OTL_Int32;
-  typedef unsigned int      OTL_UInt32;
-
-#elif OTL_SIZEOF_LONG == 4
-
-  typedef long              OTL_Int32;
-  typedef unsigned long     OTL_UInt32;
-
-#else
-#  error "no 32-bits type found"
-#endif
-
-  typedef OTL_UInt32        OTL_Tag;
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                       ERROR CODES                            *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-  typedef enum
-  {
-    OTL_Err_Ok = 0,
-    OTL_Err_InvalidArgument,
-    OTL_Err_InvalidFormat,
-    OTL_Err_InvalidOffset,
-
-    OTL_Err_Max
-
-  } OTL_Error;
-
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                     MEMORY MANAGEMENT                        *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-  typedef OTL_Pointer  (*OTL_AllocFunc)( OTL_ULong    size,
-                                         OTL_Pointer  data );
-
-  typedef OTL_Pointer  (*OTL_ReallocFunc)( OTL_Pointer   block,
-                                           OTL_ULong     size,
-                                           OTL_Pointer   data );
-
-  typedef void         (*OTL_FreeFunc)( OTL_Pointer  block,
-                                        OTL_Pointer  data );
-
-  typedef struct OTL_MemoryRec_
-  {
-    OTL_Pointer      mem_data;
-    OTL_AllocFunc    mem_alloc;
-    OTL_ReallocFunc  mem_realloc;
-    OTL_FreeFunc     mem_free;
-
-  } OTL_MemoryRec, *OTL_Memory;
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                        ENUMERATIONS                          *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-/* re-define OTL_MAKE_TAG to something different if you're not */
-/* using an ASCII-based character set (Vaxes anyone ?)         */
-#ifndef  OTL_MAKE_TAG
-#define  OTL_MAKE_TAG(c1,c2,c3,c4)         \
-           ( ( (OTL_UInt32)(c1) << 24 ) |  \
-               (OTL_UInt32)(c2) << 16 ) |  \
-               (OTL_UInt32)(c3) <<  8 ) |  \
-               (OTL_UInt32)(c4)         )
-#endif
-
-  typedef enum OTL_ScriptTag_
-  {
-    OTL_SCRIPT_NONE = 0,
-
-#define OTL_SCRIPT_TAG(c1,c2,c3,c4,s,n)  OTL_SCRIPT_TAG_ ## n = OTL_MAKE_TAG(c1,c2,c3,c4),
-#include "otltags.h"
-
-    OTL_SCRIPT_MAX
-
-  } OTL_ScriptTag;
-
-
-  typedef enum OTL_LangTag_
-  {
-    OTL_LANG_DEFAULT = 0,
-
-#define OTL_LANG_TAG(c1,c2,c3,c4,s,n)  OTL_LANG_TAG_ ## n = OTL_MAKE_TAG(c1,c2,c3,c4),
-#include "otltags.h"
-
-    OTL_LANG_MAX
-
-  } OTL_LangTag;
-
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                       MEMORY READS                           *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-#define  OTL_PEEK_USHORT(p)  ( ((OTL_UInt)((p)[0]) << 8) |  \
-                               ((OTL_UInt)((p)[1])     ) )
-
-#define  OTL_PEEK_ULONG(p)   ( ((OTL_UInt32)((p)[0]) << 24) |  \
-                               ((OTL_UInt32)((p)[1]) << 16) |  \
-                               ((OTL_UInt32)((p)[2]) <<  8) |  \
-                               ((OTL_UInt32)((p)[3])      ) )
-
-#define  OTL_PEEK_SHORT(p)     ((OTL_Int16)OTL_PEEK_USHORT(p))
-
-#define  OTL_PEEK_LONG(p)      ((OTL_Int32)OTL_PEEK_ULONG(p))
-
-#define  OTL_NEXT_USHORT(p)  ( (p) += 2, OTL_PEEK_USHORT((p)-2) )
-#define  OTL_NEXT_ULONG(p)   ( (p) += 4, OTL_PEEK_ULONG((p)-4) )
-
-#define  OTL_NEXT_SHORT(p)   ((OTL_Int16)OTL_NEXT_USHORT(p))
-#define  OTL_NEXT_LONG(p)    ((OTL_Int32)OTL_NEXT_ULONG(p))
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                        VALIDATION                            *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-  typedef struct OTL_ValidatorRec_*  OTL_Validator;
-
-  typedef struct OTL_ValidatorRec_
-  {
-    OTL_Bytes    limit;
-    OTL_Bytes    base;
-    OTL_Error    error;
-    OTL_jmp_buf  jump_buffer;
-
-  } OTL_ValidatorRec;
-
-  typedef void  (*OTL_ValidateFunc)( OTL_Bytes  table,
-                                     OTL_Valid  valid );
-
-  OTL_API( void )
-  otl_validator_error( OTL_Validator  validator,
-                       OTL_Error      error );
-
-#define  OTL_INVALID(e)  otl_validator_error( valid, e )
-
-#define  OTL_INVALID_TOO_SHORT  OTL_INVALID( OTL_Err_InvalidOffset )
-#define  OTL_INVALID_DATA       OTL_INVALID( OTL_Err_InvalidFormat )
-
-#define  OTL_CHECK(_count)   OTL_BEGIN_STMNT                       \
-                               if ( p + (_count) > valid->limit )  \
-                                 OTL_INVALID_TOO_SHORT;            \
-                             OTL_END_STMNT
-
- /* */
-
-OTL_END_HEADER
-
-#endif /* __OPENTYPE_LAYOUT_H__ */

+ 0 - 181
sys/src/libfreetype/src/otlayout/otlbase.c

@@ -1,181 +0,0 @@
-#include "otlbase.h"
-#include "otlcommn.h"
-
-  static void
-  otl_base_coord_validate( OTL_Bytes      table,
-                           OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   format;
-
-    OTL_CHECK( 4 );
-
-    format = OTL_NEXT_USHORT( p );
-    p += 2;
-
-    switch ( format )
-    {
-      case 1:
-        break;
-
-      case 2:
-        OTL_CHECK( 4 );
-        break;
-
-      case 3:
-        OTL_CHECK( 2 );
-        otl_device_table_validate( table + OTL_PEEK_USHORT( p ) );
-        break;
-
-      default:
-        OTL_INVALID_DATA;
-    }
-  }
-
-
-  static void
-  otl_base_tag_list_validate( OTL_Bytes      table,
-                              OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count;
-
-    OTL_CHECK(2);
-
-    count = OTL_NEXT_USHORT( p );
-    OTL_CHECK( count*4 );
-  }
-
-
-
-  static void
-  otl_base_values_validate( OTL_Bytes      table,
-                            OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count;
-
-    OTL_CHECK( 4 );
-
-    p    += 2;  /* skip default index */
-    count = OTL_NEXT_USHORT( p );
-
-    OTL_CHECK( count*2 );
-
-    for ( ; count > 0; count-- )
-      otl_base_coord_validate( table + OTL_NEXT_USHORT( p ), valid );
-  }
-
-
-  static void
-  otl_base_minmax_validate( OTL_Bytes      table,
-                            OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   min_coord, max_coord, count;
-
-    OTL_CHECK(6);
-    min_coord = OTL_NEXT_USHORT( p );
-    max_coord = OTL_NEXT_USHORT( p );
-    count     = OTL_NEXT_USHORT( p );
-
-    if ( min_coord )
-      otl_base_coord_validate( table + min_coord, valid );
-
-    if ( max_coord )
-      otl_base_coord_validate( table + max_coord, valid );
-
-    OTL_CHECK( count*8 );
-    for ( ; count > 0; count-- )
-    {
-      p += 4;  /* ignore tag */
-      min_coord = OTL_NEXT_USHORT( p );
-      max_coord = OTL_NEXT_USHORT( p );
-
-      if ( min_coord )
-        otl_base_coord_validate( table + min_coord, valid );
-
-      if ( max_coord )
-        otl_base_coord_validate( table + max_coord, valid );
-    }
-  }
-
-
-  static void
-  otl_base_script_validate( OTL_Bytes      table,
-                            OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   values, default_minmax;
-
-    OTL_CHECK(6);
-
-    values         = OTL_NEXT_USHORT( p );
-    default_minmax = OTL_NEXT_USHORT( p );
-    count          = OTL_NEXT_USHORT( p );
-
-    if ( values )
-      otl_base_values_validate( table + values, valid );
-
-    if ( default_minmax )
-      otl_base_minmax_validate( table + default_minmax, valid );
-
-    OTL_CHECK( count*6 );
-    for ( ; count > 0; count-- )
-    {
-      p += 4;  /* ignore tag */
-      otl_base_minmax_validate( table + OTL_NEXT_USHORT( p ), valid );
-    }
-  }
-
-
-  static void
-  otl_base_script_list_validate( OTL_Bytes      table,
-                                 OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count;
-
-    OTL_CHECK(2);
-
-    count = OTL_NEXT_USHORT( p );
-    OTL_CHECK(count*6);
-
-    for ( ; count > 0; count-- )
-    {
-      p += 4;  /* ignore script tag */
-      otl_base_script_validate( table + OTL_NEXT_USHORT( p ) );
-    }
-  }
-
-  static void
-  otl_axis_table_validate( OTL_Bytes      table,
-                           OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   tags;
-
-    OTL_CHECK(4);
-
-    tags = OTL_NEXT_USHORT( p );
-    if ( tags )
-      otl_base_tag_list_validate   ( table + tags );
-
-    otl_base_script_list_validate( table + OTL_NEXT_USHORT( p ) );
-  }
-
-
-  OTL_LOCALDEF( void )
-  otl_base_validate( OTL_Bytes      table,
-                     OTL_Validator  valid )
-  {
-    OTL_Bytes p = table;
-
-    OTL_CHECK(6);
-
-    if ( OTL_NEXT_ULONG( p ) != 0x10000UL )
-      OTL_INVALID_DATA;
-
-    otl_axis_table_validate( table + OTL_NEXT_USHORT( p ) );
-    otl_axis_table_validate( table + OTL_NEXT_USHORT( p ) );
-  }

+ 0 - 14
sys/src/libfreetype/src/otlayout/otlbase.h

@@ -1,14 +0,0 @@
-#ifndef __OTL_BASE_H__
-#define __OTL_BASE_H__
-
-#include "otlayout.h"
-
-OTL_BEGIN_HEADER
-
-  OTL_LOCAL( void )
-  otl_base_validate( OTL_Bytes      table,
-                     OTL_Validator  valid );
-
-OTL_END_HEADER
-
-#endif /* __OTL_BASE_H__ */

+ 0 - 940
sys/src/libfreetype/src/otlayout/otlcommn.c

@@ -1,940 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  otlcommn.c                                                             */
-/*                                                                         */
-/*    OpenType layout support, common tables (body).                       */
-/*                                                                         */
-/*  Copyright 2002 by                                                      */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-
-#include "otlayout.h"
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*****                                                               *****/
- /*****                       COVERAGE TABLE                          *****/
- /*****                                                               *****/
- /*************************************************************************/
- /*************************************************************************/
-
-  OTL_LOCALDEF( void )
-  otl_coverage_validate( OTL_Bytes      table,
-                         OTL_Validator  valid )
-  {
-    OTL_Bytes  p;
-    OTL_UInt   format;
-
-
-    if ( table + 4 > valid->limit )
-      OTL_INVALID_TOO_SHORT;
-
-    format = OTL_NEXT_USHORT( p );
-    switch ( format )
-    {
-    case 1:
-      {
-        OTL_UInt  count = OTL_NEXT_USHORT( p );
-
-
-        if ( p + count * 2 >= valid->limit )
-          OTL_INVALID_TOO_SHORT;
-
-        /* XXX: check glyph indices */
-      }
-      break;
-
-    case 2:
-      {
-        OTL_UInt  n, num_ranges = OTL_NEXT_USHORT( p );
-        OTL_UInt  start, end, start_cover, total = 0, last = 0;
-
-
-        if ( p + num_ranges * 6 >= valid->limit )
-          OTL_INVALID_TOO_SHORT;
-
-        for ( n = 0; n < num_ranges; n++ )
-        {
-          start       = OTL_NEXT_USHORT( p );
-          end         = OTL_NEXT_USHORT( p );
-          start_cover = OTL_NEXT_USHORT( p );
-
-          if ( start > end || start_cover != total )
-            OTL_INVALID_DATA;
-
-          if ( n > 0 && start <= last )
-            OTL_INVALID_DATA;
-
-          total += end - start + 1;
-          last   = end;
-        }
-      }
-      break;
-
-    default:
-      OTL_INVALID_FORMAT;
-    }
-  }
-
-
-  OTL_LOCALDEF( OTL_UInt )
-  otl_coverage_get_count( OTL_Bytes  table )
-  {
-    OTL_Bytes  p      = table;
-    OTL_UInt   format = OTL_NEXT_USHORT( p );
-    OTL_UInt   count  = OTL_NEXT_USHORT( p );
-    OTL_UInt   result = 0;
-
-
-    switch ( format )
-    {
-    case 1:
-      return count;
-
-    case 2:
-      {
-        OTL_UInt  start, end;
-
-
-        for ( ; count > 0; count-- )
-        {
-          start = OTL_NEXT_USHORT( p );
-          end   = OTL_NEXT_USHORT( p );
-          p    += 2;                    /* skip start_index */
-
-          result += end - start + 1;
-        }
-      }
-      break;
-
-    default:
-      ;
-    }
-
-    return result;
-  }
-
-
-  OTL_LOCALDEF( OTL_Int )
-  otl_coverage_get_index( OTL_Bytes  table,
-                          OTL_UInt   glyph_index )
-  {
-    OTL_Bytes  p      = table;
-    OTL_UInt   format = OTL_NEXT_USHORT( p );
-    OTL_UInt   count  = OTL_NEXT_USHORT( p );
-
-
-    switch ( format )
-    {
-    case 1:
-      {
-        OTL_UInt  min = 0, max = count, mid, gindex;
-
-
-        table += 4;
-        while ( min < max )
-        {
-          mid    = ( min + max ) >> 1;
-          p      = table + 2 * mid;
-          gindex = OTL_PEEK_USHORT( p );
-
-          if ( glyph_index == gindex )
-            return (OTL_Int)mid;
-
-          if ( glyph_index < gindex )
-            max = mid;
-          else
-            min = mid + 1;
-        }
-      }
-      break;
-
-    case 2:
-      {
-        OTL_UInt  min = 0, max = count, mid;
-        OTL_UInt  start, end, delta, start_cover;
-
-
-        table += 4;
-        while ( min < max )
-        {
-          mid    = ( min + max ) >> 1;
-          p      = table + 6 * mid;
-          start  = OTL_NEXT_USHORT( p );
-          end    = OTL_NEXT_USHORT( p );
-
-          if ( glyph_index < start )
-            max = mid;
-          else if ( glyph_index > end )
-            min = mid + 1;
-          else
-            return (OTL_Int)( glyph_index + OTL_NEXT_USHORT( p ) - start );
-        }
-      }
-      break;
-
-    default:
-      ;
-    }
-
-    return -1;
-  }
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                  CLASS DEFINITION TABLE                       *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-  OTL_LOCALDEF( void )
-  otl_class_definition_validate( OTL_Bytes      table,
-                                 OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   format;
-
-
-    if ( p + 4 > valid->limit )
-      OTL_INVALID_TOO_SHORT;
-
-    format = OTL_NEXT_USHORT( p );
-    switch ( format )
-    {
-    case 1:
-      {
-        OTL_UInt  count, start = OTL_NEXT_USHORT( p );
-
-
-        if ( p + 2 > valid->limit )
-          OTL_INVALID_TOO_SHORT;
-
-        count = OTL_NEXT_USHORT( p );
-
-        if ( p + count * 2 > valid->limit )
-          OTL_INVALID_TOO_SHORT;
-
-        /* XXX: check glyph indices */
-      }
-      break;
-
-    case 2:
-      {
-        OTL_UInt  n, num_ranges = OTL_NEXT_USHORT( p );
-        OTL_UInt  start, end, value, last = 0;
-
-
-        if ( p + num_ranges * 6 > valid->limit )
-          OTL_INVALID_TOO_SHORT;
-
-        for ( n = 0; n < num_ranges; n++ )
-        {
-          start = OTL_NEXT_USHORT( p );
-          end   = OTL_NEXT_USHORT( p );
-          value = OTL_NEXT_USHORT( p );  /* ignored */
-
-          if ( start > end || ( n > 0 && start <= last ) )
-            OTL_INVALID_DATA;
-
-          last = end;
-        }
-      }
-      break;
-
-    default:
-      OTL_INVALID_FORMAT;
-    }
-  }
-
-
-  OTL_LOCALDEF( OTL_UInt )
-  otl_class_definition_get_value( OTL_Bytes  table,
-                                  OTL_UInt   glyph_index )
-  {
-    OTL_Bytes  p      = table;
-    OTL_UInt   format = OTL_NEXT_USHORT( p );
-
-
-    switch ( format )
-    {
-    case 1:
-      {
-        OTL_UInt  start = OTL_NEXT_USHORT( p );
-        OTL_UInt  count = OTL_NEXT_USHORT( p );
-        OTL_UInt  idx   = (OTL_UInt)( glyph_index - start );
-
-
-        if ( idx < count )
-        {
-          p += 2 * idx;
-          return OTL_PEEK_USHORT( p );
-        }
-      }
-      break;
-
-    case 2:
-      {
-        OTL_UInt  count = OTL_NEXT_USHORT( p );
-        OTL_UInt  min = 0, max = count, mid, gindex;
-
-
-        table += 4;
-        while ( min < max )
-        {
-          mid   = ( min + max ) >> 1;
-          p     = table + 6 * mid;
-          start = OTL_NEXT_USHORT( p );
-          end   = OTL_NEXT_USHORT( p );
-
-          if ( glyph_index < start )
-            max = mid;
-          else if ( glyph_index > end )
-            min = mid + 1;
-          else
-            return OTL_PEEK_USHORT( p );
-        }
-      }
-      break;
-
-    default:
-      ;
-    }
-
-    return 0;
-  }
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                      DEVICE TABLE                             *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-  OTL_LOCALDEF( void )
-  otl_device_table_validate( OTL_Bytes      table,
-                             OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   start, end, count, format, count;
-
-
-    if ( p + 8 > valid->limit )
-      OTL_INVALID_TOO_SHORT;
-
-    start  = OTL_NEXT_USHORT( p );
-    end    = OTL_NEXT_USHORT( p );
-    format = OTL_NEXT_USHORT( p );
-
-    if ( format < 1 || format > 3 || end < start )
-      OTL_INVALID_DATA;
-
-    count = (OTL_UInt)( end - start + 1 );
-
-    if ( p + ( ( 1 << format ) * count ) / 8 > valid->limit )
-      OTL_INVALID_TOO_SHORT;
-  }
-
-
-  OTL_LOCALDEF( OTL_UInt )
-  otl_device_table_get_start( OTL_Bytes  table )
-  {
-    OTL_Bytes  p = table;
-
-
-    return OTL_PEEK_USHORT( p );
-  }
-
-
-  OTL_LOCALDEF( OTL_UInt )
-  otl_device_table_get_end( OTL_Bytes  table )
-  {
-    OTL_Bytes  p = table + 2;
-
-
-    return OTL_PEEK_USHORT( p );
-  }
-
-
-  OTL_LOCALDEF( OTL_Int )
-  otl_device_table_get_delta( OTL_Bytes  table,
-                              OTL_UInt   size )
-  {
-    OTL_Bytes  p = table;
-    OTL_Int    result = 0;
-    OTL_UInt   start, end, format, idx, value;
-
-
-    start  = OTL_NEXT_USHORT( p );
-    end    = OTL_NEXT_USHORT( p );
-    format = OTL_NEXT_USHORT( p );
-
-    if ( size >= start && size <= end )
-    {
-      /* we could do that with clever bit operations, but a switch is */
-      /* much simpler to understand and maintain                      */
-      /*                                                              */
-      switch ( format )
-      {
-      case 1:
-        idx    = (OTL_UInt)( ( size - start ) * 2 );
-        p     += idx / 16;
-        value  = OTL_PEEK_USHORT( p );
-        shift  = idx & 15;
-        result = (OTL_Short)( value << shift ) >> ( 14 - shift );
-
-        break;
-
-      case 2:
-        idx    = (OTL_UInt)( ( size - start ) * 4 );
-        p     += idx / 16;
-        value  = OTL_PEEK_USHORT( p );
-        shift  = idx & 15;
-        result = (OTL_Short)( value << shift ) >> ( 12 - shift );
-
-        break;
-
-      case 3:
-        idx    = (OTL_UInt)( ( size - start ) * 8 );
-        p     += idx / 16;
-        value  = OTL_PEEK_USHORT( p );
-        shift  = idx & 15;
-        result = (OTL_Short)( value << shift ) >> ( 8 - shift );
-
-        break;
-
-      default:
-        ;
-      }
-    }
-
-    return result;
-  }
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                      LOOKUP LISTS                             *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-  OTL_LOCALDEF( void )
-  otl_lookup_validate( OTL_Bytes      table,
-                       OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   num_tables;
-
-
-    if ( table + 6 > valid->limit )
-      OTL_INVALID_TOO_SHORT;
-
-    p += 4;
-    num_tables = OTL_NEXT_USHORT( p );
-
-    if ( p + num_tables * 2 > valid->limit )
-      OTL_INVALID_TOO_SHORT;
-
-    for ( ; num_tables > 0; num_tables-- )
-    {
-      offset = OTL_NEXT_USHORT( p );
-
-      if ( table + offset >= valid->limit )
-        OTL_INVALID_OFFSET;
-    }
-
-    /* XXX: check sub-tables? */
-  }
-
-
-  OTL_LOCALDEF( OTL_UInt )
-  otl_lookup_get_count( OTL_Bytes  table )
-  {
-    OTL_Bytes  p = table + 4;
-
-
-    return OTL_PEEK_USHORT( p );
-  }
-
-
-  OTL_LOCALDEF( OTL_Bytes )
-  otl_lookup_get_table( OTL_Bytes  table,
-                        OTL_UInt   idx )
-  {
-    OTL_Bytes  p, result = NULL;
-    OTL_UInt   count;
-
-
-    p     = table + 4;
-    count = OTL_NEXT_USHORT( p );
-    if ( idx < count )
-    {
-      p     += idx * 2;
-      result = table + OTL_PEEK_USHORT( p );
-    }
-
-    return result;
-  }
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                      LOOKUP LISTS                             *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-  OTL_LOCALDEF( void )
-  otl_lookup_list_validate( OTL_Bytes      table,
-                            OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table, q;
-    OTL_UInt   num_lookups, offset;
-
-
-    if ( p + 2 > valid->limit )
-      OTL_INVALID_TOO_SHORT;
-
-    num_lookups = OTL_NEXT_USHORT( p );
-
-    if ( p + num_lookups * 2 > valid->limit )
-      OTL_INVALID_TOO_SHORT;
-
-    for ( ; num_lookups > 0; num_lookups-- )
-    {
-      offset = OTL_NEXT_USHORT( p );
-
-      otl_lookup_validate( table + offset, valid );
-    }
-  }
-
-
-  OTL_LOCALDEF( OTL_UInt )
-  otl_lookup_list_get_count( OTL_Bytes  table )
-  {
-    OTL_Bytes  p = table;
-
-
-    return OTL_PEEK_USHORT( p );
-  }
-
-
-  OTL_LOCALDEF( OTL_Bytes )
-  otl_lookup_list_get_lookup( OTL_Bytes  table,
-                              OTL_UInt   idx )
-  {
-    OTL_Bytes  p, result = 0;
-    OTL_UInt   count;
-
-
-    p     = table;
-    count = OTL_NEXT_USHORT( p );
-    if ( idx < count )
-    {
-      p     += idx * 2;
-      result = table + OTL_PEEK_USHORT( p );
-    }
-
-    return result;
-  }
-
-
-  OTL_LOCALDEF( OTL_Bytes )
-  otl_lookup_list_get_table( OTL_Bytes  table,
-                             OTL_UInt   lookup_index,
-                             OTL_UInt   table_index )
-  {
-    OTL_Bytes  result = NULL;
-
-
-    result = otl_lookup_list_get_lookup( table, lookup_index );
-    if ( result )
-      result = otl_lookup_get_table( result, table_index );
-
-    return result;
-  }
-
-
-  OTL_LOCALDEF( void )
-  otl_lookup_list_foreach( OTL_Bytes        table,
-                           OTL_ForeachFunc  func,
-                           OTL_Pointer      func_data )
-  {
-    OTL_Bytes  p     = table;
-    OTL_UInt   count = OTL_NEXT_USHORT( p );
-
-
-    for ( ; count > 0; count-- )
-      func( table + OTL_NEXT_USHORT( p ), func_data );
-  }
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                        FEATURES                               *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-  OTL_LOCALDEF( void )
-  otl_feature_validate( OTL_Bytes      table,
-                        OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   feat_params, num_lookups;
-
-
-    if ( p + 4 > valid->limit )
-      OTL_INVALID_TOO_SHORT;
-
-    feat_params = OTL_NEXT_USHORT( p );  /* ignored */
-    num_lookups = OTL_NEXT_USHORT( p );
-
-    if ( p + num_lookups * 2 > valid->limit )
-      OTL_INVALID_TOO_SHORT;
-
-    /* XXX: check lookup indices */
-  }
-
-
-  OTL_LOCALDEF( OTL_UInt )
-  otl_feature_get_count( OTL_Bytes  table )
-  {
-    OTL_Bytes  p = table + 4;
-
-
-    return OTL_PEEK_USHORT( p );
-  }
-
-
-  OTL_LOCALDEF( OTL_UInt )
-  otl_feature_get_lookups( OTL_Bytes  table,
-                           OTL_UInt   start,
-                           OTL_UInt   count,
-                           OTL_UInt  *lookups )
-  {
-    OTL_Bytes  p;
-    OTL_UInt   num_features, result = 0;
-
-
-    p            = table + 4;
-    num_features = OTL_NEXT_USHORT( p );
-
-    p += start * 2;
-
-    for ( ; count > 0 && start < num_features; count--, start++ )
-    {
-      lookups[0] = OTL_NEXT_USHORT(p);
-      lookups++;
-      result++;
-    }
-
-    return result;
-  }
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                        FEATURE LIST                           *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-  OTL_LOCALDEF( void )
-  otl_feature_list_validate( OTL_Bytes      table,
-                             OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   num_features, offset;
-
-
-    if ( table + 2 > valid->limit )
-      OTL_INVALID_TOO_SHORT;
-
-    num_features = OTL_NEXT_USHORT( p );
-
-    if ( p + num_features * 2 > valid->limit )
-      OTL_INVALID_TOO_SHORT;
-
-    for ( ; num_features > 0; num_features-- )
-    {
-      p     += 4;                       /* skip tag */
-      offset = OTL_NEXT_USHORT( p );
-
-      otl_feature_table_validate( table + offset, valid );
-    }
-  }
-
-
-  OTL_LOCALDEF( OTL_UInt )
-  otl_feature_list_get_count( OTL_Bytes  table )
-  {
-    OTL_Bytes  p = table;
-
-
-    return OTL_PEEK_USHORT( p );
-  }
-
-
-  OTL_LOCALDEF( OTL_Bytes )
-  otl_feature_list_get_feature( OTL_Bytes  table,
-                                OTL_UInt   idx )
-  {
-    OTL_Bytes  p, result = NULL;
-    OTL_UInt   count;
-
-
-    p     = table;
-    count = OTL_NEXT_USHORT( p );
-
-    if ( idx < count )
-    {
-      p     += idx * 2;
-      result = table + OTL_PEEK_USHORT( p );
-    }
-
-    return result;
-  }
-
-
-  OTL_LOCALDEF( void )
-  otl_feature_list_foreach( OTL_Bytes        table,
-                            OTL_ForeachFunc  func,
-                            OTL_Pointer      func_data )
-  {
-    OTL_Bytes  p;
-    OTL_UInt   count;
-
-
-    p = table;
-    count = OTL_NEXT_USHORT( p );
-
-    for ( ; count > 0; count-- )
-      func( table + OTL_NEXT_USHORT( p ), func_data );
-  }
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                       LANGUAGE SYSTEM                         *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-
-  OTL_LOCALDEF( void )
-  otl_lang_validate( OTL_Bytes      table,
-                     OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   lookup_order;
-    OTL_UInt   req_feature;
-    OTL_UInt   num_features;
-
-
-    if ( table + 6 >= valid->limit )
-      OTL_INVALID_TOO_SHORT;
-
-    lookup_order = OTL_NEXT_USHORT( p );
-    req_feature  = OTL_NEXT_USHORT( p );
-    num_features = OTL_NEXT_USHORT( p );
-
-    /* XXX: check req_feature if not 0xFFFFU */
-
-    if ( p + 2 * num_features >= valid->limit )
-      OTL_INVALID_TOO_SHORT;
-
-    /* XXX: check features indices! */
-  }
-
-
-  OTL_LOCALDEF( OTL_UInt )
-  otl_lang_get_count( OTL_Bytes  table )
-  {
-    OTL_Bytes  p = table + 4;
-
-    return OTL_PEEK_USHORT( p );
-  }
-
-
-  OTL_LOCALDEF( OTL_UInt )
-  otl_lang_get_req_feature( OTL_Bytes  table )
-  {
-    OTL_Bytes  p = table + 2;
-
-
-    return OTL_PEEK_USHORT( p );
-  }
-
-
-  OTL_LOCALDEF( OTL_UInt )
-  otl_lang_get_features( OTL_Bytes  table,
-                         OTL_UInt   start,
-                         OTL_UInt   count,
-                         OTL_UInt  *features )
-  {
-    OTL_Bytes  p            = table + 4;
-    OTL_UInt   num_features = OTL_NEXT_USHORT( p );
-    OTL_UInt   result       = 0;
-
-
-    p += start * 2;
-
-    for ( ; count > 0 && start < num_features; start++, count-- )
-    {
-      features[0] = OTL_NEXT_USHORT( p );
-      features++;
-      result++;
-    }
-
-    return result;
-  }
-
-
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                           SCRIPTS                             *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-
-  OTL_LOCALDEF( void )
-  otl_script_validate( OTL_Bytes      table,
-                       OTL_Validator  valid )
-  {
-    OTL_UInt   default_lang;
-    OTL_Bytes  p = table;
-
-
-    if ( table + 4 > valid->limit )
-      OTL_INVALID_TOO_SHORT;
-
-    default_lang = OTL_NEXT_USHORT( p );
-    num_langs    = OTL_NEXT_USHORT( p );
-
-    if ( default_lang != 0 )
-    {
-      if ( table + default_lang >= valid->limit )
-        OTL_INVALID_OFFSET;
-    }
-
-    if ( p + num_langs * 6 >= valid->limit )
-      OTL_INVALID_OFFSET;
-
-    for ( ; num_langs > 0; num_langs-- )
-    {
-      OTL_UInt  offset;
-
-
-      p     += 4;  /* skip tag */
-      offset = OTL_NEXT_USHORT( p );
-
-      otl_lang_validate( table + offset, valid );
-    }
-  }
-
-
-  OTL_LOCALDEF( void )
-  otl_script_list_validate( OTL_Bytes      list,
-                            OTL_Validator  valid )
-  {
-    OTL_UInt   num_scripts;
-    OTL_Bytes  p = list;
-
-
-    if ( list + 2 > valid->limit )
-      OTL_INVALID_TOO_SHORT;
-
-    num_scripts = OTL_NEXT_USHORT( p );
-
-    if ( p + num_scripts * 6 > valid->limit )
-      OTL_INVALID_TOO_SHORT;
-
-    for ( ; num_scripts > 0; num_scripts-- )
-    {
-      OTL_UInt  offset;
-
-
-      p     += 4;                       /* skip tag */
-      offset = OTL_NEXT_USHORT( p );
-
-      otl_script_table_validate( list + offset, valid );
-    }
-  }
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                         LOOKUP LISTS                          *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-  static void
-  otl_lookup_table_validate( OTL_Bytes          table,
-                             OTL_UInt           type_count,
-                             OTL_ValidateFunc*  type_funcs,
-                             OTL_Validator      valid )
-  {
-    OTL_Bytes         p = table;
-    OTL_UInt          lookup_type, lookup_flag, count;
-    OTL_ValidateFunc  validate;
-
-    OTL_CHECK( 6 );
-    lookup_type = OTL_NEXT_USHORT( p );
-    lookup_flag = OTL_NEXT_USHORT( p );
-    count       = OTL_NEXT_USHORT( p );
-
-    if ( lookup_type == 0 || lookup_type >= type_count )
-      OTL_INVALID_DATA;
-
-    validate = type_funcs[ lookup_type - 1 ];
-
-    OTL_CHECK( 2*count );
-    for ( ; count > 0; count-- )
-      validate( table + OTL_NEXT_USHORT( p ), valid );
-  }
-
-
-  OTL_LOCALDEF( void )
-  otl_lookup_list_validate( OTL_Bytes          table,
-                            OTL_UInt           type_count,
-                            OTL_ValidateFunc*  type_funcs,
-                            OTL_Validator      valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count;
-
-    OTL_CHECK( 2 );
-    count = OTL_NEXT_USHORT( p );
-
-    OTL_CHECK( 2*count );
-    for ( ; count > 0; count-- )
-      otl_lookup_table_validate( table + OTL_NEXT_USHORT( p ),
-                                 type_count, type_funcs, valid );
-  }
-
-/* END */

+ 0 - 277
sys/src/libfreetype/src/otlayout/otlcommn.h

@@ -1,277 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  otlcommn.h                                                             */
-/*                                                                         */
-/*    OpenType layout support, common tables (specification).              */
-/*                                                                         */
-/*  Copyright 2002 by                                                      */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-
-#ifndef __OTLCOMMN_H__
-#define __OTLCOMMN_H__
-
-#include "otlayout.h"
-
-OTL_BEGIN_HEADER
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                       COVERAGE TABLE                          *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-  /* validate coverage table */
-  OTL_LOCALDEF( void )
-  otl_coverage_validate( OTL_Bytes      base,
-                         OTL_Validator  valid );
-
-  /* return number of covered glyphs */
-  OTL_LOCALDEF( OTL_UInt )
-  otl_coverage_get_count( OTL_Bytes  base );
-
-  /* Return the coverage index corresponding to a glyph glyph index. */
-  /* Return -1 if the glyph isn't covered.                           */
-  OTL_LOCALDEF( OTL_Int )
-  otl_coverage_get_index( OTL_Bytes  base,
-                          OTL_UInt   glyph_index );
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                  CLASS DEFINITION TABLE                       *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-  /* validate class definition table */
-  OTL_LOCALDEF( void )
-  otl_class_definition_validate( OTL_Bytes      table,
-                                 OTL_Validator  valid );
-
-  /* return class value for a given glyph index */
-  OTL_LOCALDEF( OTL_UInt )
-  otl_class_definition_get_value( OTL_Bytes  table,
-                                  OTL_UInt   glyph_index );
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                      DEVICE TABLE                             *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-  /* validate a device table */
-  OTL_LOCALDEF( void )
-  otl_device_table_validate( OTL_Bytes      table,
-                             OTL_Validator  valid );
-
-  /* return a device table's first size */
-  OTL_LOCALDEF( OTL_UInt )
-  otl_device_table_get_start( OTL_Bytes  table );
-
-  /* return a device table's last size */
-  OTL_LOCALDEF( OTL_UInt )
-  otl_device_table_get_end( OTL_Bytes  table );
-
-  /* return pixel adjustment for a given size */
-  OTL_LOCALDEF( OTL_Int )
-  otl_device_table_get_delta( OTL_Bytes  table,
-                              OTL_UInt   size );
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                           LOOKUPS                             *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-  /* validate lookup table */
-  OTL_LOCALDEF( void )
-  otl_lookup_validate( OTL_Bytes      table,
-                       OTL_Validator  valid );
-
-  /* return number of sub-tables in a lookup */
-  OTL_LOCALDEF( OTL_UInt )
-  otl_lookup_get_count( OTL_Bytes  table );
-
-
-  /* return lookup sub-table */
-  OTL_LOCALDEF( OTL_Bytes )
-  otl_lookup_get_table( OTL_Bytes  table,
-                        OTL_UInt   idx );
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                      LOOKUP LISTS                             *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-  /* validate lookup list */
-  OTL_LOCALDEF( void )
-  otl_lookup_list_validate( OTL_Bytes      table,
-                            OTL_Validator  valid );
-
-  /* return number of lookups in list */
-  OTL_LOCALDEF( OTL_UInt )
-  otl_lookup_list_get_count( OTL_Bytes  table );
-
-  /* return a given lookup from a list */
-  OTL_LOCALDEF( OTL_Bytes )
-  otl_lookup_list_get_lookup( OTL_Bytes  table,
-                              OTL_UInt   idx );
-
-  /* return lookup sub-table from a list */
-  OTL_LOCALDEF( OTL_Bytes )
-  otl_lookup_list_get_table( OTL_Bytes  table,
-                             OTL_UInt   lookup_index,
-                             OTL_UInt   table_index );
-
-  /* iterate over lookup list */
-  OTL_LOCALDEF( void )
-  otl_lookup_list_foreach( OTL_Bytes        table,
-                           OTL_ForeachFunc  func,
-                           OTL_Pointer      func_data );
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                        FEATURES                               *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-  /* validate feature table */
-  OTL_LOCALDEF( void )
-  otl_feature_validate( OTL_Bytes      table,
-                        OTL_Validator  valid );
-
-  /* return feature's lookup count */
-  OTL_LOCALDEF( OTL_UInt )
-  otl_feature_get_count( OTL_Bytes  table );
-
-  /* get several lookups indices from a feature. returns the number of */
-  /* lookups grabbed                                                   */
-  OTL_LOCALDEF( OTL_UInt )
-  otl_feature_get_lookups( OTL_Bytes  table,
-                           OTL_UInt   start,
-                           OTL_UInt   count,
-                           OTL_UInt  *lookups );
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                        FEATURE LIST                           *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-  /* validate a feature list */
-  OTL_LOCALDEF( void )
-  otl_feature_list_validate( OTL_Bytes      table,
-                             OTL_Validator  valid );
-
-  /* return number of features in list */
-  OTL_LOCALDEF( OTL_UInt )
-  otl_feature_list_get_count( OTL_Bytes  table );
-
-
-  /* return a given feature from a list */
-  OTL_LOCALDEF( OTL_Bytes )
-  otl_feature_list_get_feature( OTL_Bytes  table,
-                                OTL_UInt   idx );
-
-  /* iterate over all features in a list */
-  OTL_LOCALDEF( void )
-  otl_feature_list_foreach( OTL_Bytes        table,
-                            OTL_ForeachFunc  func,
-                            OTL_Pointer      func_data );
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                       LANGUAGE SYSTEM                         *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-  OTL_LOCAL( void )
-  otl_lang_validate( OTL_Bytes      table,
-                     OTL_Validator  valid );
-
-
-  OTL_LOCAL( OTL_UInt )
-  otl_lang_get_req_feature( OTL_Bytes  table );
-
-
-  OTL_LOCAL( OTL_UInt )
-  otl_lang_get_count( OTL_Bytes  table );
-
-
-  OTL_LOCAL( OTL_UInt )
-  otl_lang_get_features( OTL_Bytes  table,
-                         OTL_UInt   start,
-                         OTL_UInt   count,
-                         OTL_UInt  *features );
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                           SCRIPTS                             *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-  OTL_LOCAL( void )
-  otl_script_list_validate( OTL_Bytes          list,
-                            OTL_Validator      valid );
-
-  OTL_LOCAL( OTL_Bytes )
-  otl_script_list_get_script( OTL_Bytes  table );
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                         LOOKUP LISTS                          *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-  OTL_LOCAL( void )
-  otl_lookup_list_validate( OTL_Bytes          list,
-                            OTL_UInt           type_count,
-                            OTL_ValidateFunc*  type_funcs,
-                            OTL_Validator      valid );
-
- /* */
-
-OTL_END_HEADER
-
-#endif /* __OTLCOMMN_H__ */
-
-
-/* END */

+ 0 - 78
sys/src/libfreetype/src/otlayout/otlconf.h

@@ -1,78 +0,0 @@
-#ifndef __OT_LAYOUT_CONFIG_H__
-#define __OT_LAYOUT_CONFIG_H__
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                    CONFIGURATION MACROS                      *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-#ifdef __cplusplus
-#  define OTL_BEGIN_HEADER  extern "C" {
-#else
-#  define OTL_BEGIN_HEADER  /* nothing */
-#endif
-
-#ifdef __cplusplus
-#  define OTL_END_HEADER   }
-#else
-#  define OTL_END_HEADER   /* nothing */
-#endif
-
-#ifndef OTL_API
-#  ifdef __cplusplus
-#    define  OTL_API( x )   extern "C"
-#  else
-#    define  OTL_API( x )   extern x
-#  endif
-#endif
-
-#ifndef OTL_APIDEF
-#  define  OTL_APIDEF( x )  x
-#endif
-
-#ifndef OTL_LOCAL
-#  define OTL_LOCAL( x )   extern x
-#endif
-
-#ifndef OTL_LOCALDEF
-#  define OTL_LOCALDEF( x )  x
-#endif
-
-#define  OTL_BEGIN_STMNT  do {
-#define  OTL_END_STMNT    } while (0)
-#define  OTL_DUMMY_STMNT  OTL_BEGIN_STMNT OTL_END_STMNT
-
-#define  OTL_UNUSED( x )       (x)=(x)
-#define  OTL_UNUSED_CONST(x)   (void)(x)
-
-
-#include <limits.h>
-#if UINT_MAX == 0xFFFFU
-#  define OTL_SIZEOF_INT  2
-#elif UINT_MAX == 0xFFFFFFFFU
-#  define OTL_SIZEOF_INT  4
-#elif UINT_MAX > 0xFFFFFFFFU && UINT_MAX == 0xFFFFFFFFFFFFFFFFU
-#  define OTL_SIZEOF_INT  8
-#else
-#  error  "unsupported number of bytes in 'int' type!"
-#endif
-
-#if ULONG_MAX == 0xFFFFFFFFU
-#  define  OTL_SIZEOF_LONG  4
-#elif ULONG_MAX > 0xFFFFFFFFU && ULONG_MAX == 0xFFFFFFFFFFFFFFFFU
-#  define  OTL_SIZEOF_LONG  8
-#else
-#  error  "unsupported number of bytes in 'long' type!"
-#endif
-
-#include <setjmp.h>
-#define  OTL_jmp_buf   jmp_buf
-#define  otl_setjmp    setjmp
-#define  otl_longjmp   longjmp
-
-/* */
-
-#endif /* __OT_LAYOUT_CONFIG_H__ */

+ 0 - 175
sys/src/libfreetype/src/otlayout/otlgdef.c

@@ -1,175 +0,0 @@
-#include "otlgdef.h"
-#include "otlcommn.h"
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                      ATTACHMENTS LIST                        *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-  static void
-  otl_attach_point_validate( OTL_Bytes      table,
-                             OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count;
-
-    if ( p + 2 > valid->limit )
-      OTL_INVALID_TOO_SHORT;
-
-    count = OTL_NEXT_USHORT( p );
-    if ( table + count*2 > valid->limit )
-      OTL_INVALID_TOO_SHORT;
-  }
-
-
-  static void
-  otl_attach_list_validate( OTL_Bytes      table,
-                            OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_Bytes  coverage;
-    OTL_UInt   count;
-
-    if ( p + 4 > valid->limit )
-      OTL_INVALID_TOO_SHORT;
-
-    coverage = table + OTL_NEXT_USHORT( p );
-    count    = OTL_NEXT_USHORT( p );
-
-    otl_coverage_validate( coverage, valid );
-    if ( count != otl_coverage_get_count( coverage ) )
-      OTL_INVALID_DATA;
-
-    if ( p + count*2 > valid->limit )
-      OTL_INVALID_TOO_SHORT;
-
-    for ( ; count > 0; count-- )
-      otl_attach_point_validate( table + OTL_NEXT_USHORT( p ) );
-  }
-
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                      LIGATURE CARETS                         *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-  static void
-  otl_caret_value_validate( OTL_Bytes      table,
-                            OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-
-    if ( p + 4 > valid->limit )
-      OTL_INVALID_TOO_SHORT;
-
-    format = OTL_NEXT_USHORT( p );
-    switch ( format )
-    {
-      case 1:
-      case 2:
-        break;
-
-      case 3:
-        {
-          OTL_Bytes  device;
-
-          p += 2;
-          if ( p + 2 > valid->limit )
-            OTL_INVALID_TOO_SHORT;
-
-          otl_device_table_validate( table + OTL_PEEK_USHORT( p ) );
-        }
-        break;
-
-      default:
-        OTL_INVALID_DATA;
-    }
-  }
-
-
-  static void
-  otl_ligature_glyph_validate( OTL_Bytes      table,
-                               OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count;
-
-    if ( p + 2 > valid->limit )
-      OTL_INVALID_TOO_SHORT;
-
-    count = OTL_NEXT_USHORT( p );
-
-    if ( p + count*2 > valid->limit )
-      OTL_INVALID_TOO_SHORT;
-
-    for ( ; count > 0; count-- )
-      otl_caret_value_validate( table + OTL_NEXT_USHORT( p ) );
-  }
-
-
-  static void
-  otl_ligature_caret_list_validate( OTL_Bytes      table,
-                                    OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_Bytes  coverage;
-    OTL_UInt   count;
-
-    if ( p + 4 > valid->limit )
-      OTL_INVALID_TOO_SHORT;
-
-    coverage = table + OTL_NEXT_USHORT( p );
-    count    = OTL_NEXT_USHORT( p );
-
-    otl_coverage_validate( coverage, valid );
-    if ( count != otl_coverage_get_count( coverage ) )
-      OTL_INVALID_DATA;
-
-    if ( p + count*2 > valid->limit )
-      OTL_INVALID_TOO_SHORT;
-
-    for ( ; count > 0; count-- )
-      otl_ligature_glyph_validate( table + OTL_NEXT_USHORT( p ) );
-  }
-
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                         GDEF TABLE                           *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-  OTL_APIDEF( void )
-  otl_gdef_validate( OTL_Bytes      table,
-                     OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-
-    if ( p + 12 > valid->limit )
-      OTL_INVALID_TOO_SHORT;
-
-    /* check format */
-    if ( OTL_NEXT_ULONG( p ) != 0x00010000UL )
-      OTL_INVALID_FORMAT;
-
-    /* validate class definition table */
-    otl_class_definition_validate( table + OTL_NEXT_USHORT( p ) );
-
-    /* validate attachment point list */
-    otl_attach_list_validate( table + OTL_NEXT_USHORT( p ) );
-
-    /* validate ligature caret list */
-    otl_ligature_caret_list_validate( table + OTL_NEXT_USHORT( p ) );
-
-    /* validate mark attach class */
-    otl_class_definition_validate( table + OTL_NEXT_USHORT( p ) );
-  }
-

+ 0 - 14
sys/src/libfreetype/src/otlayout/otlgdef.h

@@ -1,14 +0,0 @@
-#ifndef __OTL_GDEF_H__
-#define __OTL_GDEF_H__
-
-#include "otltable.h"
-
-OTL_BEGIN_HEADER
-
-  OTL_API( void )
-  otl_gdef_validate( OTL_Bytes  table,
-                     OTL_Valid  valid );
-
-OTL_END_HEADER
-
-#endif /* __OTL_GDEF_H__ */

+ 0 - 980
sys/src/libfreetype/src/otlayout/otlgpos.c

@@ -1,980 +0,0 @@
-#include "otlgpos.h"
-#include "otlcommn.h"
-
- /* forward declaration */
-  static OTL_ValidateFunc  otl_gpos_validate_funcs[];
-
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                         VALUE RECORDS                        *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-  static OTL_UInt
-  otl_value_length( OTL_UInt  format )
-  {
-    FT_UInt  count;
-
-    count = (( format & 0xAA ) >> 1) + ( format & 0x55 );
-    count = (( count  & 0xCC ) >> 2) + ( count  & 0x33 );
-    count = (( count  & 0xF0 ) >> 4) + ( count  & 0x0F );
-
-    return count;
-  }
-
-
-  static void
-  otl_value_validate( OTL_Bytes      table,
-                      OTL_Bytes      pos_table,
-                      OTL_UInt       format,
-                      OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count, device;
-
-    if ( format >= 0x100U )
-      OTL_INVALID_DATA;
-
-    for ( count = 4; count > 0; count-- )
-    {
-      if ( format & 1 )
-      {
-        OTL_CHECK( 2 );
-        p += 2;
-      }
-
-      format >>= 1;
-    }
-
-    for ( count = 4; count > 0; count-- )
-    {
-      if ( format & 1 )
-      {
-        OTL_CHECK( 2 );
-        device = OTL_NEXT_USHORT( p );
-        if ( device )
-          otl_device_table_validate( pos_table + device, valid );
-      }
-      format >>= 1;
-    }
-  }
-
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                          ANCHORS                             *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-  static void
-  otl_anchor_validate( OTL_Bytes      table,
-                       OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   format;
-
-    OTL_CHECK( 6 );
-    format = OTL_NEXT_USHORT( p );
-    p += 4;
-
-    switch ( format )
-    {
-      case 1:
-        break;
-
-      case 2:
-        OTL_CHECK( 2 );  /* anchor point */
-        break;
-
-      case 3:
-        {
-          OTL_UInt  x_device, y_device;
-
-          OTL_CHECK( 4 );
-          x_device = OTL_NEXT_USHORT( p );
-          y_device = OTL_NEXT_USHORT( p );
-
-          if ( x_device )
-            otl_device_table_validate( table + x_device, valid );
-
-          if ( y_device )
-            otl_device_table_validate( table + y_device, valid );
-        }
-        break;
-
-      default:
-        OTL_INVALID_DATA;
-    }
-  }
-
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                           MARK ARRAY                         *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-  static void
-  otl_mark_array_validate( OTL_Bytes      table,
-                           OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count;
-
-    OTL_CHECK( 2 );
-
-    count = OTL_NEXT_USHORT( p );
-    OTL_CHECK( count * 4 );
-    for ( ; count > 0; count-- )
-    {
-      p += 2;  /* ignore class index */
-      otl_anchor_validate( table + OTL_NEXT_USHORT( p ), valid );
-    }
-  }
-
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                 GPOS LOOKUP TYPE 1                           *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-  static void
-  otl_gpos_lookup1_validate( OTL_Bytes      table,
-                             OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   format;
-
-    OTL_CHECK( 2 );
-    format = OTL_NEXT_USHORT( p );
-    switch ( format )
-    {
-      case 1:
-        {
-          FT_UInt  coverage, value_format;
-
-          OTL_CHECK( 4 );
-          coverage     = OTL_NEXT_USHORT( p );
-          value_format = OTL_NEXT_USHORT( p );
-
-          otl_coverage_validate( table + coverage, valid );
-          otl_value_validate( p, table, value_format, valid );
-        }
-        break;
-
-      case 2:
-        {
-          FT_UInt  coverage, value_format, count, len;
-
-          OTL_CHECK( 6 );
-          coverage     = OTL_NEXT_USHORT( p );
-          value_format = OTL_NEXT_USHORT( p );
-          count        = OTL_NEXT_USHORT( p );
-          len          = otl_value_length( value_format );
-
-          otl_coverage_validate( table + coverage, valid );
-
-          OTL_CHECK( count * len );
-          for ( ; count > 0; count-- )
-          {
-            otl_value_validate( p, table, value_format, valid );
-            p += len;
-          }
-        }
-        break;
-
-      default:
-        OTL_INVALID_DATA;
-    }
-  }
-
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                 GPOS LOOKUP TYPE 2                           *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-  static otl_gpos_pairset_validate( OTL_Bytes      table,
-                                    OTL_Bytes      pos_table,
-                                    OTL_UInt       format1,
-                                    OTL_UInt       format2,
-                                    OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   len1, len2, count;
-
-    OTL_CHECK( 2 );
-    count = OTL_NEXT_USHORT( p );
-    len1  = otl_value_length( format1 );
-    len2  = otl_value_length( format2 );
-
-    OTL_CHECK( count * (len1+len2+2) );
-    for ( ; count > 0; count-- )
-    {
-      p += 2;  /* ignore glyph id */
-      otl_value_validate( p, pos_table, format1, valid );
-      p += len1;
-
-      otl_value_validate( p, pos_table, format2, valid );
-      p += len2;
-    }
-  }
-
-  static void
-  otl_gpos_lookup2_validate( OTL_Bytes      table,
-                             OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   format;
-
-    OTL_CHECK( 2 );
-    format = OTL_NEXT_USHORT( p );
-    switch (format)
-    {
-      case 1:
-        {
-          OTL_UInt  coverage, value1, value2, count;
-
-          OTL_CHECK( 8 );
-          coverage = OTL_NEXT_USHORT( p );
-          value1   = OTL_NEXT_USHORT( p );
-          value2   = OTL_NEXT_USHORT( p );
-          count    = OTL_NEXT_USHORT( p );
-
-          otl_coverage_validate( table + coverage, valid );
-
-          OTL_CHECK( count*2 );
-          for ( ; count > 0; count-- )
-          {
-            otl_gpos_pairset_validate( table + OTL_NEXT_USHORT( p ),
-                                       table, value1, value2, valid );
-          }
-        }
-        break;
-
-      case 2:
-        {
-          OTL_UInt  coverage, value1, value2, class1, class2, count1, count2;
-          OTL_UInt  len1, len2;
-
-          OTL_CHECK( 14 );
-          coverage = OTL_NEXT_USHORT( p );
-          value1   = OTL_NEXT_USHORT( p );
-          value2   = OTL_NEXT_USHORT( p );
-          class1   = OTL_NEXT_USHORT( p );
-          class2   = OTL_NEXT_USHORT( p );
-          count1   = OTL_NEXT_USHORT( p );
-          count2   = OTL_NEXT_USHORT( p );
-
-          len1 = otl_value_length( value1 );
-          len2 = otl_value_length( value2 );
-
-          otl_coverage_validate( table + coverage, valid );
-
-          OTL_CHECK( count1*count2*(len1+len2) );
-          for ( ; count1 > 0; count1-- )
-          {
-            for ( ; count2 > 0; count2-- )
-            {
-              otl_value_validate( p, table, value1, valid );
-              p += len1;
-
-              otl_value_validate( p, table, value2, valid );
-              p += len2;
-            }
-          }
-        }
-        break;
-
-      default:
-        OTL_INVALID_DATA;
-    }
-  }
-
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                 GPOS LOOKUP TYPE 3                           *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-  static void
-  otl_gpos_lookup3_validate( OTL_Bytes  table,
-                             OTL_Valid  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   format;
-
-    OTL_CHECK( 2 );
-    format = OTL_NEXT_USHORT( p );
-    switch (format)
-    {
-      case 1:
-        {
-          OTL_UInt  coverage, count, anchor1, anchor2;
-
-          OTL_CHECK( 4 );
-          coverage = OTL_NEXT_USHORT( p );
-          count    = OTL_NEXT_USHORT( p );
-
-          otl_coverage_validate( table + coverage, valid );
-
-          OTL_CHECK( count*4 );
-          for ( ; count > 0; count-- )
-          {
-            anchor1 = OTL_NEXT_USHORT( p );
-            anchor2 = OTL_NEXT_USHORT( p );
-
-            if ( anchor1 )
-              otl_anchor_validate( table + anchor1, valid );
-
-            if ( anchor2 )
-              otl_anchor_validate( table + anchor2, valid );
-          }
-        }
-        break;
-
-      default:
-        OTL_INVALID_DATA;
-    }
-  }
-
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                 GPOS LOOKUP TYPE 4                           *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-  static void
-  otl_base_array_validate( OTL_Bytes      table,
-                           OTL_UInt       class_count,
-                           OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count, count2;
-
-    OTL_CHECK( 2 );
-    count = OTL_NEXT_USHORT( p );
-
-    OTL_CHECK( count*class_count*2 );
-    for ( ; count > 0; count-- )
-      for ( count2 = class_count; count2 > 0; count2-- )
-        otl_anchor_validate( table + OTL_NEXT_USHORT( p ) );
-  }
-
-
-  static void
-  otl_gpos_lookup4_validate( OTL_Bytes  table,
-                             OTL_Valid  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   format;
-
-    OTL_CHECK( 2 );
-    format = OTL_NEXT_USHORT( p );
-    switch (format)
-    {
-      case 1:
-        {
-          OTL_UInt  mark_coverage, base_coverage, class_count;
-          OTL_UInt  mark_array, base_array;
-
-          OTL_CHECK( 10 );
-          mark_coverage = OTL_NEXT_USHORT( p );
-          base_coverage = OTL_NEXT_USHORT( p );
-          class_count   = OTL_NEXT_USHORT( p );
-          mark_array    = OTL_NEXT_USHORT( p );
-          base_array    = OTL_NEXT_USHORT( p );
-
-          otl_coverage_validate( table + mark_coverage, valid );
-          otl_coverage_validate( table + base_coverage, valid );
-
-          otl_mark_array_validate( table + mark_array, valid );
-          otl_base_array_validate( table, class_count, valid );
-        }
-        break;
-
-      default:
-        OTL_INVALID_DATA;
-    }
-  }
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                 GPOS LOOKUP TYPE 5                           *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-  static void
-  otl_liga_attach_validate( OTL_Bytes      table,
-                            OTL_UInt       class_count,
-                            OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count, count2;
-
-    OTL_CHECK( 2 );
-    count = OTL_NEXT_USHORT( p );
-
-    OTL_CHECK( count*class_count*2 );
-    for ( ; count > 0; count-- )
-      for ( count2 = class_count; class_count > 0; class_count-- )
-        otl_anchor_validate( table + OTL_NEXT_USHORT( p ), valid );
-  }
-
-
-  static void
-  otl_liga_array_validate( OTL_Bytes      table,
-                           OTL_UInt       class_count,
-                           OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count, count2;
-
-    OTL_CHECK( 2 );
-    count = OTL_NEXT_USHORT( p );
-
-    OTL_CHECK( count*2 );
-    for ( ; count > 0; count-- )
-      otl_liga_attach_validate( table + OTL_NEXT_USHORT( p ), valid );
-  }
-
-
-  static void
-  otl_gpos_lookup5_validate( OTL_Bytes  table,
-                             OTL_Valid  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   format;
-
-    OTL_CHECK( 2 );
-    format = OTL_NEXT_USHORT( p );
-    switch (format)
-    {
-      case 1:
-        {
-          OTL_UInt  mark_coverage, lig_coverage, class_count;
-          OTL_UInt  mar_array, lig_array;
-
-          OTL_CHECK( 10 );
-          mark_coverage = OTL_NEXT_USHORT( p );
-          liga_coverage = OTL_NEXT_USHORT( p );
-          class_count   = OTL_NEXT_USHORT( p );
-          mark_array    = OTL_NEXT_USHORT( p );
-          liga_array    = OTL_NEXT_USHORT( p );
-
-          otl_coverage_validate( table + mark_coverage, valid );
-          otl_coverage_validate( table + liga_coverage, valid );
-
-          otl_mark_array_validate( table + mark_array, valid );
-          otl_liga_array_validate( table + liga_array, class_count, valid );
-        }
-        break;
-
-      default:
-        OTL_INVALID_DATA;
-    }
-  }
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                 GPOS LOOKUP TYPE 6                           *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-
-  static void
-  otl_mark2_array_validate( OTL_Bytes      table,
-                            OTL_UInt       class_count,
-                            OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count, count2;
-
-    OTL_CHECK( 2 );
-    count = OTL_NEXT_USHORT( p );
-
-    OTL_CHECK( count*class_count*2 );
-    for ( ; count > 0; count-- )
-      for ( count2 = class_count; class_count > 0; class_count-- )
-        otl_anchor_validate( table + OTL_NEXT_USHORT( p ), valid );
-  }
-
-
-  static void
-  otl_gpos_lookup6_validate( OTL_Bytes  table,
-                             OTL_Valid  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   format;
-
-    OTL_CHECK( 2 );
-    format = OTL_NEXT_USHORT( p );
-    switch (format)
-    {
-      case 1:
-        {
-          OTL_UInt  coverage1, coverage2, class_count, array1, array2;
-
-          OTL_CHECK( 10 );
-          coverage1   = OTL_NEXT_USHORT( p );
-          coverage2   = OTL_NEXT_USHORT( p );
-          class_count = OTL_NEXT_USHORT( p );
-          array1      = OTL_NEXT_USHORT( p );
-          array2      = OTL_NEXT_USHORT( p );
-
-          otl_coverage_validate( table + coverage1, valid );
-          otl_coverage_validate( table + coverage2, valid );
-
-          otl_mark_array_validate( table + array1, valid );
-          otl_mark2_array_validate( table + array2, valid );
-        }
-        break;
-
-      default:
-        OTL_INVALID_DATA;
-    }
-  }
-
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                 GPOS LOOKUP TYPE 7                           *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-  static void
-  otl_pos_rule_validate( OTL_Bytes      table,
-                         OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   glyph_count, pos_count;
-
-    OTL_CHECK( 4 );
-    glyph_count = OTL_NEXT_USHORT( p );
-    pos_count   = OTL_NEXT_USHORT( p );
-
-    if ( glyph_count == 0 )
-      OTL_INVALID_DATA;
-
-    OTL_CHECK( (glyph_count-1)*2 + pos_count*4 );
-
-    /* XXX: check glyph indices and pos lookups */
-  }
-
-
-  static void
-  otl_pos_rule_set_validate( OTL_Bytes      table,
-                             OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count;
-
-    OTL_CHECK( 2 );
-    count = OTL_NEXT_USHORT( p );
-
-    OTL_CHECK( count*2 );
-    for ( ; count > 0; count-- )
-      otl_pos_rule_validate( table + OTL_NEXT_USHORT(p), valid );
-  }
-
-
-
-  static void
-  otl_pos_class_rule_validate( OTL_Bytes      table,
-                               OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   glyph_count, pos_count;
-
-    OTL_CHECK( 4 );
-    glyph_count = OTL_NEXT_USHORT( p );
-    pos_count   = OTL_NEXT_USHORT( p );
-
-    if ( glyph_count == 0 )
-      OTL_INVALID_DATA;
-
-    OTL_CHECK( (glyph_count-1)*2 + pos_count*4 );
-
-    /* XXX: check glyph indices and pos lookups */
-  }
-
-
-  static void
-  otl_pos_class_set_validate( OTL_Bytes      table,
-                              OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count;
-
-    OTL_CHECK( 2 );
-    count = OTL_NEXT_USHORT( p );
-
-    OTL_CHECK( count*2 );
-    for ( ; count > 0; count-- )
-      otl_pos_rule_validate( table + OTL_NEXT_USHORT(p), valid );
-  }
-
-
-  static void
-  otl_gpos_lookup7_validate( OTL_Bytes      table,
-                             OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   format;
-
-    OTL_CHECK( 2 );
-    format = OTL_NEXT_USHORT( p );
-    switch (format)
-    {
-      case 1:
-        {
-          OTL_UInt  coverage, count;
-
-          OTL_CHECK( 4 );
-          coverage = OTL_NEXT_USHORT( p );
-          count    = OTL_NEXT_USHORT( p );
-
-          otl_coverage_validate( table + coverage, valid );
-
-          OTL_CHECK( count*2 );
-          for ( ; count > 0; count-- )
-            otl_pos_rule_set_validate( table + OTL_NEXT_USHORT( p ), valid );
-        }
-        break;
-
-      case 2:
-        {
-          OTL_UInt  coverage, class_def, count;
-
-          OTL_CHECK( 6 );
-          coverage  = OTL_NEXT_USHORT( p );
-          class_def = OTL_NEXT_USHORT( p );
-          count     = OTL_NEXT_USHORT( p );
-
-          otl_coverage_validate        ( table + coverage, valid );
-          otl_class_definition_validate( table + class_def, valid );
-
-          OTL_CHECK( count*2 );
-          for ( ; count > 0; count-- )
-            otl_
-        }
-        break;
-
-      case 3:
-        {
-          OTL_UInt  glyph_count, pos_count;
-
-          OTL_CHECK( 4 );
-          glyph_count = OTL_NEXT_USHORT( p );
-          pos_count   = OTL_NEXT_USHORT( p );
-
-          OTL_CHECK( glyph_count*2 + pos_count*4 );
-          for ( ; glyph_count > 0; glyph_count )
-            otl_coverage_validate( table + OTL_NEXT_USHORT( p ), valid );
-
-          /* XXX: check pos lookups */
-        }
-        break;
-
-      default:
-        OTL_INVALID_DATA;
-    }
-  }
-
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                 GPOS LOOKUP TYPE 8                           *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-  static void
-  otl_chain_pos_rule_validate( OTL_Bytes      table,
-                               OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   back_count, input_count, ahead_count, pos_count;
-
-    OTL_CHECK( 2 );
-    back_count = OTL_NEXT_USHORT( p );
-
-    OTL_CHECK( back_count*2 + 2 );
-    p += back_count*2;
-
-    input_count = OTL_NEXT_USHORT( p );
-    if ( input_count == 0 )
-      OTL_INVALID_DATA;
-
-    OTL_CHECK( input_count*2 );
-    p += (input_count-1)*2;
-
-    ahead_count = OTL_NEXT_USHORT( p );
-    OTL_CHECK( ahead_count*2 + 2 );
-    p += ahead_count*2;
-
-    pos_count = OTL_NEXT_USHORT( p );
-    OTL_CHECK( pos_count*4 );
-  }
-
-
-  static void
-  otl_chain_pos_rule_set_validate( OTL_Bytes      table,
-                                   OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count;
-
-    OTL_CHECK( 2 );
-    count = OTL_NEXT_USHORT( p );
-
-    OTL_CHECK( 2*count );
-    for ( ; count > 0; count-- )
-      otl_chain_pos_rule_validate( table + OTL_NEXT_USHORT( p ), valid );
-  }
-
-
-
-  static void
-  otl_chain_pos_class_rule_validate( OTL_Bytes      table,
-                                     OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   back_count, input_count, ahead_count, pos_count;
-
-    OTL_CHECK( 2 );
-    back_count = OTL_NEXT_USHORT( p );
-
-    OTL_CHECK( back_count*2 + 2 );
-    p += back_count*2;
-
-    input_count = OTL_NEXT_USHORT( p );
-    if ( input_count == 0 )
-      OTL_INVALID_DATA;
-
-    OTL_CHECK( input_count*2 );
-    p += (input_count-1)*2;
-
-    ahead_count = OTL_NEXT_USHORT( p );
-    OTL_CHECK( ahead_count*2 + 2 );
-    p += ahead_count*2;
-
-    pos_count = OTL_NEXT_USHORT( p );
-    OTL_CHECK( pos_count*4 );
-  }
-
-
-  static void
-  otl_chain_pos_class_set_validate( OTL_Bytes      table,
-                                   OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count;
-
-    OTL_CHECK( 2 );
-    count = OTL_NEXT_USHORT( p );
-
-    OTL_CHECK( 2*count );
-    for ( ; count > 0; count-- )
-      otl_chain_pos_class_rule_validate( table + OTL_NEXT_USHORT( p ), valid );
-  }
-
-
-  static void
-  otl_gpos_lookup8_validate( OTL_Bytes      table,
-                             OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   format;
-
-    OTL_CHECK( 2 );
-    format = OTL_NEXT_USHORT( p );
-    switch (format)
-    {
-      case 1:
-        {
-          OTL_UInt  coverage, count;
-
-          OTL_CHECK( 4 );
-          coverage = OTL_NEXT_USHORT( p );
-          count    = OTL_NEXT_USHORT( p );
-
-          otl_coverage_validate( table + coverage, valid );
-
-          OTL_CHECK( count*2 );
-          for ( ; count > 0; count-- )
-            otl_chain_pos_rule_set_validate( table + OTL_NEXT_USHORT( p ),
-                                             valid );
-        }
-        break;
-
-      case 2:
-        {
-          OTL_UInt  coverage, back_class, input_class, ahead_class, count;
-
-          OTL_CHECK( 10 );
-          coverage    = OTL_NEXT_USHORT( p );
-          back_class  = OTL_NEXT_USHORT( p );
-          input_class = OTL_NEXT_USHORT( p );
-          ahead_class = OTL_NEXT_USHORT( p );
-          count       = OTL_NEXT_USHORT( p );
-
-          otl_coverage_validate( table + coverage, valid );
-
-          otl_class_definition_validate( table + back_class,  valid );
-          otl_class_definition_validate( table + input_class, valid );
-          otl_class_definition_validate( table + ahead_class, valid );
-
-          OTL_CHECK( count*2 );
-          for ( ; count > 0; count-- )
-            otl_chain_pos_class_set_validate( table + OTL_NEXT_USHORT( p ),
-                                              valid );
-        }
-        break;
-
-      case 3:
-        {
-          OTL_UInt  back_count, input_count, ahead_count, pos_count, count;
-
-          OTL_CHECK( 2 );
-          back_count = OTL_NEXT_USHORT( p );
-
-          OTL_CHECK( 2*back_count+2 );
-          for ( count = back_count; count > 0; count-- )
-            otl_coverage_validate( table + OTL_NEXT_USHORT( p ), valid );
-
-          input_count = OTL_NEXT_USHORT( p );
-
-          OTL_CHECK( 2*input_count+2 );
-          for ( count = input_count; count > 0; count-- )
-            otl_coverage_validate( table + OTL_NEXT_USHORT( p ), valid );
-
-          ahead_count = OTL_NEXT_USHORT( p );
-
-          OTL_CHECK( 2*ahead_count+2 );
-          for ( count = ahead_count; count > 0; count-- )
-            otl_coverage_validate( table + OTL_NEXT_USHORT( p ), valid );
-
-          pos_count = OTL_NEXT_USHORT( p );
-          OTL_CHECK( pos_count*4 );
-        }
-        break;
-
-      default:
-        OTL_INVALID_DATA;
-    }
-  }
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                 GPOS LOOKUP TYPE 9                           *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-  static void
-  otl_gpos_lookup9_validate( OTL_Bytes  table,
-                             OTL_Valid  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   format;
-
-    OTL_CHECK( 2 );
-    format = OTL_NEXT_USHORT( p );
-    switch (format)
-    {
-      case 1:
-        {
-          OTL_UInt          lookup_type, lookup_offset;
-          OTL_ValidateFunc  validate;
-
-          OTL_CHECK( 6 );
-          lookup_type   = OTL_NEXT_USHORT( p );
-          lookup_offset = OTL_NEXT_ULONG( p );
-
-          if ( lookup_type == 0 || lookup_type >= 9 )
-            OTL_INVALID_DATA;
-
-          validate = otl_gpos_validate_funcs[ lookup_type-1 ];
-          validate( table + lookup_offset, valid );
-        }
-        break;
-
-      default:
-        OTL_INVALID_DATA;
-    }
-  }
-
-  static OTL_ValidateFunc  otl_gpos_validate_funcs[ 9 ] =
-  {
-    otl_gpos_lookup1_validate,
-    otl_gpos_lookup2_validate,
-    otl_gpos_lookup3_validate,
-    otl_gpos_lookup4_validate,
-    otl_gpos_lookup5_validate,
-    otl_gpos_lookup6_validate,
-    otl_gpos_lookup7_validate,
-    otl_gpos_lookup8_validate,
-    otl_gpos_lookup9_validate,
-  };
-
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                         GPOS TABLE                           *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-
-  OTL_LOCALDEF( void )
-  otl_gpos_validate( OTL_Bytes      table,
-                     OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   scripts, features, lookups;
-
-    OTL_CHECK( 10 );
-
-    if ( OTL_NEXT_USHORT( p ) != 0x10000UL )
-      OTL_INVALID_DATA;
-
-    scripts  = OTL_NEXT_USHORT( p );
-    features = OTL_NEXT_USHORT( p );
-    lookups  = OTL_NEXT_USHORT( p );
-
-    otl_script_list_validate ( table + scripts, valid );
-    otl_feature_list_validate( table + features, valid );
-
-    otl_lookup_list_validate( table + lookups, 9, otl_gpos_validate_funcs,
-                              valid );
-  }
-  

+ 0 - 14
sys/src/libfreetype/src/otlayout/otlgpos.h

@@ -1,14 +0,0 @@
-#ifndef __OTL_GPOS_H__
-#define __OTL_GPOS_H__
-
-#include "otlayout.h"
-
-OTL_BEGIN_HEADER
-
-  OTL_LOCAL( void )
-  otl_gpos_validate( OTL_Bytes      table,
-                     OTL_Validator  valid );
-
-OTL_END_HEADER
-
-#endif /* __OTL_GPOS_H__ */

+ 0 - 867
sys/src/libfreetype/src/otlayout/otlgsub.c

@@ -1,867 +0,0 @@
-#include "otlgsub.h"
-#include "otlcommn.h"
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                 GSUB LOOKUP TYPE 1                           *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
- /*
-  *  1: Single Substitution - Table format(s)
-  *
-  *  This table is used to substiture individual glyph indices
-  *  with another one. There are only two sub-formats:
-  *
-  *   Name         Offset    Size       Description
-  *   ------------------------------------------
-  *   format       0         2          sub-table format (1)
-  *   offset       2         2          offset to coverage table
-  *   delta        4         2          16-bit delta to apply on all
-  *                                     covered glyph indices
-  *
-  *   Name         Offset    Size       Description
-  *   ------------------------------------------
-  *   format       0         2          sub-table format (2)
-  *   offset       2         2          offset to coverage table
-  *   count        4         2          coverage table count
-  *   substs[]     6         2*count    substituted glyph indices,
-  *
-  */
-
-  static void
-  otl_gsub_lookup1_validate( OTL_Bytes      table,
-                             OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   format;
-
-    OTL_CHECK( 2 );
-    format = OTL_NEXT_USHORT( p );
-    switch ( format )
-    {
-      case 1:
-        {
-          OTL_UInt  coverage;
-
-          OTL_CHECK( 4 );
-          coverage = OTL_NEXT_USHORT( p );
-
-          otl_coverage_validate( table + coverage, valid );
-        }
-        break;
-
-      case 2:
-        {
-          OTL_UInt  coverage, count;
-
-          OTL_CHECK( 4 );
-          coverage = OTL_NEXT_USHORT( p );
-          count    = OTL_NEXT_USHORT( p );
-
-          otl_coverage_validate( table + coverage, valid );
-
-          OTL_CHECK( 2*count );
-
-          /* NB: we don't check that there are at most 'count'   */
-          /*     elements in the coverage table. This is delayed */
-          /*     to the lookup function...                       */
-        }
-        break;
-
-      default:
-        OTL_INVALID_DATA;
-    }
-  }
-
-
-  static OTL_Bool
-  otl_gsub_lookup1_apply( OTL_Bytes   table,
-                          OTL_Parser  parser )
-  {
-    OTL_Bytes  p = table;
-    OTL_Bytes  coverage;
-    OTL_UInt   format, gindex, property;
-    OTL_Int    index;
-    OTL_Bool   subst = 0;
-
-    if ( parser->context_len != 0xFFFF && parser->context_len < 1 )
-      goto Exit;
-
-    gindex = otl_parser_get_gindex( parser );
-
-    if ( !otl_parser_check_property( parser, gindex, &property ) )
-      goto Exit;
-
-    format   = OTL_NEXT_USHORT(p);
-    coverage = table + OTL_NEXT_USHORT(p);
-    index    = otl_coverage_lookup( coverage, gindex );
-
-    if ( index >= 0 )
-    {
-      switch ( format )
-      {
-        case 1:
-          {
-            OTL_Int  delta = OTL_NEXT_SHORT(p);
-
-            gindex = ( gindex + delta ) & 0xFFFF;
-            otl_parser_replace_1( parser, gindex );
-            subst = 1;
-          }
-          break;
-
-        case 2:
-          {
-            OTL_UInt  count = OTL_NEXT_USHORT(p);
-
-            if ( (OTL_UInt) index < count )
-            {
-              p += index*2;
-              otl_parser_replace_1( parser, OTL_PEEK_USHORT(p) );
-              subst = 1;
-            }
-          }
-          break;
-
-        default:
-          ;
-      }
-    }
-  Exit:
-    return subst;
-  }
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                 GSUB LOOKUP TYPE 2                           *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
- /*
-  *  2: Multiple Substitution - Table format(s)
-  *
-  *  Replaces a single glyph with one or more glyphs.
-  *
-  *   Name         Offset    Size       Description
-  *   -----------------------------------------------------------
-  *   format       0         2          sub-table format (1)
-  *   offset       2         2          offset to coverage table
-  *   count        4         2          coverage table count
-  *   sequencess[] 6         2*count    offsets to sequence items
-  *
-  *   each sequence item has the following format:
-  *
-  *   Name         Offset    Size       Description
-  *   -----------------------------------------------------------
-  *   count        0         2          number of replacement glyphs
-  *   gindices[]   2         2*count    string of glyph indices
-  */
-
-  static void
-  otl_seq_validate( OTL_Bytes      table,
-                    OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count;
-
-    OTL_CHECK( 2 );
-    count = OTL_NEXT_USHORT( p );
-
-    /* XXX: according to the spec, 'count' should be > 0     */
-    /*      we can deal with these cases pretty well however */
-
-    OTL_CHECK( 2*count );
-    /* check glyph indices */
-  }
-
-
-  static void
-  otl_gsub_lookup2_validate( OTL_Bytes      table,
-                             OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   format, coverage;
-
-    OTL_CHECK( 2 );
-    format = OTL_NEXT_USHORT( p );
-    switch ( format )
-    {
-      case 1:
-        {
-          OTL_UInt  coverage, seq_count;
-
-          OTL_CHECK( 4 );
-          coverage  = OTL_NEXT_USHORT( p );
-          seq_count = OTL_NEXT_USHORT( p );
-
-          otl_coverage_validate( table + coverage, valid );
-
-          OTL_CHECK( seq_count*2 );
-          for ( ; seq_count > 0; seq_count-- )
-            otl_seq_validate( table + OTL_NEXT_USHORT( p ), valid );
-        }
-        break;
-
-      default:
-        OTL_INVALID_DATA;
-    }
-  }
-
-
-  static OTL_Bool
-  otl_gsub_lookup2_apply( OTL_Bytes    table,
-                          OTL_Parser   parser )
-  {
-    OTL_Bytes  p = table;
-    OTL_Bytes  coverage, sequence;
-    OTL_UInt   format, gindex, index, property;
-    OTL_Int    index;
-    OTL_Bool   subst = 0;
-
-    if ( context_len != 0xFFFF && context_len < 1 )
-      goto Exit;
-
-    gindex = otl_parser_get_gindex( parser );
-
-    if ( !otl_parser_check_property( parser, gindex, &property ) )
-      goto Exit;
-
-    p        += 2;  /* skip format */
-    coverage  = table + OTL_NEXT_USHORT(p);
-    seq_count = OTL_NEXT_USHORT(p);
-    index     = otl_coverage_lookup( coverage, gindex );
-
-    if ( (OTL_UInt) index >= seq_count )
-      goto Exit;
-
-    p       += index*2;
-    sequence = table + OTL_PEEK_USHORT(p);
-    p        = sequence;
-    count    = OTL_NEXT_USHORT(p);
-
-    otl_parser_replace_n( parser, count, p );
-    subst = 1;
-
-   Exit:
-    return subst;
-  }
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                 GSUB LOOKUP TYPE 3                           *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
- /*
-  *  3: Alternate Substitution - Table format(s)
-  *
-  *  Replaces a single glyph by another one taken liberally
-  *  in a list of alternatives
-  *
-  *   Name         Offset    Size       Description
-  *   -----------------------------------------------------------
-  *   format       0         2          sub-table format (1)
-  *   offset       2         2          offset to coverage table
-  *   count        4         2          coverage table count
-  *   alternates[] 6         2*count    offsets to alternate items
-  *
-  *   each alternate item has the following format:
-  *
-  *   Name         Offset    Size       Description
-  *   -----------------------------------------------------------
-  *   count        0         2          number of replacement glyphs
-  *   gindices[]   2         2*count    string of glyph indices, each one
-  *                                     is a valid alternative
-  */
-
-  static void
-  otl_alternate_set_validate( OTL_Bytes      table,
-                              OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count;
-
-    OTL_CHECK( 2 );
-    count = OTL_NEXT_USHORT( p );
-
-    OTL_CHECK( 2*count );
-    /* XXX: check glyph indices */
-  }
-
-
-  static void
-  otl_gsub_lookup3_validate( OTL_Bytes      table,
-                             OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   format, coverage;
-
-    OTL_CHECK( 2 );
-    format = OTL_NEXT_USHORT( p );
-    switch ( format )
-    {
-      case 1:
-        {
-          OTL_UInt  coverage, count;
-
-          OTL_CHECK( 4 );
-          coverage = OTL_NEXT_USHORT( p );
-          count    = OTL_NEXT_USHORT( p );
-
-          otl_coverage_validate( table + coverage, valid );
-
-          OTL_CHECK( 2*count );
-          for ( ; count > 0; count-- )
-            otl_alternate_set_validate( table + OTL_NEXT_USHORT( p ), valid );
-        }
-        break;
-
-      default:
-        OTL_INVALID_DATA;
-    }
-  }
-
-
-  static OTL_Bool
-  otl_gsub_lookup3_apply( OTL_Bytes    table,
-                          OTL_Parser   parser )
-  {
-    OTL_Bytes  p = table;
-    OTL_Bytes  coverage, alternates;
-    OTL_UInt   format, gindex, index, property;
-    OTL_Int    index;
-    OTL_Bool   subst = 0;
-
-    OTL_GSUB_Alternate  alternate = parser->alternate;
-
-    if ( context_len != 0xFFFF && context_len < 1 )
-      goto Exit;
-
-    if ( alternate == NULL )
-      goto Exit;
-
-    gindex = otl_parser_get_gindex( parser );
-
-    if ( !otl_parser_check_property( parser, gindex, &property ) )
-      goto Exit;
-
-    p        += 2;  /* skip format */
-    coverage  = table + OTL_NEXT_USHORT(p);
-    seq_count = OTL_NEXT_USHORT(p);
-    index     = otl_coverage_lookup( coverage, gindex );
-
-    if ( (OTL_UInt) index >= seq_count )
-      goto Exit;
-
-    p         += index*2;
-    alternates = table + OTL_PEEK_USHORT(p);
-    p          = alternates;
-    count      = OTL_NEXT_USHORT(p);
-
-    gindex = alternate->handler_func(
-                 gindex, count, p, alternate->handler_data );
-
-    otl_parser_replace_1( parser, gindex );
-    subst = 1;
-
-   Exit:
-    return subst;
-  }
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                 GSUB LOOKUP TYPE 4                           *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-  static void
-  otl_ligature_validate( OTL_Bytes      table,
-                         OTL_Validator  valid )
-  {
-    OTL_UInt  glyph_id, count;
-
-    OTL_CHECK( 4 );
-    glyph_id = OTL_NEXT_USHORT( p );
-    count    = OTL_NEXT_USHORT( p );
-
-    if ( count == 0 )
-      OTL_INVALID_DATA;
-
-    OTL_CHECK( 2*(count-1) );
-    /* XXX: check glyph indices */
-  }
-
-
-  static void
-  otl_ligature_set_validate( OTL_Bytes      table,
-                             OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count;
-
-    OTL_CHECK( 2 );
-    count = OTL_NEXT_USHORT( p );
-
-    OTL_CHECK( 2*count );
-    for ( ; count > 0; count-- )
-      otl_ligature_validate( table + OTL_NEXT_USHORT( p ), valid );
-  }
-
-
-  static void
-  otl_gsub_lookup4_validate( OTL_Bytes      table,
-                             OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   format, coverage;
-
-    OTL_CHECK( 2 );
-    format = OTL_NEXT_USHORT( p );
-    switch ( format )
-    {
-      case 1:
-        {
-          OTL_UInt  coverage, count;
-
-          OTL_CHECK( 4 );
-          coverage = OTL_NEXT_USHORT( p );
-          count    = OTL_NEXT_USHORT( p );
-
-          otl_coverage_validate( table + coverage, valid );
-
-          OTL_CHECK( 2*count );
-          for ( ; count > 0; count-- )
-            otl_ligature_set_validate( table + OTL_NEXT_USHORT( p ), valid );
-        }
-        break;
-
-      default:
-        OTL_INVALID_DATA;
-    }
-  }
-
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                 GSUB LOOKUP TYPE 5                           *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-
-  static void
-  otl_sub_rule_validate( OTL_Bytes      table,
-                         OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   glyph_count, subst_count;
-
-    OTL_CHECK( 4 );
-    glyph_count = OTL_NEXT_USHORT( p );
-    subst_count = OTL_NEXT_USHORT( p );
-
-    if ( glyph_count == 0 )
-      OTL_INVALID_DATA;
-
-    OTL_CHECK( (glyph_count-1)*2 + substcount*4 );
-
-    /* XXX: check glyph indices and subst lookups */
-  }
-
-
-  static void
-  otl_sub_rule_set_validate( OTL_Bytes      table,
-                             OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count;
-
-    OTL_CHECK( 2 );
-    count = OTL_NEXT_USHORT( p );
-
-    OTL_CHECK( 2*count );
-    for ( ; count > 0; count-- )
-      otl_sub_rule_validate( table + OTL_NEXT_USHORT( p ), valid );
-  }
-
-
-  static void
-  otl_sub_class_rule_validate( OTL_Bytes      table,
-                               OTL_Validator  valid )
-  {
-    OTL_UInt  glyph_count, subst_count;
-
-    OTL_CHECK( 4 );
-    glyph_count = OTL_NEXT_USHORT( p );
-    subst_count = OTL_NEXT_USHORT( p );
-
-    if ( glyph_count == 0 )
-      OTL_INVALID_DATA;
-
-    OTL_CHECK( (glyph_count-1)*2 + substcount*4 );
-
-    /* XXX: check glyph indices and subst lookups */
-  }
-
-
-  static void
-  otl_sub_class_rule_set_validate( OTL_Bytes      table,
-                                   OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count;
-
-    OTL_CHECK( 2 );
-    count = OTL_NEXT_USHORT( p );
-
-    OTL_CHECK( 2*count );
-    for ( ; count > 0; count-- )
-      otl_sub_class_rule_validate( table + OTL_NEXT_USHORT( p ), valid );
-  }
-
-
-  static void
-  otl_gsub_lookup5_validate( OTL_Bytes      table,
-                             OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   format, coverage;
-
-    OTL_CHECK( 2 );
-    format = OTL_NEXT_USHORT( p );
-    switch ( format )
-    {
-      case 1:
-        {
-          OTL_UInt  coverage, count;
-
-          OTL_CHECK( 4 );
-          coverage = OTL_NEXT_USHORT( p );
-          count    = OTL_NEXT_USHORT( p );
-
-          otl_coverage_validate( table + coverage, valid );
-
-          OTL_CHECK( 2*count );
-          for ( ; count > 0; count-- )
-            otl_sub_rule_set_validate( table + coverage, valid );
-        }
-        break;
-
-      case 2:
-        {
-          OTL_UInt  coverage, class_def, count;
-
-          OTL_CHECK( 6 );
-          coverage  = OTL_NEXT_USHORT( p );
-          class_def = OTL_NEXT_USHORT( p );
-          count     = OTL_NEXT_USHORT( p );
-
-          otl_coverage_validate        ( table + coverage, valid );
-          otl_class_definition_validate( table + class_def, valid );
-
-          OTL_CHECK( 2*count );
-          for ( ; count > 0; count-- )
-            otl_sub_class_rule_set_validate( table + coveragen valid );
-        }
-        break;
-
-      case 3:
-        {
-          OTL_UInt  glyph_count, subst_count, count;
-
-          OTL_CHECK( 4 );
-          glyph_count = OTL_NEXT_USHORT( p );
-          subst_count = OTL_NEXT_USHORT( p );
-
-          OTL_CHECK( 2*glyph_count + 4*subst_count );
-          for ( count = glyph_count; count > 0; count-- )
-            otl_coverage_validate( table + OTL_NEXT_USHORT( p ), valid );
-        }
-        break;
-
-      default:
-        OTL_INVALID_DATA;
-    }
-  }
-
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                 GSUB LOOKUP TYPE 6                           *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-
-  static void
-  otl_chain_sub_rule_validate( OTL_Bytes      table,
-                               OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   back_count, input_count, ahead_count, subst_count, count;
-
-    OTL_CHECK( 2 );
-    back_count = OTL_NEXT_USHORT( p );
-
-    OTL_CHECK( 2*back_count+2 );
-    p += 2*back_count;
-
-    input_count = OTL_NEXT_USHORT( p );
-    if ( input_count == 0 )
-      OTL_INVALID_DATA;
-
-    OTL_CHECK( 2*input_count );
-    p += 2*(input_count-1);
-
-    ahead_count = OTL_NEXT_USHORT( p );
-    OTL_CHECK( 2*ahead_count + 2 );
-    p += 2*ahead_count;
-
-    count = OTL_NEXT_USHORT( p );
-    OTL_CHECK( 4*count );
-
-    /* XXX: check glyph indices and subst lookups */
-  }
-
-
-  static void
-  otl_chain_sub_rule_set_validate( OTL_Bytes      table,
-                                   OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count;
-
-    OTL_CHECK( 2 );
-    count = OTL_NEXT_USHORT( p );
-
-    OTL_CHECK( 2*count );
-    for ( ; count > 0; count-- )
-      otl_chain_sub_rule_validate( table + OTL_NEXT_USHORT( p ), valid );
-  }
-
-
-  static void
-  otl_chain_sub_class_rule_validate( OTL_Bytes      table,
-                                     OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   back_count, input_count, ahead_count, subst_count, count;
-
-    OTL_CHECK( 2 );
-    back_count = OTL_NEXT_USHORT( p );
-
-    OTL_CHECK( 2*back_count+2 );
-    p += 2*back_count;
-
-    input_count = OTL_NEXT_USHORT( p );
-    if ( input_count == 0 )
-      OTL_INVALID_DATA;
-
-    OTL_CHECK( 2*input_count );
-    p += 2*(input_count-1);
-
-    ahead_count = OTL_NEXT_USHORT( p );
-    OTL_CHECK( 2*ahead_count + 2 );
-    p += 2*ahead_count;
-
-    count = OTL_NEXT_USHORT( p );
-    OTL_CHECK( 4*count );
-
-    /* XXX: check class indices and subst lookups */
-  }
-
-
-
-  static void
-  otl_chain_sub_class_set_validate( OTL_Bytes      table,
-                                    OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count;
-
-    OTL_CHECK( 2 );
-    count = OTL_NEXT_USHORT( p );
-
-    OTL_CHECK( 2*count );
-    for ( ; count > 0; count-- )
-      otl_chain_sub_rule_validate( table + OTL_NEXT_USHORT( p ), valid );
-  }
-
-
-  static void
-  otl_gsub_lookup6_validate( OTL_Bytes      table,
-                             OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   format, coverage;
-
-    OTL_CHECK( 2 );
-    format = OTL_NEXT_USHORT( p );
-    switch ( format )
-    {
-      case 1:
-        {
-          OTL_UInt  coverage, count;
-
-          OTL_CHECK( 4 );
-          coverage = OTL_NEXT_USHORT( p );
-          count    = OTL_NEXT_USHORT( p );
-
-          otl_coverage_validate( table + coverage, valid );
-
-          OTL_CHECK( 2*count );
-          for ( ; count > 0; count-- )
-            otl_chain_sub_rule_set_validate( table + coverage, valid );
-        }
-        break;
-
-      case 2:
-        {
-          OTL_UInt  coverage, back_class, input_class, ahead_class, count;
-
-          OTL_CHECK( 10 );
-          coverage    = OTL_NEXT_USHORT( p );
-          back_class  = OTL_NEXT_USHORT( p );
-          input_class = OTL_NEXT_USHORT( p );
-          ahead_class = OTL_NEXT_USHORT( p );
-          count       = OTL_NEXT_USHORT( p );
-
-          otl_coverage_validate( table + coverage, valid );
-
-          otl_class_definition_validate( table + back_class,  valid );
-          otl_class_definition_validate( table + input_class, valid );
-          otl_class_definition_validate( table + ahead_class, valid );
-
-          OTL_CHECK( 2*count );
-          for ( ; count > 0; count-- )
-            otl_chain_sub_class_set( table + OTL_NEXT_USHORT( p ), valid );
-        }
-        break;
-
-      case 3:
-        {
-          OTL_UInt  back_count, input_count, ahead_count, subst_count, count;
-
-          OTL_CHECK( 2 );
-          back_count = OTL_NEXT_USHORT( p );
-
-          OTL_CHECK( 2*back_count+2 );
-          for ( count = back_count; count > 0; count-- )
-            otl_coverage_validate( table + OTL_NEXT_USHORT( p ), valid );
-
-          input_count = OTL_NEXT_USHORT( p );
-
-          OTL_CHECK( 2*input_count+2 );
-          for ( count = input_count; count > 0; count-- )
-            otl_coverage_validate( table + OTL_NEXT_USHORT( p ), valid );
-
-          ahead_count = OTL_NEXT_USHORT( p );
-
-          OTL_CHECK( 2*ahead_count+2 );
-          for ( count = ahead_count; count > 0; count-- )
-            otl_coverage_validate( table + OTL_NEXT_USHORT( p ), valid );
-
-          subst_count = OTL_NEXT_USHORT( p );
-          OTL_CHECK( subst_count*4 );
-        }
-        break;
-
-      default:
-        OTL_INVALID_DATA;
-    }
-  }
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                 GSUB LOOKUP TYPE 6                           *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-  static void
-  otl_gsub_lookup7_validate( OTL_Bytes      table,
-                             OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   format, coverage;
-
-    OTL_CHECK( 2 );
-    format = OTL_NEXT_USHORT( p );
-    switch ( format )
-    {
-      case 1:
-        {
-          OTL_UInt          lookup_type, lookup_offset;
-          OTL_ValidateFunc  validate;
-
-          OTL_CHECK( 6 );
-          lookup_type   = OTL_NEXT_USHORT( p );
-          lookup_offset = OTL_NEXT_ULONG( p );
-
-          if ( lookup_type == 0 || lookup_type >= 7 )
-            OTL_INVALID_DATA;
-
-          validate = otl_gsub_validate_funcs[ lookup_type-1 ];
-          validate( table + lookup_offset, valid );
-        }
-        break;
-
-      default:
-        OTL_INVALID_DATA;
-    }
-  }
-
-
-  static const OTL_ValidateFunc  otl_gsub_validate_funcs[ 7 ] =
-  {
-    otl_gsub_lookup1_validate,
-    otl_gsub_lookup2_validate,
-    otl_gsub_lookup3_validate,
-    otl_gsub_lookup4_validate,
-    otl_gsub_lookup5_validate,
-    otl_gsub_lookup6_validate
-  };
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                         GSUB TABLE                           *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-
-  OTL_LOCALDEF( void )
-  otl_gsub_validate( OTL_Bytes      table,
-                     OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   scripts, features, lookups;
-
-    OTL_CHECK( 10 );
-
-    if ( OTL_NEXT_USHORT( p ) != 0x10000UL )
-      OTL_INVALID_DATA;
-
-    scripts  = OTL_NEXT_USHORT( p );
-    features = OTL_NEXT_USHORT( p );
-    lookups  = OTL_NEXT_USHORT( p );
-
-    otl_script_list_validate ( table + scripts, valid );
-    otl_feature_list_validate( table + features, valid );
-
-    otl_lookup_list_validate( table + lookups, 7, otl_gsub_validate_funcs,
-                              valid );
-  }

+ 0 - 26
sys/src/libfreetype/src/otlayout/otlgsub.h

@@ -1,26 +0,0 @@
-#ifndef __OTL_GSUB_H__
-#define __OTL_GSUB_H__
-
-#include "otlayout.h"
-
-OTL_BEGIN_HEADER
-
-  typedef OTL_UInt  (*OTL_GSUB_AlternateFunc)( OTL_UInt     gindex,
-                                               OTL_UInt     count,
-                                               OTL_Bytes    alternates,
-                                               OTL_Pointer  data );
-
-  typedef struct OTL_GSUB_AlternateRec_
-  {
-    OTL_GSUB_AlternateFunc  handler_func;
-    OTL_Pointer             handler_data;
-
-  } OTL_GSUB_AlternateRec, *OTL_GSUB_Alternate;
-
-  OTL_LOCAL( void )
-  otl_gsub_validate( OTL_Bytes      table,
-                     OTL_Validator  valid );
-
-OTL_END_HEADER
-
-#endif /* __OTL_GSUB_H__ */

+ 0 - 189
sys/src/libfreetype/src/otlayout/otljstf.c

@@ -1,189 +0,0 @@
-#include "otljstf.h"
-#include "otlcommn.h"
-#include "otlgpos.h"
-
-  static void
-  otl_jstf_extender_validate( OTL_Bytes      table,
-                              OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count;
-
-    OTL_CHECK( 2 );
-
-    count = OTL_NEXT_USHORT( p );
-
-    OTL_CHECK( count*2 );
-  }
-
-
-  static void
-  otl_jstf_gsub_mods_validate( OTL_Bytes      table,
-                               OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count;
-
-    OTL_CHECK( 2 );
-    count = OTL_NEXT_USHORT( p );
-    OTL_CHECK( count*2 );
-
-    /* XXX: check GSUB lookup indices */
-  }
-
-
-  static void
-  otl_jstf_gpos_mods_validate( OTL_Bytes      table,
-                               OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count;
-
-    OTL_CHECK( 2 );
-    count = OTL_NEXT_USHORT( p );
-    OTL_CHECK( count*2 );
-
-    /* XXX: check GPOS lookup indices */
-  }
-
-
-  static void
-  otl_jstf_max_validate( OTL_Bytes      table,
-                         OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count;
-
-    OTL_CHECK( 2 );
-
-    count = OTL_NEXT_USHORT( p );
-
-    OTL_CHECK( count*2 );
-    for ( ; count > 0; count-- )
-      otl_gpos_subtable_check( table + OTL_NEXT_USHORT( p ), valid );
-  }
-
-
-  static void
-  otl_jstf_priority_validate( OTL_Bytes      table,
-                              OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   offset;
-
-    OTL_CHECK( 20 );
-
-    /* shrinkage GSUB enable/disable */
-    val = OTL_NEXT_USHORT( p );
-    if ( val )
-      otl_jstf_gsub_mods_validate( table + val, valid );
-
-    val = OTL_NEXT_USHORT( p );
-    if ( val )
-      otl_jstf_gsub_mods_validate( table + val, valid );
-
-    /* shrinkage GPOS enable/disable */
-    val = OTL_NEXT_USHORT( p );
-    if ( val )
-      otl_jstf_gpos_mods_validate( table + val, valid );
-
-    val = OTL_NEXT_USHORT( p );
-    if ( val )
-      otl_jstf_gpos_mods_validate( table + val, valid );
-
-    /* shrinkage JSTF max */
-    val = OTL_NEXT_USHORT( p );
-    if ( val )
-      otl_jstf_max_validate( table + val, valid );
-
-    /* extension GSUB enable/disable */
-    val = OTL_NEXT_USHORT( p );
-    if ( val )
-      otl_jstf_gsub_mods_validate( table + val, valid );
-
-    val = OTL_NEXT_USHORT( p );
-    if ( val )
-      otl_jstf_gsub_mods_validate( table + val, valid );
-
-    /* extension GPOS enable/disable */
-    val = OTL_NEXT_USHORT( p );
-    if ( val )
-      otl_jstf_gpos_mods_validate( table + val, valid );
-
-    val = OTL_NEXT_USHORT( p );
-    if ( val )
-      otl_jstf_gpos_mods_validate( table + val, valid );
-
-    /* extension JSTF max */
-    val = OTL_NEXT_USHORT( p );
-    if ( val )
-      otl_jstf_max_validate( table + val, valid );
-  }
-
-  static void
-  otl_jstf_lang_validate( OTL_Bytes      table,
-                          OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count;
-
-    OTL_CHECK( 2 );
-
-    count = OTL_NEXT_USHORT( p );
-
-    OTL_CHECK( count*2 );
-    for ( ; count > 0; count-- )
-      otl_jstf_priority_validate( table + OTL_NEXT_USHORT( p ), valid );
-  }
-
-
-  static void
-  otl_jstf_script_validate( OTL_Bytes      table,
-                            OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count, extender, default_lang;
-
-    OTL_CHECK( 6 );
-    extender     = OTL_NEXT_USHORT( p );
-    default_lang = OTL_NEXT_USHORT( p );
-    count        = OTL_NEXT_USHORT( p );
-
-    if ( extender )
-      otl_jstf_extender_validate( table + extender, valid );
-
-    if ( default_lang )
-      otl_jstf_lang_validate( table + default_lang, valid );
-
-    OTL_CHECK( 6*count );
-
-    for ( ; count > 0; count-- )
-    {
-      p += 4;  /* ignore tag */
-      otl_jstf_lang_validate( table + OTL_NEXT_USHORT( p ), valid );
-    }
-  }
-
-
-  OTL_LOCALDEF( void )
-  otl_jstf_validate( OTL_Bytes      table,
-                     OTL_Validator  valid )
-  {
-    OTL_Bytes  p = table;
-    OTL_UInt   count;
-
-    OTL_CHECK( 4 );
-
-    if ( OTL_NEXT_ULONG( p ) != 0x10000UL )
-      OTL_INVALID_DATA;
-
-    count = OTL_NEXT_USHORT( p );
-    OTL_CHECK( count*6 );
-
-    for ( ; count > 0; count++ )
-    {
-      p += 4;  /* ignore tag */
-      otl_jstf_script_validate( table + OTL_NEXT_USHORT( p ), valid );
-    }
-  }
-  

+ 0 - 14
sys/src/libfreetype/src/otlayout/otljstf.h

@@ -1,14 +0,0 @@
-#ifndef __OTL_JSTF_H__
-#define __OTL_JSTF_H__
-
-#include "otlayout.h"
-
-OTL_BEGIN_HEADER
-
-  OTL_LOCAL( void )
-  otl_jstf_validate( OTL_Bytes      table,
-                     OTL_Validator  valid );
-
-OTL_END_HEADER
-
-#endif /* __OTL_JSTF_H__ */

+ 0 - 142
sys/src/libfreetype/src/otlayout/otlparse.c

@@ -1,142 +0,0 @@
-#include "otlparse.h"
-#include "otlutils.h"
-
-  static void
-  otl_string_ensure( OTL_String  string,
-                     OTL_UInt    count,
-                     OTL_Parser  parser )
-  {
-    count += string->length;
-
-    if ( count > string->capacity )
-    {
-      OTL_UInt    old_count = string->capacity;
-      OTL_UInt    new_count = old_count;
-      OTL_Memory  memory    = parser->memory;
-
-      while ( new_count < count )
-        new_count += (new_count >> 1) + 16;
-
-      if ( OTL_MEM_RENEW_ARRAY( string->glyphs, old_count, new_count ) )
-        otl_parser_error( parser, OTL_Parse_Err_Memory );
-
-      string->capacity = new_count;
-    }
-  }
-
-#define  OTL_STRING_ENSURE(str,count,parser)                   \
-           OTL_BEGIN_STMNT                                     \
-             if ( (str)->length + (count) > (str)>capacity )   \
-               otl_string_ensure( str, count, parser );        \
-           OTL_END_STMNT
-
-
-  OTL_LOCALDEF( OTL_UInt )
-  otl_parser_get_gindex( OTL_Parser  parser )
-  {
-    OTL_String  in = parser->str_in;
-
-    if ( in->cursor >= in->num_glyphs )
-      otl_parser_error( parser, OTL_Err_Parser_Internal );
-
-    return in->str[ in->cursor ].gindex;
-  }
-
-
-  OTL_LOCALDEF( void )
-  otl_parser_error( OTL_Parser      parser,
-                    OTL_ParseError  error; )
-  {
-    parser->error = error;
-    otl_longjmp( parser->jump_buffer, 1 );
-  }
-
-#define  OTL_PARSER_UNCOVERED(x)  otl_parser_error( x, OTL_Parse_Err_UncoveredGlyph );
-
-  OTL_LOCAL( void )
-  otl_parser_check_property( OTL_Parser  parser,
-                             OTL_UInt    gindex,
-                             OTL_UInt    flags,
-                             OTL_UInt   *aproperty );
-
-  OTL_LOCALDEF( void )
-  otl_parser_replace_1( OTL_Parser  parser,
-                        OTL_UInt    gindex )
-  {
-    OTL_String       in  = parser->str_in;
-    OTL_String       out = parser->str_out;
-    OTL_StringGlyph  glyph, in_glyph;
-
-    /* sanity check */
-    if ( in == NULL               ||
-         out == NULL              ||
-         in->length == 0          ||
-         in->cursor >= in->length )
-    {
-      /* report as internal error, since these should */
-      /* never happen !!                              */
-      otl_parser_error( parser, OTL_Err_Parse_Internal );
-    }
-
-    OTL_STRING_ENSURE( out, 1, parser );
-    glyph    = out->glyphs + out->length;
-    in_glyph = in->glyphs  + in->cursor;
-
-    glyph->gindex        = gindex;
-    glyph->property      = in_glyph->property;
-    glyph->lig_component = in_glyph->lig_component;
-    glyph->lig_id        = in_glyph->lig_id;
-
-    out->length += 1;
-    out->cursor  = out->length;
-    in->cursor  += 1;
-  }
-
-  OTL_LOCALDEF( void )
-  otl_parser_replace_n( OTL_Parser  parser,
-                        OTL_UInt    count,
-                        OTL_Bytes   indices )
-  {
-    OTL_UInt         lig_component, lig_id, property;
-    OTL_String       in  = parser->str_in;
-    OTL_String       out = parser->str_out;
-    OTL_StringGlyph  glyph, in_glyph;
-    OTL_Bytes        p = indices;
-
-    /* sanity check */
-    if ( in == NULL               ||
-         out == NULL              ||
-         in->length == 0          ||
-         in->cursor >= in->length )
-    {
-      /* report as internal error, since these should */
-      /* never happen !!                              */
-      otl_parser_error( parser, OTL_Err_Parse_Internal );
-    }
-
-    OTL_STRING_ENSURE( out, count, parser );
-    glyph    = out->glyphs + out->length;
-    in_glyph = in->glyphs  + in->cursor;
-
-    glyph->gindex = gindex;
-
-    lig_component = in_glyph->lig_component;
-    lig_id        = in_glyph->lid_id;
-    property      = in_glyph->property;
-
-    for ( ; count > 0; count-- )
-    {
-      glyph->gindex        = OTL_NEXT_USHORT(p);
-      glyph->property      = property;
-      glyph->lig_component = lig_component;
-      glyph->lig_id        = lig_id;
-
-      out->length ++;
-    }
-
-    out->cursor  = out->length;
-    in->cursor  += 1;
-  }
-
-
-

+ 0 - 99
sys/src/libfreetype/src/otlayout/otlparse.h

@@ -1,99 +0,0 @@
-#ifndef __OTL_PARSER_H__
-#define __OTL_PARSER_H__
-
-#include "otlayout.h"
-#include "otlgdef.h"
-#include "otlgsub.h"
-#include "otlgpos.h"
-
-OTL_BEGIN_HEADER
-
-  typedef struct OTL_ParserRec_*   OTL_Parser;
-
-  typedef struct OTL_StringRec_*   OTL_String;
-
-  typedef struct OTL_StringGlyphRec_
-  {
-    OTL_UInt  gindex;
-    OTL_UInt  properties;
-    OTL_UInt  lig_component;
-    OTL_UInt  lig_id;
-
-  } OTL_StringGlyphRec, *OTL_StringGlyph;
-
-  typedef struct OTL_StringRec_
-  {
-    OTL_StringGlyph  glyphs;
-    OTL_UInt         cursor;
-    OTL_UInt         length;
-    OTL_UInt         capacity;
-
-  } OTL_StringRec;
-
-  typedef struct OTL_ParserRec_
-  {
-    OTL_Bytes      tab_gdef;
-    OTL_Bytes      tab_gsub;
-    OTL_Bytes      tab_gpos;
-    OTL_Bytes      tab_base;
-    OTL_Bytes      tab_jstf;
-
-    OTL_Alternate  alternate;  /* external alternate handler */
-
-    OTL_UInt       context_len;
-    OTL_UInt       markup_flags;
-
-    OTL_jmp_buf    jump_buffer;
-    OTL_Memory     memory;
-    OTL_Error      error;
-
-    OTL_StringRec  strings[2];
-    OTL_String     str_in;
-    OTL_String     str_out;
-
-  } OTL_ParserRec;
-
-  typedef enum
-  {
-    OTL_Err_Parser_Ok = 0,
-    OTL_Err_Parser_InvalidData,
-    OTL_Err_Parser_UncoveredGlyph
-
-  } OTL_ParseError;
-
-  OTL_LOCAL( OTL_UInt )
-  otl_parser_get_gindex( OTL_Parser  parser );
-
-
-  OTL_LOCAL( void )
-  otl_parser_error( OTL_Parser  parser, OTL_ParserError  error );
-
-#define  OTL_PARSER_UNCOVERED(x)  \
-           otl_parser_error( x, OTL_Err_Parser_UncoveredGlyph )
-
-  OTL_LOCAL( void )
-  otl_parser_check_property( OTL_Parser  parser,
-                             OTL_UInt    gindex,
-                             OTL_UInt    flags,
-                             OTL_UInt   *aproperty );
-
- /* copy current input glyph to output */
-  OTL_LOCAL( void )
-  otl_parser_copy_1( OTL_Parser  parser );
-
- /* copy current input glyph to output, replacing its index */
-  OTL_LOCAL( void )
-  otl_parser_replace_1( OTL_Parser  parser,
-                        OTL_UInt    gindex );
-
- /* copy current input glyph to output, replacing it by several indices */
- /* read directly from the table                                        */
-  OTL_LOCAL( void )
-  otl_parser_replace_n( OTL_Parser  parser,
-                        OTL_UInt    count,
-                        OTL_Bytes   indices );
-
-OTL_END_HEADER
-
-#endif /* __OTL_PARSER_H__ */
-

+ 0 - 60
sys/src/libfreetype/src/otlayout/otltable.h

@@ -1,60 +0,0 @@
-#ifndef __OTL_TABLE_H__
-#define __OTL_TABLE_H__
-
-#include "otlayout.h"
-
-OTL_BEGIN_HEADER
-
-  typedef struct OTL_TableRec_*    OTL_Table;
-
-  typedef enum
-  {
-    OTL_TABLE_TYPE_GDEF = 1,
-    OTL_TABLE_TYPE_GSUB,
-    OTL_TABLE_TYPE_GPOS,
-    OTL_TABLE_TYPE_BASE,
-    OTL_TABLE_TYPE_JSTF
-
-  } OTL_TableType;
-
-
- /* this may become a private structure later */
-  typedef struct OTL_TableRec_
-  {
-    OTL_TableType  type;
-    OTL_Bytes      base;
-    OTL_Bytes      limit;
-
-    OTL_Tag        script_tag;
-    OTL_Tag        lang_tag;
-
-    OTL_UInt       lookup_count;
-    OTL_Byte*      lookup_flags;
-
-    OTL_UInt       feature_count;
-    OTL_Tag        feature_tags;
-    OTL_Byte*      feature_flags;
-
-  } OTL_TableRec;
-
-
-  OTL_API( OTL_Error )
-  otl_table_validate( OTL_Bytes      table,
-                      OTL_Size       size,
-                      OTL_TableType  type,
-                      OTL_Size      *abyte_size );
-
-  OTL_API( void )
-  otl_table_init( OTL_Table      table,
-                  OTL_TableType  type,
-                  OTL_Bytes      base,
-                  OTL_Size       size );
-
-  OTL_API( void )
-  otl_table_set_script( OTL_Table      table,
-                        OTL_ScriptTag  script,
-                        OTL_LangTag    language );
-
-OTL_END_HEADER
-
-#endif /* __OTL_TABLE_H__ */

+ 0 - 88
sys/src/libfreetype/src/otlayout/otltags.h

@@ -1,88 +0,0 @@
-/* this file may be included several times by other parts of */
-/* the OpenType Layout library.. don't add #ifdef .. #endif  */
-/* delimiters to it...                                       */
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                       SCRIPT TAGS                            *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-#ifndef OTL_SCRIPT_TAG
-#define OTL_SCRIPT_TAG(c1,c2,c3,c4,s,n)  /* void */
-#endif
-
-OTL_SCRIPT_TAG( 'a','r','a','b', "Arabic", ARABIC )
-OTL_SCRIPT_TAG( 'a','r','m','n', "Armenian", ARMENIAN )
-OTL_SCRIPT_TAG( 'b','e','n','g', "Bengali", BENGALI )
-OTL_SCRIPT_TAG( 'b','o','p','o', "Bopomofo", BOPOMOFO )
-OTL_SCRIPT_TAG( 'b','r','a','i', "Braille", BRAILLE )
-OTL_SCRIPT_TAG( 'b','y','z','m', "Byzantine Music", BYZANTINE_MUSIC )
-OTL_SCRIPT_TAG( 'c','a','n','s', "Canadian Syllabic", CANADIAN )
-OTL_SCRIPT_TAG( 'c','h','e','r', "Cherokee", CHEROKEE )
-OTL_SCRIPT_TAG( 'h','a','n','i', "CJK Ideographic", CJK )
-OTL_SCRIPT_TAG( 'c','y','r','l', "Cyrillic", CYRILLIC )
-OTL_SCRIPT_TAG( 'd','f','l','t', "Default", DEFAULT )
-OTL_SCRIPT_TAG( 'd','e','v','a', "Devanagari", DEVANAGARI )
-OTL_SCRIPT_TAG( 'e','t','h','i', "Ethiopic", ETHIOPIC )
-OTL_SCRIPT_TAG( 'g','e','o','r', "Georgian", GEORGIAN )
-OTL_SCRIPT_TAG( 'g','r','e','k', "Greek", GREEK )
-OTL_SCRIPT_TAG( 'g','u','j','r', "Gujarati", GUJARATI )
-OTL_SCRIPT_TAG( 'g','u','r','u', "Gurmukhi", GURMUKHI )
-OTL_SCRIPT_TAG( 'j','a','m','o', "Hangul Jamo", JAMO )
-OTL_SCRIPT_TAG( 'h','a','n','g', "Hangul", HANGUL )
-OTL_SCRIPT_TAG( 'h','e','b','r', "Hebrew", HEBREW )
-OTL_SCRIPT_TAG( 'h','i','r','a', "Hiragana", HIRAGANA ) /* not in TAGS.txt */
-OTL_SCRIPT_TAG( 'k','n','d','a', "Kannada", KANNADA )
-OTL_SCRIPT_TAG( 'k','a','n','a', "Katakana", KATAKANA ) /* in TAGS.txt, means Hiragana _and_ Katakana */
-OTL_SCRIPT_TAG( 'k','h','m','r', "Khmer", KHMER )
-OTL_SCRIPT_TAG( 'l','a','o',' ', "Lao", LAO )
-OTL_SCRIPT_TAG( 'l','a','t','n', "Latin", LATIN )
-OTL_SCRIPT_TAG( 'm','l','y','m', "Malayalam", MALAYALAM )
-OTL_SCRIPT_TAG( 'm','o','n','g', "Mongolian", MONGOLIAN )
-OTL_SCRIPT_TAG( 'm','y','m','r', "Myanmar", MYANMAR )
-OTL_SCRIPT_TAG( 'o','g','a','m', "Ogham", OGHAM )
-OTL_SCRIPT_TAG( 'o','r','y','a', "Oriya", ORIYA )
-OTL_SCRIPT_TAG( 'r','u','n','r', "Runic", RUNIC )
-OTL_SCRIPT_TAG( 's','i','n','h', "Sinhala", SINHALA )
-OTL_SCRIPT_TAG( 's','y','r','c', "Syriac", SYRIAC )
-OTL_SCRIPT_TAG( 't','a','m','l', "Tamil", TAMIL )
-OTL_SCRIPT_TAG( 't','e','l','u', "Telugu", TELUGU )
-OTL_SCRIPT_TAG( 't','h','a','a', "Thaana", THAANA )
-OTL_SCRIPT_TAG( 't','h','a','i', "Thai", THAI )
-OTL_SCRIPT_TAG( 't','i','b','t', "Tibetan", TIBETAN )
-OTL_SCRIPT_TAG( 'y','i',' ',' ', "Yi", YI )
-
-#undef OTL_SCRIPT_TAG
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                       LANGUAGE TAGS                          *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-#ifndef OTL_LANG_TAG
-#define OTL_LANG_TAG(c1,c2,c3,c4,s,n)  /* void */
-#endif
-
-#undef OTL_LANG_TAG
-
-
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                       FEATURE TAGS                           *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
-#ifndef OTL_FEATURE_TAG
-#define OTL_FEATURE_TAG(c1,c2,c3,c4,s,n)  /* void */
-#endif
-
-#undef OTL_FEATURE_TAG
-

+ 0 - 33
sys/src/libfreetype/src/otlayout/otlutils.h

@@ -1,33 +0,0 @@
-#ifndef __OTLAYOUT_UTILS_H__
-#define __OTLAYOUT_UTILS_H__
-
-#include "otlayout.h"
-
-OTL_BEGIN_HEADER
-
-  OTL_LOCAL( OTL_Error )
-  otl_mem_alloc( OTL_Pointer*  pblock,
-                 OTL_ULong     size,
-                 OTL_Memory    memory );
-
-  OTL_LOCAL( void )
-  otl_mem_free( OTL_Pointer*  pblock,
-                OTL_Memory    memory );
-
-  OTL_LOCAL( OTL_Error )
-  otl_mem_realloc( OTL_Pointer  *pblock,
-                   OTL_ULong     cur_size,
-                   OTL_ULong     new_size,
-                   OTL_Memory    memory );
-
-#define  OTL_MEM_ALLOC(p,s)       otl_mem_alloc( (void**)&(p), (s), memory )
-#define  OTL_MEM_FREE(p)          otl_mem_free( (void**)&(p), memory )
-#define  OTL_MEM_REALLOC(p,c,n)   otl_mem_realloc( (void**)&(p), (c), (s), memory )
-
-#define  OTL_MEM_NEW(p)   OTL_MEM_ALLOC(p,sizeof(*(p)))
-#define  OTL_MEM_NEW_ARRAY(p,c)  OTL_MEM_ALLOC(p,(c)*sizeof(*(p)))
-#define  OTL_MEM_RENEW_ARRAY(p,c,n)  OTL_MEM_REALLOC(p,(c)*sizeof(*(p)),(n)*sizeof(*(p)))
-
-OTL_END_HEADER
-
-#endif /* __OTLAYOUT_UTILS_H__ */

+ 0 - 21
sys/src/libfreetype/src/pcf/Jamfile

@@ -1,21 +0,0 @@
-# FreeType 2 src/pcf Jamfile (c) 2001 David Turner
-#
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) pcf ;
-
-{
-  local  _sources ;
-
-  if $(FT2_MULTI)
-  {
-    _sources = pcfdriver pcfread pcfutil ;
-  }
-  else
-  {
-    _sources = pcf ;
-  }
-
-  Library  $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/pcf Jamfile

+ 0 - 35
sys/src/libfreetype/src/pcf/descrip.mms

@@ -1,35 +0,0 @@
-#
-# FreeType 2 pcf driver compilation rules for VMS
-#
-
-
-# Copyright (C) 2001, 2002 by
-# Francesco Zappa Nardelli
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-
-CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.pcf])
-
-OBJS=pcf.obj
-
-all : $(OBJS)
-        library [--.lib]freetype.olb $(OBJS)
-
-# EOF

+ 0 - 32
sys/src/libfreetype/src/pcf/module.mk

@@ -1,32 +0,0 @@
-#
-# FreeType 2 PCF module definition
-#
-
-# Copyright 2000 by
-# Francesco Zappa Nardelli
-# 
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-make_module_list: add_pcf_driver
-
-add_pcf_driver:
-	$(OPEN_DRIVER)pcf_driver_class$(CLOSE_DRIVER)
-	$(ECHO_DRIVER)pcf       $(ECHO_DRIVER_DESC)pcf bitmap fonts$(ECHO_DRIVER_DONE)
-
-# EOF

+ 0 - 36
sys/src/libfreetype/src/pcf/pcf.c

@@ -1,36 +0,0 @@
-/*  pcf.c
-
-    FreeType font driver for pcf fonts
-
-  Copyright 2000-2001 by
-  Francesco Zappa Nardelli
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-
-#define FT_MAKE_OPTION_SINGLE_OBJECT
-
-
-#include <ft2build.h>
-#include "pcfutil.c"
-#include "pcfread.c"
-#include "pcfdriver.c"
-
-/* END */

+ 0 - 237
sys/src/libfreetype/src/pcf/pcf.h

@@ -1,237 +0,0 @@
-/*  pcf.h
-
-  FreeType font driver for pcf fonts
-
-  Copyright (C) 2000-2001, 2002 by
-  Francesco Zappa Nardelli
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-
-#ifndef __PCF_H__
-#define __PCF_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
-#include FT_INTERNAL_STREAM_H
-
-
-FT_BEGIN_HEADER
-
-  typedef struct  PCF_TableRec_
-  {
-    FT_ULong  type;
-    FT_ULong  format;
-    FT_ULong  size;
-    FT_ULong  offset;
-
-  } PCF_TableRec, *PCF_Table;
-
-
-  typedef struct  PCF_TocRec_
-  {
-    FT_ULong   version;
-    FT_ULong   count;
-    PCF_Table  tables;
-
-  } PCF_TocRec, *PCF_Toc;
-
-
-  typedef struct  PCF_ParsePropertyRec_
-  {
-    FT_Long  name;
-    FT_Byte  isString;
-    FT_Long  value;
-
-  } PCF_ParsePropertyRec, *PCF_ParseProperty;
-
-
-  typedef struct  PCF_PropertyRec_
-  {
-    FT_String*  name;
-    FT_Byte     isString;
-
-    union
-    {
-      FT_String*  atom;
-      FT_Long     integer;
-      FT_ULong    cardinal;
-
-    } value;
-
-  } PCF_PropertyRec, *PCF_Property;
-
-
-  typedef struct  PCF_Compressed_MetricRec_
-  {
-    FT_Byte  leftSideBearing;
-    FT_Byte  rightSideBearing;
-    FT_Byte  characterWidth;
-    FT_Byte  ascent;
-    FT_Byte  descent;
-
-  } PCF_Compressed_MetricRec, *PCF_Compressed_Metric;
-
-
-  typedef struct  PCF_MetricRec_
-  {
-    FT_Short  leftSideBearing;
-    FT_Short  rightSideBearing;
-    FT_Short  characterWidth;
-    FT_Short  ascent;
-    FT_Short  descent;
-    FT_Short  attributes;
-    FT_ULong  bits;
-
-  } PCF_MetricRec, *PCF_Metric;
-
-
-  typedef struct  PCF_AccelRec_
-  {
-    FT_Byte        noOverlap;
-    FT_Byte        constantMetrics;
-    FT_Byte        terminalFont;
-    FT_Byte        constantWidth;
-    FT_Byte        inkInside;
-    FT_Byte        inkMetrics;
-    FT_Byte        drawDirection;
-    FT_Long        fontAscent;
-    FT_Long        fontDescent;
-    FT_Long        maxOverlap;
-    PCF_MetricRec  minbounds;
-    PCF_MetricRec  maxbounds;
-    PCF_MetricRec  ink_minbounds;
-    PCF_MetricRec  ink_maxbounds;
-
-  } PCF_AccelRec, *PCF_Accel;
-
-
-  typedef struct  PCD_EncodingRec_
-  {
-    FT_Long   enc;
-    FT_Short  glyph;
-
-  } PCF_EncodingRec, *PCF_Encoding;
-
-
-  typedef struct  PCF_FaceRec_
-  {
-    FT_FaceRec     root;
-
-    FT_StreamRec   gzip_stream;
-    FT_Stream      gzip_source;
-
-    char*          charset_encoding;
-    char*          charset_registry;
-
-    PCF_TocRec     toc;
-    PCF_AccelRec   accel;
-
-    int            nprops;
-    PCF_Property   properties;
-
-    FT_Long        nmetrics;
-    PCF_Metric     metrics;
-    FT_Long        nencodings;
-    PCF_Encoding   encodings;
-
-    FT_Short       defaultChar;
-
-    FT_ULong       bitmapsFormat;
-
-    FT_CharMap     charmap_handle;
-    FT_CharMapRec  charmap;  /* a single charmap per face */
-
-  } PCF_FaceRec, *PCF_Face;
-
-
-  /* macros for pcf font format */
-
-#define LSBFirst  0
-#define MSBFirst  1
-
-#define PCF_FILE_VERSION        ( ( 'p' << 24 ) | \
-                                  ( 'c' << 16 ) | \
-                                  ( 'f' <<  8 ) | 1 )
-#define PCF_FORMAT_MASK         0xFFFFFF00L
-
-#define PCF_DEFAULT_FORMAT      0x00000000L
-#define PCF_INKBOUNDS           0x00000200L
-#define PCF_ACCEL_W_INKBOUNDS   0x00000100L
-#define PCF_COMPRESSED_METRICS  0x00000100L
-
-#define PCF_FORMAT_MATCH( a, b ) \
-          ( ( (a) & PCF_FORMAT_MASK ) == ( (b) & PCF_FORMAT_MASK ) )
-
-#define PCF_GLYPH_PAD_MASK  ( 3 << 0 )
-#define PCF_BYTE_MASK       ( 1 << 2 )
-#define PCF_BIT_MASK        ( 1 << 3 )
-#define PCF_SCAN_UNIT_MASK  ( 3 << 4 )
-
-#define PCF_BYTE_ORDER( f ) \
-          ( ( (f) & PCF_BYTE_MASK ) ? MSBFirst : LSBFirst )
-#define PCF_BIT_ORDER( f ) \
-          ( ( (f) & PCF_BIT_MASK ) ? MSBFirst : LSBFirst )
-#define PCF_GLYPH_PAD_INDEX( f ) \
-          ( (f) & PCF_GLYPH_PAD_MASK )
-#define PCF_GLYPH_PAD( f ) \
-          ( 1 << PCF_GLYPH_PAD_INDEX( f ) )
-#define PCF_SCAN_UNIT_INDEX( f ) \
-          ( ( (f) & PCF_SCAN_UNIT_MASK ) >> 4 )
-#define PCF_SCAN_UNIT( f ) \
-          ( 1 << PCF_SCAN_UNIT_INDEX( f ) )
-#define PCF_FORMAT_BITS( f )             \
-          ( (f) & ( PCF_GLYPH_PAD_MASK | \
-                    PCF_BYTE_MASK      | \
-                    PCF_BIT_MASK       | \
-                    PCF_SCAN_UNIT_MASK ) )
-
-#define PCF_SIZE_TO_INDEX( s )  ( (s) == 4 ? 2 : (s) == 2 ? 1 : 0 )
-#define PCF_INDEX_TO_SIZE( b )  ( 1 << b )
-
-#define PCF_FORMAT( bit, byte, glyph, scan )          \
-          ( ( PCF_SIZE_TO_INDEX( scan )      << 4 ) | \
-            ( ( (bit)  == MSBFirst ? 1 : 0 ) << 3 ) | \
-            ( ( (byte) == MSBFirst ? 1 : 0 ) << 2 ) | \
-            ( PCF_SIZE_TO_INDEX( glyph )     << 0 ) )
-
-#define PCF_PROPERTIES        ( 1 << 0 )
-#define PCF_ACCELERATORS      ( 1 << 1 )
-#define PCF_METRICS           ( 1 << 2 )
-#define PCF_BITMAPS           ( 1 << 3 )
-#define PCF_INK_METRICS       ( 1 << 4 )
-#define PCF_BDF_ENCODINGS     ( 1 << 5 )
-#define PCF_SWIDTHS           ( 1 << 6 )
-#define PCF_GLYPH_NAMES       ( 1 << 7 )
-#define PCF_BDF_ACCELERATORS  ( 1 << 8 )
-
-#define GLYPHPADOPTIONS  4 /* I'm not sure about this */
-
-  FT_LOCAL( FT_Error )
-  pcf_load_font( FT_Stream,
-                 PCF_Face );
-
-FT_END_HEADER
-
-#endif /* __PCF_H__ */
-
-
-/* END */

+ 0 - 545
sys/src/libfreetype/src/pcf/pcfdriver.c

@@ -1,545 +0,0 @@
-/*  pcfdriver.c
-
-    FreeType font driver for pcf files
-
-    Copyright (C) 2000-2001, 2002 by
-    Francesco Zappa Nardelli
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-
-#include <ft2build.h>
-
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_GZIP_H
-#include FT_ERRORS_H
-#include FT_BDF_H
-
-#include "pcf.h"
-#include "pcfdriver.h"
-#include "pcfutil.h"
-#include "pcfread.h"
-
-#include "pcferror.h"
-
-#undef  FT_COMPONENT
-#define FT_COMPONENT  trace_pcfread
-
-
-  typedef struct  PCF_CMapRec_
-  {
-    FT_CMapRec    cmap;
-    FT_UInt       num_encodings;
-    PCF_Encoding  encodings;
-
-  } PCF_CMapRec, *PCF_CMap;
-
-
-  FT_CALLBACK_DEF( FT_Error )
-  pcf_cmap_init( PCF_CMap  cmap )
-  {
-    PCF_Face  face = (PCF_Face)FT_CMAP_FACE( cmap );
-
-
-    cmap->num_encodings = (FT_UInt)face->nencodings;
-    cmap->encodings     = face->encodings;
-
-    return FT_Err_Ok;
-  }
-
-
-  FT_CALLBACK_DEF( void )
-  pcf_cmap_done( PCF_CMap  cmap )
-  {
-    cmap->encodings     = NULL;
-    cmap->num_encodings = 0;
-  }
-
-
-  FT_CALLBACK_DEF( FT_UInt )
-  pcf_cmap_char_index( PCF_CMap   cmap,
-                       FT_UInt32  charcode )
-  {
-    PCF_Encoding  encodings = cmap->encodings;
-    FT_UInt       min, max, mid;
-    FT_UInt       result = 0;
-
-
-    min = 0;
-    max = cmap->num_encodings;
-
-    while ( min < max )
-    {
-      FT_UInt32  code;
-
-
-      mid  = ( min + max ) >> 1;
-      code = encodings[mid].enc;
-
-      if ( charcode == code )
-      {
-        result = encodings[mid].glyph + 1;
-        break;
-      }
-
-      if ( charcode < code )
-        max = mid;
-      else
-        min = mid + 1;
-    }
-
-    return result;
-  }
-
-
-  FT_CALLBACK_DEF( FT_UInt )
-  pcf_cmap_char_next( PCF_CMap    cmap,
-                      FT_UInt32  *acharcode )
-  {
-    PCF_Encoding  encodings = cmap->encodings;
-    FT_UInt       min, max, mid;
-    FT_UInt32     charcode = *acharcode + 1;
-    FT_UInt       result   = 0;
-
-
-    min = 0;
-    max = cmap->num_encodings;
-
-    while ( min < max )
-    {
-      FT_UInt32  code;
-
-
-      mid  = ( min + max ) >> 1;
-      code = encodings[mid].enc;
-
-      if ( charcode == code )
-      {
-        result = encodings[mid].glyph + 1;
-        goto Exit;
-      }
-
-      if ( charcode < code )
-        max = mid;
-      else
-        min = mid + 1;
-    }
-
-    charcode = 0;
-    if ( min < cmap->num_encodings )
-    {
-      charcode = encodings[min].enc;
-      result   = encodings[min].glyph + 1;
-    }
-
-  Exit:
-    *acharcode = charcode;
-    return result;
-  }
-
-
-  FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec  pcf_cmap_class =
-  {
-    sizeof( PCF_CMapRec ),
-    (FT_CMap_InitFunc)     pcf_cmap_init,
-    (FT_CMap_DoneFunc)     pcf_cmap_done,
-    (FT_CMap_CharIndexFunc)pcf_cmap_char_index,
-    (FT_CMap_CharNextFunc) pcf_cmap_char_next
-  };
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
-  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */
-  /* messages during execution.                                            */
-  /*                                                                       */
-#undef  FT_COMPONENT
-#define FT_COMPONENT  trace_pcfdriver
-
-
-  FT_CALLBACK_DEF( FT_Error )
-  PCF_Face_Done( PCF_Face  face )
-  {
-    FT_Memory  memory = FT_FACE_MEMORY( face );
-
-
-    FT_FREE( face->encodings );
-    FT_FREE( face->metrics );
-
-    /* free properties */
-    {
-      PCF_Property  prop = face->properties;
-      FT_Int        i;
-
-
-      for ( i = 0; i < face->nprops; i++ )
-      {
-        prop = &face->properties[i];
-
-        FT_FREE( prop->name );
-        if ( prop->isString )
-          FT_FREE( prop->value );
-      }
-
-      FT_FREE( face->properties );
-    }
-
-    FT_FREE( face->toc.tables );
-    FT_FREE( face->root.family_name );
-    FT_FREE( face->root.available_sizes );
-    FT_FREE( face->charset_encoding );
-    FT_FREE( face->charset_registry );
-
-    FT_TRACE4(( "PCF_Face_Done: done face\n" ));
-
-    /* close gzip stream if any */
-    if ( face->root.stream == &face->gzip_stream )
-    {
-      FT_Stream_Close( &face->gzip_stream );
-      face->root.stream = face->gzip_source;
-    }
-
-    return PCF_Err_Ok;
-  }
-
-
-  FT_CALLBACK_DEF( FT_Error )
-  PCF_Face_Init( FT_Stream      stream,
-                 PCF_Face       face,
-                 FT_Int         face_index,
-                 FT_Int         num_params,
-                 FT_Parameter*  params )
-  {
-    FT_Error  error = PCF_Err_Ok;
-
-    FT_UNUSED( num_params );
-    FT_UNUSED( params );
-    FT_UNUSED( face_index );
-
-
-    error = pcf_load_font( stream, face );
-    if ( error )
-    {
-      FT_Error  error2;
-
-      /* this didn't work, try gzip support !! */
-      error2 = FT_Stream_OpenGzip( &face->gzip_stream, stream );
-      if ( error2 == FT_Err_Unimplemented_Feature )
-        goto Fail;
-
-      error = error2;
-      if ( error )
-        goto Fail;
-
-      face->gzip_source = stream;
-      face->root.stream = &face->gzip_stream;
-
-      stream = face->root.stream;
-
-      error = pcf_load_font( stream, face );
-      if ( error )
-        goto Fail;
-    }
-
-    /* set-up charmap */
-    {
-      FT_String  *charset_registry, *charset_encoding;
-      FT_Bool     unicode_charmap  = 0;
-
-
-      charset_registry = face->charset_registry;
-      charset_encoding = face->charset_encoding;
-
-      if ( ( charset_registry != NULL ) &&
-           ( charset_encoding != NULL ) )
-      {
-        if ( !ft_strcmp( face->charset_registry, "ISO10646" )     ||
-             ( !ft_strcmp( face->charset_registry, "ISO8859" ) &&
-               !ft_strcmp( face->charset_encoding, "1" )       )  )
-          unicode_charmap = 1;
-      }
-
-      {
-        FT_CharMapRec  charmap;
-
-
-        charmap.face        = FT_FACE( face );
-        charmap.encoding    = FT_ENCODING_NONE;
-        charmap.platform_id = 0;
-        charmap.encoding_id = 0;
-
-        if ( unicode_charmap )
-        {
-          charmap.encoding    = FT_ENCODING_UNICODE;
-          charmap.platform_id = 3;
-          charmap.encoding_id = 1;
-        }
-
-        error = FT_CMap_New( &pcf_cmap_class, NULL, &charmap, NULL );
-
-#if 0
-        /* Select default charmap */
-        if (face->root.num_charmaps)
-          face->root.charmap = face->root.charmaps[0];
-#endif
-      }
-    }
-
-  Exit:
-    return error;
-
-  Fail:
-    FT_TRACE2(( "[not a valid PCF file]\n" ));
-    error = PCF_Err_Unknown_File_Format;  /* error */
-    goto Exit;
-  }
-
-
-  static FT_Error
-  PCF_Set_Pixel_Size( FT_Size  size )
-  {
-    PCF_Face face = (PCF_Face)FT_SIZE_FACE( size );
-
-
-    FT_TRACE4(( "rec %d - pres %d\n", size->metrics.y_ppem,
-                                      face->root.available_sizes->height ));
-
-    if ( size->metrics.y_ppem == face->root.available_sizes->height )
-    {
-      size->metrics.ascender    = face->accel.fontAscent << 6;
-      size->metrics.descender   = face->accel.fontDescent * (-64);
-#if 0
-      size->metrics.height      = face->accel.maxbounds.ascent << 6;
-#endif
-      size->metrics.height      = size->metrics.ascender -
-                                  size->metrics.descender;
-
-      size->metrics.max_advance = face->accel.maxbounds.characterWidth << 6;
-
-      return PCF_Err_Ok;
-    }
-    else
-    {
-      FT_TRACE4(( "size WRONG\n" ));
-      return PCF_Err_Invalid_Pixel_Size;
-    }
-  }
-
-
-  static FT_Error
-  PCF_Glyph_Load( FT_GlyphSlot  slot,
-                  FT_Size       size,
-                  FT_UInt       glyph_index,
-                  FT_Int32      load_flags )
-  {
-    PCF_Face    face   = (PCF_Face)FT_SIZE_FACE( size );
-    FT_Stream   stream = face->root.stream;
-    FT_Error    error  = PCF_Err_Ok;
-    FT_Bitmap*  bitmap = &slot->bitmap;
-    PCF_Metric  metric;
-    int         bytes;
-
-    FT_UNUSED( load_flags );
-
-
-    FT_TRACE4(( "load_glyph %d ---", glyph_index ));
-
-    if ( !face )
-    {
-      error = PCF_Err_Invalid_Argument;
-      goto Exit;
-    }
-
-    if ( glyph_index > 0 )
-      glyph_index--;
-
-    metric = face->metrics + glyph_index;
-
-    bitmap->rows       = metric->ascent + metric->descent;
-    bitmap->width      = metric->rightSideBearing - metric->leftSideBearing;
-    bitmap->num_grays  = 1;
-    bitmap->pixel_mode = FT_PIXEL_MODE_MONO;
-
-    FT_TRACE6(( "BIT_ORDER %d ; BYTE_ORDER %d ; GLYPH_PAD %d\n",
-                  PCF_BIT_ORDER( face->bitmapsFormat ),
-                  PCF_BYTE_ORDER( face->bitmapsFormat ),
-                  PCF_GLYPH_PAD( face->bitmapsFormat ) ));
-
-    switch ( PCF_GLYPH_PAD( face->bitmapsFormat ) )
-    {
-    case 1:
-      bitmap->pitch = ( bitmap->width + 7 ) >> 3;
-      break;
-
-    case 2:
-      bitmap->pitch = ( ( bitmap->width + 15 ) >> 4 ) << 1;
-      break;
-
-    case 4:
-      bitmap->pitch = ( ( bitmap->width + 31 ) >> 5 ) << 2;
-      break;
-
-    case 8:
-      bitmap->pitch = ( ( bitmap->width + 63 ) >> 6 ) << 3;
-      break;
-
-    default:
-      return PCF_Err_Invalid_File_Format;
-    }
-
-    /* XXX: to do: are there cases that need repadding the bitmap? */
-    bytes = bitmap->pitch * bitmap->rows;
-
-    error = ft_glyphslot_alloc_bitmap( slot, bytes );
-    if ( error )
-      goto Exit;
-
-    if ( FT_STREAM_SEEK( metric->bits )          ||
-         FT_STREAM_READ( bitmap->buffer, bytes ) )
-      goto Exit;
-
-    if ( PCF_BIT_ORDER( face->bitmapsFormat ) != MSBFirst )
-      BitOrderInvert( bitmap->buffer, bytes );
-
-    if ( ( PCF_BYTE_ORDER( face->bitmapsFormat ) !=
-           PCF_BIT_ORDER( face->bitmapsFormat )  ) )
-    {
-      switch ( PCF_SCAN_UNIT( face->bitmapsFormat ) )
-      {
-      case 1:
-        break;
-
-      case 2:
-        TwoByteSwap( bitmap->buffer, bytes );
-        break;
-
-      case 4:
-        FourByteSwap( bitmap->buffer, bytes );
-        break;
-      }
-    }
-
-    slot->bitmap_left = metric->leftSideBearing;
-    slot->bitmap_top  = metric->ascent;
-
-    slot->metrics.horiAdvance  = metric->characterWidth << 6 ;
-    slot->metrics.horiBearingX = metric->leftSideBearing << 6 ;
-    slot->metrics.horiBearingY = metric->ascent << 6 ;
-    slot->metrics.width        = ( metric->rightSideBearing -
-                                   metric->leftSideBearing ) << 6;
-    slot->metrics.height       = bitmap->rows << 6;
-
-    slot->linearHoriAdvance = (FT_Fixed)bitmap->width << 16;
-    slot->format            = FT_GLYPH_FORMAT_BITMAP;
-
-    FT_TRACE4(( " --- ok\n" ));
-
-  Exit:
-    return error;
-  }
-
-
-  static FT_Error
-  pcf_get_bdf_property( PCF_Face          face,
-                        const char*       prop_name,
-                        BDF_PropertyRec  *aproperty )
-  {
-    PCF_Property   prop;
-
-    prop = pcf_find_property( face, prop_name );
-    if ( prop != NULL )
-    {
-      if ( prop->isString )
-      {
-        aproperty->type   = BDF_PROPERTY_TYPE_ATOM;
-        aproperty->u.atom = prop->value.atom;
-      }
-      else
-      {
-       /* apparently, the PCF driver loads all properties as signed integers !
-        * this really doesn't seem to be a problem, because this is
-        * sufficient for any meaningful values
-        */
-        aproperty->type      = BDF_PROPERTY_TYPE_INTEGER;
-        aproperty->u.integer = prop->value.integer;
-      }
-      return 0;
-    }
-    return FT_Err_Invalid_Argument;
-  }
-
-
-  static FT_Module_Interface
-  pcf_driver_requester( FT_Module    module,
-                        const char*  name )
-  {
-    FT_UNUSED( module );
-
-    if ( name && ft_strcmp( name, "get_bdf_property" ) == 0 )
-      return (FT_Module_Interface) pcf_get_bdf_property;
-
-    return NULL;
-  }
-
-
-  FT_CALLBACK_TABLE_DEF
-  const FT_Driver_ClassRec  pcf_driver_class =
-  {
-    {
-      ft_module_font_driver,
-      sizeof ( FT_DriverRec ),
-
-      "pcf",
-      0x10000L,
-      0x20000L,
-
-      0,
-
-      (FT_Module_Constructor)0,
-      (FT_Module_Destructor) 0,
-      (FT_Module_Requester)  pcf_driver_requester
-    },
-
-    sizeof( PCF_FaceRec ),
-    sizeof( FT_SizeRec ),
-    sizeof( FT_GlyphSlotRec ),
-
-    (FT_Face_InitFunc)        PCF_Face_Init,
-    (FT_Face_DoneFunc)        PCF_Face_Done,
-    (FT_Size_InitFunc)        0,
-    (FT_Size_DoneFunc)        0,
-    (FT_Slot_InitFunc)        0,
-    (FT_Slot_DoneFunc)        0,
-
-    (FT_Size_ResetPointsFunc) PCF_Set_Pixel_Size,
-    (FT_Size_ResetPixelsFunc) PCF_Set_Pixel_Size,
-
-    (FT_Slot_LoadFunc)        PCF_Glyph_Load,
-
-    (FT_Face_GetKerningFunc)  0,
-    (FT_Face_AttachFunc)      0,
-    (FT_Face_GetAdvancesFunc) 0
-  };
-
-
-/* END */

+ 0 - 44
sys/src/libfreetype/src/pcf/pcfdriver.h

@@ -1,44 +0,0 @@
-/*  pcfdriver.h
-
-    FreeType font driver for pcf fonts
-
-  Copyright 2000-2001, 2002 by
-  Francesco Zappa Nardelli
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-
-#ifndef __PCFDRIVER_H__
-#define __PCFDRIVER_H__
-
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
-
-FT_BEGIN_HEADER
-
-  FT_EXPORT_VAR( const FT_Driver_ClassRec )  pcf_driver_class;
-
-FT_END_HEADER
-
-
-#endif /* __PCFDRIVER_H__ */
-
-
-/* END */

+ 0 - 40
sys/src/libfreetype/src/pcf/pcferror.h

@@ -1,40 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  pcferror.h                                                             */
-/*                                                                         */
-/*    PCF error codes (specification only).                                */
-/*                                                                         */
-/*  Copyright 2001 by                                                      */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* This file is used to define the PCF error enumeration constants.      */
-  /*                                                                       */
-  /*************************************************************************/
-
-#ifndef __PCFERROR_H__
-#define __PCFERROR_H__
-
-#include FT_MODULE_ERRORS_H
-
-#undef __FTERRORS_H__
-
-#define FT_ERR_PREFIX  PCF_Err_
-#define FT_ERR_BASE    FT_Mod_Err_PCF
-
-#include FT_ERRORS_H
-
-#endif /* __PCFERROR_H__ */
-
-
-/* END */

+ 0 - 1058
sys/src/libfreetype/src/pcf/pcfread.c

@@ -1,1058 +0,0 @@
-/*  pcfread.c
-
-    FreeType font driver for pcf fonts
-
-  Copyright 2000-2001, 2002 by
-  Francesco Zappa Nardelli
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-
-#include <ft2build.h>
-
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_OBJECTS_H
-
-#include "pcf.h"
-#include "pcfdriver.h"
-#include "pcfread.h"
-
-#include "pcferror.h"
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
-  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */
-  /* messages during execution.                                            */
-  /*                                                                       */
-#undef  FT_COMPONENT
-#define FT_COMPONENT  trace_pcfread
-
-
-#if defined( FT_DEBUG_LEVEL_TRACE )
-  static const char*  tableNames[] =
-  {
-    "prop", "accl", "mtrcs", "bmps", "imtrcs",
-    "enc", "swidth", "names", "accel"
-  };
-#endif
-
-
-  static
-  const FT_Frame_Field  pcf_toc_header[] =
-  {
-#undef  FT_STRUCTURE
-#define FT_STRUCTURE  PCF_TocRec
-
-    FT_FRAME_START( 8 ),
-      FT_FRAME_ULONG_LE( version ),
-      FT_FRAME_ULONG_LE( count ),
-    FT_FRAME_END
-  };
-
-
-  static
-  const FT_Frame_Field  pcf_table_header[] =
-  {
-#undef  FT_STRUCTURE
-#define FT_STRUCTURE  PCF_TableRec
-
-    FT_FRAME_START( 16  ),
-      FT_FRAME_ULONG_LE( type ),
-      FT_FRAME_ULONG_LE( format ),
-      FT_FRAME_ULONG_LE( size ),
-      FT_FRAME_ULONG_LE( offset ),
-    FT_FRAME_END
-  };
-
-
-  static FT_Error
-  pcf_read_TOC( FT_Stream  stream,
-                PCF_Face   face )
-  {
-    FT_Error   error;
-    PCF_Toc    toc = &face->toc;
-    PCF_Table  tables;
-
-    FT_Memory  memory = FT_FACE(face)->memory;
-    FT_UInt    n;
-
-
-    if ( FT_STREAM_SEEK ( 0 )                          ||
-         FT_STREAM_READ_FIELDS ( pcf_toc_header, toc ) )
-      return PCF_Err_Cannot_Open_Resource;
-
-    if ( toc->version != PCF_FILE_VERSION )
-      return PCF_Err_Invalid_File_Format;
-
-    if ( FT_NEW_ARRAY( face->toc.tables, toc->count ) )
-      return PCF_Err_Out_Of_Memory;
-
-    tables = face->toc.tables;
-    for ( n = 0; n < toc->count; n++ )
-    {
-      if ( FT_STREAM_READ_FIELDS( pcf_table_header, tables ) )
-        goto Exit;
-      tables++;
-    }
-
-#if defined( FT_DEBUG_LEVEL_TRACE )
-
-    {
-      FT_UInt      i, j;
-      const char*  name = "?";
-
-
-      FT_TRACE4(( "Tables count: %ld\n", face->toc.count ));
-      tables = face->toc.tables;
-      for ( i = 0; i < toc->count; i++ )
-      {
-        for( j = 0; j < sizeof ( tableNames ) / sizeof ( tableNames[0] ); j++ )
-          if ( tables[i].type == (FT_UInt)( 1 << j ) )
-            name = tableNames[j];
-
-        FT_TRACE4(( "Table %d: type=%-6s format=0x%04lX "
-                    "size=0x%06lX (%8ld) offset=0x%04lX\n",
-                    i, name,
-                    tables[i].format,
-                    tables[i].size, tables[i].size,
-                    tables[i].offset ));
-      }
-    }
-
-#endif
-
-    return PCF_Err_Ok;
-
-  Exit:
-    FT_FREE( face->toc.tables );
-    return error;
-  }
-
-
-  static
-  const FT_Frame_Field  pcf_metric_header[] =
-  {
-#undef  FT_STRUCTURE
-#define FT_STRUCTURE  PCF_MetricRec
-
-    FT_FRAME_START( 12 ),
-      FT_FRAME_SHORT_LE( leftSideBearing ),
-      FT_FRAME_SHORT_LE( rightSideBearing ),
-      FT_FRAME_SHORT_LE( characterWidth ),
-      FT_FRAME_SHORT_LE( ascent ),
-      FT_FRAME_SHORT_LE( descent ),
-      FT_FRAME_SHORT_LE( attributes ),
-    FT_FRAME_END
-  };
-
-
-  static
-  const FT_Frame_Field  pcf_metric_msb_header[] =
-  {
-#undef  FT_STRUCTURE
-#define FT_STRUCTURE  PCF_MetricRec
-
-    FT_FRAME_START( 12 ),
-      FT_FRAME_SHORT( leftSideBearing ),
-      FT_FRAME_SHORT( rightSideBearing ),
-      FT_FRAME_SHORT( characterWidth ),
-      FT_FRAME_SHORT( ascent ),
-      FT_FRAME_SHORT( descent ),
-      FT_FRAME_SHORT( attributes ),
-    FT_FRAME_END
-  };
-
-
-  static
-  const FT_Frame_Field  pcf_compressed_metric_header[] =
-  {
-#undef  FT_STRUCTURE
-#define FT_STRUCTURE  PCF_Compressed_MetricRec
-
-    FT_FRAME_START( 5 ),
-      FT_FRAME_BYTE( leftSideBearing ),
-      FT_FRAME_BYTE( rightSideBearing ),
-      FT_FRAME_BYTE( characterWidth ),
-      FT_FRAME_BYTE( ascent ),
-      FT_FRAME_BYTE( descent ),
-    FT_FRAME_END
-  };
-
-
-  static FT_Error
-  pcf_get_metric( FT_Stream   stream,
-                  FT_ULong    format,
-                  PCF_Metric  metric )
-  {
-    FT_Error  error = PCF_Err_Ok;
-
-
-    if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )
-    {
-      const FT_Frame_Field*  fields;
-
-
-      /* parsing normal metrics */
-      fields = PCF_BYTE_ORDER( format ) == MSBFirst
-               ? pcf_metric_msb_header
-               : pcf_metric_header;
-
-      /* the following sets 'error' but doesn't return in case of failure */
-      (void)FT_STREAM_READ_FIELDS( fields, metric );
-    }
-    else
-    {
-      PCF_Compressed_MetricRec  compr;
-
-
-      /* parsing compressed metrics */
-      if ( FT_STREAM_READ_FIELDS( pcf_compressed_metric_header, &compr ) )
-        goto Exit;
-
-      metric->leftSideBearing  = (FT_Short)( compr.leftSideBearing  - 0x80 );
-      metric->rightSideBearing = (FT_Short)( compr.rightSideBearing - 0x80 );
-      metric->characterWidth   = (FT_Short)( compr.characterWidth   - 0x80 );
-      metric->ascent           = (FT_Short)( compr.ascent           - 0x80 );
-      metric->descent          = (FT_Short)( compr.descent          - 0x80 );
-      metric->attributes       = 0;
-    }
-
-  Exit:
-    return error;
-  }
-
-
-  static FT_Error
-  pcf_seek_to_table_type( FT_Stream  stream,
-                          PCF_Table  tables,
-                          FT_Int     ntables,
-                          FT_ULong   type,
-                          FT_ULong  *aformat,
-                          FT_ULong  *asize )
-  {
-    FT_Error  error = 0;
-    FT_Int    i;
-
-
-    for ( i = 0; i < ntables; i++ )
-      if ( tables[i].type == type )
-      {
-        if ( stream->pos > tables[i].offset )
-          return PCF_Err_Invalid_Stream_Skip;
-
-        if ( FT_STREAM_SKIP( tables[i].offset - stream->pos ) )
-          return PCF_Err_Invalid_Stream_Skip;
-
-        *asize   = tables[i].size;  /* unused - to be removed */
-        *aformat = tables[i].format;
-
-        return PCF_Err_Ok;
-      }
-
-    return PCF_Err_Invalid_File_Format;
-  }
-
-
-  static FT_Bool
-  pcf_has_table_type( PCF_Table  tables,
-                      FT_Int     ntables,
-                      FT_ULong   type )
-  {
-    FT_Int  i;
-
-
-    for ( i = 0; i < ntables; i++ )
-      if ( tables[i].type == type )
-        return TRUE;
-
-    return FALSE;
-  }
-
-
-  static
-  const FT_Frame_Field  pcf_property_header[] =
-  {
-#undef  FT_STRUCTURE
-#define FT_STRUCTURE  PCF_ParsePropertyRec
-
-    FT_FRAME_START( 9 ),
-      FT_FRAME_LONG_LE( name ),
-      FT_FRAME_BYTE   ( isString ),
-      FT_FRAME_LONG_LE( value ),
-    FT_FRAME_END
-  };
-
-
-  static
-  const FT_Frame_Field  pcf_property_msb_header[] =
-  {
-#undef  FT_STRUCTURE
-#define FT_STRUCTURE  PCF_ParsePropertyRec
-
-    FT_FRAME_START( 9 ),
-      FT_FRAME_LONG( name ),
-      FT_FRAME_BYTE( isString ),
-      FT_FRAME_LONG( value ),
-    FT_FRAME_END
-  };
-
-
-  FT_LOCAL_DEF( PCF_Property )
-  pcf_find_property( PCF_Face          face,
-                     const FT_String*  prop )
-  {
-    PCF_Property  properties = face->properties;
-    FT_Bool       found      = 0;
-    int           i;
-
-
-    for ( i = 0 ; i < face->nprops && !found; i++ )
-    {
-      if ( !ft_strcmp( properties[i].name, prop ) )
-        found = 1;
-    }
-
-    if ( found )
-      return properties + i - 1;
-    else
-      return NULL;
-  }
-
-
-  static FT_Error
-  pcf_get_properties( FT_Stream  stream,
-                      PCF_Face   face )
-  {
-    PCF_ParseProperty  props      = 0;
-    PCF_Property       properties = 0;
-    FT_Int             nprops, i;
-    FT_ULong           format, size;
-    FT_Error           error;
-    FT_Memory          memory     = FT_FACE(face)->memory;
-    FT_ULong           string_size;
-    FT_String*         strings    = 0;
-
-
-    error = pcf_seek_to_table_type( stream,
-                                    face->toc.tables,
-                                    face->toc.count,
-                                    PCF_PROPERTIES,
-                                    &format,
-                                    &size );
-    if ( error )
-      goto Bail;
-
-    if ( FT_READ_ULONG_LE( format ) )
-      goto Bail;
-
-    FT_TRACE4(( "get_prop: format = %ld\n", format ));
-
-    if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )
-      goto Bail;
-
-    if ( PCF_BYTE_ORDER( format ) == MSBFirst )
-      (void)FT_READ_ULONG( nprops );
-    else
-      (void)FT_READ_ULONG_LE( nprops );
-    if ( error )
-      goto Bail;
-
-    FT_TRACE4(( "get_prop: nprop = %d\n", nprops ));
-
-    if ( FT_NEW_ARRAY( props, nprops ) )
-      goto Bail;
-
-    for ( i = 0; i < nprops; i++ )
-    {
-      if ( PCF_BYTE_ORDER( format ) == MSBFirst )
-      {
-        if ( FT_STREAM_READ_FIELDS( pcf_property_msb_header, props + i ) )
-          goto Bail;
-      }
-      else
-      {
-        if ( FT_STREAM_READ_FIELDS( pcf_property_header, props + i ) )
-          goto Bail;
-      }
-    }
-
-    /* pad the property array                                            */
-    /*                                                                   */
-    /* clever here - nprops is the same as the number of odd-units read, */
-    /* as only isStringProp are odd length   (Keith Packard)             */
-    /*                                                                   */
-    if ( nprops & 3 )
-    {
-      i = 4 - ( nprops & 3 );
-      FT_Stream_Skip( stream, i );
-    }
-
-    if ( PCF_BYTE_ORDER( format ) == MSBFirst )
-      (void)FT_READ_ULONG( string_size );
-    else
-      (void)FT_READ_ULONG_LE( string_size );
-    if ( error )
-      goto Bail;
-
-    FT_TRACE4(( "get_prop: string_size = %ld\n", string_size ));
-
-    if ( FT_NEW_ARRAY( strings, string_size ) )
-      goto Bail;
-
-    error = FT_Stream_Read( stream, (FT_Byte*)strings, string_size );
-    if ( error )
-      goto Bail;
-
-    if ( FT_NEW_ARRAY( properties, nprops ) )
-      goto Bail;
-
-    for ( i = 0; i < nprops; i++ )
-    {
-      /* XXX: make atom */
-      if ( FT_NEW_ARRAY( properties[i].name,
-                         ft_strlen( strings + props[i].name ) + 1 ) )
-        goto Bail;
-      ft_strcpy( properties[i].name,strings + props[i].name );
-
-      properties[i].isString = props[i].isString;
-
-      if ( props[i].isString )
-      {
-        if ( FT_NEW_ARRAY( properties[i].value.atom,
-                           ft_strlen( strings + props[i].value ) + 1 ) )
-          goto Bail;
-        ft_strcpy( properties[i].value.atom, strings + props[i].value );
-      }
-      else
-        properties[i].value.integer = props[i].value;
-    }
-
-    face->properties = properties;
-    face->nprops = nprops;
-
-    FT_FREE( props );
-    FT_FREE( strings );
-
-    return PCF_Err_Ok;
-
-  Bail:
-    FT_FREE( props );
-    FT_FREE( strings );
-
-    return error;
-  }
-
-
-  static FT_Error
-  pcf_get_metrics( FT_Stream  stream,
-                   PCF_Face   face )
-  {
-    FT_Error    error    = PCF_Err_Ok;
-    FT_Memory   memory   = FT_FACE(face)->memory;
-    FT_ULong    format   = 0;
-    FT_ULong    size     = 0;
-    PCF_Metric  metrics  = 0;
-    int         i;
-    int         nmetrics = -1;
-
-
-    error = pcf_seek_to_table_type( stream,
-                                    face->toc.tables,
-                                    face->toc.count,
-                                    PCF_METRICS,
-                                    &format,
-                                    &size );
-    if ( error )
-      return error;
-
-    error = FT_READ_ULONG_LE( format );
-
-    if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT )     &&
-         !PCF_FORMAT_MATCH( format, PCF_COMPRESSED_METRICS ) )
-      return PCF_Err_Invalid_File_Format;
-
-    if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )
-    {
-      if ( PCF_BYTE_ORDER( format ) == MSBFirst )
-        (void)FT_READ_ULONG( nmetrics );
-      else
-        (void)FT_READ_ULONG_LE( nmetrics );
-    }
-    else
-    {
-      if ( PCF_BYTE_ORDER( format ) == MSBFirst )
-        (void)FT_READ_USHORT( nmetrics );
-      else
-        (void)FT_READ_USHORT_LE( nmetrics );
-    }
-    if ( error || nmetrics == -1 )
-      return PCF_Err_Invalid_File_Format;
-
-    face->nmetrics = nmetrics;
-
-    if ( FT_NEW_ARRAY( face->metrics, nmetrics ) )
-      return PCF_Err_Out_Of_Memory;
-
-    metrics = face->metrics;
-    for ( i = 0; i < nmetrics; i++ )
-    {
-      pcf_get_metric( stream, format, metrics + i );
-
-      metrics[i].bits = 0;
-
-      FT_TRACE4(( "%d : width=%d, "
-                  "lsb=%d, rsb=%d, ascent=%d, descent=%d, swidth=%d\n",
-                  i,
-                  ( metrics + i )->characterWidth,
-                  ( metrics + i )->leftSideBearing,
-                  ( metrics + i )->rightSideBearing,
-                  ( metrics + i )->ascent,
-                  ( metrics + i )->descent,
-                  ( metrics + i )->attributes ));
-
-      if ( error )
-        break;
-    }
-
-    if ( error )
-      FT_FREE( face->metrics );
-    return error;
-  }
-
-
-  static FT_Error
-  pcf_get_bitmaps( FT_Stream  stream,
-                   PCF_Face   face )
-  {
-    FT_Error   error  = PCF_Err_Ok;
-    FT_Memory  memory = FT_FACE(face)->memory;
-    FT_Long*   offsets;
-    FT_Long    bitmapSizes[GLYPHPADOPTIONS];
-    FT_ULong   format, size;
-    int        nbitmaps, i, sizebitmaps = 0;
-    char*      bitmaps;
-
-
-    error = pcf_seek_to_table_type( stream,
-                                    face->toc.tables,
-                                    face->toc.count,
-                                    PCF_BITMAPS,
-                                    &format,
-                                    &size );
-    if ( error )
-      return error;
-
-    error = FT_Stream_EnterFrame( stream, 8 );
-    if ( error )
-      return error;
-
-    format = FT_GET_ULONG_LE();
-    if ( PCF_BYTE_ORDER( format ) == MSBFirst )
-      nbitmaps  = FT_GET_ULONG();
-    else
-      nbitmaps  = FT_GET_ULONG_LE();
-
-    FT_Stream_ExitFrame( stream );
-
-    if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )
-      return PCF_Err_Invalid_File_Format;
-
-    if ( nbitmaps != face->nmetrics )
-      return PCF_Err_Invalid_File_Format;
-
-    if ( FT_NEW_ARRAY( offsets, nbitmaps ) )
-      return error;
-
-    for ( i = 0; i < nbitmaps; i++ )
-    {
-      if ( PCF_BYTE_ORDER( format ) == MSBFirst )
-        (void)FT_READ_LONG( offsets[i] );
-      else
-        (void)FT_READ_LONG_LE( offsets[i] );
-
-      FT_TRACE4(( "bitmap %d is at offset %ld\n", i, offsets[i] ));
-    }
-    if ( error )
-      goto Bail;
-
-    for ( i = 0; i < GLYPHPADOPTIONS; i++ )
-    {
-      if ( PCF_BYTE_ORDER( format ) == MSBFirst )
-        (void)FT_READ_LONG( bitmapSizes[i] );
-      else
-        (void)FT_READ_LONG_LE( bitmapSizes[i] );
-      if ( error )
-        goto Bail;
-
-      sizebitmaps = bitmapSizes[PCF_GLYPH_PAD_INDEX( format )];
-
-      FT_TRACE4(( "padding %d implies a size of %ld\n", i, bitmapSizes[i] ));
-    }
-
-    FT_TRACE4(( "  %d bitmaps, padding index %ld\n",
-                nbitmaps,
-                PCF_GLYPH_PAD_INDEX( format ) ));
-    FT_TRACE4(( "bitmap size = %d\n", sizebitmaps ));
-
-    FT_UNUSED( sizebitmaps );       /* only used for debugging */
-
-    for ( i = 0; i < nbitmaps; i++ )
-      face->metrics[i].bits = stream->pos + offsets[i];
-
-    face->bitmapsFormat = format;
-
-    FT_FREE ( offsets );
-    return error;
-
-  Bail:
-    FT_FREE ( offsets );
-    FT_FREE ( bitmaps );
-    return error;
-  }
-
-
-  static FT_Error
-  pcf_get_encodings( FT_Stream  stream,
-                     PCF_Face   face )
-  {
-    FT_Error      error   = PCF_Err_Ok;
-    FT_Memory     memory  = FT_FACE(face)->memory;
-    FT_ULong      format, size;
-    int           firstCol, lastCol;
-    int           firstRow, lastRow;
-    int           nencoding, encodingOffset;
-    int           i, j;
-    PCF_Encoding  tmpEncoding, encoding = 0;
-
-
-    error = pcf_seek_to_table_type( stream,
-                                    face->toc.tables,
-                                    face->toc.count,
-                                    PCF_BDF_ENCODINGS,
-                                    &format,
-                                    &size );
-    if ( error )
-      return error;
-
-    error = FT_Stream_EnterFrame( stream, 14 );
-    if ( error )
-      return error;
-
-    format = FT_GET_ULONG_LE();
-
-    if ( PCF_BYTE_ORDER( format ) == MSBFirst )
-    {
-      firstCol          = FT_GET_SHORT();
-      lastCol           = FT_GET_SHORT();
-      firstRow          = FT_GET_SHORT();
-      lastRow           = FT_GET_SHORT();
-      face->defaultChar = FT_GET_SHORT();
-    }
-    else
-    {
-      firstCol          = FT_GET_SHORT_LE();
-      lastCol           = FT_GET_SHORT_LE();
-      firstRow          = FT_GET_SHORT_LE();
-      lastRow           = FT_GET_SHORT_LE();
-      face->defaultChar = FT_GET_SHORT_LE();
-    }
-
-    FT_Stream_ExitFrame( stream );
-
-    if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )
-      return PCF_Err_Invalid_File_Format;
-
-    FT_TRACE4(( "enc: firstCol %d, lastCol %d, firstRow %d, lastRow %d\n",
-                firstCol, lastCol, firstRow, lastRow ));
-
-    nencoding = ( lastCol - firstCol + 1 ) * ( lastRow - firstRow + 1 );
-
-    if ( FT_NEW_ARRAY( tmpEncoding, nencoding ) )
-      return PCF_Err_Out_Of_Memory;
-
-    error = FT_Stream_EnterFrame( stream, 2 * nencoding );
-    if ( error )
-      goto Bail;
-
-    for ( i = 0, j = 0 ; i < nencoding; i++ )
-    {
-      if ( PCF_BYTE_ORDER( format ) == MSBFirst )
-        encodingOffset = FT_GET_SHORT();
-      else
-        encodingOffset = FT_GET_SHORT_LE();
-
-      if ( encodingOffset != -1 )
-      {
-        tmpEncoding[j].enc = ( ( ( i / ( lastCol - firstCol + 1 ) ) +
-                                 firstRow ) * 256 ) +
-                               ( ( i % ( lastCol - firstCol + 1 ) ) +
-                                 firstCol );
-
-        tmpEncoding[j].glyph = (FT_Short)encodingOffset;
-        j++;
-      }
-
-      FT_TRACE4(( "enc n. %d ; Uni %ld ; Glyph %d\n",
-                  i, tmpEncoding[j - 1].enc, encodingOffset ));
-    }
-    FT_Stream_ExitFrame( stream );
-
-    if ( FT_NEW_ARRAY( encoding, j ) )
-      goto Bail;
-
-    for ( i = 0; i < j; i++ )
-    {
-      encoding[i].enc   = tmpEncoding[i].enc;
-      encoding[i].glyph = tmpEncoding[i].glyph;
-    }
-
-    face->nencodings = j;
-    face->encodings  = encoding;
-    FT_FREE( tmpEncoding );
-
-    return error;
-
-  Bail:
-    FT_FREE( encoding );
-    FT_FREE( tmpEncoding );
-    return error;
-  }
-
-
-  static
-  const FT_Frame_Field  pcf_accel_header[] =
-  {
-#undef  FT_STRUCTURE
-#define FT_STRUCTURE  PCF_AccelRec
-
-    FT_FRAME_START( 20 ),
-      FT_FRAME_BYTE      ( noOverlap ),
-      FT_FRAME_BYTE      ( constantMetrics ),
-      FT_FRAME_BYTE      ( terminalFont ),
-      FT_FRAME_BYTE      ( constantWidth ),
-      FT_FRAME_BYTE      ( inkInside ),
-      FT_FRAME_BYTE      ( inkMetrics ),
-      FT_FRAME_BYTE      ( drawDirection ),
-      FT_FRAME_SKIP_BYTES( 1 ),
-      FT_FRAME_LONG_LE   ( fontAscent ),
-      FT_FRAME_LONG_LE   ( fontDescent ),
-      FT_FRAME_LONG_LE   ( maxOverlap ),
-    FT_FRAME_END
-  };
-
-
-  static
-  const FT_Frame_Field  pcf_accel_msb_header[] =
-  {
-#undef  FT_STRUCTURE
-#define FT_STRUCTURE  PCF_AccelRec
-
-    FT_FRAME_START( 20 ),
-      FT_FRAME_BYTE      ( noOverlap ),
-      FT_FRAME_BYTE      ( constantMetrics ),
-      FT_FRAME_BYTE      ( terminalFont ),
-      FT_FRAME_BYTE      ( constantWidth ),
-      FT_FRAME_BYTE      ( inkInside ),
-      FT_FRAME_BYTE      ( inkMetrics ),
-      FT_FRAME_BYTE      ( drawDirection ),
-      FT_FRAME_SKIP_BYTES( 1 ),
-      FT_FRAME_LONG      ( fontAscent ),
-      FT_FRAME_LONG      ( fontDescent ),
-      FT_FRAME_LONG      ( maxOverlap ),
-    FT_FRAME_END
-  };
-
-
-  static FT_Error
-  pcf_get_accel( FT_Stream  stream,
-                 PCF_Face   face,
-                 FT_ULong   type )
-  {
-    FT_ULong   format, size;
-    FT_Error   error = PCF_Err_Ok;
-    PCF_Accel  accel = &face->accel;
-
-
-    error = pcf_seek_to_table_type( stream,
-                                    face->toc.tables,
-                                    face->toc.count,
-                                    type,
-                                    &format,
-                                    &size );
-    if ( error )
-      goto Bail;
-
-    error = FT_READ_ULONG_LE( format );
-
-    if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT )    &&
-         !PCF_FORMAT_MATCH( format, PCF_ACCEL_W_INKBOUNDS ) )
-      goto Bail;
-
-    if ( PCF_BYTE_ORDER( format ) == MSBFirst )
-    {
-      if ( FT_STREAM_READ_FIELDS( pcf_accel_msb_header, accel ) )
-        goto Bail;
-    }
-    else
-    {
-      if ( FT_STREAM_READ_FIELDS( pcf_accel_header, accel ) )
-        goto Bail;
-    }
-
-    error = pcf_get_metric( stream,
-                            format & ( ~PCF_FORMAT_MASK ),
-                            &(accel->minbounds) );
-    if ( error )
-      goto Bail;
-
-    error = pcf_get_metric( stream,
-                            format & ( ~PCF_FORMAT_MASK ),
-                            &(accel->maxbounds) );
-    if ( error )
-      goto Bail;
-
-    if ( PCF_FORMAT_MATCH( format, PCF_ACCEL_W_INKBOUNDS ) )
-    {
-      error = pcf_get_metric( stream,
-                              format & ( ~PCF_FORMAT_MASK ),
-                              &(accel->ink_minbounds) );
-      if ( error )
-        goto Bail;
-
-      error = pcf_get_metric( stream,
-                              format & ( ~PCF_FORMAT_MASK ),
-                              &(accel->ink_maxbounds) );
-      if ( error )
-        goto Bail;
-    }
-    else
-    {
-      accel->ink_minbounds = accel->minbounds; /* I'm not sure about this */
-      accel->ink_maxbounds = accel->maxbounds;
-    }
-    return error;
-
-  Bail:
-    return error;
-  }
-
-
-  FT_LOCAL_DEF( FT_Error )
-  pcf_load_font( FT_Stream  stream,
-                 PCF_Face   face )
-  {
-    FT_Error   error  = PCF_Err_Ok;
-    FT_Memory  memory = FT_FACE(face)->memory;
-    FT_Bool    hasBDFAccelerators;
-
-
-    error = pcf_read_TOC( stream, face );
-    if ( error )
-      goto Exit;
-
-    error = pcf_get_properties( stream, face );
-    if ( error )
-      goto Exit;
-
-    /* Use the old accelerators if no BDF accelerators are in the file. */
-    hasBDFAccelerators = pcf_has_table_type( face->toc.tables,
-                                             face->toc.count,
-                                             PCF_BDF_ACCELERATORS );
-    if ( !hasBDFAccelerators )
-    {
-      error = pcf_get_accel( stream, face, PCF_ACCELERATORS );
-      if ( error )
-        goto Exit;
-    }
-
-    /* metrics */
-    error = pcf_get_metrics( stream, face );
-    if ( error )
-      goto Exit;
-
-    /* bitmaps */
-    error = pcf_get_bitmaps( stream, face );
-    if ( error )
-      goto Exit;
-
-    /* encodings */
-    error = pcf_get_encodings( stream, face );
-    if ( error )
-      goto Exit;
-
-    /* BDF style accelerators (i.e. bounds based on encoded glyphs) */
-    if ( hasBDFAccelerators )
-    {
-      error = pcf_get_accel( stream, face, PCF_BDF_ACCELERATORS );
-      if ( error )
-        goto Exit;
-    }
-
-    /* XXX: TO DO: inkmetrics and glyph_names are missing */
-
-    /* now construct the face object */
-    {
-      FT_Face       root = FT_FACE( face );
-      PCF_Property  prop;
-      int           size_set = 0;
-
-
-      root->num_faces = 1;
-      root->face_index = 0;
-      root->face_flags = FT_FACE_FLAG_FIXED_SIZES |
-                         FT_FACE_FLAG_HORIZONTAL  |
-                         FT_FACE_FLAG_FAST_GLYPHS;
-
-      if ( face->accel.constantWidth )
-        root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
-
-      root->style_flags = 0;
-      prop = pcf_find_property( face, "SLANT" );
-      if ( prop != NULL )
-        if ( prop->isString )
-          if ( ( *(prop->value.atom) == 'O' ) ||
-               ( *(prop->value.atom) == 'I' ) )
-            root->style_flags |= FT_STYLE_FLAG_ITALIC;
-
-      prop = pcf_find_property( face, "WEIGHT_NAME" );
-      if ( prop != NULL )
-        if ( prop->isString )
-          if ( *(prop->value.atom) == 'B' )
-            root->style_flags |= FT_STYLE_FLAG_BOLD;
-
-      root->style_name = (char *)"Regular";
-
-      if ( root->style_flags & FT_STYLE_FLAG_BOLD ) {
-        if ( root->style_flags & FT_STYLE_FLAG_ITALIC )
-          root->style_name = (char *)"Bold Italic";
-        else
-          root->style_name = (char *)"Bold";
-      }
-      else if ( root->style_flags & FT_STYLE_FLAG_ITALIC )
-        root->style_name = (char *)"Italic";
-
-      prop = pcf_find_property( face, "FAMILY_NAME" );
-      if ( prop != NULL )
-      {
-        if ( prop->isString )
-        {
-          int  l = ft_strlen( prop->value.atom ) + 1;
-
-
-          if ( FT_NEW_ARRAY( root->family_name, l ) )
-            goto Exit;
-          ft_strcpy( root->family_name, prop->value.atom );
-        }
-      }
-      else
-        root->family_name = 0;
-
-      root->num_glyphs = face->nmetrics;
-
-      root->num_fixed_sizes = 1;
-      if ( FT_NEW_ARRAY( root->available_sizes, 1 ) )
-        goto Exit;
-
-      prop = pcf_find_property( face, "PIXEL_SIZE" );
-      if ( prop != NULL )
-      {
-        root->available_sizes->height =
-        root->available_sizes->width  = (FT_Short)( prop->value.integer );
-
-        size_set = 1;
-      }
-      else
-      {
-        prop = pcf_find_property( face, "POINT_SIZE" );
-        if ( prop != NULL )
-        {
-          PCF_Property  xres, yres, avgw;
-
-
-          xres = pcf_find_property( face, "RESOLUTION_X" );
-          yres = pcf_find_property( face, "RESOLUTION_Y" );
-          avgw = pcf_find_property( face, "AVERAGE_WIDTH" );
-
-          if ( ( yres != NULL ) && ( xres != NULL ) )
-          {
-            root->available_sizes->height =
-              (FT_Short)( prop->value.integer *
-                          yres->value.integer / 720 );
-
-              root->available_sizes->width =
-                (FT_Short)( prop->value.integer *
-                            xres->value.integer / 720 );
-
-            size_set = 1;
-          }
-        }
-      }
-
-      if (size_set == 0 )
-      {
-        root->available_sizes->width  = 12;
-        root->available_sizes->height = 12;
-      }
-
-      /* set-up charset */
-      {
-        PCF_Property  charset_registry = 0, charset_encoding = 0;
-
-
-        charset_registry = pcf_find_property( face, "CHARSET_REGISTRY" );
-        charset_encoding = pcf_find_property( face, "CHARSET_ENCODING" );
-
-        if ( ( charset_registry != NULL ) &&
-             ( charset_encoding != NULL ) )
-        {
-          if ( ( charset_registry->isString ) &&
-               ( charset_encoding->isString ) )
-          {
-            if ( FT_NEW_ARRAY( face->charset_encoding,
-                               ft_strlen( charset_encoding->value.atom ) + 1 ) )
-              goto Exit;
-
-            if ( FT_NEW_ARRAY( face->charset_registry,
-                               ft_strlen( charset_registry->value.atom ) + 1 ) )
-              goto Exit;
-
-            ft_strcpy( face->charset_registry, charset_registry->value.atom );
-            ft_strcpy( face->charset_encoding, charset_encoding->value.atom );
-          }
-        }
-      }
-    }
-
-  Exit:
-    if ( error )
-    {
-      /* this is done to respect the behaviour of the original */
-      /* PCF font driver.                                      */
-      error = PCF_Err_Invalid_File_Format;
-    }
-
-    return error;
-  }
-
-
-/* END */

+ 0 - 45
sys/src/libfreetype/src/pcf/pcfread.h

@@ -1,45 +0,0 @@
-/*  pcfread.h
-
-    FreeType font driver for pcf fonts
-
-  Copyright 2000-2001 by
-  Francesco Zappa Nardelli
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-
-#ifndef __PCFREAD_H__
-#define __PCFREAD_H__
-
-
-#include <ft2build.h>
-
-FT_BEGIN_HEADER
-
-  FT_LOCAL( PCF_Property )
-  pcf_find_property( PCF_Face          face,
-                     const FT_String*  prop );
-
-FT_END_HEADER
-
-#endif /* __PCFUTIL_H__ */
-
-
-/* END */

+ 0 - 215
sys/src/libfreetype/src/pcf/pcfutil.c

@@ -1,215 +0,0 @@
-/*
-
-Copyright 1990, 1994, 1998  The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-*/
-/* $XFree86: xc/lib/font/util/utilbitmap.c,v 1.3 1999/08/22 08:58:58 dawes Exp $ */
-
-/*
- * Author:  Keith Packard, MIT X Consortium
- */
-
-
-#include <ft2build.h>
-#include "pcfutil.h"
-
-
-  /* Utility functions for reformatting font bitmaps */
-
-  static const unsigned char  _reverse_byte[0x100] =
-  {
-    0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
-    0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
-    0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
-    0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
-    0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
-    0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
-    0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
-    0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
-    0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
-    0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
-    0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
-    0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
-    0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
-    0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
-    0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
-    0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
-    0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
-    0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
-    0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
-    0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
-    0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
-    0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
-    0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
-    0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
-    0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
-    0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
-    0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
-    0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
-    0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
-    0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
-    0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
-    0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
-  };
-
-  /*
-   *  Invert bit order within each BYTE of an array.
-   */
-
-  void
-  BitOrderInvert( unsigned char*  buf,
-                  int             nbytes )
-  {
-    const unsigned char*  rev = _reverse_byte;
-
-
-    for ( ; --nbytes >= 0; buf++ )
-      *buf = rev[*buf];
-  }
-
-
-  /*
-   *  Invert byte order within each 16-bits of an array.
-   */
-
-  void
-  TwoByteSwap( unsigned char*  buf,
-               int             nbytes )
-  {
-    unsigned char  c;
-
-
-    for ( ; nbytes > 0; nbytes -= 2, buf += 2 )
-    {
-      c      = buf[0];
-      buf[0] = buf[1];
-      buf[1] = c;
-    }
-  }
-
-  /*
-   *  Invert byte order within each 32-bits of an array.
-   */
-
-  void
-  FourByteSwap( unsigned char*  buf,
-                int             nbytes )
-  {
-    unsigned char  c;
-
-
-    for ( ; nbytes > 0; nbytes -= 4, buf += 4 )
-    {
-      c      = buf[0];
-      buf[0] = buf[3];
-      buf[3] = c;
-
-      c      = buf[1];
-      buf[1] = buf[2];
-      buf[2] = c;
-    }
-  }
-
-
-  /*
-   *  Repad a bitmap.
-   */
-
-  int
-  RepadBitmap( char*         pSrc,
-               char*         pDst,
-               unsigned int  srcPad,
-               unsigned int  dstPad,
-               int           width,
-               int           height )
-  {
-    int   srcWidthBytes, dstWidthBytes;
-    int   row, col;
-    char  *pTmpSrc, *pTmpDst;
-
-
-    switch ( srcPad )
-    {
-    case 1:
-      srcWidthBytes = ( width + 7 ) >> 3;
-      break;
-
-    case 2:
-      srcWidthBytes = ( ( width + 15 ) >> 4 ) << 1;
-      break;
-
-    case 4:
-      srcWidthBytes = ( ( width + 31 ) >> 5 ) << 2;
-      break;
-
-    case 8:
-      srcWidthBytes = ( ( width + 63 ) >> 6 ) << 3;
-      break;
-
-    default:
-      return 0;
-    }
-
-    switch ( dstPad )
-    {
-    case 1:
-      dstWidthBytes = ( width + 7 ) >> 3;
-      break;
-
-    case 2:
-      dstWidthBytes = ( ( width + 15 ) >> 4 ) << 1;
-      break;
-
-    case 4:
-      dstWidthBytes = ( ( width + 31 ) >> 5 ) << 2;
-      break;
-
-    case 8:
-      dstWidthBytes = ( ( width + 63 ) >> 6 ) << 3;
-      break;
-
-    default:
-      return 0;
-    }
-
-    width = srcWidthBytes;
-    if ( width > dstWidthBytes )
-      width = dstWidthBytes;
-
-    pTmpSrc= pSrc;
-    pTmpDst= pDst;
-
-    for ( row = 0; row < height; row++ )
-    {
-      for ( col = 0; col < width; col++ )
-        *pTmpDst++ = *pTmpSrc++;
-
-      while ( col < dstWidthBytes )
-      {
-        *pTmpDst++ = '\0';
-        col++;
-      }
-      pTmpSrc += srcWidthBytes - width;
-    }
-
-    return dstWidthBytes * height;
-  }
-
-
-/* END */

+ 0 - 58
sys/src/libfreetype/src/pcf/pcfutil.h

@@ -1,58 +0,0 @@
-/*  pcfutil.h
-
-    FreeType font driver for pcf fonts
-
-  Copyright 2000-2001 by
-  Francesco Zappa Nardelli
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-
-#ifndef __PCFUTIL_H__
-#define __PCFUTIL_H__
-
-
-#include <ft2build.h>
-
-
-  void
-  BitOrderInvert( unsigned char*  buf,
-                  int             nbytes);
-
-  void
-  TwoByteSwap( unsigned char*  buf,
-               int             nbytes);
-
-  void
-  FourByteSwap( unsigned char*  buf,
-                int             nbytes);
-
-  int
-  RepadBitmap( char*           pSrc,
-               char*           pDst,
-               unsigned int    srcPad,
-               unsigned int    dstPad,
-               int             width,
-               int             height);
-
-#endif /* __PCFUTIL_H__ */
-
-
-/* END */

+ 0 - 114
sys/src/libfreetype/src/pcf/readme

@@ -1,114 +0,0 @@
-                  FreeType font driver for PCF fonts
-
-                       Francesco Zappa Nardelli
-                  <francesco.zappa.nardelli@ens.fr>
-
-
-Introduction
-************
-
-PCF (Portable Compiled Format) is a binary bitmap font format, largely used
-in X world. This code implements a PCF driver for the FreeType library.
-Glyph images are loaded into memory only on demand, thus leading to a small
-memory footprint.
-
-Informations on the PCF font format can only be worked out from
-``pcfread.c'', and ``pcfwrite.c'', to be found, for instance, in the XFree86
-(www.xfree86.org) source tree (xc/lib/font/bitmap/).
-
-Many good bitmap fonts in bdf format come with XFree86: they can be
-compiled into the pcf format using the ``bdftopcf'' utility.
-
-
-Supported hardware
-******************
-
-The driver has been tested on linux/x86 and sunos5.5/sparc.  In both
-cases the compiler was gcc.  When back in Paris, I will test it also
-on linux/alpha.
-
-
-Encodings
-*********
-
-The variety of encodings that accompanies pcf fonts appears to encompass the
-small set defined in freetype.h.  On the other hand, each pcf font defines
-two properties that specify encoding and registry.
-
-I decided to make these two properties directly accessible, leaving to the
-client application the work of interpreting them.  For instance:
-
-  #include "pcftypes.h"  /* include/freetype/internal/pcftypes.h */
-
-  FT_Face     face;
-  PCF_Public_Face  pcfface;
-
-  FT_New_Face( library,..., &face );
-
-  pcfface = (PCF_Public_Face)face;
-  
-  if ((pcfface->charset_registry == "ISO10646") && 
-        (pcfface->charset_encoding) == "1")) [..]
-
-Thus the driver always export ``ft_encoding_none'' as
-face->charmap.encoding.  FT_Get_Char_Index() behavior is unmodified, that
-is, it converts the ULong value given as argument into the corresponding
-glyph number.
-
-
-Known problems
-**************
-
-- dealing explicitly with encodings breaks the uniformity of freetype2
-  api.
-
-- except for encodings properties, client applications have no
-  visibility of the PCF_Face object.  This means that applications
-  cannot directly access font tables and are obliged to trust
-  FreeType.
-
-- currently, glyph names and ink_metrics are ignored.
-
-I plan to give full visibility of the PCF_Face object in the next
-release of the driver, thus implementing also glyph names and
-ink_metrics.
-
-- height is defined as (ascent - descent).  Is this correct?
-
-- if unable to read size informations from the font, PCF_Init_Face
-  sets available_size->width and available_size->height to 12.
-
-- too many english grammar errors in the readme file :-(
-
-
-License
-*******
-
-Copyright (C) 2000 by Francesco Zappa Nardelli
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-Credits
-*******
-
-Keith Packard wrote the pcf driver found in XFree86.  His work is at
-the same time the specification and the sample implementation of the
-PCF format.  Undoubtedly, this driver is inspired from his work.

+ 0 - 80
sys/src/libfreetype/src/pcf/rules.mk

@@ -1,80 +0,0 @@
-#
-# FreeType 2 pcf driver configuration rules
-#
-
-
-# Copyright (C) 2000, 2001 by
-# Francesco Zappa Nardelli
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-
-# pcf driver directory
-#
-PCF_DIR  := $(SRC_)pcf
-PCF_DIR_ := $(PCF_DIR)$(SEP)
-
-
-PCF_COMPILE := $(FT_COMPILE) $I$(PCF_DIR)
-
-
-# pcf driver sources (i.e., C files)
-#
-PCF_DRV_SRC := $(PCF_DIR_)pcfread.c   \
-               $(PCF_DIR_)pcfdriver.c \
-               $(PCF_DIR_)pcfutil.c
-
-# pcf driver headers
-#
-PCF_DRV_H := $(PCF_DIR_)pcf.h       \
-             $(PCF_DIR_)pcfdriver.h \
-             $(PCF_DIR_)pcfutil.h   \
-             $(PCF_DIR_)pcferror.h
-
-# pcf driver object(s)
-#
-#   PCF_DRV_OBJ_M is used during `multi' builds
-#   PCF_DRV_OBJ_S is used during `single' builds
-#
-PCF_DRV_OBJ_M := $(PCF_DRV_SRC:$(PCF_DIR_)%.c=$(OBJ_)%.$O)
-PCF_DRV_OBJ_S := $(OBJ_)pcf.$O
-
-# Windows driver source file for single build
-#
-PCF_DRV_SRC_S := $(PCF_DIR_)pcf.c
-
-
-# pcf driver - single object
-#
-$(PCF_DRV_OBJ_S): $(PCF_DRV_SRC_S) $(PCF_DRV_SRC) $(FREETYPE_H) $(PCF_DRV_H)
-	$(PCF_COMPILE) $T$@ $(PCF_DRV_SRC_S)
-
-
-# pcf driver - multiple objects
-#
-$(OBJ_)%.$O: $(PCF_DIR_)%.c $(FREETYPE_H) $(PCF_DRV_H)
-	$(PCF_COMPILE) $T$@ $<
-
-
-# update main driver object lists
-#
-DRV_OBJS_S += $(PCF_DRV_OBJ_S)
-DRV_OBJS_M += $(PCF_DRV_OBJ_M)
-
-# EOF

+ 0 - 21
sys/src/libfreetype/src/pfr/Jamfile

@@ -1,21 +0,0 @@
-# FreeType 2 src/pfr Jamfile (c) 2002 David Turner
-#
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) pfr ;
-
-{
-  local  _sources ;
-
-  if $(FT2_MULTI)
-  {
-    _sources = pfrdrivr  pfrgload  pfrload  pfrobjs pfrcmap pfrsbit ;
-  }
-  else
-  {
-    _sources = pfr ;
-  }
-
-  Library  $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/pfr Jamfile

+ 0 - 23
sys/src/libfreetype/src/pfr/descrip.mms

@@ -1,23 +0,0 @@
-#
-# FreeType 2 PFR driver compilation rules for VMS
-#
-
-
-# Copyright 2002 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-
-CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.pfr])
-
-OBJS=pfr.obj
-
-all : $(OBJS)
-        library [--.lib]freetype.olb $(OBJS)
-
-# EOF

+ 0 - 22
sys/src/libfreetype/src/pfr/module.mk

@@ -1,22 +0,0 @@
-#
-# FreeType 2 PFR module definition
-#
-
-
-# Copyright 2002 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-
-make_module_list: add_pfr_driver
-
-add_pfr_driver:
-	$(OPEN_DRIVER)pfr_driver_class$(CLOSE_DRIVER)
-	$(ECHO_DRIVER)pfr       $(ECHO_DRIVER_DESC)PFR/TrueDoc font files with extension *.pfr$(ECHO_DRIVER_DONE)
-
-# EOF

+ 0 - 29
sys/src/libfreetype/src/pfr/pfr.c

@@ -1,29 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  pfr.c                                                                  */
-/*                                                                         */
-/*    FreeType PFR driver component.                                       */
-/*                                                                         */
-/*  Copyright 2002 by                                                      */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-#define FT_MAKE_OPTION_SINGLE_OBJECT
-
-#include <ft2build.h>
-
-#include "pfrload.c"
-#include "pfrgload.c"
-#include "pfrcmap.c"
-#include "pfrobjs.c"
-#include "pfrdrivr.c"
-#include "pfrsbit.c"
-
-/* END */

+ 0 - 158
sys/src/libfreetype/src/pfr/pfrcmap.c

@@ -1,158 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  pfrcmap.c                                                              */
-/*                                                                         */
-/*    FreeType PFR cmap handling (body).                                   */
-/*                                                                         */
-/*  Copyright 2002 by                                                      */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-
-#include "pfrcmap.h" 
-#include "pfrobjs.h"
-#include FT_INTERNAL_DEBUG_H
-
-
-  FT_CALLBACK_DEF( FT_Error )
-  pfr_cmap_init( PFR_CMap  cmap )
-  {
-    PFR_Face  face = (PFR_Face)FT_CMAP_FACE( cmap );
-
-
-    cmap->num_chars = face->phy_font.num_chars;
-    cmap->chars     = face->phy_font.chars;
-    
-    /* just for safety, check that the character entries are correctly */
-    /* sorted in increasing character code order                       */
-    {
-      FT_UInt  n;
-      
-
-      for ( n = 1; n < cmap->num_chars; n++ )
-      {
-        if ( cmap->chars[n - 1].char_code >= cmap->chars[n].char_code )
-          FT_ASSERT( 0 );
-      }
-    }
-    
-    return 0;
-  }
-
-
-  FT_CALLBACK_DEF( void )
-  pfr_cmap_done( PFR_CMap  cmap )
-  {
-    cmap->chars     = NULL;
-    cmap->num_chars = 0;
-  }
-
-
-  FT_CALLBACK_DEF( FT_UInt )
-  pfr_cmap_char_index( PFR_CMap   cmap,
-                       FT_UInt32  char_code )
-  {
-    FT_UInt   min = 0;
-    FT_UInt   max = cmap->num_chars;
-    FT_UInt   mid;
-    PFR_Char  gchar;
-
-
-    while ( min < max )
-    {
-      mid   = min + ( max - min ) / 2;
-      gchar = cmap->chars + mid;
-
-      if ( gchar->char_code == char_code )
-        return mid + 1;
-
-      if ( gchar->char_code < char_code )
-        min = mid + 1;
-      else
-        max = mid;
-    }
-    return 0;
-  }
-
-
-  FT_CALLBACK_DEF( FT_UInt )
-  pfr_cmap_char_next( PFR_CMap    cmap,
-                      FT_UInt32  *pchar_code )
-  {
-    FT_UInt    result    = 0;
-    FT_UInt32  char_code = *pchar_code + 1;
-
-
-  Restart:
-    {
-      FT_UInt   min = 0;
-      FT_UInt   max = cmap->num_chars;
-      FT_UInt   mid;
-      PFR_Char  gchar;
-
-
-      while ( min < max )
-      {
-        mid   = min + ( ( max - min ) >> 1 );
-        gchar = cmap->chars + mid;
-
-        if ( gchar->char_code == char_code )
-        {
-          result = mid;
-          if ( result != 0 )
-          {
-            result++;
-            goto Exit;
-          }
-
-          char_code++;
-          goto Restart;
-        }
-
-        if ( gchar->char_code < char_code )
-          min = mid+1;
-        else
-          max = mid;
-      }
-
-      /* we didn't find it, but we have a pair just above it */
-      char_code = 0;
-
-      if ( min < cmap->num_chars )
-      {
-        gchar  = cmap->chars + min;
-        result = min;
-        if ( result != 0 )
-        {
-          result++;
-          char_code = gchar->char_code;
-        }
-      }
-    }
-
-  Exit:
-    *pchar_code = char_code;
-    return result;
-  }
-
-
-  FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec
-  pfr_cmap_class_rec =
-  {
-    sizeof ( PFR_CMapRec ),
-
-    (FT_CMap_InitFunc)     pfr_cmap_init,
-    (FT_CMap_DoneFunc)     pfr_cmap_done,
-    (FT_CMap_CharIndexFunc)pfr_cmap_char_index,
-    (FT_CMap_CharNextFunc) pfr_cmap_char_next
-  };
-
-
-/* END */

+ 0 - 46
sys/src/libfreetype/src/pfr/pfrcmap.h

@@ -1,46 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  pfrcmap.h                                                              */
-/*                                                                         */
-/*    FreeType PFR cmap handling (specification).                          */
-/*                                                                         */
-/*  Copyright 2002 by                                                      */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-
-#ifndef __PFRCMAP_H__
-#define __PFRCMAP_H__
-
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include "pfrtypes.h"
-
-
-FT_BEGIN_HEADER
-
-  typedef struct  PFR_CMapRec_
-  {
-    FT_CMapRec  cmap;
-    FT_UInt     num_chars;
-    PFR_Char    chars;
-  
-  } PFR_CMapRec, *PFR_CMap;
-
-
-  FT_CALLBACK_TABLE const FT_CMap_ClassRec  pfr_cmap_class_rec;
-
-FT_END_HEADER
-
-
-#endif /* __PFRCMAP_H__ */
-
-
-/* END */

+ 0 - 168
sys/src/libfreetype/src/pfr/pfrdrivr.c

@@ -1,168 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  pfrdrivr.c                                                             */
-/*                                                                         */
-/*    FreeType PFR driver interface (body).                                */
-/*                                                                         */
-/*  Copyright 2002 by                                                      */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_PFR_H
-#include "pfrdrivr.h"
-#include "pfrobjs.h"
-
-
-  static FT_Error
-  pfr_get_kerning( PFR_Face    face,
-                   FT_UInt     left,
-                   FT_UInt     right,
-                   FT_Vector  *avector )
-  {
-    FT_Error  error;
-
-    error = pfr_face_get_kerning( face, left, right, avector );
-    if ( !error )
-    {
-      PFR_PhyFont  phys = &face->phy_font;
-
-      /* convert from metrics to outline units when necessary */
-      if ( phys->outline_resolution != phys->metrics_resolution )
-      {
-        if ( avector->x != 0 )
-          avector->x = FT_MulDiv( avector->x, phys->outline_resolution,
-                                              phys->metrics_resolution );
-
-        if ( avector->y != 0 )
-          avector->y = FT_MulDiv( avector->x, phys->outline_resolution,
-                                              phys->metrics_resolution );
-      }
-    }
-    return error;
-  }
-
-
-  static FT_Error
-  pfr_get_advance( PFR_Face   face,
-                   FT_UInt    gindex,
-                   FT_Pos    *aadvance )
-  {
-    FT_Error     error = FT_Err_Bad_Argument;
-
-    *aadvance = 0;
-    if ( face )
-    {
-      PFR_PhyFont  phys  = &face->phy_font;
-
-      if ( gindex < phys->num_chars )
-      {
-        *aadvance = phys->chars[ gindex ].advance;
-        error = 0;
-      }
-    }
-
-    return error;
-  }
-
-
-  static FT_Error
-  pfr_get_metrics( PFR_Face   face,
-                   FT_UInt   *aoutline_resolution,
-                   FT_UInt   *ametrics_resolution,
-                   FT_Fixed  *ametrics_x_scale,
-                   FT_Fixed  *ametrics_y_scale )
-  {
-    PFR_PhyFont  phys  = &face->phy_font;
-    FT_Fixed     x_scale, y_scale;
-    FT_Size      size = face->root.size;
-
-    if ( aoutline_resolution )
-      *aoutline_resolution = phys->outline_resolution;
-
-    if ( ametrics_resolution )
-      *ametrics_resolution = phys->metrics_resolution;
-
-    x_scale = 0x10000L;
-    y_scale = 0x10000L;
-
-    if ( size )
-    {
-      x_scale = FT_DivFix( size->metrics.x_ppem << 6,
-                           phys->metrics_resolution );
-
-      y_scale = FT_DivFix( size->metrics.y_ppem << 6,
-                           phys->metrics_resolution );
-    }
-
-    if ( ametrics_x_scale )
-      *ametrics_x_scale = x_scale;
-
-    if ( ametrics_y_scale )
-      *ametrics_y_scale = y_scale;
-
-    return 0;
-  }
-
-
-  FT_CALLBACK_TABLE_DEF
-  const FT_PFR_ServiceRec  pfr_service_rec =
-  {
-    (FT_PFR_GetMetricsFunc)  pfr_get_metrics,
-    (FT_PFR_GetKerningFunc)  pfr_get_kerning,
-    (FT_PFR_GetAdvanceFunc)  pfr_get_advance
-  };
-
-
-  FT_CALLBACK_TABLE_DEF
-  const FT_Driver_ClassRec  pfr_driver_class =
-  {
-    {
-      ft_module_font_driver      |
-      ft_module_driver_scalable,
-
-      sizeof( FT_DriverRec ),
-
-      "pfr",
-      0x10000L,
-      0x20000L,
-
-      (FT_PFR_Service)  &pfr_service_rec,   /* format interface */
-
-      (FT_Module_Constructor)NULL,
-      (FT_Module_Destructor) NULL,
-      (FT_Module_Requester)  NULL
-    },
-
-    sizeof( PFR_FaceRec ),
-    sizeof( PFR_SizeRec ),
-    sizeof( PFR_SlotRec ),
-
-    (FT_Face_InitFunc)        pfr_face_init,
-    (FT_Face_DoneFunc)        pfr_face_done,
-    (FT_Size_InitFunc)        NULL,
-    (FT_Size_DoneFunc)        NULL,
-    (FT_Slot_InitFunc)        pfr_slot_init,
-    (FT_Slot_DoneFunc)        pfr_slot_done,
-
-    (FT_Size_ResetPointsFunc) NULL,
-    (FT_Size_ResetPixelsFunc) NULL,
-    (FT_Slot_LoadFunc)        pfr_slot_load,
-
-    (FT_Face_GetKerningFunc)  pfr_get_kerning,
-    (FT_Face_AttachFunc)      0,
-    (FT_Face_GetAdvancesFunc) 0
-  };
-
-
-/* END */

Some files were not shown because too many files changed in this diff