Skip to content

LineSegmenter returns breakpoint for Combining Marks #6533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
saecki opened this issue May 6, 2025 · 1 comment
Closed

LineSegmenter returns breakpoint for Combining Marks #6533

saecki opened this issue May 6, 2025 · 1 comment

Comments

@saecki
Copy link

saecki commented May 6, 2025

For the following example the LineSegmenter returns breakpoints which are classified as LineBreak::CombiningMark by icu_properties.

// [dependencies]
// icu_segmenter = "1.5.0"
// icu_properties = "1.5.1"

fn main() {
    let segmenter = icu_segmenter::LineSegmenter::new_auto();
    let linebreaks = icu_properties::maps::line_break();

    let str = "\u{2066}\u{2069}";
    let iter = segmenter.segment_str(str);
    for brk_idx in iter {
        let Some(c) = str[..brk_idx].chars().next_back() else {
            continue;
        };
        let lb = linebreaks.get(c);
        println!("{brk_idx:3}: {lb:?} {}", c.escape_unicode());
    }
}

Produces this output:

  3: LineBreak(9) \u{2066}
  9: LineBreak(9) \u{2069}

The docs say:

The segmenter returns mandatory breaks (as defined by definition LD7 of Unicode Standard Annex #14, Unicode Line Breaking Algorithm) as well as line break opportunities (definition LD3).

Is this an oversight or is the returned breakpoint to be expected?

Relevant issue typst/typst#5489

@saecki
Copy link
Author

saecki commented May 6, 2025

Seems like this is correct behavior. See typst/typst#5489.

@saecki saecki closed this as completed May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant