comparison lwlib/xlwmenu.c @ 136:b980b6286996 r20-2b2

Import from CVS: tag r20-2b2
author cvs
date Mon, 13 Aug 2007 09:31:12 +0200
parents 8619ce7e4c50
children 6b37e6ddd302
comparison
equal deleted inserted replaced
135:4636a6841cd6 136:b980b6286996
67 *fontList resource set, or at least know how to deal with this. */ 67 *fontList resource set, or at least know how to deal with this. */
68 XtRString, "-*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-1"}, 68 XtRString, "-*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-1"},
69 #else 69 #else
70 {XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), 70 {XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *),
71 offset(menu.font), XtRString, "XtDefaultFont"}, 71 offset(menu.font), XtRString, "XtDefaultFont"},
72 # ifdef USE_XFONTSET
73 {XtNfontSet, XtCFontSet, XtRFontSet, sizeof(XFontSet),
74 offset(menu.font_set), XtRString, "XtDefaultFontSet"},
75 # endif
72 #endif 76 #endif
73 {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), 77 {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
74 offset(menu.foreground), XtRString, "XtDefaultForeground"}, 78 offset(menu.foreground), XtRString, "XtDefaultForeground"},
75 {XtNbuttonForeground, XtCButtonForeground, XtRPixel, sizeof(Pixel), 79 {XtNbuttonForeground, XtCButtonForeground, XtRPixel, sizeof(Pixel),
76 offset(menu.button_foreground), XtRString, "XtDefaultForeground"}, 80 offset(menu.button_foreground), XtRString, "XtDefaultForeground"},
326 #ifdef NEED_MOTIF 330 #ifdef NEED_MOTIF
327 Dimension width, height; 331 Dimension width, height;
328 XmStringExtent (mw->menu.font_list, s, &width, &height); 332 XmStringExtent (mw->menu.font_list, s, &width, &height);
329 return width; 333 return width;
330 #else 334 #else
335 # ifdef USE_XFONTSET
336 XRectangle ri, rl;
337 XmbTextExtents (mw->menu.font_set, s, strlen (s), &ri, &rl);
338 return rl.width;
339 # else
331 XCharStruct xcs; 340 XCharStruct xcs;
332 int drop; 341 int drop;
333 XTextExtents (mw->menu.font, s, strlen (s), &drop, &drop, &drop, &xcs); 342 XTextExtents (mw->menu.font, s, strlen (s), &drop, &drop, &drop, &xcs);
334 return xcs.width; 343 return xcs.width;
344 # endif /* USE_XFONTSET */
335 #endif 345 #endif
336 } 346 }
337 347
338 static char massaged_resource_char[256]; 348 static char massaged_resource_char[256];
339 349
684 1000, /* ???? width */ 694 1000, /* ???? width */
685 XmALIGNMENT_BEGINNING, 695 XmALIGNMENT_BEGINNING,
686 0, /* ???? layout_direction */ 696 0, /* ???? layout_direction */
687 0); 697 0);
688 #else 698 #else
699 # ifdef USE_XFONTSET
700 XmbDrawString (XtDisplay (mw), window, mw->menu.font_set, gc,
701 x, y + mw->menu.font_ascent, string, strlen (string));
702 # else
689 XDrawString (XtDisplay (mw), window, gc, 703 XDrawString (XtDisplay (mw), window, gc,
690 x, y + mw->menu.font_ascent, string, strlen (string)); 704 x, y + mw->menu.font_ascent, string, strlen (string));
705 # endif /* USE_XFONTSET */
691 706
692 #endif 707 #endif
693 } 708 }
694 709
695 static void 710 static void
2658 } 2673 }
2659 #endif /* Motif version */ 2674 #endif /* Motif version */
2660 XmFontListFreeFontContext (context); 2675 XmFontListFreeFontContext (context);
2661 } 2676 }
2662 #else /* Not Motif */ 2677 #else /* Not Motif */
2678 # ifdef USE_XFONTSET
2679 XFontStruct **fontstruct_list;
2680 char **fontname_list;
2681 XFontStruct *font;
2682 int fontcount = XFontsOfFontSet(mw->menu.font_set, &fontstruct_list,
2683 &fontname_list);
2684 mw->menu.font_ascent = 0;
2685 mw->menu.font_descent = 0;
2686 # if 0 /* nasty, personal debug, Kazz */
2687 fprintf(stderr, "fontSet count is %d\n", fontcount);
2688 # endif
2689 while (--fontcount >= 0) {
2690 font = fontstruct_list[fontcount];
2691 if (font->ascent > (int) mw->menu.font_ascent)
2692 mw->menu.font_ascent = font->ascent;
2693 if (font->descent > (int) mw->menu.font_descent)
2694 mw->menu.font_descent = font->descent;
2695 }
2696 # else /* ! USE_XFONTSET */
2663 mw->menu.font_ascent = mw->menu.font->ascent; 2697 mw->menu.font_ascent = mw->menu.font->ascent;
2664 mw->menu.font_descent = mw->menu.font->descent; 2698 mw->menu.font_descent = mw->menu.font->descent;
2699 # endif
2665 #endif /* NEED_MOTIF */ 2700 #endif /* NEED_MOTIF */
2666 } 2701 }
2667 2702
2668 #ifdef NEED_MOTIF 2703 #ifdef NEED_MOTIF
2669 static XFontStruct * 2704 static XFontStruct *