Author: fejj
Date: 2007-09-26 17:49:44 -0400 (Wed, 26 Sep 2007)
New Revision: 86452

Modified:
   trunk/moon/src/font.cpp
   trunk/moon/src/font.h
Log:
Added face index - needed for font uri stuff

Modified: trunk/moon/src/font.cpp
===================================================================
--- trunk/moon/src/font.cpp     2007-09-26 21:38:23 UTC (rev 86451)
+++ trunk/moon/src/font.cpp     2007-09-26 21:49:44 UTC (rev 86452)
@@ -581,6 +581,7 @@
        weight = FontWeightsNormal;
        stretch = FontStretchesNormal;
        size = 14.666f;
+       index = 0;
 }
 
 TextFontDescription::TextFontDescription (const char *str)
@@ -608,8 +609,10 @@
        pattern = FcPatternCreate ();
        FcPatternAddDouble (pattern, FC_DPI, dpi);
        
-       if (set & FontMaskFilename)
+       if (set & FontMaskFilename) {
                FcPatternAddString (pattern, FC_FILE, (FcChar8 *) filename);
+               FcPatternAddInteger (pattern, FC_INDEX, index);
+       }
        
        families = g_strsplit (GetFamily (), ",", -1);
        for (i = 0; families[i]; i++)
@@ -666,6 +669,7 @@
        if (mask & FontMaskFilename) {
                g_free (filename);
                filename = NULL;
+               index = 0;
        }
        
        if (mask & FontMaskFamily) {
@@ -688,6 +692,8 @@
                        changed = true;
                }
                
+               index = desc->index;
+               
                set |= FontMaskFilename;
        }
        
@@ -766,6 +772,18 @@
        }
 }
 
+int
+TextFontDescription::GetIndex ()
+{
+       return index;
+}
+
+void
+TextFontDescription::SetIndex (int index)
+{
+       this->index = index;
+}
+
 const char *
 TextFontDescription::GetFamily ()
 {
@@ -855,6 +873,7 @@
        if (set & FontMaskFilename) {
                g_string_append (str, "font:");
                g_string_append (str, filename);
+               g_string_append_printf (str, "?index=%d", index);
                g_string_append (str, "?family=");
        }
        
@@ -867,7 +886,7 @@
                        g_string_append (str, family);
                }
        } else if (!(set & FontMaskFilename)) {
-               g_string_append (str, "Lucida Sans");
+               g_string_append (str, "\"Lucida Sans Unicode, Lucida Sans\"");
        }
        
        if ((set & FontMaskStyle) && style != FontStylesNormal) {

Modified: trunk/moon/src/font.h
===================================================================
--- trunk/moon/src/font.h       2007-09-26 21:38:23 UTC (rev 86451)
+++ trunk/moon/src/font.h       2007-09-26 21:49:44 UTC (rev 86452)
@@ -137,6 +137,7 @@
        FontWeights weight;
        FontStretches stretch;
        double size;
+       int index;
        
        FcPattern *CreatePattern ();
        
@@ -156,6 +157,9 @@
        const char *GetFilename ();
        void SetFilename (const char *filename);
        
+       int GetIndex ();
+       void SetIndex (int index);
+       
        const char *GetFamily ();
        void SetFamily (const char *family);
        

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to