Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/dvi/mdvi-lib
diff options
context:
space:
mode:
Diffstat (limited to 'dvi/mdvi-lib')
-rw-r--r--dvi/mdvi-lib/Makefile.am7
-rw-r--r--dvi/mdvi-lib/assoc.c99
-rw-r--r--dvi/mdvi-lib/assoc.h14
-rw-r--r--dvi/mdvi-lib/bitmap.c76
-rw-r--r--dvi/mdvi-lib/color.c135
-rw-r--r--dvi/mdvi-lib/color.h34
-rw-r--r--dvi/mdvi-lib/common.h6
-rw-r--r--dvi/mdvi-lib/dviread.c66
-rw-r--r--dvi/mdvi-lib/files.c71
-rw-r--r--dvi/mdvi-lib/fontmap.c13
-rw-r--r--dvi/mdvi-lib/mdvi.h12
-rw-r--r--dvi/mdvi-lib/sp-epsf.c2
-rw-r--r--dvi/mdvi-lib/tfmfile.c1
-rw-r--r--dvi/mdvi-lib/util.c13
14 files changed, 234 insertions, 315 deletions
diff --git a/dvi/mdvi-lib/Makefile.am b/dvi/mdvi-lib/Makefile.am
index fd88f7f..aa9ef94 100644
--- a/dvi/mdvi-lib/Makefile.am
+++ b/dvi/mdvi-lib/Makefile.am
@@ -3,14 +3,13 @@ noinst_LTLIBRARIES = libmdvi.la
libmdvi_la_SOURCES = \
afmparse.c \
afmparse.h \
- assoc.c \
- assoc.h \
bitmap.c \
bitmap.h \
+ color.c \
+ color.h \
common.c \
common.h \
defaults.h \
- dvimisc.c \
dviopcodes.h \
dviread.c \
files.c \
@@ -38,3 +37,5 @@ libmdvi_la_SOURCES = \
tt.c \
util.c \
vf.c
+
+
diff --git a/dvi/mdvi-lib/assoc.c b/dvi/mdvi-lib/assoc.c
deleted file mode 100644
index e3ba113..0000000
--- a/dvi/mdvi-lib/assoc.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 2000, Matias Atria
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "mdvi.h"
-#include "assoc.h"
-#include "hash.h"
-
-typedef struct {
- void *data;
- DviFree2Func free_func;
-} DviAssoc;
-
-#define MDVI_ASSOC_SIZE 31
-
-static void assoc_free(DviHashKey key, void *ptr)
-{
- DviAssoc *assoc = (DviAssoc *)ptr;
-
- DEBUG((4, "Destroying association `%s'\n", (char *)key));
- if(assoc->free_func)
- assoc->free_func(key, assoc->data);
- xfree(assoc);
-}
-
-int mdvi_assoc_put(DviContext *dvi, char *key, void *data, DviFree2Func f)
-{
- DviAssoc *assoc;
- int ok;
-
- if(dvi->assoc.buckets == NULL) {
- mdvi_hash_create(&dvi->assoc, MDVI_ASSOC_SIZE);
- dvi->assoc.hash_free = assoc_free;
- }
- assoc = xalloc(DviAssoc);
- assoc->data = data;
- assoc->free_func = f;
-
- ok = mdvi_hash_add(&dvi->assoc, MDVI_KEY(key),
- assoc, MDVI_HASH_UNIQUE);
- if(ok < 0) {
- xfree(assoc);
- return -1;
- }
- return 0;
-}
-
-void *mdvi_assoc_get(DviContext *dvi, char *key)
-{
- DviAssoc *assoc;
-
- if(dvi->assoc.buckets == NULL)
- return NULL;
- assoc = (DviAssoc *)mdvi_hash_lookup(&dvi->assoc, MDVI_KEY(key));
- return assoc ? assoc->data : NULL;
-}
-
-void *mdvi_assoc_del(DviContext *dvi, char *key)
-{
- DviAssoc *assoc;
- void *ptr;
-
- if(dvi->assoc.buckets == NULL)
- return NULL;
- assoc = mdvi_hash_remove(&dvi->assoc, MDVI_KEY(key));
- if(assoc == NULL)
- return NULL;
- ptr = assoc->data;
- xfree(assoc);
- return ptr;
-}
-
-void mdvi_assoc_free(DviContext *dvi, char *key)
-{
- if(dvi->assoc.buckets) {
- /* this will call `assoc_free' */
- mdvi_hash_destroy_key(&dvi->assoc, MDVI_KEY(key));
- }
-}
-
-void mdvi_assoc_flush(DviContext *dvi)
-{
- if(dvi->assoc.buckets)
- mdvi_hash_reset(&dvi->assoc, 0);
-}
diff --git a/dvi/mdvi-lib/assoc.h b/dvi/mdvi-lib/assoc.h
deleted file mode 100644
index f5b7035..0000000
--- a/dvi/mdvi-lib/assoc.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef MDVI_ASSOC_H
-#define MDVI_ASSOC_H
-
-/* Associations */
-extern int mdvi_assoc_put
- __PROTO((DviContext *, char *, void *, DviFree2Func));
-extern void * mdvi_assoc_get __PROTO((DviContext *, char *));
-extern void * mdvi_assoc_del __PROTO((DviContext *, char *));
-extern void mdvi_assoc_free __PROTO((DviContext *, char *));
-extern void mdvi_assoc_flush __PROTO((DviContext *));
-
-
-#endif
-
diff --git a/dvi/mdvi-lib/bitmap.c b/dvi/mdvi-lib/bitmap.c
index b30369f..a48e6e0 100644
--- a/dvi/mdvi-lib/bitmap.c
+++ b/dvi/mdvi-lib/bitmap.c
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include "mdvi.h"
+#include "color.h"
/* bit_masks[n] contains a BmUnit with `n' contiguous bits */
@@ -46,17 +47,6 @@ static BmUnit bit_masks[] = {
#define SHOW_OP_DATA (DEBUGGING(BITMAP_OPS) && DEBUGGING(BITMAP_DATA))
#endif
-/* cache for color tables, to avoid creating them for every glyph */
-typedef struct {
- Ulong fg;
- Ulong bg;
- Uint nlevels;
- Ulong *pixels;
- int density;
- double gamma;
- Uint hits;
-} ColorCache;
-
/*
* Some useful macros to manipulate bitmap data
* SEGMENT(m,n) = bit mask for a segment of `m' contiguous bits
@@ -126,70 +116,6 @@ static Uchar bit_swap[] = {
0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
};
-#define CCSIZE 256
-static ColorCache color_cache[CCSIZE];
-static int cc_entries;
-
-#define GAMMA_DIFF 0.005
-
-static Ulong *get_color_table(DviDevice *dev,
- int nlevels, Ulong fg, Ulong bg, double gamma, int density);
-
-
-/* create a color table */
-static Ulong *get_color_table(DviDevice *dev,
- int nlevels, Ulong fg, Ulong bg, double gamma, int density)
-{
- ColorCache *cc, *tofree;
- int lohits;
- Ulong *pixels;
- int status;
-
- lohits = color_cache[0].hits;
- tofree = &color_cache[0];
- /* look in the cache and see if we have one that matches this request */
- for(cc = &color_cache[0]; cc < &color_cache[cc_entries]; cc++) {
- if(cc->hits < lohits) {
- lohits = cc->hits;
- tofree = cc;
- }
- if(cc->fg == fg && cc->bg == bg && cc->density == density &&
- cc->nlevels == nlevels && fabs(cc->gamma - gamma) <= GAMMA_DIFF)
- break;
- }
-
- if(cc < &color_cache[cc_entries]) {
- cc->hits++;
- return cc->pixels;
- }
-
- DEBUG((DBG_DEVICE, "Adding color table to cache (fg=%lu, bg=%lu, n=%d)\n",
- fg, bg, nlevels));
-
- /* no entry was found in the cache, create a new one */
- if(cc_entries < CCSIZE) {
- cc = &color_cache[cc_entries++];
- cc->pixels = NULL;
- } else {
- cc = tofree;
- xfree(cc->pixels);
- }
- pixels = xnalloc(Ulong, nlevels);
- status = dev->alloc_colors(dev->device_data,
- pixels, nlevels, fg, bg, gamma, density);
- if(status < 0) {
- xfree(pixels);
- return NULL;
- }
- cc->fg = fg;
- cc->bg = bg;
- cc->gamma = gamma;
- cc->density = density;
- cc->nlevels = nlevels;
- cc->pixels = pixels;
- cc->hits = 1;
- return pixels;
-}
/*
* next we have three bitmap functions to convert bitmaps in LSB bit order
diff --git a/dvi/mdvi-lib/color.c b/dvi/mdvi-lib/color.c
new file mode 100644
index 0000000..ae63a87
--- /dev/null
+++ b/dvi/mdvi-lib/color.c
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2000, Matias Atria
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "mdvi.h"
+#include "color.h"
+
+void mdvi_set_color(DviContext *dvi, Ulong fg, Ulong bg)
+{
+ if(dvi->curr_fg != fg || dvi->curr_bg != bg) {
+ DEBUG((DBG_DEVICE, "setting color to (%lu,%lu)\n", fg, bg));
+ if(dvi->device.set_color)
+ dvi->device.set_color(dvi->device.device_data, fg, bg);
+ dvi->curr_fg = fg;
+ dvi->curr_bg = bg;
+ }
+}
+
+void mdvi_push_color(DviContext *dvi, Ulong fg, Ulong bg)
+{
+ if(dvi->color_top == dvi->color_size) {
+ dvi->color_size += 32;
+ dvi->color_stack = xrealloc(dvi->color_stack,
+ dvi->color_size * sizeof(DviColorPair));
+ }
+ dvi->color_stack[dvi->color_top].fg = dvi->curr_fg;
+ dvi->color_stack[dvi->color_top].bg = dvi->curr_bg;
+ dvi->color_top++;
+ mdvi_set_color(dvi, fg, bg);
+}
+
+void mdvi_pop_color(DviContext *dvi)
+{
+ Ulong fg, bg;
+
+ if(dvi->color_top == 0)
+ return;
+ dvi->color_top--;
+ fg = dvi->color_stack[dvi->color_top].fg;
+ bg = dvi->color_stack[dvi->color_top].bg;
+ mdvi_set_color(dvi, fg, bg);
+}
+
+void mdvi_reset_color(DviContext *dvi)
+{
+ dvi->color_top = 0;
+ mdvi_set_color(dvi, dvi->params.fg, dvi->params.bg);
+}
+
+/* cache for color tables, to avoid creating them for every glyph */
+typedef struct {
+ Ulong fg;
+ Ulong bg;
+ Uint nlevels;
+ Ulong *pixels;
+ int density;
+ double gamma;
+ Uint hits;
+} ColorCache;
+
+#define CCSIZE 256
+static ColorCache color_cache[CCSIZE];
+static int cc_entries;
+
+#define GAMMA_DIFF 0.005
+
+
+/* create a color table */
+Ulong *get_color_table(DviDevice *dev,
+ int nlevels, Ulong fg, Ulong bg, double gamma, int density)
+{
+ ColorCache *cc, *tofree;
+ int lohits;
+ Ulong *pixels;
+ int status;
+
+ lohits = color_cache[0].hits;
+ tofree = &color_cache[0];
+ /* look in the cache and see if we have one that matches this request */
+ for(cc = &color_cache[0]; cc < &color_cache[cc_entries]; cc++) {
+ if(cc->hits < lohits) {
+ lohits = cc->hits;
+ tofree = cc;
+ }
+ if(cc->fg == fg && cc->bg == bg && cc->density == density &&
+ cc->nlevels == nlevels && fabs(cc->gamma - gamma) <= GAMMA_DIFF)
+ break;
+ }
+
+ if(cc < &color_cache[cc_entries]) {
+ cc->hits++;
+ return cc->pixels;
+ }
+
+ DEBUG((DBG_DEVICE, "Adding color table to cache (fg=%lu, bg=%lu, n=%d)\n",
+ fg, bg, nlevels));
+
+ /* no entry was found in the cache, create a new one */
+ if(cc_entries < CCSIZE) {
+ cc = &color_cache[cc_entries++];
+ cc->pixels = NULL;
+ } else {
+ cc = tofree;
+ xfree(cc->pixels);
+ }
+ pixels = xnalloc(Ulong, nlevels);
+ status = dev->alloc_colors(dev->device_data,
+ pixels, nlevels, fg, bg, gamma, density);
+ if(status < 0) {
+ xfree(pixels);
+ return NULL;
+ }
+ cc->fg = fg;
+ cc->bg = bg;
+ cc->gamma = gamma;
+ cc->density = density;
+ cc->nlevels = nlevels;
+ cc->pixels = pixels;
+ cc->hits = 1;
+ return pixels;
+}
diff --git a/dvi/mdvi-lib/color.h b/dvi/mdvi-lib/color.h
new file mode 100644
index 0000000..363776e
--- /dev/null
+++ b/dvi/mdvi-lib/color.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2000, Matias Atria
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#ifndef _COLOR_H_
+#define _COLOR_H_
+
+#include "common.h"
+
+extern Ulong *get_color_table(DviDevice *dev,
+ int nlevels, Ulong fg, Ulong bg, double gamma, int density);
+
+extern void mdvi_set_color __PROTO((DviContext *, Ulong, Ulong));
+extern void mdvi_push_color __PROTO((DviContext *, Ulong, Ulong));
+extern void mdvi_pop_color __PROTO((DviContext *));
+extern void mdvi_reset_color __PROTO((DviContext *));
+
+#endif /* _COLOR_H_ */
+
diff --git a/dvi/mdvi-lib/common.h b/dvi/mdvi-lib/common.h
index 67130fe..e9c007e 100644
--- a/dvi/mdvi-lib/common.h
+++ b/dvi/mdvi-lib/common.h
@@ -216,10 +216,6 @@ extern void *xmemdup __PROTO((const void *, size_t));
#define xnalloc(t,n) (t *)xcalloc((n), sizeof(t))
#define xresize(p,t,n) (t *)xrealloc((p), (n) * sizeof(t))
-extern int get_number __PROTO((const char *, long *));
-/* return paper dimensions (in cm) */
-extern int paper_dimensions __PROTO((const char *, double *, double *));
-
extern char *xstradd __PROTO((char *, size_t *, size_t, const char *, size_t));
extern Ulong get_mtime __PROTO((int));
@@ -255,10 +251,8 @@ extern void dstring_reset __PROTO((Dstring *));
extern char *dgets __PROTO((Dstring *, FILE *));
extern int file_readable __PROTO((const char *));
extern int file_exists __PROTO((const char *));
-extern char *find_in_path __PROTO((const char *path, const char *file));
extern const char *file_basename __PROTO((const char *));
extern const char *file_extension __PROTO((const char *));
-extern char *read_into_core __PROTO((const char *, size_t *));
/*
* Miscellaneous macros
diff --git a/dvi/mdvi-lib/dviread.c b/dvi/mdvi-lib/dviread.c
index e2ca6c7..2f9b5cd 100644
--- a/dvi/mdvi-lib/dviread.c
+++ b/dvi/mdvi-lib/dviread.c
@@ -27,6 +27,7 @@
#include "mdvi.h"
#include "private.h"
+#include "color.h"
typedef int (*DviCommand) __PROTO((DviContext *, int));
@@ -578,11 +579,6 @@ int mdvi_configure(DviContext *dvi, DviParamCode option, ...)
break;
case MDVI_SET_GAMMA:
np.gamma = va_arg(ap, double);
- if(np.pixels) {
- xfree(np.pixels);
- np.pixels = 0;
- np.npixels = 0;
- }
reset_font = MDVI_FONTSEL_GREY;
break;
case MDVI_SET_DENSITY:
@@ -745,8 +741,6 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil
dvi->params.orientation = par->orientation;
dvi->params.fg = par->fg;
dvi->params.bg = par->bg;
- dvi->params.pixels = NULL;
- dvi->params.npixels = 0;
/* initialize colors */
dvi->curr_fg = par->fg;
@@ -902,9 +896,6 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil
dvi->device.set_color = dummy_dev_set_color;
dvi->device.device_data = NULL;
- /* initialize associations */
- mdvi_hash_init(&dvi->assoc);
-
DEBUG((DBG_DVI, "%s read successfully\n", filename));
return dvi;
@@ -942,7 +933,6 @@ void mdvi_destroy_context(DviContext *dvi)
xfree(dvi->buffer.data);
if(dvi->color_stack)
xfree(dvi->color_stack);
- mdvi_assoc_flush(dvi);
xfree(dvi);
}
@@ -1175,6 +1165,50 @@ static void inline fix_after_horizontal(DviContext *dvi)
(a), (b) > 0 ? '+' : '-', \
(b) > 0 ? (b) : -(b), (c)
+/*
+ * Draw rules with some sort of antialias support. Usefult for high-rate
+ * scale factors.
+ */
+
+static void draw_shrink_rule (DviContext *dvi, int x, int y, Uint w, Uint h, int f)
+{
+ int hs, vs, npixels;
+ Ulong fg, bg;
+ Ulong *pixels;
+
+ hs = dvi->params.hshrink;
+ vs = dvi->params.vshrink;
+ fg = dvi->params.fg;
+ bg = dvi->params.bg;
+
+ if (MDVI_ENABLED(dvi, MDVI_PARAM_ANTIALIASED)) {
+ npixels = vs * hs + 1;
+ pixels = get_color_table(&dvi->device, npixels, bg, fg,
+ dvi->params.gamma, dvi->params.density);
+
+ if (pixels) {
+ int color;
+
+ /* Lines with width 1 should be perfectly visible
+ * in shrink about 15. That is the reason of constant
+ */
+
+ color = (pow (vs / h * hs, 2) + pow (hs / w * vs, 2)) / 225;
+ if (color < npixels) {
+ fg = pixels[color];
+ } else {
+ fg = pixels[npixels - 1];
+ }
+ }
+ }
+
+ mdvi_push_color (dvi, fg, bg);
+ dvi->device.draw_rule(dvi, x, y, w, h, f);
+ mdvi_pop_color (dvi);
+
+ return;
+}
+
/*
* The only commands that actually draw something are:
* set_char, set_rule
@@ -1233,8 +1267,7 @@ static void draw_box(DviContext *dvi, DviFontChar *ch)
break;
}
- dvi->device.draw_rule(dvi,
- dvi->pos.hh - x, dvi->pos.vv - y, w, h, 1);
+ draw_shrink_rule(dvi, dvi->pos.hh - x, dvi->pos.vv - y, w, h, 1);
}
int set_char(DviContext *dvi, int opcode)
@@ -1306,9 +1339,10 @@ int set_rule(DviContext *dvi, int opcode)
b, a, w, h));
/* the `draw' functions expect the origin to be at the top left
* corner of the rule, not the bottom left, as in DVI files */
- if(dvi->curr_layer <= dvi->params.layer)
- dvi->device.draw_rule(dvi,
- dvi->pos.hh, dvi->pos.vv - h + 1, w, h, 1);
+ if(dvi->curr_layer <= dvi->params.layer) {
+ draw_shrink_rule(dvi,
+ dvi->pos.hh, dvi->pos.vv - h + 1, w, h, 1);
+ }
} else {
SHOWCMD((dvi, opcode == DVI_SET_RULE ? "setrule" : "putrule", -1,
"(moving left only, by %d)\n", b));
diff --git a/dvi/mdvi-lib/files.c b/dvi/mdvi-lib/files.c
index d3dbcfe..0ed893b 100644
--- a/dvi/mdvi-lib/files.c
+++ b/dvi/mdvi-lib/files.c
@@ -77,74 +77,3 @@ int file_exists(const char *filename)
return status;
}
-static char *xstrchre(const char *string, int c)
-{
- const char *ptr;
-
- for(ptr = string; *ptr && *ptr != c; ptr++);
- return (char *)ptr;
-}
-
-char *find_in_path(const char *filename, const char *path)
-{
- const char *p, *q;
- char *try;
- int len;
-
- /* if the file is readable as given, return it */
- if(file_readable(filename))
- return xstrdup(filename);
-
- /* worst case scenario */
- try = xmalloc(strlen(path) + strlen(filename) + 2);
- try[0] = 0;
-
- for(p = path; *p; p = q) {
- q = xstrchre(p, ':');
- len = q - p;
- xstrncpy(try, p, len);
- try[len] = '/';
- strcpy(try + len + 1, filename);
- if(file_readable(try))
- break;
- if(*q) q++;
- }
-
- if(*p)
- return try;
- else {
- xfree(try);
- return NULL;
- }
-}
-
-char *read_into_core(const char *file, size_t *size)
-{
- FILE *in;
- struct stat st;
- char *ptr;
-
- in = fopen(file, "r");
- if(in == NULL)
- return NULL;
- if(fstat(fileno(in), &st) < 0) {
- /* I don't think this is possible, but who knows */
- fclose(in);
- return NULL;
- }
- if(st.st_size == 0) {
- warning("%s: file is empty\n", file);
- fclose(in);
- return NULL;
- }
- ptr = xmalloc(st.st_size + 1);
- if(fread(ptr, st.st_size, 1, in) != 1) {
- fclose(in);
- xfree(ptr);
- return NULL;
- }
- fclose(in);
- ptr[st.st_size] = 0;
- if(size) *size = st.st_size;
- return ptr;
-}
diff --git a/dvi/mdvi-lib/fontmap.c b/dvi/mdvi-lib/fontmap.c
index 0837b23..26b33af 100644
--- a/dvi/mdvi-lib/fontmap.c
+++ b/dvi/mdvi-lib/fontmap.c
@@ -872,18 +872,19 @@ void mdvi_flush_fontmaps(void)
void ps_init_default_paths(void)
{
- char *kppath = mdvi_getenv("MDVI_PS_LIBPATH");
- char *kfpath = mdvi_getenv("MDVI_PS_FONTPATH");
+ char *kppath;
+ char *kfpath;
ASSERT(psinitialized == 0);
- if(kppath == NULL)
- kppath = getenv("GS_LIB");
- if(kfpath == NULL)
- kfpath = getenv("GS_FONTPATH");
+
+ kppath = getenv("GS_LIB");
+ kfpath = getenv("GS_FONTPATH");
+
if(kppath != NULL)
pslibdir = kpse_path_expand(kppath);
if(kfpath != NULL)
psfontdir = kpse_path_expand(kfpath);
+
listh_init(&psfonts);
mdvi_hash_create(&pstable, PSMAP_HASH_SIZE);
psinitialized = 1;
diff --git a/dvi/mdvi-lib/mdvi.h b/dvi/mdvi-lib/mdvi.h
index fbbab5b..961689a 100644
--- a/dvi/mdvi-lib/mdvi.h
+++ b/dvi/mdvi-lib/mdvi.h
@@ -65,7 +65,6 @@ typedef enum {
TRUE = 1
} DviBool;
-#include "assoc.h"
#include "hash.h"
#include "paper.h"
@@ -307,8 +306,6 @@ struct _DviParams {
DviOrientation orientation; /* page orientation */
int base_x;
int base_y;
- Ulong *pixels; /* colors used for antialiasing */
- int npixels; /* number of entries in `pixels' */
};
typedef enum {
@@ -387,10 +384,11 @@ struct _DviContext {
DviDevice device; /* device-specific routines */
Ulong curr_fg; /* rendering color */
Ulong curr_bg;
+
DviColorPair *color_stack;
- DviHashTable assoc;
int color_top;
int color_size;
+
DviFontRef *(*findref) __PROTO((DviContext *, Int32));
void *user_data; /* client data attached to this context */
};
@@ -523,12 +521,6 @@ extern int mdvi_in_range __PROTO((DviRange *, int, int));
extern int mdvi_range_length __PROTO((DviRange *, int));
extern int mdvi_page_selected __PROTO((DviPageSpec *, PageNum, int));
-/* Color support */
-extern void mdvi_set_color __PROTO((DviContext *, Ulong, Ulong));
-extern void mdvi_push_color __PROTO((DviContext *, Ulong, Ulong));
-extern void mdvi_pop_color __PROTO((DviContext *));
-extern void mdvi_reset_color __PROTO((DviContext *));
-
/* Specials */
extern int mdvi_register_special __PROTO((
const char *label,
diff --git a/dvi/mdvi-lib/sp-epsf.c b/dvi/mdvi-lib/sp-epsf.c
index de08482..9a07fc7 100644
--- a/dvi/mdvi-lib/sp-epsf.c
+++ b/dvi/mdvi-lib/sp-epsf.c
@@ -235,7 +235,7 @@ void epsf_special(DviContext *dvi, char *prefix, char *arg)
{
char *file;
char *special;
- EpsfBox box;
+ EpsfBox box = {0, 0, 0, 0};
int x, y;
int w, h;
double xf, vf;
diff --git a/dvi/mdvi-lib/tfmfile.c b/dvi/mdvi-lib/tfmfile.c
index abab259..45b7850 100644
--- a/dvi/mdvi-lib/tfmfile.c
+++ b/dvi/mdvi-lib/tfmfile.c
@@ -514,7 +514,6 @@ static int ofm_load_file(const char *filename, TFMInfo *info)
}
fread(info->coding, 39, 1, in);
info->coding[n] = 0;
- ptr += i;
} else
strcpy(info->coding, "FontSpecific");
/* get the font family */
diff --git a/dvi/mdvi-lib/util.c b/dvi/mdvi-lib/util.c
index 8062733..e7c7326 100644
--- a/dvi/mdvi-lib/util.c
+++ b/dvi/mdvi-lib/util.c
@@ -360,19 +360,6 @@ char *xstradd(char *dest, size_t *size, size_t n, const char *src, size_t m)
return dest;
}
-int get_number(const char *string, long *val)
-{
- long x;
- char *end;
-
- errno = 0;
- x = strtol(string, &end, 10);
- if(errno || *end)
- return -1;
- *val = x;
- return 0;
-}
-
char *getword(char *string, const char *delim, char **end)
{
char *ptr;