Fix incorrect font sizes (#321)

Recently, when chasing the font size differences between the wayland and xcb Qt backends, I ended up normalizing on the wayland sizing when bypassing the backend's font metrics calculation (#272).  Unfortunately, the wayland backend was not rendering the font sizes correctly, and it was a mistake to duplicate its behavior. 

* Assume a virtual DPI of 72 pixels/in instead of 96 when compulting font size
  - Based on testing, this produces the correct font size
  - Updated reference labels.
* No longer need to scale fonts when importing glabels-3 files.
  - The glabels-3 font sizes were correct afterall!  (#306)
  - No longer need to compensate for scale factor in unit tests when importing glabels-3 files.
This commit is contained in:
Jaye Evins
2026-03-27 15:47:46 -04:00
committed by GitHub
parent 06675f8314
commit d1ee78e58a
5 changed files with 10 additions and 15 deletions
+1 -3
View File
@@ -53,8 +53,6 @@ namespace
using namespace glabels::model;
const uint32_t GDK_PIXBUF_MAGIC_NUMBER {0x47646b50};
const double FONT_SCALE_FACTOR {0.75}; // In glabels-3, fonts were rendered at 75% of specified fontsize
const Distance MARGIN_OFFSET { Distance::pt(3) }; // In glabels-3, margin was not accounted for in text baseline calculations
typedef enum
@@ -557,7 +555,7 @@ namespace glabels::model
/* font attrs */
fontFamily = XmlUtil::getStringAttr( element, "font_family", "Sans" );
fontSize = XmlUtil::getDoubleAttr( element, "font_size", 10 ) * FONT_SCALE_FACTOR;
fontSize = XmlUtil::getDoubleAttr( element, "font_size", 10 );
fontWeight = getWeightAttr( element, "font_weight", QFont::Normal );
fontItalicFlag = XmlUtil::getBoolAttr( element, "font_italic", false );