~ubuntu-branches/ubuntu/precise/libxfont/precise-updates

« back to all changes in this revision

Viewing changes to src/Type1/type1.c

  • Committer: Bazaar Package Importer
  • Author(s): Julien Cristau
  • Date: 2007-02-16 14:32:57 UTC
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: james.westby@ubuntu.com-20070216143257-17cvilm4gqqmfwm5
Tags: upstream-1.2.7
ImportĀ upstreamĀ versionĀ 1.2.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
29
29
 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
30
30
 */
31
 
/* Copyright (c) 1994-1999 Silicon Graphics, Inc. All Rights Reserved.
32
 
 *
33
 
 * The contents of this file are subject to the CID Font Code Public Licence
34
 
 * Version 1.0 (the "License"). You may not use this file except in compliance
35
 
 * with the Licence. You may obtain a copy of the License at Silicon Graphics,
36
 
 * Inc., attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA
37
 
 * 94043 or at http://www.sgi.com/software/opensource/cid/license.html.
38
 
 *
39
 
 * Software distributed under the License is distributed on an "AS IS" basis.
40
 
 * ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
41
 
 * WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF
42
 
 * NON-INFRINGEMENT. See the License for the specific language governing
43
 
 * rights and limitations under the License.
44
 
 *
45
 
 * The Original Software is CID font code that was developed by Silicon
46
 
 * Graphics, Inc.
47
 
 */
48
31
/* $XFree86: xc/lib/font/Type1/type1.c,v 1.9tsi Exp $ */
49
32
 
50
33
/*********************************************************************/
67
50
#ifdef HAVE_CONFIG_H
68
51
#include <config.h>
69
52
#endif
70
 
#ifdef BUILDCID
71
 
#define XFONT_CID 1
72
 
#endif
73
53
 
74
54
#ifndef FONTMODULE
75
55
#include  <stdio.h>          /* a system-dependent include, usually */
84
64
#include  "paths.h"
85
65
#include  "fonts.h"        /* understands about TEXTTYPEs */
86
66
#include  "pictures.h"     /* understands about handles */
87
 
#include  "range.h"
88
67
 
89
68
typedef struct xobject xobject;
90
69
#include  "util.h"       /* PostScript objects */
99
78
#define MAXPSFAKESTACK 32  /* Max depth of fake PostScript stack (local) */
100
79
#define MAXSTRLEN 512      /* Max length of a Type 1 string (local) */
101
80
#define MAXLABEL 256       /* Maximum number of new hints */
102
 
#if XFONT_CID
103
 
#define MAXSTEMS 500       /* Maximum number of VSTEM and HSTEM hints */
104
 
#else
105
81
#define MAXSTEMS 128       /* Maximum number of VSTEM and HSTEM hints */
106
 
#endif
107
82
#define EPS 0.001          /* Small number for comparisons */
108
83
 
109
84
/************************************/
171
146
struct xobject *Type1Char(char *env, struct XYspace *S, 
172
147
                          psobj *charstrP, psobj *subrsP, psobj *osubrsP, 
173
148
                          struct blues_struct *bluesP, int *modeP);
174
 
#if XFONT_CID
175
 
struct xobject *CIDChar(char *env, struct XYspace *S, 
176
 
                        psobj *charstrP, psobj *subrsP, psobj *osubrsP, 
177
 
                        struct blues_struct *bluesP, int *modeP);
178
 
#endif
179
149
 
180
150
static double escapementX, escapementY;
181
151
static double sidebearingX, sidebearingY;
1150
1120
      if (Top < Num+1) Error;
1151
1121
      for (i = 0; i < Num; i++) PSFakePush(Stack[Top - i - 2]);
1152
1122
      Top -= Num + 2;
1153
 
#if XFONT_CID
1154
 
      if ((int)Stack[Top + Num + 2] > 3)
1155
 
        ClearPSFakeStack();
1156
 
      else
1157
 
        CallOtherSubr((int)Stack[Top + Num + 2]);
1158
 
#else
1159
1123
      CallOtherSubr((int)Stack[Top + Num + 2]);
1160
 
#endif
1161
1124
      break;
1162
1125
    case POP: /* - POP number */
1163
1126
      /* Removes a number from the top of the */
1832
1795
 
1833
1796
  return((struct xobject *) path);
1834
1797
}
1835
 
 
1836
 
#if XFONT_CID
1837
 
struct xobject *
1838
 
CIDChar(char *env, struct XYspace *S, 
1839
 
        psobj *charstrP, psobj *subrsP, psobj *osubrsP, 
1840
 
        struct blues_struct *bluesP, /* FontID's ptr to the blues struct */
1841
 
        int *modeP)
1842
 
{
1843
 
  int Code;
1844
 
 
1845
 
  path = NULL;
1846
 
  errflag = FALSE;
1847
 
 
1848
 
  /* Make parameters available to all CID routines */
1849
 
  Environment = env;
1850
 
  CharSpace = S; /* used when creating path elements */
1851
 
  CharStringP = charstrP;
1852
 
  SubrsP = subrsP;
1853
 
 
1854
 
  blues = bluesP;
1855
 
 
1856
 
  /* compute the alignment zones */
1857
 
  ComputeAlignmentZones();
1858
 
 
1859
 
  StartDecrypt();
1860
 
 
1861
 
  ClearStack();
1862
 
  ClearPSFakeStack();
1863
 
  ClearCallStack();
1864
 
 
1865
 
  InitStems();
1866
 
 
1867
 
  currx = curry = 0;
1868
 
  escapementX = escapementY = 0;
1869
 
  sidebearingX = sidebearingY = 0;
1870
 
  accentoffsetX = accentoffsetY = 0;
1871
 
  wsoffsetX = wsoffsetY = 0;           /* No shift to preserve whitspace. */
1872
 
  wsset = 0;                           /* wsoffsetX,Y haven't been set yet. */
1873
 
 
1874
 
  for (;;) {
1875
 
    if (!DoRead(&Code)) break;
1876
 
    Decode(Code);
1877
 
    if (errflag) break;
1878
 
  }
1879
 
 
1880
 
  FinitStems();
1881
 
 
1882
 
  /* Clean up if an error has occurred */
1883
 
  if (errflag) {
1884
 
    if (path != NULL) {
1885
 
      Destroy(path); /* Reclaim storage */
1886
 
      path = NULL;   /* Indicate that character could not be built */
1887
 
    }
1888
 
  }
1889
 
 
1890
 
  return((struct xobject *) path);
1891
 
}
1892
 
#endif