--- poppler/CharTypes.h	2006/11/13 00:15:38	1.1
+++ poppler/CharTypes.h	2006/11/13 00:36:07
@@ -20,5 +20,6 @@ typedef unsigned int CID;
 // - 16-bit CID
 // - Unicode
 typedef unsigned int CharCode;
+#define CHARCODE_LIGATED 0xFFFFFFFF
 
 #endif
--- poppler/TextOutputDev.cc	2006/11/13 00:15:43	1.1
+++ poppler/TextOutputDev.cc	2006/11/13 00:50:17
@@ -1922,7 +1922,8 @@ void TextPage::addChar(GfxState *state, 
     w1 /= uLen;
     h1 /= uLen;
   for (i = 0; i < uLen; ++i) {
-      curWord->addChar(state, x1 + i*w1, y1 + i*h1, w1, h1, c, u[i]);
+      curWord->addChar(state, x1 + i*w1, y1 + i*h1, w1, h1, 
+		       (i == 0 ? c : CHARCODE_LIGATED), u[i]);
   }
   }
   if (curWord) {
@@ -3393,9 +3394,22 @@ void TextSelectionPainter::visitWord (Te
 
   out->beginString(state, string);
 
-  for (i = begin; i < end; i++)
+  for (i = begin; i < end; i++) {
+    if (word->charcode[i] == CHARCODE_LIGATED) {
+      while (word->charcode[i] == CHARCODE_LIGATED && i >= 0)
+	--i;
+      if (word->charcode[i] != CHARCODE_LIGATED)
+	out->drawChar(state, word->edge[i], word->base, 0, 0, 0, 0,
+		      word->charcode[i], 1, NULL, 0);
+      ++i;
+      while (word->charcode[i] == CHARCODE_LIGATED && i < end)
+	++i;
+      if (!(i < end))
+	break;
+    }
     out->drawChar(state, word->edge[i], word->base, 0, 0, 0, 0,
 		  word->charcode[i], 1, NULL, 0);
+  }
   
   out->endString(state);