summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Liddell <chris.liddell@artifex.com>2011-07-20 14:48:55 +0100
committerChris Liddell <chris.liddell@artifex.com>2012-03-15 11:52:08 +0000
commit0374f7e3762ec2b2df89ff02ce896d7cd5122ab0 (patch)
treed95a9c19209651b24ec0c69331265b52ae894431
parent1c8d1c6bbd4579831ed3647d2ba55df4b4fda7a8 (diff)
Remove the eXternal Fonts functionality.
The XFonts feature was of very limited utility these days, and was deprecated a couple of releases ago. This commit removes the unloved and rather bit-rotten feature completely. This does not really "fix" Bug 692357, but renders it pointless. No cluster differences.
-rw-r--r--gs/base/devs.mak6
-rw-r--r--gs/base/gdevmac.c12
-rw-r--r--gs/base/gdevmac.h9
-rw-r--r--gs/base/gdevmacxf.c442
-rw-r--r--gs/base/gdevx.c7
-rw-r--r--gs/base/gdevx.h33
-rw-r--r--gs/base/gdevxini.c152
-rw-r--r--gs/base/gdevxres.c52
-rw-r--r--gs/base/gdevxxf.c507
-rw-r--r--gs/base/gxccache.c86
-rw-r--r--gs/base/gxccman.c97
-rw-r--r--gs/base/gxchar.c41
-rw-r--r--gs/base/gxchar.h3
-rw-r--r--gs/base/gxfcache.h2
-rw-r--r--gs/base/macos-mcp.mak3
-rw-r--r--gs/doc/Xfonts.htm3
16 files changed, 13 insertions, 1442 deletions
diff --git a/gs/base/devs.mak b/gs/base/devs.mak
index e680986e9..7569fdaec 100644
--- a/gs/base/devs.mak
+++ b/gs/base/devs.mak
@@ -453,7 +453,7 @@ gdevx_h=$(GLSRC)gdevx.h $(gdevbbox_h) $(gdevxcmp_h)
# See the main makefile for the definition of XLIBDIRS and XLIBS.
x11_=$(GLOBJ)gdevx.$(OBJ) $(GLOBJ)gdevxcmp.$(OBJ) $(GLOBJ)gdevxini.$(OBJ)\
- $(GLOBJ)gdevxres.$(OBJ) $(GLOBJ)gdevxxf.$(OBJ) $(GLOBJ)gsparamx.$(OBJ)
+ $(GLOBJ)gdevxres.$(OBJ) $(GLOBJ)gsparamx.$(OBJ)
$(DD)x11_.dev : $(DEVS_MAK) $(x11_) $(GLD)bboxutil.dev $(GDEV)
$(SETMOD) $(DD)x11_ $(x11_)
$(ADDMOD) $(DD)x11_ -link $(XLIBDIRS)
@@ -483,10 +483,6 @@ $(GLOBJ)gdevxres.$(OBJ) : $(GLSRC)gdevxres.c $(std_h) $(x__h)\
$(gsmemory_h) $(gstypes_h) $(gxdevice_h) $(gdevx_h)
$(CC_NO_WARN) $(GLCCFLAGS) $(XINCLUDE) $(GLO_)gdevxres.$(OBJ) $(C_) $(GLSRC)gdevxres.c
-$(GLOBJ)gdevxxf.$(OBJ) : $(GLSRC)gdevxxf.c $(GDEVX) $(math__h) $(memory__h)\
- $(gsstruct_h) $(gsutil_h) $(gxxfont_h)
- $(GLCCSHARED) $(XINCLUDE) $(GLO_)gdevxxf.$(OBJ) $(C_) $(GLSRC)gdevxxf.c
-
# Alternate X11-based devices to help debug other drivers.
# x11alpha pretends to have 4 bits of alpha channel.
# x11cmyk pretends to be a CMYK device with 1 bit each of C,M,Y,K.
diff --git a/gs/base/gdevmac.c b/gs/base/gdevmac.c
index dfa184db2..063a85060 100644
--- a/gs/base/gdevmac.c
+++ b/gs/base/gdevmac.c
@@ -39,7 +39,7 @@ gx_device_procs gs_mac_procs = {
mac_get_params, /* get_params */
mac_put_params, /* put_params */
NULL, /* map_cmyk_color */
- mac_get_xfont_procs, /* get_xfont_procs */
+ NULL, /* get_xfont_procs */
NULL, /* get_xfont_device */
NULL, /* map_rgb_alpha_color */
gx_page_device_get_page_device, /* get_page_device */
@@ -77,7 +77,6 @@ gx_device_macos gs_macos_device = {
NULL, /* PicHandle to "draw" into */
NULL, /* PicPtr */
false, /* outputPage */
- false, /* use XFont interface (render with local TrueType fonts) */
-1, /* lastFontFace */
-1, /* lastFontSize */
-1, /* lastFontID */
@@ -571,15 +570,9 @@ mac_put_params(gx_device *dev, gs_param_list *plist)
int isOpen = mdev->is_open;
int code;
- bool useXFonts;
int depth;
gs_param_string outputFile;
- // Get the UseExternalFonts Parameter
- code = param_read_bool(plist, "UseExternalFonts", &useXFonts);
- if (!code)
- mdev->useXFonts = useXFonts;
-
// Get the BitsPerPixel Parameter
code = param_read_int(plist, "BitsPerPixel", &depth);
if (!code) {
@@ -643,9 +636,6 @@ mac_get_params(gx_device *dev, gs_param_list *plist)
if (code < 0)
return code;
- // UseExternalFonts
- code = param_write_bool(plist, "UseExternalFonts", &(mdev->useXFonts));
-
// color depth
code = param_write_int(plist, "BitsPerPixel", &(mdev->color_info.depth));
diff --git a/gs/base/gdevmac.h b/gs/base/gdevmac.h
index e15e58991..3b06de5f5 100644
--- a/gs/base/gdevmac.h
+++ b/gs/base/gdevmac.h
@@ -58,7 +58,6 @@ typedef struct gx_device_macos_s
PicHandle pic;
short *currPicPos;
bool outputPage;
- bool useXFonts;
FMFontStyle lastFontFace;
FMFontSize lastFontSize;
FMFontFamily lastFontID;
@@ -83,14 +82,6 @@ dev_proc_copy_mono(mac_copy_mono);
dev_proc_copy_color(mac_copy_color);
dev_proc_draw_line(mac_draw_line);
dev_proc_copy_alpha(mac_copy_alpha);
-dev_proc_get_xfont_procs(mac_get_xfont_procs);
-
-/* Declare the xfont procedures */
-static xfont_proc_lookup_font(mac_lookup_font);
-static xfont_proc_char_xglyph(mac_char_xglyph);
-static xfont_proc_char_metrics(mac_char_metrics);
-static xfont_proc_render_char(mac_render_char);
-static xfont_proc_release(mac_release);
/* Define a MacOS xfont. */
diff --git a/gs/base/gdevmacxf.c b/gs/base/gdevmacxf.c
deleted file mode 100644
index 120120009..000000000
--- a/gs/base/gdevmacxf.c
+++ /dev/null
@@ -1,442 +0,0 @@
-/* Copyright (C) 2001-2006 Artifex Software, Inc.
- All Rights Reserved.
-
- This software is provided AS-IS with no warranty, either express or
- implied.
-
- This software is distributed under license and may not be copied, modified
- or distributed except as expressly authorized under the terms of that
- license. Refer to licensing information at http://www.artifex.com/
- or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134,
- San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
-*/
-/* $Id$ */
-/* External font (xfont) implementation for Classic/Carbon MacOS. */
-
-#include "gdevmac.h"
-#include "gdevmacttf.h"
-
-/* if set to 1, new carbon supported FontManager calls are used */
-/* if set to 0, old FM calls that are "not recommended" for carbon are used */
-/* for now, we'll set it to 0, as classic and carbon targets don't generate link errors, */
-/* but the carbon target would be better built with this macro set to 1 */
-/* In the case that it is set, the classic target should link in FontManager(Lib) */
-#define USE_RECOMMENDED_CARBON_FONTMANAGER_CALLS 1
-
-extern const byte gs_map_std_to_iso[256];
-extern const byte gs_map_iso_to_std[256];
-
-const byte gs_map_std_to_mac[256] =
-{
-/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */
-/* 0x */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 1x */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 2x */ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
-/* 3x */ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
-/* 4x */ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
-/* 5x */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
-/* 6x */ 0xD4, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
-/* 7x */ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
-/* 8x */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 9x */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* Ax */ 0x00, 0xC1, 0xA2, 0xA3, 0xDA, 0xB4, 0xC4, 0xA4, 0xDB, 0x27, 0xD2, 0xC7, 0xDC, 0xDD, 0xDE, 0xDF,
-/* Bx */ 0x00, 0xD0, 0xA0, 0xE0, 0xE1, 0x00, 0xA6, 0xA5, 0xE2, 0xE3, 0xD3, 0xC8, 0xC9, 0xE4, 0x00, 0xC0,
-/* Cx */ 0x00, 0x60, 0xAB, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xAC, 0x00, 0xFB, 0xFC, 0x00, 0xFD, 0xFE, 0xFF,
-/* Dx */ 0xD1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* Ex */ 0x00, 0xAE, 0x00, 0xBB, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAF, 0xCE, 0xBC, 0x00, 0x00, 0x00, 0x00,
-/* Fx */ 0x00, 0xBE, 0x00, 0x00, 0x00, 0xF5, 0x00, 0x00, 0x00, 0xBF, 0xCF, 0xA7, 0x00, 0x00, 0x00, 0x00
-};
-
-const byte gs_map_mac_to_std[256] =
-{
-};
-
-const byte gs_map_iso_to_mac[256] =
-{
-/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */
-/* 0x */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 1x */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 2x */ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
-/* 3x */ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
-/* 4x */ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
-/* 5x */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
-/* 6x */ 0xD4, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
-/* 7x */ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
-/* 8x */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 9x */ 0xF5, 0x60, 0xAB, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xAC, 0x00, 0xFB, 0xFC, 0x00, 0xFD, 0xFE, 0xFF,
-/* Ax */ 0x00, 0xC1, 0xA2, 0xA3, 0xDB, 0xB4, 0x00, 0xA4, 0xAC, 0xA9, 0xBB, 0xC7, 0xC2, 0x2D, 0xA8, 0xF8,
-/* Bx */ 0xA1, 0xB1, 0x00, 0x00, 0xAB, 0xB5, 0xA6, 0xE1, 0xFC, 0x00, 0xBC, 0xC8, 0x00, 0x00, 0x00, 0xC0,
-/* Cx */ 0xCB, 0xE7, 0xE5, 0xCC, 0x80, 0x81, 0xAE, 0x82, 0xE9, 0x83, 0xE6, 0xE8, 0xEA, 0xED, 0xEB, 0xEC,
-/* Dx */ 0x00, 0x84, 0xF1, 0xEE, 0xEF, 0xCD, 0x85, 0x00, 0xAF, 0xF4, 0xF2, 0xF3, 0x86, 0x00, 0x00, 0xA7,
-/* Ex */ 0x88, 0x87, 0x89, 0x8B, 0x8A, 0x8C, 0xBE, 0x8D, 0x8F, 0x8E, 0x90, 0x91, 0x93, 0x92, 0x94, 0x95,
-/* Fx */ 0x00, 0x96, 0x98, 0x97, 0x99, 0x9B, 0x9A, 0xD6, 0xBF, 0x9D, 0x9C, 0x9E, 0x9F, 0x00, 0x00, 0xD8
-};
-
-const byte gs_map_mac_to_iso[256] =
-{
-};
-
-/* The xfont procedure record. */
-
-static const gx_xfont_procs mac_xfont_procs =
-{
- mac_lookup_font,
- mac_char_xglyph,
- mac_char_metrics,
- mac_render_char,
- mac_release
-};
-
-gs_private_st_dev_ptrs1(st_mac_xfont, mac_xfont, "mac_xfont", mac_xfont_enum_ptrs,
- mac_xfont_reloc_ptrs, dev);
-
-/* Return the xfont procedure record. */
-
-const gx_xfont_procs *
-mac_get_xfont_procs(gx_device *dev)
-{
-#pragma unused(dev)
- return &mac_xfont_procs;
-}
-
-/* lookup_font */
-
-static gx_xfont *
-mac_lookup_font(gx_device *dev, const byte *fname, uint len,
- int encoding_index, const gs_uid *puid,
- const gs_matrix *pmat, gs_memory_t *mem)
-{
-#pragma unused(encoding_index,puid)
- mac_xfont *macxf;
-
- CGrafPort *currentPort;
- int txFont, txSize, txMode;
- StyleField txFace;
- Fixed spExtra;
-
- /* are XFonts enabled? */
- if (((gx_device_macos*) dev)->useXFonts == false)
- return NULL;
-
- /* we can handle only requests from these encodings */
- if (encoding_index != ENCODING_INDEX_MACROMAN && encoding_index != ENCODING_INDEX_ISOLATIN1 &&
- encoding_index != ENCODING_INDEX_STANDARD)
- return NULL;
-
- /* Don't render very small fonts */
- if (fabs(pmat->xx * 1000.0) < 3.0)
- return NULL;
-
- /* Only handle simple cases for now (no transformations). */
- if (fabs(pmat->xy) > 0.0001 || fabs(pmat->yx) > 0.0001 || pmat->xx <= 0)
- return NULL;
-
- /* allocate memory for gx_xfont */
- macxf = gs_alloc_struct(mem, mac_xfont, &st_mac_xfont, "mac_lookup_font");
- if (macxf == NULL) {
- return NULL;
- }
-
- /* set default values */
- macxf->common.procs = &mac_xfont_procs;
- macxf->dev = dev;
-
- /* find the specified font */
- mac_find_font_family(fname, len, &(macxf->fontID), &(macxf->fontFace));
-
- /* no font found */
- if (macxf->fontID == 0)
- return NULL;
-
- FMGetFontFamilyName(macxf->fontID, macxf->fontName);
- macxf->fontSize = (short)(pmat->xx * 1000.0);
- macxf->fontEncoding = mac_get_font_encoding(macxf);
-
- /* we can handle only fonts with these encodings for now (all original Mac fonts have MacRoman encoding!) */
- if (macxf->fontEncoding != ENCODING_INDEX_MACROMAN && macxf->fontEncoding != ENCODING_INDEX_ISOLATIN1)
- return NULL;
-
- /* get font metrics */
-
- /* save current GrafPort's font information */
- GetPort(&((GrafPort*) currentPort));
- txFont = currentPort->txFont;
- txSize = currentPort->txSize;
- txFace = currentPort->txFace;
- txMode = currentPort->txMode;
- spExtra = currentPort->spExtra;
-
- /* set values for measuring */
- TextFont(macxf->fontID);
- TextSize(macxf->fontSize);
- TextFace(macxf->fontFace);
- TextMode(srcOr);
- SpaceExtra(0);
-
- /* measure font */
- FontMetrics(&(macxf->fontMetrics));
-
- /* restore current GrafPort's font information */
- currentPort->txFont = txFont;
- currentPort->txSize = txSize;
- currentPort->txFace = txFace;
- currentPort->txMode = txMode;
- currentPort->spExtra = spExtra;
-
- return (gx_xfont*) macxf;
-}
-
-/* char_xglyph */
-
-static gx_xglyph
-mac_char_xglyph(gx_xfont *xf, gs_char chr, int encoding_index,
- gs_glyph glyph, const gs_const_string *glyph_name)
-{
-#pragma unused(glyph_name,glyph)
- mac_xfont * macxf = (mac_xfont*) xf;
-
- /* can't look up names yet */
- if (chr == gs_no_char)
- return gx_no_xglyph;
-
- if (macxf->fontEncoding == ENCODING_INDEX_MACROMAN) {
- switch (encoding_index) {
- case ENCODING_INDEX_MACROMAN: return chr;
- case ENCODING_INDEX_STANDARD: return gs_map_std_to_mac[chr];
- case ENCODING_INDEX_ISOLATIN1: return gs_map_iso_to_mac[chr];
- }
- } else if (macxf->fontEncoding == ENCODING_INDEX_ISOLATIN1) {
- switch (encoding_index) {
- case ENCODING_INDEX_MACROMAN: return gs_map_mac_to_iso[chr];
- case ENCODING_INDEX_STANDARD: return gs_map_std_to_iso[chr];
- case ENCODING_INDEX_ISOLATIN1: return chr;
- }
- }
-
- return gx_no_xglyph;
-}
-
-/* char_metrics */
-
-static int
-mac_char_metrics(gx_xfont *xf, gx_xglyph xg, int wmode,
- gs_point *pwidth, gs_int_rect *pbbox)
-{
-#pragma unused(xg)
- mac_xfont * macxf = (mac_xfont*) xf;
-
- if (wmode != 0)
- return gs_error_undefined;
-
- pbbox->p.x = 0;
- pbbox->q.x = Fix2Long(macxf->fontMetrics.widMax);
- pbbox->p.y = -Fix2Long(macxf->fontMetrics.ascent);
- pbbox->q.y = Fix2Long(macxf->fontMetrics.descent);
- pwidth->x = pbbox->q.x;
- pwidth->y = 0.0;
-
- return 0;
-}
-
-/* render_char */
-
-static int
-mac_render_char(gx_xfont *xf, gx_xglyph xg, gx_device *dev,
- int xo, int yo, gx_color_index color, int required)
-{
-#pragma unused(dev,required)
- mac_xfont * macxf = (mac_xfont*) xf;
- gx_device_macos * mdev = (gx_device_macos*) macxf->dev;
-
- Str255 character;
- int i, found;
-
- CheckMem(10*1024, 100*1024);
- ResetPage();
-
- character[0] = 1;
- character[1] = xg;
-
- GSSetFgCol(macxf->dev, mdev->currPicPos, color);
-
- found = 0;
- for (i=0; i<mdev->numUsedFonts; i++)
- if (mdev->usedFontIDs[i] == macxf->fontID) found = 1;
-
- if (!found) {
- mdev->usedFontIDs[mdev->numUsedFonts++] = macxf->fontID;
- PICT_fontName(mdev->currPicPos, macxf->fontID, macxf->fontName);
- }
- if (mdev->lastFontID != macxf->fontID) {
- PICT_TxFont(mdev->currPicPos, macxf->fontID);
- mdev->lastFontID = macxf->fontID;
- }
- if (mdev->lastFontSize != macxf->fontSize) {
- PICT_TxSize(mdev->currPicPos, macxf->fontSize);
- mdev->lastFontSize = macxf->fontSize;
- }
- if (mdev->lastFontFace != macxf->fontFace) {
- PICT_TxFace(mdev->currPicPos, macxf->fontFace);
- mdev->lastFontFace = macxf->fontFace;
- }
- PICT_LongText(mdev->currPicPos, xo, yo, character);
- PICT_OpEndPicGoOn(mdev->currPicPos);
-
- return 0;
-}
-
-/* release */
-
-static int
-mac_release(gx_xfont *xf, gs_memory_t *mem)
-{
- if (mem != NULL)
- gs_free_object(mem, xf, "mac_release");
-
- return 0;
-}
-
-/* try to extract font family and style from name and find a suitable font */
-
-static void
-mac_find_font_family(ConstStringPtr fname, int len, FMFontFamily *fontID, FMFontStyle *fontFace)
-{
- char fontNameStr[512];
- char *fontFamilyName;
- char *fontStyleName;
- int i;
-
- *fontID = 0;
- *fontFace = 0;
-
- /* first try the full fontname */
- fontNameStr[0] = len;
- memcpy(fontNameStr+1, fname, len);
- *fontID = FMGetFontFamilyFromName((StringPtr) fontNameStr);
- if (*fontID > 0) return;
-
- /* try to find the font without the dashes */
- fontNameStr[0] = len;
- memcpy(fontNameStr+1, fname, len);
- for (i=1; i<=len; i++)
- if (fontNameStr[i] == '-') fontNameStr[i] = ' ';
- *fontID = FMGetFontFamilyFromName((StringPtr) fontNameStr);
- if (*fontID > 0) return;
-
- /* we should read some default fontname mappings from a file here */
- if (*fontID > 0) return;
-
- /* try to extract font basename and style names */
- memcpy(fontNameStr, fname, len);
- fontNameStr[len] = 0;
-
- fontFamilyName = strtok(fontNameStr, "- ");
- while ((fontStyleName = strtok(NULL, "- ")) != NULL) {
- if (!strcmp(fontStyleName, "Italic") || !strcmp(fontStyleName, "Oblique") || !strcmp(fontStyleName, "It"))
- *fontFace |= italic;
- if (!strcmp(fontStyleName, "Bold") || !strcmp(fontStyleName, "Bd"))
- *fontFace |= bold;
- if (!strcmp(fontStyleName, "Narrow") || !strcmp(fontStyleName, "Condensed"))
- *fontFace |= condense;
- }
-
- if (fontFamilyName == NULL) {
- return;
- } else {
- Str255 fontName;
-
- fontName[0] = strlen(fontFamilyName);
- strcpy((char*)(fontName+1), fontFamilyName);
- *fontID = FMGetFontFamilyFromName((StringPtr) fontNameStr);
- if (*fontID > 0) return;
- }
-}
-
-/* extract a font's platform id (encoding) */
-
-static int
-mac_get_font_encoding(mac_xfont *macxf)
-{
- int encoding = ENCODING_INDEX_UNKNOWN;
- ResType resType;
- short resID;
-
- mac_get_font_resource(macxf, &resType, &resID);
-
- if (resType == 'sfnt') {
- Handle fontHandle;
- TTFontDir *fontDir;
- TTFontNamingTable *fontNamingTable;
- int i;
-
- /* load resource */
- if ((fontHandle = GetResource(resType, resID)) == NULL)
- return encoding;
- HLock(fontHandle);
-
- /* walk through the font directory and find the font naming table */
- fontDir = (TTFontDir*) *fontHandle;
- if (fontDir != NULL && fontDir->version == 'true') {
- for (i=0; i<fontDir->numTables; i++) {
- if (fontDir->components[i].tagName == TTF_FONT_NAMING_TABLE) {
- fontNamingTable = (TTFontNamingTable*) ((long)(fontDir->components[i].offset) + (long)fontDir);
- switch (fontNamingTable->platformID) {
- //case 0: encoding = ENCODING_INDEX_STANDARD; break; /* Unicode */
- case 1: encoding = ENCODING_INDEX_MACROMAN; break;
- case 2: encoding = ENCODING_INDEX_ISOLATIN1; break;
- //case 3: encoding = ENCODING_INDEX_WINANSI; break;
- }
- break;
- }
- }
- }
-
- HUnlock(fontHandle);
- ReleaseResource(fontHandle);
- }
-
- return encoding;
-}
-
-/* get a handle to a font resource */
-
-static void
-mac_get_font_resource(mac_xfont *macxf, ResType *resType, short *resID)
-{
- FMInput fontInput = {0, 0, 0, true, 0, {1,1}, {1,1}};
- FMOutputPtr fontOutput;
-
- Str255 resName;
-
- fontInput.family = macxf->fontID;
- fontInput.size = macxf->fontSize;
- fontInput.face = macxf->fontFace;
-
- fontOutput = FMSwapFont(&fontInput);
-
- if (fontOutput == NULL || fontOutput->fontHandle == NULL)
- return;
-
- GetResInfo(fontOutput->fontHandle, resID, resType, resName);
-}
-
-#if !USE_RECOMMENDED_CARBON_FONTMANAGER_CALLS
-/* wrap the old Classic MacOS font manager calls to fake support for the
- new FontManager API on older systems */
-
-OSStatus
-FMGetFontFamilyName(FMFontFamily fontFamilyID, Str255 fontNameStr)
-{
- GetFontName(fontFamilyID, fontNameStr);
- return noErr;
-}
-
-FMFontFamily
-FMGetFontFamilyFromName(ConstStr255Param fontNameStr)
-{
- int fontID;
- GetFNum(fontNameStr, &fontID);
-
- return (FMFontFamily)fontID;
-}
-#endif
diff --git a/gs/base/gdevx.c b/gs/base/gdevx.c
index d8b91ad44..2ca854307 100644
--- a/gs/base/gdevx.c
+++ b/gs/base/gdevx.c
@@ -67,7 +67,6 @@ static dev_proc_copy_mono(x_copy_mono);
static dev_proc_copy_color(x_copy_color);
/*extern dev_proc_get_params(gdev_x_get_params);*/
/*extern dev_proc_put_params(gdev_x_put_params);*/
-/*extern dev_proc_get_xfont_procs(gdev_x_get_xfont_procs);*/
static dev_proc_get_page_device(x_get_page_device);
static dev_proc_strip_tile_rectangle(x_strip_tile_rectangle);
static dev_proc_begin_typed_image(x_begin_typed_image);
@@ -95,7 +94,7 @@ const gx_device_X this_device = { \
gdev_x_get_params, \
gdev_x_put_params, \
NULL, /* map_cmyk_color */ \
- gdev_x_get_xfont_procs, \
+ NULL, \
NULL, /* get_xfont_device */ \
NULL, /* map_rgb_alpha_color */ \
x_get_page_device, \
@@ -191,10 +190,6 @@ const gx_device_X this_device = { \
NULL, /* geometry */ \
128, 5, /* maxGrayRamp, maxRGBRamp */ \
NULL, /* palette */ \
- NULL, NULL, NULL, /* regularFonts, symbolFonts, dingbatFonts */ \
- NULL, NULL, NULL, /* regular_fonts, symbol_fonts, dingbat_fonts */ \
- 1, 1, /* useXFonts, useFontExtensions */ \
- 1, 0, /* useScalableFonts, logXFonts */ \
0.0, 0.0, /* xResolution, yResolution */ \
1, /* useBackingPixmap */ \
1, 1, /* useXPutImage, useXSetTile */ \
diff --git a/gs/base/gdevx.h b/gs/base/gdevx.h
index f7350f935..ad9954bef 100644
--- a/gs/base/gdevx.h
+++ b/gs/base/gdevx.h
@@ -29,26 +29,6 @@ extern XtResource gdev_x_resources[];
extern const int gdev_x_resource_count;
extern String gdev_x_fallback_resources[];
-/* Define PostScript to X11 font name mapping */
-/*
- * x11fontlist is only used within x11fontmap.
- * The names array is managed by Xlib, so the structure is simple.
- */
-typedef struct x11fontlist_s {
- char **names;
- int count;
-} x11fontlist;
-typedef struct x11fontmap_s x11fontmap;
-struct x11fontmap_s {
- char *ps_name;
- char *x11_name;
- x11fontlist std, iso;
- x11fontmap *next;
-};
-#define private_st_x11fontmap() /* in gdevxini.c */\
- gs_private_st_ptrs3(st_x11fontmap, x11fontmap, "x11fontmap",\
- x11fontmap_enum_ptrs, x11fontmap_reloc_ptrs, ps_name, x11_name, next)
-
/* Define the X Windows device */
typedef struct gx_device_X_s {
gx_device_bbox_common; /* if target != 0, is image buffer */
@@ -168,13 +148,6 @@ typedef struct gx_device_X_s {
String geometry;
int maxGrayRamp, maxRGBRamp;
String palette;
- String regularFonts;
- String symbolFonts;
- String dingbatFonts;
- x11fontmap *regular_fonts;
- x11fontmap *symbol_fonts;
- x11fontmap *dingbat_fonts;
- Boolean useXFonts, useFontExtensions, useScalableFonts, logXFonts;
float xResolution, yResolution;
/* Flags work around various X server problems. */
@@ -234,10 +207,9 @@ typedef struct gx_device_X_s {
} gx_device_X;
#define private_st_device_X() /* in gdevx.c */\
- gs_public_st_suffix_add4_final(st_device_X, gx_device_X,\
+ gs_public_st_suffix_add1_final(st_device_X, gx_device_X,\
"gx_device_X", device_x_enum_ptrs, device_x_reloc_ptrs,\
- gx_device_finalize, st_device_bbox, buffer, regular_fonts,\
- symbol_fonts, dingbat_fonts)
+ gx_device_finalize, st_device_bbox, buffer)
/* Send an event to the Ghostview process */
void gdev_x_send_event(gx_device_X *xdev, Atom msg);
@@ -266,7 +238,6 @@ dev_proc_map_rgb_color(gdev_x_map_rgb_color); /* gdevxcmp.c */
dev_proc_map_color_rgb(gdev_x_map_color_rgb); /* gdevxcmp.c */
dev_proc_get_params(gdev_x_get_params); /* gdevxini.c */
dev_proc_put_params(gdev_x_put_params); /* gdevxini.c */
-dev_proc_get_xfont_procs(gdev_x_get_xfont_procs); /* gdevxxf.c */
dev_proc_finish_copydevice(gdev_x_finish_copydevice); /* gdevxini.c */
#endif /* gdevx_INCLUDED */
diff --git a/gs/base/gdevxini.c b/gs/base/gdevxini.c
index 6af436219..487de70bd 100644
--- a/gs/base/gdevxini.c
+++ b/gs/base/gdevxini.c
@@ -39,13 +39,9 @@ typedef enum {
Seascape = 270 /* Landscape rotated the wrong way */
} orientation;
-/* GC descriptors */
-private_st_x11fontmap();
-
/* ---------------- Opening/initialization ---------------- */
/* Forward references */
-static void gdev_x_setup_fontmap(gx_device_X *);
static void x_get_work_area(gx_device_X *xdev, int *pwidth, int *pheight);
static long *x_get_win_property(gx_device_X *xdev, const char *atom_name);
@@ -308,8 +304,6 @@ gdev_x_open(gx_device_X * xdev)
/* Now that the color map is setup check if the device is separable. */
check_device_separable((gx_device *)xdev);
- gdev_x_setup_fontmap(xdev);
-
if (!xdev->ghostview) {
XWMHints wm_hints;
XSetWindowAttributes xswa;
@@ -735,125 +729,6 @@ gdev_x_clear_window(gx_device_X * xdev)
xdev->colors_or = xdev->colors_and = xdev->background;
}
-/* ------ Initialize font mapping ------ */
-
-/* Extract the PostScript font name from the font map resource. */
-static const char *
-get_ps_name(const char **cpp, int *len)
-{
- const char *ret;
-
- *len = 0;
- /* skip over whitespace and newlines */
- while (**cpp == ' ' || **cpp == '\t' || **cpp == '\n') {
- (*cpp)++;
- }
- /* return font name up to ":", whitespace, or end of string */
- if (**cpp == ':' || **cpp == '\0') {
- return NULL;
- }
- ret = *cpp;
- while (**cpp != ':' &&
- **cpp != ' ' && **cpp != '\t' && **cpp != '\n' &&
- **cpp != '\0') {
- (*cpp)++;
- (*len)++;
- }
- return ret;
-}
-
-/* Extract the X11 font name from the font map resource. */
-static const char *
-get_x11_name(const char **cpp, int *len)
-{
- const char *ret;
- int dashes = 0;
-
- *len = 0;
- /* skip over whitespace and the colon */
- while (**cpp == ' ' || **cpp == '\t' ||
- **cpp == ':') {
- (*cpp)++;
- }
- /* return font name up to end of line or string */
- if (**cpp == '\0' || **cpp == '\n') {
- return NULL;
- }
- ret = *cpp;
- while (dashes != 7 &&
- **cpp != '\0' && **cpp != '\n') {
- if (**cpp == '-')
- dashes++;
- (*cpp)++;
- (*len)++;
- }
- while (**cpp != '\0' && **cpp != '\n') {
- (*cpp)++;
- }
- if (dashes != 7)
- return NULL;
- return ret;
-}
-
-/* Scan one resource and build font map records. */
-static void
-scan_font_resource(const char *resource, x11fontmap **pmaps, gs_memory_t *mem)
-{
- const char *ps_name;
- const char *x11_name;
- int ps_name_len;
- int x11_name_len;
- x11fontmap *font;
- const char *cp = resource;
-
- while ((ps_name = get_ps_name(&cp, &ps_name_len)) != 0) {
- x11_name = get_x11_name(&cp, &x11_name_len);
- if (x11_name) {
- font = gs_alloc_struct(mem, x11fontmap, &st_x11fontmap,
- "scan_font_resource(font)");
- if (font == NULL)
- continue;
- font->ps_name = (char *)
- gs_alloc_byte_array(mem, ps_name_len + 1, sizeof(char),
- "scan_font_resource(ps_name)");
- if (font->ps_name == NULL) {
- gs_free_object(mem, font, "scan_font_resource(font)");
- continue;
- }
- strncpy(font->ps_name, ps_name, ps_name_len);
- font->ps_name[ps_name_len] = '\0';
- font->x11_name = (char *)
- gs_alloc_byte_array(mem, x11_name_len, sizeof(char),
- "scan_font_resource(x11_name)");
- if (font->x11_name == NULL) {
- gs_free_object(mem, font->ps_name,
- "scan_font_resource(ps_name)");
- gs_free_object(mem, font, "scan_font_resource(font)");
- continue;
- }
- strncpy(font->x11_name, x11_name, x11_name_len - 1);
- font->x11_name[x11_name_len - 1] = '\0';
- font->std.names = NULL;
- font->std.count = -1;
- font->iso.names = NULL;
- font->iso.count = -1;
- font->next = *pmaps;
- *pmaps = font;
- }
- }
-}
-
-/* Scan all the font resources and set up the maps. */
-static void
-gdev_x_setup_fontmap(gx_device_X * xdev)
-{
- if (!xdev->useXFonts)
- return; /* If no external fonts, don't bother */
-
- scan_font_resource(xdev->regularFonts, &xdev->regular_fonts, xdev->memory);
- scan_font_resource(xdev->symbolFonts, &xdev->symbol_fonts, xdev->memory);
- scan_font_resource(xdev->dingbatFonts, &xdev->dingbat_fonts, xdev->memory);
-}
/* Clean up the instance after making a copy. */
int
@@ -864,11 +739,6 @@ gdev_x_finish_copydevice(gx_device *dev, const gx_device *from_dev)
/* Mark the new instance as closed. */
xdev->is_open = false;
- /* Prevent dangling references from the *_fonts lists. */
- xdev->regular_fonts = 0;
- xdev->symbol_fonts = 0;
- xdev->dingbat_fonts = 0;
-
/* Clear all other pointers. */
xdev->target = 0;
xdev->buffer = 0;
@@ -1048,25 +918,6 @@ gdev_x_put_params(gx_device * dev, gs_param_list * plist)
}
/* ---------------- Closing/finalization ---------------- */
-
-/* Free fonts when closing the device. */
-static void
-free_x_fontmaps(x11fontmap **pmaps, gs_memory_t *mem)
-{
- while (*pmaps) {
- x11fontmap *font = *pmaps;
-
- *pmaps = font->next;
- if (font->std.names)
- XFreeFontNames(font->std.names);
- if (font->iso.names)
- XFreeFontNames(font->iso.names);
- gs_free_object(mem, font->x11_name, "free_x_fontmaps(x11_name)");
- gs_free_object(mem, font->ps_name, "free_x_fontmaps(ps_name)");
- gs_free_object(mem, font, "free_x_fontmaps(font)");
- }
-}
-
/* Close the device. */
int
gdev_x_close(gx_device_X *xdev)
@@ -1078,9 +929,6 @@ gdev_x_close(gx_device_X *xdev)
xdev->vinfo = NULL;
}
gdev_x_free_colors(xdev);
- free_x_fontmaps(&xdev->dingbat_fonts, xdev->memory);
- free_x_fontmaps(&xdev->symbol_fonts, xdev->memory);
- free_x_fontmaps(&xdev->regular_fonts, xdev->memory);
if (xdev->cmap != DefaultColormapOfScreen(xdev->scr))
XFreeColormap(xdev->dpy, xdev->cmap);
XCloseDisplay(xdev->dpy);
diff --git a/gs/base/gdevxres.c b/gs/base/gdevxres.c
index 3d4a5ed0c..d4d2fd0fa 100644
--- a/gs/base/gdevxres.c
+++ b/gs/base/gdevxres.c
@@ -52,65 +52,13 @@ XtResource gdev_x_resources[] = {
rpix(XtNbackground, XtCBackground, background, "XtDefaultBackground"),
rpix(XtNborderColor, XtCBorderColor, borderColor, "XtDefaultForeground"),
rdim(XtNborderWidth, XtCBorderWidth, borderWidth, 1),
- rstr("dingbatFonts", "DingbatFonts", dingbatFonts,
- "ZapfDingbats: -Adobe-ITC Zapf Dingbats-Medium-R-Normal--"),
rpix(XtNforeground, XtCForeground, foreground, "XtDefaultForeground"),
rstr(XtNgeometry, XtCGeometry, geometry, NULL),
- rbool("logExternalFonts", "LogExternalFonts", logXFonts, False),
rint("maxGrayRamp", "MaxGrayRamp", maxGrayRamp, 128),
rint("maxRGBRamp", "MaxRGBRamp", maxRGBRamp, 5),
rstr("palette", "Palette", palette, "Color"),
- /*
- * I had to compress the whitespace out of the default string to
- * satisfy certain balky compilers.
- */
- rstr("regularFonts", "RegularFonts", regularFonts, "\
-AvantGarde-Book:-Adobe-ITC Avant Garde Gothic-Book-R-Normal--\n\
-AvantGarde-BookOblique:-Adobe-ITC Avant Garde Gothic-Book-O-Normal--\n\
-AvantGarde-Demi:-Adobe-ITC Avant Garde Gothic-Demi-R-Normal--\n\
-AvantGarde-DemiOblique:-Adobe-ITC Avant Garde Gothic-Demi-O-Normal--\n\
-Bookman-Demi:-Adobe-ITC Bookman-Demi-R-Normal--\n\
-Bookman-DemiItalic:-Adobe-ITC Bookman-Demi-I-Normal--\n\
-Bookman-Light:-Adobe-ITC Bookman-Light-R-Normal--\n\
-Bookman-LightItalic:-Adobe-ITC Bookman-Light-I-Normal--\n\
-Courier:-Adobe-Courier-Medium-R-Normal--\n\
-Courier-Bold:-Adobe-Courier-Bold-R-Normal--\n\
-Courier-BoldOblique:-Adobe-Courier-Bold-O-Normal--\n\
-Courier-Oblique:-Adobe-Courier-Medium-O-Normal--\n\
-Helvetica:-Adobe-Helvetica-Medium-R-Normal--\n\
-Helvetica-Bold:-Adobe-Helvetica-Bold-R-Normal--\n\
-Helvetica-BoldOblique:-Adobe-Helvetica-Bold-O-Normal--\n\
-Helvetica-Narrow:-Adobe-Helvetica-Medium-R-Narrow--\n\
-Helvetica-Narrow-Bold:-Adobe-Helvetica-Bold-R-Narrow--\n\
-Helvetica-Narrow-BoldOblique:-Adobe-Helvetica-Bold-O-Narrow--\n\
-Helvetica-Narrow-Oblique:-Adobe-Helvetica-Medium-O-Narrow--\n\
-Helvetica-Oblique:-Adobe-Helvetica-Medium-O-Normal--\n\
-NewCenturySchlbk-Bold:-Adobe-New Century Schoolbook-Bold-R-Normal--\n\
-NewCenturySchlbk-BoldItalic:-Adobe-New Century Schoolbook-Bold-I-Normal--\n\
-NewCenturySchlbk-Italic:-Adobe-New Century Schoolbook-Medium-I-Normal--\n\
-NewCenturySchlbk-Roman:-Adobe-New Century Schoolbook-Medium-R-Normal--\n\
-Palatino-Bold:-Adobe-Palatino-Bold-R-Normal--\n\
-Palatino-BoldItalic:-Adobe-Palatino-Bold-I-Normal--\n\
-Palatino-Italic:-Adobe-Palatino-Medium-I-Normal--\n\
-Palatino-Roman:-Adobe-Palatino-Medium-R-Normal--\n\
-Times-Bold:-Adobe-Times-Bold-R-Normal--\n\
-Times-BoldItalic:-Adobe-Times-Bold-I-Normal--\n\
-Times-Italic:-Adobe-Times-Medium-I-Normal--\n\
-Times-Roman:-Adobe-Times-Medium-R-Normal--\n\
-Utopia-Bold:-Adobe-Utopia-Bold-R-Normal--\n\
-Utopia-BoldItalic:-Adobe-Utopia-Bold-I-Normal--\n\
-Utopia-Italic:-Adobe-Utopia-Regular-I-Normal--\n\
-Utopia-Regular:-Adobe-Utopia-Regular-R-Normal--\n\
-ZapfChancery-MediumItalic:-Adobe-ITC Zapf Chancery-Medium-I-Normal--"),
-
- rstr("symbolFonts", "SymbolFonts", symbolFonts,
- "Symbol: -Adobe-Symbol-Medium-R-Normal--"),
-
rbool("useBackingPixmap", "UseBackingPixmap", useBackingPixmap, True),
- rbool("useExternalFonts", "UseExternalFonts", useXFonts, True),
- rbool("useFontExtensions", "UseFontExtensions", useFontExtensions, True),
- rbool("useScalableFonts", "UseScalableFonts", useScalableFonts, True),
rbool("useXPutImage", "UseXPutImage", useXPutImage, True),
rbool("useXSetTile", "UseXSetTile", useXSetTile, True),
rfloat("xResolution", "Resolution", xResolution, "0.0"),
diff --git a/gs/base/gdevxxf.c b/gs/base/gdevxxf.c
deleted file mode 100644
index 01d1d41f6..000000000
--- a/gs/base/gdevxxf.c
+++ /dev/null
@@ -1,507 +0,0 @@
-/* Copyright (C) 2001-2006 Artifex Software, Inc.
- All Rights Reserved.
-
- This software is provided AS-IS with no warranty, either express or
- implied.
-
- This software is distributed under license and may not be copied, modified
- or distributed except as expressly authorized under the terms of that
- license. Refer to licensing information at http://www.artifex.com/
- or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134,
- San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
-*/
-
-/* $Id$ */
-/* External font (xfont) implementation for X11. */
-#include "math_.h"
-#include "memory_.h"
-#include "x_.h"
-#include "gx.h"
-#include "gxdevice.h"
-#include "gdevx.h"
-#include "gsstruct.h"
-#include "gsutil.h"
-#include "gserrors.h"
-#include "gxxfont.h"
-
-/* Define the smallest point size that we trust X to render reasonably well. */
-#define min_X_font_size 6
-/* Define the largest point size where X will do a better job than we can. */
-#define max_X_font_size 35
-
-extern gx_device_X gs_x11_device;
-
-/* duplicated from gdevemap.c so that this can build as dynamic */
-/* Mappings between StandardEncoding and ISOLatin1Encoding */
-const byte gs_map_std_to_iso[256] =
-{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 173, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
-112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 161, 162, 163, 0, 165, 0, 167, 164, 0, 0, 171, 0, 0, 0, 0,
- 0, 0, 0, 0, 183, 0, 182, 0, 0, 0, 0, 187, 0, 0, 0, 191,
- 0, 145, 180, 147, 148, 175, 150, 151, 168, 0, 154, 184, 0, 157, 158, 159,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 198, 0, 170, 0, 0, 0, 0, 0, 216, 0, 186, 0, 0, 0, 0,
- 0, 230, 0, 0, 0, 144, 0, 0, 0, 248, 0, 223, 0, 0, 0, 0
-};
-
-const byte gs_map_iso_to_std[256] =
-{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 0, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
-112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 245, 193, 194, 195, 196, 197, 198, 199, 200, 0, 202, 203, 0, 205, 206, 207,
- 32, 161, 162, 163, 168, 165, 0, 167, 200, 0, 227, 171, 0, 45, 0, 197,
- 0, 0, 0, 0, 194, 0, 182, 180, 203, 0, 235, 187, 0, 0, 0, 191,
- 0, 0, 0, 0, 0, 0, 225, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 233, 0, 0, 0, 0, 0, 0, 251,
- 0, 0, 0, 0, 0, 0, 241, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 249, 0, 0, 0, 0, 0, 0, 0
-};
-
-/* Declare the xfont procedures */
-static xfont_proc_lookup_font(x_lookup_font);
-static xfont_proc_char_xglyph(x_char_xglyph);
-static xfont_proc_char_metrics(x_char_metrics);
-static xfont_proc_render_char(x_render_char);
-static xfont_proc_release(x_release);
-static const gx_xfont_procs x_xfont_procs =
-{
- x_lookup_font,
- x_char_xglyph,
- x_char_metrics,
- x_render_char,
- x_release
-};
-
-/* Return the xfont procedure record. */
-const gx_xfont_procs *
-gdev_x_get_xfont_procs(gx_device * dev)
-{
- return &x_xfont_procs;
-}
-
-/* Define a X11 xfont. */
-typedef struct x_xfont_s x_xfont;
-struct x_xfont_s {
- gx_xfont_common common;
- gx_device_X *xdev;
- XFontStruct *font;
- int encoding_index;
- int My;
- int angle;
-};
-
-gs_private_st_dev_ptrs1(st_x_xfont, x_xfont, "x_xfont",
- x_xfont_enum_ptrs, x_xfont_reloc_ptrs, xdev);
-
-/* ---------------- Utilities ---------------- */
-
-/* Search one set of font maps for a font with a given name. */
-static x11fontmap *
-find_fontmap(x11fontmap *fmps, const byte *fname, uint len)
-{
- x11fontmap *fmp = fmps;
-
- while (fmp) {
- if (len == strlen(fmp->ps_name) &&
- strncmp(fmp->ps_name, (const char *)fname, len) == 0)
- break;
- fmp = fmp->next;
- }
- return fmp;
-}
-
-/* Find an X font with a given name, encoding, and size. */
-static char *
-find_x_font(gx_device_X *xdev, char x11template[256], x11fontmap *fmp,
- const char *encoding_name, x11fontlist *fls, int xheight,
- bool *scalable_font)
-{
- int i;
- char *x11fontname = 0;
- int len1 = strlen(fmp->x11_name) + 1;
-
- if (fls->count == -1) {
- sprintf(x11template, "%s-*-*-*-*-*-*-%s", fmp->x11_name,
- encoding_name);
- fls->names = XListFonts(xdev->dpy, x11template, 32, &fls->count);
- }
- *scalable_font = false;
- for (i = 0; i < fls->count; i++) {
- const char *szp = fls->names[i] + len1;
- int size = 0;
-
- while (*szp >= '0' && *szp <= '9')
- size = size * 10 + *szp++ - '0';
- if (size == 0) {
- *scalable_font = true;
- continue;
- }
- if (size == xheight)
- return fls->names[i];
- }
- if (*scalable_font && xdev->useScalableFonts) {
- sprintf(x11template, "%s-%d-0-0-0-*-0-%s", fmp->x11_name,
- xheight, encoding_name);
- x11fontname = x11template;
- }
- return x11fontname;
-}
-
-/* ---------------- xfont procedures ---------------- */
-
-/* Look up a font. */
-static gx_xfont *
-x_lookup_font(gx_device * dev, const byte * fname, uint len,
- int encoding_index, const gs_uid * puid, const gs_matrix * pmat,
- gs_memory_t * mem)
-{
- gx_device_X *xdev = (gx_device_X *) dev;
- x_xfont *xxf;
- char x11template[256];
- char *x11fontname = NULL;
- XFontStruct *x11font;
- x11fontmap *fmp;
- double height;
- int xwidth, xheight, angle;
- Boolean My;
- bool scalable_font;
-
- if (!xdev->useXFonts)
- return NULL;
-
- if (pmat->xy == 0 && pmat->yx == 0) {
- xwidth = fabs(pmat->xx * 1000) + 0.5;
- xheight = fabs(pmat->yy * 1000) + 0.5;
- height = fabs(pmat->yy * 1000);
- angle = (pmat->xx > 0 ? 0 : 180);
- My = (pmat->xx > 0 && pmat->yy > 0) || (pmat->xx < 0 && pmat->yy < 0);
- } else if (pmat->xx == 0 && pmat->yy == 0) {
- xwidth = fabs(pmat->xy * 1000) + 0.5;
- xheight = fabs(pmat->yx * 1000) + 0.5;
- height = fabs(pmat->yx * 1000);
- angle = (pmat->yx < 0 ? 90 : 270);
- My = (pmat->yx > 0 && pmat->xy < 0) || (pmat->yx < 0 && pmat->xy > 0);
- } else {
- return NULL;
- }
-
- /* Don't do very small fonts, where font metrics are way off */
- /* due to rounding and the server does a very bad job of scaling, */
- /* or very large fonts, where we can do just as good a job and */
- /* the server may lock up the entire window system while rasterizing */
- /* the whole font. */
- if (xwidth < min_X_font_size || xwidth > max_X_font_size ||
- xheight < min_X_font_size || xheight > max_X_font_size
- )
- return NULL;
-
- if (!xdev->useFontExtensions && (My || angle != 0))
- return NULL;
-
- switch (encoding_index) {
- case 0:
- fmp = find_fontmap(xdev->regular_fonts, fname, len);
- if (fmp == NULL)
- return NULL;
- x11fontname =
- find_x_font(xdev, x11template, fmp, "Adobe-fontspecific",
- &fmp->std, xheight, &scalable_font);
- if (!x11fontname) {
- x11fontname =
- find_x_font(xdev, x11template, fmp, "ISO8859-1",
- &fmp->iso, xheight, &scalable_font);
- encoding_index = 1;
- }
- break;
- case 1:
- fmp = find_fontmap(xdev->regular_fonts, fname, len);
- if (fmp == NULL)
- return NULL;
- x11fontname =
- find_x_font(xdev, x11template, fmp, "ISO8859-1",
- &fmp->iso, xheight, &scalable_font);
- if (!x11fontname) {
- x11fontname =
- find_x_font(xdev, x11template, fmp, "Adobe-fontspecific",
- &fmp->std, xheight, &scalable_font);
- encoding_index = 0;
- }
- break;
- case 2:
- fmp = xdev->symbol_fonts;
- goto sym;
- case 3:
- fmp = xdev->dingbat_fonts;
-sym: fmp = find_fontmap(fmp, fname, len);
- if (fmp == NULL)
- return NULL;
- x11fontname =
- find_x_font(xdev, x11template, fmp, "Adobe-fontspecific",
- &fmp->std, xheight, &scalable_font);
- default:
- return NULL;
- }
- if (!x11fontname)
- return NULL;
-
- if (xwidth != xheight || angle != 0 || My) {
- if (!xdev->useScalableFonts || !scalable_font)
- return NULL;
- sprintf(x11template, "%s%s+%d-%d+%d-0-0-0-*-0-%s",
- fmp->x11_name, (My ? "+My" : ""),
- angle * 64, xheight, xwidth,
- (encoding_index == 1 ? "ISO8859-1" : "Adobe-fontspecific"));
- x11fontname = x11template;
- }
- x11font = XLoadQueryFont(xdev->dpy, x11fontname);
- if (x11font == NULL)
- return NULL;
- /* Don't bother with 16-bit or 2 byte fonts yet */
- if (x11font->min_byte1 || x11font->max_byte1) {
- XFreeFont(xdev->dpy, x11font);
- return NULL;
- }
- xxf = gs_alloc_struct(mem, x_xfont, &st_x_xfont, "x_lookup_font");
- if (xxf == NULL)
- return NULL;
- xxf->common.procs = &x_xfont_procs;
- xxf->xdev = xdev;
- xxf->font = x11font;
- xxf->encoding_index = encoding_index;
- xxf->My = (My ? -1 : 1);
- xxf->angle = angle;
- if (xdev->logXFonts) {
- dprintf3("Using %s\n for %s at %g pixels.\n", x11fontname,
- fmp->ps_name, height);
- dflush();
- }
- return (gx_xfont *) xxf;
-}
-
-/* Convert a character name or index to an xglyph code. */
-static gx_xglyph
-x_char_xglyph(gx_xfont * xf, gs_char chr, int encoding_index,
- gs_glyph glyph, const gs_const_string *glyph_name)
-{
- const x_xfont *xxf = (x_xfont *) xf;
-
- if (chr == gs_no_char)
- return gx_no_xglyph; /* can't look up names yet */
- if (encoding_index != xxf->encoding_index) {
- if (encoding_index == 0 && xxf->encoding_index == 1)
- chr = gs_map_std_to_iso[chr];
- else if (encoding_index == 1 && xxf->encoding_index == 0)
- chr = gs_map_iso_to_std[chr];
- else
- return gx_no_xglyph;
- if (chr == 0)
- return gx_no_xglyph;
- }
- if (chr < xxf->font->min_char_or_byte2 ||
- chr > xxf->font->max_char_or_byte2)
- return gx_no_xglyph;
- if (xxf->font->per_char) {
- int i = chr - xxf->font->min_char_or_byte2;
- const XCharStruct *xc = &xxf->font->per_char[i];
-
- if ((xc->lbearing == 0) && (xc->rbearing == 0) &&
- (xc->ascent == 0) && (xc->descent == 0))
- return gx_no_xglyph;
- }
- return (gx_xglyph) chr;
-}
-
-/* Get the metrics for a character. */
-static int
-x_char_metrics(gx_xfont * xf, gx_xglyph xg, int wmode,
- gs_point * pwidth, gs_int_rect * pbbox)
-{
- const x_xfont *xxf = (const x_xfont *) xf;
- int width;
-
- if (wmode != 0)
- return gs_error_undefined;
- if (xxf->font->per_char == NULL) {
- width = xxf->font->max_bounds.width;
- pbbox->p.x = xxf->font->max_bounds.lbearing;
- pbbox->q.x = xxf->font->max_bounds.rbearing;
- pbbox->p.y = -xxf->font->max_bounds.ascent;
- pbbox->q.y = xxf->font->max_bounds.descent;
- } else {
- int i = xg - xxf->font->min_char_or_byte2;
- const XCharStruct *xc = &xxf->font->per_char[i];
-
- width = xc->width;
- pbbox->p.x = xc->lbearing;
- pbbox->q.x = xc->rbearing;
- pbbox->p.y = -xc->ascent;
- pbbox->q.y = xc->descent;
- }
- switch (xxf->angle) {
- case 0:
- pwidth->x = width, pwidth->y = 0; break;
- case 90:
- pwidth->x = 0, pwidth->y = -xxf->My * width; break;
- case 180:
- pwidth->x = -width, pwidth->y = 0; break;
- case 270:
- pwidth->x = 0, pwidth->y = xxf->My * width; break;
- }
- return 0;
-}
-
-/* Render a character. */
-static int
-x_render_char(gx_xfont * xf, gx_xglyph xg, gx_device * dev,
- int xo, int yo, gx_color_index color, int required)
-{
- x_xfont *xxf = (x_xfont *) xf;
- char chr = (char)xg;
- gs_point wxy;
- gs_int_rect bbox;
- int x, y, w, h;
- int code;
-
- if (dev->dname == gs_x11_device.dname && !((gx_device_X *)dev)->is_buffered) {
- gx_device_X *xdev = (gx_device_X *)dev;
-
- code = (*xf->common.procs->char_metrics) (xf, xg, 0, &wxy, &bbox);
- if (code < 0)
- return code;
- /* Buffer text for more efficient X interaction. */
- if (xdev->text.item_count == MAX_TEXT_ITEMS ||
- xdev->text.char_count == MAX_TEXT_CHARS ||
- (IN_TEXT(xdev) &&
- (yo != xdev->text.origin.y || color != xdev->fore_color ||
- xxf->font->fid != xdev->fid))
- ) {
- DRAW_TEXT(xdev);
- xdev->text.item_count = xdev->text.char_count = 0;
- }
- if (xdev->text.item_count == 0) {
- X_SET_FILL_STYLE(xdev, FillSolid);
- X_SET_FORE_COLOR(xdev, color);
- X_SET_FUNCTION(xdev, GXcopy);
- xdev->text.origin.x = xdev->text.x = xo;
- xdev->text.origin.y = yo;
- xdev->text.items[0].font = xdev->fid = xxf->font->fid;
- }
- /*
- * The following is wrong for rotated text, but it doesn't matter,
- * because the next call of x_render_char will have a different Y.
- */
- {
- int index = xdev->text.item_count;
- XTextItem *item = &xdev->text.items[index];
- char *pchar = &xdev->text.chars[xdev->text.char_count++];
- int delta = xo - xdev->text.x;
-
- *pchar = chr;
- if (index > 0 && delta == 0) {
- /* Continue the same item. */
- item[-1].nchars++;
- } else {
- /* Start a new item. */
- item->chars = pchar;
- item->nchars = 1;
- item->delta = delta;
- if (index > 0)
- item->font = None;
- xdev->text.item_count++;
- }
- xdev->text.x = xo + wxy.x;
- }
- if (xdev->bpixmap != (Pixmap) 0) {
- x = xo + bbox.p.x;
- y = yo + bbox.p.y;
- w = bbox.q.x - bbox.p.x;
- h = bbox.q.y - bbox.p.y;
- fit_fill(dev, x, y, w, h);
- x_update_add(xdev, x, y, w, h);
- }
- return 0;
- } else if (!required)
- return -1; /* too hard */
- else {
- /* Display on an intermediate bitmap, then copy the bits. */
- gx_device_X *xdev = xxf->xdev;
- int wbm, raster;
- int i;
- XImage *xim;
- Pixmap xpm;
- GC fgc;
- byte *bits;
-
- dev_proc_copy_mono((*copy_mono)) = dev_proc(dev, copy_mono);
-
- code = (*xf->common.procs->char_metrics) (xf, xg, 0, &wxy, &bbox);
- if (code < 0)
- return code;
- w = bbox.q.x - bbox.p.x;
- h = bbox.q.y - bbox.p.y;
- wbm = ROUND_UP(w, align_bitmap_mod * 8);
- raster = wbm >> 3;
- bits = (byte *) gs_malloc(xdev->memory, h, raster, "x_render_char");
- if (bits == 0)
- return gs_error_limitcheck;
- xpm = XCreatePixmap(xdev->dpy, xdev->win, w, h, 1);
- fgc = XCreateGC(xdev->dpy, xpm, None, NULL);
- XSetForeground(xdev->dpy, fgc, 0);
- XFillRectangle(xdev->dpy, xpm, fgc, 0, 0, w, h);
- XSetForeground(xdev->dpy, fgc, 1);
- XSetFont(xdev->dpy, fgc, xxf->font->fid);
- XDrawString(xdev->dpy, xpm, fgc, -bbox.p.x, -bbox.p.y, &chr, 1);
- xim = XGetImage(xdev->dpy, xpm, 0, 0, w, h, 1, ZPixmap);
- i = 0;
- for (y = 0; y < h; y++) {
- char b = 0;
-
- for (x = 0; x < wbm; x++) {
- b = b << 1;
- if (x < w)
- b += XGetPixel(xim, x, y);
- if ((x & 7) == 7)
- bits[i++] = b;
- }
- }
- code = (*copy_mono) (dev, bits, 0, raster, gx_no_bitmap_id,
- xo + bbox.p.x, yo + bbox.p.y, w, h,
- gx_no_color_index, color);
- gs_free(xdev->memory, (char *)bits, h, raster, "x_render_char");
- XFreePixmap(xdev->dpy, xpm);
- XFreeGC(xdev->dpy, fgc);
- XDestroyImage(xim);
- return (code < 0 ? code : 0);
- }
-}
-
-/* Release an xfont. */
-static int
-x_release(gx_xfont * xf, gs_memory_t * mem)
-{
-#if 0
- /* The device may not be open. Cannot reliably free the font. */
- x_xfont *xxf = (x_xfont *) xf;
-
- XFreeFont(xxf->xdev->dpy, xxf->font);
-#endif
- if (mem != NULL)
- gs_free_object(mem, xf, "x_release");
- return 0;
-}
diff --git a/gs/base/gxccache.c b/gs/base/gxccache.c
index 787a16513..3a64a8efb 100644
--- a/gs/base/gxccache.c
+++ b/gs/base/gxccache.c
@@ -165,92 +165,6 @@ gx_lookup_cached_char(const gs_font * pfont, const cached_fm_pair * pair,
return 0;
}
-/* Look up a character in an external font. */
-/* If found, stores a pointer to the cached_char into *pcc and returns 1 */
-/* Otherwise stores NULL into *pcc and returns 0 or error. */
-/* Note it must initialise *pcc in any case. */
-int
-gx_lookup_xfont_char(const gs_state * pgs, cached_fm_pair * pair,
- gs_char chr, gs_glyph glyph, int wmode, cached_char **pcc)
-{
- gs_font *font = pair->font;
- int enc_index;
- gx_xfont *xf;
- gx_xglyph xg;
- gs_log2_scale_point log2_scale;
- gs_point wxy;
- gs_int_rect bbox;
- cached_char *cc;
- int code;
-
- *pcc = NULL;
- if (font == 0)
- return 0;
- enc_index =
- (font->FontType == ft_composite ? -1 :
- ((gs_font_base *) font)->nearest_encoding_index);
- if (!pair->xfont_tried) { /* Look for an xfont now. */
- gx_lookup_xfont(pgs, pair, enc_index);
- pair->xfont_tried = true;
- }
- xf = pair->xfont;
- if (xf == 0)
- return 0;
- {
- const gx_xfont_procs *procs = xf->common.procs;
- gs_const_string gstr;
- int code = font->procs.glyph_name(font, glyph, &gstr);
-
- if (code < 0)
- return 0;
- if (enc_index >= 0 && ((gs_font_base *)font)->encoding_index < 0) {
- /*
- * Use the registered encoding only if this glyph
- * is the same as the one in the registered encoding.
- */
- gs_const_string kstr;
-
- if (gs_c_glyph_name(gs_c_known_encode(chr, enc_index), &kstr) < 0 ||
- kstr.size != gstr.size ||
- memcmp(kstr.data, gstr.data, kstr.size)
- )
- enc_index = -1;
- }
- xg = procs->char_xglyph(xf, chr, enc_index, glyph, &gstr);
- if (xg == gx_no_xglyph)
- return 0;
- if ((*procs->char_metrics) (xf, xg, wmode, &wxy, &bbox) < 0)
- return 0;
- }
- log2_scale.x = log2_scale.y = 1;
- code = gx_alloc_char_bits(font->dir, NULL, NULL,
- (ushort)(bbox.q.x - bbox.p.x), (ushort)(bbox.q.y - bbox.p.y),
- &log2_scale, 1, &cc);
- if (code < 0)
- return code;
- if (cc == 0)
- return 0;
- /* Success. Make the cache entry. */
- cc->code = glyph;
- cc->wmode = wmode;
- cc->xglyph = xg;
- cc->wxy.x = float2fixed(wxy.x);
- cc->wxy.y = float2fixed(wxy.y);
- cc->offset.x = int2fixed(-bbox.p.x);
- cc->offset.y = int2fixed(-bbox.p.y);
- cc_set_pair(cc, pair);
- if_debug5('k', "[k]xfont %s char %d/0x%x#0x%lx=>0x%lx\n",
- font->font_name.chars, enc_index, (int)chr,
- (ulong) glyph, (ulong) xg);
- if_debug6('k', " wxy=(%g,%g) bbox=(%d,%d),(%d,%d)\n",
- wxy.x, wxy.y, bbox.p.x, bbox.p.y, bbox.q.x, bbox.q.y);
- code = gx_add_cached_char(font->dir, NULL, cc, pair, &scale_log2_1);
- if (code < 0)
- return code;
- *pcc = cc;
- return 1;
-}
-
/* Copy a cached character to the screen. */
/* Assume the caller has already done gx_color_load. */
/* Return 0 if OK, 1 if we couldn't do the operation but no error */
diff --git a/gs/base/gxccman.c b/gs/base/gxccman.c
index bff0f6735..f25567046 100644
--- a/gs/base/gxccman.c
+++ b/gs/base/gxccman.c
@@ -57,7 +57,6 @@ static RELOC_PTRS_BEGIN(cc_ptr_reloc_ptrs)
RELOC_PTRS_END
/* Forward references */
-static gx_xfont * lookup_xfont_by_name(gx_device *, const gx_xfont_procs *, gs_font_name *, int, const cached_fm_pair *, const gs_matrix *);
static int alloc_char(gs_font_dir *, ulong, cached_char **);
static int alloc_char_in_chunk(gs_font_dir *, ulong, cached_char **);
static void hash_remove_cached_char(gs_font_dir *, uint);
@@ -378,75 +377,6 @@ gx_touch_fm_pair(gs_font_dir *dir, cached_fm_pair *pair)
return 0;
}
-/* Look up the xfont for a font/matrix pair. */
-/* (This is only exported for gxccache.c.) */
-void
-gx_lookup_xfont(const gs_state * pgs, cached_fm_pair * pair, int encoding_index)
-{
- gx_device *dev = gs_currentdevice(pgs);
- gx_device *fdev = (*dev_proc(dev, get_xfont_device)) (dev);
- gs_font *font = pair->font;
- const gx_xfont_procs *procs = (*dev_proc(fdev, get_xfont_procs)) (fdev);
- gx_xfont *xf = 0;
-
- /* We mustn't attempt to use xfonts for stroked characters, */
- /* because such characters go outside their bounding box. */
- if (procs != 0 && font->PaintType == 0) {
- gs_matrix mat;
-
- mat.xx = pair->mxx, mat.xy = pair->mxy;
- mat.yx = pair->myx, mat.yy = pair->myy;
- mat.tx = 0, mat.ty = 0;
- /* xfonts can outlive their invocations, */
- /* but restore purges them properly. */
- pair->memory = pgs->memory;
- if (font->key_name.size != 0)
- xf = lookup_xfont_by_name(fdev, procs,
- &font->key_name, encoding_index,
- pair, &mat);
-#define font_name_eq(pfn1,pfn2)\
- ((pfn1)->size == (pfn2)->size && (pfn1)->size != 0 &&\
- !memcmp((char *)(pfn1)->chars, (char *)(pfn2)->chars, (pfn1)->size))
- if (xf == 0 && font->font_name.size != 0 &&
- /* Avoid redundant lookup */
- !font_name_eq(&font->font_name, &font->key_name)
- )
- xf = lookup_xfont_by_name(fdev, procs,
- &font->font_name, encoding_index,
- pair, &mat);
- if (xf == 0 && font->FontType != ft_composite &&
- uid_is_valid(&((gs_font_base *) font)->UID)
- ) { /* Look for an original font with the same UID. */
- gs_font_dir *pdir = font->dir;
- gs_font *pfont;
-
- for (pfont = pdir->orig_fonts; pfont != 0;
- pfont = pfont->next
- ) {
- if (pfont->FontType != ft_composite &&
- uid_equal(&((gs_font_base *) pfont)->UID,
- &((gs_font_base *) font)->UID) &&
- pfont->key_name.size != 0 &&
- !font_name_eq(&font->key_name,
- &pfont->key_name)
- ) {
- xf = lookup_xfont_by_name(fdev, procs,
- &pfont->key_name,
- encoding_index, pair, &mat);
- if (xf != 0)
- break;
- }
- }
- }
- }
-
- if (xf) {
- emprintf(pgs->memory, "Warning: the Xfonts feature is deprecated and will be removed in a future release.\n");
- }
-
- pair->xfont = xf;
-}
-
/* ------ Internal routines ------ */
/* Purge from the caches all references to a given font/matrix pair, */
@@ -457,11 +387,6 @@ purge_fm_pair_char(const gs_memory_t *mem, cached_char * cc, void *vpair)
{
return cc_pair(cc) == cpair;
}
-static bool
-purge_fm_pair_char_xfont(const gs_memory_t *mem, cached_char * cc, void *vpair)
-{
- return cc_pair(cc) == cpair && cpair->xfont == 0 && !cc_has_bits(cc);
-}
#undef cpair
static inline void
@@ -495,8 +420,7 @@ gs_purge_fm_pair(gs_font_dir * dir, cached_fm_pair * pair, int xfont_only)
pair->xfont = 0;
}
gx_purge_selected_cached_chars(dir,
- (xfont_only ? purge_fm_pair_char_xfont :
- purge_fm_pair_char),
+ purge_fm_pair_char,
pair);
gs_clean_fm_pair_attributes(dir, pair);
if (!xfont_only) {
@@ -525,25 +449,6 @@ gs_purge_fm_pair(gs_font_dir * dir, cached_fm_pair * pair, int xfont_only)
return 0;
}
-/* Look up an xfont by name. */
-/* The caller must already have done get_xfont_device to get the proper */
-/* device to pass as the first argument to lookup_font. */
-static gx_xfont *
-lookup_xfont_by_name(gx_device * fdev, const gx_xfont_procs * procs,
- gs_font_name * pfstr, int encoding_index, const cached_fm_pair * pair,
- const gs_matrix * pmat)
-{
- gx_xfont *xf;
-
- if_debug5('k', "[k]lookup xfont %s [%g %g %g %g]\n",
- pfstr->chars, pmat->xx, pmat->xy, pmat->yx, pmat->yy);
- xf = (*procs->lookup_font) (fdev,
- &pfstr->chars[0], pfstr->size,
- encoding_index, &pair->UID,
- pmat, pair->memory);
- if_debug1('k', "[k]... xfont=0x%lx\n", (ulong) xf);
- return xf;
-}
/* ====== Character-level routines ====== */
diff --git a/gs/base/gxchar.c b/gs/base/gxchar.c
index 9ba9b6e32..0fd2a7ee7 100644
--- a/gs/base/gxchar.c
+++ b/gs/base/gxchar.c
@@ -1051,46 +1051,7 @@ show_proceed(gs_show_enum * penum)
depth, &subpix_origin);
}
if (cc == 0) {
- /* Character is not in cache. */
- /* If possible, try for an xfont before */
- /* rendering from the outline. */
-
- /* If antialiasing is in effect, don't use xfont */
- if (log2_scale.x + log2_scale.y > 0)
- goto no_cache;
- /* Don't use xfont for outline (stroked) fonts or
- * as the descendant of a type 0 font.
- */
- if (pfont->ExactSize == fbit_use_outlines ||
- pfont->PaintType == 2 || rfont->FontType == 0
- )
- goto no_cache;
- if (pfont->BitmapWidths) {
- code = gx_lookup_xfont_char(pgs, pair, chr,
- glyph, wmode, &cc);
- if (code < 0)
- return code;
- if (code == 0)
- goto no_cache;
- } else {
- if (!SHOW_USES_OUTLINE(penum) ||
- (penum->charpath_flag != cpm_show &&
- penum->charpath_flag != cpm_charwidth)
- )
- goto no_cache;
- /* We might have an xfont, but we still */
- /* want the scalable widths. */
- code = gx_lookup_xfont_char(pgs, pair, chr,
- glyph, wmode, &cc);
- if (code < 0)
- return code;
- /* Render up to the point of */
- /* setcharwidth or setcachedevice, */
- /* just as for stringwidth. */
- /* This is the only case in which we can */
- /* to go no_cache with cc != 0. */
- goto no_cache;
- }
+ goto no_cache;
}
/* Character is in cache. */
/* We might be doing .charboxpath or stringwidth; */
diff --git a/gs/base/gxchar.h b/gs/base/gxchar.h
index b5c820bb2..04a482b7b 100644
--- a/gs/base/gxchar.h
+++ b/gs/base/gxchar.h
@@ -124,8 +124,7 @@ int gx_add_cached_char(gs_font_dir *, gx_device_memory *, cached_char *, cached
void gx_add_char_bits(gs_font_dir *, cached_char *, const gs_log2_scale_point *);
cached_char *
gx_lookup_cached_char(const gs_font *, const cached_fm_pair *, gs_glyph, int, int, gs_fixed_point *);
-int gx_lookup_xfont_char(const gs_state * pgs, cached_fm_pair * pair,
- gs_char chr, gs_glyph glyph, int wmode, cached_char **pcc);
+
int gx_image_cached_char(gs_show_enum *, cached_char *);
void gx_compute_text_oversampling(const gs_show_enum * penum, const gs_font *pfont,
int alpha_bits, gs_log2_scale_point *p_log2_scale);
diff --git a/gs/base/gxfcache.h b/gs/base/gxfcache.h
index 3efb3e6b4..3f3b5a73c 100644
--- a/gs/base/gxfcache.h
+++ b/gs/base/gxfcache.h
@@ -355,7 +355,7 @@ int gx_provide_fm_pair_attributes(gs_font_dir * dir,
const gs_matrix * char_tm, const gs_log2_scale_point *log2_scale,
bool design_grid);
int gx_touch_fm_pair(gs_font_dir *dir, cached_fm_pair *pair);
-void gx_lookup_xfont(const gs_state *, cached_fm_pair *, int);
+
void gs_clean_fm_pair(gs_font_dir * dir, cached_fm_pair * pair);
int gs_purge_fm_pair(gs_font_dir *, cached_fm_pair *, int);
int gs_purge_font_from_char_caches(gs_font *);
diff --git a/gs/base/macos-mcp.mak b/gs/base/macos-mcp.mak
index 6d74e22e6..303face9f 100644
--- a/gs/base/macos-mcp.mak
+++ b/gs/base/macos-mcp.mak
@@ -319,7 +319,6 @@ $(GLD)macos.dev: $(macos_) $(GLOBJ)gdevemap.$(OBJ)
$(GLOBJ)gdevmac.$(OBJ): $(GLSRC)gdevmac.c $(gp_mac_h) $(gdevmac_h)
$(GLOBJ)gdevemap.$(OBJ): $(GLSRC)gdevemap.c
-$(GLOBJ)gdevmacxf.$(OBJ): $(GLSRC)gdevmacxf.c
# -------------------- Platform specific sources -------------------- #
@@ -335,7 +334,7 @@ $(GLOBJ)gp_stdin.$(OBJ): $(GLSRC)gp_stdin.c $(AK) $(stdio__h) $(gx_h) $(gp_h)
# ------------------------------------------------------------------- #
-MAC1=$(GLOBJ)gp_macio.$(OBJ) $(GLOBJ)gp_mac.$(OBJ) $(GLOBJ)gdevmacxf.$(OBJ) $(GLOBJ)gp_stdin.$(OBJ)
+MAC1=$(GLOBJ)gp_macio.$(OBJ) $(GLOBJ)gp_mac.$(OBJ) $(GLOBJ)gp_stdin.$(OBJ)
MAC2=$(GLOBJ)gp_getnv.$(OBJ) $(GLOBJ)gp_paper.$(OBJ) $(GLOBJ)gp_nsync.$(OBJ) $(GLOBJ)gdevemap.$(OBJ) $(GLOBJ)gsdll.$(OBJ)
$(GLD)macos_.dev: $(MAC1)
diff --git a/gs/doc/Xfonts.htm b/gs/doc/Xfonts.htm
index 888f8dcdb..71adff5dd 100644
--- a/gs/doc/Xfonts.htm
+++ b/gs/doc/Xfonts.htm
@@ -50,6 +50,9 @@ overview</a>.
<!-- [1.0 end visible header] ============================================== -->
<!-- [2.0 begin contents] ================================================== -->
+<h2><a name="Removal"></a>Removal</h2>
+<p>
+As of Ghostscript 9.04, the Xfont functionality has been removed
<h2><a name="Deprecated"></a>Deprecated</h2>
<p>