deca5eaeff633b054ba0091c391298fc7dc34377 braney Sat Nov 21 12:29:43 2020 -0800 finalizing freeType font work diff --git src/hg/lib/trackLayout.c src/hg/lib/trackLayout.c index cb7e331..bf79402 100644 --- src/hg/lib/trackLayout.c +++ src/hg/lib/trackLayout.c @@ -50,32 +50,45 @@ if (val != NULL) enabled = sameString(val, "yes"); first = FALSE; } return enabled; } void trackLayoutInit(struct trackLayout *tl, struct cart *cart) /* Initialize layout around small font and a picture about 600 pixels * wide, but this can be overridden by cart. */ { char *fontType = "medium"; boolean fontExtras = trackLayoutInclFontExtras(); if (fontExtras) fontType = cartUsualString(cart, "fontType", fontType); +if (cfgOptionBooleanDefault("freeType", FALSE)) + { + tl->textFont = cartUsualString(cart, textFontVar, cfgOptionDefault("freeTypeFont","Bitmap")); + char *style = cartUsualString(cart, textStyleVar, "Normal"); + + if (differentString(style, "Normal")) + { + char buffer[4096]; + safef(buffer, sizeof buffer, "%s-%s",tl->textFont, style); + tl->textFont = cloneString(buffer); + } + } +else + tl->textFont = cartUsualString(cart, textFontVar, "Helvetica"); -tl->textFont = cartUsualString(cart, textFontVar, cfgOptionDefault("freeTypeFont","Helvetica")); tl->textSize = mgFontSizeBackwardsCompatible(cartUsualString(cart, textSizeVar, cfgOptionDefault(textSizeVar,"small"))); MgFont *font = mgFontForSizeAndStyle(tl->textSize, fontType); tl->font = font; tl->mWidth = mgFontStringWidth(font, "M"); tl->nWidth = mgFontStringWidth(font, "n"); tl->fontHeight = mgFontLineHeight(font); tl->barbHeight = tl->fontHeight/4; tl->barbSpacing = (tl->fontHeight+1)/2; tl->picWidth = hgDefaultPixWidth; trackLayoutSetPicWidth(tl, cartOptionalString(cart, "pix")); // label width, but don't exceed 1/2 of image tl->leftLabelWidthChars = cartUsualInt(cart, leftLabelWidthVar, leftLabelWidthDefaultChars); if (tl->leftLabelWidthChars < 2) tl->leftLabelWidthChars = leftLabelWidthDefaultChars; tl->leftLabelWidth = tl->leftLabelWidthChars*tl->nWidth + trackTabWidth + 3;