summaryrefslogtreecommitdiff
path: root/src/preproc
diff options
context:
space:
mode:
authorwlemb <wlemb>2000-02-24 07:52:43 +0000
committerwlemb <wlemb>2000-02-24 07:52:43 +0000
commit5efe553cedc5a33a7e909b22d14fb7fafba313fd (patch)
tree9c0cbf6181691c6b5f89655abff0311985d1ebd4 /src/preproc
parent2f56b957ed930033b432e2c2589e9430f44a089f (diff)
downloadgroff-5efe553cedc5a33a7e909b22d14fb7fafba313fd.tar.gz
* src/preproc/grn/main.cc: Introduce BASE_THICKNESS, defining
line thicknesses to be integer multiples of this value. * doc/groff.texinfo: Further checking/updating. * src/preproc/grn/{main.cc, hgraph.cc}: Using point units to specify line thickness instead of base units. The new default values are now 0.15,pt 0.45pt, and 0.75pt for thin, middle, and thick lines respectively. Removed unused variable `prevval'. * src/preproc/grn/grn.man: Updated.
Diffstat (limited to 'src/preproc')
-rw-r--r--src/preproc/grn/grn.man10
-rw-r--r--src/preproc/grn/hgraph.cc7
-rw-r--r--src/preproc/grn/main.cc46
3 files changed, 33 insertions, 30 deletions
diff --git a/src/preproc/grn/grn.man b/src/preproc/grn/grn.man
index 76e92031..7197f1d4 100644
--- a/src/preproc/grn/grn.man
+++ b/src/preproc/grn/grn.man
@@ -203,9 +203,13 @@ may be abbreviated down to `sc'.
.BI thick\ N
Set the thickness of
.IR gremlin 's
-narrow (medium or thick) lines to
-.IR N .
-The default is 1 (resp. 3 and 5) pixels.
+narrow (resp. medium and thick) lines to
+.I N
+times 0.15pt
+.RI ( N
+must be an integer).
+The default is 1 (resp. 3 and 5), which corresponds to 0.15pt
+(resp. 0.45pt and 0.75pt).
.TP
.BI pointscale\ <off/on>
Scale text to match the picture.
diff --git a/src/preproc/grn/hgraph.cc b/src/preproc/grn/hgraph.cc
index 4948e3b6..4e153a9d 100644
--- a/src/preproc/grn/hgraph.cc
+++ b/src/preproc/grn/hgraph.cc
@@ -16,11 +16,10 @@
#define len(a, b) hypot((double)(b.x-a.x), (double)(b.y-a.y))
-extern int prevval; /* spacing between dots */
extern int dotshifter; /* for the length of dotted curves */
extern int style[]; /* line and character styles */
-extern int thick[];
+extern double thick[];
extern char *tfont[];
extern int tsize[];
extern int stipple_index[]; /* stipple font index for stipples 0 - 16 */
@@ -28,7 +27,7 @@ extern char *stipple; /* stipple type (cf or ug) */
extern double troffscale; /* imports from main.c */
-extern int linethickness;
+extern double linethickness;
extern int linmod;
extern int lastx;
extern int lasty;
@@ -391,7 +390,7 @@ HGSetBrush(int mode)
}
if (linethickness != thick[mode]) {
linethickness = thick[mode];
- printf("\\h'-%du'\\D't %du'", linethickness, linethickness);
+ printf("\\h'-%.2lfp'\\D't %.2lfp'", linethickness, linethickness);
printed = 1;
}
if (printed)
diff --git a/src/preproc/grn/main.cc b/src/preproc/grn/main.cc
index 3e4b4d90..bf163ce3 100644
--- a/src/preproc/grn/main.cc
+++ b/src/preproc/grn/main.cc
@@ -34,7 +34,7 @@
* pointscale - Turn on scaling point sizes to match
* `scale' commands. (Optional operand
* `off' to turn it off.)
- * narrow, medium, thick - Set pixel widths of lines.
+ * narrow, medium, thick - Set widths of lines.
* file - Set the file name to read the gremlin
* picture from. If the file isn't in
* the current directory, the gremlin
@@ -107,10 +107,9 @@ static char sccsid[] = "@(#) (Berkeley) 8/5/85, 12/28/99";
int res; /* the printer's resolution goes here */
-int prevval; /* spacing between dots */
int dotshifter; /* for the length of dotted curves */
-int linethickness; /* brush styles */
+double linethickness; /* brush styles */
int linmod;
int lastx; /* point registers for printing elements */
int lasty;
@@ -128,15 +127,22 @@ char *deffont[] =
{"R", "I", "B", "S"};
int defsize[] =
{10, 16, 24, 36};
-int defthick[STYLES] =
-{1, 1, 5, 1, 1, 3};
+/* #define BASE_THICKNESS 1.0 */
+#define BASE_THICKNESS 0.15
+double defthick[STYLES] =
+{1 * BASE_THICKNESS,
+ 1 * BASE_THICKNESS,
+ 5 * BASE_THICKNESS,
+ 1 * BASE_THICKNESS,
+ 1 * BASE_THICKNESS,
+ 3 * BASE_THICKNESS};
/* int cf_stipple_index[NSTIPPLES + 1] = */
-/* { 0, 1, 3, 12, 14, 16, 19, 21, 23 }; */
+/* {0, 1, 3, 12, 14, 16, 19, 21, 23}; */
/* a logarithmic scale looks better than a linear one for the gray shades */
-
+/* */
/* int other_stipple_index[NSTIPPLES + 1] = */
-/*{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; */
+/* {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; */
int cf_stipple_index[NSTIPPLES + 1] =
{0, 18, 32, 56, 100, 178, 316, 562, 1000}; /* only 1-8 used */
@@ -163,7 +169,7 @@ double adj2 = 0.0;
double adj3 = 0.0;
double adj4 = 0.0;
-int thick[STYLES]; /* thicknesses set by defaults, then by */
+double thick[STYLES]; /* thicknesses set by defaults, then by */
/* commands */
char *tfont[FONTS]; /* fonts originally set to deffont values, */
/* then */
@@ -362,17 +368,14 @@ getres(void)
res = font::res;
/* Correct the brush thicknesses based on res */
- if (res >= 256) {
- defthick[0] = res >> 8;
- defthick[1] = res >> 8;
- defthick[2] = res >> 4;
- defthick[3] = res >> 8;
- defthick[4] = res >> 8;
- defthick[5] = res >> 6;
- }
-
- /* Set up the spacing between dots in a dotted line, not used */
- prevval = res >> 4;
+ /* if (res >= 256) {
+ defthick[0] = res >> 8;
+ defthick[1] = res >> 8;
+ defthick[2] = res >> 4;
+ defthick[3] = res >> 8;
+ defthick[4] = res >> 8;
+ defthick[5] = res >> 6;
+ } */
linepiece = res >> 9;
for (dotshifter = 0; linepiece; dotshifter++)
@@ -823,17 +826,14 @@ interpret(char *line)
break;
case 't': /* thick */
- /* thick[2] = atoi(str2); */
thick[2] = defthick[0] * atoi(str2);
break;
case 'm': /* medium */
- /* thick[5] = atoi(str2); */
thick[5] = defthick[0] * atoi(str2);
break;
case 'n': /* narrow */
- /* thick[0] = thick[1] = thick[3] = thick[4] = atoi(str2); */
thick[0] = thick[1] = thick[3] = thick[4] =
defthick[0] * atoi(str2);
break;