Around 3 o'clock on Oct 14, Zack Rusin wrote:

> From what I read in the tutorial is seems like XftListFonts with specific
> encoding would be a good bet, so I invoke it this way: font_set  =
> XftListFonts (disp, DefaultScreen(disp), XFT_ENCODING, XftTypeString,
> "iso8859-1", 0); after which members nfont and sfont are respectively 1 and
> 32.

Well, you picked the right function, but it's kinda mystic inside.  Let's 
piece together the argument list:

        XftFontSet *
        XftListFonts (Display *dpy, int screen, ...)

Unlike most varargs functions, this one actually takes *two* lists of 
arguments (yeah, it's probably not the best API I've designed, suggestions 
are welcome).  The first list of arguments create the pattern you're 
interested in matching:

        XftListFonts (dpy, screen,
                      XFT_ENCODING, XftTypeString, "iso8859-1",

After you've built the pattern to match, you need to terminate this 
argument list with a 0:

                      0,

Now you need to tell the function what elements of the font name you're 
interested in viewing -- do you want the list of families available with 
this encoding?  Or are you interested in the families *and* their styles.  
Or are you just interested in knowing whether this encoding is supported 
at all?  If you want to know the families available with this encoding, you
use:

                     XFT_FAMILY, 0);

You can add any other elements of the font names you'd like, to get the 
families, weights and slants use:

                     XFT_FAMILY, XFT_WEIGHT, XFT_SLANT, 0);

Xft returns a list containing all names unique in the requested 
attributes; that way your application doesn't have to wade through 
duplicate information to find what it is interested in.

I'm also busy eliminating the use of the 'encoding' member; the goal is to 
provide a uniform ISO10646 encoding at the Xft API and perform internal 
translations from the available font encodings.  That's easy for TrueType/
Type1 fonts which are generally available with an encoding amenable to 
Unicode transcoding.

To present a complete example, listing the available families with an 
iso8859-1 encoding would be done with:

        fs = XftListFonts (dpy, screen,
                           XFT_ENCODING, XftTypeString, "iso8859-1",
                           0,
                           XFT_FAMILY,
                           0);

[EMAIL PROTECTED]        XFree86 Core Team              SuSE, Inc.


_______________________________________________
Render mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/render

Reply via email to