Macro libyml::WIDTH_AT

source ·
macro_rules! WIDTH_AT {
    ($string:expr, $offset:expr) => { ... };
}
Expand description

Returns the width of a Unicode character at the given offset in a string.

§Parameters

  • string: A reference to the string containing the Unicode characters.
  • offset: The offset in the string where the Unicode character is located.

§Return

The width of the Unicode character at the given offset. The width is determined by the first byte of the character:

  • If the first byte is 0x00-0x7F, the width is 1.
  • If the first byte is 0xC0-0xDF, the width is 2.
  • If the first byte is 0xE0-0xEF, the width is 3.
  • If the first byte is 0xF0-0xF7, the width is 4.
  • If the first byte does not match any of the above patterns, the width is 0.