CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 1999
    Posts
    11

    Getting available fonts

    I am trying to get the availalable font types on the system which is running my java application. Right now I use a call to:

    fonts = Toolkit.getDefaultToolkit().getFontList();

    This only returns a couple of fonts (specifically the fonts available in the awt toolkit). I really want all the fonts available on the system. I am using Windows NT as my platform.

    Does anyone have any ideas?

    Mich


  2. #2
    Join Date
    Apr 1999
    Location
    Canada
    Posts
    12

    Re: Getting available fonts

    You can see only the fonts known by the Java Runtime. In the help which comes with the JDK you find information how to add a new font to the Java Runtime.
    Unfortunatelly, you should do it by hand, modifying the font.properties file.


  3. #3
    Join Date
    Apr 1999
    Posts
    4

    Re: Getting available fonts

    Hi.

    Actually, it is possible.
    What I did last winter (when doing a simple paint applet) was something like this:

    FontX oFontX = new FontX();
    String[] oFonts = oFontx.getFontList();

    (you might have to import com.ms.awt.*)


    This works for getting all the available font types (for example for loading into a combo box) but that doesn't change the fact that you can't use any TrueType fonts in the applet. At least I couldn't. Let me know if you find out.


  4. #4
    Join Date
    Apr 1999
    Posts
    21

    Re: Getting available fonts

    hi,
    the piece of code which iam giving will fetch all possible fonts on ur system.Actually it filled out my entire dos window .
    this works with java 2 only.

    create an array of Font,
    u have to use awt package for this.

    GraphicsEnvironment ge=GraphicsEnvironment.getLocalGraphicsEnvironment();
    fonts=ge.getAllFonts();



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured