Add layout diagnosis: font metrics in the log, --snapshot option

On the Steam Frame, the fixed 1200x800 QML layout overflows: about the
bottom quarter is cut off and the navigation icons overlap their text.
Forcing 96 DPI and switching the Quick Controls style didn't help, so the
cause has to be measured rather than guessed.

- SetWidget() logs the application font (family, pt, px), what 20 pt
  (MyText) is in px, the screen's DPI and the device pixel ratio.
- --snapshot <file> writes the rendered overlay (RenderBackend::readback)
  as PNG at most once per second while it is visible. A time interval,
  because OVRAS only renders when the scene changes. Written to a
  temporary file and renamed, so readers never see a partial file.
- run.sh passes arguments after the graphics API to the program.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 00:06:09 +02:00
co-authored by Claude Opus 5.5
parent bbb3d1ba0e
commit d664f86945
9 changed files with 122 additions and 13 deletions
+21
View File
@@ -260,6 +260,27 @@ existing code:
private API.
- RPATH is only `$ORIGIN` (`BUILD_WITH_INSTALL_RPATH`): the build tree gets packaged.
## 10. Layout diagnosis: font log and `--snapshot` (approved 2026-10-08)
**Why:** on the Frame the fixed 1200×800 layout overflows: the bottom quarter is cut off
(left: Statistics, Bindings, Settings; right: Microphone, Push-to-Talk), and the navigation
icons overlap their text. `QT_FONT_DPI=96`, `QT_QUICK_CONTROLS_STYLE=Basic` and the Material
"Dense" variant didn't fix it. Font metrics (Noto Sans instead of Segoe UI) are the main
suspect; measuring needs the unwarped rendered image.
**Changes (platform-neutral):**
- `OverlayController::SetWidget()`: logs once the application font (family, pt, px), what
20 pt (`MyText`) is in px, the screen's logical/physical DPI and the window's device pixel
ratio.
- Option `--snapshot <file>` (`setup.*`, `main.cpp`, `overlaycontroller.*`): while the
overlay is visible and rendered, `renderOverlay()` writes `RenderBackend::readback()` as
PNG to `<file>`, at most once per second (OVRAS only renders when the scene changes, so a
frame count could never trigger on a still page). Written to `<file>.tmp` and renamed.
`main.cpp` passes it through a setter, not a new constructor parameter, to keep the diff
small. Without the option nothing changes.
- `run.sh`: arguments after the graphics API go to the program
(`./run.sh opengl --snapshot /tmp/ovras.png`).
## Tests
- **x86_64 locally:** the build succeeds; `objdump` check (R1).