Wednesday, August 20, 2008

likely/unlikely macros in Linux Kernel

http://kerneltrap.org/node/4705

Ever wondered what the likely and unlikely macros in the linux kernel are ?
The macros are defined as :
#define likely(x) __builtin_expect((x),1)
#define unlikely(x) __builtin_expect((x),0)

The __builtin_expect is a method that gcc (versions >= 2.96) offer for programmers to indicate branch prediction information to the compiler. The return value of __builtin_expect is the first argument (which could only be an integer) passed to it. 

To check it out how it could be beneficial, an excerpt from "info gcc" :
  if (__builtin_expect (x, 0))
  foo ();


  [This] would indicate that we do not expect to call `foo', since we
  expect `x' to be zero. 

Based on this information the compiler generates intelligent code, such that the most expected result is favored.

Let us consider it with a simple example function :

[kedar@ashwamedha ~]$ cat abc.c
int
testfun(int x)
{
  if(__builtin_expect(x, 0)) {
  ^^^--- We instruct the compiler, "else" block is more probable
  x = 5;
  x = x * x;
  } else {
  x = 6;
  }
  return x;
}
 
[kedar@ashwamedha ~]$ gcc -O2 -c abc.c
[kedar@ashwamedha ~]$ objdump -d abc.o
 
abc.o: file format elf32-i386
 
Disassembly of section .text:
 
00000000 :
  0: 55 push %ebp
  1: 89 e5 mov %esp,%ebp
  3: 8b 45 08 mov 0x8(%ebp),%eax
  6: 85 c0 test %eax,%eax
  8: 75 07 jne 11 <>
  ^^^ --- The compiler branches the "if" block and keeps "else" sequential
  a: b8 06 00 00 00 mov $0x6,%eax
  f: c9 leave
  10: c3 ret
  11: b8 19 00 00 00 mov $0x19,%eax
  16: eb f7 jmp f <>


And let us see what happens if we make the "if" block more likely.

[kedar@ashwamedha ~]$ cat abc.c
int
testfun(int x)
{
  if(__builtin_expect(x, 1)) {
  ^^^ --- We instruct the compiler, "if" block is more probable
  x = 5;
  x = x * x;
  } else {
  x = 6;
  }
  return x;
}
   
[kedar@ashwamedha ~]$ gcc -O2 -c abc.c
[kedar@ashwamedha ~]$ objdump -d abc.o
   
abc.o: file format elf32-i386
   
Disassembly of section .text:
   
00000000 :
  0: 55 push %ebp
  1: 89 e5 mov %esp,%ebp
  3: 8b 45 08 mov 0x8(%ebp),%eax
  6: 85 c0 test %eax,%eax
  8: 74 07 je 11 <>
  ^^^ --- The compiler branches the "else" block and keeps "if" sequential 
  a: b8 19 00 00 00 mov $0x19,%eax
  f: c9 leave
  10: c3 ret
  11: b8 06 00 00 00 mov $0x6,%eax
  16: eb f7 jmp f <>


...
Read More

Wednesday, July 23, 2008

screen goes black when use vesafb

When I use vesafb and set vga=xxx as kernel option to change the resolution, the screen goes blank at boot time. I know the system is still booting, nothing is wrong except the screen.

I finally found the solution. I appears the framebuffer module is not loaded with the kernel.

The walkthough is to edit /etc/modules.autoload.d/kernel-2.6   (in Gentoo, other distros may have different path) to add these two lines:

fbcon
vesafb

...
Read More

Saturday, July 12, 2008

升级x11-misc/shared-mime-info-0.40后mime数据出问题

升级x11-misc/shared-mime-info-0.40后打不开pdf、zip等文件,所有格式均识别为mime/plain-text。

Gentoo Bug #228885

解决办法为:

$ update-mime-database ~/.local/share/mime/
# update-mime-database /usr/local/share/mime/

...
Read More

Thursday, July 10, 2008

关于Sql Server Compact程序运行结束后更改丢失的问题

最近用Linq to SQL + Sql Server Compact 3.5写东西

发现往数据库里加东西以后,程序运行时是有效的,但是重编译工程后这些更改又丢失了。

后来得知,这是因为数据库文件默认的生成方式是“总是复制”(always copy),这样每次build都会把空的数据库文件拷到output目录。改成“copy if newer”就好了。

...
Read More

Tuesday, July 1, 2008

[转]Linux之父炮轰C++:糟糕程序员的垃圾语言

...
Read More

C99的新特性

C99的语法还是很爽的,单行注释、bool、随处声明变量,都很必要。

最近心血来潮想查查C99的全部新特性,发现还有很多我不知道的。

以下是C99之于C89的新特性,摘自http://www.kuro5hin.org/?op=displaystory;sid=2001/2/23/194544/139

Interesting New Features

A list of features that should[0] have made it into the C99 standard is available on Thomas Wolf's webpage. Listed below are the changes that most developers would notice or care about at first use. 
Increased identifier size limits: specifically 63 significant initial characters in an internal identifier or macro name, 31 significant initial characters in an external identifier, and 4095 characters in a logical source line. These values were 31, 6, and 509, respectively, in C89. 

The small identifier size is the reason so many ANSI functions had terse names (strcpy, strstr, strchr, etc) since the standard only guaranteed that the first six characters would be used to uniquely identify the functions. 

C++ style/line comments: The characters '//' can now be used to delineate a line of commented text, just like in C++. 

Macros take variable arguments denoted by elipsees: Function-like macros will accept variable arguments denoted by using the ellipsis (...) notation. For replacement, the variable arguments (including the separating commas) are "collected" into one single extra argument that can be referenced as __VA_ARGS__ within the macro's replacement list. 

Inline functions: The C language now supports the inline keyword which allows functions to be defined as inline, which is a hint to the compiler that invocations of such functions can be replaced with inline code expansions rather than actual function calls.

Restricted pointers: The C language now supports the restrict keyword which allows pointers to be defined as restricted, which is a hint to the compiler to disallow two restricted pointers from being aliases to the same object which allows for certain optimizations when dealing with the said pointers. 

_Bool Macro: There is a _Bool type which is a actually two valued integer type. True is defined as 
#define true (_Bool)1 
while false is defined as 
#define false (_Bool)0 
Variable Declarations can appear anywhere in the code block: No longer do variables have to be defined at the top of the code block. 

Variable length arrays: These are arrays whose size is determined at runtime. 

Variable declarations in for loops: Variables can now be declared and initialized in for loops just like in C++ and Java. 

Named initialization of structs: The members of a struct can now be initialized by name such as is done in the code block below 
struct {float x, y, z;} s = { .y = 1.0, .x = 3.5, .z = 12.8}; 
New long long type: There is a new type called long long which is at least 64 bits and can be both signed or unsigned. The new suffixes "LL" or "ll" (and "ULL" or "ull") are used for constants of the new long long type.

Functions must declare a return value: Function return types no longer defaults to int if the function declares no return type. 

Last member of a struct may be an incomplete array type. : This is to support the "struct hack" which works on most existing C compilers already. A code example of the struct hack is shown on Thomas's site. 

Addition of _Complex and _Imaginary number types: A boon for programmers doing any sort of advanced math in their programs. 

Multiple uses of a type qualifier are ignored after the first occurence: If a type qualifier appears several times (either directly or indirectly through typedefs) in a type specification, it's treated as if it appeared only once. E.g. 
const const int x; 
is the same as 
const int x; 
C++ Incompatibilities

The aforementioned features are rather impressive but one soon realizes that this means that C is no longer a subset of C++. There is a list of the major incompatibilities between the current ISO standards for C and C++ on David Tribble's webpage. At this point it is still too early to see if either C or C++ will be harmed by this development but it is clear that there will be some growing pains once C99 adoption becomes widespread. 

Bjarne Stroustrup mentioned in a recent interview with LinuxWorld that he would have liked for both languages to be compatible and would favor a technical committee whose express purpose would be integrating both languages, but doubts the possibility of this coming to pass. Stroustrup also contrasted how C's technical commitee decided to implement most of the added functionality via changes to the actual C language against the C++ approach which was by adding additional libraries. 

Compiler support

After describing all the exciting new features of C99, one would expect there to be more awareness of the standard by now but there isn't. The primary reason for the lack of awareness of C99 is the fact that compiler support at the current time is practically non-existent. Here is the status of the major compiler vendors for the development platforms that I'm interested in: 
Microsoft: A search on Microsoft's site for C99 draws a total blank. It looks like Microsoft does not plan to upgrade the C compiler that ships with Visual C++ to cover the C99 standard. 

Borland: A search on Borland's site for C99 also draws a blank. Again it looks like exclusive C++ development has won over keeping their C compiler up to date. 

Comeau Computing: The most recent version of their compiler (version 4.2.45.1) which is available for online testing claims to support a large number of features from C99. The compiler has not yet been released but can be tested online by submitting code snippets in an HTML form. 

SAS Institute: SAS/C version 7.0 supports the "long long" type, inline functions and a few of the preprocessor directives. 

Edison Design Group: The EDG C++ front end supposedly supports both C89 and C99 as well as Microsoft C++ and ANSI/ISO C++. 

GNU: GCC has a status page of C99 compliance which shows that they are quite close to becoming fully compliant with the C99 standard. 


Where To Get It

If you are interested in being the first kid on your block who knows the finer points of restricted pointers and variable argument macros, you can purchase the C99 standard online from ANSI. Finally no discussion of C99 is complete without a reference to Dennis Ritchie's opinion of the C99 standard. 

[0] I didn't buy a copy of the standard, so I cannot guarantee that everything on that site made it into the standard although there is a good chance that everything did.

C99标志着C与C++分道扬镳,C不再是C++的子集了。M$不仅目前不太支持,似乎未来也不打算支持(除非未来C++0x会采纳一些C99)。而GCC已经完美支持C99了。

...
Read More

Thursday, June 5, 2008

关于用ObjectInputStream封装socket输入流后程序阻塞的问题

下面的代码运行后在(2)和(3)处会阻塞住

public class Server {
public static void main(String[] args)throws Exception{
ServerSocket ssock=new ServerSocket(3000);
Socket sock=ssock.accept();

ObjectInputStream in=new ObjectInputStream(sock.getInputStream()); //(2)
ObjectOutputStream out=new ObjectOutputStream(sock.getOutputStream()); //(1)
while(true){
out.writeObject("s");
out.flush();
}
}
}

public class Client {
public static void main(String[] args)throws Exception{
Socket sock=new Socket("127.0.0.1",3000);
ObjectOutputStream out=new ObjectOutputStream(sock.getOutputStream());//(3)
ObjectInputStream in=new ObjectInputStream(sock.getInputStream()); //(4)
while(true){
out.writeObject("s");
System.out.println((String)in.readObject());
}
}
}

而把(1)和(2),(3)和(4)对调后程序运行正常。

原因如下:
使用缺省的serializetion的实现时,一个ObjectOutputStream的构造和一个ObjectInputStream的构造必须一一对应.ObjectOutputStream的构造函数会向输出流中写入一个标识头,而ObjectInputStream会首先读入这个标识头!

...
Read More

Saturday, April 19, 2008

wine强制全屏游戏在窗口模式下运行

wine explorer /desktop=1024x768 whatever.exe

...
Read More

Monday, April 7, 2008

用psyco优化python程序

psyco是python扩展通过编译python代码提升python程序速度

使用方法简单在python程序加上下面可以

import psyco
psyco.full()

psyco程序运行编译部分代码具体怎么编译清楚因此程序初始时间增加运行速度

篇gentoo-wiki介绍用psyco优化portage速度

http://gentoo-wiki.com/TIP_Speed_up_portage_with_Psyco

文章了psyco以后,portage性能可以提升2-5同时警告说psyco现在稳定可能带来很多问题因此推荐使用

了psyco的emerge速度看来2-5影响使用问题比如sudoemerge异常确认删除“no异常猜测因为psyco对try-except语句支持原来程序里catch异常现在引发了psyco异常

不过问题影响正常使用继续观望

另外的python程序支持psyco像Frets On Fire源码初试使用psyco了psyco以后玩Frets On Fire感觉不过没有portage那么明显

...
Read More

Friday, April 4, 2008

HOWTO XDMCP in Gnome

XDMCP stands for "X Display Manager Control Protocol" and is a network protocol. It allows a way of running X-Terminal on your PC (or Mac) and uses the X Server to provide a client/server interface between display hardware (the mouse, keyboard, and video displays) and the desktop environment while also providing both the windowing infrastructure and a standardized application interface. The X-Terminal can be displayed with an individual window or multiple windows, based on your X window system's software capabilities and setup.


On your X-Server, you must tweak the configuration of your graphical login manager (displaymanager).

for GDM, you need to change the [xdmcp]-section in your configfile:
/etc/X11/gdm/custom.conf

[xdmcp]
Enable=true

Depending on how your gdm.conf/custom.conf is set up, you might also need to add or change the [greeter] section as shown below. Without this, you will not be able to XDMCP in to your server.

[greeter]
Browser=true


How to use XDMCP

on the remote machine you can either use Xnest or simply X:
$ X -ac -query servername :1
or
$ Xnest -ac -query servername :1

where servername is your servername or IP. :1 is the display number. (:0 should be your running X-Server)

To change screen resolution of Xnest, use "geometry" option:
$ Xnest -geometry=1280x800 -ac -query servername :1

...
Read More

Sunday, March 30, 2008

用Python删除Eclipse的旧插件

Eclipse升级插件以后似乎没有办法删除版本插件

于是个python脚本清除插件

import os
import glob

def removeOldFiles(dir):
  os.chdir(dir)
  files = glob.glob('*')
  files.sort()
  prevfile = files[0]
  for filename in files[1:]:
    if (filename.find(prevfile.partition('_')[0]) == 0):
      os.system('rm -rf ' + prevfile)
    prevfile = filename

# main
removeOldFiles('/usr/lib/eclipse-3.3/plugins')
removeOldFiles('/usr/lib/eclipse-3.3/features')


...
Read More

Friday, March 28, 2008

Java程序和X程序无法调用scim输入的解决办法

最近发现Java程序无法输入中文按ctrl+space出scim

然后发型纯X程序像xterm一样症状而gtkqt程序没问题

上网了解到java程序和x程序一样用xim引擎进行输入而qt/gtk用scim因此觉得配置文件写错

检查下/etc/X11/xinit/xinitrc.d/xinputrc文件果然把XMODIFIERS小写@im=scim小写敏感现在正确内容如下

XMODIFIERS=@im=SCIM
XIM="scim"
XIM_PROGRAM="scim"
XIM_ARGS="-d"
GTK_IM_MODULE="scim"
QT_IM_MODULE="scim"

export XIM XIM_PROGRAM XMODIFIERS GTK_IM_MODULE QT_IM_MODULE

# start xim server
$XIM_PROGRAM $XIM_ARGS &

...
Read More

Tuesday, March 25, 2008

Programmer's Fonts

Programmers have very particular font needs. A font for programming must be monospaced, extremely readable, and must sharply distinguish between similar characters, such as capital O and zero and the number 1, capital I, and lowercase l. In addition, good programming fonts allow you to view more lines of code on screen at once.

You can find many programmer's fonts at this website:
http://www.lowing.org/fonts/

view the sample of the fonts

...
Read More

Thursday, March 20, 2008

HOWTO Highlight C++/Java/TeX source code syntax in LaTeX

There is a greate package which supports syntax highlighting for a huge amount of programming languages (Fortran, C, C++, csh, HTML, Java, Matlab, Mathematica, Pascal, Perl, SQL, XML, Delphi, PHP, VBScript, SAS and even Latex itself - and many more). The usage is simple: 
Load the package: \usepackage{listings} 
Set the language: \lstset{language=TeX} 
Open a lstlisting environment: \begin{lstlisting} 
Include all your programming code 
Close the lstlisting environment: \end{lstlisting} 

If this does not seem to work for your language, even if the language is listed above, try upgrading to the lastest MiKTeX version. The listings package is being updated continuously. 

Here's a more advanced example on the source code highlight: 
 \usepackage{color}
 \usepackage{listings}
 \definecolor{Brown}{cmyk}{0,0.81,1,0.60}
 \definecolor{OliveGreen}{cmyk}{0.64,0,0.95,0.40}
 \definecolor{CadetBlue}{cmyk}{0.62,0.57,0.23,0}
 \begin{document}
 
 \lstset{language=R,frame=ltrb,framesep=5pt,basicstyle=\normalsize,
  keywordstyle=\ttfamily\color{OliveGreen},
 identifierstyle=\ttfamily\color{CadetBlue}\bfseries, 
 commentstyle=\color{Brown},
 stringstyle=\ttfamily,
 showstringspaces=ture}

\begin{lstlisting}
...
\end{lstlisting}

...
Read More

HOWTO Editing Gnome/KDE Menus

Introducion

You know the menu that's shown if you start the kde-menu, gnome-menu, xfce-menu or something else. There's no real name for this kind of menu (it's also often called "root-menu"), but the menu is saved in a Freedesktop-Standard. 

Where are the files saved?

The menus are made out of a "Main file" (.menu file). The file is written in XML, and it contains a kind of links to the Applications (.desktop files). 

The Main file detailing system-wide default menu structure might be located in one of the followings directorys: 
/etc/xdg/menus/ 
User-specific menu edits: ~/.config/menus/ 
If you have not found your file yet, search for it: find / -iname *.menu 

System-wide Menu entries (.desktop files) are stored in many places, for example: 
/usr/share/applications/ 
/usr/share/applink/
Gnome applications:
/usr/share/gnome/apps/
KDE applications: 
/usr/kde/3.5/share/applications/
User-specific applications: 
~/.local/share/applications/

Or search for the files: find / -iname *.desktop

...
Read More

Monday, March 17, 2008

HowTo: Mount Bin/Cue files in Linux

* Method 1: Use CDEmu.
cdemu 0 pro.cue
mount -t iso9660 /dev/cdemu/0 /mnt/temp

* Method 2: Convert to ISO.
Convert BIN/CUE to ISO:
bchunk -v acrobat6pro.bin pro.cue pro

* Just mount the ISO by executing as root.
mount -o loop,ro -t iso9660 .iso
mount -o loop pro01.iso /mnt/temp

* Method 3: Use AcetoneISO2.

...
Read More

Saturday, March 15, 2008

【转】JDK6中文乱码完美解决之雅黑版

JDK6在LINUX环境下不支持中文,以下是解决办法。

实验环境:Ubuntu7.04,JDK6
路径说明:1、字体文件路径/usr/share/fonts/yahei/msyh.ttf
2、JAVA_HOME=/usr/lib/jvm/jdk
(请根据你的实际路径修改变命令内容)

解决AWT外的乱码:
1、cd /usr/lib/jvm/jdk/jre/lib/fonts
(进入jre的fonts文件夹)
2、sudo mkdir fallback
(创建文件夹fallback,文件名必须是"fallback",这是设置文件中指定的)
3、cd fallback
(进入fallback文件夹)
4、sudo ln -s /usr/share/fonts/yahei/msyh.ttf
(建立msyh.ttf字体文件的软连接)
5、sudo mkfontscale
(建立fonts.scale文件)
6、sudo mkfontdir
(在fonts.scale的基础上建立fonts.dir文件)

如果使用中不涉及AWT中文显示,问题已解决,针对AWT的乱码问题,必须实施以下步骤:

1、cd /usr/lib/jvm/jdk/jre/lib/fonts
(进入jre的fonts文件夹)
2、sudo cat ./fallback/fonts.dir >> fonts.dir
(把/fallback/fonts.dir的内容添加到fonts.dir文件的结尾,可以手动复制,目的是把雅黑字体的相关内容添加进jre的fonts.dir里)
3、cd ..
(返回上一级目录,即/usr/lib/jvm/jdk/lib)
4、sudo mkdir fontconfigs
(建立fontconfigs文件夹,fontconfigs可以随便命名)
5、sudo mv fontconfig.* ./fontconfigs
(把lib文件夹内的fontconfig开头的文件剪切到fontconfigs文件夹下,因为这些设置文件是应用于不同系统的,按一定顺序查找,如果不把它们移走,不能保证执行我们将要建立的文件fontconfig.properties)
6、sudo gedit fontconfig.properties
(创建并打开文件fontconfig.properties,文件名必须是默认查找顺序列表中的一个,fontconfig.properties就是其中之一)
7、复制以下内容到fontconfig.properties,并保存:


# @(#)linux.fontconfig.Ubuntu.7.04.properties 1.2 07/10/02
#
# Copyright 2007 ganjinghong, Inc. All rights reserved.
#

# Version

version=1

# Component Font Mappings
serif.plain.chinese-cn=-microsoft-microsoft yahei-medium-r-normal--*-%d-*-*-p-*-gb2312.1980-0
serif.bold.chinese-cn=-microsoft-microsoft yahei-medium-r-normal--*-%d-*-*-p-*-gb2312.1980-0
serif.italic.chinese-cn=-microsoft-microsoft yahei-medium-r-normal--*-%d-*-*-p-*-gb2312.1980-0
serif.bolditalic.chinese-cn=-microsoft-microsoft yahei-medium-r-normal--*-%d-*-*-p-*-gb2312.1980-0
sansserif.plain.chinese-cn=-microsoft-microsoft yahei-medium-r-normal--*-%d-*-*-p-*-gb2312.1980-0
sansserif.bold.chinese-cn=-microsoft-microsoft yahei-medium-r-normal--*-%d-*-*-p-*-gb2312.1980-0
sansserif.italic.chinese-cn=-microsoft-microsoft yahei-medium-r-normal--*-%d-*-*-p-*-gb2312.1980-0
sansserif.bolditalic.chinese-cn=-microsoft-microsoft yahei-medium-r-normal--*-%d-*-*-p-*-gb2312.1980-0
monospaced.plain.chinese-cn=-microsoft-microsoft yahei-medium-r-normal--*-%d-*-*-p-*-gb2312.1980-0
monospaced.bold.chinese-cn=-microsoft-microsoft yahei-medium-r-normal--*-%d-*-*-p-*-gb2312.1980-0
monospaced.italic.chinese-cn=-microsoft-microsoft yahei-medium-r-normal--*-%d-*-*-p-*-gb2312.1980-0
monospaced.bolditalic.chinese-cn=-microsoft-microsoft yahei-medium-r-normal--*-%d-*-*-p-*-gb2312.1980-0
dialog.plain.chinese-cn=-microsoft-microsoft yahei-medium-r-normal--*-%d-*-*-p-*-gb2312.1980-0
dialog.bold.chinese-cn=-microsoft-microsoft yahei-medium-r-normal--*-%d-*-*-p-*-gb2312.1980-0
dialog.italic.chinese-cn=-microsoft-microsoft yahei-medium-r-normal--*-%d-*-*-p-*-gb2312.1980-0
dialog.bolditalic.chinese-cn=-microsoft-microsoft yahei-medium-r-normal--*-%d-*-*-p-*-gb2312.1980-0
dialoginput.plain.chinese-cn=-microsoft-microsoft yahei-medium-r-normal--*-%d-*-*-p-*-gb2312.1980-0
dialoginput.bold.chinese-cn=-microsoft-microsoft yahei-medium-r-normal--*-%d-*-*-p-*-gb2312.1980-0
dialoginput.italic.chinese-cn=-microsoft-microsoft yahei-medium-r-normal--*-%d-*-*-p-*-gb2312.1980-0
dialoginput.bolditalic.chinese-cn=-microsoft-microsoft yahei-medium-r-normal--*-%d-*-*-p-*-gb2312.1980-0
dialoginput.bolditalic.chinese-cn=-microsoft-microsoft yahei-medium-r-normal--*-%d-*-*-p-*-gb2312.1980-0

serif.plain.latin-1=-b&h-lucidabright-medium-r-normal--*-%d-*-*-p-*-iso8859-1
serif.bold.latin-1=-b&h-lucidabright-demibold-r-normal--*-%d-*-*-p-*-iso8859-1
serif.italic.latin-1=-b&h-lucidabright-medium-i-normal--*-%d-*-*-p-*-iso8859-1
serif.bolditalic.latin-1=-b&h-lucidabright-demibold-i-normal--*-%d-*-*-p-*-iso8859-1
sansserif.plain.latin-1=-b&h-lucidasans-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1
sansserif.bold.latin-1=-b&h-lucidasans-bold-r-normal-sans-*-%d-*-*-p-*-iso8859-1
sansserif.italic.latin-1=-b&h-lucidasans-medium-i-normal-sans-*-%d-*-*-p-*-iso8859-1
sansserif.bolditalic.latin-1=-b&h-lucidasans-bold-i-normal-sans-*-%d-*-*-p-*-iso8859-1
monospaced.plain.latin-1=-b&h-lucidatypewriter-medium-r-normal-sans-*-%d-*-*-m-*-iso8859-1
monospaced.bold.latin-1=-b&h-lucidatypewriter-bold-r-normal-sans-*-%d-*-*-m-*-iso8859-1
monospaced.italic.latin-1=-b&h-lucidatypewriter-medium-i-normal-sans-*-%d-*-*-m-*-iso8859-1
monospaced.bolditalic.latin-1=-b&h-lucidatypewriter-bold-i-normal-sans-*-%d-*-*-m-*-iso8859-1
dialog.plain.latin-1=-b&h-lucidasans-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1
dialog.bold.latin-1=-b&h-lucidasans-bold-r-normal-sans-*-%d-*-*-p-*-iso8859-1
dialog.italic.latin-1=-b&h-lucidasans-medium-i-normal-sans-*-%d-*-*-p-*-iso8859-1
dialog.bolditalic.latin-1=-b&h-lucidasans-bold-i-normal-sans-*-%d-*-*-p-*-iso8859-1
dialoginput.plain.latin-1=-b&h-lucidatypewriter-medium-r-normal-sans-*-%d-*-*-m-*-iso8859-1
dialoginput.bold.latin-1=-b&h-lucidatypewriter-bold-r-normal-sans-*-%d-*-*-m-*-iso8859-1
dialoginput.italic.latin-1=-b&h-lucidatypewriter-medium-i-normal-sans-*-%d-*-*-m-*-iso8859-1
dialoginput.bolditalic.latin-1=-b&h-lucidatypewriter-bold-i-normal-sans-*-%d-*-*-m-*-iso8859-1


# Search Sequences

sequence.allfonts=latin-1,chinese-cn

# Exclusion Ranges

# Font File Names

8、无需重启,问题已解决。

其他字体设置方法:
把fontconfig.properties文件中的microsoft-microsoft yahei替换为你所用字体的名称。
TIPS:
1、名称获取方法:可以在字体文件同级目录下执行:sudo mkfontscale,然后打开生成的fonts.scale,里面就有相关的名称。
2、必须把你所用中文字体的fonts.scale的相关内容添加到/lib/fonts/fonts.dir

...
Read More
 
/* google analytics */