Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#108 Use system wide fonts

open
nobody
None
5
2004-05-31
2004-05-31
Christian Marker
No

I realized that FreeMind makes no use of my system
wide installed truetype fonts while all other apps do. I
thought it was my fault (screwed up properties) but
then I found this in the Gentoo Linux forum:

---

Original Posting:

Hi there!

I noticed that I can only choose between some
"default" fonts in Java applications, like "Monospaced",
"Courier", "SansSerif", etc...

How can I make Java using my whole truetype fonts like
the other apps do (i.e. KDE, OpenOffice, ...)?

---

Answer:

The ability to choose other "system" fonts was added in
Java 1.2. The ability to use these depends on how the
application you're using was written. There's a method
on GraphicsEnvironment called getAllFonts that returns
all the fonts available for use.

---

Can you make FreeMind works this way?

Discussion

  • Logged In: YES
    user_id=885594

    Hi,

    the relevant place is tools.java which says:

    public static Set getAvailableFontFamilyNames() {
    if (availableFontFamilyNames == null) {
    GraphicsEnvironment gEnv =
    GraphicsEnvironment.getLocalGraphicsEnvironment();
    String envFonts[] =
    gEnv.getAvailableFontFamilyNames();
    availableFontFamilyNames = new HashSet();
    for (int i=0; i<envFonts.length; i++) {
    availableFontFamilyNames.add(envFonts[i]); }
    // Add this one explicitly, Java defaults to it if
    the font is not
    availableFontFamilyNames.add("dialog"); }
    return availableFontFamilyNames; }

    public static Vector getAvailableFontFamilyNamesAsVector() {
    GraphicsEnvironment gEnv =
    GraphicsEnvironment.getLocalGraphicsEnvironment();
    String envFonts[] = gEnv.getAvailableFontFamilyNames();
    Vector availableFontFamilyNames = new Vector();
    for (int i=0; i<envFonts.length; i++) {
    availableFontFamilyNames.add(envFonts[i]); }
    return availableFontFamilyNames; }

    public static boolean isAvailableFontFamily(String
    fontFamilyName) {
    return
    getAvailableFontFamilyNames().contains(fontFamilyName); }

    Can you correct these lines?

    Chris