mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Use fixed overlay text font
Use Qt's system fixed font for viewer overlay text instead of the generic monospace family, avoiding the Windows font-resolution delay seen during measurement overlays. Generated with the assistance of an AI coding tool.
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "OverlayRenderer.h"
|
||||
|
||||
#include <QFont>
|
||||
#include <QFontDatabase>
|
||||
#include <QFontMetrics>
|
||||
#include <QPainter>
|
||||
#include <QtGlobal>
|
||||
@@ -58,6 +59,13 @@ GLuint link(QOpenGLFunctions_4_5_Core* gl, GLuint vs, GLuint fs) {
|
||||
return p;
|
||||
}
|
||||
|
||||
QFont overlayTextFont(int point_size) {
|
||||
QFont font = QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
||||
font.setPointSize(point_size);
|
||||
font.setStyleHint(QFont::TypeWriter);
|
||||
return font;
|
||||
}
|
||||
|
||||
// ---- Triangle program (flat color) ----
|
||||
|
||||
const char* TRI_VS = R"(
|
||||
@@ -620,10 +628,8 @@ void OverlayRenderer::render(const float view_proj[16],
|
||||
const bool any_painter = !hud_text_.isEmpty() || !labels_.empty();
|
||||
if (!any_painter) return;
|
||||
|
||||
QFont label_font("monospace", 9);
|
||||
label_font.setStyleHint(QFont::TypeWriter);
|
||||
QFont hud_font("monospace", 11);
|
||||
hud_font.setStyleHint(QFont::TypeWriter);
|
||||
QFont label_font = overlayTextFont(9);
|
||||
QFont hud_font = overlayTextFont(11);
|
||||
const QFontMetrics lfm(label_font);
|
||||
const QFontMetrics hfm(hud_font);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user