7216fbf3ffc72cb77bf509c0bffe719a1daa0ed5 braney Sun Sep 6 16:20:34 2020 -0700 first cut at using FreeType for font support diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c index 1664d0a..231bd00 100644 --- src/hg/hgTracks/hgTracks.c +++ src/hg/hgTracks/hgTracks.c @@ -614,30 +614,37 @@ && winStart <= cb->chromEnd) { safef(startBand, buffSize, "%s", cb->name); } /* End is > rather than >= due to odditiy in the cytoband track where the starts and ends of two bands overlaps by one. */ if (winEnd > cb->chromStart && winEnd <= cb->chromEnd) { safef(endBand, buffSize, "%s", cb->name); } } } +static void maybeNewFonts(struct hvGfx *hvg) +/* Check to see if we want to use the alternate font engine (FreeType2). */ +{ +if (sameString(cfgOptionDefault("freeType", "off"), "on")) + hvGfxSetFontMethod(hvg, FONT_METHOD_FREETYPE); +} + boolean makeChromIdeoImage(struct track **pTrackList, char *psOutput, struct tempName *ideoTn) /* Make an ideogram image of the chromosome and our position in it. If the * ideoTn parameter is not NULL, it is filled in if the ideogram is created. */ { struct track *ideoTrack = NULL; MgFont *font = tl.font; char *mapName = "ideoMap"; struct hvGfx *hvg; boolean doIdeo = TRUE; int ideoWidth = round(.8 *tl.picWidth); int ideoHeight = 0; int textWidth = 0; struct tempName pngTn; boolean nukeIdeoFromList = FALSE; @@ -689,30 +696,31 @@ /* Start up client side map. */ if (!psOutput) hPrintf("\n", mapName); /* Draw the ideogram. */ ideoHeight = gfxBorder + ideoTrack->height; if (psOutput) { trashDirFile(ideoTn, "hgtIdeo", "hgtIdeo", ".ps"); hvg = hvGfxOpenPostScript(ideoWidth, ideoHeight, ideoTn->forCgi); } else { trashDirFile(ideoTn, "hgtIdeo", "hgtIdeo", ".png"); hvg = hvGfxOpenPng(ideoWidth, ideoHeight, ideoTn->forCgi, FALSE); } + maybeNewFonts(hvg); hvg->rc = revCmplDisp; initColors(hvg); ideoTrack->ixColor = hvGfxFindRgb(hvg, &ideoTrack->color); ideoTrack->ixAltColor = hvGfxFindRgb(hvg, &ideoTrack->altColor); hvGfxSetClip(hvg, 0, gfxBorder, ideoWidth, ideoTrack->height); if (virtMode) { if (!sameString(virtModeShortDescr,"")) safef(title, sizeof(title), "%s (%s)", chromName, virtModeShortDescr); else safef(title, sizeof(title), "%s (%s)", chromName, virtModeType); } else if (isEmpty(startBand)) safef(title, sizeof(title), "%s", chromName); else if (sameString(startBand, endBand)) @@ -5031,30 +5039,32 @@ if (theImgBox && theImgBox->showPortal && withLeftLabels) { // TODO: It would be great to make the two images smaller, // but keeping both the same full size for now struct tempName pngTnSide; trashDirFile(&pngTnSide, "hgtSide", "side", ".png"); hvgSide = hvGfxOpenPng(pixWidth, pixHeight, pngTnSide.forCgi, transparentImage); // Also add the side image theSideImg = imgBoxImageAdd(theImgBox,pngTnSide.forHtml,NULL,pixWidth, pixHeight,FALSE); hvgSide->rc = revCmplDisp; initColors(hvgSide); } } +maybeNewFonts(hvg); +maybeNewFonts(hvgSide); hvg->rc = revCmplDisp; initColors(hvg); /* Start up client side map. */ hPrintf("\n", mapName); if (theImgBox == NULL) // imageV2 highlighting is done by javascript. This does pdf and view-image highlight highlightRegions(cart, hvg, imagePixelHeight); for (window=windows; window; window=window->next) { /* Find colors to draw in. */ findTrackColors(hvg, window->trackList); }