diff --git a/src/HTMLRenderer/font.cc b/src/HTMLRenderer/font.cc index 659f09c..074daa3 100644 --- a/src/HTMLRenderer/font.cc +++ b/src/HTMLRenderer/font.cc @@ -449,6 +449,10 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo info.space_width = font_cid->getWidth(buf, 2); } ffw_add_empty_char((int32_t)' ', (int)floor(info.space_width * info.em_size + 0.5)); + if(param.debug) + { + cerr << "Missing space width in font: " << hex << info.id << " set to " << dec << info.space_width << endl; + } } if(ctu) diff --git a/src/HTMLRenderer/general.cc b/src/HTMLRenderer/general.cc index 03eeaa7..d327867 100644 --- a/src/HTMLRenderer/general.cc +++ b/src/HTMLRenderer/general.cc @@ -25,6 +25,7 @@ #include "util/math.h" #include "util/path.h" #include "util/css_const.h" +#include "util/encoding.h" namespace pdf2htmlEX { @@ -505,9 +506,9 @@ void HTMLRenderer::embed_file(ostream & out, const string & path, const string & } else { - out << iter->second.first - << fn - << iter->second.second << endl; + out << iter->second.first; + outputURL(out, fn); + out << iter->second.second << endl; if(copy) { diff --git a/src/HTMLTextLine.cc b/src/HTMLTextLine.cc index c9b9536..0c00591 100644 --- a/src/HTMLTextLine.cc +++ b/src/HTMLTextLine.cc @@ -403,7 +403,8 @@ void HTMLTextLine::optimize() // get the text segment covered by current state (*state_iter1) const auto text_iter1 = text.begin() + text_idx1; const auto text_iter2 = text.begin() + text_idx2; - if(find(text_iter1, text_iter2, ' ') == text_iter2) + const static std::vector space_chars = { 0x20, 0xa0 }; + if(find_first_of(text_iter1, text_iter2, space_chars.begin(), space_chars.end()) == text_iter2) { // if there is not any space, we may change the value of word_space arbitrarily // note that we may only change word space, no offset will be affected