be4311c07e14feb728abc6425ee606ffaa611a58 markd Fri Jan 22 06:46:58 2021 -0800 merge with master diff --git src/lib/pscmGfx.c src/lib/pscmGfx.c index 06db3d6..4f98893 100644 --- src/lib/pscmGfx.c +++ src/lib/pscmGfx.c @@ -235,33 +235,37 @@ { pscmSetColor(pscm, c); psDrawBox(ps, x, yOff, 1, height); } } } static void pscmSetFont(struct pscmGfx *pscm, MgFont *font) /* Set font. */ { /* For now we basically still get the sizing info from the old * gem fonts. I'm not sure how to get sizing info out of * PostScript. We'll try and arrange it so that the PostScript * fonts match the gem fonts more or less. */ void *v = font; -if ((pscm->fontMethod == 0) && (v != pscm->curFont)) +if (v != pscm->curFont) { + if (pscm->fontMethod == 0) psTimesFont(pscm->ps, font->psHeight); + else + psSetFont(pscm->ps, pscm->fontName, font->psHeight); + pscm->curFont = v; } } void pscmText(struct pscmGfx *pscm, int x, int y, int color, MgFont *font, char *text) /* Draw a line of text with upper left corner x,y. */ { pscmSetColor(pscm, color); pscmSetFont(pscm, font); psTextAt(pscm->ps, x, y, text); boxPscm = NULL; } void pscmTextRight(struct pscmGfx *pscm, int x, int y, int width, int height, @@ -745,31 +749,30 @@ psSetDash(pscm->ps, FALSE); // PostScript bezier is cubic -- derive the two control points from the single quadratic control point double c1x = bezierQuadraticToCubic(x1, x2); double c1y = bezierQuadraticToCubic(y1, y2); double c2x = bezierQuadraticToCubic(x3, x2); double c2y = bezierQuadraticToCubic(y3, y2); psDrawCurve(pscm->ps, (double)x1, (double)y1, c1x, c1y, c2x, c2y, (double)x3, (double)y3); psSetDash(pscm->ps, FALSE); } void pscmSetFontMethod(struct pscmGfx *pscm, unsigned int method, char *fontName, char *fontFile) /* Which font drawing method shoud we use. */ { pscm->fontMethod = method; pscm->fontName = cloneString(fontName); -psSetFont(pscm->ps, fontName); } struct vGfx *vgOpenPostScript(int width, int height, char *fileName) /* Open up something that will someday be a PostScript file. */ { struct vGfx *vg = vgHalfInit(width, height); vg->data = pscmOpen(width, height, fileName); vg->close = (vg_close)pscmClose; vg->dot = (vg_dot)pscmDot; vg->box = (vg_box)pscmBox; vg->line = (vg_line)pscmLine; vg->text = (vg_text)pscmText; vg->textRight = (vg_textRight)pscmTextRight; vg->textCentered = (vg_textCentered)pscmTextCentered; vg->findColorIx = (vg_findColorIx)pscmFindColorIx;