Tryst::FontHandle
A font resolved once, for the duration of a measurement pass - the batch counterpart to Interp#text_width/#font_metrics/#measure_chars, which each pay their own Tk_GetFont/Tk_FreeFont pair per call. A per-glyph layout loop doing that once per glyph is exactly the cost #with_font exists to amortize: resolve the font once, measure many glyphs against this handle, free it once.
app.with_font("TkDefaultFont") do |handle|
text.each_char.sum { |char| handle.text_width(char.to_s) }
end
Never construct directly - only valid for the lifetime of the #with_font block it was yielded to, since the underlying Tk_Font is freed the moment that block returns.