5c16e9df442a6a66c91f8cbf52f7543cb9cb4517 braney Mon Dec 6 16:34:22 2021 -0800 add new function to the graphics library to put text in a box that is used by the logo function of wiggle draws diff --git src/lib/pscmGfx.c src/lib/pscmGfx.c index 4f98893..ec25f4c 100644 --- src/lib/pscmGfx.c +++ src/lib/pscmGfx.c @@ -276,30 +276,40 @@ pscmSetFont(pscm, font); psTextRight(pscm->ps, x, y, width, height, text); boxPscm = NULL; } void pscmTextCentered(struct pscmGfx *pscm, int x, int y, int width, int height, int color, MgFont *font, char *text) /* Draw a line of text centered in box defined by x/y/width/height */ { pscmSetColor(pscm, color); pscmSetFont(pscm, font); psTextCentered(pscm->ps, x, y, width, height, text); boxPscm = NULL; } +void pscmTextInBox(struct pscmGfx *pscm, int x, int y, + int width, int height, int color, MgFont *font, char *text) +/* Draw a line of text that fills in box defined by x/y/width/height */ +{ +pscmSetColor(pscm, color); +pscmSetFont(pscm, font); +psTextInBox(pscm->ps, x, y, width, height, text); +boxPscm = NULL; +} + void pscmFillUnder(struct pscmGfx *pscm, int x1, int y1, int x2, int y2, int bottom, Color color) /* Draw a 4 sided filled figure that has line x1/y1 to x2/y2 at * it's top, a horizontal line at bottom at it's bottom, and * vertical lines from the bottom to y1 on the left and bottom to * y2 on the right. */ { pscmSetColor(pscm, color); psFillUnder(pscm->ps, x1, y1, x2, y2, bottom); boxPscm = NULL; } void psPolyFindExtremes(struct gfxPoly *poly, int *pMinX, int *pMaxX, int *pMinY, int *pMaxY) @@ -763,30 +773,31 @@ pscm->fontName = cloneString(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->textInBox = (vg_textInBox)pscmTextInBox; vg->findColorIx = (vg_findColorIx)pscmFindColorIx; vg->colorIxToRgb = (vg_colorIxToRgb)pscmColorIxToRgb; vg->setClip = (vg_setClip)pscmSetClip; vg->unclip = (vg_unclip)pscmUnclip; vg->verticalSmear = (vg_verticalSmear)pscmVerticalSmear; vg->fillUnder = (vg_fillUnder)pscmFillUnder; vg->drawPoly = (vg_drawPoly)pscmDrawPoly; vg->ellipse = (vg_ellipse)pscmEllipse; vg->circle = (vg_circle)pscmCircle; vg->curve = (vg_curve)pscmCurve; vg->setHint = (vg_setHint)pscmSetHint; vg->getHint = (vg_getHint)pscmGetHint; vg->getFontPixelHeight = (vg_getFontPixelHeight)pscmGetFontPixelHeight; vg->getFontStringWidth = (vg_getFontStringWidth)pscmGetFontStringWidth; vg->setWriteMode = (vg_setWriteMode)pscmSetWriteMode;