v06i028: xpic -- pic previewer for X11, Patch11
Dan Heller
argv%turnpike at Sun.COM
Sun Mar 11 08:00:45 AEST 1990
Submitted-by: Mark Moraes <uunet!cs.toronto.edu!moraes at uunet.UU.NET>
Posting-number: Volume 6, Issue 28
Archive-name: xpic/patch11
Patch-To: xpic: Volume 4, Issues 66-80
*** /dev/null Mon Feb 19 20:44:13 1990
--- contrib/clients/xpic/CHANGES.Pat11 Sun Feb 18 10:56:08 1990
***************
*** 0 ****
--- 1,5 ----
+ - added tune.h dependencies explicitly to Imakefile so people
+ don't get burnt if they forget to run make depend.
+
+ - used a more accurate font scaling formula (use POINT_SIZE instead of
+ PIXEL_SIZE)
*** orig/xpic/patchlevel.h Fri Nov 24 01:34:46 1989
--- contrib/clients/xpic/patchlevel.h Sun Feb 18 10:56:08 1990
***************
*** 1,2 ****
! #define PATCHLEVEL 10
--- 1,2 ----
! #define PATCHLEVEL 11
*** /dev/null Mon Feb 19 20:44:13 1990
--- contrib/clients/xpic/calcfonts Sat Feb 17 01:20:48 1990
***************
*** 0 ****
--- 1,21 ----
+ #! /bin/sh
+ # calcfonts -- calculates font pointsizes at different dpi
+ gridSpacing=${1-"8"}
+ family=${2-"-bitstream-charter-medium-r-normal-"}
+ echo "$family" "scaled to" $gridSpacing "gridSpacing"
+ xlsfonts -fn "$family"'*' |
+ awk -F- 'BEGIN {
+ gridSpacing = '"$gridSpacing"';
+ printf " %10s %10s %10s %7s %10s\n", "PIXELSIZE", "POINTSIZE", "RESOLUTION", "(1)", "(2)";
+ }
+ {
+ i1 = int($9 * $11 / (gridSpacing * 10.) / 10 +.5);
+ i2 = int(72 * $8 / (gridSpacing * 10.) + .5);
+ printf "%10d %10d %10d %10d %10d\n", $8, $9, $11, i1, i2;
+ }' |
+ sort -n +3
+ echo "(1) POINT_SIZE * RESOLUTION / $gridSpacing"0" / 10 + .5";
+ echo " int realsize = fontsize * dpi / (gridSpacing * 10.) / 10. + 0.5;"
+ echo "(2) PIXEL_SIZE * 72 / $gridSpacing"0" + .5";
+ echo " int realsize = (72. * fontsize)/(10. * gridSpacing) + .5;"
+ echo ""
diff -r -c orig/xpic/Imakefile contrib/clients/xpic/Imakefile
*** orig/xpic/Imakefile Fri Nov 24 01:45:47 1989
--- contrib/clients/xpic/Imakefile Sun Feb 18 10:53:16 1990
***************
*** 146,148 ****
--- 146,157 ----
echo \#define PROGRAMNAME \"$(BINDIR)/xpic\" >> tune.h.new
echo \#define DUMPDIR \"$(DUMPDIR)\" >> tune.h.new
-cmp -s tune.h.new tune.h || cp tune.h.new tune.h
+
+ # Lots of people don't like running make depend because it drags in
+ # all of /usr/include, more or less.
+ main.o: tune.h
+ newfonts.o: tune.h
+ x2pic.o: tune.h
+ x2ps.o: tune.h
+ x2tpic.o: tune.h
+ xpic.o: tune.h
diff -r -c orig/xpic/README contrib/clients/xpic/README
*** orig/xpic/README Fri Nov 24 01:36:31 1989
--- contrib/clients/xpic/README Mon Feb 19 00:25:27 1990
***************
*** 8,35 ****
and DEFAULTPAGEWIDTH. These are set to fill the entire screen on a Sun 3/50
ordinary resolution or uvax3200.
! 4. make.
! 5. To test it, copy the file fontdesc/xpic to ~/.xpic, run it with the
command
xpic test/test.xpic
xpic uses the X.V11R3 font naming convention and the X.V11R3 fonts.
! 6. make install.
! Notes: You need to have the HP Widgets. The ones on the R3 tape in
! contrib/widgets are really for R2 and won't work with xpic. You need to get
! Martin Friedmann's fixed widgets. (These are available as
! Xhp.patch.works.tar.Z from various archive sites - try expo.lcs.mit.edu in
! contrib/ and ai.toronto.edu in pub/X by anonymous ftp)
xpic has been tested very extensively under X11R2 and R3 on monochrome
and color Suns and reasonably thoroughly under X11R2 on uVaxen as well.
! It has been known to compile and work on SGI's Personal Iris.
Bugs
====
Known problems:
Splines leave a residue caused by a lousy rubber banding
method. If you think you can do better, please do.
--- 8,36 ----
and DEFAULTPAGEWIDTH. These are set to fill the entire screen on a Sun 3/50
ordinary resolution or uvax3200.
! 4. xmkmf to make a new Makefile from the Imakefile, make depend, make clean,
! make.
! 5. To test it, copy the file fontdesc/xpic to $HOME/.xpic, run it with the
command
xpic test/test.xpic
xpic uses the X.V11R3 font naming convention and the X.V11R3 fonts.
! 6. make install. (You can remove $HOME/.xpic now)
! Notes: You need to have the HP Widgets installed as XWLIB. The ones
! in contrib/toolkits/Xw in X.V11R4 should work. (The ones in R3 probably
! will not work)
xpic has been tested very extensively under X11R2 and R3 on monochrome
and color Suns and reasonably thoroughly under X11R2 on uVaxen as well.
! It has been seen to work under R4 and has been known to compile and
! work on an SGI Iris4D.
Bugs
====
Known problems:
+
Splines leave a residue caused by a lousy rubber banding
method. If you think you can do better, please do.
***************
*** 39,46 ****
philosophy, and seems hard to fix - if you want to undo
something, undo it immediately after doing it!
! Rubberbanding thick objects is SLOOOOW, especially on machines
! without hardware floating point support. Yell at your server vendor.
If you do run into a bug, please tell me exactly what happened so I can try
to track it down - ideally, if you could narrow it down to a reproducible
--- 40,48 ----
philosophy, and seems hard to fix - if you want to undo
something, undo it immediately after doing it!
! Rubberbanding thick objects might be SLOOOOW, especially on
! machines without hardware floating point support. Yell at your
! server vendor. (or get the R4 server)
If you do run into a bug, please tell me exactly what happened so I can try
to track it down - ideally, if you could narrow it down to a reproducible
***************
*** 48,58 ****
line, and then click the adjust buttons, the line vanishes" would make it
possible to fix the bug without divination!
! Please do send in bug reports - chances are that I'll be able to find the
! bug a bit faster, unless it depends on specific peculiarities of your system
! - and then I might be able to offer pointers and narrow down the
! possibilities. With a bug report, please send me the output of an 'xrdb
! -query'.
Finally the disclaimer:
This program was developed as an independent project to satisfy a need
--- 50,60 ----
line, and then click the adjust buttons, the line vanishes" would make it
possible to fix the bug without divination!
! Please do send in bug reports - chances are that I'll be able to find
! the bug a bit faster, unless it depends on specific peculiarities of
! your system - and then I might be able to offer pointers and narrow
! down the possibilities. With a bug report, please send me the output
! of an 'xrdb -query', and an xpic file of the picture you were editing.
Finally the disclaimer:
This program was developed as an independent project to satisfy a need
diff -r -c orig/xpic/newfonts.c contrib/clients/xpic/newfonts.c
*** orig/xpic/newfonts.c Fri Nov 24 02:19:11 1989
--- contrib/clients/xpic/newfonts.c Sun Feb 18 10:33:59 1990
***************
*** 75,81 ****
if (nf == 0) {
#ifdef DEBUG
(void) fprintf(stderr, "Warning: No fonts found for %s\n",
! prefix);
#endif
continue;
}
--- 75,81 ----
if (nf == 0) {
#ifdef DEBUG
(void) fprintf(stderr, "Warning: No fonts found for %s\n",
! pattern);
#endif
continue;
}
***************
*** 89,100 ****
fn = getfontname(*cp);
#ifdef DEBUG
! fprintf(stderr, " %s %s %s\n", *cp, fn[PIXEL_SIZE], fn[RESOLUTION_Y]);
#endif
! if (fn[PIXEL_SIZE] == NULL || fn[RESOLUTION_X] == NULL)
continue;
addfont(fptr, strsave(*cp),
! atoi(fn[PIXEL_SIZE]), atoi(fn[RESOLUTION_Y]));
cp++;
}
XFreeFontNames(fontnames);
--- 89,100 ----
fn = getfontname(*cp);
#ifdef DEBUG
! fprintf(stderr, " %s %s %s\n", *cp, fn[POINT_SIZE], fn[RESOLUTION_Y]);
#endif
! if (fn[POINT_SIZE] == NULL || fn[RESOLUTION_Y] == NULL)
continue;
addfont(fptr, strsave(*cp),
! atoi(fn[POINT_SIZE]), atoi(fn[RESOLUTION_Y]));
cp++;
}
XFreeFontNames(fontnames);
***************
*** 163,181 ****
char *fontname;
int fontsize, dpi;
{
! int realsize = (8. * dpi * fontsize)/(75. * gridSpacing) + .5;
! #if 0
! /*
! * This is the exact font calculation - the above fudge gives better
! * results since the fonts are 75 dpi and the xpic grid is 80 dpi. So
! * we just fake it to pretend both are the same
! */
! int realsize = (dpi * fontsize)/(10. * gridSpacing) + .5;
! #endif
register int i;
register FontSizes *sptr;
register FontSizes *sp;
/*
* Find the place for inserting the fontname by pointsize - the
* table is ordered by pointsize
--- 163,176 ----
char *fontname;
int fontsize, dpi;
{
! int realsize = (fontsize / 10.0) * ( dpi / (gridSpacing * 10.)) + 0.5;
register int i;
register FontSizes *sptr;
register FontSizes *sp;
+ /* Fudge a little. People prefer even-numbered font sizes */
+ realsize -= realsize % 2;
+
/*
* Find the place for inserting the fontname by pointsize - the
* table is ordered by pointsize
dan
-----------------------------------------------------------
O'Reilly && Associates
argv at sun.com / argv at ora.com
632 Petaluma Ave, Sebastopol, CA 95472
800-338-NUTS, in CA: 800-533-NUTS, FAX 707-829-0104
Opinions expressed reflect those of the author only.
More information about the Comp.sources.x
mailing list