Enumerating fonts

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brian P. Bailey

    #1

    Enumerating fonts

    Hello, I'm trying to enumerate the fixed-pitch font families installed on a
    system. I am _not_ trying to create a generic monospaced font. I've tried
    looking at:

    FontFamily
    InstalledFontCo llection
    Font

    The closest I could get was to use Font.ToLogFont( ...). I should be able to
    get a GDI LOGFONT structure and then look at the lfPitchAndFamil y member.

    Problem is, this requires unmanaged code, and I cannot find any quick
    examples of how to use this function anyway (e.g., I cannot find a namespace
    containing the LOGFONT structure, so how do I cast the object parameter?). I
    clearly have no experience in using unmanaged code with .NET.

    Is there an easier way to do this, preferably with managed code only? If
    not, can someone provide or point me to an example of using the
    ToLogFont(...) function, including namespace references?

    Thanks in advance,
    Brian P. Bailey


Working...