• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Windows XP and Fonts

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I was wondering if in Java it can recognize fonts that are in a different directory. The reason why I'm asking is I'm using GIMP and it allows me to place .ttf files under my home account (and don't seem to be known by Windows b/c I never install them): C:\my_home_dir\.gimp-2.4\fonts. GIMP recognizes those fonts and thus alleviate Windows from getting bloated.

That directory is going to get large (1000+ font files) as I'm doing graphic editing. I don't care about these fonts being registered with Windows.

So where does Java fit in: I'm going to write a program that takes as word and a font size and shows me what that word looks like in all those fonts and size.

Thanks, Jim
 
Marshal
Posts: 79698
381
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you found the GraphicsEnvironment#getAllFonts() method. I think you need a static method of GraphicsEnvironment to get an instance, then you can call getAllFonts on that.
 
Bartender
Posts: 3323
86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Have you found the GraphicsEnvironment#getAllFonts() method.

Unfortunately, I think this will only work for installed fonts.

@Jim Harrison
I believe you will have to load each of the uninstalled fonts using one of the Font.createFont(..) methods.
You can register these fonts with the graphics environment using the GraphicsEnvironment.registerFont(..) method. As far as I'm aware this isn't compulsary but it does mean you can use the GraphicsEnvironment.getAllFonts() or GraphicsEnvironment.getAvailableFontFamilyNames() methods to get a single list of all the installed and registered fonts.
 
It's a tiny ad. At least, that's what she said.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic