getting ttf font/family name; fontTools?

John Hunter jdhunter at ace.bsd.uchicago.edu
Fri Sep 12 10:25:18 EDT 2003


>>>>> "Mike" == Mike C Fletcher <mcfletch at rogers.com> writes:


    Mike> I've checked the change into CVS. That'll teach me to open
    Mike> my big mouth :) . Have fun, Mike

OK, thanks, I repaired it on my end too.  I'm having trouble figuring
out how to use the minor argument.  For example, with the Bitstream
Vera fonts in my path, if I do

    import sys, os
    import ttffiles

    major, minor = 'Sans', None

    weight = 'bold'
    italics = 0
    registry = ttffiles.Registry()
    new,failed = registry.scan( paths=None, printErrors = 1, force = 0)

    for fontName in registry.familyMembers( major, minor ):
        print 'F', fontName
        for specific in registry.fontMembers(
            fontName, weight=weight, italics=italics ):
            print ' ', registry.fontFile( specific )

I get the results

  F Bitstream Vera Sans
    /usr/share/fonts/ttf-bitstream-vera/Vera.ttf
  F Bitstream Vera Sans Mono
    /usr/share/fonts/ttf-bitstream-vera/VeraMono.ttf

How do I indicate whether I want the Mono or regular version?  I tried
specifying 'Mono' as the minor argument, but this returned no matches.

Also, I found the WEIGHT_NAMES dictionary in describe, but haven't
found the analog for italics.  Empirically, I find that italics=1
returns italics fonts and italics=0 returns nonslanted fonts.  How do
I ask for oblique?

Thanks again,
John Hunter








More information about the Python-list mailing list