Skip to content

U+3000 IDEOGRAPHIC SPACE is reported as Whitespace::None #104

@magackame

Description

@magackame

Repro

main.rs:

use swash::FontRef;
use swash::shape::ShapeContext;

fn main() {
    let mut shape_context = ShapeContext::new();
    let font = std::fs::read("/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc").unwrap();
    let font = FontRef::from_index(&font, 0).unwrap();

    let mut shaper = shape_context.builder(font).build();
    shaper.add_str("\u{3000}");

    shaper.shape_with(|glyph_cluster| {
        println!(
            "glyph_cluster.whitespace: {:?}",
            glyph_cluster.info.whitespace()
        );
        println!(
            "glyph_cluster.is_whitespace(): {}",
            glyph_cluster.info.is_whitespace()
        );
    });

    println!();
    println!(
        "'\\u{{3000}}'.is_whitespace(): {}",
        '\u{3000}'.is_whitespace()
    );
}

Cargo.toml:

[package]
name = "swash-space-repro"
version = "0.1.0"
edition = "2024"

[dependencies]
swash = "0.2.5"

Output

actual output (cargo run):

glyph_cluster.whitespace: None
glyph_cluster.is_whitespace(): false

'\u{3000}'.is_whitespace(): true

expected output:

glyph_cluster.whitespace: Space
glyph_cluster.is_whitespace(): true

'\u{3000}'.is_whitespace(): true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions