Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
大家有没有发现, 现在不用overlay, simsun也能粗体了?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index 中文 (Chinese)
View previous topic :: View next topic  
Author Message
galilette
n00b
n00b


Joined: 17 Jan 2005
Posts: 22

PostPosted: Sat Mar 25, 2006 7:19 pm    Post subject: 大家有没有发现, 现在不用overlay, simsun也能粗体了? Reply with quote

刚在sir发的, 转过来和大家share一下

喝喝, 我平时一般不怎么emerge sync, 昨天sync了一下才转到modular X的

~x86的话, emerge -1u fontconfig freetype libXft, 然后打开 /etc/fonts/fonts.conf后, 找到下面这段:
Code:

<!--
 Synthetic emboldening for fonts that do not have bold face available
 -->

   <match target="font">
      <!-- check to see if the font is just regular -->
      <test name="weight" compare="less_eq">
         <int>100</int>
      </test>
      <!-- check to see if the pattern requests bold -->
      <test target="pattern" name="weight" compare="more_eq">
         <int>200</int>
      </test>
      <!-- set the embolden flag -->
      <edit name="embolden" mode="assign">
         <bool>true</bool>
      </edit>
   </match>


仔细看一下你就能看出问题: 比如运行
Code:

shell> fc-match -v "serif:lang=zh-cn:bold" | egrep 'embolden|weight'

你就会发觉, 虽然embolden是true了, 但weight还是80. 仔细想想, 让xft按weight=80 (非粗体的weight) 去渲染粗体, 出来会是什么效果呢?

所以解决办法比较简单. quick'n'dirty的话, 在</match>前加上一行
Code:

<edit name="weight" mode="assign"><int>200</int></edit>

就好了.

当然比较正规的方法是加一个单独配置到你的fontconfig.d里, 比如
Code:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /hoard/fonts/fontconfig.d/65_boldify -->
<fontconfig>
  <match target="font">
    <test target="pattern" name="weight" compare="more_eq">
        <int>200</int>
    </test>
    <test name="weight" compare="less"><int>200</int></test>
    <edit name="weight" mode="assign"><int>200</int></edit>
    <edit name="embolden"><bool>true</bool></edit>
  </match>
</fontconfig>


如果大家早就发觉了, 不要笑我啊, 我大致翻了翻最近的帖子, 基本上都是overlay的办法
Back to top
View user's profile Send private message
akar
Bodhisattva
Bodhisattva


Joined: 03 Dec 2004
Posts: 348
Location: HKSAR,China

PostPosted: Tue Mar 28, 2006 12:51 am    Post subject: Reply with quote

  不知道呢!! 己經可以了嗎? 那太好了。 不知道 斜體和粗斜體 有了沒有?  效果又如何呢?

  前天剛 emerge 了 X 7.0,還是把補釘也一起上了。 portage overlay 來自 GOT

http://www.gentoo.org/proj/en/desktop/x/x11/modular-x-howto.xml
http://www.gentoo.org/proj/en/desktop/x/x11/porting-modular-x-howto.xml
http://www.gentoo-wiki.com/HOWTO_Modular_Xorg
_________________
AKar
Back to top
View user's profile Send private message
sxprophet
n00b
n00b


Joined: 28 Feb 2006
Posts: 10

PostPosted: Tue Mar 28, 2006 1:52 pm    Post subject: Reply with quote

akar wrote:
...
前天剛 emerge 了 X 7.0,還是把補釘也一起上了。 portage overlay 來自 GOT ...


请问,got对简体中文的支持效果怎样呢?
Back to top
View user's profile Send private message
r0bertz
Retired Dev
Retired Dev


Joined: 13 Sep 2004
Posts: 257
Location: HKSAR,China

PostPosted: Tue Mar 28, 2006 6:20 pm    Post subject: Reply with quote

至少半年前就可以了
从freetype-2.1.10开始的
Back to top
View user's profile Send private message
r0bertz
Retired Dev
Retired Dev


Joined: 13 Sep 2004
Posts: 257
Location: HKSAR,China

PostPosted: Tue Mar 28, 2006 6:25 pm    Post subject: Reply with quote

sxprophet wrote:
akar wrote:
...
前天剛 emerge 了 X 7.0,還是把補釘也一起上了。 portage overlay 來自 GOT ...


请问,got对简体中文的支持效果怎样呢?

我是从这里获得的got
http://www.gentoo.tw/proj/ebuild/packed_overlay/got-ebuilds_latest.tbz2
不知道是否是最新的
如果是的话
那么说句实在话
got现在基本已经没有应用价值了
freetype依然是2.1.9
xorg-x11是6.8.2

如果想要好的中文支持
搜索中文美化overlay
Back to top
View user's profile Send private message
akar
Bodhisattva
Bodhisattva


Joined: 03 Dec 2004
Posts: 348
Location: HKSAR,China

PostPosted: Wed Mar 29, 2006 9:10 am    Post subject: Reply with quote

sxprophet wrote:
请问,got对简体中文的支持效果怎样呢?

  很好。沒有 GOT ,當年的我就放棄了使用 Gentoo。來這獲得:Gentoo 台灣中文 Ebuild 使用指南
  Gentoo 台灣 是我看見,中文社區中支持一個 GNU/Linux 發行版最優秀的團體之一。 讚!!
_________________
AKar
Back to top
View user's profile Send private message
EricHsu
Bodhisattva
Bodhisattva


Joined: 03 May 2004
Posts: 591
Location: Aragon Consulting Group, Beijing, China

PostPosted: Wed Mar 29, 2006 12:36 pm    Post subject: Reply with quote

zhllg wrote:
至少半年前就可以了
从freetype-2.1.10开始的


是 d~

我记得从用上 xorg 6.9 开始就有了~
_________________
- http://nkbit.com
- http://twitter.com/xuyihua
Back to top
View user's profile Send private message
galilette
n00b
n00b


Joined: 17 Jan 2005
Posts: 22

PostPosted: Thu Mar 30, 2006 9:12 am    Post subject: Reply with quote

2 eric:
印象里6.9好像没有unmask过. 当然可能因为我sync得比较少

2 zhllg
我不是很明白你说的`好的中文支持' 是指什么, 我曾经粗略看了你的overlay指南, 爬坡问题我没遇到过, 不过除此以外, 中文支持里似乎只有粗体的问题了吧? 还请明示

edit: utf-8 encoded - eric
Back to top
View user's profile Send private message
r0bertz
Retired Dev
Retired Dev


Joined: 13 Sep 2004
Posts: 257
Location: HKSAR,China

PostPosted: Fri Mar 31, 2006 4:03 am    Post subject: Reply with quote

galilette wrote:

2 zhllg
我不是很明白你说的`好的中文支持' 是指什么, 我曾经粗略看了你的overlay指南, 爬坡问题我没遇到过, 不过除此以外, 中文支持里似乎只有粗体的问题了吧? 还请明示

edit: utf-8 encoded - eric

主要是字体显示效果
粗斜体
使用内嵌点阵(不再发虚)
中文字体名

爬坡,是原版freetype-2.1.10引入的一个新问题
主要在qt程序里出现
打了补丁就没事了
Back to top
View user's profile Send private message
galilette
n00b
n00b


Joined: 17 Jan 2005
Posts: 22

PostPosted: Fri Mar 31, 2006 11:08 am    Post subject: Reply with quote

zhllg wrote:
galilette wrote:

2 zhllg
我不是很明白你说的`好的中文支持' 是指什么, 我曾经粗略看了你的overlay指南, 爬坡问题我没遇到过, 不过除此以外, 中文支持里似乎只有粗体的问题了吧? 还请明示

edit: utf-8 encoded - eric

主要是字体显示效果
粗斜体
使用内嵌点阵(不再发虚)
中文字体名

爬坡,是原版freetype-2.1.10引入的一个新问题
主要在qt程序里出现
打了补丁就没事了

了解了. 中文字体名的确还不行
3x for the info
Back to top
View user's profile Send private message
countryroad
n00b
n00b


Joined: 21 Mar 2006
Posts: 9

PostPosted: Fri Mar 31, 2006 12:35 pm    Post subject: Reply with quote

很快就release的 freetype2.2 中文的显示质量有了很大的提高,和Fontconfig 2.4 的本土化也越来越好了。
Back to top
View user's profile Send private message
jiangtao
Tux's lil' helper
Tux's lil' helper


Joined: 16 Mar 2004
Posts: 80

PostPosted: Sat May 13, 2006 1:01 am    Post subject: Reply with quote

emerge -u world 到最新版。

似乎我还是不能用 simsun.ttf 显示粗体………………
谁能告诉我怎么做 :oops:

MagicLinux 害人啊,我已经不会中文美化了………………
Back to top
View user's profile Send private message
Fleta
n00b
n00b


Joined: 12 Dec 2004
Posts: 68

PostPosted: Sun May 21, 2006 1:11 pm    Post subject: Reply with quote

我试了一下,粗体是有了,但不完全,比如firefox浏览linuxsir就显示不了粗体(konqueror没问题)。字体发虚出现在终端或网页里显示代码的地方。Qt程序“爬坡”只是在用en的locale才出现,把LC_CTYPE设成zh_CN类的locale就没事了。
还有楼主的hack在我这里似乎没有影响。
Back to top
View user's profile Send private message
galilette
n00b
n00b


Joined: 17 Jan 2005
Posts: 22

PostPosted: Mon May 22, 2006 4:57 am    Post subject: Reply with quote

Fleta wrote:
我试了一下,粗体是有了,但不完全,比如firefox浏览linuxsir就显示不了粗体(konqueror没问题)。字体发虚出现在终端或网页里显示代码的地方。Qt程序“爬坡”只是在用en的locale才出现,把LC_CTYPE设成zh_CN类的locale就没事了。
还有楼主的hack在我这里似乎没有影响。

a screenshot is worth 1000 words
check this

my original post is only a demo, you shall not take it literally. you have to hand tune your fontconfig to suit your own need.
Back to top
View user's profile Send private message
Fleta
n00b
n00b


Joined: 12 Dec 2004
Posts: 68

PostPosted: Mon May 22, 2006 4:09 pm    Post subject: Reply with quote

galilette wrote:
Fleta wrote:
我试了一下,粗体是有了,但不完全,比如firefox浏览linuxsir就显示不了粗体(konqueror没问题)。字体发虚出现在终端或网页里显示代码的地方。Qt程序“爬坡”只是在用en的locale才出现,把LC_CTYPE设成zh_CN类的locale就没事了。
还有楼主的hack在我这里似乎没有影响。

a screenshot is worth 1000 words
check this

my original post is only a demo, you shall not take it literally. you have to hand tune your fontconfig to suit your own need.

那你能否贴一下你的font.conf给大家做个参考。
至于那个hack,我是说用了和没用,我这儿的字体效果都一样。
Back to top
View user's profile Send private message
galilette
n00b
n00b


Joined: 17 Jan 2005
Posts: 22

PostPosted: Tue May 23, 2006 1:51 pm    Post subject: Reply with quote

Fleta wrote:

那你能否贴一下你的font.conf给大家做个参考。
至于那个hack,我是说用了和没用,我这儿的字体效果都一样。

最早没贴fonts.conf, 是因为没有用单文件方式配置. 忘了从哪个版本开始fontconfig支持debian风格的 .d dir + number_leading conf piece方式. 这样虽然比较方便微调, 但是发帖的时候不容易说明白.

我现在的配置是这样的:

  1. 不修改系统的/etc/fonts/*
  2. 所有用到的字体放在 /hoard/fonts/fonts.using/ 下. (symlink即可)
  3. 所有配置在 /hoard/fonts/fontconfig.d/ 中(world readable), 需要使用该配置的用户建立如下 ~/.fonts.conf
    Code:

    <?xml version="1.0"?>
    <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
    <!-- /etc/fonts/fonts.conf file to configure system font access -->
    <fontconfig>
        <include>/hoard/fonts/fontconfig.d</include>
    </fontconfig>

  4. 在/hoard/fonts/fontconfig.d/中有 dir, font_target, pattern_target 三个文件

    dir的用途: 枚举自定义的字体目录

    pattern_target的用途: fontconfig的匹配过程是双向的, 首先是应用程序向fontconfig引擎发送request, 描述自己需要的字体特徵. fontconfig在对request进行解读前, 用户可以干预应用程序的request, 这些干预由fontconfig配置文件中所有<target=pattern>的部分完成. 这些部分集中放在pattern_target文件中.

    font_target的用途: fontconfig处理完所有<target=pattern>指令, 获得最终的request pattern后, 挑选出离request pattern距离最近的字体, 得到一个font description, 这包括诸如字体在哪个文件, 如何修饰 (粗体? 斜体? AA? subpixel?), 以及修饰所需的参数 (粗体-->weight多少? 斜体-->slant matrix? subpixel-->which mode?), 等等. 注意到font description和request pattern是两个不同的对象, 所以即便request pattern里要求比如粗体, 但因为simsun不支持native粗体, 所以返回的font description里, style就是normal. 所以我们需要干预fc返回的font description, 这些干预由<target=font>部分完成.

    我在最早的帖子中试图说明的是, fc只负责字体匹配, 它返回的font description必须经由渲染引擎(libxft)渲染, 但是渲染引擎如何处理一个style=bold, weight=<default> (=100, 也就是没有加粗)的字体? 我觉得最可能的结果是libxft按weight=100去粗化simsun, 结果就是无用功.

    这里其实还有一些tricky的地方, 因为最终调用rendering engine的是应用程序, 所以显示效果要看app怎么把从fc得到的font description传给rendering engine, 这就造成一种fontconfig配置, 对一个程序有用, 对另一个就未必. 最简单的例子是, 同样是fc+xft, rxvt-unicode可以针对每个字符挑选字体, firefox就不行. 至于Qt程序里的字体, 我猜道理也是类似的. 这也是我说为什么需要hand tune的原因, 每个人用的程序都不同.

    • 文件/hoard/fonts/fontconfig.d/dir
      Code:

      <?xml version="1.0"?>
      <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
      <!-- /etc/fonts/fonts.conf file to configure system font access -->
      <fontconfig>
        <!-- better no trailing / -->
        <dir>/hoard/fonts/fonts.using</dir>
      </fontconfig>

    • 文件/hoard/fonts/fontconfig.d/pattern_target
      Code:

      <?xml version="1.0"?>
      <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
      <!-- /etc/fonts/fonts.conf file to configure system font access -->
      <fontconfig>
        <!--
            ****************************************************************
            the system-wise fonts.conf recognize simsun as sans family,
            while in fact it is serif family. so undo that effect
            ****************************************************************
          -->
        <match target="pattern">
          <!-- check to see if simsun is among the family list -->
          <test name="family" qual="any" compare="contains">
            <string>SimSun</string>
          </test>
          <!-- if so, locate the 'sans-serif' inserted by fonts.conf -->
          <test name="family" qual="any" compare="eq">
            <string>sans-serif</string>
          </test>
          <!-- now replace the located 'sans-serif' with 'serif' -->
          <edit name="family" mode="assign">
            <string>serif</string>
          </edit>
        </match>

        <!--
            ****************************************************************
            if app suggests language then prepend directly to top of font list
            ****************************************************************
          -->
        <!--
        <match target="pattern">
          <test name="lang" compare="contains">
            <string>zh</string>
          </test>
          <test name="family" compare="contains">
            <string>serif</string>
          </test>
          <edit name="family" mode="prepend_first">
            <string>SimSun</string>
          </edit>
        </match>
        <match target="pattern">
          <test name="lang" compare="contains">
            <string>zh</string>
          </test>
          <test name="family" compare="contains">
            <string>sans-serif</string>
          </test>
          <edit name="family" mode="prepend_first">
            <string>Vera Sans YuanTi</string>
          </edit>
        </match>
        <match target="pattern">
          <test name="lang" compare="contains">
            <string>zh</string>
          </test>
          <test name="family" compare="contains">
            <string>monospace</string>
          </test>
          <edit name="family" mode="prepend_first">
            <string>NSimSun</string>
            <string>Vera Sans YuanTi Mono</string>
          </edit>
        </match>
        -->
        <!--
             ****************************************************************
             I don't like arphic fonts. so remove any relavent request
             ****************************************************************
          -->
        <!-- replace arphic serifs with simsun -->
        <match target="pattern">
          <test name="family" qual="any" compare="contains">
            <string>AR PL SungtiL GB</string>
            <string>AR PL Mingti2L Big5</string>
          </test>
          <edit name="family" mode="assign">
            <string>SimSun</string>
          </edit>
        </match>

        <!-- replace arphic sans with Yuanti -->
        <match target="pattern">
          <test name="family" qual="any" compare="contains">
            <string>AR PL KaitiM GB</string>
            <string>AR PL KaitiM Big5</string>
          </test>
          <edit name="family" mode="assign">
            <string>Vera Sans YuanTi</string>
          </edit>
        </match>
        <!--
            ****************************************************************
            Since the system adds the prefer list after reading user conf,
            we'll have to choose our own prefer list so that ours are
            inserted before the system default prefer list
           
            The rationale for the prefer list:
           
            that some beautiful opensource english fonts shall go first,
            then go micro$oft english fonts, then chinese fonts.
           
            The rationale for prepend_first:
           
            If the system requested directly known chinese fonts, shall
            they go first? let's try yes for now
            ****************************************************************
          -->
        <!-- serif -->
        <alias>
          <family>serif</family>
          <prefer>
            <!-- open source first -->
            <family>Bitstream Vera Serif</family>
            <!-- m$ fonts -->
            <family>Times New Roman</family>
            <!-- now chinese fonts -->
            <family>SimSun</family>
          </prefer>
        </alias>
        <!-- sans -->
        <alias>
          <family>sans-serif</family>
          <prefer>
            <!-- oss fonts -->
            <family>Bitstream Vera Sans</family>
            <!-- m$ fonts -->
            <family>Verdana</family>
            <family>Arial</family>
            <!-- chinese fonts -->
            <family>Vera Sans YuanTi</family>
            <!-- fall back to serif in case yuanti doesnt cover certain
            chars -->
            <family>SimSun</family>
          </prefer>
        </alias>
        <!-- mono -->
        <alias>
          <family>monospace</family>
          <prefer>
            <family>Bitstream Vera Sans Mono</family>
            <!-- m$ -->
            <family>Andale Mono</family>
            <family>Courier New</family>
            <!-- chs -->
            <family>Vera Sans YuanTi Mono</family>
            <family>NSimSun</family>
          </prefer>
        </alias>
        <!--
            ****************************************************************
            where appropriate, we use wqy's song since its latin chars are
            more appealing
            ****************************************************************
          -->
        <match target="pattern">
          <test name="family"><string>SimSun</string></test>
          <test qual="all" name="pixelsize" compare="more_eq">
            <double>12</double>
          </test>
          <test qual="all" name="pixelsize" compare="less_eq">
            <double>18</double>
          </test>
          <edit name="family" mode="prepend">
            <string>WenQuanYi Bitmap Song</string>
          </edit>
        </match>
      </fontconfig>

    • 文件/hoard/fonts/fontconfig.d/font_target
      Code:

      <?xml version="1.0"?>
      <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
      <!-- font_target: operations for <match target="font"> -->
      <fontconfig>
        <!--
            ****************************************************************
            the globaladvance thing. see corresponding part in the default
            fonts.conf
            ****************************************************************
          -->
        <match target="font">
          <test name="family" compare="contains">
            <string>SimSun</string>
            <string>WenQuanYi</string>
            <string>YuanTi</string>
            <!-- add more fonts here -->
          </test>
          <edit name="globaladvance"><bool>false</bool></edit>
        </match>
       
        <!--
            ****************************************************************
            synthetic emboldening. The corresponding part in fonts.conf
            almost never works, since it seems when the 'embolden' flag was
            on, libXft needs "weight" as a parameter: the "weight" as to
            "embolden" is like "matrix" as to "slant" flag in artificial
            oblique. After all, libXft had to know something about to which
            extent the emboldening should be applied.
            ****************************************************************
       -->
         <match target="font">
           <test target="pattern" name="weight" compare="more_eq">
             <int>180</int></test>
           <!-- the following test on returned weight won't work in the case
          that we conditionally substitute simsun with wqy. Take
          doggiehome or linuxsir as examples, when text size is set to
          the wqy regime, the font itself has a bold face, and thus
          bypasses the test. when the size is enlarged, at least in
          firefox simsun doesn't get emboldened. but when the test is
          on "style", all seems working
         
          <test name="weight" compare="less"><int>200</int></test>
           -->
           <test name="style" compare="contains">
             <string>regular</string></test>
           <!-- set the embolden flag -->
           <edit name="embolden" mode="assign">
             <bool>true</bool>
           </edit>
           <!-- the part that fonts.conf missed -->
           <edit name="weight" mode="assign">
             <!-- unfortunately, we have no way to know what is the weight
             in the pattern requested, so we have to compose one on
             ourselves -->
             <int>200</int>
           </edit>
           <!-- and if you want to be a gentleman, also set the "style" to
           "bold" -->
           <!--
           <edit name="style" mode="assign">
             <const>bold</const>
           </edit>
           -->
         </match>

         <!-- disable AA of chinese fonts from 12 to 18-->
         <match target="font">
           <test name="lang" compare="contains">
             <string>zh</string></test>
           <test name="pixelsize" compare="more_eq">
             <double>12</double></test>
           <test name="pixelsize" compare="less_eq">
             <double>18</double></test>
           <edit name="antialias"><bool>false</bool></edit>
           <edit name="hinting"><bool>true</bool></edit>
         </match>
      </fontconfig>



  5. 做如下symlink:
    dir --> 00_dir
    pattern_target --> 20_pattern
    font_target --> 40_font
    fc将按leading number的顺序处理这些文件
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index 中文 (Chinese) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum