From fcd4e993ba9b6961af69a88a123bdb8f04139ed5 Mon Sep 17 00:00:00 2001 From: Matthieu Herrb Date: Sat, 16 Dec 2006 18:29:47 +0000 Subject: merge libXfont 1.2.5 and regenerate --- lib/libXfont/src/FreeType/Makefile.in | 2 - lib/libXfont/src/Makefile.in | 2 - lib/libXfont/src/Speedo/Makefile.in | 2 - lib/libXfont/src/Type1/AFM.h | 62 ---- lib/libXfont/src/Type1/Makefile.in | 16 +- lib/libXfont/src/Type1/afm.c | 201 ----------- lib/libXfont/src/Type1/cidchar.c | 621 --------------------------------- lib/libXfont/src/Type1/range.h | 48 --- lib/libXfont/src/bitmap/Makefile.in | 2 - lib/libXfont/src/builtins/Makefile.in | 2 - lib/libXfont/src/fc/Makefile.in | 2 - lib/libXfont/src/fontcache/Makefile.in | 2 - lib/libXfont/src/fontfile/Makefile.in | 2 - lib/libXfont/src/stubs/Makefile.in | 2 - lib/libXfont/src/util/Makefile.in | 2 - 15 files changed, 4 insertions(+), 964 deletions(-) delete mode 100644 lib/libXfont/src/Type1/AFM.h delete mode 100644 lib/libXfont/src/Type1/afm.c delete mode 100644 lib/libXfont/src/Type1/cidchar.c delete mode 100644 lib/libXfont/src/Type1/range.h (limited to 'lib/libXfont/src') diff --git a/lib/libXfont/src/FreeType/Makefile.in b/lib/libXfont/src/FreeType/Makefile.in index dad1f9975..51c8556b8 100644 --- a/lib/libXfont/src/FreeType/Makefile.in +++ b/lib/libXfont/src/FreeType/Makefile.in @@ -134,8 +134,6 @@ XFONT_BITMAP_TRUE = @XFONT_BITMAP_TRUE@ XFONT_BUILTINS_FALSE = @XFONT_BUILTINS_FALSE@ XFONT_BUILTINS_TRUE = @XFONT_BUILTINS_TRUE@ XFONT_CFLAGS = @XFONT_CFLAGS@ -XFONT_CID_FALSE = @XFONT_CID_FALSE@ -XFONT_CID_TRUE = @XFONT_CID_TRUE@ XFONT_FC_FALSE = @XFONT_FC_FALSE@ XFONT_FC_TRUE = @XFONT_FC_TRUE@ XFONT_FONTCACHE_FALSE = @XFONT_FONTCACHE_FALSE@ diff --git a/lib/libXfont/src/Makefile.in b/lib/libXfont/src/Makefile.in index 6e5cb308c..d4664e2e8 100644 --- a/lib/libXfont/src/Makefile.in +++ b/lib/libXfont/src/Makefile.in @@ -190,8 +190,6 @@ XFONT_BITMAP_TRUE = @XFONT_BITMAP_TRUE@ XFONT_BUILTINS_FALSE = @XFONT_BUILTINS_FALSE@ XFONT_BUILTINS_TRUE = @XFONT_BUILTINS_TRUE@ XFONT_CFLAGS = @XFONT_CFLAGS@ -XFONT_CID_FALSE = @XFONT_CID_FALSE@ -XFONT_CID_TRUE = @XFONT_CID_TRUE@ XFONT_FC_FALSE = @XFONT_FC_FALSE@ XFONT_FC_TRUE = @XFONT_FC_TRUE@ XFONT_FONTCACHE_FALSE = @XFONT_FONTCACHE_FALSE@ diff --git a/lib/libXfont/src/Speedo/Makefile.in b/lib/libXfont/src/Speedo/Makefile.in index de124dad7..546082232 100644 --- a/lib/libXfont/src/Speedo/Makefile.in +++ b/lib/libXfont/src/Speedo/Makefile.in @@ -137,8 +137,6 @@ XFONT_BITMAP_TRUE = @XFONT_BITMAP_TRUE@ XFONT_BUILTINS_FALSE = @XFONT_BUILTINS_FALSE@ XFONT_BUILTINS_TRUE = @XFONT_BUILTINS_TRUE@ XFONT_CFLAGS = @XFONT_CFLAGS@ -XFONT_CID_FALSE = @XFONT_CID_FALSE@ -XFONT_CID_TRUE = @XFONT_CID_TRUE@ XFONT_FC_FALSE = @XFONT_FC_FALSE@ XFONT_FC_TRUE = @XFONT_FC_TRUE@ XFONT_FONTCACHE_FALSE = @XFONT_FONTCACHE_FALSE@ diff --git a/lib/libXfont/src/Type1/AFM.h b/lib/libXfont/src/Type1/AFM.h deleted file mode 100644 index f2c997a3f..000000000 --- a/lib/libXfont/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/lib/libXfont/src/Type1/Makefile.in b/lib/libXfont/src/Type1/Makefile.in index f249e6b66..adebadecf 100644 --- a/lib/libXfont/src/Type1/Makefile.in +++ b/lib/libXfont/src/Type1/Makefile.in @@ -48,10 +48,10 @@ CONFIG_HEADER = $(top_builddir)/config.h \ CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libtype1_la_LIBADD = -am_libtype1_la_OBJECTS = afm.lo arith.lo cidchar.lo curves.lo \ - fontfcn.lo hints.lo lines.lo objects.lo paths.lo regions.lo \ - scanfont.lo spaces.lo t1funcs.lo t1info.lo t1io.lo t1malloc.lo \ - t1snap.lo t1stub.lo t1unicode.lo token.lo type1.lo util.lo +am_libtype1_la_OBJECTS = arith.lo curves.lo fontfcn.lo hints.lo \ + lines.lo objects.lo paths.lo regions.lo scanfont.lo spaces.lo \ + t1funcs.lo t1info.lo t1io.lo t1malloc.lo t1snap.lo t1stub.lo \ + t1unicode.lo token.lo type1.lo util.lo libtype1_la_OBJECTS = $(am_libtype1_la_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -I$(top_builddir)/include/X11/fonts depcomp = $(SHELL) $(top_srcdir)/depcomp @@ -137,8 +137,6 @@ XFONT_BITMAP_TRUE = @XFONT_BITMAP_TRUE@ XFONT_BUILTINS_FALSE = @XFONT_BUILTINS_FALSE@ XFONT_BUILTINS_TRUE = @XFONT_BUILTINS_TRUE@ XFONT_CFLAGS = @XFONT_CFLAGS@ -XFONT_CID_FALSE = @XFONT_CID_FALSE@ -XFONT_CID_TRUE = @XFONT_CID_TRUE@ XFONT_FC_FALSE = @XFONT_FC_FALSE@ XFONT_FC_TRUE = @XFONT_FC_TRUE@ XFONT_FONTCACHE_FALSE = @XFONT_FONTCACHE_FALSE@ @@ -208,12 +206,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 \ @@ -231,7 +226,6 @@ libtype1_la_SOURCES = \ paths.c \ paths.h \ pictures.h \ - range.h \ regions.c \ regions.h \ scanfont.c \ @@ -309,9 +303,7 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/afm.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arith.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cidchar.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curves.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fontfcn.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hints.Plo@am__quote@ diff --git a/lib/libXfont/src/Type1/afm.c b/lib/libXfont/src/Type1/afm.c deleted file mode 100644 index 006ff3ca2..000000000 --- a/lib/libXfont/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 -#endif -#ifdef BUILDCID -#define XFONT_CID 1 -#endif - -#ifdef XFONT_CID -#ifndef FONTMODULE -#include -#include -#include -#else -#include "Xmd.h" /* For INT32 declaration */ -#include "Xdefs.h" /* For Bool */ -#include "xf86_ansic.h" -#endif -#include /* for xalloc/xfree */ -#include "AFM.h" - -#include - -#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/lib/libXfont/src/Type1/cidchar.c b/lib/libXfont/src/Type1/cidchar.c deleted file mode 100644 index 20d26650c..000000000 --- a/lib/libXfont/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 -#endif -#ifdef BUILDCID -#define XFONT_CID 1 -#endif - -#if XFONT_CID -#ifndef FONTMODULE -#include -#include -#include -#ifdef USE_MMAP -#include -#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 -#else -#define _XOPEN_SOURCE -#include -#undef _XOPEN_SOURCE -#endif -#endif -#include -#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/lib/libXfont/src/Type1/range.h b/lib/libXfont/src/Type1/range.h deleted file mode 100644 index 496f000da..000000000 --- a/lib/libXfont/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/lib/libXfont/src/bitmap/Makefile.in b/lib/libXfont/src/bitmap/Makefile.in index 425024c97..11e0d2acc 100644 --- a/lib/libXfont/src/bitmap/Makefile.in +++ b/lib/libXfont/src/bitmap/Makefile.in @@ -136,8 +136,6 @@ XFONT_BITMAP_TRUE = @XFONT_BITMAP_TRUE@ XFONT_BUILTINS_FALSE = @XFONT_BUILTINS_FALSE@ XFONT_BUILTINS_TRUE = @XFONT_BUILTINS_TRUE@ XFONT_CFLAGS = @XFONT_CFLAGS@ -XFONT_CID_FALSE = @XFONT_CID_FALSE@ -XFONT_CID_TRUE = @XFONT_CID_TRUE@ XFONT_FC_FALSE = @XFONT_FC_FALSE@ XFONT_FC_TRUE = @XFONT_FC_TRUE@ XFONT_FONTCACHE_FALSE = @XFONT_FONTCACHE_FALSE@ diff --git a/lib/libXfont/src/builtins/Makefile.in b/lib/libXfont/src/builtins/Makefile.in index bd2e31524..761849cb7 100644 --- a/lib/libXfont/src/builtins/Makefile.in +++ b/lib/libXfont/src/builtins/Makefile.in @@ -134,8 +134,6 @@ XFONT_BITMAP_TRUE = @XFONT_BITMAP_TRUE@ XFONT_BUILTINS_FALSE = @XFONT_BUILTINS_FALSE@ XFONT_BUILTINS_TRUE = @XFONT_BUILTINS_TRUE@ XFONT_CFLAGS = @XFONT_CFLAGS@ -XFONT_CID_FALSE = @XFONT_CID_FALSE@ -XFONT_CID_TRUE = @XFONT_CID_TRUE@ XFONT_FC_FALSE = @XFONT_FC_FALSE@ XFONT_FC_TRUE = @XFONT_FC_TRUE@ XFONT_FONTCACHE_FALSE = @XFONT_FONTCACHE_FALSE@ diff --git a/lib/libXfont/src/fc/Makefile.in b/lib/libXfont/src/fc/Makefile.in index 4cbf441c8..8026425b4 100644 --- a/lib/libXfont/src/fc/Makefile.in +++ b/lib/libXfont/src/fc/Makefile.in @@ -134,8 +134,6 @@ XFONT_BITMAP_TRUE = @XFONT_BITMAP_TRUE@ XFONT_BUILTINS_FALSE = @XFONT_BUILTINS_FALSE@ XFONT_BUILTINS_TRUE = @XFONT_BUILTINS_TRUE@ XFONT_CFLAGS = @XFONT_CFLAGS@ -XFONT_CID_FALSE = @XFONT_CID_FALSE@ -XFONT_CID_TRUE = @XFONT_CID_TRUE@ XFONT_FC_FALSE = @XFONT_FC_FALSE@ XFONT_FC_TRUE = @XFONT_FC_TRUE@ XFONT_FONTCACHE_FALSE = @XFONT_FONTCACHE_FALSE@ diff --git a/lib/libXfont/src/fontcache/Makefile.in b/lib/libXfont/src/fontcache/Makefile.in index f1a9b8c99..db94d362d 100644 --- a/lib/libXfont/src/fontcache/Makefile.in +++ b/lib/libXfont/src/fontcache/Makefile.in @@ -136,8 +136,6 @@ XFONT_BITMAP_TRUE = @XFONT_BITMAP_TRUE@ XFONT_BUILTINS_FALSE = @XFONT_BUILTINS_FALSE@ XFONT_BUILTINS_TRUE = @XFONT_BUILTINS_TRUE@ XFONT_CFLAGS = @XFONT_CFLAGS@ -XFONT_CID_FALSE = @XFONT_CID_FALSE@ -XFONT_CID_TRUE = @XFONT_CID_TRUE@ XFONT_FC_FALSE = @XFONT_FC_FALSE@ XFONT_FC_TRUE = @XFONT_FC_TRUE@ XFONT_FONTCACHE_FALSE = @XFONT_FONTCACHE_FALSE@ diff --git a/lib/libXfont/src/fontfile/Makefile.in b/lib/libXfont/src/fontfile/Makefile.in index 15ec25cb2..459d5eaa2 100644 --- a/lib/libXfont/src/fontfile/Makefile.in +++ b/lib/libXfont/src/fontfile/Makefile.in @@ -138,8 +138,6 @@ XFONT_BITMAP_TRUE = @XFONT_BITMAP_TRUE@ XFONT_BUILTINS_FALSE = @XFONT_BUILTINS_FALSE@ XFONT_BUILTINS_TRUE = @XFONT_BUILTINS_TRUE@ XFONT_CFLAGS = @XFONT_CFLAGS@ -XFONT_CID_FALSE = @XFONT_CID_FALSE@ -XFONT_CID_TRUE = @XFONT_CID_TRUE@ XFONT_FC_FALSE = @XFONT_FC_FALSE@ XFONT_FC_TRUE = @XFONT_FC_TRUE@ XFONT_FONTCACHE_FALSE = @XFONT_FONTCACHE_FALSE@ diff --git a/lib/libXfont/src/stubs/Makefile.in b/lib/libXfont/src/stubs/Makefile.in index 868eae767..9707f7777 100644 --- a/lib/libXfont/src/stubs/Makefile.in +++ b/lib/libXfont/src/stubs/Makefile.in @@ -137,8 +137,6 @@ XFONT_BITMAP_TRUE = @XFONT_BITMAP_TRUE@ XFONT_BUILTINS_FALSE = @XFONT_BUILTINS_FALSE@ XFONT_BUILTINS_TRUE = @XFONT_BUILTINS_TRUE@ XFONT_CFLAGS = @XFONT_CFLAGS@ -XFONT_CID_FALSE = @XFONT_CID_FALSE@ -XFONT_CID_TRUE = @XFONT_CID_TRUE@ XFONT_FC_FALSE = @XFONT_FC_FALSE@ XFONT_FC_TRUE = @XFONT_FC_TRUE@ XFONT_FONTCACHE_FALSE = @XFONT_FONTCACHE_FALSE@ diff --git a/lib/libXfont/src/util/Makefile.in b/lib/libXfont/src/util/Makefile.in index 3b12134f1..1016abbaf 100644 --- a/lib/libXfont/src/util/Makefile.in +++ b/lib/libXfont/src/util/Makefile.in @@ -136,8 +136,6 @@ XFONT_BITMAP_TRUE = @XFONT_BITMAP_TRUE@ XFONT_BUILTINS_FALSE = @XFONT_BUILTINS_FALSE@ XFONT_BUILTINS_TRUE = @XFONT_BUILTINS_TRUE@ XFONT_CFLAGS = @XFONT_CFLAGS@ -XFONT_CID_FALSE = @XFONT_CID_FALSE@ -XFONT_CID_TRUE = @XFONT_CID_TRUE@ XFONT_FC_FALSE = @XFONT_FC_FALSE@ XFONT_FC_TRUE = @XFONT_FC_TRUE@ XFONT_FONTCACHE_FALSE = @XFONT_FONTCACHE_FALSE@ -- cgit v1.2.3