Closed dawoodalbadi closed 8 years ago
@andreas-vox ping
Hi,
I'm afraid moving LineControl out of pageitem_textframe.cpp was the wrong move. This class is not designed to be used outside of layout().
In pdflib_core.cpp you use it like this:
LineControl* item; for (int d = ls->firstChar(); d <= ls->lastChar(); ++d) { const GlyphLayout glyphs = item->glyphRuns.at(d).glyphs().at(d);
Instead you should write something like this:
for (int i = 0; i < ls->boxes().length(); ++i) { const GlyphBox* box = dynamic_cast<const GlyphBox*> (ls->boxes()[i]); if (box) { const GlyphRun& glyphs(box->glyphs());
Ok I will modify it accordingly
but in other hand I found out there are no code to initialize or to create the boxes. We modified it in all classes but I think that we need to create boxes when we insert char. I see that you add method like createGlyphBox in LineControl so I put in my mined that this is the way to initialize boxes by using line control. When I look again i found out that my thinking was completely wrong so I am asking what is the correct way to create boxes such as linebox or glyphbox
I think you get confuse Mr Andreas last commit I did not use LineControl in any place other than pageItem_textFrame in instead I made object called m_gb in pageItem_textFrame then I modified it according to following code
const LineBox* linebox;
for (uint ll=0; ll < textLayout.lines(); ++ll)
{
linebox = textLayout.line(ll);
const GlyphBox* glyphbox;
for (int i = 0; i < linebox->boxes().count(); ++i)
{
glyphbox = dynamic_cast<const GlyphBox*>(linebox->boxes()[i]);
}
m_gb = glyphbox;
}
}
then I call this object in other classes please check this commit https://github.com/dawoodalbadi/ScribusCTL/commi/72ba86acbc54a8560938dffdceccb5afdd10a995
now I need to create the boxes when ever i have text. Where I can do that ??? moreover regarding to render method can you explain its functionalities ???
From: dawoodalbadi [mailto:notifications@github.com] Sent: Montag, 14. Dezember 2015 07:22 To: andreas-vox/ScribusCTL Cc: andreas-vox Subject: Re: [ScribusCTL] Making boxes.cpp compiled without error (#16)
Ok I will modify it accordingly but in other hand I found out there are no code to initialize or to create the boxes. We modified it in all classes but I think that we need to create boxes when we insert char. I see that you add method like createGlyphBox in LineControl so I put in my mined that this is the way to initialize boxes by using line control. When I look again i found out that my thinking was completely wrong so I am asking what is the correct way to create boxes such as linebox or glyphbox
Hi Dawood!
The boxes are created by PageItem_Textframe::layout() with the help of LineControl. After layout() has been called, TextLayout holds the correct tree of boxes and no further changes to the tree are required. Rendering just traverses this tree and calls graphic primitives to draw the layout on screen or to PDF.
The current implementation of layout() does Scribus' old text layout. It will have to be rewritten for RTL. The old layout produces a simple box tree:
For rendering the structure doesn't matter. It will follow this pseudo code:
TextLayout::render(Painter* painter) { p->save(); set up painter for position and scale; m_lines->render(painter); p->restore(); }
GroupBox::render(Painter* p) { p->moveBy(x(), y()); foreach (Box b in boxes()) { b->render(p); } p->moveBy(-x(), -y()); }
GlyphBox::render(Painter* p) { p->save(); set up painter for font and style for (int i = 0; I < glyphs().length(); ++i) { render glyph[i] ; p->moveBy( glyph[i].xAdvance, glyph[i].yAdvance); } p->restore(); }
InlineBox::render(Painter* p) { p->save(); setup painter for frame position and scale; embeddedFrame()->textLayout()->render(p); p->restore(); }
From: dawoodalbadi [mailto:notifications@github.com] Sent: Montag, 14. Dezember 2015 08:34 To: andreas-vox/ScribusCTL Cc: andreas-vox Subject: Re: [ScribusCTL] Making boxes.cpp compiled without error (#16)
I think you get confuse Mr Andreas last commit I did not use LineControl in any place other than pageItem_textFrame in instead I made object called m_gb in pageItem_textFrame then I modified it according to following code
const LineBox* linebox; for (uint ll=0; ll < textLayout.lines(); ++ll) { linebox = textLayout.line(ll); const GlyphBox* glyphbox; for (int i = 0; i < linebox->boxes().count(); ++i)
{ glyphbox = dynamic_cast<const GlyphBox*>(linebox->boxes()[i]); } m_gb = glyphbox;
} } then I call this object in other classes please check this commit https://github.com/dawoodalbadi/ScribusCTL/commi/72ba86acbc54a8560938dffdceccb5afdd10a995 now I need to create the boxes when ever i have text. Where I can do that ??? moreover regarding to render method can you explain its functionalities ???
Hi Dawood,
I was commenting on your pull request to andreas-vox/ScribusCTL. You may have additional commits on your fork. The above code doesn't make sense since it only handles the last glyphbox of the last line. Storing m_gb will not help you. You have to iterate the tree of boxes each time starting with PageItem::textLayout.
You don't need to create the boxes yourself, they are already created in PageItem_TextFrame::layout(). You'll rewrite this method for RTL at a later stage.
/Andreas
I did some modifications but the code has a lot of segmentation volt.
regarding render method I let my partner work on it. he almost finish it but still something to done on it. I will merge it to my fork as son as he finish it
in following commit : https://github.com/dawoodalbadi/ScribusCTL/commit/9be17e2a15328a6e9bdb212713bb052dd4b9d742
we still not modifying any code regarding pathtext
Hi Dawood!
I’ll check it out.
Shall we meet at 10h GMT this Saturday in #scribusdev then?
Or do you prefer a later time?
Regards,
Andreas
From: dawoodalbadi [mailto:notifications@github.com] Sent: Donnerstag, 17. Dezember 2015 11:02 To: andreas-vox/ScribusCTL Cc: andreas-vox Subject: Re: [ScribusCTL] Making boxes.cpp compiled without error (#16)
I did some modifications but the code has a lot of segmentation volt.
regarding render method I let my partner work on it. he almost finish it but still something to done on it.
in following commit : dawoodalbadi@ https://github.com/dawoodalbadi/ScribusCTL/commit/9be17e2a15328a6e9bdb212713bb052dd4b9d742 9be17e2
we still not modifying any code regarding pathtext
— Reply to this email directly or view it on GitHub https://github.com/andreas-vox/ScribusCTL/pull/16#issuecomment-165405399 . https://github.com/notifications/beacon/AD_WIRWAKcsaeX5TVD6E2iA28MnoExdgks5pQn-ygaJpZM4Gv5Fb.gif
Hello Andreas Actually 10 GMT is 14:00 with me and so it will be lunch time 😅😅 If you can make it later it will be very nice Any time after 11 GMT will be fine with me بتاريخ ١٧/١٢/٢٠١٥ ٥:٠٨ م، كتب "andreas-vox" notifications@github.com:
Hi Dawood!
I’ll check it out.
Shall we meet at 10h GMT this Saturday in #scribusdev then?
Or do you prefer a later time?
Regards,
Andreas
From: dawoodalbadi [mailto:notifications@github.com] Sent: Donnerstag, 17. Dezember 2015 11:02 To: andreas-vox/ScribusCTL Cc: andreas-vox Subject: Re: [ScribusCTL] Making boxes.cpp compiled without error (#16)
I did some modifications but the code has a lot of segmentation volt.
regarding render method I let my partner work on it. he almost finish it but still something to done on it.
in following commit : dawoodalbadi@ < https://github.com/dawoodalbadi/ScribusCTL/commit/9be17e2a15328a6e9bdb212713bb052dd4b9d742> 9be17e2
we still not modifying any code regarding pathtext
— Reply to this email directly or view it on GitHub < https://github.com/andreas-vox/ScribusCTL/pull/16#issuecomment-165405399> . < https://github.com/notifications/beacon/AD_WIRWAKcsaeX5TVD6E2iA28MnoExdgks5pQn-ygaJpZM4Gv5Fb.gif>
— Reply to this email directly or view it on GitHub https://github.com/andreas-vox/ScribusCTL/pull/16#issuecomment-165447984 .
Hi,
propose another time, then. Do you hold siesta after lunch? ;-)
/Andreas
From: dawoodalbadi [mailto:notifications@github.com] Sent: Donnerstag, 17. Dezember 2015 14:19 To: andreas-vox/ScribusCTL Cc: andreas-vox Subject: Re: [ScribusCTL] Making boxes.cpp compiled without error (#16)
Hello Andreas Actually 10 GMT is 14:00 with me and so it will be lunch time 😅😅 If you can make it later it will be very nice Any time after 11 GMT will be fine with me بتاريخ ١٧/١٢/٢٠١٥ ٥:٠٨ م، كتب "andreas-vox" notifications@github.com:
Hi Dawood!
I’ll check it out.
Shall we meet at 10h GMT this Saturday in #scribusdev then?
Or do you prefer a later time?
Regards,
Andreas
From: dawoodalbadi [mailto:notifications@github.com] Sent: Donnerstag, 17. Dezember 2015 11:02 To: andreas-vox/ScribusCTL Cc: andreas-vox Subject: Re: [ScribusCTL] Making boxes.cpp compiled without error (#16)
I did some modifications but the code has a lot of segmentation volt.
regarding render method I let my partner work on it. he almost finish it but still something to done on it.
in following commit : dawoodalbadi@ < https://github.com/dawoodalbadi/ScribusCTL/commit/9be17e2a15328a6e9bdb212713bb052dd4b9d742> 9be17e2
we still not modifying any code regarding pathtext
— Reply to this email directly or view it on GitHub < https://github.com/andreas-vox/ScribusCTL/pull/16#issuecomment-165405399> . < https://github.com/notifications/beacon/AD_WIRWAKcsaeX5TVD6E2iA28MnoExdgks5pQn-ygaJpZM4Gv5Fb.gif>
— Reply to this email directly or view it on GitHub https://github.com/andreas-vox/ScribusCTL/pull/16#issuecomment-165447984 .
— Reply to this email directly or view it on GitHub https://github.com/andreas-vox/ScribusCTL/pull/16#issuecomment-165451373 . https://github.com/notifications/beacon/AD_WIRHucdjFLbFmduhY9KWK2j-PmXSpks5pQq25gaJpZM4Gv5Fb.gif
😂😂unfortunately there is no siesta
Best time for me is 16:00 GMT but I can manage to have the meeting any time after 11:00 GMT بتاريخ ١٧/١٢/٢٠١٥ ٥:٢٣ م، كتب "andreas-vox" notifications@github.com:
Hi,
propose another time, then. Do you hold siesta after lunch? ;-)
/Andreas
From: dawoodalbadi [mailto:notifications@github.com] Sent: Donnerstag, 17. Dezember 2015 14:19 To: andreas-vox/ScribusCTL Cc: andreas-vox Subject: Re: [ScribusCTL] Making boxes.cpp compiled without error (#16)
Hello Andreas Actually 10 GMT is 14:00 with me and so it will be lunch time 😅😅 If you can make it later it will be very nice Any time after 11 GMT will be fine with me بتاريخ ١٧/١٢/٢٠١٥ ٥:٠٨ م، كتب "andreas-vox" notifications@github.com:
Hi Dawood!
I’ll check it out.
Shall we meet at 10h GMT this Saturday in #scribusdev then?
Or do you prefer a later time?
Regards,
Andreas
From: dawoodalbadi [mailto:notifications@github.com] Sent: Donnerstag, 17. Dezember 2015 11:02 To: andreas-vox/ScribusCTL Cc: andreas-vox Subject: Re: [ScribusCTL] Making boxes.cpp compiled without error (#16)
I did some modifications but the code has a lot of segmentation volt.
regarding render method I let my partner work on it. he almost finish it but still something to done on it.
in following commit : dawoodalbadi@ <
https://github.com/dawoodalbadi/ScribusCTL/commit/9be17e2a15328a6e9bdb212713bb052dd4b9d742
9be17e2
we still not modifying any code regarding pathtext
— Reply to this email directly or view it on GitHub < https://github.com/andreas-vox/ScribusCTL/pull/16#issuecomment-165405399
. <
https://github.com/notifications/beacon/AD_WIRWAKcsaeX5TVD6E2iA28MnoExdgks5pQn-ygaJpZM4Gv5Fb.gif
— Reply to this email directly or view it on GitHub < https://github.com/andreas-vox/ScribusCTL/pull/16#issuecomment-165447984> .
— Reply to this email directly or view it on GitHub < https://github.com/andreas-vox/ScribusCTL/pull/16#issuecomment-165451373> . < https://github.com/notifications/beacon/AD_WIRHucdjFLbFmduhY9KWK2j-PmXSpks5pQq25gaJpZM4Gv5Fb.gif>
— Reply to this email directly or view it on GitHub https://github.com/andreas-vox/ScribusCTL/pull/16#issuecomment-165452101 .
Hello Andreas I have problems with iterate on the boxes first look at the next code to see how I iterate on the boxes
for (uint ll=0; ll < ite->textLayout.lines(); ++ll) { const LineBox* ls = ite->textLayout.line(ll); tabDist = ls->x(); double CurX = ls->x(); for (int a = 0; a < ls->boxes().length(); ++a) { const GlyphBox* box = dynamic_cast<const GlyphBox*> (ls->boxes()[a]); if (box) { const GlyphRun glyphss(box->glyphs);
for (int d=0; d < glyphss.glyphs().length(); d++)
{
const GlyphLayout glyphs = glyphss.glyphs().at(d);
this example I applied it on pdflib_core but this is not the case
I want to test the boxes tree so I create text frame and I wrote inside it "dawood albadi" then I export it to pdf to debug the iterations on the line boxes and boxes
this what I got :
When it inter the first loop, it take me to first line box and then it loop on boxes inside that line and there was the problem it shows that the length is 5 and it show for me this chars: d,a,w,o,o then it goes outside the loop of boxes and it iterate again on line boxes and in the next iteration it shows the following chars : o,d,' ',a,l and it goes again the next line box which hold the following chars: a,b,a,d,i and same thing happen it goes to next line box which hold these chars: d,i
and then it goes outside the loop.
so what I notice that the length of boxes is always smaller than 6, I did not modify any thing regarding creating boxes, what you think cause that problem?
Dawood
Hello again I made another debug and I found out part of the problem, it calculate the possible break line correctly but it use it always. what that mean? In the following function it calculate possible break void rememberBreak(int index, double pos, double morespace = 0) but it use it always not on real end of line width as it suppose to do you can find the problem in this condition in textFrame::layout()
// end of line
if (outs)
In case that you know this problem and how it is affect on lineboxes the other part of problem is why it always repeat one or two chars from last line.
There were some spelling and missing methods. First method need to be modified is Box* GroupBox::addBox(uint i) : in this function there are a method used called clear which I don’t understand what you really want to clear. Second method need to be implement from the scratch which is screenToPosition . Finally, I think there are some method need logical fix such as addBox(uint i).