Index: dvi/dvi.h
===================================================================
RCS file: /usr/local/cvsroot/tkdvi/dvi/dvi.h,v
retrieving revision 1.7
diff -u -r1.7 dvi.h
--- dvi/dvi.h	2000/06/29 10:54:42	1.7
+++ dvi/dvi.h	2000/07/14 10:21:47
@@ -228,18 +228,24 @@
                                                      S32 *tfmWidthPtr,
                                                      S32 *pixelWidthPtr));
 typedef int (Dvi_FontCloseProc) _ANSI_ARGS_((struct Dvi_Font *dviFont));
+typedef int (Dvi_FontIterateCallbackProc)
+    _ANSI_ARGS_((struct Dvi_Font *dviFont, S32 i, Dvi_Glyph *glyphPtr));
+typedef int (Dvi_FontIterateProc) _ANSI_ARGS_((struct Dvi_Font *dviFont,
+					       Dvi_FontIterateCallbackProc *));
 
 typedef struct Dvi_FontTypeDesc {
     char *name;
     Dvi_FontLoadProc *loadProc;
     Dvi_FontGlyphProc *glyphProc;
     Dvi_FontCloseProc *closeProc;
+    Dvi_FontIterateProc *iterateProc;
 } Dvi_FontTypeDesc;
 
 EXTERN int Dvi_CreateFontType _ANSI_ARGS_((Dvi_FontType type, char *name,
                                            Dvi_FontLoadProc *loadProc,
                                            Dvi_FontGlyphProc *glyphProc,
-                                           Dvi_FontCloseProc *closeProc));
+                                           Dvi_FontCloseProc *closeProc,
+					   Dvi_FontIterateProc *iterateProc));
 EXTERN int Dvi_CreateFontType_PK _ANSI_ARGS_((void));
 EXTERN int Dvi_CreateFontType_VF _ANSI_ARGS_((void));
 EXTERN int Dvi_CreateFontType_TFM _ANSI_ARGS_((void));
@@ -282,6 +288,8 @@
                                                  S32 character,
                                                  S32 *tfmWidthPtr,
                                                  S32 *pixelWidthPtr));
+EXTERN int Dvi_FontIterate _ANSI_ARGS_((Dvi_FontIterateCallbackProc *));
+
 #ifdef DVI_DEBUG
 EXTERN Tcl_Obj * Dvi_FontDump _ANSI_ARGS_((Tcl_Interp *interp,
 					   Dvi_Font *dviFont));
Index: dvi/font.c
===================================================================
RCS file: /usr/local/cvsroot/tkdvi/dvi/font.c,v
retrieving revision 1.4
diff -u -r1.4 font.c
--- dvi/font.c	2000/06/29 11:01:38	1.4
+++ dvi/font.c	2000/07/14 10:21:47
@@ -57,17 +57,20 @@
  */
 
 int
-Dvi_CreateFontType (type, name, loadProc, glyphProc, closeProc)
+Dvi_CreateFontType (type, name, loadProc, glyphProc, closeProc,
+		    iterateProc)
     Dvi_FontType type;
     char *name;
     Dvi_FontLoadProc *loadProc;
     Dvi_FontGlyphProc *glyphProc;
     Dvi_FontCloseProc *closeProc;
+    Dvi_FontIterateProc *iterateProc;
 {
     fontTypes[type].name = name;
     fontTypes[type].loadProc = loadProc;
     fontTypes[type].glyphProc = glyphProc;
     fontTypes[type].closeProc = closeProc;
+    fontTypes[type].iterateProc = iterateProc;
     fontTypeCount++;
     
     return TCL_OK;
@@ -405,6 +408,26 @@
     fontHeadPtr = headPtr;
 
     return headPtr;
+}
+
+int
+Dvi_FontIterate(callbackProc)
+    Dvi_FontIterateCallbackProc *callbackProc;
+{
+    FontHead *headPtr;
+    Dvi_Font *fontPtr;
+
+    for (headPtr = fontHeadPtr; headPtr != 0; headPtr = headPtr->nextPtr) {
+	for (fontPtr = headPtr->fonts; fontPtr; fontPtr = fontPtr->nextPtr) {
+	    Dvi_FontIterateProc *iterateProc
+		= fontTypes[fontPtr->type].iterateProc;
+    
+	    if (iterateProc != 0) {
+		(* iterateProc)(fontPtr, callbackProc);
+	    }
+	}
+    }
+    return 1;
 }
 
 /*
Index: dvi/fontPK.c
===================================================================
RCS file: /usr/local/cvsroot/tkdvi/dvi/fontPK.c,v
retrieving revision 1.3
diff -u -r1.3 fontPK.c
--- dvi/fontPK.c	2000/05/18 12:50:32	1.3
+++ dvi/fontPK.c	2000/07/14 10:21:47
@@ -62,6 +62,8 @@
 static Dvi_Glyph *PkRunCount _ANSI_ARGS_((U8 *codePtr));
 
 static int PkClose _ANSI_ARGS_((Dvi_Font *dviFont));
+static int PkIterate _ANSI_ARGS_((Dvi_Font *dviFont,
+				  Dvi_FontIterateCallbackProc *callbackProc));
 
 /*
  * ------------------------------------------------------------------------
@@ -83,7 +85,8 @@
 int
 Dvi_CreateFontType_PK ()
 {
-    return Dvi_CreateFontType(dvi_font_pk, "pk", PkLoad, PkGlyph, PkClose);
+    return Dvi_CreateFontType(dvi_font_pk, "pk", PkLoad, PkGlyph, PkClose,
+			      PkIterate);
 }
 
 static int
@@ -622,4 +625,27 @@
     }
     ckfree((char *)charInfoPtr);
     return TCL_OK;
+}
+
+static int
+PkIterate(dviFont, callback)
+    Dvi_Font *dviFont;
+    Dvi_FontIterateCallbackProc callback;
+{
+    PkInfo *infoPtr = (PkInfo *)dviFont->fontData;
+    PkCharInfo *charInfoPtr;
+    S32 i;
+
+    if (infoPtr == (PkInfo *)0) {
+	return 0;
+    }
+
+    charInfoPtr = infoPtr->charInfoPtr;
+    for (i = infoPtr->minChar; i <= infoPtr->maxChar; i++) {
+	if (charInfoPtr[i - infoPtr->minChar].glyphPtr) {
+	    (* callback)(dviFont, i,
+			 charInfoPtr[i - infoPtr->minChar].glyphPtr);
+	}
+    }
+    return 1;
 }
Index: dvi/image.c
===================================================================
RCS file: /usr/local/cvsroot/tkdvi/dvi/image.c,v
retrieving revision 1.12
diff -u -r1.12 image.c
--- dvi/image.c	2000/07/07 08:00:36	1.12
+++ dvi/image.c	2000/07/14 10:21:47
@@ -263,6 +263,8 @@
 static int RenderFontDef _ANSI_ARGS_((ClientData, Dvi_Interp *,
 				      Dvi_FontList **, S32, U32, U32,
 				      U32, size_t, char *, Dvi_FontDefMode));
+
+static int ReleaseShrunkenGlyph _ANSI_ARGS_((Dvi_Font *, S32, Dvi_Glyph *));
 
 /*
  * This is a fixed version of the Tk_InitImageArgs function from the
@@ -768,6 +770,17 @@
     return TCL_OK;
 }
 
+static int
+ReleaseShrunkenGlyph (junk0, junk1, glyphPtr)
+    Dvi_Font *junk0;
+    S32 junk1;
+    Dvi_Glyph *glyphPtr;
+{
+    XDestroyImage((XImage *)(glyphPtr->shrinkGlyphPtr));
+    glyphPtr->shrinkGlyphPtr = 0;
+    glyphPtr->shrink = 0;
+}
+
 static ColorContext *
 FindColorContext (instancePtr, fgUid, bgUid)
     DviInstance *instancePtr;
@@ -837,6 +850,8 @@
 
     colorContextPtr->nextPtr = instancePtr->colorCachePtr;
     instancePtr->colorCachePtr = colorContextPtr;
+
+    Dvi_FontIterate(ReleaseShrunkenGlyph);
 
     return colorContextPtr;
 }
Index: lib/browser.tcl
===================================================================
RCS file: /usr/local/cvsroot/tkdvi/lib/browser.tcl,v
retrieving revision 1.12
diff -u -r1.12 browser.tcl
--- lib/browser.tcl	2000/07/07 09:02:32	1.12
+++ lib/browser.tcl	2000/07/14 10:21:47
@@ -31,6 +31,7 @@
 	measureunit {MeasureUnit cm}
 	sourcespecials {SourceSpecials 0}
 	freehandcolor {FreehandColor red}
+	gamma {Gamma 1.2}
     }
 
     foreach {option cv} [array get Options] {
@@ -59,7 +60,10 @@
 	    [namespace code [list Images $name -1]]
     trace variable Configure($name-shrink) w \
 	    [namespace code [list Images $name -1]]
-    
+
+    trace variable Configure($name-gamma) w \
+	    [namespace code [list Images $name -1]]
+
     trace variable Configure($name-titleformat) w \
 	    [namespace code [list TitleFormat $name]]
 
@@ -378,6 +382,7 @@
 
     set State($name-$key,i) [::image create dvi -file $State($name-code) \
 	    -shrink $shrink -size $Configure($name-size) \
+	    -gamma $Configure($name-gamma) \
 	    -specialcommand \
 	        [namespace code [list SpecialCmd $name $key %x %y %c %s]] \
 	    -precommand [namespace code [list PreCmd $name $key %p]] \
@@ -1283,6 +1288,7 @@
     
     set Dialog($name-defaultmode) [option get $name mode Mode]
     set Dialog($name-measureunit) $Configure($name-measureunit)
+    set Dialog($name-gamma) $Configure($name-gamma)
 
     label $p.layout-l -text {Default Display Mode: } -anchor e
     eval OptionMenu $p.layout-m \
@@ -1298,6 +1304,14 @@
     grid $p.unit-m -row $row -column 1 -sticky we -padx 2 -pady 2
     incr row
 
+    label $p.gamma-l -text {Gamma value:} -anchor e
+    scale $p.gamma-s -orient horizontal -length 80 -resolution 0.1 \
+	    -showvalue true -from 0 -to 5 -tickinterval 0 \
+	    -variable tkdvi::browser::Dialog($name-gamma)
+    grid $p.gamma-l -row $row -column 0 -sticky e -ipadx 5 -ipady 5
+    grid $p.gamma-s -row $row -column 1 -sticky we -padx 2 -pady 2
+    incr row
+
     frame $p.sep -relief sunken -borderwidth 1 -height 2
     grid $p.sep -row $row -column 0 -columnspan 2 -sticky we
     incr row
@@ -1319,6 +1333,7 @@
     variable Dialog
 
     set Configure($name-measureunit) $Dialog($name-measureunit)
+    set Configure($name-gamma) $Dialog($name-gamma)
     option add *TkDVIBrowser.mode $Dialog($name-defaultmode) interactive
 
     if {$quit} {
