How do you determine the list of available fonts? [message #447993] |
Wed, 22 December 2004 16:37  |
Eclipse User |
|
|
|
I'm trying to populate a Combo with the names of the available fonts (like
in Word). The array returned by Device#getFontList(...) has lots of
repetition. It seems it's returning FontDatas that are the same font but
different height and/or styles. FontDialog uses some native code to
construct its list. Is there any way of constructing the list of valid
(scalable) fonts?
|
|
|
|
|
Re: How do you determine the list of available fonts? [message #448188 is a reply to message #448179] |
Wed, 05 January 2005 09:49  |
Eclipse User |
|
|
|
You will need to remove duplicate names. Please enter a problem report
about this. I'm pretty sure that these are different fonts in the operating
system but we might also have a bug.
import java.util.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.graphics.*;
public class ListFonts {
public static void main(String[] args) {
final Display display = new Display();
Set s = new HashSet();
// Add names of all bitmap fonts.
FontData[] fds = display.getFontList(null, false);
for (int i=0; i<fds.length; ++i)
s.add(fds[i].getName());
// Add names of all scalable fonts.
fds = display.getFontList(null, true);
for (int i=0; i<fds.length; ++i)
s.add(fds[i].getName());
// Sort the result and print it.
String[] answer = new String[s.size()];
s.toArray(answer);
Arrays.sort(answer);
for (int i=0; i<answer.length; ++i) {
System.out.println(answer[i]);
}
display.dispose();
}}
"Pratik Shah" <ppshah@us.ibm.com> wrote in message
news:crf8dn$tk6$1@www.eclipse.org...
> As I mentioned in my post, I've already tried that, but that results in a
> lot of repetition. Here's the list of scalable fonts returned by that
> method on my computer:
>
> Roman
>
> Script
>
> Modern
>
> Marlett
>
> Arial
>
> Arial CE
>
> Arial CYR
>
> Arial Greek
>
> Arial TUR
>
> Arial Baltic
>
> Arial
>
> Arial CE
>
> Arial CYR
>
> Arial Greek
>
> Arial TUR
>
> Arial Baltic
>
> Arial
>
> Arial CE
>
> Arial CYR
>
> Arial Greek
>
> Arial TUR
>
> Arial Baltic
>
> Arial
>
> Arial CE
>
> Arial CYR
>
> Arial Greek
>
> Arial TUR
>
> Arial Baltic
>
> Arial CE
>
> Arial CE
>
> Arial CE
>
> Arial CE
>
> Arial CE
>
> Arial CE
>
> Arial CE
>
> Arial CE
>
> Arial CE
>
> Arial CE
>
> Arial CE
>
> Arial CE
>
> Arial CE
>
> Arial CE
>
> Arial CE
>
> Arial CE
>
> Arial CE
>
> Arial CE
>
> Arial CE
>
> Arial CE
>
> Arial CE
>
> Arial CE
>
> Arial CE
>
> Arial CE
>
> Arial CYR
>
> Arial CYR
>
> Arial CYR
>
> Arial CYR
>
> Arial CYR
>
> Arial CYR
>
> Arial CYR
>
> Arial CYR
>
> Arial CYR
>
> Arial CYR
>
> Arial CYR
>
> Arial CYR
>
> Arial CYR
>
> Arial CYR
>
> Arial CYR
>
> Arial CYR
>
> Arial CYR
>
> Arial CYR
>
> Arial CYR
>
> Arial CYR
>
> Arial CYR
>
> Arial CYR
>
> Arial CYR
>
> Arial CYR
>
> Arial Greek
>
> Arial Greek
>
> Arial Greek
>
> Arial Greek
>
> Arial Greek
>
> Arial Greek
>
> Arial Greek
>
> Arial Greek
>
> Arial Greek
>
> Arial Greek
>
> Arial Greek
>
> Arial Greek
>
> Arial Greek
>
> Arial Greek
>
> Arial Greek
>
> Arial Greek
>
> Arial Greek
>
> Arial Greek
>
> Arial Greek
>
> Arial Greek
>
> Arial Greek
>
> Arial Greek
>
> Arial Greek
>
> Arial Greek
>
> Arial TUR
>
> Arial TUR
>
> Arial TUR
>
> Arial TUR
>
> Arial TUR
>
> Arial TUR
>
> Arial TUR
>
> Arial TUR
>
> Arial TUR
>
> Arial TUR
>
> Arial TUR
>
> Arial TUR
>
> Arial TUR
>
> Arial TUR
>
> Arial TUR
>
> Arial TUR
>
> Arial TUR
>
> Arial TUR
>
> Arial TUR
>
> Arial TUR
>
> Arial TUR
>
> Arial TUR
>
> Arial TUR
>
> Arial TUR
>
> Arial Baltic
>
> Arial Baltic
>
> Arial Baltic
>
> Arial Baltic
>
> Arial Baltic
>
> Arial Baltic
>
> Arial Baltic
>
> Arial Baltic
>
> Arial Baltic
>
> Arial Baltic
>
> Arial Baltic
>
> Arial Baltic
>
> Arial Baltic
>
> Arial Baltic
>
> Arial Baltic
>
> Arial Baltic
>
> Arial Baltic
>
> Arial Baltic
>
> Arial Baltic
>
> Arial Baltic
>
> Arial Baltic
>
> Arial Baltic
>
> Arial Baltic
>
> Arial Baltic
>
> Courier New
>
> Courier New CE
>
> Courier New CYR
>
> Courier New Greek
>
> Courier New TUR
>
> Courier New Baltic
>
> Courier New
>
> Courier New CE
>
> Courier New CYR
>
> Courier New Greek
>
> Courier New TUR
>
> Courier New Baltic
>
> Courier New
>
> Courier New CE
>
> Courier New CYR
>
> Courier New Greek
>
> Courier New TUR
>
> Courier New Baltic
>
> Courier New
>
> Courier New CE
>
> Courier New CYR
>
> Courier New Greek
>
> Courier New TUR
>
> Courier New Baltic
>
> Courier New CE
>
> Courier New CE
>
> Courier New CE
>
> Courier New CE
>
> Courier New CE
>
> Courier New CE
>
> Courier New CE
>
> Courier New CE
>
> Courier New CE
>
> Courier New CE
>
> Courier New CE
>
> Courier New CE
>
> Courier New CE
>
> Courier New CE
>
> Courier New CE
>
> Courier New CE
>
> Courier New CE
>
> Courier New CE
>
> Courier New CE
>
> Courier New CE
>
> Courier New CE
>
> Courier New CE
>
> Courier New CE
>
> Courier New CE
>
> Courier New CYR
>
> Courier New CYR
>
> Courier New CYR
>
> Courier New CYR
>
> Courier New CYR
>
> Courier New CYR
>
> Courier New CYR
>
> Courier New CYR
>
> Courier New CYR
>
> Courier New CYR
>
> Courier New CYR
>
> Courier New CYR
>
> Courier New CYR
>
> Courier New CYR
>
> Courier New CYR
>
> Courier New CYR
>
> Courier New CYR
>
> Courier New CYR
>
> Courier New CYR
>
> Courier New CYR
>
> Courier New CYR
>
> Courier New CYR
>
> Courier New CYR
>
> Courier New CYR
>
> Courier New Greek
>
> Courier New Greek
>
> Courier New Greek
>
> Courier New Greek
>
> Courier New Greek
>
> Courier New Greek
>
> Courier New Greek
>
> Courier New Greek
>
> Courier New Greek
>
> Courier New Greek
>
> Courier New Greek
>
> Courier New Greek
>
> Courier New Greek
>
> Courier New Greek
>
> Courier New Greek
>
> Courier New Greek
>
> Courier New Greek
>
> Courier New Greek
>
> Courier New Greek
>
> Courier New Greek
>
> Courier New Greek
>
> Courier New Greek
>
> Courier New Greek
>
> Courier New Greek
>
> Courier New TUR
>
> Courier New TUR
>
> Courier New TUR
>
> Courier New TUR
>
> Courier New TUR
>
> Courier New TUR
>
> Courier New TUR
>
> Courier New TUR
>
> Courier New TUR
>
> Courier New TUR
>
> Courier New TUR
>
> Courier New TUR
>
> Courier New TUR
>
> Courier New TUR
>
> Courier New TUR
>
> Courier New TUR
>
> Courier New TUR
>
> Courier New TUR
>
> Courier New TUR
>
> Courier New TUR
>
> Courier New TUR
>
> Courier New TUR
>
> Courier New TUR
>
> Courier New TUR
>
> Courier New Baltic
>
> Courier New Baltic
>
> Courier New Baltic
>
> Courier New Baltic
>
> Courier New Baltic
>
> Courier New Baltic
>
> Courier New Baltic
>
> Courier New Baltic
>
> Courier New Baltic
>
> Courier New Baltic
>
> Courier New Baltic
>
> Courier New Baltic
>
> Courier New Baltic
>
> Courier New Baltic
>
> Courier New Baltic
>
> Courier New Baltic
>
> Courier New Baltic
>
> Courier New Baltic
>
> Courier New Baltic
>
> Courier New Baltic
>
> Courier New Baltic
>
> Courier New Baltic
>
> Courier New Baltic
>
> Courier New Baltic
>
> Lucida Console
>
> Lucida Sans Unicode
>
> Times New Roman
>
> Times New Roman CE
>
> Times New Roman CYR
>
> Times New Roman Greek
>
> Times New Roman TUR
>
> Times New Roman Baltic
>
> Times New Roman
>
> Times New Roman CE
>
> Times New Roman CYR
>
> Times New Roman Greek
>
> Times New Roman TUR
>
> Times New Roman Baltic
>
> Times New Roman
>
> Times New Roman CE
>
> Times New Roman CYR
>
> Times New Roman Greek
>
> Times New Roman TUR
>
> Times New Roman Baltic
>
> Times New Roman
>
> Times New Roman CE
>
> Times New Roman CYR
>
> Times New Roman Greek
>
> Times New Roman TUR
>
> Times New Roman Baltic
>
> Times New Roman CE
>
> Times New Roman CE
>
> Times New Roman CE
>
> Times New Roman CE
>
> Times New Roman CE
>
> Times New Roman CE
>
> Times New Roman CE
>
> Times New Roman CE
>
> Times New Roman CE
>
> Times New Roman CE
>
> Times New Roman CE
>
> Times New Roman CE
>
> Times New Roman CE
>
> Times New Roman CE
>
> Times New Roman CE
>
> Times New Roman CE
>
> Times New Roman CE
>
> Times New Roman CE
>
> Times New Roman CE
>
> Times New Roman CE
>
> Times New Roman CE
>
> Times New Roman CE
>
> Times New Roman CE
>
> Times New Roman CE
>
> Times New Roman CYR
>
> Times New Roman CYR
>
> Times New Roman CYR
>
> Times New Roman CYR
>
> Times New Roman CYR
>
> Times New Roman CYR
>
> Times New Roman CYR
>
> Times New Roman CYR
>
> Times New Roman CYR
>
> Times New Roman CYR
>
> Times New Roman CYR
>
> Times New Roman CYR
>
> Times New Roman CYR
>
> Times New Roman CYR
>
> Times New Roman CYR
>
> Times New Roman CYR
>
> Times New Roman CYR
>
> Times New Roman CYR
>
> Times New Roman CYR
>
> Times New Roman CYR
>
> Times New Roman CYR
>
> Times New Roman CYR
>
> Times New Roman CYR
>
> Times New Roman CYR
>
> Times New Roman Greek
>
> Times New Roman Greek
>
> Times New Roman Greek
>
> Times New Roman Greek
>
> Times New Roman Greek
>
> Times New Roman Greek
>
> Times New Roman Greek
>
> Times New Roman Greek
>
> Times New Roman Greek
>
> Times New Roman Greek
>
> Times New Roman Greek
>
> Times New Roman Greek
>
> Times New Roman Greek
>
> Times New Roman Greek
>
> Times New Roman Greek
>
> Times New Roman Greek
>
> Times New Roman Greek
>
> Times New Roman Greek
>
> Times New Roman Greek
>
> Times New Roman Greek
>
> Times New Roman Greek
>
> Times New Roman Greek
>
> Times New Roman Greek
>
> Times New Roman Greek
>
> Times New Roman TUR
>
> Times New Roman TUR
>
> Times New Roman TUR
>
> Times New Roman TUR
>
> Times New Roman TUR
>
> Times New Roman TUR
>
> Times New Roman TUR
>
> Times New Roman TUR
>
> Times New Roman TUR
>
> Times New Roman TUR
>
> Times New Roman TUR
>
> Times New Roman TUR
>
> Times New Roman TUR
>
> Times New Roman TUR
>
> Times New Roman TUR
>
> Times New Roman TUR
>
> Times New Roman TUR
>
> Times New Roman TUR
>
> Times New Roman TUR
>
> Times New Roman TUR
>
> Times New Roman TUR
>
> Times New Roman TUR
>
> Times New Roman TUR
>
> Times New Roman TUR
>
> Times New Roman Baltic
>
> Times New Roman Baltic
>
> Times New Roman Baltic
>
> Times New Roman Baltic
>
> Times New Roman Baltic
>
> Times New Roman Baltic
>
> Times New Roman Baltic
>
> Times New Roman Baltic
>
> Times New Roman Baltic
>
> Times New Roman Baltic
>
> Times New Roman Baltic
>
> Times New Roman Baltic
>
> Times New Roman Baltic
>
> Times New Roman Baltic
>
> Times New Roman Baltic
>
> Times New Roman Baltic
>
> Times New Roman Baltic
>
> Times New Roman Baltic
>
> Times New Roman Baltic
>
> Times New Roman Baltic
>
> Times New Roman Baltic
>
> Times New Roman Baltic
>
> Times New Roman Baltic
>
> Times New Roman Baltic
>
> Wingdings
>
> Symbol
>
> Verdana
>
> Verdana
>
> Verdana
>
> Verdana
>
> Comic Sans MS
>
> Comic Sans MS
>
> Georgia
>
> Georgia
>
> Georgia
>
> Georgia
>
> Franklin Gothic Medium
>
> Franklin Gothic Medium
>
> Palatino Linotype
>
> Palatino Linotype
>
> Palatino Linotype
>
> Palatino Linotype
>
> Tahoma
>
> Tahoma
>
> Trebuchet MS
>
> Trebuchet MS
>
> Trebuchet MS
>
> Trebuchet MS
>
> Webdings
>
> Estrangelo Edessa
>
> Gautami
>
> Latha
>
> Mangal
>
> MV Boli
>
> Raavi
>
> Shruti
>
> Tunga
>
> Sylfaen
>
> Microsoft Sans Serif
>
> Book Antiqua
>
> Book Antiqua
>
> Book Antiqua
>
> Book Antiqua
>
> Bookman Old Style
>
> Bookman Old Style
>
> Bookman Old Style
>
> Bookman Old Style
>
> MS Outlook
>
> Monotype Corsiva
>
> Arial Black
>
> Arial Black
>
> Math A
>
> Math B
>
> Math C
>
> LotusWP Int A
>
> LotusWP Int B
>
> LotusWP Box
>
> LotusWP Type
>
> LotusWP Icon
>
> Lotus Postal Barcode
>
> Brush Script
>
> Gill Sans
>
> Gill Sans
>
> Gill Sans
>
> Gill Sans
>
> Letter Gothic
>
> Letter Gothic
>
> Letter Gothic
>
> Lydian
>
> News Gothic
>
> News Gothic
>
> News Gothic
>
> News Gothic Condensed
>
> Perpetua
>
> Perpetua
>
> Perpetua
>
> Perpetua
>
> Photina Casual Black
>
> Arial Narrow
>
> Arial Narrow
>
> Arial Narrow
>
> Arial Narrow
>
> Baskerville
>
> Baskerville
>
> Baskerville
>
> Baskerville
>
> Binner Gothic
>
> Centaur
>
> Centaur
>
> Garamond
>
> Garamond
>
> Garamond
>
> Garamond
>
> Gill Sans Condensed
>
> Gill Sans Condensed
>
> Gill Sans Ultra Bold
>
> Impact
>
> Monotype Sorts
>
> Nimrod
>
> Nimrod
>
> Nimrod
>
> Nimrod
>
> Onyx
>
> Botanical
>
> Rockwell
>
> Rockwell
>
> Rockwell Condensed
>
> Rockwell Light
>
> Rockwell Light
>
> Batang
>
> @Batang
>
> MS Mincho
>
> @MS Mincho
>
> SimSun
>
> @SimSun
>
> MT Extra
>
> Myriad Condensed Web
>
> Myriad Condensed Web
>
> Myriad Web
>
> Myriad Web
>
> Myriad Web
>
> Arial Unicode MS
>
> @Arial Unicode MS
>
> Century
>
> Century Gothic
>
> Century Gothic
>
> Century Gothic
>
> Century Gothic
>
> Wingdings 2
>
> Wingdings 3
>
>
> "Steve Northover" <steve_northover@ca.ibm.com> wrote in message
> news:crei2u$jj1$1@www.eclipse.org...
> > /**
> > * Returns <code>FontData</code> objects which describe
> > * the fonts that match the given arguments. If the
> > * <code>faceName</code> is null, all fonts will be returned.
> > *
> > * @param faceName the name of the font to look for, or null
> > * @param scalable if true only scalable fonts are returned, otherwise
> only
> > non-scalable fonts are returned.
> > * @return the matching font data
> > *
> > * @exception SWTException <ul>
> > * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
> > * </ul>
> > */
> > public FontData [] getFontList (String faceName, boolean scalable) {
> >
> > "Pratik Shah" <ppshah@us.ibm.com> wrote in message
> > news:cqcpff$jr8$1@www.eclipse.org...
> > > I'm trying to populate a Combo with the names of the available fonts
> (like
> > > in Word). The array returned by Device#getFontList(...) has lots of
> > > repetition. It seems it's returning FontDatas that are the same font
> but
> > > different height and/or styles. FontDialog uses some native code to
> > > construct its list. Is there any way of constructing the list of
valid
> > > (scalable) fonts?
> > >
> > >
> >
> >
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.04191 seconds