Mercurial > hg > xemacs-beta
annotate lwlib/lwlib-fonts.c @ 4916:a6c778975d7d
split USE_XFT into HAVE_XFT/USE_XFT
-------------------- ChangeLog entries follow: --------------------
ChangeLog addition:
2010-02-01 Ben Wing <ben@xemacs.org>
* configure:
* configure.ac (TAB):
USE_XFT* -> HAVE_XFT*.
lwlib/ChangeLog addition:
2010-02-01 Ben Wing <ben@xemacs.org>
* lwlib-colors.c:
* lwlib-colors.h:
* lwlib-fonts.c:
* lwlib-fonts.h:
* xlwmenu.c:
* xlwmenu.c (xlwMenuResources):
* xlwmenu.c (x_xft_text_width):
* xlwmenu.c (label_button_draw):
* xlwmenu.c (push_button_size):
* xlwmenu.c (push_button_draw):
* xlwmenu.c (make_drawing_gcs):
* xlwmenu.c (extract_font_extents):
* xlwmenu.c (default_font_of_font_list):
* xlwmenu.c (XlwMenuInitialize):
* xlwmenu.c (XlwMenuDestroy):
* xlwmenu.c (XlwMenuSetValues):
* xlwmenuP.h:
* xlwmenuP.h (_XlwMenu_part):
* xlwtabs.c:
* xlwtabs.c (TabsInit):
* xlwtabs.c (TabsDestroy):
* xlwtabs.c (TabsSetValues):
* xlwtabs.c (DrawTab):
* xlwtabs.c (TabWidth):
* xlwtabs.c (TabsAllocFgGC):
* xlwtabs.c (TabsAllocGreyGC):
* xlwtabsP.h:
USE_XFT* -> HAVE_XFT*.
src/ChangeLog addition:
2010-02-01 Ben Wing <ben@xemacs.org>
* Makefile.in.in:
* compiler.h:
* config.h.in:
* console-x-impl.h:
* console-x-impl.h (struct x_frame):
* console-x-impl.h (FRAME_X_TOTALLY_VISIBLE_P):
* console-x.h:
* console-xlike-inc.h:
* emacs.c (main_1):
* faces.c (complex_vars_of_faces):
* font-mgr.h:
* frame-x.c (x_delete_frame):
* frame-x.c (x_update_frame_external_traits):
* glyphs-x.c (update_widget_face):
* inline.c:
* objects-x-impl.h:
* objects-x-impl.h (struct x_color_instance_data):
* objects-x-impl.h (struct x_font_instance_data):
* objects-x.c:
* objects-x.c (x_initialize_color_instance):
* objects-x.c (x_initialize_font_instance):
* objects-x.c (x_print_font_instance):
* objects-x.c (x_finalize_font_instance):
* objects-x.c (x_font_instance_truename):
* objects-x.c (vars_of_objects_x):
* objects-x.h:
USE_XFT* -> HAVE_XFT*. But in objects-xlike-inc.c and
redisplay-xlike-inc.c, continue to use USE_XFT, and define
it appropriately in console-xlike-inc.h when both HAVE_XFT
and THIS_IS_X -- even if HAVE_XFT, we don't want to enable
XFT code when included in a *-gtk.c file.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Mon, 01 Feb 2010 22:00:29 -0600 |
parents | 316fddbf58e2 |
children | c9d31263ab7d 308d34e9f07d |
rev | line source |
---|---|
3094 | 1 /* Font handling code for X and Xft. |
2 | |
3 Copyright (C) 2003 Eric Knauel | |
4 Copyright (C) 2004 Free Software Foundation, Inc. | |
5 | |
6 Author: Stephen J. Turnbull <stephen@xemacs.org> | |
7 Created: 24 Jul 2004 by Stephen J. Turnbull | |
8 | |
9 This file is part of XEmacs. | |
10 | |
11 XEmacs is free software; you can redistribute it and/or modify it | |
12 under the terms of the GNU General Public License as published by the | |
13 Free Software Foundation; either version 2, or (at your option) any | |
14 later version. | |
15 | |
16 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
19 for more details. | |
20 | |
21 You should have received a copy of the GNU General Public License | |
22 along with XEmacs; see the file COPYING. If not, write to | |
23 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
24 Boston, MA 02111-1307, USA. */ | |
25 | |
26 /* Synched up with: Not in GNU Emacs. */ | |
27 | |
28 #include <config.h> | |
29 #include <stdio.h> | |
30 #include <stdlib.h> | |
31 #include "lwlib-fonts.h" | |
32 | |
33 #if 0 | |
34 /* these are all from ../src; if we need them move the code */ | |
35 #include "lisp.h" | |
36 #include "device.h" | |
37 #include "device-impl.h" | |
38 #include "console-x-impl.h" | |
3360 | 39 #ifdef HAVE_FONTCONFIG |
3354 | 40 #include "font-mgr.h" |
3094 | 41 #endif |
3360 | 42 #endif |
3094 | 43 |
44 /* | |
45 * code for handling Xft | |
46 */ | |
47 | |
4916
a6c778975d7d
split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents:
3360
diff
changeset
|
48 #ifdef HAVE_XFT |
3094 | 49 |
50 /* helper function to correctly open Xft/core fonts by name | |
51 #### Can't we use FcParseName here? | |
52 #### Is this done so often that the logic needs to be hard-coded in C? | |
53 | |
54 Daniel Pittman sez: Older code tried to enforce that an XLFD font was | |
55 not scaled, while this version just doesn't care. I think that is a | |
56 better behavior, since if someone really wants a scaled font we should | |
57 oblige them. | |
58 | |
59 Stephen sez: This whole function was ill-conceived, and I'm not sure it | |
60 succeeds at any of the things it attempts to do. First, we should be | |
61 using fontconfig directly. I'm not sure what Xft (or fontconfig) will | |
62 try to do if passed an XLFD. As for scaled fonts, both options are | |
63 equally bad. The problem is that the X server will often scale bitmap | |
64 fonts willy-nilly; it's worth trying to avoid that, but I can't say | |
65 whether that's worth overriding somebody who knows what they're doing. | |
66 In any case, I think we should find out what Xft (fontconfig?) is able | |
67 and willing to do with XLFDs, and probably move the logic to LISP. | |
68 */ | |
69 XftFont * | |
70 xft_open_font_by_name (Display *dpy, char *name) | |
71 { | |
72 XftFont *res = NULL; | |
73 | |
74 /* if (!NILP (Fxft_xlfd_font_name_p (make_string (name, strlen (name))))) */ | |
75 /* #### this is bogus but ... */ | |
76 int count = 0; | |
77 char *pos = name; | |
78 /* extra parens shut up gcc */ | |
79 while ((pos = index (pos, '-'))) | |
80 { | |
81 count++; | |
82 pos++; | |
83 } | |
84 | |
85 /* #### hard-coding DefaultScreen is evil! */ | |
86 if (count == 14 /* fully-qualified XLFD */ | |
87 || (count < 14 /* heuristic for wildcarded XLFD */ | |
88 && count >= 5 | |
89 && index (name, '*'))) | |
90 res = XftFontOpenXlfd (dpy, DefaultScreen (dpy), name); | |
91 else | |
92 res = XftFontOpenName (dpy, DefaultScreen (dpy), name); | |
93 | |
94 /* Try for a generic monospace font | |
95 #### Why? Menus don't need to line up in columns! */ | |
96 if (!res) | |
97 res = XftFontOpenName (dpy, DefaultScreen (dpy), "monospace"); | |
98 /* Try for anything we can get */ | |
99 if (!res) | |
100 res = XftFontOpenName (dpy, DefaultScreen (dpy), ""); | |
101 | |
102 if (!res) | |
103 { | |
104 /* #### This is Just So Wrong ... ! */ | |
105 /* sorry folks ... */ | |
106 fprintf (stderr, | |
107 "Unable to find any usable XFT font, even the defaults!\n"); | |
108 abort (); | |
109 return 0; | |
110 } | |
111 | |
112 return res; | |
113 } | |
114 | |
4916
a6c778975d7d
split USE_XFT into HAVE_XFT/USE_XFT
Ben Wing <ben@xemacs.org>
parents:
3360
diff
changeset
|
115 #endif /* HAVE_XFT */ |
3094 | 116 |
117 /* End of lwlib-fonts.c */ |