summaryrefslogtreecommitdiff
path: root/lib/uniwidth/width.c
diff options
context:
space:
mode:
authorAndreas Rottmann <a.rottmann@gmx.at>2010-05-27 18:23:15 +0200
committerAndreas Rottmann <a.rottmann@gmx.at>2010-05-27 18:23:15 +0200
commit3e0814cd9862b89c7a39672672937477bd87ddfb (patch)
tree159134a624e51509f40ed8823249f09a70d1dda3 /lib/uniwidth/width.c
parent3bebb94360f1c2333feb8d504a9fa4f96984d8b7 (diff)
Imported Upstream version 0.9.3upstream/0.9.3
Diffstat (limited to 'lib/uniwidth/width.c')
-rw-r--r--lib/uniwidth/width.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/lib/uniwidth/width.c b/lib/uniwidth/width.c
index 25ff0c73..c88fdb66 100644
--- a/lib/uniwidth/width.c
+++ b/lib/uniwidth/width.c
@@ -1,5 +1,5 @@
/* Determine display width of Unicode character.
- Copyright (C) 2001-2002, 2006-2009 Free Software Foundation, Inc.
+ Copyright (C) 2001-2002, 2006-2010 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This program is free software: you can redistribute it and/or modify it
@@ -310,26 +310,26 @@ uc_width (ucs4_t uc, const char *encoding)
{
int ind = nonspacing_table_ind[uc >> 9];
if (ind >= 0)
- if ((nonspacing_table_data[64*ind + ((uc >> 3) & 63)] >> (uc & 7)) & 1)
- {
- if (uc > 0 && uc < 0xa0)
- return -1;
- else
- return 0;
- }
+ if ((nonspacing_table_data[64*ind + ((uc >> 3) & 63)] >> (uc & 7)) & 1)
+ {
+ if (uc > 0 && uc < 0xa0)
+ return -1;
+ else
+ return 0;
+ }
}
else if ((uc >> 9) == (0xe0000 >> 9))
{
if (uc >= 0xe0100)
- {
- if (uc <= 0xe01ef)
- return 0;
- }
+ {
+ if (uc <= 0xe01ef)
+ return 0;
+ }
else
- {
- if (uc >= 0xe0020 ? uc <= 0xe007f : uc == 0xe0001)
- return 0;
- }
+ {
+ if (uc >= 0xe0020 ? uc <= 0xe007f : uc == 0xe0001)
+ return 0;
+ }
}
/* Test for double-width character.
* Generated from "grep '^....;[WF]' EastAsianWidth.txt"
@@ -337,17 +337,17 @@ uc_width (ucs4_t uc, const char *encoding)
*/
if (uc >= 0x1100
&& ((uc < 0x1160) /* Hangul Jamo */
- || (uc >= 0x2329 && uc < 0x232b) /* Angle Brackets */
- || (uc >= 0x2e80 && uc < 0xa4d0 /* CJK ... Yi */
- && !(uc == 0x303f) && !(uc >= 0x4dc0 && uc < 0x4e00))
- || (uc >= 0xac00 && uc < 0xd7a4) /* Hangul Syllables */
- || (uc >= 0xf900 && uc < 0xfb00) /* CJK Compatibility Ideographs */
- || (uc >= 0xfe10 && uc < 0xfe20) /* Presentation Forms for Vertical */
- || (uc >= 0xfe30 && uc < 0xfe70) /* CJK Compatibility Forms */
- || (uc >= 0xff00 && uc < 0xff61) /* Fullwidth Forms */
- || (uc >= 0xffe0 && uc < 0xffe7) /* Fullwidth Signs */
- || (uc >= 0x20000 && uc <= 0x2a6d6) /* CJK */
- || (uc >= 0x2f800 && uc <= 0x2fa1d) /* CJK Compatibility Ideographs */
+ || (uc >= 0x2329 && uc < 0x232b) /* Angle Brackets */
+ || (uc >= 0x2e80 && uc < 0xa4d0 /* CJK ... Yi */
+ && !(uc == 0x303f) && !(uc >= 0x4dc0 && uc < 0x4e00))
+ || (uc >= 0xac00 && uc < 0xd7a4) /* Hangul Syllables */
+ || (uc >= 0xf900 && uc < 0xfb00) /* CJK Compatibility Ideographs */
+ || (uc >= 0xfe10 && uc < 0xfe20) /* Presentation Forms for Vertical */
+ || (uc >= 0xfe30 && uc < 0xfe70) /* CJK Compatibility Forms */
+ || (uc >= 0xff00 && uc < 0xff61) /* Fullwidth Forms */
+ || (uc >= 0xffe0 && uc < 0xffe7) /* Fullwidth Signs */
+ || (uc >= 0x20000 && uc <= 0x2a6d6) /* CJK */
+ || (uc >= 0x2f800 && uc <= 0x2fa1d) /* CJK Compatibility Ideographs */
) )
return 2;
/* In ancient CJK encodings, Cyrillic and most other characters are