From bde9b8a21aae2f35316f3e0b33f234677671e3b3 Mon Sep 17 00:00:00 2001 From: dan Date: Sat, 30 Nov 2002 02:19:46 +0000 Subject: [PATCH] forgot to add these in cvs --- README.antialiasing | 154 ++++++++++++++++++++++++++++++++++++++++++++ Sample.XftConfig | 79 +++++++++++++++++++++++ 2 files changed, 233 insertions(+) create mode 100644 README.antialiasing create mode 100644 Sample.XftConfig diff --git a/README.antialiasing b/README.antialiasing new file mode 100644 index 00000000..240291f4 --- /dev/null +++ b/README.antialiasing @@ -0,0 +1,154 @@ + +Here is a step by step mini-HOWTO of the things needed to be done to get +antialiased fonts in Window Maker quickly: + +1. Make sure you have a recent XFree server (4.x or newer, but 4.2.x or newer + is preferable). Also make sure it supports the RENDER extension (you can + see this in the output of xdpyinfo) and it has the freetype extension + module (you should have a /usr/X11R6/lib/modules/fonts/libfreetype.a file). +2. Make sure you have the following lines in your XF86Config file in the + "Module" section: + Load "type1" + Load "freetype" + Load "extmod" + (Not sure if extmod is really required for antialiased fonts, but it won't + hurt). +3. Install some True Type fonts say in /usr/X11R6/lib/X11/fonts/TrueType +4. To generate the fonts.scale and fonts.dir files in the directory where the + True Type fonts were installed you need an utility named ttmkfdir. There is + also an utility named mkttfdir but that only supports ISO8859-1 and JIS + encodings. From my experience ttmkfdir will recognize more fonts and works + better so I recommend using this one. You should issue these commands to + generate the fonts.scale and fonts.dir files: + cd /usr/X11R6/lib/X11/fonts/TrueType + ttmkfdir -o fonts.scale + mkfontdir +5. Now add /usr/X11R6/lib/X11/fonts/TrueType to your font path in the + XF86Config file. It goes in the "Files" section as: + FontPath "/usr/X11R6/lib/X11/fonts/TrueType" + I recommend to put this at the top of your font path list. +6. You can restart the X server at this point, to make all these changes take + effect. +7. Edit your /etc/X11/XftConfig file (or ~/.xftconfig if you don't have + access to edit the global file). Make sure that the True Type font path is + _before_ the Type1 font path. You should have something like this: + dir "/usr/X11R6/lib/X11/fonts/TrueType" + dir "/usr/X11R6/lib/X11/fonts/Type1" + If you add extra True type paths, add them before the Type1 path + If the Type1 path is first, and the Xft library fails to find/load the font + you asked for, it will load some very ugly defaults. + A sample XftConfig file is included with the Window Maker source at + toplevel as Sample.XftConfig. You can use that as reference and for ideas. +8. Compile and install Window Maker. No special switches are needed. However + watch the ./configure output and check if it says that Antialiased text + support is enabled in WINGs. If not, probably it failed to find libXft. + Check that you have the development files for your X server installed. +9. Edit ~/GNUstep/Defaults/WMGLOBAL and add entries for the following: + AntialiasedSystemFont = "-*-trebuchet ms-medium-r-normal-*-%d-*-*-*-*-*-*-*"; + AntialiasedBoldSystemFont = "-*-trebuchet ms-bold-r-normal-*-%d-*-*-*-*-*-*-*"; + AntialiasedText = Yes; + Use a font that you have installed on your system (arial and "trebuchet ms" + are good choices). + If AntialiasedText is enabled in WMGLOBAL, all WINGs based application will + use antialiased fonts by default (this includes Window Maker). + You can then disable the antialiased fonts on the per application basis by + adding an AntialiasedText = No; entry in their specific configuration files + The entry in the application's configuration file will always overwrite the + global setting from WMGLOBAL. + However if you want most of your WINGs applications to use normal fonts, + but just a few to use antialiased fonts, then put AntialiasedText = No; in + WMGLOBAL, and enable antialiased fonts only in the applications you want, + by adding the AntialiasedText = Yes; in their own configuration files + +At this point all WINGs based application should be able to use antialiased +fonts. You can check this by enabling antialiasing and starting WPrefs. It +should show nice antialiased text everywhere. + +Now to enable antialiased fonts in Window Maker, there are 2 possibilities: + +10a. Add entries for all font options in ~/GNUstep/Defaults/WindowMaker + containing True Type fonts ("trebuchet ms", arial or verdana should work + fine). Don't use non True Type fonts like Helvetica, because Xft won't + load them, instead will load some defaults. Depending on the TrueTupe vs + Type1 path order in your XftConfig file and the options declared there, + it can range from "Extremely ugly" (if path to Type1 is before the path + to True Type fonts), to "Acceptable" (if the True Type path comes first). + Also modify all your themes to hold True Type fonts for all the font + options + +10b. Leave the fonts as they are (for example leave the default Helvetica) in + ~/GNUstep/Defaults/WindowMaker, and add an alias (or more) in the + XftConfig file. This alias should look something like: + match any family == "Helvetica" edit family += "Trebuchet MS"; + match any family == "Courier" edit family += "Courier New"; + ... + Which means that every time the Xft library (which is used the WINGs) gets + a request to load a Helvetica font, it will load the "trebuchet ms" font + instead, keeping all the other font parameters unchanged. + +Each of these 2 methods have advantages and disadvantages. + +Case 10a: +--------- +With the first method, you do more work and you will not be able to use +existing themes by just enabling antialiasing, because it will load default +fonts which may not look as you want. You will need to change the fonts in +every theme you want to use by replacing them with True Type fonts. + +If you plan to switch antialiasing on/off, this method has a big disadvantage: +you need to edit your configuration/themes with every switch (at least if you +want Helvetica or other Type1 font for the non-antialiased case). This is +because if you have a font set to (say) Arial and want to switch antialiasing +off, you will get the normal version of Arial and you need to edit your font +options again to see Helvetica. +If you are happy with how the non-antialiased version of your True Type fonts +looks this disadvantage goes away. In this case you will use the same font +(say arial) with both antialiased/normal fonts. + +OTOH this method gives you fine tune over the fonts used in Window Maker and +you will be able to set each individual font as you like. + +Case 10b: +--------- +With the second method, you have almost nothing to do. Just define the proper +aliases in the XftConfig file, and whenever some of the fonts you aliased is +requested it's True Type alias will be loaded. +This way you can use all your old themes and all you have to do except adding +the aliases to the XftConfig file, is to enable or disable antialiasing the +the configuration file. + +For example if Helvetica is aliased to Arial, if you have antialiasing +disabled, Helvetica will be used, but if you enable antialiasing Arial will +be used instead. This method is very handy if you want to use existing themes +you don't want to modify, or if you want to switch antialiasing on/off and +don't want to edit your font options with every such switch. + +The downside of this method is that if you don't have some font aliased in +the XftConfig file, it will load some default instead. +Also another downside is that you cannot fine tune your fonts. They will be +translated by the alias rules in XftConfig from whatever they are defined in +the theme. Sometimes this is not optimal. + +For example if you aliased Helvetica to "Trebuchet MS" and all your screen +fonts are Helvetica (at different sizes). With antialiasing disabled the +Helvetica fonts everywhere looks good. However with antialiasing enabled the +10pt font used by the miniwindow titles looks better if Arial is used. Also +the 10pt font used by the clip looks better with Verdana. Same for the 12pt +font used by balloons which is also better if Arial is used. But with this +method you cannot do such fine tuning, unless you edit your font options in +the Window Maker configuration file, in which case there will be a mix of the +2 methods. + +11. At this point if all was properly done, all you have to do is either add + an AntialiasedText = Yes; entry to ~/GNUstep/Defaults/WindowMaker, or + start WPrefs, goto the Expert Settings panel, and check the + "Smooth font edges" option. Currently you need to restart if you switch + antialiasing on/off (this may change in the future) + + +Final note: antialiased text only looks good if a True Type font is +used for it. Either by directly specifying it, or providing an alias in +the XftConfig file. The idea is that the font Xft loads (after all the +aliases have beed resolved) should point to a True Type font. Else +unpleasant results may show on your screen :P + diff --git a/Sample.XftConfig b/Sample.XftConfig new file mode 100644 index 00000000..338da80c --- /dev/null +++ b/Sample.XftConfig @@ -0,0 +1,79 @@ +# $XFree86: xc/lib/Xft/XftConfig.cpp,v 1.8 2001/11/21 23:41:12 keithp Exp $ + +dir "/usr/share/fonts/truetype" +dir "/usr/X11R6/lib/X11/fonts/TrueType" +dir "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType" +dir "/usr/X11R6/lib/X11/fonts/Type1" + +# +# alias 'fixed' for 'mono' +# +match any family == "fixed" edit family =+ "mono"; + +# +# Check users config file +# +includeif "~/.xftconfig" + +# +# Substitute TrueType fonts for Type1 versions +# +match any family == "Times" edit family += "Times New Roman"; +#match any family == "Helvetica" edit family += "Verdana"; +#match any family == "Helvetica" edit family += "Arial"; +match any family == "Helvetica" edit family += "Trebuchet MS"; +match any family == "Courier" edit family += "Courier New"; + +# +# Use TrueType fonts for defaults +# +match any family == "serif" edit family += "Times New Roman"; +match any family == "sans" edit family += "Verdana"; + +# +# Use monotype.com (andale) face where possible +# +match + any family == "mono" + all slant == roman + all weight < bold +edit + family += "monotype.com"; +# +# otherwise, use courier +# +match any family == "mono" edit family += "Courier New"; + +# +# Alias between XLFD families and font file family name, prefer local fonts +# +match any family == "charter" edit family += "bitstream charter"; +match any family == "bitstream charter" edit family =+ "charter"; + +match any family == "Charter" edit family += "Bitstream Charter"; +match any family == "Bitstream Charter" edit family =+ "Charter"; + +match any family == "Lucidux Serif" edit family += "LuciduxSerif"; +match any family == "LuciduxSerif" edit family =+ "Lucidux Serif"; + +match any family == "Lucidux Sans" edit family += "LuciduxSans"; +match any family == "LuciduxSans" edit family =+ "Lucidux Sans"; + +match any family == "Lucidux Mono" edit family += "LuciduxMono"; +match any family == "LuciduxMono" edit family =+ "Lucidux Mono"; + +# +# TrueType font aliases +# +match any family == "Comic Sans" edit family += "Comic Sans MS"; +match any family == "Comic Sans MS" edit family =+ "Comic Sans"; +match any family == "Trebuchet" edit family += "Trebuchet MS"; +match any family == "Trebuchet MS" edit family =+ "Trebuchet"; +match any family == "Monotype" edit family =+ "Monotype.com"; +match any family == "Andale Mono" edit family += "Monotype.com"; +match any family == "Monotype.com" edit family =+ "Andale Mono"; + +# +# +match any family == "webdings" edit encoding += "glyphs-fontspecific"; +match any family == "symbol" edit encoding += "glyphs-fontspecific";