[poppler] 2 commits - glib/demo qt4/src

Albert Astals Cid aacid at kemper.freedesktop.org
Tue Mar 11 16:00:32 PDT 2008


 glib/demo/CMakeLists.txt   |    1 +
 qt4/src/poppler-page.cc    |    8 ++++++--
 qt4/src/poppler-private.h  |    3 +--
 qt4/src/poppler-qt4.h      |    6 ++----
 qt4/src/poppler-textbox.cc |    4 ++--
 5 files changed, 12 insertions(+), 10 deletions(-)

New commits:
commit 9c472f76d2462d0e775c851fdbac6ca2bc9812ea
Author: Albert Astals Cid <aacid at kde.org>
Date:   Wed Mar 12 00:00:20 2008 +0100

    cmake build

diff --git a/glib/demo/CMakeLists.txt b/glib/demo/CMakeLists.txt
index 30568c4..7928052 100644
--- a/glib/demo/CMakeLists.txt
+++ b/glib/demo/CMakeLists.txt
@@ -13,6 +13,7 @@ set(poppler_glib_demo_SRCS
   render.c
   transitions.c
   utils.c
+  annots.c
 )
 poppler_add_test(poppler-glib-demo BUILD_GTK_TESTS ${poppler_glib_demo_SRCS})
 target_link_libraries(poppler-glib-demo poppler-glib ${GTK2_LIBRARIES})
commit 821858f5c36786955d9475044bfee57f5060ad2f
Author: Albert Astals Cid <aacid at kde.org>
Date:   Tue Mar 11 23:58:05 2008 +0100

    Return char bounding box instead of edge, it's much more useful for character positioning

diff --git a/qt4/src/poppler-page.cc b/qt4/src/poppler-page.cc
index f02e033..8ae6ccd 100644
--- a/qt4/src/poppler-page.cc
+++ b/qt4/src/poppler-page.cc
@@ -362,8 +362,12 @@ QList<TextBox*> Page::textList(Rotation rotate) const
     
     TextBox* text_box = new TextBox(string, QRectF(xMin, yMin, xMax-xMin, yMax-yMin));
     text_box->m_data->hasSpaceAfter = word->hasSpaceAfter() == gTrue;
-    text_box->m_data->edge.reserve(word->getLength() + 1);
-    for (int j = 0; j <= word->getLength(); ++j) text_box->m_data->edge.append(word->getEdge(j));
+    text_box->m_data->charBBoxes.reserve(word->getLength());
+    for (int j = 0; j < word->getLength(); ++j)
+    {
+        word->getCharBBox(j, &xMin, &yMin, &xMax, &yMax);
+        text_box->m_data->charBBoxes.append(QRectF(xMin, yMin, xMax-xMin, yMax-yMin));
+    }
     
     wordBoxMap.insert(word, text_box);
     
diff --git a/qt4/src/poppler-private.h b/qt4/src/poppler-private.h
index 3774d20..6f55f18 100644
--- a/qt4/src/poppler-private.h
+++ b/qt4/src/poppler-private.h
@@ -302,8 +302,7 @@ namespace Poppler {
 		QString text;
 		QRectF bBox;
 		TextBox *nextWord;
-		QVector<double> edge;	// "near" edge x or y coord of each char
-					//   (plus one extra entry for the last char)
+		QVector<QRectF> charBBoxes; // the boundingRect of each character
 		bool hasSpaceAfter;
     };
 
diff --git a/qt4/src/poppler-qt4.h b/qt4/src/poppler-qt4.h
index 726fd75..5deedd8 100644
--- a/qt4/src/poppler-qt4.h
+++ b/qt4/src/poppler-qt4.h
@@ -93,11 +93,9 @@ namespace Poppler {
       TextBox *nextWord() const;
 
       /**
-	  Returns the position of \p i -th edge of the current word.
-
-	  For a text() of \em n characters, there are \em n+1 edges.
+	  Returns the bounding box of the \p i -th characted of the word.
       */
-      double edge(int i) const;
+      QRectF charBoundingBox(int i) const;
 
       /**
 	  Returns whether there is a space character after this text box
diff --git a/qt4/src/poppler-textbox.cc b/qt4/src/poppler-textbox.cc
index 840b389..a17ab62 100644
--- a/qt4/src/poppler-textbox.cc
+++ b/qt4/src/poppler-textbox.cc
@@ -48,9 +48,9 @@ TextBox *TextBox::nextWord() const
 	return m_data->nextWord;
 }
 
-double TextBox::edge(int i) const
+QRectF TextBox::charBoundingBox(int i) const
 {
-	return m_data->edge.value(i, 0.0);
+	return m_data->charBBoxes.value(i);
 }
 
 bool TextBox::hasSpaceAfter() const


More information about the poppler mailing list