Proposal: RBBI Line Break, distinguish hard breaks

"Andy Heninger" <[email protected]>
Newsgroups gmane.comp.lib.icu.general
Message-ID <[email protected]>
Proposal for extending the Line Break Iterator to allow distinguishing Hard
and Soft breaks
----------------------------------------------------------------------------
-------------

Line Break Iterators in ICU find locations within a chunk of text that would
be appropriate points for splitting a line when laying it out for display.

Elisha Berns, in a mail to the ICU4C support list last month, noted that ICU
does not distinguish soft breaks, or places where a line break could be
inserted if one was needed, and hard breaks, places that a line break is
required.  Hard breaks occur after new line characters or sequences, such as
CR/LF.

This is a proposal to add a status value to the line break iterator for
distinguishing between the two kinds of breaks.  Break Iterators already
support the concept through the getRuleStatus() API which is used with word
break.  Extending it to Line Break is straight forward.


In ubrk.h, add an enum

typedef enum ULineBreak {
    UBRK_LINE_NONE            = 0,
    UBRK_WORD_NONE_LIMIT      = 100,
    UBRK_LINE_HARD            = 100,
    UBRK_LINE_HARD_LIMIT      = 200
}  ULineBreak;


This parallels the existing enum UWordBreak.  The UBRK_LINE_NONE range is
for boundaries that are not explicitly identified as special in some way,
and would include all soft line breaks.

No other API changes are needed.  getRuleStatus() already exists, and will
return the appropriate value after each boundary has been found.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.