Monday Oct 27, 2008

Check the OWfontpath's fontpath whether exist

From snv_97 some fonts have been removed. So, when you select some locales such like CCK, you will see garbage display on dtlogin screen. Actually not only dtlogin, all dt application such like dtterm will garbage display. What's root cause? Have a look /usr/dt/config/Xsetup, there is a fuction ADDFONTPATH_LOCAL() to add fonts path:
 ADDFONTPATH_LOCAL() {
        # Combine lines together to make arguments for the xset command
        FP=`/usr/bin/awk '
        BEGIN { fp="fp+ " }
        /\^[     ]\*$/ { fp=" +fp " ; continue }
        { printf("%s%s", fp, $0) ; fp="," } ' $1`
        if [ -n "$FP" ]; then

                eval "$XDIR/xset $FP"
        fi
}

If the font path which be passed by $1(OWfontpath) do not exist. xset will failed. To set X font path successfully, we should make sure all fonts path in OWfontpath exist. That means, if you remove some fonts path, they should be remove from OWfontpath too. Currently from snv_97 to snv_101, some the fonts path, which do not exist, are still listed in OWfontpath. This cause the issue I describe in header of this paper. I wrote a simple tool in python to check which fontpath have been removed, but still in OWfontpath. To display correctly, they need to be removed from OWfontpath.:

###############check_fontpath.py########################
#!/usr/bin/python
import os
import sys

def check_OWfontpath(OWfont):
    '''Check whether the entrie from $OWfont exists.
    '''
    bret = False
    for line in open(OWfont):
        if ',' in line:
            for path1 in line.split(','):
                if (not os.path.exists(path1.strip())):
                    print path1
                    if (bret==False):
                        bret = True
            continue
        if (not os.path.exists(line.strip())):
            print line,
            if (bret==False):
                bret = True
    return bret

def main():
    basedir = '/usr/openwin/lib/locale'
    owfontpath = 'OWfontpath'
    if (not os.path.exists(basedir)):
        print ' %s is not exist. ' % basedir
    for lc in os.listdir(basedir):
        lc_full = basedir + os.path.sep + lc
        if (os.path.isdir(lc_full) and (not os.path.islink(lc_full)) ):
            OWfont = lc_full + os.path.sep + owfontpath
            if (os.path.isfile(OWfont)):
                bRet = check_OWfontpath(OWfont)
                if (bRet==True):
                    print 'Above fonts path do not exist which listed by : %s' % OWfont  
                print   

if __name__ == '__main__':
    main()


Friday Oct 10, 2008

久违的blog-近况update

每次一个人中断很久不写blog,总会说N久没有写了,除草。。呵呵。因为太忙,将近3个月后,今天终于回来。因为太忙了,为关心我的朋友更新一下近况。


这三个月发生了很多大事小事,最大的要数北京成功的举办了奥运会,期待的这么多年终于实现了,奥运给我留下很多感人的瞬间,期间也有幸去北京工体的现场看了拳击最轻量级的预赛。开闭幕式都很壮观,用媒体的话说--无与伦比!


工作上,完成增加东南亚的三个locale的支持(ms,vi,id),在不久前也终于在Nevada的build99集成了进去。包括写了为越南语编码增加iconv的模块。相信在11月发布的OpenSolaris各位就能使用这三个locale了。当然更多的locale还得靠大家添加,社区的力量是无穷的。现在最希望有新加坡的朋友能有兴趣增加新加坡的locale,如果有兴趣请与我联系,非常感谢!


还有件事不得不说,合作一年多的PM离开了这个部门到了别的team。有些不情愿,因为之前合作的很愉快,她教了我很多的东西,彼此也有一定的默契了。心里总觉得可惜啊。她是个很好的人,工作很努力,总是为别人考虑,对于我,最好的是能讲中文,因此跟她单独沟通的时候可以中文交流,呵呵;)。 新的PM来了,我必须努力讲好英文了。我也要更加努力了!希望我们也能合作的很好。Anyway,祝福wenling在新的位置能够工作的开心并获得成功!加油!!


很巧的一个机会,现在开始兼职做老师了,儿时的梦想之一就是做老师。呵呵:)站在讲台上,看着下面可爱年轻的学生们,想起当年的自己。希望他们能从这门课上有所收获。学生总是和年轻希望梦想未来朝气蓬勃这样人类语言中最鲜活阳光的词汇联系在一起,毫无疑问老师总是能被这些所感动,我也期待并享受他们带给我的这段经历。



About

williamxue

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
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
   
       
Today