Skip to content

Request for ability to determine width of multi-codepoint graphemes #112

@heimskr

Description

@heimskr

Thanks for creating this great library! I'm currently creating a terminal UI library that uses libunicode for grapheme iteration and width measurement. Currently, to determine the width of a grapheme, I'm using unicode::width(view[0]), where view is the std::u32string_view returned by unicode::grapheme_segmenter::operator*(). This works in most cases, but I noticed it fails for strings containing "☝️" (U+261D U+FE0F) because U+261D by itself (☝) has a width of 1, but when followed by the variation selector U+FE0F, it should have a width of 2.

I'd like a way to determine the width of an entire multi-codepoint grapheme (and perhaps even an entire multi-grapheme string). Perhaps an overload of unicode::width that takes a std::u32string_view argument.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions