You can subscribe to this list here.
2007 |
Jan
(1) |
Feb
|
Mar
|
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
(1) |
Oct
(2) |
Nov
(37) |
Dec
(44) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(188) |
Feb
(74) |
Mar
(154) |
Apr
(100) |
May
(16) |
Jun
(11) |
Jul
(38) |
Aug
(67) |
Sep
(82) |
Oct
(24) |
Nov
(23) |
Dec
(5) |
2009 |
Jan
|
Feb
(15) |
Mar
(52) |
Apr
(32) |
May
(8) |
Jun
(7) |
Jul
(53) |
Aug
(92) |
Sep
(59) |
Oct
(31) |
Nov
|
Dec
(1) |
2010 |
Jan
|
Feb
(28) |
Mar
|
Apr
(75) |
May
(58) |
Jun
(43) |
Jul
(5) |
Aug
(36) |
Sep
(16) |
Oct
|
Nov
(6) |
Dec
(2) |
2011 |
Jan
(11) |
Feb
(3) |
Mar
|
Apr
|
May
(1) |
Jun
(21) |
Jul
(8) |
Aug
(37) |
Sep
(1) |
Oct
|
Nov
(11) |
Dec
(4) |
2012 |
Jan
(35) |
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(6) |
Nov
|
Dec
|
2013 |
Jan
(3) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Andreas K. <ya...@gm...> - 2014-08-11 08:30:08
|
Hi! Anyone got an idea where one can retrieve the Qt4 based branch? TiA, Andreas |
From: Yuen <yen...@ho...> - 2014-04-16 14:34:44
|
Hi, I am using the addText sample in the pdfedit tools section to try to add text to a PDF document. I want to add CJK (east Asian) characters but the default fonts don't support those. I downloaded the language support packs but am not sure how to go about this. I know I have to add TrueType font to the page but there is only method to add Type1font in the API page->addSystemType1Font (font_id); Also do I insert UTF-8 characters or characters from a language's code page (Big5 for Chinese for example) ? Thanks if anyone can help. |
From: <ef...@io...> - 2013-01-25 12:38:06
|
From: mis...@ho... Date: 25/01/2013 10.46 > Thank you Valerio, > when we get the time we will definitely use it. attached a new version with left2right lines Valerio |
From: Jozef M. <mis...@ho...> - 2013-01-25 09:46:53
|
Dne 1/22/2013 5:02 PM, ef...@io... napsal(a): > hi, > the Win32 installer do not set an icon, nor the executable contain one. > I prepared one, editing some your resources online. > If you like you can use it in GPL too. > > Valerio Thank you Valerio, when we get the time we will definitely use it. Best, Jozef > > > ------------------------------------------------------------------------------ > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft > MVPs and experts. ON SALE this month only -- learn more at: > http://p.sf.net/sfu/learnnow-d2d > > > _______________________________________________ > Pdfedit-devel mailing list > Pdf...@li... > https://lists.sourceforge.net/lists/listinfo/pdfedit-devel |
From: <ef...@io...> - 2013-01-22 16:03:01
|
hi, the Win32 installer do not set an icon, nor the executable contain one. I prepared one, editing some your resources online. If you like you can use it in GPL too. Valerio |
From: Marek Z. <mar...@gm...> - 2012-10-22 17:35:14
|
Hi Michal, it looks way more involved it seems :-) I have to give up in such a case: lack of time to dig in to the issue. Anyways, thanks for being responsives and looking at the issue yourself! Cheers, Marek On Mon, Oct 22, 2012 at 3:35 PM, Michal Hocko <ms...@gm...> wrote: > From 01f026b4fbb786549b2517497afc0336a818311b Mon Sep 17 00:00:00 2001 > From: Michal Hocko <ms...@gm...> > Date: Fri, 4 Nov 2011 11:27:36 +0100 > Subject: [PATCH 2/2] kernel: distinguish {set,get}Mediabox relative and > absolute coordinating systems > > Current implementation of CPageDisplay::{set,get} uses hardcoded absolute > coordinating system (aka User space). This is correct but not ideal if a > page has any transformation on top of it (e.g. rotation). Then you are > seting the box before the rotation is actually applied so the result can > be little bit surprising (or call it confusing). > > This patch adds a new parameter to both functions with the absolute > coordinates as a default. If you use the false for it then it rotates the > given (returned) rectangle so that the left bottom resp. right top are > independent on the rotation. > > Fixes bt#367 > --- > src/gui/qspage.cc | 6 +-- > src/kernel/cpage.cc | 8 ++-- > src/kernel/cpage.h | 19 ++++++-- > src/kernel/cpagedisplay.cc | 110 +++++++++++++++++++++++++++++++++++++------- > src/kernel/cpagedisplay.h | 9 +++- > 5 files changed, 124 insertions(+), 28 deletions(-) > > diff --git a/src/gui/qspage.cc b/src/gui/qspage.cc > index 868426f..253269e 100644 > --- a/src/gui/qspage.cc > +++ b/src/gui/qspage.cc > @@ -330,7 +330,7 @@ void QSPage::addAnnotation(QObject *an) { > \see CPage::getMediabox > */ > QVariant QSPage::mediabox() { > - libs::Rectangle r=obj->getMediabox(); > + libs::Rectangle r=obj->getMediabox(false); > Q_List<QVariant> rect; > rect.append(r.xleft); > rect.append(r.yleft); > @@ -350,7 +350,7 @@ QVariant QSPage::mediabox() { > void QSPage::setMediabox(double x1,double y1,double x2,double y2) { > libs::Rectangle r(x1,y1,x2,y2); > try { > - obj->setMediabox(r); > + obj->setMediabox(r, false); > } catch (ReadOnlyDocumentException &e) { > base->errorException("Page","setMediaBox",QObject::tr("Document is read-only")); > } > @@ -366,7 +366,7 @@ void QSPage::setMediabox(QRect rc) { > //However, media box is often array of int, so this may not be a problem > libs::Rectangle r(rc.left(),rc.top(),rc.right(),rc.bottom()); > try { > - obj->setMediabox(r); > + obj->setMediabox(r, false); > } catch (ReadOnlyDocumentException &e) { > base->errorException("Page","setMediaBox",QObject::tr("Document is read-only")); > } > diff --git a/src/kernel/cpage.cc b/src/kernel/cpage.cc > index 6777cc5..7e453f6 100644 > --- a/src/kernel/cpage.cc > +++ b/src/kernel/cpage.cc > @@ -185,15 +185,15 @@ CPage::setRotation (int rot) > // > // > libs::Rectangle > -CPage::getMediabox () const > +CPage::getMediabox (bool absolute) const > { > - return _display->getMediabox(); > + return _display->getMediabox(absolute); > } > > void > -CPage::setMediabox (const libs::Rectangle& rc) > +CPage::setMediabox (const libs::Rectangle& rc, bool absolute) > { > - _display->setMediabox (rc); > + _display->setMediabox (rc, absolute); > } > > // > diff --git a/src/kernel/cpage.h b/src/kernel/cpage.h > index 7ccee7f..a85cd9b 100644 > --- a/src/kernel/cpage.h > +++ b/src/kernel/cpage.h > @@ -401,10 +401,23 @@ public: > * > * @return Rectangle specifying the box. > */ > - libs::Rectangle getMediabox () const; > + libs::Rectangle getMediabox (bool absolute = true) const; > > - /** Seta media box of this page. */ > - void setMediabox (const libs::Rectangle& rc); > + /** Seta media box of this page. > + * @param rc Rectangle for the box. > + * @param absolute Flag whether the given rectangle should be treated as absolute (see below). > + * > + * Rectangle with the absolute coordinates (in PDF specification called > + * User Space) is the one which defines device independent coordinates > + * (with the fixed relationship to the page - e.g. no rotation applied > + * - checkout "4.2.1 Coordinate Spaces" in the PDF specification). > + * <br> > + * Absolute flag can be, however, tricky if there is a rotation applied > + * to the page ([0,0] point is not in the left, bottom corner but rather) > + * rotated according to the selected rotation. absolute == false handles > + * the page as you see it displayed. > + */ > + void setMediabox (const libs::Rectangle& rc, bool absolute = true); > > /** > * Set transform matrix of a page. This operator will be preceding first cm > diff --git a/src/kernel/cpagedisplay.cc b/src/kernel/cpagedisplay.cc > index 1f9524d..2aa1512 100644 > --- a/src/kernel/cpagedisplay.cc > +++ b/src/kernel/cpagedisplay.cc > @@ -199,18 +199,50 @@ CPageDisplay::setRotation (int rot) > // > // > libs::Rectangle > -CPageDisplay::getMediabox () const > +CPageDisplay::getMediabox (bool absolute) const > { > kernelPrintDbg (debug::DBG_DBG, ""); > > CPageAttributes::InheritedAttributes atr; > - CPageAttributes::fillInherited (_page->getDictionary(),atr); > + boost::shared_ptr<CDict> dict = _page->getDictionary(); > + CPageAttributes::fillInherited (dict, atr); > libs::Rectangle rc; > > - rc.xleft = getDoubleFromArray (atr._mediaBox, 0); > - rc.yleft = getDoubleFromArray (atr._mediaBox, 1); > - rc.xright = getDoubleFromArray (atr._mediaBox, 2); > - rc.yright = getDoubleFromArray (atr._mediaBox, 3); > + int rotation = 0; > + if (!absolute) { > + try > + { > + shared_ptr<CInt> rotateProp = dict->getProperty<CInt>(Specification::Page::ROTATE); > + rotation = rotateProp->getValue(); > + }catch(...) > + { > + // nothing to do here as this means that we have 0 Rotation > + } > + > + } > + > + // TODO k*360 + standard rotation > + if (rotation == 0 ) { > + rc.xleft = getDoubleFromArray (atr._mediaBox, 0); > + rc.yleft = getDoubleFromArray (atr._mediaBox, 1); > + rc.xright = getDoubleFromArray (atr._mediaBox, 2); > + rc.yright = getDoubleFromArray (atr._mediaBox, 3); > + } else if (rotation == 90) { > + rc.xleft = getDoubleFromArray (atr._mediaBox,2); > + rc.yleft = getDoubleFromArray (atr._mediaBox,1); > + rc.xright = getDoubleFromArray (atr._mediaBox,0); > + rc.yright = getDoubleFromArray (atr._mediaBox,3); > + } else if (rotation == 180) { > + rc.xleft = getDoubleFromArray (atr._mediaBox,3); > + rc.yleft = getDoubleFromArray (atr._mediaBox,2); > + rc.xright = getDoubleFromArray (atr._mediaBox,1); > + rc.yright = getDoubleFromArray (atr._mediaBox,0); > + } else if (rotation == 270) { > + rc.xleft = getDoubleFromArray (atr._mediaBox,0); > + rc.yleft = getDoubleFromArray (atr._mediaBox,3); > + rc.xright = getDoubleFromArray (atr._mediaBox,2); > + rc.yright = getDoubleFromArray (atr._mediaBox,1); > + } > > return rc; > } > @@ -225,21 +257,67 @@ CPageDisplay::getPageRect () const > // > // > void > -CPageDisplay::setMediabox (const libs::Rectangle& rc) > +CPageDisplay::setMediabox (const libs::Rectangle& rc, bool absolute) > { > kernelPrintDbg (debug::DBG_DBG, " [" << rc << "]"); > > - CArray mb; > - CReal r (rc.xleft); > - mb.addProperty (r); > - r.setValue (rc.yleft); > - mb.addProperty (r); > - r.setValue (rc.xright); > - mb.addProperty (r); > - r.setValue (rc.yright); > - mb.addProperty (r); > > boost::shared_ptr<CDict> dict = _page->getDictionary(); > + int rotation = 0; > + if (!absolute) { > + try > + { > + shared_ptr<CInt> rotateProp = dict->getProperty<CInt>(Specification::Page::ROTATE); > + rotation = rotateProp->getValue(); > + }catch(...) > + { > + // nothing to do here as this means that we have 0 Rotation > + } > + > + } > + > + // TODO k*360 + standard rotation > + CArray mb; > + if (rotation == 0) { > + CReal r (rc.xleft); > + mb.addProperty (r); > + r.setValue (rc.yleft); > + mb.addProperty (r); > + r.setValue (rc.xright); > + mb.addProperty (r); > + r.setValue (rc.yright); > + mb.addProperty (r); > + } > + else if (rotation == 90) { > + CReal r (rc.xright); > + mb.addProperty (r); > + r.setValue (rc.yleft); > + mb.addProperty (r); > + r.setValue (rc.xleft); > + mb.addProperty (r); > + r.setValue (rc.yright); > + mb.addProperty (r); > + } > + else if (rotation == 180) { > + CReal r (rc.yright); > + mb.addProperty (r); > + r.setValue (rc.xright); > + mb.addProperty (r); > + r.setValue (rc.yleft); > + mb.addProperty (r); > + r.setValue (rc.xleft); > + mb.addProperty (r); > + } > + else if (rotation == 270) { > + CReal r (rc.xleft); > + mb.addProperty (r); > + r.setValue (rc.yright); > + mb.addProperty (r); > + r.setValue (rc.xright); > + mb.addProperty (r); > + r.setValue (rc.yleft); > + mb.addProperty (r); > + } > dict->setProperty (Specification::Page::MEDIABOX,mb); > > // We should sync all generally used Boxes (CropBox and TrimBox) > diff --git a/src/kernel/cpagedisplay.h b/src/kernel/cpagedisplay.h > index 739abc9..624b013 100644 > --- a/src/kernel/cpagedisplay.h > +++ b/src/kernel/cpagedisplay.h > @@ -81,22 +81,27 @@ public: > > /** > * Returns media box of this page. > + * @param absolute Flag for the absolute coordinates. > * > * It is a required item in page dictionary (spec p.119) but can be > * inherited from a parent in the page tree. > * > + * @see CPage::setMediabox > * @return Rectangle specifying the box. > */ > - libs::Rectangle getMediabox () const; > + libs::Rectangle getMediabox (bool absolute = true) const; > > /** > * Sets media box of this page. > * @param rc Rectangle for the media box. > + * @param absolute Flag for the absolute coordinates. > * > * As a side effect it changes also CropBox and TrimBox if they are > * set. > + * <br> > + * @see CPage::setMediabox > */ > - void setMediabox (const libs::Rectangle& rc); > + void setMediabox (const libs::Rectangle& rc, bool absolute = true); > > /** > * Returns rect of this page. > -- > 1.7.10.4 > > -- > Michal Hocko |
From: Michal H. <ms...@gm...> - 2012-10-22 14:03:54
|
On Mon, Oct 22, 2012 at 03:17:26PM +0200, Marek Zawirski wrote: > Hi, Hi, > I am attaching a quick fix patch for the wrong labels in Edit page > metric dialog. I hope I got it right. I was trying to fix the very same thing quite some time ago - didn't get to finish it though. The solution is not that easy. Because the corrdinations depends on the page rotation (maybe something more - sorry don't remember details). I will send what I have in my tree currently - it still needs some work. Thanks! -- Michal Hocko |
From: Michal H. <ms...@gm...> - 2012-10-22 13:53:57
|
>From 01f026b4fbb786549b2517497afc0336a818311b Mon Sep 17 00:00:00 2001 From: Michal Hocko <ms...@gm...> Date: Fri, 4 Nov 2011 11:27:36 +0100 Subject: [PATCH 2/2] kernel: distinguish {set,get}Mediabox relative and absolute coordinating systems Current implementation of CPageDisplay::{set,get} uses hardcoded absolute coordinating system (aka User space). This is correct but not ideal if a page has any transformation on top of it (e.g. rotation). Then you are seting the box before the rotation is actually applied so the result can be little bit surprising (or call it confusing). This patch adds a new parameter to both functions with the absolute coordinates as a default. If you use the false for it then it rotates the given (returned) rectangle so that the left bottom resp. right top are independent on the rotation. Fixes bt#367 --- src/gui/qspage.cc | 6 +-- src/kernel/cpage.cc | 8 ++-- src/kernel/cpage.h | 19 ++++++-- src/kernel/cpagedisplay.cc | 110 +++++++++++++++++++++++++++++++++++++------- src/kernel/cpagedisplay.h | 9 +++- 5 files changed, 124 insertions(+), 28 deletions(-) diff --git a/src/gui/qspage.cc b/src/gui/qspage.cc index 868426f..253269e 100644 --- a/src/gui/qspage.cc +++ b/src/gui/qspage.cc @@ -330,7 +330,7 @@ void QSPage::addAnnotation(QObject *an) { \see CPage::getMediabox */ QVariant QSPage::mediabox() { - libs::Rectangle r=obj->getMediabox(); + libs::Rectangle r=obj->getMediabox(false); Q_List<QVariant> rect; rect.append(r.xleft); rect.append(r.yleft); @@ -350,7 +350,7 @@ QVariant QSPage::mediabox() { void QSPage::setMediabox(double x1,double y1,double x2,double y2) { libs::Rectangle r(x1,y1,x2,y2); try { - obj->setMediabox(r); + obj->setMediabox(r, false); } catch (ReadOnlyDocumentException &e) { base->errorException("Page","setMediaBox",QObject::tr("Document is read-only")); } @@ -366,7 +366,7 @@ void QSPage::setMediabox(QRect rc) { //However, media box is often array of int, so this may not be a problem libs::Rectangle r(rc.left(),rc.top(),rc.right(),rc.bottom()); try { - obj->setMediabox(r); + obj->setMediabox(r, false); } catch (ReadOnlyDocumentException &e) { base->errorException("Page","setMediaBox",QObject::tr("Document is read-only")); } diff --git a/src/kernel/cpage.cc b/src/kernel/cpage.cc index 6777cc5..7e453f6 100644 --- a/src/kernel/cpage.cc +++ b/src/kernel/cpage.cc @@ -185,15 +185,15 @@ CPage::setRotation (int rot) // // libs::Rectangle -CPage::getMediabox () const +CPage::getMediabox (bool absolute) const { - return _display->getMediabox(); + return _display->getMediabox(absolute); } void -CPage::setMediabox (const libs::Rectangle& rc) +CPage::setMediabox (const libs::Rectangle& rc, bool absolute) { - _display->setMediabox (rc); + _display->setMediabox (rc, absolute); } // diff --git a/src/kernel/cpage.h b/src/kernel/cpage.h index 7ccee7f..a85cd9b 100644 --- a/src/kernel/cpage.h +++ b/src/kernel/cpage.h @@ -401,10 +401,23 @@ public: * * @return Rectangle specifying the box. */ - libs::Rectangle getMediabox () const; + libs::Rectangle getMediabox (bool absolute = true) const; - /** Seta media box of this page. */ - void setMediabox (const libs::Rectangle& rc); + /** Seta media box of this page. + * @param rc Rectangle for the box. + * @param absolute Flag whether the given rectangle should be treated as absolute (see below). + * + * Rectangle with the absolute coordinates (in PDF specification called + * User Space) is the one which defines device independent coordinates + * (with the fixed relationship to the page - e.g. no rotation applied + * - checkout "4.2.1 Coordinate Spaces" in the PDF specification). + * <br> + * Absolute flag can be, however, tricky if there is a rotation applied + * to the page ([0,0] point is not in the left, bottom corner but rather) + * rotated according to the selected rotation. absolute == false handles + * the page as you see it displayed. + */ + void setMediabox (const libs::Rectangle& rc, bool absolute = true); /** * Set transform matrix of a page. This operator will be preceding first cm diff --git a/src/kernel/cpagedisplay.cc b/src/kernel/cpagedisplay.cc index 1f9524d..2aa1512 100644 --- a/src/kernel/cpagedisplay.cc +++ b/src/kernel/cpagedisplay.cc @@ -199,18 +199,50 @@ CPageDisplay::setRotation (int rot) // // libs::Rectangle -CPageDisplay::getMediabox () const +CPageDisplay::getMediabox (bool absolute) const { kernelPrintDbg (debug::DBG_DBG, ""); CPageAttributes::InheritedAttributes atr; - CPageAttributes::fillInherited (_page->getDictionary(),atr); + boost::shared_ptr<CDict> dict = _page->getDictionary(); + CPageAttributes::fillInherited (dict, atr); libs::Rectangle rc; - rc.xleft = getDoubleFromArray (atr._mediaBox, 0); - rc.yleft = getDoubleFromArray (atr._mediaBox, 1); - rc.xright = getDoubleFromArray (atr._mediaBox, 2); - rc.yright = getDoubleFromArray (atr._mediaBox, 3); + int rotation = 0; + if (!absolute) { + try + { + shared_ptr<CInt> rotateProp = dict->getProperty<CInt>(Specification::Page::ROTATE); + rotation = rotateProp->getValue(); + }catch(...) + { + // nothing to do here as this means that we have 0 Rotation + } + + } + + // TODO k*360 + standard rotation + if (rotation == 0 ) { + rc.xleft = getDoubleFromArray (atr._mediaBox, 0); + rc.yleft = getDoubleFromArray (atr._mediaBox, 1); + rc.xright = getDoubleFromArray (atr._mediaBox, 2); + rc.yright = getDoubleFromArray (atr._mediaBox, 3); + } else if (rotation == 90) { + rc.xleft = getDoubleFromArray (atr._mediaBox,2); + rc.yleft = getDoubleFromArray (atr._mediaBox,1); + rc.xright = getDoubleFromArray (atr._mediaBox,0); + rc.yright = getDoubleFromArray (atr._mediaBox,3); + } else if (rotation == 180) { + rc.xleft = getDoubleFromArray (atr._mediaBox,3); + rc.yleft = getDoubleFromArray (atr._mediaBox,2); + rc.xright = getDoubleFromArray (atr._mediaBox,1); + rc.yright = getDoubleFromArray (atr._mediaBox,0); + } else if (rotation == 270) { + rc.xleft = getDoubleFromArray (atr._mediaBox,0); + rc.yleft = getDoubleFromArray (atr._mediaBox,3); + rc.xright = getDoubleFromArray (atr._mediaBox,2); + rc.yright = getDoubleFromArray (atr._mediaBox,1); + } return rc; } @@ -225,21 +257,67 @@ CPageDisplay::getPageRect () const // // void -CPageDisplay::setMediabox (const libs::Rectangle& rc) +CPageDisplay::setMediabox (const libs::Rectangle& rc, bool absolute) { kernelPrintDbg (debug::DBG_DBG, " [" << rc << "]"); - CArray mb; - CReal r (rc.xleft); - mb.addProperty (r); - r.setValue (rc.yleft); - mb.addProperty (r); - r.setValue (rc.xright); - mb.addProperty (r); - r.setValue (rc.yright); - mb.addProperty (r); boost::shared_ptr<CDict> dict = _page->getDictionary(); + int rotation = 0; + if (!absolute) { + try + { + shared_ptr<CInt> rotateProp = dict->getProperty<CInt>(Specification::Page::ROTATE); + rotation = rotateProp->getValue(); + }catch(...) + { + // nothing to do here as this means that we have 0 Rotation + } + + } + + // TODO k*360 + standard rotation + CArray mb; + if (rotation == 0) { + CReal r (rc.xleft); + mb.addProperty (r); + r.setValue (rc.yleft); + mb.addProperty (r); + r.setValue (rc.xright); + mb.addProperty (r); + r.setValue (rc.yright); + mb.addProperty (r); + } + else if (rotation == 90) { + CReal r (rc.xright); + mb.addProperty (r); + r.setValue (rc.yleft); + mb.addProperty (r); + r.setValue (rc.xleft); + mb.addProperty (r); + r.setValue (rc.yright); + mb.addProperty (r); + } + else if (rotation == 180) { + CReal r (rc.yright); + mb.addProperty (r); + r.setValue (rc.xright); + mb.addProperty (r); + r.setValue (rc.yleft); + mb.addProperty (r); + r.setValue (rc.xleft); + mb.addProperty (r); + } + else if (rotation == 270) { + CReal r (rc.xleft); + mb.addProperty (r); + r.setValue (rc.yright); + mb.addProperty (r); + r.setValue (rc.xright); + mb.addProperty (r); + r.setValue (rc.yleft); + mb.addProperty (r); + } dict->setProperty (Specification::Page::MEDIABOX,mb); // We should sync all generally used Boxes (CropBox and TrimBox) diff --git a/src/kernel/cpagedisplay.h b/src/kernel/cpagedisplay.h index 739abc9..624b013 100644 --- a/src/kernel/cpagedisplay.h +++ b/src/kernel/cpagedisplay.h @@ -81,22 +81,27 @@ public: /** * Returns media box of this page. + * @param absolute Flag for the absolute coordinates. * * It is a required item in page dictionary (spec p.119) but can be * inherited from a parent in the page tree. * + * @see CPage::setMediabox * @return Rectangle specifying the box. */ - libs::Rectangle getMediabox () const; + libs::Rectangle getMediabox (bool absolute = true) const; /** * Sets media box of this page. * @param rc Rectangle for the media box. + * @param absolute Flag for the absolute coordinates. * * As a side effect it changes also CropBox and TrimBox if they are * set. + * <br> + * @see CPage::setMediabox */ - void setMediabox (const libs::Rectangle& rc); + void setMediabox (const libs::Rectangle& rc, bool absolute = true); /** * Returns rect of this page. -- 1.7.10.4 -- Michal Hocko |
From: Michal H. <ms...@gm...> - 2012-10-22 13:53:50
|
>From a7611f3e6957388b08cb09c23288a51303d8dd30 Mon Sep 17 00:00:00 2001 From: Michal Hocko <ms...@gm...> Date: Fri, 4 Nov 2011 11:26:25 +0100 Subject: [PATCH 1/2] gui: Edit page metrics coordinates fix Roger Burrows has reported that "Edit page metrics" labels expect that the coordinate system is based on the left top corner which doesn't seem to be the case for his documents (as well as my randomly picked up ones) where the base seems to be at left bottom corner. In this case we have to change the labels --- src/gui/dialogs.qs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/dialogs.qs b/src/gui/dialogs.qs index fb39080..93f3d46 100644 --- a/src/gui/dialogs.qs +++ b/src/gui/dialogs.qs @@ -64,13 +64,13 @@ function editPageMediaBox() { var dialog = createDialog (tr("Change page rectangle"), tr("Change"), tr("Cancel"), tr("Page metrics")); var gb = createGroupBoxAndDisplay (tr("Page metrics"), dialog); - var exl = createNumberEditAndDisplay(tr("Left upper corner")+", "+tr("x position")+"( "+PageSpace.getDefaultUnits()+" ): ", + var exl = createNumberEditAndDisplay(tr("Left bottom corner")+", "+tr("x position")+"( "+PageSpace.getDefaultUnits()+" ): ", PageSpace.convertUnits(xleft,"pt"), gb); - var eyl = createNumberEditAndDisplay(tr("Left upper corner")+", "+tr("y position")+"( "+PageSpace.getDefaultUnits()+" ): ", + var eyl = createNumberEditAndDisplay(tr("Left bottom corner")+", "+tr("y position")+"( "+PageSpace.getDefaultUnits()+" ): ", PageSpace.convertUnits(yleft,"pt"), gb); - var exr = createNumberEditAndDisplay(tr("Right bottom corner")+", "+tr("x position")+"( "+PageSpace.getDefaultUnits()+" ): ", + var exr = createNumberEditAndDisplay(tr("Right upper corner")+", "+tr("x position")+"( "+PageSpace.getDefaultUnits()+" ): ", PageSpace.convertUnits(xright,"pt"), gb); - var eyr = createNumberEditAndDisplay(tr("Right bottom corner")+", "+tr("y position")+"( "+PageSpace.getDefaultUnits()+" ): ", + var eyr = createNumberEditAndDisplay(tr("Right upper corner")+", "+tr("y position")+"( "+PageSpace.getDefaultUnits()+" ): ", PageSpace.convertUnits(yright,"pt"), gb); var pagePos = createNumberEditAndDisplay(tr("Apply from page"), document.getPagePosition(page()), dialog); var pageCount = createNumberEditAndDisplay(tr("How many pages"), 1, dialog); -- 1.7.10.4 -- Michal Hocko |
From: Marek Z. <mar...@gm...> - 2012-10-22 13:17:37
|
Hi, I am attaching a quick fix patch for the wrong labels in Edit page metric dialog. I hope I got it right. Cheers, Marek Zawirski |
From: Swizzla K. <opt...@gm...> - 2012-10-04 18:02:42
|
Dear Devs, I first want to say thank you for your hard work in making pdfEdit so usable and for choosing the open source way. In the spirit of open-source I would like to give back to the community by doing some work on pdfedit. My main gripe with pdfedit is that it is difficult to edit text. I want to see how i can tweak the GUI to make it easier. Can you kindly fill me in on how to get started with this task? Later on I'd like to modernize the rest of the GUI as time permits. I may need a lot of guidance for this as I am pretty much a neophyte when it comes to developing on Linux. I spent some time programming in XNA C# and C (procedural C) and am used to visual studio. I also used mono-develop for a while on Ubuntu. If you can show me how i can fit into your work-flow that would be great. Sincere Thanks, Swizzla |
From: Jozef M. <mis...@ho...> - 2012-02-10 00:36:41
|
Dne 1/31/2012 11:41 AM, Michal Hocko napsal(a): > Hi, > this is another one that needs a bit of clarification. I am not familiar > with state updaters enough to see what this actually fixes/enhances. > Any further description would be appreciated. I just merged it because it did not to break my code. jm > --- > > From 5ec13261832a2244872ed8bedf847b1697ff138c Mon Sep 17 00:00:00 2001 > From: =?UTF-8?q?Eva=20Pe=C5=A1kov=C3=A1?=<car...@gm...> > Date: Tue, 31 Jan 2012 11:26:14 +0100 > Subject: [PATCH] kernel: Update operator position during printTextUpdate > > if it is provided as a parameter. > > [mis...@ho...: make the parameter optional] > > TODO: What does this fix? > --- > src/kernel/stateupdater.cc | 19 ++++++++++++++----- > src/kernel/stateupdater.h | 2 +- > 2 files changed, 15 insertions(+), 6 deletions(-) > > diff --git a/src/kernel/stateupdater.cc b/src/kernel/stateupdater.cc > index 656b434..0d1c3de 100644 > --- a/src/kernel/stateupdater.cc > +++ b/src/kernel/stateupdater.cc > @@ -442,12 +442,15 @@ namespace { > // This can happen in really damaged pdfs > if (state->getFont()) { > TextSimpleOperator *txtOp = dynamic_cast<TextSimpleOperator*>(op.get()); > + txtOp->clearPositions(); > assert(txtOp); > // TODO - can we use const GfxFont *? > txtOp->setFontData((GfxFont *)state->getFont()); > + txtOp->setTransformationMatrix(state->getCTM()); > + txtOp->concatTransformationMatrix(state->getTextMat()); > std::string rawStr; > txtOp->getRawText(rawStr); > - StateUpdater::printTextUpdate (state, rawStr, rc); > + StateUpdater::printTextUpdate (state, rawStr, rc,txtOp); > } > > // return changed state > @@ -508,12 +511,13 @@ namespace { > > > TextSimpleOperator *txtOp = dynamic_cast<TextSimpleOperator*>(op.get()); > + txtOp->clearPositions(); > assert(txtOp); > // TODO can we use const GfxFont *? > txtOp->setFontData((GfxFont *)state->getFont()); > std::string rawStr; > txtOp->getRawText(rawStr); > - StateUpdater::printTextUpdate (state, rawStr, rc); > + StateUpdater::printTextUpdate (state, rawStr, rc,txtOp); > > // Set edge of rectangle from actual position on output devices > //state->transform(state->getCurX (), state->getCurY(),& rc->xright,& rc->yright); > @@ -572,9 +576,10 @@ namespace { > > break; > case pString: > - StateUpdater::printTextUpdate (state, getStringFromIProperty (item),& h_rc); > + { > + StateUpdater::printTextUpdate (state, getStringFromIProperty (item),& h_rc,txtOp); > break; > - > + } > default: > assert (!"opTJUpdate: Bad object type."); > throw ElementBadTypeException ("opTJUpdate: Bad object type."); > @@ -758,7 +763,7 @@ namespace { > // Actual state (position) updaters > // > GfxState* > -StateUpdater::printTextUpdate (GfxState* state, const std::string& txt, BBox* rc) > +StateUpdater::printTextUpdate (GfxState* state, const std::string& txt, BBox* rc, PdfOperator* oper) > { > const GfxFont *font; > int wMode; > @@ -950,6 +955,10 @@ StateUpdater::printTextUpdate (GfxState* state, const std::string& txt, BBox* rc > originY *= state->getFontSize(); > state->textTransformDelta(originX, originY,&tOriginX,&tOriginY); > state->shift(tdx, tdy); > + if ( oper ) { > + TextSimpleOperator *txtOp = dynamic_cast<TextSimpleOperator*>(oper); > + txtOp->savePosition(tdx,tdy); > + } > p += n; > len -= n; > } > diff --git a/src/kernel/stateupdater.h b/src/kernel/stateupdater.h > index 6f2235a..a711e48 100644 > --- a/src/kernel/stateupdater.h > +++ b/src/kernel/stateupdater.h > @@ -211,7 +211,7 @@ public: > // Helper functions > // > public: > - static GfxState* printTextUpdate (GfxState* state, const std::string& txt, BBox* rc); > + static GfxState* printTextUpdate (GfxState* state, const std::string& txt, BBox* rc, PdfOperator* op=NULL); > > }; > |
From: Jozef M. <mis...@ho...> - 2012-02-10 00:33:44
|
fixed http://pdfedit.petricek.net/bt/view.php?id=374 on gui-jm, released windows version jm Dne 2/10/2012 1:20 AM, Jozef Misutka napsal(a): > The branch, gui-jm has been updated > via 70c6f2fbc437a15432ae886cc85f9abc94f074f0 (commit) > from 9497f5687cb7d7417425d44afc1ce43ce2268091 (commit) > > Those revisions listed above that are new to this repository have > not appeared on any other notification email; so we list those > revisions in full, below. > > - Log ----------------------------------------------------------------- > commit 70c6f2fbc437a15432ae886cc85f9abc94f074f0 > Author: jm<mis...@ho...> > Date: Fri Feb 10 01:18:48 2012 +0100 > > http://pdfedit.petricek.net/bt/view.php?id=374, added newest xpdf 'fix', affected all previous versions of pdfedit > > ----------------------------------------------------------------------- > > Summary of changes: > src/gui/TabPage.cpp | 1 - > src/gui/aboutDialog.ui | 10 +++++++--- > src/gui/debug.h | 3 +-- > src/gui/openpdf.cpp | 10 +++------- > src/xpdf/xpdf/SplashOutputDev.cc | 29 +++++++++++++++++++---------- > 5 files changed, 30 insertions(+), 23 deletions(-) > > > hooks/post-receive |
From: Michal H. <ms...@gm...> - 2012-01-31 10:41:13
|
Hi, this is another one that needs a bit of clarification. I am not familiar with state updaters enough to see what this actually fixes/enhances. Any further description would be appreciated. --- >From 5ec13261832a2244872ed8bedf847b1697ff138c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eva=20Pe=C5=A1kov=C3=A1?= <car...@gm...> Date: Tue, 31 Jan 2012 11:26:14 +0100 Subject: [PATCH] kernel: Update operator position during printTextUpdate if it is provided as a parameter. [mis...@ho...: make the parameter optional] TODO: What does this fix? --- src/kernel/stateupdater.cc | 19 ++++++++++++++----- src/kernel/stateupdater.h | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/kernel/stateupdater.cc b/src/kernel/stateupdater.cc index 656b434..0d1c3de 100644 --- a/src/kernel/stateupdater.cc +++ b/src/kernel/stateupdater.cc @@ -442,12 +442,15 @@ namespace { // This can happen in really damaged pdfs if (state->getFont()) { TextSimpleOperator *txtOp = dynamic_cast<TextSimpleOperator*>(op.get()); + txtOp->clearPositions(); assert(txtOp); // TODO - can we use const GfxFont *? txtOp->setFontData((GfxFont *)state->getFont()); + txtOp->setTransformationMatrix(state->getCTM()); + txtOp->concatTransformationMatrix(state->getTextMat()); std::string rawStr; txtOp->getRawText(rawStr); - StateUpdater::printTextUpdate (state, rawStr, rc); + StateUpdater::printTextUpdate (state, rawStr, rc,txtOp); } // return changed state @@ -508,12 +511,13 @@ namespace { TextSimpleOperator *txtOp = dynamic_cast<TextSimpleOperator*>(op.get()); + txtOp->clearPositions(); assert(txtOp); // TODO can we use const GfxFont *? txtOp->setFontData((GfxFont *)state->getFont()); std::string rawStr; txtOp->getRawText(rawStr); - StateUpdater::printTextUpdate (state, rawStr, rc); + StateUpdater::printTextUpdate (state, rawStr, rc,txtOp); // Set edge of rectangle from actual position on output devices //state->transform(state->getCurX (), state->getCurY(), & rc->xright, & rc->yright); @@ -572,9 +576,10 @@ namespace { break; case pString: - StateUpdater::printTextUpdate (state, getStringFromIProperty (item), & h_rc); + { + StateUpdater::printTextUpdate (state, getStringFromIProperty (item), & h_rc,txtOp); break; - + } default: assert (!"opTJUpdate: Bad object type."); throw ElementBadTypeException ("opTJUpdate: Bad object type."); @@ -758,7 +763,7 @@ namespace { // Actual state (position) updaters // GfxState* -StateUpdater::printTextUpdate (GfxState* state, const std::string& txt, BBox* rc) +StateUpdater::printTextUpdate (GfxState* state, const std::string& txt, BBox* rc, PdfOperator* oper) { const GfxFont *font; int wMode; @@ -950,6 +955,10 @@ StateUpdater::printTextUpdate (GfxState* state, const std::string& txt, BBox* rc originY *= state->getFontSize(); state->textTransformDelta(originX, originY, &tOriginX, &tOriginY); state->shift(tdx, tdy); + if ( oper ) { + TextSimpleOperator *txtOp = dynamic_cast<TextSimpleOperator*>(oper); + txtOp->savePosition(tdx,tdy); + } p += n; len -= n; } diff --git a/src/kernel/stateupdater.h b/src/kernel/stateupdater.h index 6f2235a..a711e48 100644 --- a/src/kernel/stateupdater.h +++ b/src/kernel/stateupdater.h @@ -211,7 +211,7 @@ public: // Helper functions // public: - static GfxState* printTextUpdate (GfxState* state, const std::string& txt, BBox* rc); + static GfxState* printTextUpdate (GfxState* state, const std::string& txt, BBox* rc, PdfOperator* op=NULL); }; -- 1.7.8.3 -- Michal Hocko |
From: Michal H. <ms...@gm...> - 2012-01-31 09:43:47
|
On Tue, Jan 31, 2012 at 10:18:52AM +0100, Jozef Misutka wrote: > Dne 1/29/2012 10:12 PM, Michal Hocko napsal(a): > >On Wed, Jan 25, 2012 at 06:28:17PM +0100, Michal Hocko wrote: > >[...] > >>diff --git a/src/xpdf/xpdf/Gfx.cc b/src/xpdf/xpdf/Gfx.cc > >>index fe1c465..1a29de4 100644 > >>--- a/src/xpdf/xpdf/Gfx.cc > >>+++ b/src/xpdf/xpdf/Gfx.cc > >[...] > >>@@ -2127,7 +2125,7 @@ void Gfx::doAxialShFill(GfxAxialShading *shading) { > >> double t0, t1, tt; > >> double ta[axialMaxSplits + 1]; > >> int next[axialMaxSplits + 1]; > >>- GfxColor color0, color1; > >>+ GfxColor color0 = {}, color1 = {}; > >> int nComps; > >> int i, j, k, kk; > >> > >>What happens if we really do not initialize them? Isn't this just > >>papering over a real problem? > >OK, I have double checked the change and I think we can never end up > >using those two uninitialized. Unless I missed something the following > >patch should be applied to gui-staging. > >--- > >> From 22a549d4db5e1ed6b51db1d985e46f60e30c8b73 Mon Sep 17 00:00:00 2001 > >From: Michal Hocko<ms...@gm...> > >Date: Sun, 29 Jan 2012 22:04:54 +0100 > >Subject: [PATCH - for gui-staging] xpdf: revert uninitialized warning fix > > > >It has been observed that some compilers warn about Gfx::doAxialShFill > >not initializing color0 and color1. After a code inspection it turned > >out that they will never be used uninitialized because > >GfxShading::getColor always set the given color parameter. > >color0 is initialized unconditionally and color1 might end up > >uninitialized only if we skipped while (j> i + 1) loop which is not > >possible because j = next[0] = axialMaxSplits / 2 (which is 128). > > > >Let's revert the fix to be closer to the master branch. > > I totally disagree - maybe you've inspected the code manually and > found it to be correct (maybe you've just made a mistake); and maybe my compiler did the same mistake (no warning with -Wall or with explicit -Wuninitialized). Hey common. Either prove it wrong or stop this kind "let's shut up the compiler and paper over real bugs". > however, > - there are people out there who compile pdfedit and those warnings > can cost them their time, > - it is unproffesional, Papering over real bugs by blind initialization is unproffesional. Have you checked what would happen if you just intialize those values? I have! And you would just get random values same as with unitialized ones (the only difference is that if you initialize you will get more constant crap.) > - we are lost in warnings so we should minimise them to catch only > the important ones, We have thousands of warnings that come from char * -> const char * conversion. No change in that... > - somebody will change a function later and will rely on the fact > that it is initialized and we are in big trouble, It would have to change the initialization as well, don't you think? Otherwise it would be consistently buggy. > > (btw: this is exactly why gui-jm was created) Sorry but this is just bull crap. I haven't pushed anything to pdfedit-staging yet. This has been posted for review and you haven't pointed _any_ single technical argument. Please go and look into the code. I am not saying I didn't make a mistake and I am open to push the initialization fix if you back it by a technical argument. > jm > > >--- > > src/xpdf/xpdf/Gfx.cc | 2 +- > > 1 files changed, 1 insertions(+), 1 deletions(-) > > > >diff --git a/src/xpdf/xpdf/Gfx.cc b/src/xpdf/xpdf/Gfx.cc > >index a64454b..e1b073d 100644 > >--- a/src/xpdf/xpdf/Gfx.cc > >+++ b/src/xpdf/xpdf/Gfx.cc > >@@ -2127,7 +2127,7 @@ void Gfx::doAxialShFill(GfxAxialShading *shading) { > > double t0, t1, tt; > > double ta[axialMaxSplits + 1]; > > int next[axialMaxSplits + 1]; > >- GfxColor color0 = {}, color1 = {}; > >+ GfxColor color0, color1; > > int nComps; > > int i, j, k, kk; > > -- Michal Hocko |
From: Jozef M. <mis...@ho...> - 2012-01-31 09:19:01
|
Dne 1/29/2012 10:12 PM, Michal Hocko napsal(a): > On Wed, Jan 25, 2012 at 06:28:17PM +0100, Michal Hocko wrote: > [...] >> diff --git a/src/xpdf/xpdf/Gfx.cc b/src/xpdf/xpdf/Gfx.cc >> index fe1c465..1a29de4 100644 >> --- a/src/xpdf/xpdf/Gfx.cc >> +++ b/src/xpdf/xpdf/Gfx.cc > [...] >> @@ -2127,7 +2125,7 @@ void Gfx::doAxialShFill(GfxAxialShading *shading) { >> double t0, t1, tt; >> double ta[axialMaxSplits + 1]; >> int next[axialMaxSplits + 1]; >> - GfxColor color0, color1; >> + GfxColor color0 = {}, color1 = {}; >> int nComps; >> int i, j, k, kk; >> >> What happens if we really do not initialize them? Isn't this just >> papering over a real problem? > OK, I have double checked the change and I think we can never end up > using those two uninitialized. Unless I missed something the following > patch should be applied to gui-staging. > --- > > From 22a549d4db5e1ed6b51db1d985e46f60e30c8b73 Mon Sep 17 00:00:00 2001 > From: Michal Hocko<ms...@gm...> > Date: Sun, 29 Jan 2012 22:04:54 +0100 > Subject: [PATCH - for gui-staging] xpdf: revert uninitialized warning fix > > It has been observed that some compilers warn about Gfx::doAxialShFill > not initializing color0 and color1. After a code inspection it turned > out that they will never be used uninitialized because > GfxShading::getColor always set the given color parameter. > color0 is initialized unconditionally and color1 might end up > uninitialized only if we skipped while (j> i + 1) loop which is not > possible because j = next[0] = axialMaxSplits / 2 (which is 128). > > Let's revert the fix to be closer to the master branch. I totally disagree - maybe you've inspected the code manually and found it to be correct (maybe you've just made a mistake); however, - there are people out there who compile pdfedit and those warnings can cost them their time, - it is unproffesional, - we are lost in warnings so we should minimise them to catch only the important ones, - somebody will change a function later and will rely on the fact that it is initialized and we are in big trouble, (btw: this is exactly why gui-jm was created) jm > --- > src/xpdf/xpdf/Gfx.cc | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/src/xpdf/xpdf/Gfx.cc b/src/xpdf/xpdf/Gfx.cc > index a64454b..e1b073d 100644 > --- a/src/xpdf/xpdf/Gfx.cc > +++ b/src/xpdf/xpdf/Gfx.cc > @@ -2127,7 +2127,7 @@ void Gfx::doAxialShFill(GfxAxialShading *shading) { > double t0, t1, tt; > double ta[axialMaxSplits + 1]; > int next[axialMaxSplits + 1]; > - GfxColor color0 = {}, color1 = {}; > + GfxColor color0, color1; > int nComps; > int i, j, k, kk; > |
From: Michal H. <ms...@gm...> - 2012-01-29 21:12:47
|
On Wed, Jan 25, 2012 at 06:28:17PM +0100, Michal Hocko wrote: [...] > diff --git a/src/xpdf/xpdf/Gfx.cc b/src/xpdf/xpdf/Gfx.cc > index fe1c465..1a29de4 100644 > --- a/src/xpdf/xpdf/Gfx.cc > +++ b/src/xpdf/xpdf/Gfx.cc [...] > @@ -2127,7 +2125,7 @@ void Gfx::doAxialShFill(GfxAxialShading *shading) { > double t0, t1, tt; > double ta[axialMaxSplits + 1]; > int next[axialMaxSplits + 1]; > - GfxColor color0, color1; > + GfxColor color0 = {}, color1 = {}; > int nComps; > int i, j, k, kk; > > What happens if we really do not initialize them? Isn't this just > papering over a real problem? OK, I have double checked the change and I think we can never end up using those two uninitialized. Unless I missed something the following patch should be applied to gui-staging. --- >From 22a549d4db5e1ed6b51db1d985e46f60e30c8b73 Mon Sep 17 00:00:00 2001 From: Michal Hocko <ms...@gm...> Date: Sun, 29 Jan 2012 22:04:54 +0100 Subject: [PATCH - for gui-staging] xpdf: revert uninitialized warning fix It has been observed that some compilers warn about Gfx::doAxialShFill not initializing color0 and color1. After a code inspection it turned out that they will never be used uninitialized because GfxShading::getColor always set the given color parameter. color0 is initialized unconditionally and color1 might end up uninitialized only if we skipped while (j > i + 1) loop which is not possible because j = next[0] = axialMaxSplits / 2 (which is 128). Let's revert the fix to be closer to the master branch. --- src/xpdf/xpdf/Gfx.cc | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/xpdf/xpdf/Gfx.cc b/src/xpdf/xpdf/Gfx.cc index a64454b..e1b073d 100644 --- a/src/xpdf/xpdf/Gfx.cc +++ b/src/xpdf/xpdf/Gfx.cc @@ -2127,7 +2127,7 @@ void Gfx::doAxialShFill(GfxAxialShading *shading) { double t0, t1, tt; double ta[axialMaxSplits + 1]; int next[axialMaxSplits + 1]; - GfxColor color0 = {}, color1 = {}; + GfxColor color0, color1; int nComps; int i, j, k, kk; -- 1.7.8.3 -- Michal Hocko |
From: Michal H. <ms...@gm...> - 2012-01-29 20:41:57
|
On Wed, Jan 25, 2012 at 06:28:17PM +0100, Michal Hocko wrote: > Hi, > I have looked at the xpdf changes introduced by pdfeditor project > (http://code.google.com/p/pdfeditor/). > > I would like to clarify some of them before mergin: > [...] > diff --git a/src/xpdf/xpdf/Gfx.cc b/src/xpdf/xpdf/Gfx.cc > index fe1c465..1a29de4 100644 > --- a/src/xpdf/xpdf/Gfx.cc > +++ b/src/xpdf/xpdf/Gfx.cc > @@ -703,10 +703,8 @@ void Gfx::execOp(const Object *cmd, Object args[], int numArgs) { > } > > Operator *Gfx::findOp(const char *name) { > - int a, b, m, cmp; > + int a = -1, b = numOps, m = 0, cmp = 0; > > - a = -1; > - b = numOps; I have double checked this one. The full function looks as follows int a, b, m, cmp; a = -1; b = numOps; // invariant: opTab[a] < name < opTab[b] while (b - a > 1) { m = (a + b) / 2; cmp = strcmp(opTab[m].name, name); if (cmp < 0) a = m; else if (cmp > 0) b = m; else a = b = m; } if (cmp != 0) return NULL; return &opTab[a]; gcc doesn't seem to complain even with -Wall. Anyway, the only issue seems to be that cmp might be used uninitialized if numOps <= 0 but this can never happen because it is defined as sizeof(opTab) / sizeof(Operator). So I would be for reverting this change: --- >From 53f1b1a3d6165dfd63f77937adc7910f3e6f458d Mon Sep 17 00:00:00 2001 From: Michal Hocko <ms...@gm...> Date: Sun, 29 Jan 2012 21:38:09 +0100 Subject: [PATCH] xpdf: revert used by unitialized warning We do not have to initialize m and cmp variables because they can never be used uninitialized because numOps would have to be <= 0 which is not possible as it is defined as sizeof(opTab) / sizeof(Operator). So revert the original fix so that we are closer with the master branch. --- src/xpdf/xpdf/Gfx.cc | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/xpdf/xpdf/Gfx.cc b/src/xpdf/xpdf/Gfx.cc index 1a29de4..a64454b 100644 --- a/src/xpdf/xpdf/Gfx.cc +++ b/src/xpdf/xpdf/Gfx.cc @@ -703,8 +703,10 @@ void Gfx::execOp(const Object *cmd, Object args[], int numArgs) { } Operator *Gfx::findOp(const char *name) { - int a = -1, b = numOps, m = 0, cmp = 0; + int a, b, m, cmp; + a = -1; + b = numOps; // invariant: opTab[a] < name < opTab[b] while (b - a > 1) { m = (a + b) / 2; -- 1.7.8.3 -- Michal Hocko |
From: Michal H. <ms...@gm...> - 2012-01-29 20:18:05
|
I have looked at SplashOutputDev::getFontById introduced by Pdfeditor and to be honest I didn't get the point of the function. It is quite hackish because we are allocating an artificial id just to use it as an argument. I know xpdf object hierarchy doesn't allow better implementation without much more code changes. The part I am not getting is why do we _need_ it at all when we can use getFont name with a name argument instead (fallback in the current implementation). So here is a RFC patch which removes the function and updates the gui to use only the fallback method. Let me know if I am missing something important and the function should stay. --- >From 7c96209bc3e0d430c6e2dc4301a2e5e3bc1bf5e1 Mon Sep 17 00:00:00 2001 From: Michal Hocko <ms...@gm...> Date: Sun, 29 Jan 2012 21:10:28 +0100 Subject: [RFC PATCH for gui-staging] Remove getFontById The functionality is not necessary as we still might use getFont with font->getName parameter so rather use that than adding a new code. --- src/gui/TabPage.cpp | 4 +--- src/xpdf/xpdf/SplashOutputDev.cc | 12 ------------ src/xpdf/xpdf/SplashOutputDev.h | 2 -- 3 files changed, 1 insertions(+), 17 deletions(-) diff --git a/src/gui/TabPage.cpp b/src/gui/TabPage.cpp index d2b9423..17d0805 100644 --- a/src/gui/TabPage.cpp +++ b/src/gui/TabPage.cpp @@ -2938,9 +2938,7 @@ GlyphInfo TabPage::checkCode( QString s, std::string fontName ) Unicode u = s[i].unicode(); char c = font->getCodeFromUnicode(&u,1); double temp[] = {1,0,0,1,0,0}; - SplashFont * fnt = splash.getFontById(font); - if (!fnt) - fnt = splash.getFont(font->getName(),temp); + SplashFont * fnt = splash.getFont(font->getName(),temp); SplashGlyphBitmap tBitmap; assert(fnt); fnt->getGlyph(c,0,0,&tBitmap); diff --git a/src/xpdf/xpdf/SplashOutputDev.cc b/src/xpdf/xpdf/SplashOutputDev.cc index b7fea5c..5c61a01 100644 --- a/src/xpdf/xpdf/SplashOutputDev.cc +++ b/src/xpdf/xpdf/SplashOutputDev.cc @@ -959,18 +959,6 @@ void SplashOutputDev::updateStrokeOpacity(GfxState *state) { void SplashOutputDev::updateFont(GfxState *state) { needFontUpdate = gTrue; } -SplashFont * SplashOutputDev::getFontById(GfxFont * gfxFont) -{ - SplashOutFontFileID *id; - id = new SplashOutFontFileID(gfxFont->getID()); - SplashFontFile *fontFile = fontEngine->getFontFile(id); - delete id; - if (!fontFile ) - return NULL; - SplashCoord coord[] = {1,0,0,1,0,0}; - SplashFont * fnt = fontEngine->getFont(fontFile,coord,coord); - return fnt; -} void SplashOutputDev::doUpdateFont(GfxState *state) { const GfxFont *gfxFont; GfxFontType fontType; diff --git a/src/xpdf/xpdf/SplashOutputDev.h b/src/xpdf/xpdf/SplashOutputDev.h index ad5c037..04ee167 100644 --- a/src/xpdf/xpdf/SplashOutputDev.h +++ b/src/xpdf/xpdf/SplashOutputDev.h @@ -78,8 +78,6 @@ public: //----- save/restore graphics state virtual void saveState(GfxState *state); virtual void restoreState(GfxState *state); - - SplashFont * getFontById(GfxFont * gfxFont); //----- update graphics state virtual void updateAll(GfxState *state); virtual void updateCTM(GfxState *state, double m11, double m12, -- 1.7.8.3 -- Michal Hocko |
From: Jozef M. <mis...@ho...> - 2012-01-27 09:03:45
|
Dne 1/27/2012 9:50 AM, Michal Hocko napsal(a): > On Fri, Jan 27, 2012 at 09:06:20AM +0100, Jozef Misutka wrote: >> Dne 1/26/2012 10:59 PM, Michal Hocko napsal(a): >>> On Thu, Jan 26, 2012 at 09:27:11PM +0100, Jozef Misutka wrote: >>> [...] >>>>>>> @@ -496,19 +496,19 @@ static bool isUnicodeSame(const Unicode *u1, int size1, const Unicode *u2, int s >>>>>>> } >>>>>>> >>>>>>> CharCode CharCodeToUnicode::mapFromUnicode(const Unicode *u, int size)const { >>>>>>> - int i; >>>>>>> + unsigned int i; >>>>>>> if (size == 1) { >>>>>>> for (i = 0; i< mapLen; ++i) >>>>>>> if (map[i] == *u) >>>>>>> return i; >>>>>>> } >>>>>>> - for (i = 0; i< sMapLen; ++i) { >>>>>>> + for (i = 0; i< (unsigned int)sMapLen; ++i) { >>>>>>> if (isUnicodeSame(u, size, sMap[i].u, sMap[i].len)) >>>>>>> return sMap[i].c; >>>>>>> } >>>>>>> >>>>>>> If the sMapLen is negative for some readon we would loop for quite >>>>>>> some time ;) So this cannot be right. What is the reason for the >>>>>>> change? Compiler warning fix? >>>>>> afaict, length(size) is always>= 0 >>>>> So what is the purpose of the change? >>>> compiler warning . >>> Could you be more specific? both sMapLen and i are ints... >> CharCode mapLen; CharCode is unsinged >> two lines below i definition there is a comparison > Bahhh, yes, you are right of course (I missed the different name). -Wall > is not on by default so I there was no warning with my builds. > Thanks! > Anyway I guess the following fix should be simpler and safer: > --- > > From f499a4cba1315dd0dacecaee93126e0d74cff82f Mon Sep 17 00:00:00 2001 > From: Michal Hocko<ms...@gm...> > Date: Fri, 27 Jan 2012 09:42:42 +0100 > Subject: [PATCH] xpdf: fix compiler warning > MIME-Version: 1.0 > Content-Type: text/plain; charset=UTF-8 > Content-Transfer-Encoding: 8bit > > mapLen unlike sMapLen is unsigned. I guess this is bogus as mapLen > should never be bigger than INT_MAX but it might be initialized from > external so rather make sure we are on the safe side. > > Fixes: > CharCodeToUnicode.cc: In member function ‘CharCode > CharCodeToUnicode::mapFromUnicode(const Unicode*, int) const’: > CharCodeToUnicode.cc:501:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] > --- > src/xpdf/xpdf/CharCodeToUnicode.cc | 6 +++--- > 1 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/src/xpdf/xpdf/CharCodeToUnicode.cc b/src/xpdf/xpdf/CharCodeToUnicode.cc > index 71465f0..786f3df 100644 > --- a/src/xpdf/xpdf/CharCodeToUnicode.cc > +++ b/src/xpdf/xpdf/CharCodeToUnicode.cc > @@ -498,9 +498,9 @@ static bool isUnicodeSame(const Unicode *u1, int size1, const Unicode *u2, int s > CharCode CharCodeToUnicode::mapFromUnicode(const Unicode *u, int size)const { > int i; > if (size == 1) { > - for (i = 0; i< mapLen; ++i) > - if (map[i] == *u) > - return i; > + for (CharCode j = 0; j< mapLen; ++j) > + if (map[j] == *u) > + return j; > } > for (i = 0; i< sMapLen; ++i) { > if (isUnicodeSame(u, size, sMap[i].u, sMap[i].len)) indeed. |
From: Jozef M. <mis...@ho...> - 2012-01-27 09:02:35
|
Dne 1/27/2012 9:50 AM, Michal Hocko napsal(a): > On Fri, Jan 27, 2012 at 09:06:20AM +0100, Jozef Misutka wrote: >> Dne 1/26/2012 10:59 PM, Michal Hocko napsal(a): >>> On Thu, Jan 26, 2012 at 09:27:11PM +0100, Jozef Misutka wrote: >>> [...] >>>>>>> @@ -496,19 +496,19 @@ static bool isUnicodeSame(const Unicode *u1, int size1, const Unicode *u2, int s >>>>>>> } >>>>>>> >>>>>>> CharCode CharCodeToUnicode::mapFromUnicode(const Unicode *u, int size)const { >>>>>>> - int i; >>>>>>> + unsigned int i; >>>>>>> if (size == 1) { >>>>>>> for (i = 0; i< mapLen; ++i) >>>>>>> if (map[i] == *u) >>>>>>> return i; >>>>>>> } >>>>>>> - for (i = 0; i< sMapLen; ++i) { >>>>>>> + for (i = 0; i< (unsigned int)sMapLen; ++i) { >>>>>>> if (isUnicodeSame(u, size, sMap[i].u, sMap[i].len)) >>>>>>> return sMap[i].c; >>>>>>> } >>>>>>> >>>>>>> If the sMapLen is negative for some readon we would loop for quite >>>>>>> some time ;) So this cannot be right. What is the reason for the >>>>>>> change? Compiler warning fix? >>>>>> afaict, length(size) is always>= 0 >>>>> So what is the purpose of the change? >>>> compiler warning . >>> Could you be more specific? both sMapLen and i are ints... >> CharCode mapLen; CharCode is unsinged >> two lines below i definition there is a comparison > Bahhh, yes, you are right of course (I missed the different name). -Wall > is not on by default so I there was no warning with my builds. > Thanks! > Anyway I guess the following fix should be simpler and safer: > --- > > From f499a4cba1315dd0dacecaee93126e0d74cff82f Mon Sep 17 00:00:00 2001 > From: Michal Hocko<ms...@gm...> > Date: Fri, 27 Jan 2012 09:42:42 +0100 > Subject: [PATCH] xpdf: fix compiler warning > MIME-Version: 1.0 > Content-Type: text/plain; charset=UTF-8 > Content-Transfer-Encoding: 8bit > > mapLen unlike sMapLen is unsigned. I guess this is bogus as mapLen > should never be bigger than INT_MAX but it might be initialized from > external so rather make sure we are on the safe side. > > Fixes: > CharCodeToUnicode.cc: In member function ‘CharCode > CharCodeToUnicode::mapFromUnicode(const Unicode*, int) const’: > CharCodeToUnicode.cc:501:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] > --- > src/xpdf/xpdf/CharCodeToUnicode.cc | 6 +++--- > 1 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/src/xpdf/xpdf/CharCodeToUnicode.cc b/src/xpdf/xpdf/CharCodeToUnicode.cc > index 71465f0..786f3df 100644 > --- a/src/xpdf/xpdf/CharCodeToUnicode.cc > +++ b/src/xpdf/xpdf/CharCodeToUnicode.cc > @@ -498,9 +498,9 @@ static bool isUnicodeSame(const Unicode *u1, int size1, const Unicode *u2, int s > CharCode CharCodeToUnicode::mapFromUnicode(const Unicode *u, int size)const { > int i; > if (size == 1) { > - for (i = 0; i< mapLen; ++i) > - if (map[i] == *u) > - return i; > + for (CharCode j = 0; j< mapLen; ++j) > + if (map[j] == *u) > + return j; > } > for (i = 0; i< sMapLen; ++i) { > if (isUnicodeSame(u, size, sMap[i].u, sMap[i].len)) indeed. |
From: Jozef M. <mis...@ho...> - 2012-01-27 09:01:27
|
Dne 1/27/2012 9:50 AM, Michal Hocko napsal(a): > On Fri, Jan 27, 2012 at 09:06:20AM +0100, Jozef Misutka wrote: >> Dne 1/26/2012 10:59 PM, Michal Hocko napsal(a): >>> On Thu, Jan 26, 2012 at 09:27:11PM +0100, Jozef Misutka wrote: >>> [...] >>>>>>> @@ -496,19 +496,19 @@ static bool isUnicodeSame(const Unicode *u1, int size1, const Unicode *u2, int s >>>>>>> } >>>>>>> >>>>>>> CharCode CharCodeToUnicode::mapFromUnicode(const Unicode *u, int size)const { >>>>>>> - int i; >>>>>>> + unsigned int i; >>>>>>> if (size == 1) { >>>>>>> for (i = 0; i< mapLen; ++i) >>>>>>> if (map[i] == *u) >>>>>>> return i; >>>>>>> } >>>>>>> - for (i = 0; i< sMapLen; ++i) { >>>>>>> + for (i = 0; i< (unsigned int)sMapLen; ++i) { >>>>>>> if (isUnicodeSame(u, size, sMap[i].u, sMap[i].len)) >>>>>>> return sMap[i].c; >>>>>>> } >>>>>>> >>>>>>> If the sMapLen is negative for some readon we would loop for quite >>>>>>> some time ;) So this cannot be right. What is the reason for the >>>>>>> change? Compiler warning fix? >>>>>> afaict, length(size) is always>= 0 >>>>> So what is the purpose of the change? >>>> compiler warning . >>> Could you be more specific? both sMapLen and i are ints... >> CharCode mapLen; CharCode is unsinged >> two lines below i definition there is a comparison > Bahhh, yes, you are right of course (I missed the different name). -Wall > is not on by default so I there was no warning with my builds. > Thanks! > Anyway I guess the following fix should be simpler and safer: > --- > > From f499a4cba1315dd0dacecaee93126e0d74cff82f Mon Sep 17 00:00:00 2001 > From: Michal Hocko<ms...@gm...> > Date: Fri, 27 Jan 2012 09:42:42 +0100 > Subject: [PATCH] xpdf: fix compiler warning > MIME-Version: 1.0 > Content-Type: text/plain; charset=UTF-8 > Content-Transfer-Encoding: 8bit > > mapLen unlike sMapLen is unsigned. I guess this is bogus as mapLen > should never be bigger than INT_MAX but it might be initialized from > external so rather make sure we are on the safe side. > > Fixes: > CharCodeToUnicode.cc: In member function ‘CharCode > CharCodeToUnicode::mapFromUnicode(const Unicode*, int) const’: > CharCodeToUnicode.cc:501:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] > --- > src/xpdf/xpdf/CharCodeToUnicode.cc | 6 +++--- > 1 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/src/xpdf/xpdf/CharCodeToUnicode.cc b/src/xpdf/xpdf/CharCodeToUnicode.cc > index 71465f0..786f3df 100644 > --- a/src/xpdf/xpdf/CharCodeToUnicode.cc > +++ b/src/xpdf/xpdf/CharCodeToUnicode.cc > @@ -498,9 +498,9 @@ static bool isUnicodeSame(const Unicode *u1, int size1, const Unicode *u2, int s > CharCode CharCodeToUnicode::mapFromUnicode(const Unicode *u, int size)const { > int i; > if (size == 1) { > - for (i = 0; i< mapLen; ++i) > - if (map[i] == *u) > - return i; > + for (CharCode j = 0; j< mapLen; ++j) > + if (map[j] == *u) > + return j; > } > for (i = 0; i< sMapLen; ++i) { > if (isUnicodeSame(u, size, sMap[i].u, sMap[i].len)) indeed. |
From: Michal H. <ms...@gm...> - 2012-01-27 08:50:20
|
On Fri, Jan 27, 2012 at 09:06:20AM +0100, Jozef Misutka wrote: > Dne 1/26/2012 10:59 PM, Michal Hocko napsal(a): > >On Thu, Jan 26, 2012 at 09:27:11PM +0100, Jozef Misutka wrote: > >[...] > >>>>>@@ -496,19 +496,19 @@ static bool isUnicodeSame(const Unicode *u1, int size1, const Unicode *u2, int s > >>>>> } > >>>>> > >>>>> CharCode CharCodeToUnicode::mapFromUnicode(const Unicode *u, int size)const { > >>>>>- int i; > >>>>>+ unsigned int i; > >>>>> if (size == 1) { > >>>>> for (i = 0; i< mapLen; ++i) > >>>>> if (map[i] == *u) > >>>>> return i; > >>>>> } > >>>>>- for (i = 0; i< sMapLen; ++i) { > >>>>>+ for (i = 0; i< (unsigned int)sMapLen; ++i) { > >>>>> if (isUnicodeSame(u, size, sMap[i].u, sMap[i].len)) > >>>>> return sMap[i].c; > >>>>> } > >>>>> > >>>>>If the sMapLen is negative for some readon we would loop for quite > >>>>>some time ;) So this cannot be right. What is the reason for the > >>>>>change? Compiler warning fix? > >>>>afaict, length(size) is always>= 0 > >>>So what is the purpose of the change? > >>compiler warning . > >Could you be more specific? both sMapLen and i are ints... > > CharCode mapLen; CharCode is unsinged > two lines below i definition there is a comparison Bahhh, yes, you are right of course (I missed the different name). -Wall is not on by default so I there was no warning with my builds. Thanks! Anyway I guess the following fix should be simpler and safer: --- >From f499a4cba1315dd0dacecaee93126e0d74cff82f Mon Sep 17 00:00:00 2001 From: Michal Hocko <ms...@gm...> Date: Fri, 27 Jan 2012 09:42:42 +0100 Subject: [PATCH] xpdf: fix compiler warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mapLen unlike sMapLen is unsigned. I guess this is bogus as mapLen should never be bigger than INT_MAX but it might be initialized from external so rather make sure we are on the safe side. Fixes: CharCodeToUnicode.cc: In member function ‘CharCode CharCodeToUnicode::mapFromUnicode(const Unicode*, int) const’: CharCodeToUnicode.cc:501:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] --- src/xpdf/xpdf/CharCodeToUnicode.cc | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/xpdf/xpdf/CharCodeToUnicode.cc b/src/xpdf/xpdf/CharCodeToUnicode.cc index 71465f0..786f3df 100644 --- a/src/xpdf/xpdf/CharCodeToUnicode.cc +++ b/src/xpdf/xpdf/CharCodeToUnicode.cc @@ -498,9 +498,9 @@ static bool isUnicodeSame(const Unicode *u1, int size1, const Unicode *u2, int s CharCode CharCodeToUnicode::mapFromUnicode(const Unicode *u, int size)const { int i; if (size == 1) { - for (i = 0; i < mapLen; ++i) - if (map[i] == *u) - return i; + for (CharCode j = 0; j < mapLen; ++j) + if (map[j] == *u) + return j; } for (i = 0; i < sMapLen; ++i) { if (isUnicodeSame(u, size, sMap[i].u, sMap[i].len)) -- 1.7.8.3 -- Michal Hocko |
From: Jozef M. <mis...@ho...> - 2012-01-27 08:06:30
|
Dne 1/26/2012 10:59 PM, Michal Hocko napsal(a): > On Thu, Jan 26, 2012 at 09:27:11PM +0100, Jozef Misutka wrote: > [...] >>>>> @@ -496,19 +496,19 @@ static bool isUnicodeSame(const Unicode *u1, int size1, const Unicode *u2, int s >>>>> } >>>>> >>>>> CharCode CharCodeToUnicode::mapFromUnicode(const Unicode *u, int size)const { >>>>> - int i; >>>>> + unsigned int i; >>>>> if (size == 1) { >>>>> for (i = 0; i< mapLen; ++i) >>>>> if (map[i] == *u) >>>>> return i; >>>>> } >>>>> - for (i = 0; i< sMapLen; ++i) { >>>>> + for (i = 0; i< (unsigned int)sMapLen; ++i) { >>>>> if (isUnicodeSame(u, size, sMap[i].u, sMap[i].len)) >>>>> return sMap[i].c; >>>>> } >>>>> >>>>> If the sMapLen is negative for some readon we would loop for quite >>>>> some time ;) So this cannot be right. What is the reason for the >>>>> change? Compiler warning fix? >>>> afaict, length(size) is always>= 0 >>> So what is the purpose of the change? >> compiler warning . > Could you be more specific? both sMapLen and i are ints... CharCode mapLen; CharCode is unsinged two lines below i definition there is a comparison > > [...] >>>>> @@ -132,11 +132,11 @@ public: >>>>> >>>>> // Get font descriptor flags. >>>>> int getFlags()const { return flags; } >>>>> - GBool isFixedWidth()const { return flags& fontFixedWidth; } >>>>> - GBool isSerif()const { return flags& fontSerif; } >>>>> - GBool isSymbolic()const { return flags& fontSymbolic; } >>>>> - GBool isItalic()const { return flags& fontItalic; } >>>>> - GBool isBold()const { return flags& fontBold; } >>>>> + GBool isFixedWidth()const { return flags& PDF_fontFixedWidth; } >>>>> + GBool isSerif()const { return flags& PDF_fontSerif; } >>>>> + GBool isSymbolic()const { return flags& PDF_fontSymbolic; } >>>>> + GBool isItalic()const { return flags& PDF_fontItalic; } >>>>> + GBool isBold()const { return flags& PDF_fontBold; } >>>>> >>>>> I have already mentioned this above. NAK for this. It makes us diverge >> i do not have a strong opinion about this one. > There is no external user of the renamed constants. > |
From: Michal H. <ms...@gm...> - 2012-01-26 22:07:05
|
On Thu, Jan 26, 2012 at 09:35:03PM +0100, Jozef Misutka wrote: > maybe I am already lost in the patch deluge but i think all xpdf but > lexer and gfxfont.h are solved, right? We are left with the following changes. I will resolve them later. $ git diff master gui-staging -- src/xpdf/ diff --git a/src/xpdf/xpdf/Gfx.cc b/src/xpdf/xpdf/Gfx.cc index e1b073d..1a29de4 100644 --- a/src/xpdf/xpdf/Gfx.cc +++ b/src/xpdf/xpdf/Gfx.cc @@ -703,10 +703,8 @@ void Gfx::execOp(const Object *cmd, Object args[], int numArgs) { } Operator *Gfx::findOp(const char *name) { - int a, b, m, cmp; + int a = -1, b = numOps, m = 0, cmp = 0; - a = -1; - b = numOps; // invariant: opTab[a] < name < opTab[b] while (b - a > 1) { m = (a + b) / 2; @@ -2127,7 +2125,7 @@ void Gfx::doAxialShFill(GfxAxialShading *shading) { double t0, t1, tt; double ta[axialMaxSplits + 1]; int next[axialMaxSplits + 1]; - GfxColor color0, color1; + GfxColor color0 = {}, color1 = {}; int nComps; int i, j, k, kk; diff --git a/src/xpdf/xpdf/SplashOutputDev.cc b/src/xpdf/xpdf/SplashOutputDev.cc index 281aca0..b7fea5c 100644 --- a/src/xpdf/xpdf/SplashOutputDev.cc +++ b/src/xpdf/xpdf/SplashOutputDev.cc @@ -959,7 +959,18 @@ void SplashOutputDev::updateStrokeOpacity(GfxState *state) { void SplashOutputDev::updateFont(GfxState *state) { needFontUpdate = gTrue; } - +SplashFont * SplashOutputDev::getFontById(GfxFont * gfxFont) +{ + SplashOutFontFileID *id; + id = new SplashOutFontFileID(gfxFont->getID()); + SplashFontFile *fontFile = fontEngine->getFontFile(id); + delete id; + if (!fontFile ) + return NULL; + SplashCoord coord[] = {1,0,0,1,0,0}; + SplashFont * fnt = fontEngine->getFont(fontFile,coord,coord); + return fnt; +} void SplashOutputDev::doUpdateFont(GfxState *state) { const GfxFont *gfxFont; GfxFontType fontType; diff --git a/src/xpdf/xpdf/SplashOutputDev.h b/src/xpdf/xpdf/SplashOutputDev.h index f6fb0c0..ad5c037 100644 --- a/src/xpdf/xpdf/SplashOutputDev.h +++ b/src/xpdf/xpdf/SplashOutputDev.h @@ -79,6 +79,7 @@ public: virtual void saveState(GfxState *state); virtual void restoreState(GfxState *state); + SplashFont * getFontById(GfxFont * gfxFont); //----- update graphics state virtual void updateAll(GfxState *state); virtual void updateCTM(GfxState *state, double m11, double m12, -- Michal Hocko |