Skip to content

feat: add break-type masks and fix BreakCount reporting (fixes #54)#55

Open
fam007e wants to merge 1 commit intoJimmyLefevre:mainfrom
fam007e:fix/issue-54
Open

feat: add break-type masks and fix BreakCount reporting (fixes #54)#55
fam007e wants to merge 1 commit intoJimmyLefevre:mainfrom
fam007e:fix/issue-54

Conversation

@fam007e
Copy link
Copy Markdown

@fam007e fam007e commented Feb 3, 2026

Fixes #54

This PR adds the ability to disable specific Unicode break types via kbts_break_config_flags to optimize performance in per-frame UI pipelines. It also fixes a bug in break count reporting.

Summary of Changes

1. Break-Type Masks (Optimization)

  • Added new flags to kbts_break_config_flags: DISABLE_DIRECTION_BREAK, DISABLE_SCRIPT_BREAK, DISABLE_GRAPHEME_BREAK, DISABLE_WORD_BREAK, and DISABLE_LINE_BREAK.
  • Optimized kbts__BreakAddCodepoint to skip expensive Unicode property lookups for disabled types.
  • Updated kbts__DoBreak to filter emitted flags based on the configuration.

2. Bug Fix: BreakCount Reporting

  • Fixed a bug in kbts_BreakEntireString where BreakCount was only updated if the Breaks buffer was NULL. It now correctly reports the count for both dry runs and actual runs.

Verification

  • Verified that BreakCount is correctly reported when providing a buffer.
  • Verified that disabling specific break types successfully suppresses the corresponding flags in the output.
  • Verified that the system remains stable when optional break types are disabled (mandatory paragraph direction is preserved).

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

Successfully merging this pull request may close these issues.

Expose break‑type masks or lightweight run segmentation (avoid line‑break cost)

1 participant