Article View: borland.public.jbuilder.java.swing
Article #7851Re: Monospaced and Higher Unicode Characters
From: James A. Schulz
Date: Fri, 01 Dec 2000 00:00
Date: Fri, 01 Dec 2000 00:00
40 lines
2095 bytes
2095 bytes
John, I am assuming that "M" is the same width as all the other characters in the "Monospaced" font, otherwise what does "Monospaced" mean? But the fact is that at least some of the higher unicode characters are wider than the "Monospaced" standard. And, in fact some are much narrower. What I need is a way to tell a jTextField to place all characters in the font in equal width "cells". I know it won't look very good, but that's not important for my application. Can you help me with this: James "John McGrath [TeamB]" <ng-b@JPMcGrath.net> wrote in message news:MPG.14912621d190d0f989d82@forums.borland.com... > On Thu, 30 Nov 2000 14:30:25 -0600, James A. Schulz wrote: > > > In a jTextField with its font set to "Monospaced" the > > width of '\u2228' is greater than an 'M'. Is there > > anyway I can fix this? > > Install a font that meets your expectations? :o) > > You seem to be assuming that the "M" must be the widest character in a > font, and there is no guarantee of that. > > The FontMetrics class has a getMaxAdvance() method that will tell you > the maximum advance (width) of all characters in the font. But note > that the information is not guaranteed to be available. > > -- > Regards, > > John McGrath [TeamB] > > --------------------------------------------------- > Before sending me e-mail, please read: > http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID:
<9088jr$apb4@bornews.inprise.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<906d8v$cq63@bornews.inprise.com> <MPG.14912621d190d0f989d82@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,e7b0355fee419750 X-Google-Attributes: gid111d45,public From: "James A. Schulz" <jaschulz@wiseware.com> Subject: Re: Monospaced and Higher Unicode Characters Date: 2000/12/01 Message-ID: <9088jr$apb4@bornews.inprise.com> X-Deja-AN: 699915191 References: <906d8v$cq63@bornews.inprise.com> <MPG.14912621d190d0f989d82@forums.borland.com> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Organization: Another Netscape Collabra Server User X-MSMail-Priority: Normal Reply-To: "James A. Schulz" <jaschulz@wiseware.com> Newsgroups: borland.public.jbuilder.java.swing