fix(qt): pin the FreeType font engine on Windows

Qt's default rasteriser on Windows renders text thin and jagged. The owner's
words for the lyrics panel were "como fuente de bloc de notas con extra
alias", and the supplied screenshot shows exactly that: broken strokes and
visible stair-stepping on every line.

It is the RASTERISER, not the font and not the lyrics view. Verified on the
box by launching the same build with
QT_QPA_PLATFORM=windows:fontengine=freetype and comparing the same panel:
identical font, identical sizes, clean glyphs. So the fix belongs at the
application level, where it also cleans up the rest of the UI.

Applied only when the variable carries no real value. `offscreen` is what
the release smoke gate passes here and overwriting it would make the gate
test a platform nobody ships. Empty counts as absent for the same reason the
renderer preference now does: a cleared variable is present-with-no-value,
which var_os().is_some() reports as set.

cc
This commit is contained in:
vicrodh committed 2026-08-27 08:49:21 -06:00
1 parent 93b506dcd6
commit 559f8bfce6
1 file changed
+23
+23
View File
@@ -3334,6 +3334,29 @@ fn main() {
renderer_qt::apply_gpu_preference();
apply_scroll_physics();
// FONT ENGINE (Windows). Qt's default rasteriser on Windows renders the
// lyric text thin and jagged - the owner's words were "como fuente de
// bloc de notas con extra alias", and the same text is clean under
// FreeType. Verified on the box by launching with
// QT_QPA_PLATFORM=windows:fontengine=freetype and comparing the lyrics
// panel: same build, same font, only the rasteriser changed.
//
// Only when the variable carries no real value. `offscreen` is what the
// release smoke gate passes here, and overwriting it would make the gate
// test a platform nobody ships. Empty counts as absent: a cleared
// variable is present-with-no-value, which `var_os().is_some()` reports
// as set (the same trap the renderer preference had).
#[cfg(windows)]
{
let explicit = std::env::var_os("QT_QPA_PLATFORM")
.map(|v| !v.to_string_lossy().trim().is_empty())
.unwrap_or(false);
if !explicit {
std::env::set_var("QT_QPA_PLATFORM", "windows:fontengine=freetype");
log::info!("[qbz-qt] font engine -> freetype (Qt's Windows rasteriser aliases text)");
}
}
// D7 (research/02 §4.4): with no explicit style Qt loads `Windows` on
// Windows and `Fusion` on Linux — never Basic — and the popups without an
// explicit `background:` inherit native chrome. Pin Basic so all three