summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2006-12-01 00:35:04 +0200
committerDaniel Stone <daniels@endtroducing.fooishbar.org>2006-12-01 00:35:04 +0200
commit47084ba39920068030c3e59523701d1205161a9f (patch)
tree8d022181254a185cf67791b759b83dfc7f6cb4dd
parentc4741cdd83bcdedcc6f7a072a73b16668fc905eb (diff)
remove CID font support (bug #5553)
Remove non-free CID font support, which was unused anyway.
-rw-r--r--configure.ac16
-rw-r--r--include/X11/fonts/fontconf.h.in3
-rw-r--r--src/Type1/AFM.h62
-rw-r--r--src/Type1/Makefile.am4
-rw-r--r--src/Type1/afm.c201
-rw-r--r--src/Type1/cidchar.c621
-rw-r--r--src/Type1/fontfcn.c393
-rw-r--r--src/Type1/fontfcn.h145
-rw-r--r--src/Type1/objects.h24
-rw-r--r--src/Type1/range.h48
-rw-r--r--src/Type1/scanfont.c845
-rw-r--r--src/Type1/t1funcs.c914
-rw-r--r--src/Type1/t1info.c603
-rw-r--r--src/Type1/t1intf.h88
-rw-r--r--src/Type1/t1io.c89
-rw-r--r--src/Type1/t1stdio.h7
-rw-r--r--src/Type1/type1.c94
-rw-r--r--src/Type1/util.c28
-rw-r--r--src/Type1/util.h30
-rw-r--r--src/fontfile/ffcheck.c3
-rw-r--r--src/fontfile/register.c6
21 files changed, 1 insertions, 4223 deletions
diff --git a/configure.ac b/configure.ac
index baa7342..29b6572 100644
--- a/configure.ac
+++ b/configure.ac
@@ -106,27 +106,11 @@ AC_SUBST(FREETYPE_LIBS)
AC_SUBST(FREETYPE_CFLAGS)
AC_SUBST(FREETYPE_REQUIRES)
-#
-# A bit tricky here; CID font support uses the IBM Type1 rasterizer,
-# but it's generally better to use FreeType for regular Type1 files,
-# so we make CID build the IBM rasterizer, but not also make the Type1
-# rasterizer used for normal Type1 files
-#
-
AC_ARG_ENABLE(type1, [ --enable-type1 ], [XFONT_TYPE1=$enableval], [XFONT_TYPE1=no])
if test "x$XFONT_TYPE1" = xyes; then
AC_DEFINE(XFONT_TYPE1,1,[Support IBM Type 1 rasterizer for Type1 font files])
XFONT_FONTFILE=yes
fi
-
-AC_ARG_ENABLE(cid, [ --disable-cid ], [XFONT_CID=$enableval], [XFONT_CID=yes])
-AM_CONDITIONAL(XFONT_CID, [test "x$XFONT_CID" = xyes ])
-if test "x$XFONT_CID" = xyes; then
- AC_DEFINE(XFONT_CID,1,[Support Type 1 CID font files])
- XFONT_TYPE1=yes
- XFONT_FONTFILE=yes
-fi
-
AM_CONDITIONAL(XFONT_TYPE1, [test "x$XFONT_TYPE1" = xyes ])
AC_ARG_ENABLE(speedo, [ --disable-speedo ], [XFONT_SPEEDO=$enableval], [XFONT_SPEEDO=yes])
diff --git a/include/X11/fonts/fontconf.h.in b/include/X11/fonts/fontconf.h.in
index 358e133..b16df93 100644
--- a/include/X11/fonts/fontconf.h.in
+++ b/include/X11/fonts/fontconf.h.in
@@ -28,9 +28,6 @@
/* Define as 1 if you have Type1 font support in Xfont */
#undef XFONT_TYPE1
-/* Define as 1 if you have Type1 CID font support in Xfont */
-#undef XFONT_CID
-
/* Define as 1 if you have Speedo support in Xfont */
#undef XFONT_SPEEDO
diff --git a/src/Type1/AFM.h b/src/Type1/AFM.h
deleted file mode 100644
index f2c997a..0000000
--- a/src/Type1/AFM.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Copyright (c) 1994-1999 Silicon Graphics, Inc. All Rights Reserved.
- *
- * The contents of this file are subject to the CID Font Code Public Licence
- * Version 1.0 (the "License"). You may not use this file except in compliance
- * with the Licence. You may obtain a copy of the License at Silicon Graphics,
- * Inc., attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA
- * 94043 or at http://www.sgi.com/software/opensource/cid/license.html.
- *
- * Software distributed under the License is distributed on an "AS IS" basis.
- * ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
- * WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF
- * NON-INFRINGEMENT. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * The Original Software is CID font code that was developed by Silicon
- * Graphics, Inc.
- */
-#ifdef BUILDCID
-#define XFONT_CID 1
-#endif
-
-#if XFONT_CID
-#ifndef AFM_H
-#define AFM_H
-
-/* Bounding box definition. Used for the Font BBox as well as the
- * Character BBox.
- */
-typedef struct
-{
- int llx; /* lower left x-position */
- int lly; /* lower left y-position */
- int urx; /* upper right x-position */
- int ury; /* upper right y-position */
-} BBox;
-
-/* Character Metric Information. This structure is used only if ALL
- * character metric information is requested. If only the character
- * widths is requested, then only an array of the character x-widths
- * is returned.
- *
- * The key that each field is associated with is in comments. For an
- * explanation about each key and its value please refer to the
- * Character Metrics section of the AFM documentation (full title
- * & version given above).
- */
-typedef struct
-{
- long code; /* CID code */
- int wx; /* key: WX or W0X */
- BBox charBBox; /* key: B */
-} Metrics;
-
-typedef struct
-{
- int nChars; /* number of entries in char metrics array */
- Metrics *metrics; /* ptr to char metrics array */
-} FontInfo;
-
-int CIDAFM(FILE *, FontInfo **);
-#endif /* AFM_H */
-#endif
diff --git a/src/Type1/Makefile.am b/src/Type1/Makefile.am
index 105bf24..9adaa0e 100644
--- a/src/Type1/Makefile.am
+++ b/src/Type1/Makefile.am
@@ -4,12 +4,9 @@ INCLUDES = \
noinst_LTLIBRARIES = libtype1.la
libtype1_la_SOURCES = \
- afm.c \
- AFM.h \
arith.c \
arith.h \
blues.h \
- cidchar.c \
cluts.h \
curves.c \
curves.h \
@@ -27,7 +24,6 @@ libtype1_la_SOURCES = \
paths.c \
paths.h \
pictures.h \
- range.h \
regions.c \
regions.h \
scanfont.c \
diff --git a/src/Type1/afm.c b/src/Type1/afm.c
deleted file mode 100644
index 006ff3c..0000000
--- a/src/Type1/afm.c
+++ /dev/null
@@ -1,201 +0,0 @@
-/* Copyright (c) 1994-1999 Silicon Graphics, Inc. All Rights Reserved.
- *
- * The contents of this file are subject to the CID Font Code Public Licence
- * Version 1.0 (the "License"). You may not use this file except in compliance
- * with the Licence. You may obtain a copy of the License at Silicon Graphics,
- * Inc., attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA
- * 94043 or at http://www.sgi.com/software/opensource/cid/license.html.
- *
- * Software distributed under the License is distributed on an "AS IS" basis.
- * ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
- * WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF
- * NON-INFRINGEMENT. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * The Original Software is CID font code that was developed by Silicon
- * Graphics, Inc.
- */
-/* $XFree86: xc/lib/font/Type1/afm.c,v 1.2 1999/08/21 13:47:38 dawes Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#ifdef BUILDCID
-#define XFONT_CID 1
-#endif
-
-#ifdef XFONT_CID
-#ifndef FONTMODULE
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#else
-#include "Xmd.h" /* For INT32 declaration */
-#include "Xdefs.h" /* For Bool */
-#include "xf86_ansic.h"
-#endif
-#include <X11/fonts/fontmisc.h> /* for xalloc/xfree */
-#include "AFM.h"
-
-#include <limits.h>
-
-#define PBUF 256
-#define KBUF 20
-
-char *gettoken(FILE *);
-
-static char *afmbuf = NULL;
-
-char *gettoken(FILE *fd) {
- char *bp;
- int c, found;
-
- bp = afmbuf;
- found = 0;
-
- while((c = getc(fd)) != EOF) {
- if (found == 0 && (c == ' ' || c == '\t' || c == '\n' || c == '\r' ||
- c == ';' || c == ',')) continue;
- found = 1;
- if (c != ' ' && c != '\t' && c != '\n' && c != '\r' && c != ';') {
- *bp++ = c;
- if (bp - afmbuf >= PBUF) {
- bp = afmbuf;
- break;
- }
- } else
- break;
- }
-
- *bp = 0;
- return(afmbuf);
-}
-
-int CIDAFM(FILE *fd, FontInfo **pfi) {
- char *p = 0;
- int i, j, k = 0, found = 0;
- FontInfo *fi;
-
- if (fd == NULL || pfi == NULL) return(1);
-
- *pfi = NULL;
-
- if ((afmbuf = (char *)xalloc(PBUF)) == NULL)
- return(1);
-
- while(1) {
- if (!(p = gettoken(fd))) {
- xfree(afmbuf);
- return(1);
- }
-
- if (strncmp(p, "StartFontMetrics", 16) == 0) {
- if (!(p = gettoken(fd))) {
- xfree(afmbuf);
- return(1);
- }
- if (strncmp(p, "4", 1) < 0) {
- free(afmbuf);
- return(1);
- }
- found = 1;
- } else if (strncmp(p, "StartCharMetrics", 16) == 0) {
- if (!found) {
- xfree(afmbuf);
- return(1);
- }
-
- if (!(p = gettoken(fd))) {
- xfree(afmbuf);
- return(1);
- }
-
- fi = (FontInfo *)xalloc(sizeof(FontInfo));
-
- if (fi == NULL) {
- xfree(afmbuf);
- return(1);
- }
- bzero(fi, sizeof(FontInfo));
-
- fi->nChars = atoi(p);
-
- if (fi->nChars < 0 || fi->nChars > INT_MAX / sizeof(Metrics)) {
- xfree(afmbuf);
- xfree(fi);
- return(1);
- }
- fi->metrics = (Metrics *)xalloc(fi->nChars *
- sizeof(Metrics));
- if (fi->metrics == NULL) {
- xfree(afmbuf);
- xfree(fi);
- return(1);
- }
-
- j = 0;
- for (i = 0; i < fi->nChars; i++) {
- k = 0;
- while(1) {
- if (!(p = gettoken(fd))) {
- k = KBUF;
- break;
- }
- if (strncmp(p, "W0X", 3) == 0) {
- if (!(p = gettoken(fd))) {
- k = KBUF;
- break;
- }
- fi->metrics[j].wx = atoi(p);
- } else if (strncmp(p, "N", 1) == 0) {
- if (!(p = gettoken(fd))) {
- k = KBUF;
- break;
- }
- fi->metrics[j].code = (long)atoi(p);
- } else if (strncmp(p, "B", 1) == 0) {
- if (!(p = gettoken(fd))) {
- k = KBUF;
- break;
- }
- fi->metrics[j].charBBox.llx = atoi(p);
- if (!(p = gettoken(fd))) {
- k = KBUF;
- break;
- }
- fi->metrics[j].charBBox.lly = atoi(p);
- if (!(p = gettoken(fd))) {
- k = KBUF;
- break;
- }
- fi->metrics[j].charBBox.urx = atoi(p);
- if (!(p = gettoken(fd))) {
- k = KBUF;
- break;
- }
- fi->metrics[j].charBBox.ury = atoi(p);
- j++;
- break;
- }
- k++;
- if (k >= KBUF) break;
- }
- if (k >= KBUF) break;
- }
- if (k >= KBUF || j != fi->nChars) {
- xfree(fi->metrics);
- xfree(fi);
- xfree(afmbuf);
- return(1);
- } else {
- *pfi = fi;
- xfree(afmbuf);
- return(0);
- }
- }
- }
-
- xfree(afmbuf);
- return(1);
-}
-#endif
diff --git a/src/Type1/cidchar.c b/src/Type1/cidchar.c
deleted file mode 100644
index 20d2665..0000000
--- a/src/Type1/cidchar.c
+++ /dev/null
@@ -1,621 +0,0 @@
-/* Copyright (c) 1994-1999 Silicon Graphics, Inc. All Rights Reserved.
- *
- * The contents of this file are subject to the CID Font Code Public Licence
- * Version 1.0 (the "License"). You may not use this file except in compliance
- * with the Licence. You may obtain a copy of the License at Silicon Graphics,
- * Inc., attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA
- * 94043 or at http://www.sgi.com/software/opensource/cid/license.html.
- *
- * Software distributed under the License is distributed on an "AS IS" basis.
- * ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
- * WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF
- * NON-INFRINGEMENT. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * The Original Software is CID font code that was developed by Silicon
- * Graphics, Inc.
- */
-/* $XFree86: xc/lib/font/Type1/cidchar.c,v 1.9tsi Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#ifdef BUILDCID
-#define XFONT_CID 1
-#endif
-
-#if XFONT_CID
-#ifndef FONTMODULE
-#include <stdio.h>
-#include <string.h>
-#include <sys/stat.h>
-#ifdef USE_MMAP
-#include <sys/mman.h>
-#ifndef MAP_FAILED
-#define MAP_FAILED ((caddr_t)(-1))
-#endif
-#endif
-#else
-#include "Xmd.h" /* For INT32 declaration */
-#include "Xdefs.h" /* For Bool */
-#include "xf86_ansic.h"
-#endif
-#ifndef FONTMODULE
-#ifdef _XOPEN_SOURCE
-#include <math.h>
-#else
-#define _XOPEN_SOURCE
-#include <math.h>
-#undef _XOPEN_SOURCE
-#endif
-#endif
-#include <X11/fonts/fntfilst.h>
-#include "objects.h"
-#include "spaces.h"
-#include "range.h"
-#include "util.h"
-#include "fontfcn.h"
-#include "blues.h"
-#include "AFM.h"
-#include "t1intf.h"
-
-#define BSIZE 4096
-
-extern cidfont *CIDFontP;
-extern psfont *FDArrayP;
-extern psfont *FontP;
-
-static unsigned char sd[] = "StartData";
-
-CharInfoPtr
-CIDGetGlyphInfo(FontPtr pFont, unsigned int cidcode, CharInfoPtr pci, int *rc)
-{
- CharInfoPtr cp = NULL;
-#ifdef USE_MMAP
- int fd;
- unsigned char *buf;
- long total_len = 0;
-#else
- FILE *fp;
- unsigned char buf[BSIZE];
- unsigned int count = 0;
-#endif
- cidglyphs *cid;
- unsigned char *p1 = NULL;
-#ifndef USE_MMAP
- unsigned char *p2;
-#endif
- register int i = 0, j;
- long byteoffset;
- int FDindex, FDBytes, GDBytes, SDBytes, SubrCount, CIDMapOffset, len;
- psobj *arrayP;
- psobj charstring;
- long *subroffsets = NULL, cstringoffset, nextcstringoffset;
- struct blues_struct *blues;
-
- cid = (cidglyphs *)pFont->fontPrivate;
-
-#ifdef USE_MMAP
- if (!cid->CIDdata) {
- if (!(fd = open(cid->CIDFontName, O_RDONLY, 0))) {
- *rc = BadFontName;
- return(cp);
- }
- cid->CIDsize = lseek(fd, 0, SEEK_END);
- cid->CIDdata = (unsigned char *)
- mmap(0, (size_t)cid->CIDsize, PROT_READ, MAP_SHARED, fd, 0);
- close(fd);
- if (cid->CIDdata == (unsigned char *)MAP_FAILED) {
- *rc = AllocError;
- cid->CIDdata = NULL;
- return (cp);
- }
- }
-#else
- if (!(fp = fopen(cid->CIDFontName,"rb"))) {
- *rc = BadFontName;
- return(cp);
- }
-#endif
-
-#ifdef USE_MMAP
- if (cid->dataoffset == 0) {
- if ((p1 = (unsigned char *)strstr((char *)cid->CIDdata, (char *)sd))
- != NULL) {
- cid->dataoffset = (p1 - cid->CIDdata) + strlen((char *)sd);
- }
- else {
- *rc = BadFontFormat;
- return(cp);
- }
- }
-#else /* USE_MMAP */
- if (cid->dataoffset == 0) {
- p2 = sd;
-
- /* find "StartData" */
- while (*p2) {
- cid->dataoffset += count;
- if ((count = fread(buf, 1, BSIZE, fp)) == 0)
- break;
- p1 = buf;
- for (i=0; i < count && *p2; i++) {
- if (*p1 == *p2)
- p2++;
- else {
- p2 = sd;
- if (*p1 == *p2)
- p2++;
- }
- p1++;
- }
- }
-
- /* if "StartData" not found, or end of file */
- if (*p2 || count == 0) {
- *rc = BadFontFormat;
- fclose(fp);
- return(cp);
- }
-
- if (i >= count) {
- cid->dataoffset += count;
- count = fread(buf, 1, BSIZE, fp);
- p1 = buf;
- } else {
- cid->dataoffset += p1 - buf;
- count = count - (p1 - buf);
- }
- } else {
- if (fseek(fp, cid->dataoffset, SEEK_SET)) {
- *rc = BadFontFormat;
- fclose(fp);
- return(cp);
- }
- if ((count = fread(buf, 1, BSIZE, fp)) == 0) {
- *rc = BadFontFormat;
- fclose(fp);
- return(cp);
- }
- p1 = buf;
- }
-
- /* if "StartData" not found, or "Binary" data and the next character */
- /* is not the space character (0x20) */
-
- if (count == 0 || (CIDFontP->binarydata && (*p1 != ' '))) {
- *rc = BadFontFormat;
- fclose(fp);
- return(cp);
- }
-#endif /* USE_MMAP */
-
- FDBytes = CIDFontP->CIDfontInfoP[CIDFDBYTES].value.data.integer;
- GDBytes = CIDFontP->CIDfontInfoP[CIDGDBYTES].value.data.integer;
- CIDMapOffset = CIDFontP->CIDfontInfoP[CIDMAPOFFSET].value.data.integer;
- byteoffset = cid->dataoffset + 1 + CIDMapOffset +
- cidcode * (FDBytes + GDBytes);
-#ifdef USE_MMAP
- buf = &cid->CIDdata[byteoffset];
-#else
- if (fseek(fp, byteoffset, SEEK_SET)) {
- *rc = BadFontFormat;
- fclose(fp);
- return(cp);
- }
- if ((count = fread(buf, 1, BSIZE, fp)) < 2*(FDBytes + GDBytes)) {
- *rc = BadFontFormat;
- fclose(fp);
- return(cp);
- }
-#endif
-
- /* if FDBytes is equal to 0, the CIDMap contains no FD indices, and the */
- /* FD index of 0 is assumed. */
- if (FDBytes == 0)
- FDindex = 0;
- else {
- FDindex = 0;
- for (i = 0; i < FDBytes; i++)
- FDindex += (unsigned char)buf[i] << (8 * (FDBytes - 1 - i));
- }
-
- if (FDindex >= CIDFontP->CIDfontInfoP[CIDFDARRAY].value.len) {
- *rc = BadFontFormat;
-#ifndef USE_MMAP
- fclose(fp);
-#endif
- return(cp);
- }
-
- cstringoffset = 0;
- for (i = 0; i < GDBytes; i++)
- cstringoffset += (unsigned char)buf[FDBytes + i] <<
- (8 * (GDBytes - 1 - i));
-
- nextcstringoffset = 0;
- for (i = 0; i < GDBytes; i++)
- nextcstringoffset += (unsigned char)buf[2*FDBytes + GDBytes + i] <<
- (8 * (GDBytes - 1 - i));
-
- len = nextcstringoffset - cstringoffset;
-
- if (len <= 0) { /* empty interval, missing glyph */
- *rc = BadFontFormat;
-#ifndef USE_MMAP
- fclose(fp);
-#endif
- return(cp);
- }
-
- FontP = &FDArrayP[FDindex];
-
- charstring.type = OBJ_INTEGER;
- charstring.len = len;
-
-#ifndef USE_MMAP
- if (!(charstring.data.stringP = (unsigned char *)xalloc(len))) {
- *rc = AllocError;
- fclose(fp);
- return(cp);
- }
-#endif
-
- byteoffset = cid->dataoffset + 1 + cstringoffset;
-
-#ifdef USE_MMAP
- charstring.data.stringP = &cid->CIDdata[byteoffset];
-#else
- if (fseek(fp, byteoffset, SEEK_SET)) {
- *rc = BadFontFormat;
- xfree(charstring.data.stringP);
- fclose(fp);
- return(cp);
- }
-
- if ((count = fread(charstring.data.stringP, 1, len, fp)) != len) {
- *rc = BadFontFormat;
- xfree(charstring.data.stringP);
- fclose(fp);
- return(cp);
- }
-#endif
-
- if (FontP->Subrs.data.arrayP == NULL) {
- /* get subroutine data */
- byteoffset = cid->dataoffset + 1 +
- FDArrayP[FDindex].Private[CIDT1SUBMAPOFF].value.data.integer;
-
- SDBytes = FDArrayP[FDindex].Private[CIDT1SDBYTES].value.data.integer;
-
- SubrCount = FDArrayP[FDindex].Private[CIDT1SUBRCNT].value.data.integer;
-#ifdef USE_MMAP
- buf = &cid->CIDdata[byteoffset];
-#else
- if (fseek(fp, byteoffset, SEEK_SET)) {
- *rc = BadFontFormat;
- fclose(fp);
- return(cp);
- }
-
- if ((count = fread(buf, 1, BSIZE, fp)) < SDBytes * (SubrCount + 1)) {
- *rc = BadFontFormat;
- fclose(fp);
- return(cp);
- }
-#endif
-
- arrayP = (psobj *)vm_alloc(SubrCount*sizeof(psobj));
- if (!arrayP) {
- *rc = AllocError;
-#ifndef USE_MMAP
- fclose(fp);
-#endif
- return(cp);
- }
-
- if (!(subroffsets = (long *)xalloc((SubrCount + 1)*sizeof(long)))) {
- *rc = AllocError;
-#ifndef USE_MMAP
- fclose(fp);
-#endif
- return(cp);
- }
-
- for (i = 0; i <= SubrCount; i++) {
- subroffsets[i] = 0;
- for (j = 0; j < SDBytes; j++)
- subroffsets[i] += (unsigned char)buf[i * SDBytes + j] <<
- (8 * (SDBytes - 1 - j));
- }
-
- byteoffset = cid->dataoffset + 1 + subroffsets[0];
-
- /* get subroutine info */
-#ifndef USE_MMAP
- if (fseek(fp, byteoffset, SEEK_SET)) {
- *rc = BadFontFormat;
- xfree(subroffsets);
- fclose(fp);
- return(cp);
- }
-#else
- total_len = byteoffset;
-#endif
- for (i = 0; i < SubrCount; i++) {
- len = subroffsets[i + 1] - subroffsets[i];
-#ifndef USE_MMAP
- arrayP[i].data.valueP = vm_alloc(len);
- if (!arrayP[i].data.valueP) {
- *rc = AllocError;
- xfree(subroffsets);
- fclose(fp);
- return(cp);
- }
-#endif
- arrayP[i].len = len;
-#ifdef USE_MMAP
- arrayP[i].data.valueP = (char *)&cid->CIDdata[total_len];
- total_len += len;
-#else
- if ((count = fread(arrayP[i].data.valueP, 1, len, fp)) != len) {
- *rc = BadFontFormat;
- xfree(subroffsets);
- fclose(fp);
- return(cp);
- }
-#endif
- }
-
- FontP->Subrs.len = SubrCount;
- FontP->Subrs.data.arrayP = arrayP;
- xfree(subroffsets);
- }
-
- if (FontP->BluesP == NULL) {
- blues = (struct blues_struct *) vm_alloc(sizeof(struct blues_struct));
- if (!blues) {
- *rc = AllocError;
-#ifndef USE_MMAP
- xfree(subroffsets);
- fclose(fp);
-#endif
- return(cp);
- }
- bzero(blues, sizeof(struct blues_struct));
- blues->numBlueValues =
- FDArrayP[FDindex].Private[CIDT1BLUEVALUES].value.len;
- for (i = 0; i < blues->numBlueValues; i++)
- blues->BlueValues[i] =
- FDArrayP[FDindex].Private[CIDT1BLUEVALUES].value.data.arrayP[i].data.integer;
- blues->numOtherBlues =
- FDArrayP[FDindex].Private[CIDT1OTHERBLUES].value.len;
- for (i = 0; i < blues->numOtherBlues; i++)
- blues->OtherBlues[i] =
- FDArrayP[FDindex].Private[CIDT1OTHERBLUES].value.data.arrayP[i].data.integer;
- blues->numFamilyBlues =
- FDArrayP[FDindex].Private[CIDT1FAMBLUES].value.len;
- for (i = 0; i < blues->numFamilyBlues; i++)
- blues->FamilyBlues[i] =
- FDArrayP[FDindex].Private[CIDT1FAMBLUES].value.data.arrayP[i].data.integer;
- blues->numFamilyOtherBlues =
- FDArrayP[FDindex].Private[CIDT1FAMOTHERBLUES].value.len;
- for (i = 0; i < blues->numFamilyOtherBlues; i++)
- blues->FamilyOtherBlues[i] =
- FDArrayP[FDindex].Private[CIDT1FAMOTHERBLUES].value.data.arrayP[i].data.integer;
- blues->BlueScale = FDArrayP[FDindex].Private[CIDT1BLUESCALE].value.data.real;
- blues->BlueShift = FDArrayP[FDindex].Private[CIDT1BLUESHIFT].value.data.integer;
- blues->BlueFuzz = FDArrayP[FDindex].Private[CIDT1BLUEFUZZ].value.data.integer;
- blues->StdHW = (double)FDArrayP[FDindex].Private[CIDT1STDHW].value.data.arrayP[0].data.integer;
- blues->StdVW = (double)FDArrayP[FDindex].Private[CIDT1STDVW].value.data.arrayP[0].data.integer;
-
- blues->numStemSnapH =
- FDArrayP[FDindex].Private[CIDT1STEMSNAPH].value.len;
- for (i = 0; i < blues->numStemSnapH; i++)
- blues->StemSnapH[i] =
- FDArrayP[FDindex].Private[CIDT1STEMSNAPH].value.data.arrayP[i].data.integer;
- blues->numStemSnapV =
- FDArrayP[FDindex].Private[CIDT1STEMSNAPV].value.len;
- for (i = 0; i < blues->numStemSnapV; i++)
- blues->StemSnapV[i] =
- FDArrayP[FDindex].Private[CIDT1STEMSNAPV].value.data.arrayP[i].data.integer;
- blues->ForceBold =
- FDArrayP[FDindex].Private[CIDT1FORCEBOLD].value.data.boolean;
-
- blues->LanguageGroup =
- FDArrayP[FDindex].Private[CIDT1LANGGROUP].value.data.integer;
-
- blues->RndStemUp =
- FDArrayP[FDindex].Private[CIDT1RNDSTEMUP].value.data.boolean;
-
- blues->lenIV =
- FDArrayP[FDindex].Private[CIDT1LENIV].value.data.integer;
-
- blues->ExpansionFactor =
- FDArrayP[FDindex].Private[CIDT1EXPFACTOR].value.data.real;
-
- FontP->BluesP = blues;
- }
-
- cp = CIDRenderGlyph(pFont, &charstring, &FontP->Subrs, FontP->BluesP, pci, rc);
-
-#ifndef USE_MMAP
- xfree(charstring.data.stringP);
-
- fclose(fp);
-#endif
- return(cp);
-}
-
-static int
-node_compare(const void *node1, const void *node2)
-{
- return (((Metrics *)node1)->code - ((Metrics *)node2)->code);
-}
-
-static CharInfoRec *
-CIDGetCharMetrics(FontPtr pFont, FontInfo *fi, unsigned int charcode, double sxmult)
-{
- CharInfoPtr cp;
- Metrics *p, node;
- unsigned int cidcode;
-
- cidcode = node.code = getCID(pFont, charcode);
- if ((cidcode < fi->nChars) && (cidcode == fi->metrics[cidcode].code))
- p = &fi->metrics[cidcode];
- else
- p = (Metrics *)bsearch(&node, fi->metrics, fi->nChars, sizeof(Metrics), node_compare);
-
- if (!p)
- p = &fi->metrics[0];
-
- if (!(cp = (CharInfoRec *)Xalloc(sizeof(CharInfoRec))))
- return NULL;
- bzero(cp, sizeof(CharInfoRec));
-
- /* indicate that character bitmap is not defined */
- cp->bits = (char *)CID_BITMAP_UNDEFINED;
-
-
- /* get metric data for this CID code from the CID AFM file */
- cp->metrics.leftSideBearing =
- floor(p->charBBox.llx / sxmult + 0.5);
- cp->metrics.rightSideBearing =
- floor(p->charBBox.urx / sxmult + 0.5);
- cp->metrics.characterWidth = floor(p->wx / sxmult + 0.5);
- cp->metrics.ascent = floor(p->charBBox.ury / sxmult + 0.5);
- cp->metrics.descent = -floor(p->charBBox.lly / sxmult + 0.5);
-
- cp->metrics.attributes = p->wx;
-
- return cp;
-}
-
-int
-CIDGetAFM(FontPtr pFont, unsigned long count, unsigned char *chars, FontEncoding charEncoding, unsigned long *glyphCount, CharInfoPtr *glyphs, char *cidafmfile)
-{
- FILE *fp;
- FontInfo *fi = NULL;
- cidglyphs *cid;
- CharInfoPtr *glyphsBase;
- register unsigned int c;
-
- register CharInfoPtr pci;
- CharInfoPtr pDefault;
- unsigned int firstCol, code, char_row, char_col;
- double sxmult;
-
- cid = (cidglyphs *)pFont->fontPrivate;
-
- if (cid->AFMinfo == NULL) {
- if (!(fp = fopen(cidafmfile, "rb")))
- return(BadFontName);
-
- if (CIDAFM(fp, &fi) != 0) {
- fprintf(stderr,
- "There is something wrong with Adobe Font Metric file %s.\n",
- cidafmfile);
- fclose(fp);
- return(BadFontName);
- }
- fclose(fp);
- cid->AFMinfo = fi;
- }
- fi = cid->AFMinfo;
-
- firstCol = pFont->info.firstCol;
- pDefault = cid->pDefault;
- glyphsBase = glyphs;
-
- /* multiplier for computation of raw values */
- sxmult = hypot(cid->pixel_matrix[0], cid->pixel_matrix[1]);
- if (sxmult > EPS) sxmult = 1000.0 / sxmult;
- if (sxmult == 0.0) return(0);
-
- switch (charEncoding) {
-
-#define EXIST(pci) \
- ((pci)->metrics.attributes || \
- (pci)->metrics.ascent != -(pci)->metrics.descent || \
- (pci)->metrics.leftSideBearing != (pci)->metrics.rightSideBearing)
-
- case Linear8Bit:
- case TwoD8Bit:
- if (pFont->info.firstRow > 0)
- break;
- while (count--) {
- c = (*chars++);
- if (c >= firstCol && c <= pFont->info.lastCol) {
- code = c - firstCol;
- if (!(pci = (CharInfoRec *)cid->glyphs[code]))
- pci = CIDGetCharMetrics(pFont, fi, c, sxmult);
- if (pci && EXIST(pci)) {
- *glyphs++ = pci;
- cid->glyphs[code] = pci;
- }
- } else if (pDefault)
- *glyphs++ = pDefault;
- }
- break;
- case Linear16Bit:
- while (count--) {
- char_row = *chars++;
- char_col = *chars++;
- c = char_row << 8;
- c = (c | char_col);
- if (pFont->info.firstRow <= char_row && char_row <=
- pFont->info.lastRow && pFont->info.firstCol <= char_col &&
- char_col <= pFont->info.lastCol) {
- code = pFont->info.lastCol - pFont->info.firstCol + 1;
- char_row = char_row - pFont->info.firstRow;
- char_col = char_col - pFont->info.firstCol;
- code = char_row * code + char_col;
- if (!(pci = (CharInfoRec *)cid->glyphs[code]))
- pci = CIDGetCharMetrics(pFont, fi, c, sxmult);
- if (pci && EXIST(pci)) {
- *glyphs++ = pci;
- cid->glyphs[code] = pci;
- } else if (pDefault) {
- *glyphs++ = pDefault;
- cid->glyphs[code] = pDefault;
- }
- } else if (pDefault)
- *glyphs++ = pDefault;
- }
- break;
-
- case TwoD16Bit:
- while (count--) {
- char_row = (*chars++);
- char_col = (*chars++);
- c = char_row << 8;
- c = (c | char_col);
- if (pFont->info.firstRow <= char_row && char_row <=
- pFont->info.lastRow && pFont->info.firstCol <= char_col &&
- char_col <= pFont->info.lastCol) {
- code = pFont->info.lastCol - pFont->info.firstCol + 1;
- char_row = char_row - pFont->info.firstRow;
- char_col = char_col - pFont->info.firstCol;
- code = char_row * code + char_col;
- if (!(pci = (CharInfoRec *)cid->glyphs[code]))
- pci = CIDGetCharMetrics(pFont, fi, c, sxmult);
- if (pci && EXIST(pci)) {
- *glyphs++ = pci;
- cid->glyphs[code] = pci;
- } else if (pDefault) {
- *glyphs++ = pDefault;
- cid->glyphs[code] = pDefault;
- }
- } else if (pDefault)
- *glyphs++ = pDefault;
- }
- break;
- }
- *glyphCount = glyphs - glyphsBase;
-
-#undef EXIST
-
- return Successful;
-
-}
-#endif
diff --git a/src/Type1/fontfcn.c b/src/Type1/fontfcn.c
index 9b48b98..5149561 100644
--- a/src/Type1/fontfcn.c
+++ b/src/Type1/fontfcn.c
@@ -28,31 +28,11 @@
* SOFTWARE.
*/
/* Author: Katherine A. Hitchcock IBM Almaden Research Laboratory */
-/* Copyright (c) 1994-1999 Silicon Graphics, Inc. All Rights Reserved.
- *
- * The contents of this file are subject to the CID Font Code Public Licence
- * Version 1.0 (the "License"). You may not use this file except in compliance
- * with the Licence. You may obtain a copy of the License at Silicon Graphics,
- * Inc., attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA
- * 94043 or at http://www.sgi.com/software/opensource/cid/license.html.
- *
- * Software distributed under the License is distributed on an "AS IS" basis.
- * ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
- * WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF
- * NON-INFRINGEMENT. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * The Original Software is CID font code that was developed by Silicon
- * Graphics, Inc.
- */
/* $XFree86: xc/lib/font/Type1/fontfcn.c,v 1.10 2001/04/05 17:42:27 dawes Exp $ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#ifdef BUILDCID
-#define XFONT_CID 1
-#endif
#ifndef FONTMODULE
#include <stdio.h>
@@ -64,10 +44,6 @@
#endif
#include "t1imager.h"
#include "util.h"
-#if XFONT_CID
-#include "range.h"
-#include <X11/Xdefs.h>
-#endif
#include <X11/fonts/fntfilst.h>
#include "fontfcn.h"
@@ -76,13 +52,6 @@ extern struct segment *Type1Char ( char *env, XYspace S,
psobj *osubrsP,
struct blues_struct *bluesP, int *modeP );
-#if XFONT_CID
-extern struct xobject *CIDChar ( char *env, XYspace S,
- psobj *charstrP, psobj *subrsP,
- psobj *osubrsP,
- struct blues_struct *bluesP, int *modeP );
-static boolean initCIDFont( int cnt );
-#endif
/***================================================================***/
/* GLOBALS */
@@ -92,17 +61,7 @@ char *CurFontEnv;
char *vm_base = NULL;
psfont *FontP = NULL;
psfont TheCurrentFont;
-#if XFONT_CID
-char CurCIDFontName[CID_PATH_MAX];
-char CurCMapName[CID_PATH_MAX];
-cidfont *CIDFontP = NULL;
-cmapres *CMapP = NULL;
-cidfont TheCurrentCIDFont;
-cmapres TheCurrentCMap;
-psfont *FDArrayP = NULL;
-int FDArrayIndex = 0;
-#endif
-
+
/***================================================================***/
/* SearchDict - look for name */
/* - compare for match on len and string */
@@ -129,55 +88,6 @@ SearchDictName(psdict *dictP, psobj *keyP)
return(0);
}
-#if XFONT_CID
-static boolean
-initCIDFont(int cnt)
-{
- if (!(vm_init(cnt))) return(FALSE);
- vm_base = vm_next_byte();
- strcpy(CurCIDFontName, ""); /* initialize to none */
- strcpy(CurCMapName, ""); /* initialize to none */
- /* cause a font data reset on the next Type 1 font */
- strcpy(CurFontName, ""); /* initialize to none */
- CIDFontP = &TheCurrentCIDFont;
- CMapP = &TheCurrentCMap;
- CIDFontP->vm_start = vm_next_byte();
- CIDFontP->spacerangecnt = 0;
- CIDFontP->notdefrangecnt = 0;
- CIDFontP->cidrangecnt = 0;
- CIDFontP->spacerangeP = NULL;
- CIDFontP->notdefrangeP = NULL;
- CIDFontP->cidrangeP = NULL;
- CIDFontP->CIDFontFileName.len = 0;
- CIDFontP->CIDFontFileName.data.valueP = CurCIDFontName;
- CMapP->CMapFileName.len = 0;
- CMapP->CMapFileName.data.valueP = CurCMapName;
- CMapP->firstRow = 0xFFFF;
- CMapP->firstCol = 0xFFFF;
- CMapP->lastRow = 0;
- CMapP->lastCol = 0;
- return(TRUE);
-}
-
-/***================================================================***/
-boolean
-initCIDType1Font(void)
-{
- strcpy(CurFontName, ""); /* initialize to none */
- FontP = &FDArrayP[FDArrayIndex];
- FontP->vm_start = vm_next_byte();
- FontP->FontFileName.len = 0;
- FontP->FontFileName.data.valueP = CurFontName;
- FontP->Subrs.len = 0;
- FontP->Subrs.data.stringP = NULL;
- FontP->CharStringsP = NULL;
- FontP->Private = NULL;
- FontP->fontInfoP = NULL;
- FontP->BluesP = NULL;
- return(TRUE);
-}
-#endif
-
boolean
initFont(int cnt)
{
@@ -186,10 +96,6 @@ initFont(int cnt)
vm_base = vm_next_byte();
if (!(Init_BuiltInEncoding())) return(FALSE);
strcpy(CurFontName, ""); /* iniitialize to none */
-#if XFONT_CID
- /* cause a font data reset on the next CID-keyed font */
- strcpy(CurCIDFontName, ""); /* initialize to none */
-#endif
FontP = &TheCurrentFont;
FontP->vm_start = vm_next_byte();
FontP->FontFileName.len = 0;
@@ -197,51 +103,6 @@ initFont(int cnt)
return(TRUE);
}
/***================================================================***/
-#if XFONT_CID
-static void
-resetCIDFont(char *cidfontname, char *cmapfile)
-{
-
- vm_next = CIDFontP->vm_start;
- vm_free = vm_size - ( vm_next - vm_base);
- CIDFontP->spacerangecnt = 0;
- CIDFontP->notdefrangecnt = 0;
- CIDFontP->cidrangecnt = 0;
- CIDFontP->spacerangeP = NULL;
- CIDFontP->notdefrangeP = NULL;
- CIDFontP->cidrangeP = NULL;
- CIDFontP->CIDfontInfoP = NULL;
- /* This will load the font into the FontP */
- strcpy(CurCIDFontName,cidfontname);
- strcpy(CurCMapName,cmapfile);
- CIDFontP->CIDFontFileName.len = strlen(CurCIDFontName);
- CIDFontP->CIDFontFileName.data.valueP = CurCIDFontName;
- CMapP->CMapFileName.len = strlen(CurCMapName);
- CMapP->CMapFileName.data.valueP = CurCMapName;
- CMapP->firstRow = 0xFFFF;
- CMapP->firstCol = 0xFFFF;
- CMapP->lastRow = 0;
- CMapP->lastCol = 0;
-}
-
-static void
-resetCIDType1Font(void)
-{
-
- vm_next = FontP->vm_start;
- vm_free = vm_size - ( vm_next - vm_base);
- FontP->Subrs.len = 0;
- FontP->Subrs.data.stringP = NULL;
- FontP->CharStringsP = NULL;
- FontP->Private = NULL;
- FontP->fontInfoP = NULL;
- FontP->BluesP = NULL;
- /* This will load the font into the FontP */
- FontP->FontFileName.len = strlen(CurFontName);
- FontP->FontFileName.data.valueP = CurFontName;
-}
-#endif
-
static void
resetFont(char *env)
{
@@ -261,52 +122,6 @@ resetFont(char *env)
}
-#if XFONT_CID
-/***================================================================***/
-int
-readCIDFont(char *cidfontname, char *cmapfile)
-{
- int rcode;
-
- /* restore the virtual memory and eliminate old font */
- resetCIDFont(cidfontname, cmapfile);
- /* This will load the font into the FontP */
- rcode = scan_cidfont(CIDFontP, CMapP);
- if (rcode == SCAN_OUT_OF_MEMORY) {
- /* free the memory and start again */
- if (!(initCIDFont(vm_size * 2))) {
- /* we are really out of memory */
- return(SCAN_OUT_OF_MEMORY);
- }
- resetCIDFont(cidfontname, cmapfile);
- rcode = scan_cidfont(CIDFontP, CMapP);
- /* only double the memory twice, then report error */
- if (rcode == SCAN_OUT_OF_MEMORY) {
- /* free the memory and start again */
- if (!(initCIDFont(vm_size * 2))) {
- /* we are really out of memory */
- return(SCAN_OUT_OF_MEMORY);
- }
- resetCIDFont(cidfontname, cmapfile);
- rcode = scan_cidfont(CIDFontP, CMapP);
- }
- }
- return(rcode);
-}
-
-int
-readCIDType1Font(void)
-{
- int rcode;
-
- resetCIDType1Font();
-
- /* This will load the font into the FontP */
- rcode = scan_cidtype1font(FontP);
- return(rcode);
-}
-#endif
-
int
readFont(char *env)
{
@@ -317,33 +132,13 @@ readFont(char *env)
/* This will load the font into the FontP */
rcode = scan_font(FontP);
if (rcode == SCAN_OUT_OF_MEMORY) {
- /* free the memory and start again */
-#if XFONT_CID
- /* xfree(vm_base); */
-#else
- xfree(vm_base);
-#endif
if (!(initFont(vm_size * 2))) {
/* we are really out of memory */
return(SCAN_OUT_OF_MEMORY);
}
resetFont(env);
rcode = scan_font(FontP);
-#if XFONT_CID
- /* only double the memory twice, then report error */
- if (rcode == SCAN_OUT_OF_MEMORY) {
- /* free the memory and start again */
- /* xfree(vm_base) */
- if (!(initFont(vm_size * 2))) {
- /* we are really out of memory */
- return(SCAN_OUT_OF_MEMORY);
- }
- resetFont(env);
- rcode = scan_font(FontP);
- }
-#else
/* only double the memory once, then report error */
-#endif
}
return(rcode);
}
@@ -393,73 +188,6 @@ fontfcnB(struct XYspace *S, unsigned char *code, int *lenP, int *mode)
return(charpath);
}
-#if XFONT_CID
-/***================================================================***/
-/* CIDfontfcnA(cidfontname, cmapfile, mode) */
-/* */
-/* 1) initialize the font - global indicates it has been done */
-/* 2) load the font */
-/***================================================================***/
-Bool
-CIDfontfcnA(char *cidfontname, char *cmapfile, int *mode)
-{
- int rcode, cidinit;
-
- cidinit = 0;
- if (CIDFontP == NULL || strcmp(CurCIDFontName, "") == 0) {
- InitImager();
- if (!(initCIDFont(VM_SIZE))) {
- /* we are really out of memory */
- *mode = SCAN_OUT_OF_MEMORY;
- return(FALSE);
- }
- cidinit = 1;
- }
-
- /* if the cidfontname is null, then use font already loaded */
-
- /* if not the same font name */
- if (cidinit || (cidfontname && strcmp(cidfontname,CurCIDFontName) != 0) ||
- (cmapfile && strcmp(cmapfile,CurCMapName) != 0)) {
- /* restore the virtual memory and eliminate old font, read new one */
- rcode = readCIDFont(cidfontname, cmapfile);
- if (rcode != 0 ) {
- strcpy(CurCIDFontName, ""); /* no CIDFont loaded */
- strcpy(CurCMapName, ""); /* no CMap loaded */
- *mode = rcode;
- return(FALSE);
- }
- }
- return(TRUE);
-
-}
-
-/***================================================================***/
-/* CIDType1fontfcnA(mode) */
-/* */
-/* 1) initialize the font - global indicates it has been done */
-/* 2) load the font */
-/***================================================================***/
-Bool
-CIDType1fontfcnA(int *mode)
-{
- int rcode;
-
- if (!(initCIDType1Font())) {
- /* we are really out of memory */
- *mode = SCAN_OUT_OF_MEMORY;
- return(FALSE);
- }
-
- if ((rcode = readCIDType1Font()) != 0) {
- strcpy(CurFontName, ""); /* no font loaded */
- *mode = rcode;
- return(FALSE);
- }
- return(TRUE);
-
-}
-#endif
/***================================================================***/
/* fontfcnA(env, mode) */
@@ -476,11 +204,7 @@ fontfcnA(char *env, int *mode)
/* Has the FontP initialized? If not, then */
/* Initialize */
-#if XFONT_CID
- if (FontP == NULL || strcmp(CurFontName, "") == 0) {
-#else
if (FontP == NULL) {
-#endif
InitImager();
if (!(initFont(VM_SIZE))) {
/* we are really out of memory */
@@ -505,100 +229,6 @@ fontfcnA(char *env, int *mode)
}
-#if XFONT_CID
-/***================================================================***/
-/* CIDQueryFontLib(cidfontname,cmapfile,infoName,infoValue,rcodeP) */
-/* */
-/* cidfontname is a pointer to a string that contains the fontname. */
-/* */
-/* 1) initialize the font - global indicates it has been done */
-/* 2) load the font */
-/* 3) use the font to call getInfo for that value. */
-/***================================================================***/
-
-void
-CIDQueryFontLib(char *cidfontname, char *cmapfile, char *infoName,
- pointer infoValue, /* parameter returned here */
- int *rcodeP)
-{
- int rc,N,i,cidinit;
- psdict *dictP;
- psobj nameObj;
- psobj *valueP;
-
- /* Has the CIDFontP initialized? If not, then */
- /* Initialize */
- cidinit = 0;
- if (CIDFontP == NULL || strcmp(CurCIDFontName, "") == 0) {
- InitImager();
- if (!(initCIDFont(VM_SIZE))) {
- *rcodeP = 1;
- return;
- }
- cidinit = 1;
- }
- /* if the file name is null, then use font already loaded */
- /* if the not same font name, reset and load next font */
- if (cidinit || (cidfontname && strcmp(cidfontname,CurCIDFontName) != 0) ||
- (cmapfile && strcmp(cmapfile,CurCMapName) != 0)) {
- /* restore the virtual memory and eliminate old font */
- rc = readCIDFont(cidfontname, cmapfile);
- if (rc != 0 ) {
- strcpy(CurCIDFontName, ""); /* no font loaded */
- strcpy(CurCMapName, ""); /* no font loaded */
- *rcodeP = 1;
- return;
- }
- }
- dictP = CIDFontP->CIDfontInfoP;
- objFormatName(&nameObj,strlen(infoName),infoName);
- N = SearchDictName(dictP,&nameObj);
- /* if found */
- if ( N > 0 ) {
- *rcodeP = 0;
- switch (dictP[N].value.type) {
- case OBJ_ARRAY:
- valueP = dictP[N].value.data.arrayP;
- /* Just double check valueP. H.J. */
- if (valueP == NULL) break;
- if (strcmp(infoName,"FontMatrix") == 0) {
- /* 6 elments, return them as floats */
- for (i=0;i<6;i++) {
- if (valueP->type == OBJ_INTEGER )
- ((float *)infoValue)[i] = valueP->data.integer;
- else
- ((float *)infoValue)[i] = valueP->data.real;
- valueP++;
- }
- }
- if (strcmp(infoName,"FontBBox") == 0) {
- /* 4 elments for Bounding Box. all integers */
- for (i=0;i<4;i++) {
- ((int *)infoValue)[i] = valueP->data.integer;
- valueP++;
- }
- break;
- case OBJ_INTEGER:
- case OBJ_BOOLEAN:
- *((int *)infoValue) = dictP[N].value.data.integer;
- break;
- case OBJ_REAL:
- *((float *)infoValue) = dictP[N].value.data.real;
- break;
- case OBJ_NAME:
- case OBJ_STRING:
- *((char **)infoValue) = dictP[N].value.data.valueP;
- break;
- default:
- *rcodeP = 1;
- break;
- }
- }
- }
- else *rcodeP = 1;
-}
-#endif
-
/***================================================================***/
/* QueryFontLib(env, infoName,infoValue,rcodeP) */
/* */
@@ -686,24 +316,3 @@ QueryFontLib(char *env, char *infoName,
}
else *rcodeP = 1;
}
-
-#if XFONT_CID
-struct xobject *
-CIDfontfcnC(struct XYspace *S, psobj *theStringP,
- psobj *SubrsArrayP, struct blues_struct *BluesP,
- int *lenP, int *mode)
-{
- struct xobject *charpath; /* the path for this character */
-
- charpath = (struct xobject *)CIDChar((char *)FontP,S,theStringP,
- SubrsArrayP,NULL,BluesP,mode);
- /* if Type1Char reported an error, then return */
- if ( *mode == FF_PARSE_ERROR) return(NULL);
- /* fill with winding rule unless path was requested */
- if (*mode != FF_PATH) {
- charpath = (struct xobject *)Interior((struct segment *)charpath,
- WINDINGRULE+CONTINUITY);
- }
- return(charpath);
-}
-#endif
diff --git a/src/Type1/fontfcn.h b/src/Type1/fontfcn.h
index 1409eb9..70d82ad 100644
--- a/src/Type1/fontfcn.h
+++ b/src/Type1/fontfcn.h
@@ -27,62 +27,14 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
-/* Copyright (c) 1994-1999 Silicon Graphics, Inc. All Rights Reserved.
- *
- * The contents of this file are subject to the CID Font Code Public Licence
- * Version 1.0 (the "License"). You may not use this file except in compliance
- * with the Licence. You may obtain a copy of the License at Silicon Graphics,
- * Inc., attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA
- * 94043 or at http://www.sgi.com/software/opensource/cid/license.html.
- *
- * Software distributed under the License is distributed on an "AS IS" basis.
- * ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
- * WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF
- * NON-INFRINGEMENT. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * The Original Software is CID font code that was developed by Silicon
- * Graphics, Inc.
- */
/* $XFree86: xc/lib/font/Type1/fontfcn.h,v 1.4 1999/08/22 08:58:50 dawes Exp $ */
-#ifdef BUILDCID
-#define XFONT_CID 1
-#endif
-
/* modular config.h defines VERSION as libXfont version */
#ifdef VERSION
#undef VERSION
#endif
-#if XFONT_CID
-/* Definition of a PostScript CIDFont resource */
-typedef struct cid_font {
- char *vm_start;
- int spacerangecnt;
- int notdefrangecnt;
- int cidrangecnt;
- spacerange *spacerangeP;
- cidrange *notdefrangeP;
- cidrange *cidrangeP;
- int binarydata; /* 1=binary data, 0=hex data */
- long bytecnt;
- psobj CIDFontFileName;
- psdict *CIDfontInfoP;
-} cidfont;
-
-/* Definition of a PostScript CMap resource */
-typedef struct cmap_res {
- unsigned short firstCol;
- unsigned short lastCol;
- unsigned short firstRow;
- unsigned short lastRow;
- psobj CMapFileName;
- psdict *CMapInfoP;
-} cmapres;
-#endif
-
/* Definition of a PostScript FONT */
typedef struct ps_font {
char *vm_start;
@@ -98,10 +50,6 @@ struct blues_struct *BluesP;
/***================================================================***/
extern boolean Init_BuiltInEncoding ( void );
-#if XFONT_CID
-extern int scan_cidfont ( cidfont *CIDFontP, cmapres *CMapP );
-extern int scan_cidtype1font ( psfont *FontP );
-#endif
extern int scan_font ( psfont *FontP );
/***================================================================***/
/* Return codes from scan_font */
@@ -115,42 +63,6 @@ extern int scan_font ( psfont *FontP );
#define SCAN_FALSE -6
#define SCAN_END -7
-#if XFONT_CID
-/***================================================================***/
-/* Name of CID FontInfo fields */
-/***================================================================***/
-#define CIDCOUNT 1
-#define CIDFONTNAME 2
-#define CIDFONTTYPE 3
-#define CIDVERSION 4
-#define CIDREGISTRY 5
-#define CIDORDERING 6
-#define CIDSUPPLEMENT 7
-#define CIDMAPOFFSET 8
-#define CIDFDARRAY 9
-#define CIDFDBYTES 10
-#define CIDFONTBBOX 11
-#define CIDFULLNAME 12
-#define CIDFAMILYNAME 13
-#define CIDWEIGHT 14
-#define CIDNOTICE 15
-#define CIDGDBYTES 16
-#define CIDUIDBASE 17
-#define CIDXUID 18
-
-/***================================================================***/
-/* Name of CMapInfo fields */
-/***================================================================***/
-#define CMAPREGISTRY 1
-#define CMAPORDERING 2
-#define CMAPSUPPLEMENT 3
-#define CMAPNAME 4
-#define CMAPVERSION 5
-#define CMAPTYPE 6
-#define CMAPWMODE 7
-#define CMAPCIDCOUNT 8
-#endif
-
/***================================================================***/
/* Name of FontInfo fields */
/***================================================================***/
@@ -191,60 +103,3 @@ extern int scan_font ( psfont *FontP );
#define LENIV 14
#define RNDSTEMUP 15
#define EXPANSIONFACTOR 16
-
-#if XFONT_CID
-/***================================================================***/
-/* Name of CID Type 1 Private values */
-/***================================================================***/
-#define CIDT1MINFEATURE 1
-#define CIDT1LENIV 2
-#define CIDT1LANGGROUP 3
-#define CIDT1BLUEVALUES 4
-#define CIDT1OTHERBLUES 5
-#define CIDT1BLUESCALE 6
-#define CIDT1BLUEFUZZ 7
-#define CIDT1BLUESHIFT 8
-#define CIDT1FAMBLUES 9
-#define CIDT1FAMOTHERBLUES 10
-#define CIDT1STDHW 11
-#define CIDT1STDVW 12
-#define CIDT1STEMSNAPH 13
-#define CIDT1STEMSNAPV 14
-#define CIDT1SUBMAPOFF 15
-#define CIDT1SDBYTES 16
-#define CIDT1SUBRCNT 17
-#define CIDT1FORCEBOLD 18
-#define CIDT1RNDSTEMUP 19
-#define CIDT1EXPFACTOR 20
-
-#define CID_BITMAP_UNDEFINED 0
-extern int SearchDictName ( psdict *dictP, psobj *keyP );
-#if XFONT_CID
-extern boolean initCIDType1Font ( void );
-#endif
-extern boolean initFont ( int cnt );
-#if XFONT_CID
-extern int readCIDFont ( char *cidfontname, char *cmapfile );
-extern int readCIDType1Font ( void );
-#endif
-extern int readFont ( char *env );
-extern struct xobject *fontfcnB ( struct XYspace *S, unsigned char *code,
- int *lenP, int *mode );
-#if XFONT_CID
-extern Bool CIDfontfcnA ( char *cidfontname, char *cmapfile, int *mode );
-extern Bool CIDType1fontfcnA ( int *mode );
-#endif
-extern Bool fontfcnA ( char *env, int *mode );
-#if XFONT_CID
-extern void CIDQueryFontLib ( char *cidfontname, char *cmapfile,
- char *infoName, pointer infoValue, int *rcodeP );
-#endif
-extern void QueryFontLib ( char *env, char *infoName, pointer infoValue,
- int *rcodeP );
-#if XFONT_CID
-extern struct xobject *CIDfontfcnC ( struct XYspace *S, psobj *theStringP,
- psobj *SubrsArrayP,
- struct blues_struct *BluesP, int *lenP,
- int *mode );
-#endif
-#endif
diff --git a/src/Type1/objects.h b/src/Type1/objects.h
index 7552f98..7289a17 100644
--- a/src/Type1/objects.h
+++ b/src/Type1/objects.h
@@ -26,30 +26,10 @@
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
* THIS SOFTWARE.
*/
-/* Copyright (c) 1994-1999 Silicon Graphics, Inc. All Rights Reserved.
- *
- * The contents of this file are subject to the CID Font Code Public Licence
- * Version 1.0 (the "License"). You may not use this file except in compliance
- * with the Licence. You may obtain a copy of the License at Silicon Graphics,
- * Inc., attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA
- * 94043 or at http://www.sgi.com/software/opensource/cid/license.html.
- *
- * Software distributed under the License is distributed on an "AS IS" basis.
- * ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
- * WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF
- * NON-INFRINGEMENT. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * The Original Software is CID font code that was developed by Silicon
- * Graphics, Inc.
- */
/* $XFree86: xc/lib/font/Type1/objects.h,v 1.14tsi Exp $ */
/*SHARED*/
/*END SHARED*/
-#ifdef BUILDCID
-#define XFONT_CID 1
-#endif
#include <X11/Xdefs.h>
#include <X11/Xfuncproto.h>
@@ -303,11 +283,7 @@ struct xobject {
extern char MustCheckArgs INITIALIZED(TRUE);
extern char MustTraceCalls INITIALIZED(FALSE);
-#if XFONT_CID
-extern char MustCrash INITIALIZED(FALSE);
-#else
extern char MustCrash INITIALIZED(TRUE);
-#endif
extern char InternalTrace INITIALIZED(TRUE);
extern char LineIOTrace INITIALIZED(TRUE);
diff --git a/src/Type1/range.h b/src/Type1/range.h
deleted file mode 100644
index 496f000..0000000
--- a/src/Type1/range.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright (c) 1994-1999 Silicon Graphics, Inc. All Rights Reserved.
- *
- * The contents of this file are subject to the CID Font Code Public Licence
- * Version 1.0 (the "License"). You may not use this file except in compliance
- * with the Licence. You may obtain a copy of the License at Silicon Graphics,
- * Inc., attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA
- * 94043 or at http://www.sgi.com/software/opensource/cid/license.html.
- *
- * Software distributed under the License is distributed on an "AS IS" basis.
- * ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
- * WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF
- * NON-INFRINGEMENT. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * The Original Software is CID font code that was developed by Silicon
- * Graphics, Inc.
- */
-#ifdef BUILDCID
-#define XFONT_CID 1
-#endif
-
-#if XFONT_CID
-#define CID_NAME_MAX 255 /* max # of characters in a file name */
-#define CID_PATH_MAX 1024 /* max # of characters in a path name */
-
-typedef struct spacerange_code {
- unsigned int srcCodeLo;
- unsigned int srcCodeHi;
-} spacerangecode;
-
-typedef struct space_range {
- struct space_range *next;
- int rangecnt;
- struct spacerange_code *spacecode;
-} spacerange;
-
-typedef struct cidrange_code {
- unsigned int srcCodeLo;
- unsigned int srcCodeHi;
- unsigned int dstCIDLo;
-} cidrangecode;
-
-typedef struct cid_range {
- struct cid_range *next;
- int rangecnt;
- struct cidrange_code *range;
-} cidrange;
-#endif
diff --git a/src/Type1/scanfont.c b/src/Type1/scanfont.c
index bc3c244..9a09848 100644
--- a/src/Type1/scanfont.c
+++ b/src/Type1/scanfont.c
@@ -29,31 +29,11 @@
* SOFTWARE.
*/
/* Author: Katherine A. Hitchcock IBM Almaden Research Laboratory */
-/* Copyright (c) 1994-1999 Silicon Graphics, Inc. All Rights Reserved.
- *
- * The contents of this file are subject to the CID Font Code Public Licence
- * Version 1.0 (the "License"). You may not use this file except in compliance
- * with the Licence. You may obtain a copy of the License at Silicon Graphics,
- * Inc., attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA
- * 94043 or at http://www.sgi.com/software/opensource/cid/license.html.
- *
- * Software distributed under the License is distributed on an "AS IS" basis.
- * ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
- * WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF
- * NON-INFRINGEMENT. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * The Original Software is CID font code that was developed by Silicon
- * Graphics, Inc.
- */
/* $XFree86: xc/lib/font/Type1/scanfont.c,v 1.16 2003/05/27 22:26:46 tsi Exp $ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#ifdef BUILDCID
-#define XFONT_CID 1
-#endif
#ifndef FONTMODULE
#include <string.h>
@@ -65,9 +45,6 @@
#include "t1stdio.h"
#include "util.h"
#include "token.h"
-#if XFONT_CID
-#include "range.h"
-#endif
#include "objects.h"
#include "spaces.h"
#include "fontfcn.h"
@@ -75,18 +52,6 @@
#include <limits.h>
-#if XFONT_CID
-#define CID_BUFSIZE 80
-
-extern psfont *FDArrayP;
-static spacerange *spacerangeP;
-static cidrange *notdefrangeP;
-static cidrange *cidrangeP;
-extern int FDArrayIndex;
-static boolean CIDWantFontInfo;
-static psobj inputFile1;
-#endif
-
static int rc;
static boolean InPrivateDict;
static boolean WantFontInfo;
@@ -631,59 +596,6 @@ getEncoding(psobj *arrayP)
return (SCAN_ERROR);
}
/***================================================================***/
-#if XFONT_CID
-static int
-getFDArray(psobj *arrayP)
-{
- int rc;
-
- /* get the number of items in the FDArray */
- scan_token(inputP);
- if (tokenType == TOKEN_INTEGER) {
- /* an FD array must contain at least one element */
- if (tokenValue.integer <= 0)
- return(SCAN_ERROR);
- arrayP->len = tokenValue.integer;
- } else
- return(SCAN_ERROR);
-
- /* get the token "array" */
- scan_token(inputP);
- if (tokenType != TOKEN_NAME || strncmp(tokenStartP, "array", 5) != 0)
- return(SCAN_ERROR);
-
- /* format the array in memory, save pointer to the beginning */
- arrayP->data.valueP = tokenStartP;
-
- /* allocate FDArray */
- /* No integer overflow since arrayP->len is unsigned short */
- FDArrayP = (psfont *)vm_alloc(arrayP->len*(sizeof(psfont)));
- if (!(FDArrayP)) return(SCAN_OUT_OF_MEMORY);
-
- /* get a specified number of font dictionaries */
- for (FDArrayIndex = 0; FDArrayIndex < arrayP->len; FDArrayIndex++) {
- /* get "dup" */
- scan_token(inputP);
- if (tokenType != TOKEN_NAME || strncmp(tokenStartP, "dup", 3) != 0)
- return(SCAN_ERROR);
- /* get an integer digit */
- scan_token(inputP);
- if (tokenType != TOKEN_INTEGER)
- return(SCAN_ERROR);
-
- /* read a CID version of a Type 1 font */
- if (!CIDType1fontfcnA(&rc))
- return(rc);
-
- /* get "put" */
- scan_token(inputP);
- if (tokenType != TOKEN_NAME || strncmp(tokenStartP, "put", 3) != 0)
- return(SCAN_ERROR);
- }
- return(SCAN_OK);
-}
-#endif
-
static int
getArray(psobj *arrayP)
{
@@ -946,98 +858,6 @@ BuildCharStrings(psfont *FontP)
}
/***================================================================***/
-#if XFONT_CID
-/***================================================================***/
-/*
- * BuildCIDFontInfo Dictionary
- */
-/***================================================================***/
-static int
-BuildCIDFontInfo(cidfont *CIDfontP)
-{
- psdict *dictP;
-
- /* allocate the private dictionary (max number of entries + 1) */
- dictP = (psdict *)vm_alloc(20*sizeof(psdict));
- if (!(dictP)) return(SCAN_OUT_OF_MEMORY);
-
- CIDfontP->CIDfontInfoP = dictP;
- CIDfontP->CIDfontInfoP[0].key.len = 18; /* number of actual entries */
- objFormatName(&(dictP[CIDCOUNT].key),8,"CIDCount");
- objFormatInteger(&(dictP[CIDCOUNT].value),-1);
- objFormatName(&(dictP[CIDFONTNAME].key),11,"CIDFontName");
- objFormatName(&(dictP[CIDFONTNAME].value),0,NULL);
- objFormatName(&(dictP[CIDFONTTYPE].key),11,"CIDFontType");
- objFormatInteger(&(dictP[CIDFONTTYPE].value),-1);
- objFormatName(&(dictP[CIDVERSION].key),14,"CIDFontVersion");
- objFormatInteger(&(dictP[CIDVERSION].value),-1);
- objFormatName(&(dictP[CIDREGISTRY].key),8,"Registry");
- objFormatString(&(dictP[CIDREGISTRY].value),0,NULL);
- objFormatName(&(dictP[CIDORDERING].key),8,"Ordering");
- objFormatString(&(dictP[CIDORDERING].value),0,NULL);
- objFormatName(&(dictP[CIDSUPPLEMENT].key),10,"Supplement");
- objFormatInteger(&(dictP[CIDSUPPLEMENT].value),-1);
- objFormatName(&(dictP[CIDMAPOFFSET].key),12,"CIDMapOffset");
- objFormatInteger(&(dictP[CIDMAPOFFSET].value),-1);
- objFormatName(&(dictP[CIDFDARRAY].key),7,"FDArray");
- objFormatArray(&(dictP[CIDFDARRAY].value),0,NULL);
- objFormatName(&(dictP[CIDFDBYTES].key),7,"FDBytes");
- objFormatInteger(&(dictP[CIDFDBYTES].value),-1);
- objFormatName(&(dictP[CIDFONTBBOX].key),8,"FontBBox");
- objFormatArray(&(dictP[CIDFONTBBOX].value),0,NULL);
- objFormatName(&(dictP[CIDFULLNAME].key),8,"FullName");
- objFormatString(&(dictP[CIDFULLNAME].value),0,NULL);
- objFormatName(&(dictP[CIDFAMILYNAME].key),10,"FamilyName");
- objFormatString(&(dictP[CIDFAMILYNAME].value),0,NULL);
- objFormatName(&(dictP[CIDWEIGHT].key),6,"Weight");
- objFormatString(&(dictP[CIDWEIGHT].value),0,NULL);
- objFormatName(&(dictP[CIDNOTICE].key),6,"Notice");
- objFormatString(&(dictP[CIDNOTICE].value),0,NULL);
- objFormatName(&(dictP[CIDGDBYTES].key),7,"GDBytes");
- objFormatInteger(&(dictP[CIDGDBYTES].value),-1);
- objFormatName(&(dictP[CIDUIDBASE].key),7,"UIDBase");
- objFormatInteger(&(dictP[CIDUIDBASE].value),0);
- objFormatName(&(dictP[CIDXUID].key),4,"XUID");
- objFormatInteger(&(dictP[CIDXUID].value),0);
- return(SCAN_OK);
-}
-/***================================================================***/
-/*
- * BuildCMapInfo Dictionary
- */
-/***================================================================***/
-static int
-BuildCMapInfo(cmapres *CMapP)
-{
- psdict *dictP;
-
- /* allocate the private dictionary (max number of entries + 1) */
- dictP = (psdict *)vm_alloc(20*sizeof(psdict));
- if (!(dictP)) return(SCAN_OUT_OF_MEMORY);
-
- CMapP->CMapInfoP = dictP;
- CMapP->CMapInfoP[0].key.len = 8; /* number of actual entries */
- objFormatName(&(dictP[CMAPREGISTRY].key),8,"Registry");
- objFormatString(&(dictP[CMAPREGISTRY].value),0,NULL);
- objFormatName(&(dictP[CMAPORDERING].key),8,"Ordering");
- objFormatString(&(dictP[CMAPORDERING].value),0,NULL);
- objFormatName(&(dictP[CMAPSUPPLEMENT].key),10,"Supplement");
- objFormatInteger(&(dictP[CMAPSUPPLEMENT].value),-1);
- objFormatName(&(dictP[CMAPNAME].key),8,"CMapName");
- objFormatString(&(dictP[CMAPNAME].value),0,NULL);
- objFormatName(&(dictP[CMAPVERSION].key),11,"CMapVersion");
- objFormatInteger(&(dictP[CMAPVERSION].value),-1);
- objFormatName(&(dictP[CMAPTYPE].key),8,"CMapType");
- objFormatInteger(&(dictP[CMAPTYPE].value),-1);
- objFormatName(&(dictP[CMAPWMODE].key),5,"WMode");
- objFormatInteger(&(dictP[CMAPWMODE].value),-1);
- objFormatName(&(dictP[CMAPCIDCOUNT].key),8,"CIDCount");
- objFormatInteger(&(dictP[CMAPCIDCOUNT].value),-1);
- return(SCAN_OK);
-}
-#endif
-
-/***================================================================***/
/*
* BuildFontInfo Dictionary
*/
@@ -1089,70 +909,6 @@ BuildFontInfo(psfont *fontP)
objFormatReal(&(dictP[UNDERLINETHICKNESS].value),0.0);
return(SCAN_OK);
}
-#if XFONT_CID
-/***================================================================***/
-/*
- * BuildCIDType1Private Dictionary
- */
-/***================================================================***/
-static int
-BuildCIDType1Private(psfont *fontP)
-{
- psdict *Private;
-
- /* allocate the private dictionary */
- Private = (psdict *)vm_alloc(21*sizeof(psdict));
-
- if (!(Private)) return(SCAN_OUT_OF_MEMORY);
-
- fontP->Private = Private;
- fontP->Private[0].key.len = 20; /* number of actual entries */
-
- objFormatName(&(Private[CIDT1MINFEATURE].key),10,"MinFeature");
- objFormatArray(&(Private[CIDT1MINFEATURE].value),0,NULL);
- objFormatName(&(Private[CIDT1LENIV].key),5,"lenIV");
- objFormatInteger(&(Private[CIDT1LENIV].value),DEFAULTLENIV);
- objFormatName(&(Private[CIDT1LANGGROUP].key),13,"LanguageGroup");
- objFormatInteger(&(Private[CIDT1LANGGROUP].value),DEFAULTLANGUAGEGROUP);
- objFormatName(&(Private[CIDT1BLUEVALUES].key),10,"BlueValues");
- objFormatArray(&(Private[CIDT1BLUEVALUES].value),0,NULL);
- objFormatName(&(Private[CIDT1OTHERBLUES].key),10,"OtherBlues");
- objFormatArray(&(Private[CIDT1OTHERBLUES].value),0,NULL);
- objFormatName(&(Private[CIDT1BLUESCALE].key),9,"BlueScale");
- objFormatReal(&(Private[CIDT1BLUESCALE].value),DEFAULTBLUESCALE);
- objFormatName(&(Private[CIDT1BLUEFUZZ].key),8,"BlueFuzz");
- objFormatInteger(&(Private[CIDT1BLUEFUZZ].value),DEFAULTBLUEFUZZ);
- objFormatName(&(Private[CIDT1BLUESHIFT].key),9,"BlueShift");
- objFormatInteger(&(Private[CIDT1BLUESHIFT].value),DEFAULTBLUESHIFT);
- objFormatName(&(Private[CIDT1FAMBLUES].key),11,"FamilyBlues");
- objFormatArray(&(Private[CIDT1FAMBLUES].value),0,NULL);
- objFormatName(&(Private[CIDT1FAMOTHERBLUES].key),16,"FamilyOtherBlues");
- objFormatArray(&(Private[CIDT1FAMOTHERBLUES].value),0,NULL);
- objFormatName(&(Private[CIDT1STDHW].key),5,"StdHW");
- objFormatArray(&(Private[CIDT1STDHW].value),0,NULL);
- objFormatName(&(Private[CIDT1STDVW].key),5,"StdVW");
- objFormatArray(&(Private[CIDT1STDVW].value),0,NULL);
- objFormatName(&(Private[CIDT1STEMSNAPH].key),9,"StemSnapH");
- objFormatArray(&(Private[CIDT1STEMSNAPH].value),0,NULL);
- objFormatName(&(Private[CIDT1STEMSNAPV].key),9,"StemSnapV");
- objFormatArray(&(Private[CIDT1STEMSNAPV].value),0,NULL);
- /* skip password */
- objFormatName(&(Private[CIDT1SUBMAPOFF].key),13,"SubrMapOffset");
- objFormatInteger(&(Private[CIDT1SUBMAPOFF].value),0);
- objFormatName(&(Private[CIDT1SDBYTES].key),7,"SDBytes");
- objFormatInteger(&(Private[CIDT1SDBYTES].value),0);
- objFormatName(&(Private[CIDT1SUBRCNT].key),9,"SubrCount");
- objFormatInteger(&(Private[CIDT1SUBRCNT].value),0);
- objFormatName(&(Private[CIDT1FORCEBOLD].key),9,"ForceBold");
- objFormatBoolean(&(Private[CIDT1FORCEBOLD].value),DEFAULTFORCEBOLD);
- objFormatName(&(Private[CIDT1RNDSTEMUP].key),9,"RndStemUp");
- objFormatBoolean(&(Private[CIDT1RNDSTEMUP].value),DEFAULTRNDSTEMUP);
- objFormatName(&(Private[CIDT1EXPFACTOR].key),15,"ExpansionFactor");
- objFormatReal(&(Private[CIDT1EXPFACTOR].value),
- DEFAULTEXPANSIONFACTOR);
- return(SCAN_OK);
-}
-#endif
/***================================================================***/
/*
* BuildPrivate Dictionary
@@ -1551,14 +1307,7 @@ FindDictValue(psdict *dictP)
if ( V != SCAN_OK ) return(V);
break;
case OBJ_ARRAY:
-#if XFONT_CID
- if (0 == strncmp(tokenStartP,"FDArray",7))
- V = getFDArray(&(dictP[N].value));
- else
- V = getArray(&(dictP[N].value));
-#else
V = getArray(&(dictP[N].value));
-#endif
if ( V != SCAN_OK ) return(V);
break;
case OBJ_INTEGER:
@@ -1615,600 +1364,6 @@ FindDictValue(psdict *dictP)
}
/***================================================================***/
-#if XFONT_CID
-/*
- * -------------------------------------------------------------------
- * Scan the next token and convert it into an object
- * Result is placed on the Operand Stack as next object
- * -------------------------------------------------------------------
- */
-int
-scan_cidfont(cidfont *CIDFontP, cmapres *CMapP)
-{
- char filename[CID_PATH_MAX];
- char cmapfile[CID_PATH_MAX];
- char buf[CID_BUFSIZE];
- char filetype[3];
- FILE *fileP;
- FILE *fileP1;
- char *nameP;
- int namelen;
- int i, j;
- int cread, rangecnt;
- unsigned int char_row, char_col;
-
- filetype[0] = 'r';
- filetype[1] = 'b';
- filetype[2] = '\0';
-
- /* copy the filename and remove leading or trailing blanks */
- /* point to name and search for leading blanks */
- nameP= CIDFontP->CIDFontFileName.data.nameP;
- namelen = CIDFontP->CIDFontFileName.len;
- while (nameP[0] == ' ') {
- nameP++;
- namelen--;
- }
- /* now remove any trailing blanks */
- while ((namelen>0) && ( nameP[namelen-1] == ' ')) {
- namelen--;
- }
- strncpy(filename,nameP,namelen);
- filename[namelen] = '\0';
- /* file name is now constructed */
- inputFile.data.fileP = NULL;
- filterFile.data.fileP = NULL;
-
- /* check whether a CIDFont file */
- if ((fileP = fopen(filename,filetype))) {
- cread = fread(buf, 1, CID_BUFSIZE, fileP);
- fclose(fileP);
- if (cread > 17) {
- if (strncmp(buf, "%!", 2) ||
- strstr(buf, "Resource-CIDFont") == NULL)
- return(SCAN_FILE_OPEN_ERROR);
- } else
- return(SCAN_FILE_OPEN_ERROR);
- } else
- return(SCAN_FILE_OPEN_ERROR);
-
- /* copy the CMap file name and remove leading or trailing blanks */
- /* point to name and search for leading blanks */
- nameP = CMapP->CMapFileName.data.nameP;
- namelen = CMapP->CMapFileName.len;
- while (nameP[0] == ' ') {
- nameP++;
- namelen--;
- }
- /* now remove any trailing blanks */
- while ((namelen>0) && ( nameP[namelen-1] == ' ')) {
- namelen--;
- }
- strncpy(cmapfile,nameP,namelen);
- cmapfile[namelen] = '\0';
- /* CMap file name is now constructed */
- inputFile1.data.fileP = NULL;
-
- /* check whether a CMap file */
- if ((fileP1 = fopen(cmapfile,filetype))) {
- cread = fread(buf, 1, CID_BUFSIZE, fileP1);
- fclose(fileP1);
- if (cread > 17) {
- if (strncmp(buf, "%!", 2) ||
- strstr(buf, "Resource-CMap") == NULL)
- return(SCAN_FILE_OPEN_ERROR);
- } else
- return(SCAN_FILE_OPEN_ERROR);
- } else
- return(SCAN_FILE_OPEN_ERROR);
-
- /* read the specified CMap file */
- inputP = &inputFile1;
-
- if (!(fileP1 = fopen(cmapfile,filetype)))
- return(SCAN_FILE_OPEN_ERROR);
-
- objFormatFile(inputP,fileP1);
-
- if ((rc = BuildCMapInfo(CMapP)) != 0)
- return(rc);
-
- /* Assume everything will be OK */
- rc = 0;
- rangecnt = 0;
-
- do {
- /* Scan the next token */
- scan_token(inputP);
- if (tokenType == TOKEN_INTEGER)
- rangecnt = tokenValue.integer;
-
- if (rangecnt < 0 || rangecnt > INT_MAX / sizeof(spacerangecode)) {
- rc = SCAN_ERROR;
- break;
- }
- /* ==> tokenLength, tokenTooLong, tokenType, and */
- /* tokenValue are now set */
-
- switch (tokenType) {
- case TOKEN_EOF:
- case TOKEN_NONE:
- case TOKEN_INVALID:
- /* in this case we are done */
- if (tokenTooLong) return(SCAN_OUT_OF_MEMORY);
- rc = SCAN_ERROR;
- break;
- case TOKEN_LITERAL_NAME:
- /* Look up the name */
- tokenStartP[tokenLength] = '\0';
-
- rc = FindDictValue(CMapP->CMapInfoP);
- /* we are not going to report errors except out of memory */
- if (rc != SCAN_OUT_OF_MEMORY)
- rc = SCAN_OK;
- break;
- case TOKEN_NAME:
- if (0 == strncmp(tokenStartP,"begincodespacerange",19)) {
- CIDFontP->spacerangecnt++;
- spacerangeP = (spacerange *)vm_alloc(sizeof(spacerange));
- if (!spacerangeP) {
- rc = SCAN_OUT_OF_MEMORY;
- break;
- }
- spacerangeP->next = NULL;
- spacerangeP->rangecnt = rangecnt;
- spacerangeP->spacecode =
- (spacerangecode *)vm_alloc(rangecnt*sizeof(spacerangecode));
- if (!spacerangeP->spacecode) {
- rc = SCAN_OUT_OF_MEMORY;
- break;
- }
- for (i = 0; i < rangecnt; i++) {
- scan_token(inputP);
- if (tokenType != TOKEN_HEX_STRING) {
- rc = SCAN_ERROR;
- break;
- }
- spacerangeP->spacecode[i].srcCodeLo = 0;
- for (j = 0; j < tokenLength; j++)
- spacerangeP->spacecode[i].srcCodeLo +=
- (unsigned char)tokenStartP[j] << (8 * (tokenLength - 1 - j));
-
- scan_token(inputP);
- if (tokenType != TOKEN_HEX_STRING) {
- rc = SCAN_ERROR;
- break;
- }
- spacerangeP->spacecode[i].srcCodeHi = 0;
- for (j = 0; j < tokenLength; j++)
- spacerangeP->spacecode[i].srcCodeHi +=
- (unsigned char)tokenStartP[j] << (8 * (tokenLength - 1 - j));
- }
-
- if (CIDFontP->spacerangeP) {
- if (CIDFontP->spacerangeP->next == NULL)
- CIDFontP->spacerangeP->next = spacerangeP;
- else {
- spacerangeP->next = CIDFontP->spacerangeP->next;
- CIDFontP->spacerangeP->next = spacerangeP;
- }
- } else
- CIDFontP->spacerangeP = spacerangeP;
-
- /* read "endcodespacerange" */
- scan_token(inputP);
- if (tokenType != TOKEN_NAME || (tokenType == TOKEN_NAME &&
- (strncmp(tokenStartP,"endcodespacerange",17) != 0))) {
- rc = SCAN_ERROR;
- break;
- }
- }
- if (0 == strncmp(tokenStartP,"begincidrange",13)) {
- CIDFontP->cidrangecnt++;
- cidrangeP = (cidrange *)vm_alloc(sizeof(cidrange));
- if (!cidrangeP) {
- rc = SCAN_OUT_OF_MEMORY;
- break;
- }
- cidrangeP->next = NULL;
- cidrangeP->rangecnt = rangecnt;
- cidrangeP->range =
- (cidrangecode *)vm_alloc(rangecnt*sizeof(cidrangecode));
- if (!cidrangeP->range) {
- rc = SCAN_OUT_OF_MEMORY;
- break;
- }
- for (i = 0; i < rangecnt; i++) {
- scan_token(inputP);
- if (tokenType != TOKEN_HEX_STRING) {
- rc = SCAN_ERROR;
- break;
- }
- cidrangeP->range[i].srcCodeLo = 0;
- for (j = 0; j < tokenLength; j++)
- cidrangeP->range[i].srcCodeLo +=
- (unsigned char)tokenStartP[j] << (8 * (tokenLength - 1 - j));
- char_row = (cidrangeP->range[i].srcCodeLo >> 8) & 0xff;
- char_col = cidrangeP->range[i].srcCodeLo & 0xff;
- if (char_row < CMapP->firstRow)
- CMapP->firstRow = char_row;
- if (char_row > CMapP->lastRow)
- CMapP->lastRow = char_row;
- if (char_col < CMapP->firstCol)
- CMapP->firstCol = char_col;
- if (char_col > CMapP->lastCol)
- CMapP->lastCol = char_col;
- scan_token(inputP);
- if (tokenType != TOKEN_HEX_STRING) {
- rc = SCAN_ERROR;
- break;
- }
- cidrangeP->range[i].srcCodeHi = 0;
- for (j = 0; j < tokenLength; j++)
- cidrangeP->range[i].srcCodeHi +=
- (unsigned char)tokenStartP[j] << (8 * (tokenLength - 1 - j));
- char_row = (cidrangeP->range[i].srcCodeHi >> 8) & 0xff;
- char_col = cidrangeP->range[i].srcCodeHi & 0xff;
- if (char_row < CMapP->firstRow)
- CMapP->firstRow = char_row;
- if (char_row > CMapP->lastRow)
- CMapP->lastRow = char_row;
- if (char_col < CMapP->firstCol)
- CMapP->firstCol = char_col;
- if (char_col > CMapP->lastCol)
- CMapP->lastCol = char_col;
- scan_token(inputP);
- if (tokenType != TOKEN_INTEGER) {
- rc = SCAN_ERROR;
- break;
- }
- cidrangeP->range[i].dstCIDLo = tokenValue.integer;
- }
-
- if (CIDFontP->cidrangeP) {
- if (CIDFontP->cidrangeP->next == NULL)
- CIDFontP->cidrangeP->next = cidrangeP;
- else {
- cidrangeP->next = CIDFontP->cidrangeP->next;
- CIDFontP->cidrangeP->next = cidrangeP;
- }
- } else
- CIDFontP->cidrangeP = cidrangeP;
-
- /* read "endcidrange" */
- scan_token(inputP);
- if (tokenType != TOKEN_NAME || (tokenType == TOKEN_NAME &&
- (strncmp(tokenStartP,"endcidrange",11) != 0))) {
- rc = SCAN_ERROR;
- break;
- }
- }
-
- if (0 == strncmp(tokenStartP,"beginnotdefrange",16)) {
- CIDFontP->notdefrangecnt++;
- notdefrangeP = (cidrange *)vm_alloc(sizeof(cidrange));
- if (!notdefrangeP) {
- rc = SCAN_OUT_OF_MEMORY;
- break;
- }
- notdefrangeP->next = 0;
- notdefrangeP->rangecnt = rangecnt;
- notdefrangeP->range =
- (cidrangecode *)vm_alloc(rangecnt*sizeof(cidrangecode));
- if (!notdefrangeP->range) {
- rc = SCAN_OUT_OF_MEMORY;
- break;
- }
- for (i = 0; i < rangecnt; i++) {
- scan_token(inputP);
- if (tokenType != TOKEN_HEX_STRING) {
- rc = SCAN_ERROR;
- break;
- }
- notdefrangeP->range[i].srcCodeLo = 0;
- for (j = 0; j < tokenLength; j++)
- notdefrangeP->range[i].srcCodeLo = (int)(tokenStartP[j] <<
- (8 * (tokenLength - 1 - j)));
- scan_token(inputP);
- if (tokenType != TOKEN_HEX_STRING) {
- rc = SCAN_ERROR;
- break;
- }
- notdefrangeP->range[i].srcCodeHi = 0;
- for (j = 0; j < tokenLength; j++)
- notdefrangeP->range[i].srcCodeHi = (int)(tokenStartP[j] <<
- (8 * (tokenLength - 1 - j)));
- scan_token(inputP);
- if (tokenType != TOKEN_INTEGER) {
- rc = SCAN_ERROR;
- break;
- }
- notdefrangeP->range[i].dstCIDLo = tokenValue.integer;
- }
- if (CIDFontP->notdefrangeP) {
- if (CIDFontP->notdefrangeP->next == NULL)
- CIDFontP->notdefrangeP->next = notdefrangeP;
- else {
- notdefrangeP->next = CIDFontP->notdefrangeP->next;
- CIDFontP->notdefrangeP->next = notdefrangeP;
- }
- } else
- CIDFontP->notdefrangeP = notdefrangeP;
-
- /* read "endnotdefrange" */
- scan_token(inputP);
- if (tokenType != TOKEN_NAME || (tokenType == TOKEN_NAME &&
- (strncmp(tokenStartP,"endnotdefrange",14) != 0))) {
- rc = SCAN_ERROR;
- break;
- }
- }
-
- if (0 == strncmp(tokenStartP,"endcmap",7)) {
- if (CMapP->CMapInfoP[CMAPREGISTRY].value.data.valueP == NULL ||
- CMapP->CMapInfoP[CMAPORDERING].value.data.valueP == NULL ||
- CMapP->CMapInfoP[CMAPSUPPLEMENT].value.data.integer == -1) {
- rc = SCAN_ERROR;
- break;
- } else {
- rc = SCAN_FILE_EOF;
- break;
- }
- }
- break;
- }
- }
- while (rc == 0);
- fclose(inputP->data.fileP);
- if (tokenTooLong)
- rc = SCAN_OUT_OF_MEMORY;
- if (rc == SCAN_OUT_OF_MEMORY) return(rc);
-
- /* open the specified CIDFont file */
- if (!(fileP = fopen(filename,filetype)))
- return(SCAN_FILE_OPEN_ERROR);
-
- inputP = &inputFile;
- objFormatFile(inputP,fileP);
- CIDWantFontInfo = TRUE;
- TwoSubrs = FALSE;
- rc = BuildCIDFontInfo(CIDFontP);
- if (rc != 0) return(rc);
-
- /* Assume everything will be OK */
- rc = 0;
-
- /* Loop until complete font is read */
- do {
- /* Scan the next token */
- scan_token(inputP);
-
- /* ==> tokenLength, tokenTooLong, tokenType, and tokenValue are */
- /* now set */
-
- switch (tokenType) {
- case TOKEN_EOF:
- case TOKEN_NONE:
- case TOKEN_INVALID:
- /* in this case we are done */
- if (tokenTooLong) return(SCAN_OUT_OF_MEMORY);
- rc = SCAN_ERROR;
- break;
- case TOKEN_LITERAL_NAME:
- /* Look up the name */
- tokenStartP[tokenLength] = '\0';
-
- if (CIDWantFontInfo) {
- rc = FindDictValue(CIDFontP->CIDfontInfoP);
- /* we are not going to report errors except out of memory */
- if (rc != SCAN_OUT_OF_MEMORY)
- rc = SCAN_OK;
- break;
- }
- break;
- case TOKEN_STRING:
- tokenStartP[tokenLength] = '\0';
- if (0 == strncmp(tokenStartP,"Binary",6)) {
- CIDFontP->binarydata = 1;
- scan_token(inputP);
- if (tokenType == TOKEN_INTEGER)
- CIDFontP->bytecnt = tokenValue.integer;
- else {
- rc = SCAN_ERROR;
- break;
- }
- } else if (0 == strncmp(tokenStartP,"Hex",3)) {
- /* not yet supported */
- rc = SCAN_ERROR;
- break;
-#if 0
- /* uncomment when the hex format is supported */
- CIDFontP->binarydata = 0;
- scan_token(inputP);
- if (tokenType == TOKEN_INTEGER)
- CIDFontP->bytecnt = tokenValue.integer;
- else {
- rc = SCAN_ERROR;
- break;
- }
-#endif
- }
- break;
- case TOKEN_NAME:
- /* end of PostScript and beginning of data */
- if (0 == strncmp(tokenStartP,"StartData",9)) {
- /* every CIDFont must have an FDArray */
- /* check whether other required dictionary entries were found */
- if (CIDFontP->CIDfontInfoP[CIDFDARRAY].value.data.arrayP == NULL ||
- CIDFontP->CIDfontInfoP[CIDFONTNAME].value.data.nameP == NULL ||
- CIDFontP->CIDfontInfoP[CIDFONTTYPE].value.data.integer == -1 ||
- CIDFontP->CIDfontInfoP[CIDVERSION].value.data.integer == -1 ||
- CIDFontP->CIDfontInfoP[CIDREGISTRY].value.data.valueP == NULL ||
- CIDFontP->CIDfontInfoP[CIDORDERING].value.data.valueP == NULL ||
- CIDFontP->CIDfontInfoP[CIDSUPPLEMENT].value.data.integer == -1 ||
- CIDFontP->CIDfontInfoP[CIDFONTBBOX].value.data.arrayP == NULL ||
- CIDFontP->CIDfontInfoP[CIDMAPOFFSET].value.data.integer == -1 ||
- CIDFontP->CIDfontInfoP[CIDFDBYTES].value.data.integer == -1 ||
- CIDFontP->CIDfontInfoP[CIDGDBYTES].value.data.integer == -1 ||
- CIDFontP->CIDfontInfoP[CIDCOUNT].value.data.integer == -1) {
- rc = SCAN_ERROR;
- break;
- } else {
- /* do Registry and Ordering entries match? */
- if (strcmp(CIDFontP->CIDfontInfoP[CIDREGISTRY].value.data.valueP,
- CMapP->CMapInfoP[CMAPREGISTRY].value.data.valueP) != 0 ||
- strcmp(CIDFontP->CIDfontInfoP[CIDORDERING].value.data.valueP,
- CMapP->CMapInfoP[CMAPORDERING].value.data.valueP) != 0) {
- rc = SCAN_ERROR;
- break;
- } else {
- fclose(inputP->data.fileP);
- return(SCAN_OK);
- }
- }
- }
- break;
- }
-
- }
- while (rc ==0);
- fclose(inputP->data.fileP);
- if (tokenTooLong) return(SCAN_OUT_OF_MEMORY);
- return(rc);
-}
-
-/*
- * -------------------------------------------------------------------
- * Scan the next token and convert it into an object
- * Result is placed on the Operand Stack as next object
- * -------------------------------------------------------------------
- */
-int
-scan_cidtype1font(psfont *FontP)
-{
- int i;
- int begincnt = 0; /* counter for the number of unpaired begin operators */
- int currentfilefound = 0;
-
- WantFontInfo = TRUE;
- InPrivateDict = FALSE;
- TwoSubrs = FALSE;
- rc = BuildFontInfo(FontP);
- if (rc != 0) return(rc);
-
- /* Assume everything will be OK */
- rc = 0;
- filterFile.data.fileP = NULL;
-
- /* Loop until complete font is read */
- do {
- /* Scan the next token */
- scan_token(inputP);
-
- /* ==> tokenLength, tokenTooLong, tokenType, and tokenValue are */
- /* now set */
-
- switch (tokenType) {
- case TOKEN_EOF:
- case TOKEN_NONE:
- case TOKEN_INVALID:
- /* in this case we are done */
- if (tokenTooLong) return(SCAN_OUT_OF_MEMORY);
- rc = SCAN_ERROR;
- break;
- case TOKEN_LITERAL_NAME:
- /* Look up the name */
- tokenStartP[tokenLength] = '\0';
- if (InPrivateDict ) {
- rc = FindDictValue(FontP->Private);
- /* we are not going to report errors */
- /* Sometimes the font file may test a value such as */
- /* testing to see if the font is alreadly loaded with */
- /* same UniqueID. We would faile on /UniqueID get */
- /* because we are expecting a int to follow UniqueID*/
- /* If the correct object type does not follow a Name*/
- /* then we will skip over it without reporting error except */
- /* out of memory */
- if (rc != SCAN_OUT_OF_MEMORY)
- rc = SCAN_OK;
- break;
- } /* end of reading Private dictionary */
- else
- if (0 == strncmp(tokenStartP,"Private",7) ) {
- InPrivateDict = TRUE;
- rc = BuildCIDType1Private(FontP);
- break;
- }
- else
- if (WantFontInfo) {
- rc = FindDictValue(FontP->fontInfoP);
- /* we are not going to report errors except out of memory */
- if (rc != SCAN_OUT_OF_MEMORY)
- rc = SCAN_OK;
- break;
- }
- break;
- case TOKEN_NAME:
- if (0 == strncmp(tokenStartP,"currentfile",11)) {
- currentfilefound = 1;
- break;
- } else if (0 == strncmp(tokenStartP,"eexec",5)) {
- if (currentfilefound == 1) {
- currentfilefound = 0;
- filterFile.data.fileP = CIDeexec(inputP->data.fileP);
- if (filterFile.data.fileP == NULL) {
- fclose(inputFile.data.fileP);
- return(SCAN_FILE_OPEN_ERROR);
- }
- inputP = &filterFile;
- } else {
- rc = SCAN_ERROR;
- break;
- }
- } else if (0 == strncmp(tokenStartP,"begin",5)) {
- begincnt++;
- currentfilefound = 0;
- } else if (0 == strncmp(tokenStartP,"end",3)) {
- currentfilefound = 0;
- begincnt--;
- if (begincnt == 0) {
- if (filterFile.data.fileP != NULL) {
- scan_token(inputP); /* get 'currentfile' */
- scan_token(inputP); /* get 'closefile' */
- inputP = &inputFile;
- resetDecrypt();
- inputP->data.fileP->b_cnt =
- F_BUFSIZ - (inputP->data.fileP->b_ptr -
- inputP->data.fileP->b_base);
- if (inputP->data.fileP->b_cnt > 0) {
- for (i = 0; i < inputP->data.fileP->b_cnt; i++)
- if (*(inputP->data.fileP->b_ptr + i) == '%')
- break;
- if (i < inputP->data.fileP->b_cnt) {
- inputP->data.fileP->b_cnt -= i;
- inputP->data.fileP->b_ptr += i;
- } else
- inputP->data.fileP->b_cnt = 0;
- }
- }
- rc = SCAN_OK;
- return(rc);
- }
- if (begincnt < 0) {
- rc = SCAN_ERROR;
- break;
- }
- }
- break;
- }
-
- }
- while (rc == 0);
- if (tokenTooLong) return(SCAN_OUT_OF_MEMORY);
- return(rc);
-}
-#endif
-
/*
* -------------------------------------------------------------------
* Scan the next token and convert it into an object
diff --git a/src/Type1/t1funcs.c b/src/Type1/t1funcs.c
index 9de819a..1f78b94 100644
--- a/src/Type1/t1funcs.c
+++ b/src/Type1/t1funcs.c
@@ -54,23 +54,6 @@
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* Copyright (c) 1994-1999 Silicon Graphics, Inc. All Rights Reserved.
- *
- * The contents of this file are subject to the CID Font Code Public Licence
- * Version 1.0 (the "License"). You may not use this file except in compliance
- * with the Licence. You may obtain a copy of the License at Silicon Graphics,
- * Inc., attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA
- * 94043 or at http://www.sgi.com/software/opensource/cid/license.html.
- *
- * Software distributed under the License is distributed on an "AS IS" basis.
- * ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
- * WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF
- * NON-INFRINGEMENT. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * The Original Software is CID font code that was developed by Silicon
- * Graphics, Inc.
- */
/* $XFree86: xc/lib/font/Type1/t1funcs.c,v 3.33 2003/07/19 13:16:40 tsi Exp $ */
/*
@@ -104,17 +87,9 @@ from The Open Group.
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#ifdef BUILDCID
-#define XFONT_CID 1
-#endif
#ifndef FONTMODULE
#include <string.h>
-#if XFONT_CID
-#include <stdlib.h>
-#include <sys/types.h>
-#include <dirent.h>
-#endif
#ifdef _XOPEN_SOURCE
#include <math.h>
#else
@@ -143,10 +118,6 @@ from The Open Group.
#include <X11/fonts/fontenc.h>
#include "t1unicode.h"
-#if XFONT_CID
-#include "range.h"
-#endif
-
#include "objects.h"
#include "spaces.h"
#include "paths.h"
@@ -161,12 +132,6 @@ static int Type1GetGlyphs ( FontPtr pFont, unsigned long count,
unsigned char *chars, FontEncoding charEncoding,
unsigned long *glyphCount, CharInfoPtr *glyphs );
-#if XFONT_CID
-#define CMapDir "/CMap/"
-#define CFMDir "/CFM/"
-#define CIDFontDir "/CIDFont/"
-#endif
-
static int Type1GetMetrics ( FontPtr pFont, unsigned long count,
unsigned char *chars,
FontEncoding charEncoding,
@@ -182,317 +147,9 @@ static void fillrun ( char *p, pel x0, pel x1, int bit );
extern psfont *FontP;
extern psobj *ISOLatin1EncArrayP;
-#if XFONT_CID
-extern char CurCIDFontName[];
-extern char CurCMapName[];
-
-static CharInfoPtr CIDGetGlyph ( FontPtr pFont, unsigned int charcode,
- CharInfoPtr pci );
-
-extern cidfont *CIDFontP;
-extern cmapres *CMapP;
-#endif
-
static void fill ( char *dest, int h, int w, struct region *area, int byte,
int bit, int wordsize );
-#if XFONT_CID
-int
-CIDOpenScalable (FontPathElementPtr fpe,
- FontPtr *ppFont,
- int flags,
- FontEntryPtr entry,
- char *fileName,
- FontScalablePtr vals,
- fsBitmapFormat format,
- fsBitmapFormatMask fmask,
- FontPtr non_cachable_font) /* We don't do licensing */
-{
- FontPtr pFont;
- int bit,
- byte,
- glyph,
- scan,
- image;
- long *pool; /* memory pool for ximager objects */
- int size; /* for memory size calculations */
- struct XYspace *S; /* coordinate space for character */
- register int i;
- int nchars, len, rc;
- cidglyphs *cid;
- char *p;
- double t1 = .001, t2 = 0.0, t3 = 0.0, t4 = .001;
- double sxmult;
- char CIDFontName[CID_NAME_MAX];
- char CMapName[CID_NAME_MAX];
- char cidfontname[CID_PATH_MAX];
- char cmapname[CID_PATH_MAX];
- char *path;
- char cidfontpath[CID_PATH_MAX];
- char cmappath[CID_PATH_MAX];
-#if defined(HAVE_CFM) || defined(CID_ALL_CHARS)
- char cfmdir[CID_PATH_MAX];
- char cfmfilename[CID_NAME_MAX];
-#endif
-#if defined(CID_ALL_CHARS)
- char *cf;
-#else
- long sAscent, sDescent;
-#endif
-
- /* check the font name */
- len = strlen(fileName);
- if (len <= 0 || len > CID_NAME_MAX - 1)
- return BadFontName;
-
-#if defined(HAVE_CFM) || defined(CID_ALL_CHARS)
- strcpy(cfmdir, fileName);
- p = strrchr(cfmdir, '/');
- if (p) *p = '\0';
-#endif
-
- path = fileName;
- if (!(fileName = strrchr(fileName, '/')))
- return BadFontName;
-
- len = fileName - path;
- strncpy(cidfontpath, path, len);
- cidfontpath[len] = '\0';
- strcpy(cmappath, cidfontpath);
- strcat(cmappath, CMapDir);
-#ifdef HAVE_CFM
- strcpy(cfmdir, cidfontpath);
- strcat(cfmdir, CFMDir);
-#endif
- strcat(cidfontpath, CIDFontDir);
-
- fileName++;
-
- /* extract the CIDFontName and CMapName from the font name */
- /* check for <CIDFontName>--<CMapName> */
- if ((p = strstr(fileName, "--"))) {
- if (p == fileName)
- return BadFontName;
- else {
- strcpy(CIDFontName, fileName);
- CIDFontName[p - fileName] = '\0';
- p += 2;
- i = 0;
- while (*p && *p != '.')
- CMapName[i++] = *p++;
- CMapName[i] = '\0';
- if ((len = strlen(CMapName)) <= 0)
- return BadFontName;
- }
- } else
- return BadFontName;
-
- /* The CMap files whose names end with -V are not yet supported */
- len = strlen(CMapName);
- if ((len >= 2 && CMapName[len - 2] == '-' && CMapName[len - 1] == 'V') ||
- (len == 1 && CMapName[len - 1] == 'V'))
- return BadFontName;
-
- /* Reject ridiculously small font sizes that will blow up the math */
- if (hypot(vals->pixel_matrix[0], vals->pixel_matrix[1]) < 1.0 ||
- hypot(vals->pixel_matrix[2], vals->pixel_matrix[3]) < 1.0)
- return BadFontName;
-
-#ifdef CID_ALL_CHARS
- if ((cf = getenv("CFMDIR")) == NULL)
- strcat(cfmdir, CFMDir);
- else {
- strcpy(cfmdir, cf);
- strcat(cfmdir, "/");
- }
-#endif
-
-#if defined(HAVE_CFM) || defined(CID_ALL_CHARS)
- strcpy(cfmfilename, cfmdir);
- strcat(cfmfilename, CIDFontName);
- strcat(cfmfilename, "--");
- strcat(cfmfilename, CMapName);
- strcat(cfmfilename, ".cfm");
-#endif
-
- /* create a full-path name for a CIDFont file */
- if (strlen(cidfontpath) + strlen(CIDFontName) + 2 >
- CID_PATH_MAX)
- return BadFontName;
- strcpy(cidfontname, cidfontpath);
- strcat(cidfontname, CIDFontName);
-
- /* create a full-path name for a CMap file */
- if (strlen(cmappath) + strlen(CMapName) + 2 > CID_PATH_MAX)
- return BadFontName;
- strcpy(cmapname, cmappath);
- strcat(cmapname, CMapName);
-
- /* set up default values */
- FontDefaultFormat(&bit, &byte, &glyph, &scan);
- /* get any changes made from above */
- rc = CheckFSFormat(format, fmask, &bit, &byte, &scan, &glyph, &image);
- if (rc != Successful)
- return rc;
-
-#define PAD(bits, pad) (((bits)+(pad)-1)&-(pad))
-
- if (!(pFont = CreateFontRec()))
- return AllocError;
-
- cid = (cidglyphs *)xalloc(sizeof(cidglyphs));
- if (cid == NULL) {
- DestroyFontRec(pFont);
- return AllocError;
- }
- bzero(cid, sizeof(cidglyphs));
-
- /* heuristic for "maximum" size of pool we'll need: */
- size = 200000 + 600 *
- (int)hypot(vals->pixel_matrix[2], vals->pixel_matrix[3])
- * sizeof(short);
- if (size < 0 || NULL == (pool = (long *) xalloc(size))) {
- xfree(cid);
- DestroyFontRec(pFont);
- return AllocError;
- }
-
- addmemory(pool, size);
-
- /* load font if not already loaded */
- if (!CIDfontfcnA(cidfontname, cmapname, &rc)) {
- FontP = NULL;
- delmemory();
- xfree(pool);
- xfree(cid);
- DestroyFontRec(pFont);
- return Type1ReturnCodeToXReturnCode(rc);
- }
-
- FontP = NULL;
-
- S = (struct XYspace *) t1_Transform((struct xobject *)IDENTITY,
- t1, t2, t3, t4);
-
- S = (struct XYspace *) Permanent(t1_Transform((struct xobject *)S,
- vals->pixel_matrix[0],
- -vals->pixel_matrix[1],
- vals->pixel_matrix[2],
- -vals->pixel_matrix[3]));
-
- /* multiplier for computation of raw values */
- sxmult = hypot(vals->pixel_matrix[0], vals->pixel_matrix[1]);
- if (sxmult > EPS) sxmult = 1000.0 / sxmult;
-
- pFont->info.firstRow = CMapP->firstRow;
- pFont->info.firstCol = CMapP->firstCol;
- pFont->info.lastRow = CMapP->lastRow;
- pFont->info.lastCol = CMapP->lastCol;
-
- nchars = (pFont->info.lastRow - pFont->info.firstRow + 1) *
- (pFont->info.lastCol - pFont->info.firstCol + 1);
-
- delmemory();
- xfree(pool);
-
- if (pFont->info.firstCol > pFont->info.lastCol)
- {
- xfree(cid);
- DestroyFontRec(pFont);
- return BadFontName;
- }
-
- cid->glyphs = (CharInfoRec **)xalloc(nchars*sizeof(CharInfoRec *));
- if (cid->glyphs == NULL) {
- xfree(cid);
- DestroyFontRec(pFont);
- return AllocError;
- }
- bzero(cid->glyphs, nchars*sizeof(CharInfoRec *));
-
- pFont->info.defaultCh = 0;
- pFont->format = format;
-
- pFont->bit = bit;
- pFont->byte = byte;
- pFont->glyph = glyph;
- pFont->scan = scan;
-
- pFont->get_metrics = CIDGetMetrics;
- pFont->get_glyphs = CIDGetGlyphs;
- pFont->unload_font = CIDCloseFont;
- pFont->unload_glyphs = NULL;
- pFont->refcnt = 0;
-
- len = strlen(cidfontname);
- cid->CIDFontName = (char *)xalloc(len + 1);
- if (cid->CIDFontName == NULL) {
- xfree(cid->glyphs);
- xfree(cid);
- DestroyFontRec(pFont);
- return AllocError;
- }
- strcpy(cid->CIDFontName, cidfontname);
-
- len = strlen(cmapname);
- cid->CMapName = (char *)xalloc(len + 1);
- if (cid->CMapName == NULL) {
- xfree(cid->CIDFontName);
- xfree(cid->glyphs);
- xfree(cid);
- DestroyFontRec(pFont);
- return AllocError;
- }
- strcpy(cid->CMapName, cmapname);
-
- cid->pixel_matrix[0] = vals->pixel_matrix[0];
- cid->pixel_matrix[1] = vals->pixel_matrix[1];
- cid->pixel_matrix[2] = vals->pixel_matrix[2];
- cid->pixel_matrix[3] = vals->pixel_matrix[3];
-
- pFont->fontPrivate = (unsigned char *)cid;
-
- pFont->info.fontAscent =
- (CIDFontP->CIDfontInfoP[CIDFONTBBOX].value.data.arrayP[3].data.integer *
- vals->pixel_matrix[3] +
- (CIDFontP->CIDfontInfoP[CIDFONTBBOX].value.data.arrayP[3].data.integer >
- 0 ? 500 : -500)) / 1000;
-
- pFont->info.fontDescent =
- -(int)((double)CIDFontP->CIDfontInfoP[CIDFONTBBOX].value.data.arrayP[1].data.integer
- * vals->pixel_matrix[3] +
- (CIDFontP->CIDfontInfoP[CIDFONTBBOX].value.data.arrayP[1].data.integer >
- 0 ? 500 : -500)) / 1000;
-
- /* Adobe does not put isFixedPitch entries in CID-keyed fonts. */
- /* CID-keyed are not constant-width fonts. */
- pFont->info.constantWidth = 0;
-
-#ifndef CID_ALL_CHARS
- sAscent = CIDFontP->CIDfontInfoP[CIDFONTBBOX].value.data.arrayP[3].data.integer;
- sDescent = -CIDFontP->CIDfontInfoP[CIDFONTBBOX].value.data.arrayP[1].data.integer;
-#endif
-
- if (strncmp(entry->name.name, "-bogus", 6)) {
-#ifdef CID_ALL_CHARS
- ComputeBoundsAllChars(pFont, cfmfilename, sxmult);
-#else
-#ifdef HAVE_CFM
- CIDFillFontInfo(pFont, vals, cidfontname, entry->name.name, cmapname,
- cfmfilename, sAscent, sDescent, sxmult);
-#else
- CIDFillFontInfo(pFont, vals, cidfontname, entry->name.name, cmapname,
- sAscent, sDescent, sxmult);
-#endif /* HAVE_CFM */
-#endif /* CID_ALL_CHARS */
- }
-
- *ppFont = pFont;
-
- return Successful;
-}
-#endif
-
/*ARGSUSED*/
int
Type1OpenScalable (FontPathElementPtr fpe,
@@ -556,11 +213,7 @@ Type1OpenScalable (FontPathElementPtr fpe,
bzero(type1, sizeof(struct type1font));
/* heuristic for "maximum" size of pool we'll need: */
-#if XFONT_CID
- size = 400000 + 600 *
-#else
size = 200000 + 600 *
-#endif
(int)hypot(vals->pixel_matrix[2], vals->pixel_matrix[3])
* sizeof(short);
if (size < 0 || NULL == (pool = (long *) xalloc(size))) {
@@ -824,273 +477,6 @@ Type1OpenScalable (FontPathElementPtr fpe,
return Successful;
}
-#if XFONT_CID
-unsigned int
-getCID(FontPtr pFont, unsigned int charcode)
-{
- unsigned int cidcode = 0;
- Bool charvalid = FALSE;
- cidglyphs *cid;
- int i, j;
- unsigned int char_row, char_col, rangelo_row, rangelo_col, k;
- unsigned int rangehi_row, rangehi_col;
- spacerange *spacerangeP;
- cidrange *notdefrangeP, *cidrangeP;
-
- cid = (cidglyphs *)pFont->fontPrivate;
-
- if (cid == NULL)
- return cidcode;
-
- char_row = (charcode >> 8) & 0xff;
- char_col = charcode & 0xff;
-
- spacerangeP = CIDFontP->spacerangeP;
- for (i = 0; i < CIDFontP->spacerangecnt; i++) {
- for (j = 0; j < spacerangeP->rangecnt; j++) {
- rangelo_row =
- (spacerangeP->spacecode[j].srcCodeLo >> 8) & 0xff;
- rangelo_col = spacerangeP->spacecode[j].srcCodeLo & 0xff;
- rangehi_row =
- (spacerangeP->spacecode[j].srcCodeHi >> 8) & 0xff;
- rangehi_col = spacerangeP->spacecode[j].srcCodeHi & 0xff;
- if (char_row >= rangelo_row && char_row <= rangehi_row &&
- char_col >= rangelo_col && char_col <= rangehi_col) {
- charvalid = TRUE;
- break;
- }
- }
- if (charvalid) break;
- spacerangeP = spacerangeP->next;
- }
-
- if (charvalid) {
- charvalid = FALSE;
- cidrangeP = CIDFontP->cidrangeP;
- for (i = 0; i < CIDFontP->cidrangecnt; i++) {
- for (j = 0; j < cidrangeP->rangecnt; j++) {
- rangelo_row =
- (cidrangeP->range[j].srcCodeLo >> 8) & 0xff;
- rangelo_col = cidrangeP->range[j].srcCodeLo & 0xff;
- rangehi_row =
- (cidrangeP->range[j].srcCodeHi >> 8) & 0xff;
- rangehi_col = cidrangeP->range[j].srcCodeHi & 0xff;
- if (char_row >= rangelo_row && char_row <= rangehi_row &&
- char_col >= rangelo_col && char_col <= rangehi_col) {
- charvalid = TRUE;
- for (k = cidrangeP->range[j].srcCodeLo;
- k <= cidrangeP->range[j].srcCodeHi; k++) {
- if (k == charcode)
- cidcode = cidrangeP->range[j].dstCIDLo + k -
- cidrangeP->range[j].srcCodeLo;
- }
- break;
- }
- }
- if (charvalid) break;
- cidrangeP = cidrangeP->next;
- }
- }
-
- if (charvalid) {
- charvalid = FALSE;
- notdefrangeP = CIDFontP->notdefrangeP;
- for (i = 0; i < CIDFontP->notdefrangecnt; i++) {
- for (j = 0; j < notdefrangeP->rangecnt; j++) {
- rangelo_row =
- (notdefrangeP->range[j].srcCodeLo >> 8) & 0xff;
- rangelo_col = notdefrangeP->range[j].srcCodeLo & 0xff;
- rangehi_row =
- (notdefrangeP->range[j].srcCodeHi >> 8) & 0xff;
- rangehi_col = notdefrangeP->range[j].srcCodeHi & 0xff;
- if (char_row >= rangelo_row && char_row <= rangehi_row &&
- char_col >= rangelo_col && char_col <= rangehi_col) {
- charvalid = TRUE;
- for (k = notdefrangeP->range[j].srcCodeLo;
- k <= notdefrangeP->range[j].srcCodeHi; k++) {
- if (k == charcode)
- /* the whole range is mapped to a single CID code */
- cidcode = notdefrangeP->range[j].dstCIDLo;
- }
- break;
- }
- }
- if (charvalid) break;
- notdefrangeP = notdefrangeP->next;
- }
- }
-
- /* If you specify a CMap that has more CIDs than a specified CIDFont, */
- /* the program could go beyond the number of entries in CIDMap. Make */
- /* sure that that does not happen. */
- if (cidcode < CIDFontP->CIDfontInfoP[CIDCOUNT].value.data.integer)
- return cidcode;
- else
- return 0;
-}
-
-static CharInfoPtr
-CIDGetGlyph(FontPtr pFont, unsigned int charcode, CharInfoPtr pci)
-{
- int rc;
- CharInfoPtr cp = NULL;
- unsigned int cidcode;
-
- /* character code -> CID */
- cidcode = getCID(pFont, charcode);
-
- cp = CIDGetGlyphInfo(pFont, cidcode, pci, &rc);
-
- if (rc != Successful && cidcode) {
- cidcode = 0;
- cp = CIDGetGlyphInfo(pFont, cidcode, pci, &rc);
- }
-
- return cp;
-}
-
-int
-CIDGetGlyphs(FontPtr pFont,
- unsigned long count,
- unsigned char *chars,
- FontEncoding charEncoding,
- unsigned long *glyphCount, /* RETURN */
- CharInfoPtr *glyphs) /* RETURN */
-{
- unsigned int code, char_row, char_col;
- CharInfoPtr *glyphsBase;
- register unsigned int c;
- CharInfoPtr pci;
- CharInfoPtr pDefault;
- cidglyphs *cid;
- register int firstCol;
- int rc = 0;
- int cid_valid = 0;
-
- cid = (cidglyphs *)pFont->fontPrivate;
-
- FontP = NULL;
-
- firstCol = pFont->info.firstCol;
- pDefault = cid->pDefault;
- glyphsBase = glyphs;
-
- switch (charEncoding) {
-
-#define EXIST(pci) \
- ((pci)->metrics.attributes || \
- (pci)->metrics.ascent != -(pci)->metrics.descent || \
- (pci)->metrics.leftSideBearing != (pci)->metrics.rightSideBearing)
-
- case Linear8Bit:
- case TwoD8Bit:
- if (pFont->info.firstRow > 0)
- break;
- while (count--) {
- c = (*chars++);
- if (c >= firstCol && c <= pFont->info.lastCol) {
- code = c - firstCol;
- if (!(pci = (CharInfoRec *)cid->glyphs[code]) ||
- ((long)pci->bits == CID_BITMAP_UNDEFINED)) {
- /* load font if not already loaded */
- if(!cid_valid) {
- if(!CIDfontfcnA(cid->CIDFontName, cid->CMapName, &rc)) { FontP = NULL;
- return Type1ReturnCodeToXReturnCode(rc);
- }
- cid_valid = 1;
- }
- pci = CIDGetGlyph(pFont, c, pci);
- }
- if (pci && EXIST(pci)) {
- *glyphs++ = pci;
- cid->glyphs[code] = pci;
- } else if (pDefault) {
- *glyphs++ = pDefault;
- cid->glyphs[code] = pDefault;
- }
- } else if (pDefault)
- *glyphs++ = pDefault;
- }
- break;
- case Linear16Bit:
- while (count--) {
- char_row = *chars++;
- char_col = *chars++;
- c = char_row << 8;
- c = (c | char_col);
- if (pFont->info.firstRow <= char_row && char_row <=
- pFont->info.lastRow && pFont->info.firstCol <= char_col &&
- char_col <= pFont->info.lastCol) {
- code = pFont->info.lastCol - pFont->info.firstCol + 1;
- char_row = char_row - pFont->info.firstRow;
- char_col = char_col - pFont->info.firstCol;
- code = char_row * code + char_col;
- if (!(pci = (CharInfoRec *)cid->glyphs[code]) ||
- ((long)pci->bits == CID_BITMAP_UNDEFINED)) {
- /* load font if not already loaded */
- if(!cid_valid) {
- if(!CIDfontfcnA(cid->CIDFontName, cid->CMapName, &rc)) { FontP = NULL;
- return Type1ReturnCodeToXReturnCode(rc);
- }
- cid_valid = 1;
- }
- pci = CIDGetGlyph(pFont, c, pci);
- }
- if (pci && EXIST(pci)) {
- *glyphs++ = pci;
- cid->glyphs[code] = pci;
- } else if (pDefault) {
- *glyphs++ = pDefault;
- cid->glyphs[code] = pDefault;
- }
- } else if (pDefault)
- *glyphs++ = pDefault;
- }
- break;
-
- case TwoD16Bit:
- while (count--) {
- char_row = (*chars++);
- char_col = (*chars++);
- c = char_row << 8;
- c = (c | char_col);
- if (pFont->info.firstRow <= char_row && char_row <=
- pFont->info.lastRow && pFont->info.firstCol <= char_col &&
- char_col <= pFont->info.lastCol) {
- code = pFont->info.lastCol - pFont->info.firstCol + 1;
- char_row = char_row - pFont->info.firstRow;
- char_col = char_col - pFont->info.firstCol;
- code = char_row * code + char_col;
- if (!(pci = (CharInfoRec *)cid->glyphs[code]) ||
- ((long)pci->bits == CID_BITMAP_UNDEFINED)) {
- /* load font if not already loaded */
- if(!cid_valid) {
- if(!CIDfontfcnA(cid->CIDFontName, cid->CMapName, &rc)) { FontP = NULL;
- return Type1ReturnCodeToXReturnCode(rc);
- }
- cid_valid = 1;
- }
- pci = CIDGetGlyph(pFont, c, pci);
- }
- if (pci && EXIST(pci)) {
- *glyphs++ = pci;
- cid->glyphs[code] = pci;
- } else if (pDefault) {
- *glyphs++ = pDefault;
- cid->glyphs[code] = pDefault;
- }
- } else if (pDefault)
- *glyphs++ = pDefault;
- }
- break;
- }
- *glyphCount = glyphs - glyphsBase;
- return Successful;
-
-#undef EXIST
-}
-#endif
-
static int
Type1GetGlyphs(FontPtr pFont,
unsigned long count,
@@ -1169,59 +555,6 @@ Type1GetGlyphs(FontPtr pFont,
#undef EXIST
}
-#if XFONT_CID
-static CharInfoRec nonExistantChar;
-
-int
-CIDGetMetrics(FontPtr pFont,
- unsigned long count,
- unsigned char *chars,
- FontEncoding charEncoding,
- unsigned long *glyphCount, /* RETURN */
- xCharInfo **glyphs) /* RETURN */
-{
- int ret;
- cidglyphs *cid;
- CharInfoPtr oldDefault;
- char cidafmname[CID_PATH_MAX];
- char CIDFontName[CID_NAME_MAX];
- char *ptr;
-
- cid = (cidglyphs *)pFont->fontPrivate;
-
- strcpy(cidafmname, cid->CIDFontName);
- if (!(ptr = strrchr(cidafmname, '/')))
- return BadFontName;
-
- *ptr = '\0';
-
- strcpy(CIDFontName, ptr + 1);
-
- if (!(ptr = strrchr(cidafmname, '/')))
- return BadFontName;
-
- *ptr = '\0';
-
- strcat(cidafmname, "/AFM/");
- strcat(cidafmname, CIDFontName);
-
- strcat(cidafmname, ".afm");
-
- oldDefault = cid->pDefault;
- cid->pDefault = &nonExistantChar;
-
- ret = CIDGetAFM(pFont, count, chars, charEncoding, glyphCount, (CharInfoPtr
-*)glyphs, cidafmname);
- if (ret != Successful)
- ret = CIDGetGlyphs(pFont, count, chars, charEncoding, glyphCount,
- (CharInfoPtr *)glyphs);
-
- *ptr = 0;
- cid->pDefault = oldDefault;
- return ret;
-}
-#endif
-
static int
Type1GetMetrics(FontPtr pFont,
unsigned long count,
@@ -1244,66 +577,6 @@ Type1GetMetrics(FontPtr pFont,
return ret;
}
-#if XFONT_CID
-void
-CIDCloseFont(FontPtr pFont)
-{
- register int i;
- cidglyphs *cid;
- int nchars;
-
- if (pFont) {
-
- cid = (cidglyphs *)pFont->fontPrivate;
-
- if (cid) {
-
- if (cid->CIDFontName && !strcmp(cid->CIDFontName, CurCIDFontName)
- && cid->CMapName && !strcmp(cid->CMapName, CurCMapName)){
- strcpy(CurCIDFontName, ""); /* initialize to none */
- strcpy(CurCMapName, ""); /* initialize to none */
- }
-
- if (cid->CIDFontName)
- xfree(cid->CIDFontName);
-
- if (cid->CMapName)
- xfree(cid->CMapName);
-
- nchars = (pFont->info.lastRow - pFont->info.firstRow + 1) *
- (pFont->info.lastCol - pFont->info.firstCol + 1);
-
- for (i = 0; i < nchars; i++) {
- if (cid->glyphs[i] && (cid->glyphs[i] != &nonExistantChar)) {
- if (cid->glyphs[i]->bits)
- xfree(cid->glyphs[i]->bits);
- xfree(cid->glyphs[i]);
- }
- }
-
- if (cid->glyphs)
- xfree(cid->glyphs);
-
- if (cid->AFMinfo)
- xfree(cid->AFMinfo);
-#ifdef USE_MMAP
- if (cid->CIDdata)
- munmap(cid->CIDdata, cid->CIDsize);
-#endif
- xfree(cid);
- }
-
- if (pFont->info.props)
- xfree(pFont->info.props);
-
- if (pFont->info.isStringProp)
- xfree(pFont->info.isStringProp);
-
- DestroyFontRec(pFont);
- }
-}
-#endif
-
void
Type1CloseFont(FontPtr pFont)
{
@@ -1438,50 +711,21 @@ fillrun(char *p, /* address of this scan line */
#define CAPABILITIES (CAP_MATRIX | CAP_CHARSUBSETTING)
-#if XFONT_CID
-FontRendererRec CIDRendererInfo[] = {
- { ".cid", 4, NULL, CIDOpenScalable,
- NULL, CIDGetInfoScalable, 0, CAPABILITIES }
-};
-#endif
-
-#if XFONT_CID
-FontRendererRec Type1RendererInfo[] = {
-#else
static FontRendererRec renderers[] = {
-#endif
{ ".pfa", 4, NULL, Type1OpenScalable,
NULL, Type1GetInfoScalable, 0, CAPABILITIES },
{ ".pfb", 4, NULL, Type1OpenScalable,
NULL, Type1GetInfoScalable, 0, CAPABILITIES }
};
-#if XFONT_CID
-void
-CIDRegisterFontFileFunctions(void)
-{
- int i;
-
- Type1InitStdProps();
- for (i=0; i < sizeof(CIDRendererInfo) / sizeof(FontRendererRec); i++)
- FontFileRegisterRenderer(&CIDRendererInfo[i]);
-}
-#endif
-
void
Type1RegisterFontFileFunctions(void)
{
int i;
-#if XFONT_CID
- Type1InitStdProps();
- for (i=0; i < sizeof(Type1RendererInfo) / sizeof(FontRendererRec); i++)
- FontFilePriorityRegisterRenderer(&Type1RendererInfo[i], -10);
-#else
T1InitStdProps();
for (i=0; i < sizeof(renderers) / sizeof(FontRendererRec); i++)
FontFilePriorityRegisterRenderer(&renderers[i], -10);
-#endif
}
int
@@ -1504,165 +748,7 @@ Type1ReturnCodeToXReturnCode(int rc)
/* fall through */
default:
/* this should not happen */
-#if XFONT_CID
- ErrorF("Font return code cannot be converted to X return code: %d\n", rc);
-#else
ErrorF("Type1 return code not convertable to X return code: %d\n", rc);
-#endif
return rc;
}
}
-
-#if XFONT_CID
-CharInfoPtr
-CIDRenderGlyph(FontPtr pFont, psobj *charstringP, psobj *subarrayP,
- struct blues_struct *bluesP, CharInfoPtr pci, int *mode)
-{
- int bit,
- byte,
- glyph,
- scan,
- image;
- int pad,wordsize; /* scan & image in bits */
- long *pool; /* memory pool for ximager objects */
- int size; /* for memory size calculations */
- struct XYspace *S; /* coordinate space for character */
- struct region *area;
- CharInfoRec *glyphs;
- int len, rc;
- long x0;
- double x1, y1, t1 = .001, t2 = 0.0, t3 = 0.0, t4 = .001;
- double sxmult;
- long h,w;
- long paddedW;
- cidglyphs *cid;
- fsBitmapFormat format = 0;
- fsBitmapFormatMask fmask = 0;
-
- cid = (cidglyphs *)pFont->fontPrivate;
-
- /* set up default values */
- FontDefaultFormat(&bit, &byte, &glyph, &scan);
- /* get any changes made from above */
- rc = CheckFSFormat(format, fmask, &bit, &byte, &scan, &glyph, &image);
- if (rc != Successful) {
- *mode = rc;
- return(NULL);
- }
-
- pad = glyph * 8;
- wordsize = scan * 8;
-
-#define PAD(bits, pad) (((bits)+(pad)-1)&-(pad))
-
- /* heuristic for "maximum" size of pool we'll need: */
- size = 200000 + 600 *
- (int)hypot(cid->pixel_matrix[2], cid->pixel_matrix[3])
- * sizeof(short);
- if (size < 0 || NULL == (pool = (long *) xalloc(size))) {
- *mode = AllocError;
- return(NULL);
- }
-
- addmemory(pool, size);
-
- if (pci && (long)pci->bits == CID_BITMAP_UNDEFINED)
- glyphs = pci;
- else {
- if (!(glyphs = (CharInfoRec *)xalloc(sizeof(CharInfoRec)))) {
- delmemory();
- xfree(pool);
- *mode = AllocError;
- return(NULL);
- }
- bzero(glyphs, sizeof(CharInfoRec));
- }
-
- S = (struct XYspace *) t1_Transform((struct xobject *)IDENTITY,
- t1, t2, t3, t4);
-
- S = (struct XYspace *) Permanent(t1_Transform((struct xobject *)S,
- cid->pixel_matrix[0],
- -cid->pixel_matrix[1],
- cid->pixel_matrix[2],
- -cid->pixel_matrix[3]));
-
- /* multiplier for computation of raw values */
- sxmult = hypot(cid->pixel_matrix[0], cid->pixel_matrix[1]);
- if (sxmult > EPS) sxmult = 1000.0 / sxmult;
-
- rc = 0;
- area = (struct region *)CIDfontfcnC(S, charstringP, subarrayP, bluesP,
- &len, &rc);
- if (rc < 0 || area == NULL) {
- delmemory();
- xfree(pool);
- if (pci != glyphs) xfree(glyphs);
- *mode = Type1ReturnCodeToXReturnCode(rc);
- return(NULL);
- }
-
- h = area->ymax - area->ymin;
- w = area->xmax - area->xmin;
- paddedW = PAD(w, pad);
-
- if (h > 0 && w > 0) {
- size = h * paddedW / 8;
- glyphs[0].bits = (char *)xalloc(size);
- if (glyphs[0].bits == NULL) {
- Destroy(area);
- delmemory();
- xfree(pool);
- if (pci != glyphs) xfree(glyphs);
- *mode = AllocError;
- return(NULL);
- }
- bzero(glyphs[0].bits, size);
- }
- else {
- size = 0;
- h = w = 0;
- area->xmin = area->xmax = 0;
- area->ymax = area->ymax = 0;
- glyphs[0].bits = NULL;
- }
-
- glyphs[0].metrics.leftSideBearing = area->xmin;
- x1 = (double)(x0 = area->ending.x - area->origin.x);
- y1 = (double)(area->ending.y - area->origin.y);
- glyphs[0].metrics.characterWidth =
- (x0 + (x0 > 0 ? FPHALF : -FPHALF)) / (1 << FRACTBITS);
- if (!glyphs[0].metrics.characterWidth && size == 0)
- {
- /* Zero size and zero extents: presumably caused by
- the choice of transformation. Let's create a
- small bitmap so we're not mistaken for an undefined
- character. */
- h = w = 1;
- size = paddedW = PAD(w, pad);
- glyphs[0].bits = (char *)xalloc(size);
- if (glyphs[0].bits == NULL) {
- Destroy(area);
- delmemory();
- xfree(pool);
- if (pci != glyphs) xfree(glyphs);
- *mode = AllocError;
- return(NULL);
- }
- bzero(glyphs[0].bits, size);
- }
- glyphs[0].metrics.attributes =
- NEARESTPEL((long)(hypot(x1, y1) * sxmult));
- glyphs[0].metrics.rightSideBearing = w + area->xmin;
- glyphs[0].metrics.descent = area->ymax - NEARESTPEL(area->origin.y);
- glyphs[0].metrics.ascent = h - glyphs[0].metrics.descent;
-
- if (h > 0 && w > 0)
- fill(glyphs[0].bits, h, paddedW, area, byte, bit, wordsize);
- Destroy(area);
- delmemory();
- xfree(pool);
- *mode = Successful;
- return(glyphs);
-}
-#endif
diff --git a/src/Type1/t1info.c b/src/Type1/t1info.c
index 322572e..ec8ac90 100644
--- a/src/Type1/t1info.c
+++ b/src/Type1/t1info.c
@@ -82,71 +82,23 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
-/* Copyright (c) 1994-1999 Silicon Graphics, Inc. All Rights Reserved.
- *
- * The contents of this file are subject to the CID Font Code Public Licence
- * Version 1.0 (the "License"). You may not use this file except in compliance
- * with the Licence. You may obtain a copy of the License at Silicon Graphics,
- * Inc., attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA
- * 94043 or at http://www.sgi.com/software/opensource/cid/license.html.
- *
- * Software distributed under the License is distributed on an "AS IS" basis.
- * ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
- * WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF
- * NON-INFRINGEMENT. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * The Original Software is CID font code that was developed by Silicon
- * Graphics, Inc.
- */
/* $XFree86: xc/lib/font/Type1/t1info.c,v 1.18tsi Exp $ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#ifdef BUILDCID
-#define XFONT_CID 1
-#endif
#include <X11/fonts/fntfilst.h>
#include <X11/fonts/fontutil.h>
#ifndef FONTMODULE
#include <stdio.h>
-#ifndef BUILDCID
-#include <math.h>
-#endif
#else
#include "xf86_ansic.h"
#endif
#include <X11/fonts/FSproto.h>
-#if XFONT_CID
-#ifndef FONTMODULE
-#ifdef _XOPEN_SOURCE
-#include <math.h>
-#else
-#define _XOPEN_SOURCE
-#include <math.h>
-#undef _XOPEN_SOURCE
-#endif
-#endif
-#include "objects.h"
-#include "spaces.h"
-#include "range.h"
-#endif
-
-#if XFONT_CID
-#include "util.h"
#include "fontfcn.h"
-#if defined(HAVE_CFM) || defined(CID_ALL_CHARS)
-#ifndef DEFAULT_CFM_DIR
-#define DEFAULT_CFM_DIR "./"
-#endif
-char cfmDefaultDir[] = DEFAULT_CFM_DIR;
-#define CFMMAGIC 0x91239123
-#endif
-#endif
#include "t1intf.h"
#define DECIPOINTSPERINCH 722.7
@@ -158,21 +110,6 @@ enum scaleType {
resolution_y, average_width
};
-#if XFONT_CID
-extern cidfont *CIDFontP;
-static int stdpropsinit = 0;
-
-typedef struct cfm_rec {
- xCharInfo maxbounds;
- xCharInfo minbounds;
- xCharInfo ink_maxbounds;
- xCharInfo ink_minbounds;
- INT32 totalrw;
- INT16 maxo;
- INT16 alle;
-} cfmrec;
-#endif
-
typedef struct _fontProp {
char *name;
long atom;
@@ -334,248 +271,6 @@ ComputeBounds(FontInfoPtr pInfo, CharInfoPtr pChars, FontScalablePtr Vals)
FontComputeInfoAccelerators (pInfo);
}
-#if XFONT_CID
-#ifdef CID_ALL_CHARS
-void
-ComputeBoundsAllChars(FontPtr pFont, char *cfmfilename, double sxmult)
-{
- FILE *cfm;
- CARD32 magic;
- int count = 0;
- int maxlap, overlap, i, j, k, ret;
- xCharInfo minchar, maxchar;
- cidrange *cidrangeP;
- unsigned char ccode[2];
- unsigned long ccount;
- xCharInfo *pmetrics;
- long total_raw_width = 0, total_width = 0;
- char cfmd[CID_PATH_MAX];
- cfmrec *cfmp;
- char *p;
-
- if (!(cfm = fopen(cfmfilename, "w"))) {
- fprintf(stderr,
- "Unable to open the file %s. You are probably not logged in as root.\n",
- cfmfilename);
- p = strrchr(cfmfilename, '/');
- if (p == NULL) exit(1);
- strcpy(cfmd, cfmDefaultDir);
- strcat(cfmd, p + 1);
- if (!(cfm = fopen(cfmd, "w"))) {
- fprintf(stderr,
- "Switching to current directory. Unable to open the file %s.\n",
- cfmd);
- exit(1);
- }
- }
-
- if ((cfmp = (cfmrec *)xalloc(sizeof(cfmrec))) == NULL) {
- fprintf(stderr, "Unable to allocate memory.");
- exit(1);
- }
- bzero(cfmp, sizeof(cfmrec));
-
- minchar.ascent = minchar.descent =
- minchar.leftSideBearing = minchar.rightSideBearing =
- minchar.characterWidth = minchar.attributes = 32767;
- maxchar.ascent = maxchar.descent =
- maxchar.leftSideBearing = maxchar.rightSideBearing =
- maxchar.characterWidth = maxchar.attributes = -32767;
-
- maxlap = -32767;
- cfmp->alle = 1;
- cidrangeP = CIDFontP->cidrangeP;
-
- /* go through all character codes specified in a given CMap */
- for (i = 0; i < CIDFontP->cidrangecnt; i++) {
- for (j = 0; j < cidrangeP->rangecnt; j++) {
- for (k = cidrangeP->range[j].srcCodeLo;
- k <= cidrangeP->range[j].srcCodeHi; k++) {
- ccode[0] = (k >> 8) & 0xff;
- ccode[1] = k & 0xff;
- ret = CIDGetMetrics(pFont, 1, ccode, Linear16Bit, &ccount, &pmetrics);
- if (ret != Successful || (ret == Successful && pmetrics == NULL))
- continue;
- total_width += pmetrics->attributes;
- total_raw_width += abs((int)(INT16)pmetrics->attributes);
- if (pmetrics->attributes ||
- pmetrics->ascent != -pmetrics->descent ||
- pmetrics->leftSideBearing != pmetrics->rightSideBearing) {
- count++;
- adjust_min_max(&minchar, &maxchar, pmetrics);
- overlap = pmetrics->rightSideBearing - pmetrics->characterWidth;
- if (overlap > maxlap) maxlap = overlap;
- }
- else cfmp->alle = 0;
- }
- }
- }
-
- if (count)
- {
- total_raw_width = (total_raw_width * 10 + count / 2) / count;
- if (total_width < 0)
- {
- /* Predominant direction is R->L */
- total_raw_width = -total_raw_width;
- }
- }
-
- cfmp->totalrw = (INT32)total_raw_width;
-
- cfmp->maxbounds.leftSideBearing =
- floor((double)maxchar.leftSideBearing * sxmult + 0.5);
- cfmp->maxbounds.rightSideBearing =
- floor((double)maxchar.rightSideBearing * sxmult + 0.5);
- cfmp->maxbounds.characterWidth =
- floor((double)maxchar.characterWidth * sxmult + 0.5);
- cfmp->maxbounds.ascent =
- floor((double)maxchar.ascent * sxmult + 0.5);
- cfmp->maxbounds.descent =
- floor((double)maxchar.descent * sxmult);
- cfmp->maxbounds.attributes = maxchar.attributes;
-
- cfmp->minbounds.leftSideBearing =
- floor((double)minchar.leftSideBearing * sxmult + 0.5);
- cfmp->minbounds.rightSideBearing =
- floor((double)minchar.rightSideBearing * sxmult + 0.5);
- cfmp->minbounds.characterWidth =
- floor((double)minchar.characterWidth * sxmult + 0.5);
- cfmp->minbounds.ascent =
- floor((double)minchar.ascent * sxmult + 0.5);
- cfmp->minbounds.descent =
- floor((double)minchar.descent * sxmult + 0.5);
- cfmp->minbounds.attributes = minchar.attributes;
-
- cfmp->ink_maxbounds.leftSideBearing =
- floor((double)maxchar.leftSideBearing * sxmult + 0.5);
- cfmp->ink_maxbounds.rightSideBearing =
- floor((double)maxchar.rightSideBearing * sxmult + 0.5);
- cfmp->ink_maxbounds.characterWidth =
- floor((double)maxchar.characterWidth * sxmult + 0.5);
- cfmp->ink_maxbounds.ascent =
- floor((double)maxchar.ascent * sxmult + 0.5);
- cfmp->ink_maxbounds.descent =
- floor((double)maxchar.descent * sxmult + 0.5);
- cfmp->ink_maxbounds.attributes = maxchar.attributes;
-
- cfmp->ink_minbounds.leftSideBearing =
- floor((double)minchar.leftSideBearing * sxmult + 0.5);
- cfmp->ink_minbounds.rightSideBearing =
- floor((double)minchar.rightSideBearing * sxmult + 0.5);
- cfmp->ink_minbounds.characterWidth =
- floor((double)minchar.characterWidth * sxmult + 0.5);
- cfmp->ink_minbounds.ascent =
- floor((double)minchar.ascent * sxmult + 0.5);
- cfmp->ink_minbounds.descent =
- floor((double)minchar.descent * sxmult + 0.5);
- cfmp->ink_minbounds.attributes = minchar.attributes;
-
- cfmp->maxo = (INT32)(maxlap + -(minchar.leftSideBearing));
-
- magic = CFMMAGIC;
- fwrite(&magic, sizeof(CARD32), 1, cfm);
- fwrite(cfmp, sizeof(cfmrec), 1, cfm);
- xfree(cfmp);
- fclose(cfm);
-}
-#else
-static long
-ComputeBoundsAll(FontPtr pFont)
-{
- int count = 0;
- int maxlap, overlap, i, j, k, ret;
- xCharInfo minchar, maxchar;
- cidrange *cidrangeP;
- unsigned char ccode[2];
- unsigned long ccount;
- xCharInfo *pmetrics;
- CharInfoRec *cinfo[1];
- long total_raw_width = 0, total_width = 0;
- FontInfoPtr pInfo = &(pFont->info);
-
- minchar.ascent = minchar.descent =
- minchar.leftSideBearing = minchar.rightSideBearing =
- minchar.characterWidth = minchar.attributes = 32767;
- maxchar.ascent = maxchar.descent =
- maxchar.leftSideBearing = maxchar.rightSideBearing =
- maxchar.characterWidth = maxchar.attributes = -32767;
-
- maxlap = -32767;
- pInfo->allExist = 1;
- cidrangeP = CIDFontP->cidrangeP;
-
- /* go through all character codes specified in a given CMap */
- for (i = 0; i < CIDFontP->cidrangecnt; i++) {
- for (j = 0; j < cidrangeP->rangecnt; j++) {
- for (k = cidrangeP->range[j].srcCodeLo;
- k <= cidrangeP->range[j].srcCodeHi; k++) {
- ccode[0] = (k >> 8) & 0xff;
- ccode[1] = k & 0xff;
- ret = CIDGetMetrics(pFont, 1, ccode, Linear16Bit, &ccount, (xCharInfo **)cinfo);
- if (ret != Successful || cinfo == NULL)
- continue;
- pmetrics = &cinfo[0]->metrics;
- total_width += pmetrics->attributes;
- total_raw_width += abs((int)(INT16)pmetrics->attributes);
- if (pmetrics->attributes ||
- pmetrics->ascent != -pmetrics->descent ||
- pmetrics->leftSideBearing != pmetrics->rightSideBearing) {
- count++;
- adjust_min_max(&minchar, &maxchar, pmetrics);
- overlap = pmetrics->rightSideBearing - pmetrics->characterWidth;
- if (overlap > maxlap) maxlap = overlap;
- }
- else pInfo->allExist = 0;
- }
- }
- }
-
- if (count)
- {
- total_raw_width = (total_raw_width * 10 + count / 2) / count;
- if (total_width < 0)
- {
- /* Predominant direction is R->L */
- total_raw_width = -total_raw_width;
- }
- }
-
- pInfo->maxbounds.leftSideBearing = maxchar.leftSideBearing;
- pInfo->maxbounds.rightSideBearing = maxchar.rightSideBearing;
- pInfo->maxbounds.characterWidth = maxchar.characterWidth;
- pInfo->maxbounds.ascent = maxchar.ascent;
- pInfo->maxbounds.descent = maxchar.descent;
- pInfo->maxbounds.attributes = maxchar.attributes;
-
- pInfo->minbounds.leftSideBearing = minchar.leftSideBearing;
- pInfo->minbounds.rightSideBearing = minchar.rightSideBearing;
- pInfo->minbounds.characterWidth = minchar.characterWidth;
- pInfo->minbounds.ascent = minchar.ascent;
- pInfo->minbounds.descent = minchar.descent;
- pInfo->minbounds.attributes = minchar.attributes;
-
- pInfo->ink_maxbounds.leftSideBearing = maxchar.leftSideBearing;
- pInfo->ink_maxbounds.rightSideBearing = maxchar.rightSideBearing;
- pInfo->ink_maxbounds.characterWidth = maxchar.characterWidth;
- pInfo->ink_maxbounds.ascent = maxchar.ascent;
- pInfo->ink_maxbounds.descent = maxchar.descent;
- pInfo->ink_maxbounds.attributes = maxchar.attributes;
-
- pInfo->ink_minbounds.leftSideBearing = minchar.leftSideBearing;
- pInfo->ink_minbounds.rightSideBearing = minchar.rightSideBearing;
- pInfo->ink_minbounds.characterWidth = minchar.characterWidth;
- pInfo->ink_minbounds.ascent = minchar.ascent;
- pInfo->ink_minbounds.descent = minchar.descent;
- pInfo->ink_minbounds.attributes = minchar.attributes;
-
- pInfo->maxOverlap = maxlap + -(minchar.leftSideBearing);
-
- return total_raw_width;
-}
-#endif
-#endif
-
static void
ComputeProps(FontInfoPtr pInfo, FontScalablePtr Vals, char *Filename,
long *sAscent, long *sDescent)
@@ -601,147 +296,6 @@ ComputeProps(FontInfoPtr pInfo, FontScalablePtr Vals, char *Filename,
}
}
-#if XFONT_CID
-#ifndef CID_ALL_CHARS
-static void
-CIDComputeStdProps(FontInfoPtr pInfo, FontScalablePtr Vals,
- char *Filename, char *Cmapname, char *Fontname,
- long sAscent, long sDescent, long sWidth)
-{
- FontPropPtr pp;
- int i,
- nprops;
- fontProp *fpt;
- char *is_str;
- char *ptr1 = NULL,
- *ptr2;
- char *ptr3;
- char *infostrP;
- int rc;
- char scaledName[CID_PATH_MAX];
-
- strcpy (scaledName, Fontname);
- /* Fill in our copy of the fontname from the Vals structure */
- FontParseXLFDName (scaledName, Vals, FONT_XLFD_REPLACE_VALUE);
-
- /* This form of the properties is used by the X-client; the X-server
- doesn't care what they are. */
- nprops = pInfo->nprops = NPROPS;
- pInfo->isStringProp = (char *) xalloc(sizeof(char) * nprops);
- pInfo->props = (FontPropPtr) xalloc(sizeof(FontPropRec) * nprops);
- if (!pInfo->isStringProp || !pInfo->props) {
- xfree(pInfo->isStringProp);
- pInfo->isStringProp = (char *) 0;
- xfree(pInfo->props);
- pInfo->props = (FontPropPtr) 0;
- pInfo->nprops = 0;
- return;
- }
- bzero(pInfo->isStringProp, (sizeof(char) * nprops));
-
- ptr2 = scaledName;
- for (i = NNAMEPROPS, pp = pInfo->props, fpt = fontNamePropTable, is_str = pInfo->isStringProp;
- i;
- i--, pp++, fpt++, is_str++) {
-
- if (*ptr2)
- {
- ptr1 = ptr2 + 1;
- if (!(ptr2 = strchr(ptr1, '-'))) ptr2 = strchr(ptr1, '\0');
- }
-
- pp->name = fpt->atom;
- switch (fpt->type) {
- case atom: /* Just copy info from scaledName */
- *is_str = TRUE;
- pp->value = MakeAtom(ptr1, ptr2 - ptr1, TRUE);
- break;
- case truncate_atom:
- *is_str = TRUE;
- for (ptr3 = ptr1; *ptr3; ptr3++)
- if (*ptr3 == '[')
- break;
- pp->value = MakeAtom(ptr1, ptr3 - ptr1, TRUE);
- break;
- case pixel_size:
- pp->value = (int)(fabs(Vals->pixel_matrix[3]) + .5);
- break;
- case point_size:
- pp->value = (int)(fabs(Vals->point_matrix[3]) * 10.0 + .5);
- break;
- case resolution_x:
- pp->value = Vals->x;
- break;
- case resolution_y:
- pp->value = Vals->y;
- break;
- case average_width:
- pp->value = Vals->width;
- break;
- }
- }
-
- for (i = 0, fpt = extraProps;
- i < NEXTRAPROPS;
- i++, is_str++, pp++, fpt++) {
- pp->name = fpt->atom;
- switch (i) {
- case FONTPROP:
- *is_str = TRUE;
- pp->value = MakeAtom(scaledName, strlen(scaledName), TRUE);
- break;
- case COPYRIGHTPROP:
- *is_str = TRUE;
- CIDQueryFontLib(Filename, Cmapname, "Notice", &infostrP, &rc);
- if (rc || !infostrP) {
- infostrP = "Copyright Notice not available";
- }
- pp->value = MakeAtom(infostrP, strlen(infostrP), TRUE);
- break;
- case FACE_NAMEPROP:
- *is_str = TRUE;
- CIDQueryFontLib(Filename, Cmapname, "CIDFontName", &infostrP, &rc);
- if (rc || !infostrP) {
- infostrP = "(unknown)";
- }
- pp->value = MakeAtom(infostrP, strlen(infostrP), TRUE);
- break;
- case FONT_TYPEPROP:
- *is_str = TRUE;
- infostrP = "CIDFont";
- pp->value = MakeAtom(infostrP, strlen(infostrP), TRUE);
- break;
- case RASTERIZER_NAMEPROP:
- *is_str = TRUE;
- infostrP = "X Consortium Type 1 Rasterizer";
- pp->value = MakeAtom(infostrP, strlen(infostrP), TRUE);
- break;
- case RAWPIXELPROP:
- *is_str = FALSE;
- pp->value = 1000;
- break;
- case RAWPOINTPROP:
- *is_str = FALSE;
- pp->value = (long)(72270.0 / (double)Vals->y + .5);
- break;
- case RAWASCENTPROP:
- *is_str = FALSE;
- pp->value = sAscent;
- break;
- case RAWDESCENTPROP:
- *is_str = FALSE;
- pp->value = sDescent;
- break;
- case RAWWIDTHPROP:
- *is_str = FALSE;
- pp->value = sWidth;
- break;
- }
- }
-}
-#endif
-#endif
-
static void
ComputeStdProps(FontInfoPtr pInfo, FontScalablePtr Vals,
char *Filename, char *Fontname,
@@ -878,37 +432,6 @@ ComputeStdProps(FontInfoPtr pInfo, FontScalablePtr Vals,
}
}
-#if XFONT_CID
-/*ARGSUSED*/
-int
-CIDGetInfoScalable(FontPathElementPtr fpe,
- FontInfoPtr pInfo,
- FontEntryPtr entry,
- FontNamePtr fontName,
- char *fileName,
- FontScalablePtr Vals)
-{
- FontPtr pfont;
- int flags = 0;
- long format = 0; /* It doesn't matter what format for just info */
- long fmask = 0;
- int ret;
-
- ret = CIDOpenScalable(fpe, &pfont, flags, entry, fileName, Vals,
- format, fmask, NULL);
- if (ret != Successful)
- return ret;
- *pInfo = pfont->info;
-
- /* XXX - Set pointers in pfont->info to NULL so they are not freed. */
- pfont->info.props = NULL;
- pfont->info.isStringProp = NULL;
-
- CIDCloseFont(pfont);
- return Successful;
-}
-#endif
-
/*ARGSUSED*/
int
Type1GetInfoScalable(FontPathElementPtr fpe,
@@ -938,116 +461,6 @@ Type1GetInfoScalable(FontPathElementPtr fpe,
return Successful;
}
-#if XFONT_CID
-#ifndef CID_ALL_CHARS
-void
-CIDFillFontInfo(FontPtr pFont, FontScalablePtr Vals,
- char *Filename, char *Fontname, char *Cmapname,
-#ifdef HAVE_CFM
- char *cfmfilename,
-#endif
- long sAscent, long sDescent, double sxmult)
-{
-#ifdef HAVE_CFM
- FILE *cfm;
- cfmrec *cfmp;
- int gotcfm = 0;
- CARD32 magic;
-#endif
- long sWidth = 0;
- FontInfoPtr pInfo = &pFont->info;
-
- FillHeader(pInfo, Vals);
-
-#ifdef HAVE_CFM
- if ((cfm = fopen(cfmfilename,"r"))) {
- fread(&magic,sizeof(CARD32),1,cfm);
- if(magic == CFMMAGIC) {
- if ((cfmp = (cfmrec *)xalloc(sizeof(cfmrec))) != NULL) {
- fread(cfmp,sizeof(cfmrec),1,cfm);
- sWidth = (long)cfmp->totalrw;
- pInfo->allExist = cfmp->alle;
- if (sxmult != 0) {
- pInfo->maxbounds.leftSideBearing =
- floor((double)cfmp->maxbounds.leftSideBearing /
- sxmult + 0.5);
- pInfo->maxbounds.rightSideBearing =
- floor((double)cfmp->maxbounds.rightSideBearing /
- sxmult + 0.5);
- pInfo->maxbounds.characterWidth =
- floor((double)cfmp->maxbounds.characterWidth /
- sxmult + 0.5);
- pInfo->maxbounds.ascent =
- floor((double)cfmp->maxbounds.ascent /
- sxmult + 0.5);
- pInfo->maxbounds.descent =
- floor((double)cfmp->maxbounds.descent /
- sxmult + 0.5);
- pInfo->maxbounds.attributes =
- cfmp->maxbounds.attributes;
-
- pInfo->minbounds.leftSideBearing =
- cfmp->minbounds.leftSideBearing / sxmult;
- pInfo->minbounds.rightSideBearing =
- cfmp->minbounds.rightSideBearing / sxmult;
- pInfo->minbounds.characterWidth =
- cfmp->minbounds.characterWidth / sxmult;
- pInfo->minbounds.ascent =
- cfmp->minbounds.ascent / sxmult;
- pInfo->minbounds.descent =
- cfmp->minbounds.descent / sxmult;
- pInfo->minbounds.attributes = cfmp->minbounds.attributes;
-
- pInfo->ink_maxbounds.leftSideBearing =
- cfmp->ink_maxbounds.leftSideBearing / sxmult;
- pInfo->ink_maxbounds.rightSideBearing =
- cfmp->ink_maxbounds.rightSideBearing / sxmult;
- pInfo->ink_maxbounds.characterWidth =
- cfmp->ink_maxbounds.characterWidth / sxmult;
- pInfo->ink_maxbounds.ascent =
- cfmp->ink_maxbounds.ascent / sxmult;
- pInfo->ink_maxbounds.descent =
- cfmp->ink_maxbounds.descent / sxmult;
- pInfo->ink_maxbounds.attributes =
- cfmp->ink_maxbounds.attributes;
-
- pInfo->ink_minbounds.leftSideBearing =
- cfmp->ink_minbounds.leftSideBearing / sxmult;
- pInfo->ink_minbounds.rightSideBearing =
- cfmp->ink_minbounds.rightSideBearing / sxmult;
- pInfo->ink_minbounds.characterWidth =
- cfmp->ink_minbounds.characterWidth / sxmult;
- pInfo->ink_minbounds.ascent =
- cfmp->ink_minbounds.ascent / sxmult;
- pInfo->ink_minbounds.descent =
- cfmp->ink_minbounds.descent / sxmult;
- pInfo->ink_minbounds.attributes =
- cfmp->ink_minbounds.attributes;
- pInfo->ink_minbounds.attributes =
- cfmp->ink_minbounds.attributes;
-
- pInfo->maxOverlap = (short)cfmp->maxo;
-
- gotcfm = 1;
- }
- xfree(cfmp);
- }
- }
- fclose(cfm);
- }
-
- if (!gotcfm)
-#endif
- sWidth = ComputeBoundsAll(pFont);
-
- FontComputeInfoAccelerators(pInfo);
-
- CIDComputeStdProps(pInfo, Vals, Filename, Cmapname, Fontname, sAscent,
- sDescent, sWidth);
-}
-#endif /* CID_ALL_CHARS */
-#endif /* BUILDCID */
-
void
T1FillFontInfo(FontPtr pFont, FontScalablePtr Vals,
char *Filename, char *Fontname, long sWidth)
@@ -1066,31 +479,15 @@ T1FillFontInfo(FontPtr pFont, FontScalablePtr Vals,
/* Called once, at renderer registration time */
void
-#if XFONT_CID
-Type1InitStdProps(void)
-#else
T1InitStdProps(void)
-#endif
{
int i;
fontProp *t;
-#if XFONT_CID
- if (!stdpropsinit) {
- stdpropsinit = 1;
- i = sizeof(fontNamePropTable) / sizeof(fontProp);
- for (t = fontNamePropTable; i; i--, t++)
- t->atom = MakeAtom(t->name, (unsigned) strlen(t->name), TRUE);
- i = sizeof(extraProps) / sizeof(fontProp);
- for (t = extraProps; i; i--, t++)
- t->atom = MakeAtom(t->name, (unsigned) strlen(t->name), TRUE);
- }
-#else
i = sizeof(fontNamePropTable) / sizeof(fontProp);
for (t = fontNamePropTable; i; i--, t++)
t->atom = MakeAtom(t->name, (unsigned) strlen(t->name), TRUE);
i = sizeof(extraProps) / sizeof(fontProp);
for (t = extraProps; i; i--, t++)
t->atom = MakeAtom(t->name, (unsigned) strlen(t->name), TRUE);
-#endif
}
diff --git a/src/Type1/t1intf.h b/src/Type1/t1intf.h
index 831acc5..d1ac727 100644
--- a/src/Type1/t1intf.h
+++ b/src/Type1/t1intf.h
@@ -27,117 +27,29 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
-/* Copyright (c) 1994-1999 Silicon Graphics, Inc. All Rights Reserved.
- *
- * The contents of this file are subject to the CID Font Code Public Licence
- * Version 1.0 (the "License"). You may not use this file except in compliance
- * with the Licence. You may obtain a copy of the License at Silicon Graphics,
- * Inc., attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA
- * 94043 or at http://www.sgi.com/software/opensource/cid/license.html.
- *
- * Software distributed under the License is distributed on an "AS IS" basis.
- * ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
- * WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF
- * NON-INFRINGEMENT. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * The Original Software is CID font code that was developed by Silicon
- * Graphics, Inc.
- */
/* $XFree86: xc/lib/font/Type1/t1intf.h,v 1.6 2001/01/17 19:43:23 dawes Exp $ */
-#ifdef BUILDCID
-#define XFONT_CID 1
-#endif
-
-#if XFONT_CID
-#include "AFM.h"
-#endif
-
struct type1font {
CharInfoPtr pDefault;
CharInfoRec glyphs[256];
};
-#if XFONT_CID
-typedef struct cid_glyphs {
- char *CIDFontName;
- char *CMapName;
- long dataoffset;
- double pixel_matrix[4];
- CharInfoPtr pDefault;
- CharInfoRec **glyphs;
- FontInfo *AFMinfo;
-#ifdef USE_MMAP
- unsigned char *CIDdata;
- long CIDsize;
-#endif
-} cidglyphs;
-#endif
-
/*
* Function prototypes
*/
/* t1funcs.c */
-#if XFONT_CID
-extern int CIDOpenScalable ( FontPathElementPtr fpe, FontPtr *ppFont,
- int flags, FontEntryPtr entry, char *fileName,
- FontScalablePtr vals, fsBitmapFormat format,
- fsBitmapFormatMask fmask,
- FontPtr non_cachable_font );
-#endif
extern int Type1OpenScalable ( FontPathElementPtr fpe, FontPtr *ppFont,
int flags, FontEntryPtr entry, char *fileName,
FontScalablePtr vals, fsBitmapFormat format,
fsBitmapFormatMask fmask,
FontPtr non_cachable_font );
-#if XFONT_CID
-extern unsigned int getCID ( FontPtr pFont, unsigned int charcode );
-extern int CIDGetGlyphs ( FontPtr pFont, unsigned long count,
- unsigned char *chars, FontEncoding charEncoding,
- unsigned long *glyphCount, CharInfoPtr *glyphs );
-extern int CIDGetMetrics ( FontPtr pFont, unsigned long count,
- unsigned char *chars, FontEncoding charEncoding,
- unsigned long *glyphCount, xCharInfo **glyphs );
-extern void CIDCloseFont ( FontPtr pFont );
-#endif
extern void Type1CloseFont ( FontPtr pFont );
extern int Type1ReturnCodeToXReturnCode ( int rc );
-#if XFONT_CID
-extern CharInfoPtr CIDRenderGlyph ( FontPtr pFont, psobj *charstringP,
- psobj *subarrayP,
- struct blues_struct *bluesP,
- CharInfoPtr pci, int *mode );
-#endif
/* t1info.c */
-#ifdef CID_ALL_CHARS
-extern void ComputeBoundsAllChars ( FontPtr pFont, char *cfmfilename, double sxmult );
-#endif
-#if XFONT_CID
-extern int CIDGetInfoScalable ( FontPathElementPtr fpe, FontInfoPtr pInfo,
- FontEntryPtr entry, FontNamePtr fontName,
- char *fileName, FontScalablePtr Vals );
-#endif
extern int Type1GetInfoScalable ( FontPathElementPtr fpe, FontInfoPtr pInfo,
FontEntryPtr entry, FontNamePtr fontName,
char *fileName, FontScalablePtr Vals );
-#if XFONT_CID
-extern void CIDFillFontInfo ( FontPtr pFont, FontScalablePtr Vals,
- char *Filename, char *Fontname, char *Cmapname,
-#ifdef HAVE_CFM
- char *cfmfilename,
-#endif
- long sAscent, long sDescent, double sxmult );
-#endif
extern void T1FillFontInfo ( FontPtr pFont, FontScalablePtr Vals,
char *Filename, char *Fontname, long sWidth );
extern void Type1InitStdProps ( void );
-
-/* cidchar.c */
-extern CharInfoPtr CIDGetGlyphInfo ( FontPtr pFont, unsigned int cidcode,
- CharInfoPtr pci, int *rc );
-extern int CIDGetAFM ( FontPtr pFont, unsigned long count,
- unsigned char *chars, FontEncoding charEncoding,
- unsigned long *glyphCount, CharInfoPtr *glyphs,
- char *cidafmfile );
diff --git a/src/Type1/t1io.c b/src/Type1/t1io.c
index 42b8bb6..ba2e580 100644
--- a/src/Type1/t1io.c
+++ b/src/Type1/t1io.c
@@ -28,23 +28,6 @@
* SOFTWARE.
* Author: Carol H. Thompson IBM Almaden Research Center
*/
-/* Copyright (c) 1994-1999 Silicon Graphics, Inc. All Rights Reserved.
- *
- * The contents of this file are subject to the CID Font Code Public Licence
- * Version 1.0 (the "License"). You may not use this file except in compliance
- * with the Licence. You may obtain a copy of the License at Silicon Graphics,
- * Inc., attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA
- * 94043 or at http://www.sgi.com/software/opensource/cid/license.html.
- *
- * Software distributed under the License is distributed on an "AS IS" basis.
- * ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
- * WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF
- * NON-INFRINGEMENT. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * The Original Software is CID font code that was developed by Silicon
- * Graphics, Inc.
- */
/* $XFree86: xc/lib/font/Type1/t1io.c,v 3.8 2001/01/17 19:43:23 dawes Exp $ */
/*******************************************************************
* I/O package for Type 1 font reading
@@ -53,9 +36,6 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#ifdef BUILDCID
-#define XFONT_CID 1
-#endif
#ifndef STATIC
#define STATIC static
@@ -92,14 +72,6 @@ STATIC unsigned char TheBuffer[F_BUFSIZ];
static int T1Decrypt ( unsigned char *p, int len );
static int T1Fill ( F_FILE *f );
-#if XFONT_CID
-void
-resetDecrypt(void)
-{
- Decrypt = 0;
-}
-#endif
-
/* -------------------------------------------------------------- */
/*ARGSUSED*/
F_FILE *
@@ -258,67 +230,6 @@ T1eexec(F_FILE *f) /* Stream descriptor */
return (T1Feof(f))?NULL:f;
} /* end eexec */
-#if XFONT_CID
-F_FILE * /* Initialization */
-CIDeexec(F_FILE *f) /* Stream descriptor */
-{
- int i, c;
- int H;
- unsigned char *p;
- unsigned char randomP[8];
-
- r = 55665; /* initial key */
- asc = 1; /* indicate ASCII form */
-
- /* Consume the 4 random bytes, determining if we are also to
- ASCIIDecodeHex as we process our input. (See pages 63-64
- of the Adobe Type 1 Font Format book.) */
-
- /* Skip over any initial white space chars */
- while (HighHexP[c=_XT1getc(f)] == HWHITE_SPACE) ;
-
- /* If ASCII, the next 7 chars are guaranteed consecutive */
- randomP[0] = c; /* store first non white space char */
- T1Read((pointer)(randomP+1), 1, 3, f); /* read 3 more, for a total of 4 */
- /* store first four chars */
- for (i=0,p=randomP; i<4; i++) { /* Check 4 valid ASCIIEncode chars */
- if (HighHexP[*p++] > LAST_HDIGIT) { /* non-ASCII byte */
- asc = 0;
- break;
- }
- }
- if (asc) { /* ASCII form, convert first eight bytes to binary */
- T1Read((pointer)(randomP+4), 1, 4, f); /* Need four more */
- for (i=0,p=randomP; i<4; i++) { /* Convert */
- H = HighHexP[*p++];
- randomP[i] = H | LowHexP[*p++];
- }
- }
-
- /* Adjust our key */
- for (i=0,p=randomP; i<4; i++) {
- r = (*p++ + r) * c1 + c2;
- }
-
- /* Decrypt up to, but not including, the first '%' sign */
- if (f->b_cnt > 0) {
- for (i = 0; i < f->b_cnt; i++)
- if (*(f->b_ptr + i) == '%')
- break;
-
- if (i < f->b_cnt) {
- if (i == 0)
- f->b_cnt = 0;
- else
- f->b_cnt = T1Decrypt(f->b_ptr, i);
- } else
- f->b_cnt = T1Decrypt(f->b_ptr, f->b_cnt);
- }
- Decrypt = 1;
- return (T1Feof(f))?NULL:f;
-} /* end eexec */
-#endif
-
/* -------------------------------------------------------------- */
STATIC int
T1Decrypt(unsigned char *p, int len)
diff --git a/src/Type1/t1stdio.h b/src/Type1/t1stdio.h
index 2ed0832..aa281c0 100644
--- a/src/Type1/t1stdio.h
+++ b/src/Type1/t1stdio.h
@@ -29,9 +29,6 @@
*/
/* $XFree86: xc/lib/font/Type1/t1stdio.h,v 1.9 2001/01/17 19:43:24 dawes Exp $ */
/* T1IO FILE structure and related stuff */
-#ifdef BUILDCID
-#define XFONT_CID 1
-#endif
#ifdef XFree86LOADER
#undef FILE
@@ -72,10 +69,6 @@ typedef struct F_FILE {
#define T1Feof(f) (((f)->flags & FIOEOF) && ((f)->b_cnt==0))
-#if XFONT_CID
-extern F_FILE *CIDeexec ( FILE *f );
-#endif
-
extern FILE *T1Open ( char *fn, char *mode );
extern int T1Getc ( FILE *f );
extern int T1Ungetc ( int c, FILE *f );
diff --git a/src/Type1/type1.c b/src/Type1/type1.c
index b3fa496..4aa890c 100644
--- a/src/Type1/type1.c
+++ b/src/Type1/type1.c
@@ -28,23 +28,6 @@
* CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* Copyright (c) 1994-1999 Silicon Graphics, Inc. All Rights Reserved.
- *
- * The contents of this file are subject to the CID Font Code Public Licence
- * Version 1.0 (the "License"). You may not use this file except in compliance
- * with the Licence. You may obtain a copy of the License at Silicon Graphics,
- * Inc., attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA
- * 94043 or at http://www.sgi.com/software/opensource/cid/license.html.
- *
- * Software distributed under the License is distributed on an "AS IS" basis.
- * ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
- * WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF
- * NON-INFRINGEMENT. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * The Original Software is CID font code that was developed by Silicon
- * Graphics, Inc.
- */
/* $XFree86: xc/lib/font/Type1/type1.c,v 1.9tsi Exp $ */
/*********************************************************************/
@@ -67,9 +50,6 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#ifdef BUILDCID
-#define XFONT_CID 1
-#endif
#ifndef FONTMODULE
#include <stdio.h> /* a system-dependent include, usually */
@@ -99,11 +79,7 @@ typedef struct xobject xobject;
#define MAXPSFAKESTACK 32 /* Max depth of fake PostScript stack (local) */
#define MAXSTRLEN 512 /* Max length of a Type 1 string (local) */
#define MAXLABEL 256 /* Maximum number of new hints */
-#if XFONT_CID
-#define MAXSTEMS 500 /* Maximum number of VSTEM and HSTEM hints */
-#else
#define MAXSTEMS 128 /* Maximum number of VSTEM and HSTEM hints */
-#endif
#define EPS 0.001 /* Small number for comparisons */
/************************************/
@@ -171,11 +147,6 @@ struct stem { /* representation of a STEM hint */
struct xobject *Type1Char(char *env, struct XYspace *S,
psobj *charstrP, psobj *subrsP, psobj *osubrsP,
struct blues_struct *bluesP, int *modeP);
-#if XFONT_CID
-struct xobject *CIDChar(char *env, struct XYspace *S,
- psobj *charstrP, psobj *subrsP, psobj *osubrsP,
- struct blues_struct *bluesP, int *modeP);
-#endif
static double escapementX, escapementY;
static double sidebearingX, sidebearingY;
@@ -1150,14 +1121,7 @@ Escape(int Code)
if (Top < Num+1) Error;
for (i = 0; i < Num; i++) PSFakePush(Stack[Top - i - 2]);
Top -= Num + 2;
-#if XFONT_CID
- if ((int)Stack[Top + Num + 2] > 3)
- ClearPSFakeStack();
- else
- CallOtherSubr((int)Stack[Top + Num + 2]);
-#else
CallOtherSubr((int)Stack[Top + Num + 2]);
-#endif
break;
case POP: /* - POP number */
/* Removes a number from the top of the */
@@ -1832,61 +1796,3 @@ Type1Char(char *env, struct XYspace *S, psobj *charstrP, psobj *subrsP,
return((struct xobject *) path);
}
-
-#if XFONT_CID
-struct xobject *
-CIDChar(char *env, struct XYspace *S,
- psobj *charstrP, psobj *subrsP, psobj *osubrsP,
- struct blues_struct *bluesP, /* FontID's ptr to the blues struct */
- int *modeP)
-{
- int Code;
-
- path = NULL;
- errflag = FALSE;
-
- /* Make parameters available to all CID routines */
- Environment = env;
- CharSpace = S; /* used when creating path elements */
- CharStringP = charstrP;
- SubrsP = subrsP;
-
- blues = bluesP;
-
- /* compute the alignment zones */
- ComputeAlignmentZones();
-
- StartDecrypt();
-
- ClearStack();
- ClearPSFakeStack();
- ClearCallStack();
-
- InitStems();
-
- currx = curry = 0;
- escapementX = escapementY = 0;
- sidebearingX = sidebearingY = 0;
- accentoffsetX = accentoffsetY = 0;
- wsoffsetX = wsoffsetY = 0; /* No shift to preserve whitspace. */
- wsset = 0; /* wsoffsetX,Y haven't been set yet. */
-
- for (;;) {
- if (!DoRead(&Code)) break;
- Decode(Code);
- if (errflag) break;
- }
-
- FinitStems();
-
- /* Clean up if an error has occurred */
- if (errflag) {
- if (path != NULL) {
- Destroy(path); /* Reclaim storage */
- path = NULL; /* Indicate that character could not be built */
- }
- }
-
- return((struct xobject *) path);
-}
-#endif
diff --git a/src/Type1/util.c b/src/Type1/util.c
index 7c5a81d..2eefc11 100644
--- a/src/Type1/util.c
+++ b/src/Type1/util.c
@@ -27,32 +27,12 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
-/* Copyright (c) 1994-1999 Silicon Graphics, Inc. All Rights Reserved.
- *
- * The contents of this file are subject to the CID Font Code Public Licence
- * Version 1.0 (the "License"). You may not use this file except in compliance
- * with the Licence. You may obtain a copy of the License at Silicon Graphics,
- * Inc., attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA
- * 94043 or at http://www.sgi.com/software/opensource/cid/license.html.
- *
- * Software distributed under the License is distributed on an "AS IS" basis.
- * ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
- * WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF
- * NON-INFRINGEMENT. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * The Original Software is CID font code that was developed by Silicon
- * Graphics, Inc.
- */
/* $XFree86: xc/lib/font/Type1/util.c,v 1.5 1999/08/21 13:47:53 dawes Exp $ */
/* Author: Katherine A. Hitchcock IBM Almaden Research Laboratory */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#ifdef BUILDCID
-#define XFONT_CID 1
-#endif
#ifndef FONTMODULE
#include <stdio.h>
@@ -75,15 +55,7 @@ static char *vm_base = NULL; /* Start of virtual memory area */
boolean
vm_init(int cnt)
{
-#if XFONT_CID
- if (vm_base == NULL || (vm_base != NULL && vm_size != cnt)) {
- if (vm_base != NULL) xfree(vm_base);
- vm_next = vm_base = (char *)xalloc (cnt);
- } else
- vm_next = vm_base;
-#else
vm_next = vm_base = (char *)xalloc (cnt);
-#endif
if (vm_base != NULL) {
vm_free = cnt;
diff --git a/src/Type1/util.h b/src/Type1/util.h
index a1a8b3e..ddfc139 100644
--- a/src/Type1/util.h
+++ b/src/Type1/util.h
@@ -27,32 +27,11 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
-/* Copyright (c) 1994-1999 Silicon Graphics, Inc. All Rights Reserved.
- *
- * The contents of this file are subject to the CID Font Code Public Licence
- * Version 1.0 (the "License"). You may not use this file except in compliance
- * with the Licence. You may obtain a copy of the License at Silicon Graphics,
- * Inc., attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA
- * 94043 or at http://www.sgi.com/software/opensource/cid/license.html.
- *
- * Software distributed under the License is distributed on an "AS IS" basis.
- * ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
- * WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF
- * NON-INFRINGEMENT. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * The Original Software is CID font code that was developed by Silicon
- * Graphics, Inc.
- */
/* $XFree86: xc/lib/font/Type1/util.h,v 1.4 1999/08/22 08:58:55 dawes Exp $ */
#ifndef UTIL_H
#define UTIL_H
-#ifdef BUILDCID
-#define XFONT_CID 1
-#endif
-
#ifndef boolean
typedef int boolean;
#endif
@@ -81,15 +60,6 @@ typedef int boolean;
#define MAX_STRING_LEN (65535)
#define MAX_NAME_LEN (128)
-/* this is the size of memory allocated for reading fonts */
-
-#if XFONT_CID
-#define VM_SIZE (100*1024)
-#else
-#define VM_SIZE (50*1024)
-#endif
-/***================================================================***/
-
#ifndef MIN
#define MIN(a,b) (((a)<(b)) ? a : b )
#endif
diff --git a/src/fontfile/ffcheck.c b/src/fontfile/ffcheck.c
index fed6189..d03be4f 100644
--- a/src/fontfile/ffcheck.c
+++ b/src/fontfile/ffcheck.c
@@ -131,9 +131,6 @@ FontFileCheckRegisterFpeFunctions (void)
#ifdef XFONT_TYPE1
Type1RegisterFontFileFunctions();
#endif
-#ifdef XFONT_CID
- CIDRegisterFontFileFunctions();
-#endif
#ifdef XFONT_FREETYPE
FreeTypeRegisterFontFileFunctions();
#endif
diff --git a/src/fontfile/register.c b/src/fontfile/register.c
index cb74c7c..53016b2 100644
--- a/src/fontfile/register.c
+++ b/src/fontfile/register.c
@@ -63,9 +63,6 @@ in this Software without prior written authorization from The Open Group.
# endif
#endif
-#ifdef BUILD_CID
-# define XFONT_CID 1
-#endif
#ifdef BUILD_FREETYPE
# define XFONT_FREETYPE 1
#endif
@@ -84,9 +81,6 @@ FontFileRegisterFpeFunctions(void)
#ifdef XFONT_TYPE1
Type1RegisterFontFileFunctions();
#endif
-#ifdef XFONT_CID
- CIDRegisterFontFileFunctions();
-#endif
#ifdef XFONT_FREETYPE
FreeTypeRegisterFontFileFunctions();
#endif