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:

        # 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"

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.:
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
        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  

if __name__ == ‘__main__’:

One thought on “Check the OWfontpath’s fontpath whether exist


Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s