Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #1848

Re: Actual width of unicode chracters.

Path csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
From markspace <-@.>
Newsgroups comp.lang.java.help
Subject Re: Actual width of unicode chracters.
Date Tue, 12 Jun 2012 20:45:30 -0700
Organization A noiseless patient Spider
Lines 47
Message-ID <jr92cs$9m1$1@dont-email.me> (permalink)
References <jr8tid$64v$1@tnews.hananet.net>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Wed, 13 Jun 2012 03:45:32 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="zckhMTG1LjiDagbj0FoxqA"; logging-data="9921"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19+nT/4NowzgwUkQ8tzhZSVu1HriUU/QuY="
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1
In-Reply-To <jr8tid$64v$1@tnews.hananet.net>
Cancel-Lock sha1:cLaUFEQBfKY/Rt3CEYkvhGE89/o=
Xref csiph.com comp.lang.java.help:1848

Show key headers only | View raw


On 6/12/2012 7:23 PM, Young wrote:
>    I am trying to write a class that draws tables in console mode. Korean
> character takes two space width for one character.


I think "width" here does not mean what you think.


> When I count length of
> a string having numbers and Korean Characters together, I cannot get
> correct width.


String korean = ...

int count = korean.codePointCount( 0, korean.length()-1 );



> In result, I cannot align vertical line right.


Er, what?  Are you looking for this?

<http://docs.oracle.com/javase/tutorial/2d/text/measuringtext.html>


>    So, I have wrote a new method, countWidth().


Use "codePointCount()" above.


>    However, this would work properly when I have English and Korean in
> string variables. How would I know how many character spaces in console?


Use "codePointCount()" above.


A short, self-contained, compilable example would help here:

http://sscce.org/



Back to comp.lang.java.help | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Actual width of unicode chracters. Young <ycp101@gmail.com> - 2012-06-13 02:23 +0000
  Re: Actual width of unicode chracters. Roedy Green <see_website@mindprod.com.invalid> - 2012-06-12 20:42 -0700
  Re: Actual width of unicode chracters. markspace <-@.> - 2012-06-12 20:45 -0700
    Re: Actual width of unicode chracters. markspace <-@.> - 2012-06-13 00:58 -0700
      Re: Actual width of unicode chracters. Young <ycp101@gmail.com> - 2012-06-13 08:30 +0000
        Re: Actual width of unicode chracters. markspace <-@.> - 2012-06-13 08:45 -0700
        Re: Actual width of unicode chracters. Lew <lewbloch@gmail.com> - 2012-06-13 14:14 -0700
          Re: Actual width of unicode chracters. Steven Simpson <ss@domain.invalid> - 2012-06-14 08:06 +0100
            Re: Actual width of unicode chracters. "mayeul.marguet" <mayeul.marguet@free.fr> - 2012-06-14 10:26 +0200
              Re: Actual width of unicode chracters. "Peter J. Holzer" <hjp-usenet2@hjp.at> - 2012-06-14 15:32 +0200
                Re: Actual width of unicode chracters. "mayeul.marguet" <mayeul.marguet@free.fr> - 2012-06-14 16:47 +0200
                Re: Actual width of unicode chracters. "Peter J. Holzer" <hjp-usenet2@hjp.at> - 2012-06-16 20:39 +0200
  Re: Actual width of unicode chracters. Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-06-13 00:00 -0400
  Re: Actual width of unicode chracters. markspace <-@.> - 2012-06-13 00:24 -0700
  Re: Actual width of unicode chracters. Steven Simpson <ss@domain.invalid> - 2012-06-13 10:24 +0100

csiph-web