No trailing space patch.
-- 
Mariano
diff --git a/st.c b/st.c
index 2811876..8b92289 100644
--- a/st.c
+++ b/st.c
@@ -2715,6 +2715,7 @@ xloadfonts(char *fontstr, int fontsize) {
        FcPattern *pattern;
        FcResult result;
        double fontval;
+       double DPI;
 
        if(fontstr[0] == '-') {
                pattern = XftXlfdParse(fontstr, False, False);
@@ -2734,12 +2735,21 @@ xloadfonts(char *fontstr, int fontsize) {
                if(result == FcResultMatch) {
                        usedfontsize = (int)fontval;
                } else {
-                       /*
-                        * Default font size is 12, if none given. This is to
-                        * have a known usedfontsize value.
-                        */
-                       FcPatternAddDouble(pattern, FC_PIXEL_SIZE, 12);
-                       usedfontsize = 12;
+                       /* Try to get size in Pt */
+                       result = FcPatternGetDouble(pattern, FC_SIZE, 0, 
&fontval);
+                       if(result == FcResultMatch) {
+                               DPI = XDisplayWidth(xw.dpy, xw.scr) /
+                                       (XDisplayWidthMM(xw.dpy, xw.scr) / 
25.4);
+                               usedfontsize = (int)DPI * fontval / 72;
+                               FcPatternAddDouble(pattern, FC_PIXEL_SIZE, 
usedfontsize);
+                       } else {
+                               /*
+                                * Default font size is 12, if none given. This
+                                * is to have a known usedfontsize value.
+                                */
+                               FcPatternAddDouble(pattern, FC_PIXEL_SIZE, 12);
+                               usedfontsize = 12;
+                       }
                }
        }
 

Reply via email to