ops
[wmaker-crm.git] / README.antialiasing
blob240291f444dd9eafbf1cd298daabea855ad0b91c
2 Here is a step by step mini-HOWTO of the things needed to be done to get
3 antialiased fonts in Window Maker quickly:
5 1. Make sure you have a recent XFree server (4.x or newer, but 4.2.x or newer
6    is preferable). Also make sure it supports the RENDER extension (you can
7    see this in the output of xdpyinfo) and it has the freetype extension
8    module (you should have a /usr/X11R6/lib/modules/fonts/libfreetype.a file).
9 2. Make sure you have the following lines in your XF86Config file in the
10    "Module" section:
11      Load "type1"
12      Load "freetype"
13      Load "extmod"
14    (Not sure if extmod is really required for antialiased fonts, but it won't
15     hurt).
16 3. Install some True Type fonts say in /usr/X11R6/lib/X11/fonts/TrueType
17 4. To generate the fonts.scale and fonts.dir files in the directory where the
18    True Type fonts were installed you need an utility named ttmkfdir. There is
19    also an utility named mkttfdir but that only supports ISO8859-1 and JIS
20    encodings. From my experience ttmkfdir will recognize more fonts and works
21    better so I recommend using this one. You should issue these commands to
22    generate the fonts.scale and fonts.dir files:
23      cd /usr/X11R6/lib/X11/fonts/TrueType
24      ttmkfdir -o fonts.scale
25      mkfontdir
26 5. Now add /usr/X11R6/lib/X11/fonts/TrueType to your font path in the
27    XF86Config file. It goes in the "Files" section as:
28      FontPath "/usr/X11R6/lib/X11/fonts/TrueType"
29    I recommend to put this at the top of your font path list.
30 6. You can restart the X server at this point, to make all these changes take
31    effect.
32 7. Edit your /etc/X11/XftConfig file (or ~/.xftconfig if you don't have
33    access to edit the global file). Make sure that the True Type font path is
34    _before_ the Type1 font path. You should have something like this:
35      dir "/usr/X11R6/lib/X11/fonts/TrueType"
36      dir "/usr/X11R6/lib/X11/fonts/Type1"
37    If you add extra True type paths, add them before the Type1 path
38    If the Type1 path is first, and the Xft library fails to find/load the font
39    you asked for, it will load some very ugly defaults.
40    A sample XftConfig file is included with the Window Maker source at
41    toplevel as Sample.XftConfig. You can use that as reference and for ideas.
42 8. Compile and install Window Maker. No special switches are needed. However
43    watch the ./configure output and check if it says that Antialiased text
44    support is enabled in WINGs. If not, probably it failed to find libXft.
45    Check that you have the development files for your X server installed.
46 9. Edit ~/GNUstep/Defaults/WMGLOBAL and add entries for the following:
47      AntialiasedSystemFont = "-*-trebuchet ms-medium-r-normal-*-%d-*-*-*-*-*-*-*";
48      AntialiasedBoldSystemFont = "-*-trebuchet ms-bold-r-normal-*-%d-*-*-*-*-*-*-*";
49      AntialiasedText = Yes;
50    Use a font that you have installed on your system (arial and "trebuchet ms"
51    are good choices).
52    If AntialiasedText is enabled in WMGLOBAL, all WINGs based application will
53    use antialiased fonts by default (this includes Window Maker).
54    You can then disable the antialiased fonts on the per application basis by
55    adding an AntialiasedText = No; entry in their specific configuration files
56    The entry in the application's configuration file will always overwrite the
57    global setting from WMGLOBAL.
58    However if you want most of your WINGs applications to use normal fonts,
59    but just a few to use antialiased fonts, then put AntialiasedText = No; in
60    WMGLOBAL, and enable antialiased fonts only in the applications you want,
61    by adding the AntialiasedText = Yes; in their own configuration files
63 At this point all WINGs based application should be able to use antialiased
64 fonts. You can check this by enabling antialiasing and starting WPrefs. It
65 should show nice antialiased text everywhere.
67 Now to enable antialiased fonts in Window Maker, there are 2 possibilities:
69 10a. Add entries for all font options in ~/GNUstep/Defaults/WindowMaker
70      containing True Type fonts ("trebuchet ms", arial or verdana should work
71      fine). Don't use non True Type fonts like Helvetica, because Xft won't
72      load them, instead will load some defaults. Depending on the TrueTupe vs
73      Type1 path order in your XftConfig file and the options declared there,
74      it can range from "Extremely ugly" (if path to Type1 is before the path
75      to True Type fonts), to "Acceptable" (if the True Type path comes first).
76      Also modify all your themes to hold True Type fonts for all the font
77      options
79 10b. Leave the fonts as they are (for example leave the default Helvetica) in
80      ~/GNUstep/Defaults/WindowMaker, and add an alias (or more) in the 
81      XftConfig file. This alias should look something like:
82        match any family == "Helvetica"         edit family += "Trebuchet MS";
83        match any family == "Courier"           edit family += "Courier New";
84        ...
85      Which means that every time the Xft library (which is used the WINGs) gets
86      a request to load a Helvetica font, it will load the "trebuchet ms" font
87      instead, keeping all the other font parameters unchanged.
89 Each of these 2 methods have advantages and disadvantages.
91 Case 10a:
92 ---------
93 With the first method, you do more work and you will not be able to use
94 existing themes by just enabling antialiasing, because it will load default
95 fonts which may not look as you want. You will need to change the fonts in
96 every theme you want to use by replacing them with True Type fonts.
98 If you plan to switch antialiasing on/off, this method has a big disadvantage:
99 you need to edit your configuration/themes with every switch (at least if you
100 want Helvetica or other Type1 font for the non-antialiased case). This is
101 because if you have a font set to (say) Arial and want to switch antialiasing
102 off, you will get the normal version of Arial and you need to edit your font
103 options again to see Helvetica.
104 If you are happy with how the non-antialiased version of your True Type fonts
105 looks this disadvantage goes away. In this case you will use the same font
106 (say arial) with both antialiased/normal fonts.
108 OTOH this method gives you fine tune over the fonts used in Window Maker and
109 you will be able to set each individual font as you like. 
111 Case 10b:
112 ---------
113 With the second method, you have almost nothing to do. Just define the proper
114 aliases in the XftConfig file, and whenever some of the fonts you aliased is
115 requested  it's True Type alias will be loaded. 
116 This way you can use all your old themes and all you have to do except adding
117 the aliases to the XftConfig file, is to enable or disable antialiasing the
118 the configuration file.
120 For example if Helvetica is aliased to Arial, if you have antialiasing
121 disabled, Helvetica will be used, but if you enable antialiasing Arial will
122 be used instead. This method is very handy if you want to use existing themes
123 you don't want to modify, or if you want to switch antialiasing on/off and
124 don't want to edit your font options with every such switch.
126 The downside of this method is that if you don't have some font aliased in
127 the XftConfig file, it will load some default instead.
128 Also another downside is that you cannot fine tune your fonts. They will be
129 translated by the alias rules in XftConfig from whatever they are defined in
130 the theme. Sometimes this is not optimal.
132 For example if you aliased Helvetica to "Trebuchet MS" and all your screen
133 fonts are Helvetica (at different sizes). With antialiasing disabled the
134 Helvetica fonts everywhere looks good. However with antialiasing enabled the
135 10pt font used by the miniwindow titles looks better if Arial is used. Also
136 the 10pt font used by the clip looks better with Verdana. Same for the 12pt
137 font used by balloons which is also better if Arial is used. But with this
138 method you cannot do such fine tuning, unless you edit your font options in
139 the Window Maker configuration file, in which case there will be a mix of the
140 2 methods.
142 11. At this point if all was properly done, all you have to do is either add
143     an AntialiasedText = Yes; entry to ~/GNUstep/Defaults/WindowMaker, or
144     start WPrefs, goto the Expert Settings panel, and check the 
145     "Smooth font edges" option. Currently you need to restart if you switch 
146     antialiasing on/off (this may change in the future)
149 Final note: antialiased text only looks good if a True Type font is
150 used for it. Either by directly specifying it, or providing an alias in
151 the XftConfig file. The idea is that the font Xft loads (after all the
152 aliases have beed resolved) should point to a True Type font. Else
153 unpleasant results may show on your screen :P