CJK computingfullwidth charactershalfwidth charactersUnicode East Asian WidthShift JIS

CJK Character Widths: Fullwidth vs. Halfwidth in Computing

CJK Character Widths: Fullwidth vs. Halfwidth in Computing In the world of Chinese, Japanese, and Korean (CJK) computing, characters are not all created equal in terms of the space they o...

CJK Character Widths: Fullwidth vs. Halfwidth in Computing

In the world of Chinese, Japanese, and Korean (CJK) computing, characters are not all created equal in terms of the space they occupy. Unlike standard monospaced fonts where every character takes up the same amount of room, CJK typography relies on a distinction between fullwidth and halfwidth characters. This distinction is fundamental to how text is rendered, aligned, and encoded across different digital systems.

A halfwidth character occupies approximately half the horizontal space of a fullwidth character. This structural difference is not merely aesthetic; it is a legacy of how early computer systems managed limited screen real estate and complex character sets.

A command prompt (cmd.exe) with Korean localisation, showing halfwidth and fullwidth characters
A command prompt (cmd.exe) with Korean localisation, showing halfwidth and fullwidth characters

The Historical Rationale for Character Widths

During the era of text-mode computing, screens were typically arranged in a grid, such as 80 columns by 24 or 25 lines. In these environments, characters were displayed using a small dot matrix, often roughly 8 pixels wide. To handle Western languages, systems used a Single-Byte Character Set (SBCS), where each character was represented by one byte of data.

However, CJK languages presented a challenge. For better readability and aesthetics, Chinese characters are ideally square-shaped. To achieve this, they were designed to be twice as wide as the standard Western characters. This necessitated the use of a Double-Byte Character Set (DBCS). Because these characters required more data, their width on screen was proportional to their byte length.

Technical limitations of early terminals also played a role. Some editing programs could only display double-byte characters starting at even-numbered columns. To ensure compatibility and allow CJK and Western characters to coexist on the same line, DBCS sets included Roman characters and digits that could be used alongside CJK scripts.

Characters which appear in both JIS X 0201 (single byte) and JIS X 0208 / JIS X 0213 (double byte) have both a halfwidth and a fullwidth form in Shift JIS.
Characters which appear in both JIS X 0201 (single byte) and JIS X 0208 / JIS X 0213 (double byte) have both a halfwidth and a fullwidth form in Shift JIS.

The Emergence of Halfwidth Kana and Jamo

Early Japanese computing introduced a single-byte code page known as JIS X 0201 for Katakana. These characters were rendered at the same width as standard single-byte Western characters, resulting in what are known as halfwidth kana. While the JIS X 0201 standard did not explicitly mandate this display style, it became a defining visual feature in the Shift JIS encoding, distinguishing single-byte JIS X 0201 Katakana from double-byte JIS X 0208 Katakana.

A similar approach was used in some IBM code pages for Korean jamo (the basic components of Hangul), based on the N-byte Hangul code and its EBCDIC translation.

Unicode and the East Asian Width Property

To ensure that older encodings could be translated to and from Unicode without losing information, Unicode established the Halfwidth and Fullwidth Forms block (U+FF00 – FFEF). This block contains "alternative width" characters, such as fullwidth versions of ASCII characters and halfwidth versions of Katakana and Hangul. Unicode only includes characters necessary for a lossless "round trip" to existing sets, rather than creating fullwidth versions for every possible Latin accented character.

To help software manage these variations, Unicode assigns every code point an East_Asian_Width property. Terminal emulators use this property to determine whether a character should consume one or two columns when calculating cursor positions and tab stops.

Examples for the Unicode property East_Asian_Width. F, H, and W are generally only used by East Asian scripts.
Examples for the Unicode property East_Asian_Width. F, H, and W are generally only used by East Asian scripts.

Understanding East Asian Width Classifications

Unicode East Asian Width Property Classifications
Abbreviation Name Description
W Wide Naturally wide characters, such as Hiragana.
Na Narrow Naturally narrow characters, such as the ISO Basic Latin alphabet.
F Fullwidth Wide variants that normalize to naturally narrow characters (e.g., fullwidth Latin).
H Halfwidth Narrow variants that normalize to naturally wide characters (e.g., halfwidth kana).
A Ambiguous Characters found in both East Asian DBCS and European SBCS (e.g., Greek).
N Neutral Characters not appearing in East Asian DBCS (e.g., Devanagari).

Implementation in Modern Typography

In modern digital typography, the control of these widths has moved into font technology. The OpenType standard includes specific feature tags to reproduce these forms:

  • fwid: Fullwidth forms
  • halt: Halfwidth forms
  • hwid: Halfwidth width
  • vhal: Vertical halfwidth

Web developers can control these features in CSS using the font-variant-east-asian and font-feature-settings properties.

Key Facts

  • Fullwidth characters are designed to be square and occupy roughly twice the space of halfwidth characters.
  • The U+FF00 – FFEF Unicode block exists to allow lossless translation between older encodings and Unicode.
  • East_Asian_Width is a Unicode property used by terminals to calculate cursor positioning and column width.
  • Shift JIS uses halfwidth forms to distinguish between single-byte and double-byte Katakana.
  • OpenType features like fwid and halt allow for the programmatic switching of character widths in modern fonts.

Frequently Asked Questions

Why are some characters wider than others in CJK text?

In CJK computing, characters like Chinese Hanzi are designed to be square for readability. To maintain a grid-like structure in text environments, these are treated as "fullwidth," while Western characters are "halfwidth." This allows complex characters to occupy the same visual space as two standard Latin characters.

What is the purpose of the Unicode Halfwidth and Fullwidth Forms block?

This block (U+FF00 – FFEF) provides compatibility. It ensures that when converting from older character sets (which contained both widths) to Unicode, the specific width of the character is preserved, allowing for a lossless "round trip" of data.

How does a computer know how much space a character takes?

Computers use the East_Asian_Width property assigned to each Unicode code point. This property tells the system whether a character is Wide (W), Narrow (Na), Fullwidth (F), Halfwidth (H), Ambiguous (A), or Neutral (N).

Can I control character width using CSS?

Yes. You can use the font-variant-east-asian property or the font-feature-settings property to access OpenType features that trigger fullwidth or halfwidth forms.

What are "ambiguous" characters in Unicode?

Ambiguous (A) characters are those that appear in both East Asian double-byte sets and European single-byte sets, such as the Greek alphabet. Because they can be treated differently depending on the context, their display behavior can vary.

References

  1. In Taiwan and Hong Kong: 全形; in CJK: 全角.
  2. In Taiwan and Hong Kong: 半形; in CJK: 半角.
  3. "ICU Demonstration - Converter Explorer". demo.icu-project.org. Retrieved 7 May 2018.
  4. Lunde, Ken (2019-01-25). "Unicode® Standard Annex #11: East Asian Width". Unicode Consortium.
  5. "Syntax for OpenType features in CSS". Adobe. Retrieved 2023-09-20.