How to find fixed width fonts?

Hi! I want to retrieve a list of all available fixed width fonts (e.g. Monospaced) on the user's system.
I tried the GraphicsEnvironment() class and stepped through the result of getAllFonts(). I compared the widths of the chars per font if they differ... No success. Some fonts are filtered but not all.
On windows systems you can get a font metrics info with a type like 'Symbol', 'Fixed', 'Non fixed' etc.
Is there something comparable in Java?
Thanks in advance,
Jan

Here's some code based on jsalonen's suggestion. It prints the font if M and i are the same width.
   public static void main(String[] args) {
      GraphicsEnvironment ge=GraphicsEnvironment.getLocalGraphicsEnvironment();
      Font[] s=ge.getAllFonts();
      Canvas comp=new Canvas();
      for(int i=0;i<s.length;i++) {
         int f1=comp.getFontMetrics(s).charWidth('i');
int f2=comp.getFontMetrics(s[i]).charWidth('M');
if(f1==f2) System.out.println(s[i].getName());

Similar Messages

  • How can i change standard font and fixed-width font in ipad 2?

    i need to change standard font and fixed-width font in my ipad 2, but i can not find safari setting menu. it is alower me to change that?

    Sorry, the font is not user selectable in Safari on iPad, like it might be on a desktop.  You can change the font size, but not the actual font.

  • Fixed width fonts

    How do I tell if a given Font object is a fixed width font?
    I've tried the closest I could find:
    Font f; ...
    FontMetrics m = getFontMetrics(f);
    if (m.hasUniformLineMetrics()) {
    but that apparently wasn't even close. Any ideas?
    Thanks,
    Nathan Kronenfeld

    This is how i done it once,
        Font f; ...
        FontMetrics m = getFontMetrics(f);
        int cW = m.charWidth('W');     
        int cI = m.charWidth('.');     
        if (cW == cI)
        }

  • [iPhone] [Bug] Fixed Width Fonts Aren't

    Aren't fixed width, that is. I imagine they're still fonts. =)
    Recently I've been doing some ASCII art applications on the iPhone and I've noticed that things don't render the way I expect. I threw together some quick demonstration images of boxes rendered with fixed width fonts in TextMate.app and then on the iPhone simulator to show the difference. Although I used TextMate.app, similar results were found using TextEdit.app.
    First some boxes rendered in the fixed width font Monaco 12 pt in TextMate.app
    The first is a large 6x6 box with an interior of 5x5 spaces.
    The second box uses tabs. This is not an important box really--it's expected that different apps use different lengths for tab. In fact, this box looks completely different in TextEdit.app where the tabs are much wider. Don't worry too much about box number 2.
    The next box is a 3x3 box with one space in the center, and the last box is a 4x4 box with... well, you get the idea. Note how all boxes render as squares correctly.
    Now here's an image of the same boxes rendered with Monaco 12 pt on the iPhone's UITextView:
    Some problems are immediately visible. White space has some width, but it's far too small. I'm not too concerned about the tabs (box #2) since as I said above, I expect some variance in tabs, but the rest are pretty bad, especially box #3 whose single space looks positively anorexic. I focus a lot on white space here, because it's notable, but also notice that the + is wider than either the - or | as well.
    The Monaco font on the iPhone is not fixed width.
    The situation with Courier 12pt is slightly better but still has issues:
    Courier 12 pt on TextMate.app:
    Courier 12 pt on the iPhone:
    Unlike Monaco this is almost correct. Ignore box #2 again--I don't expect tab to work out. Courier doesn't have the same issue Monaco has with most characters. |, +, and - are all taking up the same width. However, as the boxes grow larger (Boxes 3, 4, and 1), the consecutive spaces start to show more and more how they're slightly too thin. It's barely perceptible in box 3, noticeable in box 4, and impossible to miss in box 1.
    It looks like the Courier font on iPhone has a space which is too narrow to be fixed width.
    As far as other things to try: I tried this with Andale Mono and Courier New as well with similar results. Also, although I've used a UITextView here, it also happens if you render a UIWebView containing the boxes inside of <pre> tags as well as outside of <pre> tags but use   for spaces.
    Has anyone else seen this phenomenon? Is there a fix or something I'm missing? Or is this a bug?
    Thanks!

    Bump. =(

  • Problem with printing perfomance when using a fixed width font

    Hello.
    I'm using the java.awt.print.Printable interface for printing text.
    Everything works fine when I choose a font like Serif.
    When I choose a fixed width font, like Courier, the printing becomes too slow!!!
    Any Idea?
    My code looks like that :
    private int sizeFont = 10;
    private font myFont = new Font ("Courier", Font.PLAIN, sizeFont);
    public int print(Graphics g, PageFormat pf, int indice)
    Graphics2D g2=(Graphics2D)g;
    while(myCondition){
    g2.drawString(myString,0,0);
    g2.translate(0,this.sizeFont);
    return Printable.PAGE_EXISTS;

    If it interests someone, I have found a solution :
    do not use "Courier", but "Courier New" .

  • How to display fixed width column in Advanced Table?

    Hi,
    This is probably a newbie question for OAF. My requirement is quite simple but I couldn't find the answer in either the OAF developer's guide or anywhere else so I turn to the experts here. I have a region of type Table or Advanced table with three items in them. One of the Item is of type comments which could be up to 4000 characters.
    I wanted to show all three on the first page but only have fixed width for the comments section like only show the first 50 characters for example and then if they want to see more detail they can click on a link to see full comments.
    The problem is I cannot figure out how to make the comments item fixed width. I have played with the table width properties but it keeps displaying the comments in multiple lines (I don't want that...). I have also tried putting the Table in a Row Layout but it doesn't seem to help.
    Since this is new development I can change my region style to anything to meet my requirements.
    I hope this is an easy question and if someone can help me that would be great....:-)

    Hi,
    Thanks but I was not wanting to change the VO attribute length size since I want to have a link on the first page which would enable to see a user the full 4000 comments using the same VO object. Then if I limit it to 50 characters in the VO, I will not be able to display the full comments on the second page.
    Isn't there some way in the UI that I can limit it? I know one workaround I can use for now is to have another column in the VO with the 50 character value such as substr(comments, 1, 50) and then have the full comments selected also in the VO and then show this subtr value in the first page and the comments value in the 2nd. I just thought there would be an easier way about it then doing all this workaround.
    Any ideas?
    Thanks

  • How do I fix jagged fonts in Preview?

    Something happened and now all the pdf-documents I open in Preview have really jagged fonts and terrible quality. I'm using OS X 10.6.8. This might have happened when I last updated the software, but I don't remember exactly. How do I fix this?

    Wow, now I feel really stupid. I just found the "Smooth text and line art" and clicked that. Fixed the problem. Amazed.

  • How do i fix sound font fail for audigy 2

    all of the suddon my sound stopped working and my diagnostics say sound font fail. how do i fix this problem?

    I had the exact same problem updating the drivers for my Audigy 2 Platinum EX, but I think I managed to solve the problem. This was quite awhile ago, but I think I remember how I got it to work.
    First of all, which update did you download? The "Digital Rights Management" driver update was the one giving me that problem, and this was after installing the main drivers and programs from my Audigy 2 CD. But, I think the reason why it gives this message is because you need to install one of the other driver updates first, then install this DRM update. Look under the driver details and it says the following:
    "<EM>Requirements</EM>:
    Microsoft? Windows? XP Service Pack 2 or Windows 2000 Service Pack 4 </LI>
    Creative Sound Blaster Audigy 2 or Audigy 2 ZS series internal audio device </LI>
    <EM>EAX 4.0 ADVANCED HD Driver Patch Update for Sound Blaster Audigy 2 and Audigy 2 ZS (released on 29 March, 2004) installed, or Sound Blaster Audigy 2 and Audigy 2 ZS Driver Update (released on 29 July, 2004) installed</EM>."</LI>
    Strangely enough, it appears this update requires you install an older driver update first (EAX4DRV_AUDIGY2__84_50.exe) then afterwards try running the Digital Rights Management update.
    I think this is right, but I'm not 00% sure.

  • How do I fix a font compatibilty issue from Mac to Windows, using Adobe Flash CS4?

    Hi,
    I need to edit a Flash movie that somebody else developed in Adobe Flash CS3 on a Mac. I'm using Adobe Flash CS4 on Windows (Vista). However, the font that shows up on my computer is much bigger than on the .SWF that he produced.
    He used a custom font, which I had to add to my system Fonts folder. Because Adobe Flash detected the right fonts on my computer, it didn't map them to substitute fonts. I verified that Flash is indeed using the same font files that he used.
    I believe the fonts are being rendered differently because I'm using Windows.
    How do I fix this?

    hi all - I have a similar problem with flash - basically the plugin crashes pretty much every time I am not looking at it directly (playing online games in tabs for example)
    I have tried disabling the "memory-safe-away-time-out thingee" in config:about - to no avail. I have also tried disabling all other plugins (not that I actually have many - Java, VLC, quicktime, some windows stuff), have set themes to default, have made sure all plugins are latest version.
    currently running the 4.0.b2 Firefox version cause of the plug in crashes in the 3.6.8 version - same problem though.
    and where it gets really strange is that a friendly help person on the adobe site suggested I upgrade my firefox to version 3.8 (while I was on the 3.6.8 version) and that would fix it. which I thought was.. interesting as 3.6.8 is the latest version as Firefox upgrade check insisted.
    by now i have invested at least 4 days trying to fix this issue and I gotta say... I am tempted to actually try other browsers, though firefox is my default browser since years.

  • How to find the missing fonts?

    hi,
    Is there any other options to find the missing fonts in a illustrator 10 file using AppleScript.
    or
    How to identify the missing fonts and missing links dialog box when opening a document through AppleScript. Suppose if i can identify in the particular file means (in batch processes), i need to neglect the particular file and open the other file in a BatchProcess.
    Regards,
    Subha

    reply as soon as possible.........

  • How do I fix corrupted fonts in firefox that ALL other browsers display perfectly fine?

    How it looks in firefox: http://i47.tinypic.com/334rki0.png
    How it looks in crome (and is supposed to look): http://i47.tinypic.com/5xo1ow.png
    I'm on firefox 20.0.1 on a Mac running mountain lion 10.8.3.
    How do I fix this?

    Hello,
    The Reset Firefox feature can fix many issues by restoring Firefox to its factory default state while saving your essential information.
    Note: ''This will cause you to lose any Extensions, Open websites, and some Preferences.''
    To Reset Firefox do the following:
    #Go to Firefox > Help > Troubleshooting Information.
    #Click the "Reset Firefox" button.
    #Firefox will close and reset. After Firefox is done, it will show a window with the information that is imported. Click Finish.
    #Firefox will open with all factory defaults applied.
    Further information can be found in the [[Reset Firefox – easily fix most problems]] article.
    Did this fix your problems? Please report back to us!
    Thank you.

  • How to find the missing fonts while running the script?

    hi,
    I need to create a script to find the missing font. not only for that. Actually i created a script to read the file properties. but i have a problem while running the script.
    I have put "User Interation Level" to never interact. Even i need to check wheather each file have "missing fonts". mean time i never stop the script.
    Is It Possible???
    Regards,
    SubhaOviya

    Here's a shot of the Find Font Dialog:
    Papyrus (highlighted in the list) is missing, and there's a yellow warning triangle to show that. Fonts that ar not missing have an icon to show the type of font. You'll also see it shown as missing in the "Info" box at the bottom of the dialog.
    If you use the Replace With dropdown you will only see fonts listed that are installed on the system. In order to actually use the missing font, rather than substitute a different font in its place, you must obtain and install the missing font on the system.
    Are you seeing something different when you open Find Font?

  • How can I fix Bad Font Detected dialog box

    Hi, I Installed some font books a few months ago then change hard drives, so I moved some of the fonts to the new HDD. After that I started getting this annoying error boxes with this information:
    http://www.redgizmo.net/errors/BadFontError.png
    This errors (with different fonts) appear some times when I open Illustrator, photoshop, InDesign or some times when I open Safari. I can't find the error path on my computer and I don't know how to get rid of those. Please help.
    Someone know how can get rid of the errors?
    Thank you

    Hello pv:
    Welcome to Apple discussions.
    I suggest you run fontbook (located in your application folder). That should tell you which fonts are corrupted/problematic.
    Barry

  • How to find out the font type?

    Is it possible to find out the type of the used fonts(like Open type (or) true type) in illustrator cs3 file through programmatically. Kindly share with me the possibilities and solution.
    Thanks...

    You can't consistently, but a lot of files have identifying characteristics in the first few bytes that make it easier.
    There are utilities to do this, but I could have sworn that someone wrote a Java library to do it as well. As always, I suggest that you poke around http://jakarta.apache.org/commons/
    Or do a Google if Jakarta doesn't pan out.
    Message was edited by:
    paulcw

  • How to make fixed width size on grid layout managers.,

    hiya,
    my gird contains labels but whenever the labels has different width on their texts, the grid adopts to the width of the text, how not to?
    many thanks! :)

    Thats the way the GridLayout works, each cell is the same size. The size is determined by the largest component added to the grid.
    Here is the Swing tutorial on "Using Layout Managers".
    http://java.sun.com/docs/books/tutorial/uiswing/layout/using.html

Maybe you are looking for

  • Iphone 4s space issues

    I have a 16gig (or so I thought) iphone 4s with 681 photos and unable to update any apps as I am supposedly over my storage capacity. Wondering if anyone has had similar issues or if my photos and music are at a higher rez then normal.

  • Error message (-43), won't back up.

    I'm trying to update my 3Gs. I continually get an error message (-43). Restarted the phone, iTunes is up to date, phone is charged. I'd rather not lose everything!

  • Start New Report server

    Can any one help me I need to start another report server to serve new Custom Application in Oracle E business suite server My Application R12 1.2 Os Linux 5

  • SRVCTL - Error

    Hi, When i run the command *./srvctl status database -d <db_name>* on Node 1 i get the following Error: # ./srvctl status database -d <db_name> ./srvctl: line 179: 30283 Segmentation fault $JRE $JRE_OPTIONS -classpath $CLASSPATH $TRACE oracle.ops.ops

  • Tranistion from .mac to mobile me

    I had a .mac website / blog on my .mac account. But have changed the operating system to leopard, and now want to publish again to the same website. I have entered in the website's name into my preferences but still, it creates a new website. Does an