Decoration: don't crash when given a non-existent font

This commit is contained in:
Andrea Rossato 2007-08-10 18:24:33 +00:00
parent 17342a2421
commit 300a017edf

View File

@ -66,7 +66,8 @@ withGC w fn f = withDisplay $ \d -> do gc <- io $ createGC d w
let fontname = if fn == "" let fontname = if fn == ""
then "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*" then "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*"
else fn else fn
font <- io $ loadQueryFont d fontname font <- io $ catch (loadQueryFont d fontname)
(const $ loadQueryFont d "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*")
io $ setFont d gc (fontFromFontStruct font) io $ setFont d gc (fontFromFontStruct font)
f d w gc font f d w gc font
io $ freeGC d gc io $ freeGC d gc