archlinux中的字体看起来真的很搓,试过ubuntu patch过的版本,还是不尽如人意。后来发现了fontconfig-infinality, 整个世界突然美好了。跟windows下的MacType差不多。

当我将ibus换成fcitx之后,问题又出现了,3.6版本之后的fcitx竟然没有字体设置了,对于字体的控制必须使用fontconfig。这必须的修改默认的中文字体。

直接贴fontconfig的配置吧(我这里使用的是DejaVu Sans YuanTi

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>

    <!-- fonts dirs -->
    <dir>~/.fonts</dir>

    <match>
        <test name="family">
            <string>sans-serif</string>
        </test>
        <edit name="family" mode="prepend" binding="strong">
	    <string>DejaVu Sans YuanTi</string>
            <string>DejaVu Sans</string>
            <string>Liberation Sans</string>
            <string>Droid Sans</string>
            <string>WenQuanYi Zen Hei</string>
            <string>WenQuanYi Micro Hei</string>
            <string>WenQuanYi Bitmap Song</string>
            <string>AR PL KaitiM Big5</string>
            <string>AR PL KaitiM GB</string>
            <string>AR PL Mingti2L Big5</string>
            <string>AR PL New Sung</string>
            <string>AR PL SungtiL GB</string>
            <string>AR PL UKai CN</string>
            <string>AR PL UKai HK</string>
            <string>AR PL UKai TW</string>
            <string>AR PL UKai TW MBE</string>
            <string>AR PL UMing CN</string>
            <string>AR PL UMing HK</string>
            <string>AR PL UMing TW</string>
            <string>AR PL UMing TW MBE</string>
        </edit>
    </match>
    <match>
        <test name="family">
            <string>serif</string>
        </test>
        <edit name="family" mode="prepend" binding="strong">
  	    <string>DejaVu Sans YuanTi</string>
            <string>DejaVu Serif</string>
            <string>Liberation Serif</string>
            <string>Bitstream Charter</string>
            <string>Droid Serif</string>
            <string>WenQuanYi Zen Hei Sharp</string>
            <string>WenQuanYi Bitmap Song</string>
            <string>AR PL New Sung</string>
            <string>AR PL SungtiL GB</string>
            <string>AR PL UMing CN</string>
            <string>AR PL UMing TW</string>
            <string>AR PL KaitiM Big5</string>
            <string>AR PL KaitiM GB</string>
            <string>AR PL Mingti2L Big5</string>
            <string>AR PL UKai CN</string>
            <string>AR PL UKai HK</string>
            <string>AR PL UKai TW</string>
            <string>AR PL UKai TW MBE</string>
            <string>AR PL UMing CN</string>
            <string>AR PL UMing HK</string>
            <string>AR PL UMing TW</string>
            <string>AR PL UMing TW MBE</string>
        </edit>
    </match>
    <match>
        <test name="family">
            <string>monospace</string>
        </test>
        <edit name="family" mode="prepend" binding="strong">
  	    <string>DejaVu Sans YuanTi Mono</string>
            <string>DejaVu Sans Mono</string>
            <string>Liberation Sans Mono</string>
            <string>Droid Sans Mono</string>
            <string>WenQuanYi Zen Hei Mono</string>
            <string>WenQuanYi Micro Hei Mono</string>
            <string>WenQuanYi Zen Hei Sharp</string>
            <string>AR PL UMing TW</string>
            <string>AR PL KaitiM Big5</string>
            <string>AR PL KaitiM GB</string>
            <string>AR PL Mingti2L Big5</string>
            <string>AR PL New Sung</string>
            <string>AR PL SungtiL GB</string>
            <string>AR PL UKai CN</string>
            <string>AR PL UKai HK</string>
            <string>AR PL UKai TW</string>
            <string>AR PL UKai TW MBE</string>
            <string>AR PL UMing CN</string>
            <string>AR PL UMing HK</string>
            <string>AR PL UMing TW</string>
            <string>AR PL UMing TW MBE</string>
        </edit>
    </match>

    <!-- 把serif ,sans,monospace的family(字体族)重新排序 -->
    <alias>
        <family>serif</family>
        <prefer>
  	    <family>DejaVu Sans YuanTi</family>
            <family>DejaVu Serif</family>
            <family>Liberation Serif</family>
            <family>Bitstream Charter</family>
            <family>Droid Serif</family>
            <family>WenQuanYi Zen Hei Sharp</family>
            <family>WenQuanYi Bitmap Song</family>
            <family>AR PL New Sung</family>
            <family>AR PL SungtiL GB</family>
            <family>AR PL UMing CN</family>
            <family>AR PL UMing TW</family>
            <family>AR PL KaitiM Big5</family>
            <family>AR PL KaitiM GB</family>
            <family>AR PL Mingti2L Big5</family>
            <family>AR PL SungtiL GB</family>
            <family>AR PL UKai CN</family>
            <family>AR PL UKai HK</family>
            <family>AR PL UKai TW</family>
            <family>AR PL UKai TW MBE</family>
            <family>AR PL UMing CN</family>
            <family>AR PL UMing HK</family>
            <family>AR PL UMing TW</family>
            <family>AR PL UMing TW MBE</family>
        </prefer>
    </alias>
    <alias>
        <family>sans-serif</family>
        <prefer>
  	    <family>DejaVu Sans YuanTi</family>
            <family>DejaVu Sans</family>
            <family>Liberation Sans</family>
            <family>Droid Sans</family>
            <family>WenQuanYi Zen Hei</family>
            <family>WenQuanYi Micro Hei</family>
            <family>WenQuanYi Bitmap Song</family>
            <family>AR PL New Sung</family>
            <family>AR PL KaitiM Big5</family>
            <family>AR PL KaitiM GB</family>
            <family>AR PL Mingti2L Big5</family>
            <family>AR PL SungtiL GB</family>
            <family>AR PL UKai CN</family>
            <family>AR PL UKai HK</family>
            <family>AR PL UKai TW</family>
            <family>AR PL UKai TW MBE</family>
            <family>AR PL UMing CN</family>
            <family>AR PL UMing HK</family>
            <family>AR PL UMing TW</family>
            <family>AR PL UMing TW MBE</family>
        </prefer>
    </alias>
    <alias>
        <family>monospace</family>
        <prefer>
  	    <family>DejaVu Sans YuanTi Mono</family>
            <family>DejaVu Sans Mono</family>
            <family>Liberation Sans Mono</family>
            <family>Droid Sans Mono</family>
            <family>WenQuanYi Zen Hei Mono</family>
            <family>WenQuanYi Micro Hei Mono</family>
            <family>WenQuanYi Zen Hei Sharp</family>
            <family>AR PL New Sung</family>
            <family>AR PL UMing TW</family>
            <family>AR PL KaitiM Big5</family>
            <family>AR PL KaitiM GB</family>
            <family>AR PL Mingti2L Big5</family>
            <family>AR PL SungtiL GB</family>
            <family>AR PL UKai CN</family>
            <family>AR PL UKai HK</family>
            <family>AR PL UKai TW</family>
            <family>AR PL UKai TW MBE</family>
            <family>AR PL UMing CN</family>
            <family>AR PL UMing HK</family>
            <family>AR PL UMing TW</family>
            <family>AR PL UMing TW MBE</family>
        </prefer>
    </alias>

    <!-- DPI -->
    <match target="pattern">
        <edit name="dpi" mode="assign">
            <double>96</double>
        </edit>
    </match>

    <!-- default : smoothed and hinted -->
    <match target="font">
        <edit name="antialias" mode="assign">
            <bool>true</bool>
        </edit>
        <edit name="autohint" mode="assign">
            <bool>true</bool>
        </edit>
        <edit name="hinting" mode="assign">
            <bool>true</bool>
        </edit>
        <edit name="hintstyle" mode="assign">
            <const>hintfull</const>
        </edit>
        <edit name="rgba" mode="assign">
            <const>rgb</const>
        </edit>
        <edit name="lcdfilter" mode="assign">
            <const>lcddefault</const>
        </edit>
    </match>

    <!-- 优先使用内嵌的点阵字 -->
    <match target="font">
        <edit name="embeddedbitmap" mode="assign">
            <bool>true</bool>
        </edit>
    </match>

    <!-- For point size less equal than 6 : only smoothed -->
    <match target="font" >
        <test name="size" compare="less_eq">
            <double>6</double>
        </test>
        <edit name="antialias" mode="assign">
            <bool>true</bool>
        </edit>
        <edit name="autohint" mode="assign">
            <bool>false</bool>
        </edit>
        <edit name="hinting" mode="assign">
            <bool>false</bool>
        </edit>
    </match>

    <!-- 注意没有指定hintstyle,不希望它作为全局设定 -->
    <match target="font">
        <test name="lang" compare="contains">
            <string>zh</string>
            <string>ja</string>
            <string>ko</string>
        </test>
        <edit name="hinting" mode="assign">
            <bool>true</bool>
        </edit>
        <edit name="autohint" mode="assign">
            <bool>true</bool>
        </edit>
        <edit name="antialias" mode="assign">
            <bool>true</bool>
        </edit>
    </match>

    <!-- Synthetic emboldening for fonts do not have bold face -->
    <match target="font">
        <test name="weight" compare="less_eq">
            <const>medium</const>
        </test>
        <test target="pattern" compare="more" name="weight">
            <const>medium</const>
        </test>
        <edit name="embolden" mode="assign">
            <bool>true</bool>
        </edit>
        <edit name="weight" mode="assign">
            <const>bold</const>
        </edit>
    </match>

    <!-- The dual-width Asian fonts (spacing=dual) are not rendered
         correctly, apparently FreeType forces all widths to match.
         Trying to disable the width forcing code by setting
         globaladvance=false alone doesn't  help. As a brute force
         workaround, also set spacing=proportional, i.e. handle
         them as proportional fonts:  CJK 双宽度纠正 -->
    <match target="font">
        <test name="lang" target="pattern" compare="contains">
            <string>zh</string>
            <string>ja</string>
            <string>ko</string>
        </test>
        <test name="spacing" compare="eq">
            <const>dual</const>
        </test>
        <edit name="spacing" mode="assign">
            <const>proportional</const>
        </edit>
        <edit name="globaladvance" mode="assign">
            <bool>false</bool>
        </edit>
    </match>

    <!-- There is a similar problem with dual width bitmap fonts.
         They don't have spacing=dual, therefore they are not
         handled by the above rule and still display as charcell
         fonts. For example "Efont Biwidth" has spacing=mono and
         "Misc Fixed Wide" has spacing=charcell. Force handling of
         these fonts as proportional fonts as well: -->
    <match target="font">
        <test name="lang" compare="contains">
            <string>zh</string>
            <string>ja</string>
            <string>ko</string>
        </test>
        <test name="outline" compare="eq">
            <bool>false</bool>
        </test>
        <test name="spacing" compare="eq">
            <const>mono</const>
            <const>charcell</const>
        </test>
        <edit name="spacing">
            <const>proportional</const>
        </edit>
        <edit name="globaladvance" binding="strong">
            <bool>false</bool>
        </edit>
    </match>

    <!-- 设定中文字体的最小字号 -->
    <match target="font">
        <test name="family" equal="any">
            <string>Unibit</string>
            <string>WenQuanYi Zen Hei</string>
            <string>WenQuanYi Micro Hei</string>
            <string>WenQuanYi Zen Hei Mono</string>
            <string>WenQuanYi Micro Hei Mono</string>
            <string>WenQuanYi Zen Hei Sharp</string>
            <string>WenQuanYi Bitmap Song</string>
            <string>AR PL UMing TW</string>
            <string>AR PL KaitiM Big5</string>
            <string>AR PL KaitiM GB</string>
            <string>AR PL Mingti2L Big5</string>
            <string>AR PL New Sung</string>
            <string>AR PL SungtiL GB</string>
            <string>AR PL UKai CN</string>
            <string>AR PL UKai HK</string>
            <string>AR PL UKai TW</string>
            <string>AR PL UKai TW MBE</string>
            <string>AR PL UMing CN</string>
            <string>AR PL UMing HK</string>
            <string>AR PL UMing TW</string>
            <string>AR PL UMing TW MBE</string>
            <string>AR PL UMing CN</string>
            <string>AR PL UMing TW</string>
        </test>
        <test name="pixelsize" compare="more_eq">
            <int>8</int>
        </test>
        <test name="pixelsize" compare="less_eq">
            <int>12</int>
        </test>
        <edit name="pixelsize" mode="assign">
            <int>12</int>
        </edit>
    </match>

    <!-- MingLiU/PMingLiU一定要全力hint,否则字会错乱 -->
    <match target="font">
        <test name="family" compare="eq">
            <string>MingLiU</string>
            <string>PMingLiU</string>
        </test>
        <edit name="hintstyle" mode="assign">
            <const>hintfull</const>
        </edit>
    </match>

    <!-- WenQuanYi Fonts -->
    <match target="font">
        <test name="family" equal="any">
            <string>WenQuanYi Zen Hei</string>
            <string>WenQuanYi Zen Hei Mono</string>
            <string>WenQuanYi Zen Hei Sharp</string>
            <string>WenQuanYi Micro Hei</string>
            <string>WenQuanYi Micro Hei Mono</string>
            <string>WenQuanYi Micro Hei Light</string>
        </test>
        <edit name="antialias" mode="assign">
            <bool>true</bool>
        </edit>
        <edit name="hinting" mode="assign">
            <bool>true</bool>
        </edit>
        <edit name="autohint" mode="assign">
            <bool>true</bool>
        </edit>
        <edit name="hintstyle" mode="assign">
            <const>hintfull</const>
        </edit>
        <edit name="embeddedbitmap" mode="assign">
            <bool>true</bool>
        </edit>
    </match>
    <match target="pattern">
        <test name="family" equal="any" compare="eq">
            <string>serif</string>
            <string>sans-serif</string>
            <string>monospace</string>
        </test>
        <test name="lang" equal="any" compare="eq">
            <string>zh-cn</string>
            <string>zh-tw</string>
            <string>zh-hk</string>
            <string>zh-sg</string>
        </test>
        <test name="pixelsize" compare="more_eq">
            <double>12</double>
        </test>
        <test name="pixelsize" compare="less_eq">
            <double>16</double>
        </test>
        <edit name="family" mode="prepend_first">
            <string>WenQuanYi Bitmap Song</string>
        </edit>
    </match>
    <!-- End WenQuanYi Fonts -->

    <!-- Firefly Truetype Font -->
    <match target="font">
        <test name="family" equal="any">
            <string>AR PL New Sung</string>
        </test>
        <edit name="antialias">
            <bool>true</bool>
        </edit>
        <edit name="hinting" mode="assign">
            <bool>true</bool>
        </edit>
        <edit name="autohint" mode="assign">
            <bool>false</bool>
        </edit>
    </match>
    <match target="font">
        <test name="family" equal="any">
            <string>AR PL New Sung</string>
        </test>
        <test name="size" compare="less_eq">
            <int>16</int>
        </test>
        <edit name="antialias" mode="assign">
            <bool>false</bool>
        </edit>
        <edit name="hinting" mode="assign">
            <bool>true</bool>
        </edit>
    </match>
    <match target="font">
        <test name="family" equal="any">
            <string>AR PL New Sung</string>
        </test>
        <edit name="globaladvance" mode="assign">
            <bool>false</bool>
        </edit>
    </match>
    <!-- end Firefly Truetype Font -->
</fontconfig>