[poppler] 2 commits - utils/HtmlFonts.cc utils/HtmlFonts.h utils/HtmlOutputDev.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Oct 7 19:38:20 UTC 2018


 utils/HtmlFonts.cc     |   19 ++-----------------
 utils/HtmlFonts.h      |    1 -
 utils/HtmlOutputDev.cc |   15 ++++-----------
 3 files changed, 6 insertions(+), 29 deletions(-)

New commits:
commit 51adf4f54815c3a74b3a224eff5b107adf7ef7fe
Author: Steven Boswell <ulatekh at yahoo.com>
Date:   Sat Oct 6 09:25:08 2018 +0200

    Make HtmlFont::HtmlFilter convert tabs into spaces using the same logic used for spaces.

diff --git a/utils/HtmlFonts.cc b/utils/HtmlFonts.cc
index 71702417..fca3e708 100644
--- a/utils/HtmlFonts.cc
+++ b/utils/HtmlFonts.cc
@@ -224,7 +224,7 @@ GooString* HtmlFont::HtmlFilter(const Unicode* u, int uLen) {
   for (int i = 0; i < uLen; ++i) {
     // skip control characters.  W3C disallows them and they cause a warning
     // with PHP.
-    if (u[i] <= 31)
+    if (u[i] <= 31 && u[i] != '\t')
       continue;
 
     switch (u[i])
@@ -233,7 +233,7 @@ GooString* HtmlFont::HtmlFilter(const Unicode* u, int uLen) {
 	case '&': tmp->append("&");  break;
 	case '<': tmp->append("<");  break;
 	case '>': tmp->append(">");  break;
-	case ' ': tmp->append( !xml && ( i+1 >= uLen || !tmp->getLength() || tmp->getChar( tmp->getLength()-1 ) == ' ' ) ? " " : " " );
+	case ' ': case '\t': tmp->append( !xml && ( i+1 >= uLen || !tmp->getLength() || tmp->getChar( tmp->getLength()-1 ) == ' ' ) ? " " : " " );
 	          break;
 	default:  
 	  {
commit 2b5c7c8609e88a4a9b18a19168ba4eb6a60572c3
Author: Adam Reichold <adam.reichold at t-online.de>
Date:   Sat Oct 6 09:21:44 2018 +0200

    Remove HtmlFont::simple since it is just a diversion around HtmlFont::HtmlFilter.

diff --git a/utils/HtmlFonts.cc b/utils/HtmlFonts.cc
index afd7a2a9..71702417 100644
--- a/utils/HtmlFonts.cc
+++ b/utils/HtmlFonts.cc
@@ -249,21 +249,6 @@ GooString* HtmlFont::HtmlFilter(const Unicode* u, int uLen) {
   return tmp;
 }
 
-GooString* HtmlFont::simple(HtmlFont* font, Unicode* content, int uLen){
-  GooString *cont=HtmlFilter (content, uLen); 
-
-  /*if (font.isBold()) {
-    cont->insert(0,"<b>",3);
-    cont->append("</b>",4);
-  }
-  if (font.isItalic()) {
-    cont->insert(0,"<i>",3);
-    cont->append("</i>",4);
-    } */
-
-  return cont;
-}
-
 HtmlFontAccu::HtmlFontAccu(){
   accu=new std::vector<HtmlFont>();
 }
diff --git a/utils/HtmlFonts.h b/utils/HtmlFonts.h
index 26abb7bf..431be6bd 100644
--- a/utils/HtmlFonts.h
+++ b/utils/HtmlFonts.h
@@ -90,7 +90,6 @@ public:
    static GooString* HtmlFilter(const Unicode* u, int uLen); //char* s);
    GBool isEqual(const HtmlFont& x) const;
    GBool isEqualIgnoreBold(const HtmlFont& x) const;
-   static GooString* simple(HtmlFont *font, Unicode *content, int uLen);
    void print() const {printf("font: %s (%s) %d %s%s\n", FontName->getCString(), familyName.c_str(), size, bold ? "bold " : "", italic ? "italic " : "");};
 };
 
diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc
index b379102b..2d2f92a9 100644
--- a/utils/HtmlOutputDev.cc
+++ b/utils/HtmlOutputDev.cc
@@ -346,22 +346,15 @@ void HtmlPage::beginString(GfxState *state, const GooString *s) {
 
 
 void HtmlPage::conv(){
-  HtmlString *tmp;
-
-  int linkIndex = 0;
-  HtmlFont* h;
-  for(tmp=yxStrings;tmp;tmp=tmp->yxNext){
-     int pos=tmp->fontpos;
-     h=fonts->Get(pos);
-
-     if (tmp->htext) delete tmp->htext; 
-     tmp->htext=HtmlFont::simple(h,tmp->text,tmp->len);
+  for(HtmlString *tmp=yxStrings;tmp;tmp=tmp->yxNext){
+     delete tmp->htext;
+     tmp->htext=HtmlFont::HtmlFilter(tmp->text,tmp->len);
 
+     int linkIndex = 0;
      if (links->inLink(tmp->xMin,tmp->yMin,tmp->xMax,tmp->yMax, linkIndex)){
        tmp->link = links->getLink(linkIndex);
      }
   }
-
 }
 
 


More information about the poppler mailing list