configure.ac | 2 include/X11/fonts/bitmap.h | 7 include/X11/fonts/bufio.h | 2 include/X11/fonts/fntfil.h | 4 include/X11/fonts/pcf.h | 2 src/FreeType/ft.h | 1 src/FreeType/fttools.c | 47 --- src/FreeType/xttcap.c | 400 ++++++++++----------------- src/FreeType/xttcap.h | 5 src/Speedo/do_char.c | 207 -------------- src/Speedo/do_trns.c | 14 src/Speedo/out_scrn.c | 172 +++++------ src/Speedo/out_util.c | 196 ++++++------- src/Speedo/reset.c | 2 src/Speedo/set_spcs.c | 10 src/Speedo/set_trns.c | 234 ++++----------- src/Speedo/spdo_prv.h | 161 ---------- src/Speedo/speedo.h | 16 - src/Speedo/spglyph.c | 2 src/Speedo/spint.h | 2 src/Type1/Makefile.am | 1 src/Type1/arith.c | 276 ------------------ src/Type1/arith.h | 6 src/Type1/digit.h | 2 src/Type1/fontfcn.c | 11 src/Type1/fontfcn.h | 2 src/Type1/lines.c | 69 ++-- src/Type1/lines.h | 2 src/Type1/objects.c | 267 +++--------------- src/Type1/objects.h | 39 -- src/Type1/paths.c | 662 --------------------------------------------- src/Type1/paths.h | 34 -- src/Type1/regions.c | 423 +++------------------------- src/Type1/regions.h | 26 - src/Type1/scanfont.c | 2 src/Type1/spaces.c | 221 +++++---------- src/Type1/spaces.h | 21 - src/Type1/t1funcs.c | 50 +-- src/Type1/t1info.c | 5 src/Type1/t1intf.h | 1 src/Type1/t1malloc.c | 4 src/Type1/t1stub.c | 56 --- src/Type1/util.h | 1 src/bitmap/bitmapfunc.c | 100 +++--- src/bitmap/bitscale.c | 6 src/bitmap/snfread.c | 2 src/bitmap/snfstr.h | 1 src/builtins/builtin.h | 8 src/builtins/dir.c | 4 src/builtins/file.c | 19 - src/builtins/fonts.c | 14 src/builtins/fpe.c | 23 - src/builtins/render.c | 35 -- src/fc/fsconvert.c | 40 -- src/fc/fserve.c | 75 ++--- src/fc/fserve.h | 3 src/fc/fservestr.h | 9 src/fc/fsio.c | 62 ---- src/fc/fsio.h | 7 src/fontfile/Makefile.am | 3 src/fontfile/bufio.c | 22 - src/fontfile/catalogue.c | 457 +++++++++++++++++++++++++++++++ src/fontfile/fontfile.c | 41 +- src/fontfile/register.c | 1 64 files changed, 1300 insertions(+), 3299 deletions(-)
New commits: commit 8d47483711be6076e7bfefab14aa890c5f37e1aa Author: Kristian Høgsberg <[EMAIL PROTECTED]> Date: Thu Jun 21 21:44:02 2007 -0400 Bump version to 1.2.9. diff --git a/configure.ac b/configure.ac index fb5cdec..379243a 100644 --- a/configure.ac +++ b/configure.ac @@ -26,7 +26,7 @@ dnl Process this file with autoconf to create configure. AC_PREREQ([2.57]) AC_INIT([libXfont], - 1.2.8, + 1.2.9, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], libXfont) dnl commit c5ab59762c4ad5def68436d55937a2bd558d5c99 Author: Kristian Høgsberg <[EMAIL PROTECTED]> Date: Tue Jun 19 10:38:02 2007 -0400 Add a new 'catalogue' FPE, which takes font paths from symlinks in a dir. This patch adds a new FPE type, which will match font path elements of the form catalogue:<dir> The dir specified after the catalogue: prefix will be scanned for symlinks and each symlink destination will be added as a local fontfile FPE. The symlink can be suffixed by attributes, such as 'unscaled', which will be passed through to the underlying fontfile FPE. Except the new attribute 'pri' which will be used for ordering the fontfile FPEs. An example configuration: 75dpi:unscaled:pri=20 -> /usr/share/X11/fonts/75dpi ghostscript:pri=60 -> /usr/share/fonts/default/ghostscript misc:unscaled:pri=10 -> /usr/share/X11/fonts/misc type1:pri=40 -> /usr/share/X11/fonts/Type1 type1:pri=50 -> /usr/share/fonts/default/Type1 will add /usr/share/X11/fonts/misc as the first FPE with the attribute 'unscaled', second FPE will be /usr/share/X11/fonts/75dpi, also with the attribute unscaled etc. This is functionally equivalent to setting the following font path: /usr/share/X11/fonts/misc:unscaled, /usr/share/X11/fonts/75dpi:unscaled, /usr/share/X11/fonts/Type1, /usr/share/fonts/default/Type1, /usr/share/fonts/default/ghostscript The motivation is to let font packages add a symlink to the new font directory they provide instead of rewriting either the Xorg config file or the xfs config file. diff --git a/include/X11/fonts/fntfil.h b/include/X11/fonts/fntfil.h index 81d2cbc..074f2d0 100644 --- a/include/X11/fonts/fntfil.h +++ b/include/X11/fonts/fntfil.h @@ -92,6 +92,9 @@ extern int FontFileOpenBitmap ( FontPathElementPtr fpe, FontPtr *pFont, extern int FontFileListFonts ( pointer client, FontPathElementPtr fpe, char *pat, int len, int max, FontNamesPtr names ); +extern int FontFileStartListFonts ( pointer client, FontPathElementPtr fpe, + char *pat, int len, int max, + pointer *privatep, int mark_aliases ); extern int FontFileStartListFontsWithInfo ( pointer client, FontPathElementPtr fpe, char *pat, int len, int max, @@ -111,6 +114,7 @@ extern int FontFileListNextFontOrAlias ( pointer client, char **resolvedp, int *resolvedlenp, pointer private ); extern void FontFileRegisterLocalFpeFunctions ( void ); +extern void CatalogueRegisterLocalFpeFunctions ( void ); extern FontEntryPtr FontFileAddEntry ( FontTablePtr table, diff --git a/src/fontfile/Makefile.am b/src/fontfile/Makefile.am index a80f437..8c361bd 100644 --- a/src/fontfile/Makefile.am +++ b/src/fontfile/Makefile.am @@ -26,4 +26,5 @@ libfontfile_la_SOURCES = \ gunzip.c \ printerfont.c \ register.c \ - renderers.c + renderers.c \ + catalogue.c diff --git a/src/fontfile/catalogue.c b/src/fontfile/catalogue.c new file mode 100644 index 0000000..6d364a5 --- /dev/null +++ b/src/fontfile/catalogue.c @@ -0,0 +1,457 @@ +/* + * Copyright © 2007 Red Hat, Inc + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Author: + * Kristian Høgsberg <[EMAIL PROTECTED]> + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +#include <X11/fonts/fntfilst.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <dirent.h> +#include <unistd.h> + +static const char CataloguePrefix[] = "catalogue:"; + +static int CatalogueFreeFPE (FontPathElementPtr fpe); + +static int +CatalogueNameCheck (char *name) +{ + return strncmp(name, CataloguePrefix, sizeof(CataloguePrefix) - 1) == 0; +} + +typedef struct _CatalogueRec { + time_t mtime; + int fpeCount, fpeAlloc; + FontPathElementPtr *fpeList; +} CatalogueRec, *CataloguePtr; + +static int +CatalogueAddFPE (CataloguePtr cat, FontPathElementPtr fpe) +{ + FontPathElementPtr *new; + + if (cat->fpeCount >= cat->fpeAlloc) + { + if (cat->fpeAlloc == 0) + cat->fpeAlloc = 16; + else + cat->fpeAlloc *= 2; + + new = xrealloc(cat->fpeList, + cat->fpeAlloc * sizeof(FontPathElementPtr)); + if (new == NULL) + return AllocError; + + cat->fpeList = new; + } + + cat->fpeList[cat->fpeCount++] = fpe; + + return Successful; +} + +static const char PriorityAttribute[] = "pri="; + +static int +ComparePriority(const void *p1, const void *p2) +{ + FontDirectoryPtr dir1 = (*(FontPathElementPtr*) p1)->private; + FontDirectoryPtr dir2 = (*(FontPathElementPtr*) p2)->private; + const char *pri1 = strstr(dir1->attributes, PriorityAttribute); + const char *pri2 = strstr(dir2->attributes, PriorityAttribute); + + if (pri1 == NULL && pri2 == NULL) + return 0; + else if (pri1 == NULL) + return 1; + else if (pri2 == NULL) + return -1; + else + return + atoi(pri1 + strlen(PriorityAttribute)) - + atoi(pri2 + strlen(PriorityAttribute)); +} + +static void +CatalogueUnrefFPEs (FontPathElementPtr fpe) +{ + CataloguePtr cat = fpe->private; + FontPathElementPtr subfpe; + int i; + + for (i = 0; i < cat->fpeCount; i++) + { + subfpe = cat->fpeList[i]; + subfpe->refcount--; + if (subfpe->refcount == 0) + { + FontFileFreeFPE (subfpe); + xfree(subfpe->name); + xfree(subfpe); + } + } + + cat->fpeCount = 0; +} + +static int +CatalogueRescan (FontPathElementPtr fpe) +{ + CataloguePtr cat = fpe->private; + char link[MAXFONTFILENAMELEN]; + char dest[MAXFONTFILENAMELEN]; + char *attrib; + FontPathElementPtr subfpe; + struct stat statbuf; + const char *path; + DIR *dir; + struct dirent *entry; + int len; + + path = fpe->name + strlen(CataloguePrefix); + if (stat(path, &statbuf) < 0 || !S_ISDIR(statbuf.st_mode)) + return BadFontPath; + + if (statbuf.st_mtime <= cat->mtime) + return Successful; + + dir = opendir(path); + if (dir == NULL) + { + xfree(cat); + return BadFontPath; + } + + CatalogueUnrefFPEs (fpe); + while (entry = readdir(dir), entry != NULL) + { + snprintf(link, sizeof link, "%s/%s", path, entry->d_name); + len = readlink(link, dest, sizeof dest); + if (len < 0) + continue; + + attrib = strchr(link, ':'); + if (attrib && len + strlen(attrib) < sizeof dest) + { + memcpy(dest + len, attrib, strlen(attrib)); + len += strlen(attrib); + } + + subfpe = xalloc(sizeof *subfpe); + if (subfpe == NULL) + continue; + + /* The fonts returned by OpenFont will point back to the + * subfpe they come from. So set the type of the subfpe to + * what the catalogue fpe was assigned, so calls to CloseFont + * (which uses font->fpe->type) goes to CatalogueCloseFont. */ + subfpe->type = fpe->type; + subfpe->name_length = len; + subfpe->name = xalloc (len + 1); + if (subfpe == NULL) + { + xfree(subfpe); + continue; + } + + memcpy(subfpe->name, dest, len); + subfpe->name[len] = '\0'; + + /* The X server will manipulate the subfpe ref counts + * associated with the font in OpenFont and CloseFont, so we + * have to make sure it's valid. */ + subfpe->refcount = 1; + + if (FontFileInitFPE (subfpe) != Successful) + { + xfree(subfpe->name); + xfree(subfpe); + continue; + } + + if (CatalogueAddFPE(cat, subfpe) != Successful) + { + FontFileFreeFPE (subfpe); + xfree(subfpe); + continue; + } + } + + qsort(cat->fpeList, + cat->fpeCount, sizeof cat->fpeList[0], ComparePriority); + + cat->mtime = statbuf.st_mtime; + + return Successful; +} + +static int +CatalogueInitFPE (FontPathElementPtr fpe) +{ + CataloguePtr cat; + + cat = (CataloguePtr) xalloc(sizeof *cat); + if (cat == NULL) + return AllocError; + + fpe->private = (pointer) cat; + cat->fpeCount = 0; + cat->fpeAlloc = 0; + cat->fpeList = NULL; + cat->mtime = 0; + + return CatalogueRescan (fpe); +} + +static int +CatalogueResetFPE (FontPathElementPtr fpe) +{ + /* Always just tell the caller to close and re-open */ + return FPEResetFailed; +} + +static int +CatalogueFreeFPE (FontPathElementPtr fpe) +{ + CataloguePtr cat = fpe->private; + + /* If the catalogue is modified while the xserver has fonts open + * from the previous subfpes, we'll unref the old subfpes when we + * reload the catalogue, and the xserver will the call FreeFPE on + * them once it drops its last reference. Thus, the FreeFPE call + * for the subfpe ends up here and we just forward it to + * FontFileFreeFPE. */ + + if (!CatalogueNameCheck (fpe->name)) + return FontFileFreeFPE (fpe); + + CatalogueUnrefFPEs (fpe); + xfree(cat->fpeList); + xfree(cat); + + return Successful; +} + +static int +CatalogueOpenFont (pointer client, FontPathElementPtr fpe, Mask flags, + char *name, int namelen, + fsBitmapFormat format, fsBitmapFormatMask fmask, + XID id, FontPtr *pFont, char **aliasName, + FontPtr non_cachable_font) +{ + CataloguePtr cat = fpe->private; + FontPathElementPtr subfpe; + FontDirectoryPtr dir; + int i, status; + + CatalogueRescan (fpe); + + for (i = 0; i < cat->fpeCount; i++) + { + subfpe = cat->fpeList[i]; + dir = subfpe->private; + status = FontFileOpenFont(client, subfpe, flags, + name, namelen, format, fmask, id, + pFont, aliasName, non_cachable_font); + if (status == Successful || status == FontNameAlias) + return status; + } + + return BadFontName; +} + +static void +CatalogueCloseFont (FontPathElementPtr fpe, FontPtr pFont) +{ + /* Note: this gets called with the actual subfpe where we found + * the font, not the catalogue fpe. */ + + FontFileCloseFont(fpe, pFont); +} + +static int +CatalogueListFonts (pointer client, FontPathElementPtr fpe, char *pat, + int len, int max, FontNamesPtr names) +{ + CataloguePtr cat = fpe->private; + FontPathElementPtr subfpe; + FontDirectoryPtr dir; + int i; + + CatalogueRescan (fpe); + + for (i = 0; i < cat->fpeCount; i++) + { + subfpe = cat->fpeList[i]; + dir = subfpe->private; + FontFileListFonts(client, subfpe, pat, len, max, names); + } + + return Successful; +} + +int +FontFileStartListFonts(pointer client, FontPathElementPtr fpe, + char *pat, int len, int max, + pointer *privatep, int mark_aliases); + +typedef struct _LFWIData { + pointer *privates; + int current; +} LFWIDataRec, *LFWIDataPtr; + +static int +CatalogueStartListFonts(pointer client, FontPathElementPtr fpe, + char *pat, int len, int max, pointer *privatep, + int mark_aliases) +{ + CataloguePtr cat = fpe->private; + LFWIDataPtr data; + int ret, i, j; + + CatalogueRescan (fpe); + + data = (LFWIDataPtr) xalloc (sizeof *data + + sizeof data->privates[0] * cat->fpeCount); + if (!data) + return AllocError; + data->privates = (pointer *) (data + 1); + + for (i = 0; i < cat->fpeCount; i++) + { + ret = FontFileStartListFonts(client, cat->fpeList[i], pat, len, + max, &data->privates[i], mark_aliases); + if (ret != Successful) + goto bail; + } + + data->current = 0; + *privatep = (pointer) data; + return Successful; + + bail: + for (j = 0; j < i; j++) + /* FIXME: we have no way to free the per-fpe privates. */; + xfree (data); + + return AllocError; +} + +static int +CatalogueStartListFontsWithInfo(pointer client, FontPathElementPtr fpe, + char *pat, int len, int max, + pointer *privatep) +{ + return CatalogueStartListFonts(client, fpe, pat, len, max, privatep, 0); +} + +static int +CatalogueListNextFontWithInfo(pointer client, FontPathElementPtr fpe, + char **namep, int *namelenp, + FontInfoPtr *pFontInfo, + int *numFonts, pointer private) +{ + LFWIDataPtr data = private; + CataloguePtr cat = fpe->private; + int ret; + + if (data->current == cat->fpeCount) + { + xfree(data); + return BadFontName; + } + + ret = FontFileListNextFontWithInfo(client, cat->fpeList[data->current], + namep, namelenp, + pFontInfo, numFonts, + data->privates[data->current]); + if (ret == BadFontName) + { + data->current++; + return CatalogueListNextFontWithInfo(client, fpe, namep, namelenp, + pFontInfo, numFonts, private); + } + + return ret; +} + +static int +CatalogueStartListFontsAndAliases(pointer client, FontPathElementPtr fpe, + char *pat, int len, int max, + pointer *privatep) +{ + return CatalogueStartListFonts(client, fpe, pat, len, max, privatep, 1); +} + +static int +CatalogueListNextFontOrAlias(pointer client, FontPathElementPtr fpe, + char **namep, int *namelenp, char **resolvedp, + int *resolvedlenp, pointer private) +{ + LFWIDataPtr data = private; + CataloguePtr cat = fpe->private; + int ret; + + if (data->current == cat->fpeCount) + { + xfree(data); + return BadFontName; + } + + ret = FontFileListNextFontOrAlias(client, cat->fpeList[data->current], + namep, namelenp, + resolvedp, resolvedlenp, + data->privates[data->current]); + if (ret == BadFontName) + { + data->current++; + return CatalogueListNextFontOrAlias(client, fpe, namep, namelenp, + resolvedp, resolvedlenp, private); + } + + return ret; +} + +void +CatalogueRegisterLocalFpeFunctions (void) +{ + RegisterFPEFunctions(CatalogueNameCheck, + CatalogueInitFPE, + CatalogueFreeFPE, + CatalogueResetFPE, + CatalogueOpenFont, + CatalogueCloseFont, + CatalogueListFonts, + CatalogueStartListFontsWithInfo, + CatalogueListNextFontWithInfo, + NULL, + NULL, + NULL, + CatalogueStartListFontsAndAliases, + CatalogueListNextFontOrAlias, + FontFileEmptyBitmapSource); +} diff --git a/src/fontfile/fontfile.c b/src/fontfile/fontfile.c index 914f8cd..f900f75 100644 --- a/src/fontfile/fontfile.c +++ b/src/fontfile/fontfile.c @@ -795,9 +795,9 @@ FontFileListFonts (pointer client, FontPathElementPtr fpe, char *pat, } int -FontFileStartListFontsWithInfo(pointer client, FontPathElementPtr fpe, - char *pat, int len, int max, - pointer *privatep) +FontFileStartListFonts(pointer client, FontPathElementPtr fpe, + char *pat, int len, int max, + pointer *privatep, int mark_aliases) { LFWIDataPtr data; int ret; @@ -811,7 +811,8 @@ FontFileStartListFontsWithInfo(pointer client, FontPathElementPtr fpe, xfree (data); return AllocError; } - ret = FontFileListFonts (client, fpe, pat, len, max, data->names); + ret = _FontFileListFonts (client, fpe, pat, len, + max, data->names, mark_aliases); if (ret != Successful) { FreeFontNames (data->names); @@ -823,6 +824,15 @@ FontFileStartListFontsWithInfo(pointer client, FontPathElementPtr fpe, return Successful; } + +int +FontFileStartListFontsWithInfo(pointer client, FontPathElementPtr fpe, + char *pat, int len, int max, + pointer *privatep) +{ + return FontFileStartListFonts(client, fpe, pat, len, max, privatep, 0); +} + /* ARGSUSED */ static int FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe, @@ -1076,28 +1086,7 @@ FontFileStartListFontsAndAliases(pointer client, FontPathElementPtr fpe, char *pat, int len, int max, pointer *privatep) { - LFWIDataPtr data; - int ret; - - data = (LFWIDataPtr) xalloc (sizeof *data); - if (!data) - return AllocError; - data->names = MakeFontNamesRecord (0); - if (!data->names) - { - xfree (data); - return AllocError; - } - ret = _FontFileListFonts (client, fpe, pat, len, max, data->names, 1); - if (ret != Successful) - { - FreeFontNames (data->names); - xfree (data); - return ret; - } - data->current = 0; - *privatep = (pointer) data; - return Successful; + return FontFileStartListFonts(client, fpe, pat, len, max, privatep, 1); } int diff --git a/src/fontfile/register.c b/src/fontfile/register.c index a591838..3dc7ef0 100644 --- a/src/fontfile/register.c +++ b/src/fontfile/register.c @@ -119,5 +119,6 @@ FontFileRegisterFpeFunctions(void) } FontFileRegisterLocalFpeFunctions (); + CatalogueRegisterLocalFpeFunctions (); } commit 1a690feaf7c416da9b01861af381d15a661e5f52 Author: Adam Jackson <[EMAIL PROTECTED]> Date: Thu Jun 7 16:01:03 2007 -0400 Minor fontfile cleanup. diff --git a/include/X11/fonts/bufio.h b/include/X11/fonts/bufio.h index da90064..b31b813 100644 --- a/include/X11/fonts/bufio.h +++ b/include/X11/fonts/bufio.h @@ -72,10 +72,8 @@ extern BufFilePtr BufFilePushCompressed ( BufFilePtr ); extern BufFilePtr BufFilePushZIP ( BufFilePtr ); #endif extern int BufFileClose ( BufFilePtr, int ); -extern int BufFileFlush ( BufFilePtr, int ); extern int BufFileRead ( BufFilePtr, char*, int ); extern int BufFileWrite ( BufFilePtr, char*, int ); -extern void BufFileFree ( BufFilePtr ); #define BufFileGet(f) ((f)->left-- ? *(f)->bufp++ : ((f)->eof = (*(f)->input) (f))) #define BufFilePut(c,f) (--(f)->left ? *(f)->bufp++ = ((unsigned char)(c)) : (*(f)->output) ((unsigned char)(c),f)) diff --git a/src/fontfile/bufio.c b/src/fontfile/bufio.c index 43c6a13..a5746e3 100644 --- a/src/fontfile/bufio.c +++ b/src/fontfile/bufio.c @@ -147,6 +147,14 @@ BufFileRawFlush (int c, BufFilePtr f) return c; } +static int +BufFileFlush (BufFilePtr f, int doClose) +{ + if (f->bufp != f->buffer) + return (*f->output) (BUFFILEEOF, f); + return 0; +} + BufFilePtr BufFileOpenWrite (int fd) { @@ -189,14 +197,6 @@ BufFileWrite (BufFilePtr f, char *b, int n) } int -BufFileFlush (BufFilePtr f, int doClose) -{ - if (f->bufp != f->buffer) - return (*f->output) (BUFFILEEOF, f); - return 0; -} - -int BufFileClose (BufFilePtr f, int doClose) { int ret; @@ -204,9 +204,3 @@ BufFileClose (BufFilePtr f, int doClose) xfree (f); return ret; } - -void -BufFileFree (BufFilePtr f) -{ - xfree (f); -} commit 3b1bcd7676fe810ce60d6a4758067b571796cceb Author: Adam Jackson <[EMAIL PROTECTED]> Date: Thu Jun 7 15:54:51 2007 -0400 Dead code cull from fontserver code. diff --git a/src/fc/fsconvert.c b/src/fc/fsconvert.c index 9ff54f5..8cdda2a 100644 --- a/src/fc/fsconvert.c +++ b/src/fc/fsconvert.c @@ -43,8 +43,6 @@ extern char _fs_glyph_undefined; extern char _fs_glyph_requested; -extern char _fs_glyph_zero_length; - /* * converts data from font server form to X server form @@ -400,41 +398,7 @@ _fs_clean_aborted_loadglyphs(FontPtr pfont, int num_expected_ranges, } } - -/* - * figures out what extents to request - * this is where lots of extra - * smarts wants to live - */ -/* ARGSUSED */ -int -_fs_check_extents(FontPtr pfont, Mask flags, int nranges, fsRange *range, - FSBlockDataPtr blockrec) -{ -/* XXX -- either fill in the requested info if we have it somewhere - * and return AccessDone, or else return Successful - */ - return Successful; -} - -/* - * figures out what glyphs to request - * this is where lots of extra - * smarts wants to live - */ -/* ARGSUSED */ -int -_fs_check_bitmaps(FontPtr pfont, fsBitmapFormat format, - Mask flags, int nranges, fsRange *range, - FSBlockDataPtr blockrec) -{ -/* XXX -- either fill in the requested info if we have it somewhere - * and return AccessDone, or else return Successful - */ - return Successful; -} - -int +static int _fs_get_glyphs(FontPtr pFont, unsigned long count, unsigned char *chars, FontEncoding charEncoding, unsigned long *glyphCount, /* RETURN */ @@ -640,7 +604,7 @@ _fs_get_metrics(FontPtr pFont, unsigned long count, unsigned char *chars, } -void +static void _fs_unload_font(FontPtr pfont) { FSFontPtr fsdata = (FSFontPtr) pfont->fontPrivate; diff --git a/src/fc/fserve.c b/src/fc/fserve.c index 804ac85..fd1bd53 100644 --- a/src/fc/fserve.c +++ b/src/fc/fserve.c @@ -130,11 +130,11 @@ static void fs_cleanup_bfont (FSBlockedFontPtr bfont); char _fs_glyph_undefined; char _fs_glyph_requested; -char _fs_glyph_zero_length; +static char _fs_glyph_zero_length; static int generationCount; -int FontServerRequestTimeout = 30 * 1000; +static int FontServerRequestTimeout = 30 * 1000; static void _fs_close_server (FSFpePtr conn); @@ -2046,41 +2046,7 @@ extern pointer serverClient; /* This could be any number that doesn't conflict with existing client values. */ -int -fs_load_all_glyphs(FontPtr pfont) -{ - int err; - FSFpePtr conn = (FSFpePtr) pfont->fpe->private; - - /* - * The purpose of this procedure is to load all glyphs in the event - * that we're dealing with someone who doesn't understand the finer - * points of glyph caching... it is called from _fs_get_glyphs() if - * the latter is called to get glyphs that have not yet been loaded. - * We assume that the caller will not know how to handle a return - * value of Suspended (usually the case for a GetGlyphs() caller), - * so this procedure hangs around, freezing the server, for the - * request to complete. This is an unpleasant kluge called to - * perform an unpleasant job that, we hope, will never be required. - */ - - while ((err = _fs_load_glyphs(serverClient, pfont, TRUE, 0, 0, NULL)) == - Suspended) - { - if (fs_await_reply (conn) != FSIO_READY) - { - /* Get rid of blockrec */ - fs_client_died(serverClient, pfont->fpe); - err = BadCharRange; - break; - } - fs_read_reply (pfont->fpe, serverClient); - } - return err; -} - - -int +static int _fs_load_glyphs(pointer client, FontPtr pfont, Bool range_flag, unsigned int nchars, int item_size, unsigned char *data) { @@ -2230,6 +2196,39 @@ _fs_load_glyphs(pointer client, FontPtr pfont, Bool range_flag, return fs_send_load_glyphs(client, pfont, nranges, ranges); } +int +fs_load_all_glyphs(FontPtr pfont) +{ + int err; + FSFpePtr conn = (FSFpePtr) pfont->fpe->private; + + /* + * The purpose of this procedure is to load all glyphs in the event + * that we're dealing with someone who doesn't understand the finer + * points of glyph caching... it is called from _fs_get_glyphs() if + * the latter is called to get glyphs that have not yet been loaded. + * We assume that the caller will not know how to handle a return + * value of Suspended (usually the case for a GetGlyphs() caller), + * so this procedure hangs around, freezing the server, for the + * request to complete. This is an unpleasant kluge called to + * perform an unpleasant job that, we hope, will never be required. + */ + + while ((err = _fs_load_glyphs(serverClient, pfont, TRUE, 0, 0, NULL)) == + Suspended) + { + if (fs_await_reply (conn) != FSIO_READY) + { + /* Get rid of blockrec */ + fs_client_died(serverClient, pfont->fpe); + err = BadCharRange; + break; + } + fs_read_reply (pfont->fpe, serverClient); + } + return err; +} + static int fs_read_list(FontPathElementPtr fpe, FSBlockDataPtr blockrec) { diff --git a/src/fc/fserve.h b/src/fc/fserve.h index 3254f40..3b08526 100644 --- a/src/fc/fserve.h +++ b/src/fc/fserve.h @@ -80,9 +80,6 @@ extern FontPtr fs_create_font (FontPathElementPtr fpe, fsBitmapFormatMask fmask); extern int fs_load_all_glyphs ( FontPtr pfont ); -extern int _fs_load_glyphs ( pointer client, FontPtr pfont, Bool range_flag, - unsigned int nchars, int item_size, - unsigned char *data ); /* * These should be declared elsewhere, but I'm concerned that moving them diff --git a/src/fc/fservestr.h b/src/fc/fservestr.h index 0e41666..1993de8 100644 --- a/src/fc/fservestr.h +++ b/src/fc/fservestr.h @@ -197,15 +197,6 @@ extern int fs_build_range ( FontPtr pfont, Bool range_flag, extern void _fs_clean_aborted_loadglyphs ( FontPtr pfont, int num_expected_ranges, fsRange *expected_ranges ); -extern int _fs_check_extents ( FontPtr pfont, Mask flags, int nranges, - fsRange *range, FSBlockDataPtr blockrec ); -extern int _fs_check_bitmaps ( FontPtr pfont, fsBitmapFormat format, - Mask flags, int nranges, fsRange *range, - FSBlockDataPtr blockrec ); -extern int _fs_get_glyphs ( FontPtr pFont, unsigned long count, - unsigned char *chars, FontEncoding charEncoding, - unsigned long *glyphCount, CharInfoPtr *glyphs ); -extern void _fs_unload_font ( FontPtr pfont ); extern void _fs_init_font ( FontPtr pfont ); extern pointer fs_alloc_glyphs (FontPtr pFont, int size); #endif /* _FSERVESTR_H_ */ diff --git a/src/fc/fsio.c b/src/fc/fsio.c index fbfb9df..a7abe12 100644 --- a/src/fc/fsio.c +++ b/src/fc/fsio.c @@ -150,7 +150,7 @@ _fs_connect(char *servername, int *err) return trans_conn; } -int +static int _fs_fill (FSFpePtr conn) { long avail; @@ -422,19 +422,6 @@ _fs_write_pad(FSFpePtr conn, char *data, long len) return _fs_do_write (conn, data, len, len + padlength[len & 3]); } -/* - * returns the amount of data waiting to be read - */ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]