Re: issue with line break option PANGO_WRAP_CHAR



On 13-09-06 08:22 AM, Parth Kanungo wrote:
Hello,

I am facing an issue with a line break option - PANGO_WRAP_CHAR.

You can see the output (image.bmp)

for my code (main.cpp)

It is clear that "i" can be rendered on the first line after "Th".

However, it is coming on the second line. This is wrong.

Is this a known bug?

There's many things going on here:

1. Unicode line breaking algorithm prohibits breaking before a space.  As such
we try to fit the space after i in the same line.  Normally, after we break
line, we zero the width of the final space on the line (see
pango-layout.c:zero_line_final_space).  We try to account for that when
deciding where to break, but it's possible that we are messing things up,

2. When WRAP_CHAR, we still never break before a space, while sometimes that's
the right thing to do no matter what Unicode says.

In short, that piece of code needs some long overdue love, but I don't know
anyone with the time and expertise to look into it right now.

behdad


I further debugged and found that

1. can_break_at() gives false for space character.

2. break_width contains the width of "Th" only, when it should contain the
width of "The"

 

But, I am not sure how to fix this.

Moreover, this problem aggravates if we introduce multiple spaces between 2 words.

 

Any pointers in this direction would be helpful.

 

Thanks and regards,
Parth Kanungo



_______________________________________________
gtk-i18n-list mailing list
gtk-i18n-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-i18n-list


-- 
behdad
http://behdad.org/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]