WineHQ

Font Replacements: Difference between revisions

(initial import; fix markup; fix some grammar)
 
(add patch)
 
Line 7: Line 7:
Here is an example patch to show how to set Font Replacements in wine.inf.in:
Here is an example patch to show how to set Font Replacements in wine.inf.in:


attachment:0001-loader-wine.inf.in-Added-localized-font-name-replaceme.txt
<pre>
From a3138c9e4d8e257f60c148cfac0bbc5e74a34602 Mon Sep 17 00:00:00 2001
From: Qian Hong <[email protected]>
Date: Sat, 20 Sep 2014 00:23:54 +0800
Subject: [PATCH] loader/wine.inf.in: Added localized font name replacement.
To: wine-patches <[email protected]>
Reply-To: wine-devel <[email protected]>
Cc: Qian Hong<[email protected]>
 
See http://wiki.winehq.org/FontReplacements
---
loader/wine.inf.in | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
 
diff --git a/loader/wine.inf.in b/loader/wine.inf.in
index 42a750e..e988a8b 100644
--- a/loader/wine.inf.in
+++ b/loader/wine.inf.in
@@ -1,3 +1,6 @@
+;; To support localized font name replacement, this file should be encoded in
+;; UTF-8 with BOM, be careful not to strip the BOM header!
+;;
;; .INF script for the basic Wine configuration
;; Version: @PACKAGE_STRING@
;;
@@ -569,6 +572,21 @@ HKLM,%FontSubStr%,"Times New Roman CYR,204",,"Times New Roman,204"
HKLM,%FontSubStr%,"Times New Roman Greek,161",,"Times New Roman,161"
HKLM,%FontSubStr%,"Times New Roman TUR,162",,"Times New Roman,162"
HKLM,System\CurrentControlSet\Hardware Profiles\Current\Software\Fonts,"LogPixels",0x10003,0x00000060
+HKCU,Software\Wine\Fonts\Replacements,"SimSun",,"WenQuanYi Micro Hei"
+HKCU,Software\Wine\Fonts\Replacements,"宋体",,"WenQuanYi Micro Hei"
+HKCU,Software\Wine\Fonts\Replacements,"PMingLiU",,"WenQuanYi Micro Hei"
+HKCU,Software\Wine\Fonts\Replacements,"新細明體",,"WenQuanYi Micro Hei"
+HKCU,Software\Wine\Fonts\Replacements,"MS Gothic",,"Ume Gothic"
+HKCU,Software\Wine\Fonts\Replacements,"MS PGothic",,"Ume P Gothic"
+HKCU,Software\Wine\Fonts\Replacements,"MSPゴシック",,"Ume P Gothic"
+HKCU,Software\Wine\Fonts\Replacements,"MS UI Gothic",,"Ume UI Gothic"
+HKCU,Software\Wine\Fonts\Replacements,"MS Mincho",,"Ume Mincho"
+HKCU,Software\Wine\Fonts\Replacements,"MS PMincho",,"Ume P Mincho"
+HKCU,Software\Wine\Fonts\Replacements,"Batang",,"UnBatang"
+HKCU,Software\Wine\Fonts\Replacements,"Dotum",,"UnDotum"
+HKCU,Software\Wine\Fonts\Replacements,"Gulim",,"UnDotum"
+HKCU,Software\Wine\Fonts\Replacements,"Arial Unicode MS",,"Droid Sans Fallback"
+
[MCI]
HKLM,%Mci32Str%,"AVIVideo",,"mciavi32.dll"
--  
1.9.1
 
</pre>


'''Be careful: this patch changes the encoding of the file loader/wine.inf.in from ASCII to UTF-8 with BOM, don't miss the BOM header in the above patch! Copy&Paste may miss the BOM header, download and save the file is recommended.'''
'''Be careful: this patch changes the encoding of the file loader/wine.inf.in from ASCII to UTF-8 with BOM, don't miss the BOM header in the above patch! Copy&Paste may miss the BOM header, download and save the file is recommended.'''
Line 14: Line 64:


After patching wine.inf.in, you can just use
After patching wine.inf.in, you can just use
<syntaxhighlight lang="bash">
<pre>
./configure
./configure
make
make
sudo make install
sudo make install
</syntaxhighlight>
</pre>
to build Wine again.
to build Wine again.


But you don't have to build the whole Wine. Just run the below command from the Wine source code root directory to generate a new wine.inf and install it to the system wine directory:
But you don't have to build the whole Wine. Just run the below command from the Wine source code root directory to generate a new wine.inf and install it to the system wine directory:
<syntaxhighlight lang="bash">
<pre>
cd loader && make wine.inf
cd loader && make wine.inf
sudo make install wine.inf
sudo make install wine.inf
</syntaxhighlight>
</pre>


As far, Ubuntu and [http://pkgs.fedoraproject.org/cgit/wine.git/tree/wine-cjk.patch Fedora] have set Font Replacements in their Wine deb/rpm packages, feel free to edit this page to add more distributions.
As far, Ubuntu and [http://pkgs.fedoraproject.org/cgit/wine.git/tree/wine-cjk.patch Fedora] have set Font Replacements in their Wine deb/rpm packages, feel free to edit this page to add more distributions.

Latest revision as of 20:00, 18 March 2016

Wine does not have CJK fonts .

Some CJK applications hardcode the fonts they need, such as SimSun/MS Gothic/Batang and other default CJK fonts in Windows; usually these fonts can't be obtained freely due to copyright issues. If you have these fonts, you can simply copy them to usr/share/fonts/truetype . If you don't have these fonts, you can map them to alternative CJK Fonts in your system by Font Replacements settings in Wine. Different Linux/Unix distributions have different default CJK fonts, so the Font Replacements setting is depending on systems, and we can't set it built-in in upstream Wine.

If you are a normal Wine user, you mostly do not need to worry about Font Replacements; your distribution packages should have set them already. However, if they don't, it is recommended to file a bug report to your distribution (not upstream Wine!). If you are compiling Wine from source code for testing purpose, or you are the distribution package maintainer, please check the below example to see how to set Font Replacements:

Here is an example patch to show how to set Font Replacements in wine.inf.in:

From a3138c9e4d8e257f60c148cfac0bbc5e74a34602 Mon Sep 17 00:00:00 2001
From: Qian Hong <[email protected]>
Date: Sat, 20 Sep 2014 00:23:54 +0800
Subject: [PATCH] loader/wine.inf.in: Added localized font name replacement.
To: wine-patches <[email protected]>
Reply-To: wine-devel <[email protected]>
Cc: Qian Hong<[email protected]>

See http://wiki.winehq.org/FontReplacements
---
 loader/wine.inf.in | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/loader/wine.inf.in b/loader/wine.inf.in
index 42a750e..e988a8b 100644
--- a/loader/wine.inf.in
+++ b/loader/wine.inf.in
@@ -1,3 +1,6 @@
+;; To support localized font name replacement, this file should be encoded in
+;; UTF-8 with BOM, be careful not to strip the BOM header!
+;;
 ;; .INF script for the basic Wine configuration
 ;; Version: @PACKAGE_STRING@
 ;;
@@ -569,6 +572,21 @@ HKLM,%FontSubStr%,"Times New Roman CYR,204",,"Times New Roman,204"
 HKLM,%FontSubStr%,"Times New Roman Greek,161",,"Times New Roman,161"
 HKLM,%FontSubStr%,"Times New Roman TUR,162",,"Times New Roman,162"
 HKLM,System\CurrentControlSet\Hardware Profiles\Current\Software\Fonts,"LogPixels",0x10003,0x00000060
+HKCU,Software\Wine\Fonts\Replacements,"SimSun",,"WenQuanYi Micro Hei"
+HKCU,Software\Wine\Fonts\Replacements,"宋体",,"WenQuanYi Micro Hei"
+HKCU,Software\Wine\Fonts\Replacements,"PMingLiU",,"WenQuanYi Micro Hei"
+HKCU,Software\Wine\Fonts\Replacements,"新細明體",,"WenQuanYi Micro Hei"
+HKCU,Software\Wine\Fonts\Replacements,"MS Gothic",,"Ume Gothic"
+HKCU,Software\Wine\Fonts\Replacements,"MS PGothic",,"Ume P Gothic"
+HKCU,Software\Wine\Fonts\Replacements,"MSPゴシック",,"Ume P Gothic"
+HKCU,Software\Wine\Fonts\Replacements,"MS UI Gothic",,"Ume UI Gothic"
+HKCU,Software\Wine\Fonts\Replacements,"MS Mincho",,"Ume Mincho"
+HKCU,Software\Wine\Fonts\Replacements,"MS PMincho",,"Ume P Mincho"
+HKCU,Software\Wine\Fonts\Replacements,"Batang",,"UnBatang"
+HKCU,Software\Wine\Fonts\Replacements,"Dotum",,"UnDotum"
+HKCU,Software\Wine\Fonts\Replacements,"Gulim",,"UnDotum"
+HKCU,Software\Wine\Fonts\Replacements,"Arial Unicode MS",,"Droid Sans Fallback"
+
 
 [MCI]
 HKLM,%Mci32Str%,"AVIVideo",,"mciavi32.dll"
-- 
1.9.1

Be careful: this patch changes the encoding of the file loader/wine.inf.in from ASCII to UTF-8 with BOM, don't miss the BOM header in the above patch! Copy&Paste may miss the BOM header, download and save the file is recommended.

The above patch is for Ubuntu, if you are using other distributions, you need to adjust the patch to match your distribution's default CJK fonts.

After patching wine.inf.in, you can just use

./configure
make
sudo make install

to build Wine again.

But you don't have to build the whole Wine. Just run the below command from the Wine source code root directory to generate a new wine.inf and install it to the system wine directory:

cd loader && make wine.inf
sudo make install wine.inf

As far, Ubuntu and Fedora have set Font Replacements in their Wine deb/rpm packages, feel free to edit this page to add more distributions.

Alternative, you can change Font Replacements settings by registry key as well, see Useful Registry Keys for more information.

Please don't file CJK font rendering bugs to upstream Wine before setting Font Replacements correctly. When reporting CJK font bugs to Wine, please mention how do you set Font Replacements and whether you have installed MS fonts.

Feel free to contribute CJK fonts to Wine, see Create Fonts for more informations.

Once Wine supports detecting default CJK fonts through Fontconfig, then no Font Replacements settings will be needed any more.

Reference

font replacement discussion on wine-devel


This page was last edited on 18 March 2016, at 20:00.