cf3880c50c550e4deb61c9664f4f994e13ab6dd8
max
  Mon Aug 17 08:05:58 2026 -0700
hgc/hgTracks: fix three items from the v502 code review, refs #38106

Shared BLAT alignment links (hgc g=htcBlatAlign) drew the page and then
exit(0), which skips main's cartCheckout, so the loaded session was never
written back and the recipient's cart ended up nearly empty. Add
cartCheckout(&cart) before all four exit(0) calls that follow webEndGb(),
including the two early error returns.

squishCodonFont() decided FreeType was active with a looser test than
maybeNewFonts(), missing the requirement that the font name match a row in
freeTypeFonts[]; when they disagreed the bitmap engine got a cell height it
cannot render. Factor the engine decision into freeTypeFontActive() and use
it in both places.

Query name, chrom and a hub's organism string went raw into single-quoted JS
string literals and page titles on the modern alignment page; the shared-link
path reads the query name back out of a bigPsl, so it is not covered by
hgBlat's whitelist. javaScriptLiteralEncode the JS arguments and htmlEncode
the HTML labels.

Also add "u"/"s" (the shared-link session selectors) to hgc excludeVars so
they are not left in the reader's cart.

diff --git src/hg/hgTracks/hgTracks.h src/hg/hgTracks/hgTracks.h
index d7b9bfa00cd..9f894dce35c 100644
--- src/hg/hgTracks/hgTracks.h
+++ src/hg/hgTracks/hgTracks.h
@@ -1918,30 +1918,35 @@
 boolean loadRecTrackSetFromFile(struct cart *cart, char *sessionName);
 /* If a contents file exists in htdocs for this recommended track set, merge its
  * settings into the current cart and return TRUE.  Return FALSE if no file, so the
  * caller can fall back to loading the session from hgcentral. */
 
 Color colorFromSoTerm(enum soTerm term);
 /* Assign a Color according to soTerm: red for non-synonymous, green for synonymous, blue for
  * UTR/noncoding, black otherwise. */
 
 void maybeNewFonts(struct hvGfx *hvg);
 /* Check to see if we want to use the alternate font engine (FreeType2). */
 
 void initFontEngine();
 /* Load the text engine the user has picked, before anything measures a string. */
 
+boolean freeTypeFontActive();
+/* TRUE when the FreeType font engine is the one maybeNewFonts() will actually switch to.  Callers
+ * that pick a font to match the live engine (e.g. squishCodonFont) must use this rather than a
+ * looser test, or they can hand the bitmap engine a cell height it cannot render. */
+
 Color colorFromCart(struct track *tg, Color color);
 /* Return the RGB color from the cart setting 'colorOverride' or just return color */
 
 unsigned getParaLoadTimeout();
 // get the parallel load timeout in seconds (defaults to 90)
 
 void maybeDrawQuickLiftLines( struct track *tg, int seqStart, int seqEnd,
                       struct hvGfx *hvg, int xOff, int yOff, int width,
                       MgFont *font, Color color, enum trackVisibility vis);
 /* Draw the indel regions as a highlight. */
 
 unsigned findBiggest(unsigned num);
 /* find biggest font not bigger than num */
 #endif /* HGTRACKS_H */