/* This function tests, whether the ISO 10646/Unicode character code
 * ucs belongs into the East Asian Wide (W) or East Asian FullWidth
 * (F) category as defined in Unicode Technical Report #11. In this
 * case, the terminal emulator should represent the character using a
 * a glyph from a double-wide font that covers two normal (Latin)
 * character cells. */

int iswide(int ucs)
{
  if (ucs < 0x1100)
    return 0;

  return
    (ucs >= 0x1100 && ucs <= 0x115f) || /* Hangul Jamo */
    (ucs >= 0x2e80 && ucs <= 0xa4cf && ucs != 0x303f) || /* CJK ... Yi */
    (ucs >= 0xac00 && ucs <= 0xd7a3) || /* Hangul Syllables */
    (ucs >= 0xf900 && ucs <= 0xfaff) || /* CJK Compatibility Ideographs */
    (ucs >= 0xfe30 && ucs <= 0xfe6f) || /* CJK Compatibility Forms */
    (ucs >= 0xff00 && ucs <= 0xff5f) || /* Fullwidth Forms */
    (ucs >= 0xffe0 && ucs <= 0xffe6);
}

