50214f805964207ffae51a783513167cb51f5e2e braney Tue Sep 29 17:49:32 2020 -0700 support font choice in freetype font support diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c index cb31886..d7b5b5e 100644 --- src/hg/hgTracks/hgTracks.c +++ src/hg/hgTracks/hgTracks.c @@ -619,31 +619,45 @@ /* 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); + { + char *fontDir = cfgOptionDefault("freeTypeDir", "/usr/share/fonts/default/Type1"); + char *defaultFont = cfgOptionDefault("freeTypeDefault", "n022003l.pfb"); + char buffer[4096]; + + extern char *freeTypeFontNames[]; + extern char *freeTypeFontFiles[]; + int ii; + for(ii=0; ii < 33; ii++) + if (sameString(freeTypeFontNames[ii], tl.textFont)) + break; + defaultFont = freeTypeFontFiles[ii]; + safef(buffer, sizeof buffer, "%s/%s", fontDir, defaultFont); + hvGfxSetFontMethod(hvg, FONT_METHOD_FREETYPE, buffer ); + } } 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;