Still have some doubt about the algorithm for word wrap. TextMetrics.cpp pos_type TextMetrics::rowBreakPoint(int width, pit_type const pit, pos_type pos) const
This function seems to iterate through until the right margin or end of par is reached. I'm wondering whether it iterates a word per pass or just a character. Furthermore, If it is a word, how does LyX wrap a long word to the next row? Thx. Best, Lin On Tue, Apr 9, 2013 at 3:25 PM, Lin Wei <weilin1...@gmail.com> wrote: > It seems the following function decides where to break within a paragraph: > TextMetrics.cpp: pos_type TextMetrics::rowBreakPoint(int width, pit_type > const pit, pos_type pos) const > > But still, I didn't really figure out how it works...What I'm puzzled > about the codes is how it knows the exact breaking point as it iterates to > then end of a row width but is still in the middle of a word. Say a word > "itshardtowrapaword" is at the end of a line and the position iterator now > pointing to 'p'. Then we find we are now at the end of the line, which > means the whole words needs to be wrapped. How did the codes achieve that? > > Becides, I think the problem of Lyx with Chinese is that it view all > Chinese characters as just one word so long as no space/newline appears. A > main feature of Chinese and Japanese is that they generally don't use any > space within words or sentences. So a sentence like "***(Bob > 2010)***********" would be treated as two words, "**(Bob" and > "2010)***********", thus incorrectly wrapped if the second so-called word > is too long. > > Thanks a lot and looking for more updates from you. > > Btw....Sorry that I don't know the convention in developing free software, > but should I reply only to the mailing list or cc to everyone replied me as > well? > > Best, > Lin > > > On Sun, Apr 7, 2013 at 9:40 AM, Scott Kostyshak <skost...@lyx.org> wrote: > >> On Sat, Apr 6, 2013 at 9:30 PM, Lin Wei <weilin1...@gmail.com> wrote: >> >>> >>> TO Richard Heck: >>> I didn't find RowMetrics.cpp. Thanks, though. >>> >> >> Hi Lin Wei, >> >> I know nothing about this, but maybe take a look at >> TextMetrics::computeRowMetrics? >> >> src/TextMetrics.cpp:void TextMetrics::computeRowMetrics(pit_type const >> pit, >> src/TextMetrics.h: void computeRowMetrics(pit_type pit, Row & row, >> int width) const; >> >> Best, >> >> Scott >> > >