Skip to content

Instantly share code, notes, and snippets.

@saitoha
Last active August 29, 2015 13:55
Show Gist options
  • Save saitoha/8767268 to your computer and use it in GitHub Desktop.
Save saitoha/8767268 to your computer and use it in GitHub Desktop.
Proposal for resolving character-cell width problems in multilingual terminal emulators.

[Draft] glyph width query / report escape sequence

This document proposes two new escape sequences based on yaft's glyph width reporting feature.

YF_RQGRW - request glyph width list

The host sends this control string to retrive terminal-specific definition for character-cell width. The terminal is expected to respond with a YF_RPGRW sequence.

Direction: Host To Terminal

Format:

OSC 8900 ; Ps ; ? ST

or

OSC 8900 ; Ps ; ? : from : to ST
  • Ps:

    reserved (maybe charset, default = 0)

  • from:

    the first code point of the range to query

  • to:

    the last code point of the range to query

Example:

  • request entire glyph width list of terminal

    OSC 8900 ; 0 ; ? ST

  • request the glyph width list for BMP range

    OSC 8900 ; 0 ; ? : 0 : 65535 ST

YF_RPGRW - glyph width report

Reports the terminal-specific definition for character-cell width in response to a YF_RQGRW sequence.

Direction: Terminal To Host

Format:

OSC 8900 ; Ps ; Pt ; width : from : to ; width : from : to ; ... ST
  • Ps:

    • Ps = 0: ok (default)

    • Ps = 1: recognized but not supported

    • Ps = 2: not recognized

  • Pt:

    reserved (maybe charset information or East Asian Width version, default = 0)

  • width:

    character-cell width of current range piece, typically 0, 1 or 2

  • from:

    the first code point of current range piece

  • to:

    the last code point of current range piece

Example:

OSC 8900 ; 0 ; 0 ; 2 : 4352 : 4441 ; 2 : 4447 : 4447 ; 2 : 9001 : 9002 ; 2 : 11904 : 11929 ; 2 : 11931 : 12019 ; 2 : 12032 : 12245 ; 2 : 12272 : 12283 ; 2 : 12288 : 12329 ; 2 : 12336 : 12350 ; 2 : 12353 : 12438 ; 2 : 12443 : 12543 ; 2 : 12549 : 12589 ; 2 : 12593 : 12686 ; 2 : 12688 : 12727 ; 2 : 12736 : 12751 ; 2 : 12784 : 12830 ; 2 : 12832 : 12867 ; 2 : 12880 : 13054 ; 2 : 13056 : 19893 ; 2 : 19904 : 40891 ; 2 : 40960 : 42124 ; 2 : 42128 : 42182 ; 2 : 44032 : 55203 ; 2 : 63744 : 64045 ; 2 : 64048 : 64106 ; 2 : 64112 : 64217 ; 2 : 65040 : 65049 ; 2 : 65072 : 65106 ; 2 : 65108 : 65126 ; 2 : 65128 : 65131 ; 2 : 65281 : 65376 ; 2 : 65504 : 65510 ST

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment