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.

Best,
Lin


On Sun, Apr 7, 2013 at 3:08 PM, Abdelrazak Younes <you...@lyx.org> wrote:

>  On 07/04/2013 03:30, Lin Wei wrote:
>
>  Sorry to bother again. Just want to add more details about the word
> wrapping problem <http://www.lyx.org/trac/ticket/4635> I mentioned 
> before<http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg177765.html>.
> It looks like this, huge space between mixture of CJK languages and
> English, which is really annoying when citing English written literatures.
>
>  [image: Inline image 1]
>
>  Wondering if anyone is working on this problem. Maybe we can come up
> with a solution together.
>
>
>  TO Richard Heck:
> I didn't find RowMetrics.cpp. Thanks, though.
>
>
> Try ParagraphMetrics.cpp and/or Row.cpp
>
> Abdel.
>
>
>
>  Regards,
> Lin
>
>
> On Sun, Apr 7, 2013 at 9:25 AM, Lin Wei <weilin1...@gmail.com> wrote:
>
>> But...there is actually no RowMetrics.cpp......
>>
>>
>> On Sat, Apr 6, 2013 at 9:01 AM, Lin Wei <weilin1...@gmail.com> wrote:
>>
>>> By the way, sorry for my late reply...
>>>
>>>
>>> On Sat, Apr 6, 2013 at 8:35 AM, Lin Wei <weilin1...@gmail.com> wrote:
>>>
>>>> Thanks a lot :)
>>>>
>>>>
>>>>  On Sat, Mar 30, 2013 at 11:04 PM, Richard Heck <rgh...@lyx.org> wrote:
>>>>
>>>>>   On 03/30/2013 06:48 AM, Lin Wei wrote:
>>>>>
>>>>> Hi there,
>>>>>
>>>>>  Word wrapping doesn't work perfectly when I use LyX with both
>>>>> Chinese and English.
>>>>> Seems this bug/defect <http://www.lyx.org/trac/ticket/4635> has been
>>>>> identified for over 5 years but still left unclosed. I'm trying fix it
>>>>> myself but get stuck in locating the source file of word wrapping. So I'm
>>>>> wondering if you can tell me which part of the source code and how it 
>>>>> deals
>>>>> with word wrapping...
>>>>>
>>>>>
>>>>>  I'm not an expert in this part of the code, but I believe most of
>>>>> this gets done in the calculation of row metrics, in RowMetrics.cpp.
>>>>>
>>>>> Richard
>>>>>
>>>>>
>>>>
>>>
>>
>
>

Reply via email to