You wrote:
> Hello, everybody. I have question on using 'XLoadFont ()' funtion.
>
> Consider the following XLFD, "-*-*-*-*-*-*-*-*-*-*-*-*-iso8859-1", is it a
> valid XLFD.
>
> By the way, I can query a list of font name with this;
> font_list = XListFonts (display, "-*-*-*-*-*-*-*-*-*-*-*-*-iso8859-1", 30,
> &num_retd);
>
> So far, it is far, and a list of matching font name is reterned. But, when
> i do this....
>
> font = XLoadFont (display, "-*-*-*-*-*-*-*-*-*-*-*-*-iso8859-1");
>
> A BadError is appeared. (Named color or font does not exist).
>
> Why?? Also the return value, i.e. font, is not NULL, even though the
> BadError is really occur.
>
> I have write a piece of code, so that I can easier to learn about these
> function. And the result is, most probably, XListFonts will return me a
> list, as long as the parameter is in XLFD. While, XLoadFont are not.
>
> Another question, if I specified a XLFD with wildcard to Load a Font, and
> how can I know the exact fontname I have opened??
>
> Zenith (zl)
> _______________________________________________
> Fonts mailing list
> [EMAIL PROTECTED]
> http://XFree86.Org/mailman/listinfo/fonts
Hello,
I have tested XLoadFont with parameter "-*-*-*-*-*-*-*-*-*-*-*-*-iso8859-1"
and it worked. My version of Xfree86 is "4.1.0 from 2 June 2001".
A quick look at the implementation revealed that XLoadFont always returns
a valid resource id. But XLoadQueryFont returns 0 in case of an error
my be you want to use this function instead of XLoadFont.
To get to font name of a loaded font use the following code snippet
unsigned long aFontname = None ;
XFontStruct* pXfont = 0 ;
pXfont = XLoadQueryFont(display,"-*-*-*-*-*-*-*-*-*-*-*-*-iso8859-1" ) ;
/*
or use
pFfont = XQueryFont( display, font ) ;
if you want to use XLoadFont
*/
if (pXfont && XGetFontProperrty( pXfont, XA_FONT, &aFontname ))
{
char* strFontName = 0 ;
strFontName = XGetAtomName( display, aFontName ) ;
/* use name here */
/* ... */
XFree( strFontName ) ; strFontName = 0 ;
}
if (pXfont) XFreeFont( display, pXfont) ; pXfont = 0 ;
Regards
Joerg Seebohn
(http://www.s.netic.de/jseebohn)
_______________________________________________
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts