Author: matt
Date: 2009-09-15 13:33:55 -0700 (Tue, 15 Sep 2009)
New Revision: 6871
Log:
I blindly applied this patch to 1.1.10 (I don't have Xft on my Mac...) so 
please someone check for typos. Thanks. Added Xft Font Lookup Table (STR #2215)

Modified:
   branches/branch-1.1/CHANGES
   branches/branch-1.1/src/fl_font_xft.cxx

Modified: branches/branch-1.1/CHANGES
===================================================================
--- branches/branch-1.1/CHANGES 2009-09-13 22:02:30 UTC (rev 6870)
+++ branches/branch-1.1/CHANGES 2009-09-15 20:33:55 UTC (rev 6871)
@@ -1,5 +1,6 @@
 CHANGES IN FLTK 1.1.10
 
+       - Added Xft2 font lookup table (STR #2215)
        - Fixed X server "lock", if a modal dialog window is opened
          while a menu is active (STR #1986)
        - Updated mirror sites in documentation (STR #2220)

Modified: branches/branch-1.1/src/fl_font_xft.cxx
===================================================================
--- branches/branch-1.1/src/fl_font_xft.cxx     2009-09-13 22:02:30 UTC (rev 
6870)
+++ branches/branch-1.1/src/fl_font_xft.cxx     2009-09-15 20:33:55 UTC (rev 
6871)
@@ -291,11 +291,11 @@
 static XFontStruct* load_xfont_for_xft2(void) {
   XFontStruct* xgl_font = 0;
   int size = fl_size_;
-  char *weight = "medium"; // no specifc weight requested - accept any
+  const char *weight = "medium"; // no specifc weight requested - accept any
   char slant = 'r';   // regular non-italic by default
   char xlfd[128];     // we will put our synthetic XLFD in here
   char *pc = strdup(fl_fonts[fl_font_].name); // what font were we asked for?
-  char *name = pc;    // keep a handle to the original name for freeing later
+  const char *name = pc;    // keep a handle to the original name for freeing 
later
   // Parse the "fltk-name" of the font
   switch (*name++) {
   case 'I': slant = 'i'; break;     // italic
@@ -305,6 +305,19 @@
   default: name--;                  // no prefix, restore name
   }
 
+  // map generic Xft names to customary XLFD faces
+  if (!strcmp(name, "sans")) {
+    name = "helvetica";
+  } else if (!strcmp(name, "mono")) {
+    name = "courier";
+  } else if (!strcmp(name, "serif")) {
+    name = "times";
+  } else if (!strcmp(name, "screen")) {
+    name = "lucidatypewriter";
+  } else if (!strcmp(name, "dingbats")) {
+    name = "zapf dingbats";
+  }
+
   // first, we do a query with no prefered size, to see if the font exists at 
all
   snprintf(xlfd, 128, "-*-*%s*-%s-%c-*--*-*-*-*-*-*-*-*", name, weight, 
slant); // make up xlfd style name
   xgl_font = XLoadQueryFont(fl_display, xlfd);

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to