Article View: borland.public.jbuilder.java.swing
Article #7856Re: Monospaced and Higher Unicode Characters
From: Rich Wilkman
Date: Fri, 01 Dec 2000 00:00
Date: Fri, 01 Dec 2000 00:00
62 lines
3505 bytes
3505 bytes
James: There is no "Monospaced" font. What "Monospaced" means is 'use the font mapped to this tag'. You have no guarantee of it being the same from system to system *at all*. Heck, you have no guarantee that the font mapped to Monospaced is even Monospaced or that the pt. size you are assuming is available and not remapped on the client. For your measurement test to be valid you'd have to compare MMMMM to the series of Unicode escapes that map to the M character. The concept of 'em' is ASCII only (it's based on typography conventions that are about a hundred years older than Java) and you can't expect it to apply to characters shoved into the high registers of the font to fulfill unicode desires. Tor's original suggestion of installing a font that meets your expectations really is your best bet. Find a font (or create one) that meets your ASCII and Unicode needs and map it to "Monospaced". I've been tracking your project via your posts. You are fighting UI/UE design and structure and Java implementations every step of the way. You should be able to easily limit your JTextField to the entry of 50 characters. Forcing the preferred size to do it for the current definition of monospaced for the set of characters you want to allow input for... Extend JTextField and start writing a bunch of code to determine at runtime what that preferred size should be today. Then, never use that extended component in a smart or helpful layout manager like GBL or a dumb one like Border or Grid or Flow. -Rich "James A. Schulz" wrote: > Tor, > > In fact this just isn't true. Try drawing the following strings (one below > the other) using the "Monospaced" font: > > 1. "MMMMM" > > 2. \u2228 + \u2228 + \u2228 + \u2228 +\u2228 > > and you will see that these strings, which have the same character length, > do not draw out to the same length on the screen. > > What I need is some guidance about creating a descendent of jTextField which > will enforce a truly uniform value for characterWidth + paddihg. If you can > help, I would be grateful. > > James > > "Tor Iver Wilhelmsen" <tor.wilhelmsen@sds.no> wrote in message > news:uofyw444r.fsf@sds.no... > > "James A. Schulz" <jaschulz@wiseware.com> writes: > > > > > I am assuming that "M" is the same width as all the other characters in > the > > > "Monospaced" font, otherwise what does "Monospaced" mean? > > > > That all characters occupy the same area - but this means the > > character width _plus padding_ is constant. And the em value is based > > on use of [a-zA-Z] plus possibly the special characters: Unicode may > > have several characters that the "em" standard doesn't take into > > account.
Technical Details
Message-ID:
<3A27EA61.B6E7F02@formlessvoid.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<906d8v$cq63@bornews.inprise.com> <MPG.14912621d190d0f989d82@forums.borland.com> <9088jr$apb4@bornews.inprise.com> <uofyw444r.fsf@sds.no> <908hh3$o9l2@bornews.inprise.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: Rich Wilkman <richw@formlessvoid.com> Subject: Re: Monospaced and Higher Unicode Characters Date: 2000/12/01 Message-ID: <3A27EA61.B6E7F02@formlessvoid.com> X-Deja-AN: 700010098 Content-Transfer-Encoding: 7bit References: <906d8v$cq63@bornews.inprise.com> <MPG.14912621d190d0f989d82@forums.borland.com> <9088jr$apb4@bornews.inprise.com> <uofyw444r.fsf@sds.no> <908hh3$o9l2@bornews.inprise.com> X-Accept-Language: ja,en Content-Type: text/plain; charset=us-ascii X-Trace: 1 Dec 2000 10:15:06 -0800, 209.144.169.10 MIME-Version: 1.0 Reply-To: richw@formlessvoid.com Newsgroups: borland.public.jbuilder.java.swing