Monday, October 27, 2008

Wine and fonts

Wine makes it possible to run validly-licensed windows software applications.
There are a few windows apps that I can use if I want to.
I installed wine-0.9.49 because it interacts nicely with the applications I want to use.
I tried installing wine-1.0.1 which is claimed as stable, but MsAccess queries returned incorrect results?
I tried installing wine-1.1.1 but it failed in miserable ways.
If you are using different software, a different wine may be more appropriate.
Which wine? Your guess is as good as anybody's, but 0.9.49 worked for me.
Be sure to have at least ??MB available. At least 300 to 400 or more.
It will eat much space while it is building.
Each user will probably want a couple hundred MB.
The bin and lib will add around 100MB.

Cups should be installed and a printer should be set up before installing the wine package because many windows programs foul up or throw a tantrum if they can't have their default printer.

Unpack the tarball and change to the unpacked directory.

INSTALLING WITH TYPICAL COMMANDS
./configure
make
make install

- OR -

INSTALLING WITH INSTRUCTIONS at WineHQ
./configure
make depend
make
make install
(This method intalls wine in /usr/local.)
(I am not familiar with make depend.)

- OR -

INSTALLING WITH WINEINSTALL
Just do ./tools/wineinstall
It will ask if it is ok to do an "su".
If you say no, I think it will bail out and stop.
Therefore, say yes and wait approximately 2 hours.
... After waiting [just like windows] ...
Then you must type the root password.
Then it will continue and do its make install business.
(This method intalls wine in /usr/local.)

I guess it is ok to install wine in /usr/local because it is one of those packages you may want to isolate and redo/undo several times (assuming 2 hours is available each time for each redo.)

WINE and FONTS
Wine is drunk with its handling of fonts sometimes.
Lfs enables the freetype bytecode interpreter by default.
The bottom line is that I prefer windows fonts in wine without the bytecode interpreter enabled and with the "try to look like freetype (NonW2k)" registry settings below.

To my knowledge, the bytecode interpreter affects only certain fonts. The impact of the bytecode interpreter is to allow windows fonts to be displayed as they would be displayed in windows 2000. This has been dubbed "sharp fonts" by some, and there is a following. But to my taste, "sharp fonts" are blocky and more disturbing to look at than the typical "blurry" anti-aliased fonts. You can change settings in the wine registry to anti-alias instead, but then the fonts get rendered with faint spots in characters such as W2KRr, which is also disturbing to look at. I have found it to be necessary to build freetype with the bytecode interpreter not-enabled in order to see fonts in wine applications rendered by freetype (not using bytecoder) in the same way they would be rendered in linux.

The registry settings in ~/.wine/user.reg to "try to look like freetype" and "try to look like w2k" are:
::::::::::::::
user.reg-NonW2k.txt
::::::::::::::
[Software\\Wine\\X11 Driver]
"ClientSideAntiAliasWithCore"="N"
"ClientSideAntiAliasWithRender"="Y"
"ClientSideWithCore"="N"
"ClientSideWithRender"="Y"
"Managed"="Y"
::::::::::::::
user.reg-W2k.txt
::::::::::::::
[Software\\Wine\\X11 Driver]
"ClientSideAntiAliasWithCore"="N"
"ClientSideAntiAliasWithRender"="N"
"ClientSideWithCore"="N"
"ClientSideWithRender"="Y"
"Managed"="Y"

Many experiments switching true to false and viewing in mousepad text editor showed that freetype (or is it fontconfig) provides more flexibility in dealing with these bytecode capable fonts than wine does.
Here is an example ~/.fonts.conf file used for experiments with the parameters hinting, antialias, and autohint:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<dir>~/.wine/drive_c/windows/fonts</dir>
<match target="pattern" name="family">
<test qual="any" name="family">
<string>Arial</string>
<string>Verdana</string>
<string>Andale</string>
<string>Comic</string>
<string>Cour</string>
<string>Georgia</string>
<string>Impact</string>
<string>Tahoma</string>
<string>Times</string>
<string>Trebuc</string>
<string>Webdings</string>
</test>
<!-- unsure this needed here -->
<edit mode="assign" name="hinting" >
<bool>true</bool>
</edit>
<edit mode="assign" name="antialias">
<bool>true</bool>
</edit>
<!-- turn off? patented byte code interpreter hinting -->
<edit mode="assign" name="autohint">
<bool>true</bool>
</edit>
</match>
</fontconfig>


Here is a custom/config script to build freetype without enabling the bytecode interpreter (or the patented subpixel):
::::::::::::::
/jhalfs/custom/config/2112-freetype
::::::::::::::
#
# $Id$
#
# Any comments you wish to add
#
# PACKAGE NAME: freetype-2.3.4
#
# DEPENDENCIES:

PKG="freetype"
PKG_VERSION="2.3.4"
PKG_FILE="${PKG}-${PKG_VERSION}.tar.bz2"
URL="ftp://anduin.linuxfromscratch.org/BLFS/conglomeration/$PKG/$PKG_FILE"
#URL="http://downloads.sourceforge.net/freetype/freetype-2.3.4.tar.bz2"
MD5="40cb37ba6c003845208c1b89cf507249"
for i in PATCH{1..10}; do
unset $i
done
PATCH1=""

( cat << "xEOFx"

# For enabling the bytecode interpreter
# For enabling the patented subpixel
#sed -i -r -e 's:.*(#.*BYTE.*) .*:\1:' \
# -e 's:.*(#.*SUBPIX.*) .*:\1:' \
# include/freetype/config/ftoption.h

# For enabling the bytecode interpreter
# For not enabling the patented subpixel
#sed -i -r -e 's:.*(#.*BYTE.*) .*:\1:' \
# include/freetype/config/ftoption.h

# For enabling the patented subpixel
# For not enabling the bytecode interpreter
#sed -i -r -e 's:.*(#.*SUBPIX.*) .*:\1:' \
# include/freetype/config/ftoption.h

# None of the above for enabling neither BYTE nor SUBPIX (no sed cmd)

./configure --prefix=/usr
make
make install

if [ -d docs ]; then
install -v -m755 -d /usr/share/doc/freetype-2.3.4 &&
cp -v -R docs/* /usr/share/doc/freetype-2.3.4
fi

ldconfig

xEOFx
) > tmp

:::::::::::::::

Substitue freetype 2.3.7 instead of the 2.3.4 above if you like.
I know 2.3.4 is not the current BLFS 6.3 version of freetype, but it takes a long time to get to the bottom of font convolutions, and upgrading freetype would mean starting the research and testing all over again. Fonts is not straightforward. The subpixel rendering is quite an involved and intricate undertaking. Wine does not or can not do subpixel rendering -- and openoffice doesn't/can't either. I still prefer the grey anti-aliasing to even the best result of tweaking the "beautiful rainbow fonts" also known as sub-pixel rendering.

The subpixel rendering FOO relies on several players: freetype, cairo, xft, and perhaps fontconfig. The patches to make it happen were never maintained for cairo and xft except in:
libcairo-1.2.4-lcd-cleartype-like.diff
libXft-2.1.8.2-lcd-cleartype-like.diff
Above patches from David Turner's LCD ClearType-like patches
These maybe can apply cleanly to blfs versions of cairo and libXft ... I haven't tested subpixel in a while.

I recently found the suggestion that latest cairo-1.8.0 allows the freetype to handle it, and that would be nice. http://lwn.net/Articles/293581/
"LCD subpixel filtering using FreeType
- -------------------------------------
FreeType 2.3.5 added support for various LCD subpixel filtering, and
fontconfig 2.6.0 added support for configuring LCD filter on a font by font
basis. Cairo now relies on FreeType and fontconfig for subpixel filtering.
This work is based on David Turner's original patch to cairo, maintained
and tested by Sylvain Pasche and others. Thanks all!"
THAT DO NOT MENTION XFT ???

Now blfs-6.3 has cairo-1.4.14 and fontconfig-2.4.2 so you see how squashy the subpixel mishmash is. You could be stepping right into a mess.

Again, the above digression had nothing to do with wine.


Installing Microsoft Office 97 in wine:

Run winecfg and set Windows Version to Windows 98 for installing O97
sh winetricks dcom98
Install Office 97
Run Word once before running Excel for the first time (else hang)

Unless the dcom98 (above) is installed, Microsoft Office 97 with Access fails to install: "accwiz.dll failed to register itself".

I got good results with the optional "REGISTRY" changes below which can also be edited in user.reg or using regedit.
The DllOverrides were reccommended in a wine/office/install how to.
The X11 Driver settings are to let X11 handle the window frame and the fonts.
The Access Settings are to set a size for the MS Access window.

wine regedit MSACCESS.REG
::::::::::::
MSACCESS.REG
::::::::::::

REGEDIT4

[HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides]
"itss"="native,builtin"
"ole32"="native,builtin"
"oleaut32"="native,builtin"
"olepro32"="native,builtin"
"rpcrt4"="native,builtin"
"stdole2.tlb"="native,builtin"
"stdole32.tlb"="native,builtin"

[HKEY_CURRENT_USER\\Software\\Wine\\X11 Driver]
"ClientSideAntiAliasWithCore"="N"
"ClientSideAntiAliasWithRender"="Y"
"ClientSideWithCore"="N"
"ClientSideWithRender"="Y"
"Managed"="Y"

[HKEY_CURRENT_USER\\Software\\Microsoft\\Office\\8.0\\Access\\Settings]
"Maximized"=dword:00000000
"MRUFlags1"=dword:00000000
"Prefs Migrated"=dword:00000001
"Window Height"=dword:000001f1
"Window Left"=dword:00000002
"Window Top"=dword:00000004
"Window Width"=dword:000002e5

::::::::::::::::::::
::::::::::::::::::::

Here is a custom config script to build wine:
::::::::::::::
/jhalfs/custom/config/5122-wine
::::::::::::::
#
# $Id$
#
# Any comments you wish to add
#
# PACKAGE NAME: wine-0.9.49
#
# DEPENDENCIES:

PKG="wine"
PKG_VERSION="0.9.49"
PKG_FILE="${PKG}-${PKG_VERSION}.tar.bz2"
#URL="ftp://anduin.linuxfromscratch.org/BLFS/conglomeration/$PKG/$PKG_FILE"
URL="http://internap.dl.sourceforge.net/sourceforge/wine/wine-0.9.49.tar.bz2"
MD5="417912f28e48ddc6c4285a493d070564"
for i in PATCH{1..10}; do
unset $i
done
PATCH1=""

( cat << "xEOFx"

./configure
make
make install

xEOFx
) > tmp


On an lfs system, the only fonts I ever needed to install were the Bitstream Vera fonts which, in olden days, were included in Xorg-6.9.0, and I never needed to customize a "fonts.conf" file except for experimentation.
The Bitstream Vera fonts were installed by copying the .ttf files to
${PREFIX}/lib/X11/fonts/TTF
Then, as BLFS reccommends, make a X11-TTF link with
ln -svn ${PREFIX}/lib/X11/fonts/TTF /usr/share/fonts/X11-TTF

The above ${PREFIX} is often /usr (where Xorg is installed).

... I think I forgot to mention ...
I installed fontforge-20061220 before installing wine.
Without fontforge, in some apps, the Minimize, Maximize, and Close symbols at the upper right of the window looked peculiar.




When installing Microsoft Office 97 Professional,
I made these selections/deselections

CUSTOM

DeSelect:

Microsoft Binder
Microsoft Outlook
Microsoft Bookshelf Basics
Getting Results Book
Office Tools -> Microsoft Office Shortcut Bar
Office Tools -> Office Assistant
Office Tools -> Organizational Chart
Office Tools -> MS Info
Office Tools -> Find Fast

Additionally Select:

Data Access -> Microsoft Query
Data Access -> Data Access Objects for Visual Basic


Q: Do all programs run well in wine?
A: Some do. Some may require considererable effort to achieve acceptable performance.


I ran into ACCESS: Screen Blank Making Selections in Label Wizard and solved that problem by doing:
sh winetricks corefonts

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

Click blog title for the latest post