Allow setting absolute font sizes with <type>absolute</type>
authorMikael Magnusson <mikachu@gmail.com>
Mon, 12 Mar 2018 14:02:16 +0000 (15:02 +0100)
committerMikael Magnusson <mikachu@gmail.com>
Mon, 20 Mar 2023 06:28:01 +0000 (07:28 +0100)
Ie, pixel size instead of point size. (I think).

obrender/font.c
openbox/config.c

index 47606aee25acfe3645c4fe1859b5967c3d62016b..3c627926707fe7b8afdfbe489806d6db9fdeee78 100644 (file)
@@ -113,7 +113,10 @@ RrFont *RrFontOpen(const RrInstance *inst, const gchar *name, gint size,
     pango_font_description_set_family(out->font_desc, name);
     pango_font_description_set_weight(out->font_desc, pweight);
     pango_font_description_set_style(out->font_desc, pstyle);
-    pango_font_description_set_size(out->font_desc, size * PANGO_SCALE);
+    if (size < 0)
+        pango_font_description_set_absolute_size(out->font_desc, -size * PANGO_SCALE);
+    else
+        pango_font_description_set_size(out->font_desc, size * PANGO_SCALE);
 
     /* setup the layout */
     pango_layout_set_font_description(out->layout, out->font_desc);
index 112f5d06a01ee80a9696cde2adf68a6737c28be7..24abd5c1d2f5fc8453bca0731ece3f7c13ee35ff 100644 (file)
@@ -771,7 +771,11 @@ static void parse_theme(xmlNodePtr node, gpointer d)
         }
         if ((fnode = obt_xml_find_node(n->children, "size"))) {
             int s = obt_xml_node_int(fnode);
-            if (s > 0) size = s;
+            if (s > 0) {
+                size = s;
+                if (obt_xml_attr_contains(fnode, "type", "absolute"))
+                    size = -size;
+            }
         }
         if ((fnode = obt_xml_find_node(n->children, "weight"))) {
             gchar *w = obt_xml_node_string(fnode);