Browse Source

grid.c, windisp.c, vertical text for postscript and WINGUI

Arial as standard font for WINGUI
pre-master-46
Holger Vogt 8 years ago
parent
commit
65ee87e0a2
  1. 14
      src/frontend/plotting/grid.c
  2. 14
      src/frontend/wdisp/windisp.c

14
src/frontend/plotting/grid.c

@ -141,7 +141,13 @@ gr_redrawgrid(GRAPH *graph)
graph->fontwidth, graph->fontwidth,
(graph->absolute.height * 3) / 4, 0); (graph->absolute.height * 3) / 4, 0);
} else { } else {
DevDrawText(graph->grid.ylabel,
if (eq(dispdev->name, "postscript") || eq(dispdev->name, "Windows"))
DevDrawText(graph->grid.ylabel,
graph->fontwidth,
/*vertical text, midpoint in y is aligned midpoint of text string */
(graph->absolute.height - (int) strlen(graph->grid.ylabel) * graph->fontwidth) / 2, 90);
else /* FIXME: for now excluding X11 and others */
DevDrawText(graph->grid.ylabel,
graph->fontwidth, graph->fontwidth,
graph->absolute.height / 2, 90); graph->absolute.height / 2, 90);
} }
@ -311,8 +317,14 @@ lingrid(GRAPH *graph, double lo, double hi, double delta, int type, Axis axis)
margin = graph->viewportxoff; margin = graph->viewportxoff;
/*max = graph->viewport.width + graph->viewportxoff;*/ /*max = graph->viewport.width + graph->viewportxoff;*/
max = graph->absolute.width - graph->viewportxoff; max = graph->absolute.width - graph->viewportxoff;
/* don't subtract font height from right border of grid */
if (graph->grid.ylabel)
max += graph->fontheight;
} else { } else {
graph->viewportxoff = (digits + 5 + mag - mag3) * graph->fontwidth; graph->viewportxoff = (digits + 5 + mag - mag3) * graph->fontwidth;
/* add height of the vertical text to offset*/
if (graph->grid.ylabel)
graph->viewportxoff += graph->fontheight;
margin = graph->viewportyoff; margin = graph->viewportyoff;
/*max = graph->viewport.height + graph->viewportyoff;*/ /*max = graph->viewport.height + graph->viewportyoff;*/
max = graph->absolute.height - graph->viewportyoff; max = graph->absolute.height - graph->viewportyoff;

14
src/frontend/wdisp/windisp.c

@ -3,6 +3,7 @@
* Wolfgang Muees 27.10.97 * Wolfgang Muees 27.10.97
* Holger Vogt 07.12.01 * Holger Vogt 07.12.01
* Holger Vogt 05.12.07 * Holger Vogt 05.12.07
* Holger Vogt 01.11.18
*/ */
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
@ -71,7 +72,7 @@ extern void com_hardcopy(wordlist *wl);
#define M_LN10 2.30258509299404568402 #define M_LN10 2.30258509299404568402
#endif #endif
#define DEF_FONTW "Courier"
#define DEF_FONTW "Arial"
/* local variables */ /* local variables */
static int IsRegistered = 0; /* 1 if window class is registered */ static int IsRegistered = 0; /* 1 if window class is registered */
@ -864,9 +865,6 @@ WIN_Text(char *text, int x, int y, int angle)
tpWindowData wd; tpWindowData wd;
HFONT hfont; HFONT hfont;
LOGFONT lf; LOGFONT lf;
NG_IGNORE(angle);
int CentiDegrees = 0;
if (!currentgraph) if (!currentgraph)
return 0; return 0;
@ -877,8 +875,8 @@ WIN_Text(char *text, int x, int y, int angle)
lf.lfHeight = (int) (1.1 * currentgraph->fontheight); lf.lfHeight = (int) (1.1 * currentgraph->fontheight);
lf.lfWidth = 0; lf.lfWidth = 0;
lf.lfEscapement = CentiDegrees;
lf.lfOrientation = CentiDegrees;
lf.lfEscapement = angle * 10;
lf.lfOrientation = angle * 10;
lf.lfWeight = 500; lf.lfWeight = 500;
lf.lfItalic = 0; lf.lfItalic = 0;
lf.lfUnderline = 0; lf.lfUnderline = 0;
@ -894,9 +892,7 @@ WIN_Text(char *text, int x, int y, int angle)
(void) lstrcpy(lf.lfFaceName, DEF_FONTW); (void) lstrcpy(lf.lfFaceName, DEF_FONTW);
if (!cp_getvar("wfont_size", CP_NUM, &(lf.lfHeight), 0)) if (!cp_getvar("wfont_size", CP_NUM, &(lf.lfHeight), 0))
lf.lfHeight = (int) (1.1 * currentgraph->fontheight);
// lstrcpy (lf.lfFaceName, "Courier"/*"Times New Roman"*/);
lf.lfHeight = (int) (1.3 * currentgraph->fontheight);
hfont = CreateFontIndirect (&lf); hfont = CreateFontIndirect (&lf);
SelectObject(wd->hDC, hfont); SelectObject(wd->hDC, hfont);

Loading…
Cancel
Save