1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 13:00:08 +00:00

escape input file name; aware of 0xa0 as space

This commit is contained in:
Lu Wang 2013-05-01 23:56:20 +08:00
parent 0712b39659
commit b8cfac4574
3 changed files with 10 additions and 4 deletions

View File

@ -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)

View File

@ -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)
{

View File

@ -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<Unicode> 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