This is the final piece of my fixes to PS output.
As discussed in previous thread, this patch enables title to
be shown in PS format output.
But I did not add a option to enable/disable the drawing of
frame over viewWindow and titleWindow. First, this feature
does not exist for the screen output or bitmap output.
Second, this requires rather extensive changes, including
adding support on the SPAD side. Third, this looks like
a debugging feature to me. So I leave this portion of code
under "#if 0".
Some side notes: it looks like the PS related functions
are modeled after X11 APIs. It looks like it was designed
with mono color at first, then added some color support,
but incomplete. Some other parts also looks like unfinished
or unpolished. Also the PS functions are too tightly tangled
with X11 logic, so it is too difficult to make the generation
of PS free of X11 dependency.
About next steps:
First is to use those generated PS images for the book.
I currently used a hack in htinp.c to generate PS image,
but a proper solution is needed, maybe by tweaking the
awk scripts.
Second is to make the book generated by pdflatex.
Third is to find a proper way to generate those fancy images
listed in appendix.
- Qian
--
You received this message because you are subscribed to the Google Groups "FriCAS -
computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/fricas-devel/5a8455d0-fd49-41bb-9377-859f86aba9ad%40gmail.com.
diff --git a/src/graph/Gdraws/Gfun.c b/src/graph/Gdraws/Gfun.c
index d86fdc07..43952d35 100644
--- a/src/graph/Gdraws/Gfun.c
+++ b/src/graph/Gdraws/Gfun.c
@@ -68,10 +68,10 @@ filecopy(FILE * ifp, FILE * ofp)
*/
float Gdraws_computeScale(Window vw, Window tw) {
- XWindowAttributes vwInfo;
+ XWindowAttributes twInfo;
float pageWidth, pageHeight, scale;
- XGetWindowAttributes(dsply, vw, &vwInfo);
+ XGetWindowAttributes(dsply, tw, &twInfo);
pageWidth = 575.0;
pageHeight = 750.0;
#if 0
@@ -81,8 +81,8 @@ float Gdraws_computeScale(Window vw, Window tw) {
pageHeight *= 210.0;
fprintf(stderr, "%f, %f\n", pageWidth, pageHeight);
#endif
- if ((vwInfo.width > pageWidth) || (vwInfo.height > pageHeight)) {
- scale = fminf(pageWidth / vwInfo.width, pageHeight / vwInfo.height);
+ if ((twInfo.width > pageWidth) || (twInfo.height > pageHeight)) {
+ scale = fminf(pageWidth / twInfo.width, pageHeight / twInfo.height);
} else {
scale = 1.0;
}
@@ -112,11 +112,7 @@ PSCreateFile(
fprintf(fp, "\n grestore\t%% restore graphics state\n\n");
fclose(fp);
-#if 0
- /* Make frame drawing optional. */
-
Gdraws_drawFrame(bWidth, vw, tw, title);
-#endif
/* put procedures and script together into OUTPUT.ps */
@@ -128,12 +124,12 @@ PSCreateFile(
fprintf(ofp, "%%!PS-Adobe-2.0\n");
/* Write a Bounding Box for psfig etc. */
- XWindowAttributes vwInfo;
- XGetWindowAttributes(dsply, vw, &vwInfo);
+ XWindowAttributes twInfo;
+ XGetWindowAttributes(dsply, tw, &twInfo);
float scale = Gdraws_computeScale(vw, tw);
fprintf(fp, "%%%%BoundingBox: 0 0 %d %d\n",
- (int) ceilf(scale * vwInfo.width),
- (int) ceilf(scale * vwInfo.height));
+ (int) ceilf(scale * twInfo.width),
+ (int) ceilf(scale * twInfo.height));
i = 1;
while (i < psDrawNo) { /* loops through each file/procedure */
@@ -195,16 +191,20 @@ Gdraws_drawFrame(
fp = fopen(psData[scriptps].filename, "a");
XGetWindowAttributes(dsply, viewWindow, &vwInfo);
+ XGetWindowAttributes(dsply, titleWindow, &twInfo);
+
+ /* Make frame drawing optional. */
+#if 0
/* draw title window */
- XGetWindowAttributes(dsply, titleWindow, &twInfo);
fprintf(fp, "\t%s\t%d\t%d\t%d\t%d\ttitle\n", "frameDict",
twInfo.height - vwInfo.height, twInfo.width, 0, vwInfo.height);
/* draw viewport window */
fprintf(fp, "\t%s\tdrawFrame\n", "frameDict"); /* using Gdraws_setDimension() */
+#endif
/* draw title text */