mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-10-05 19:41:40 +00:00
escape input file name; aware of 0xa0 as space
This commit is contained in:
parent
0712b39659
commit
b8cfac4574
@ -449,6 +449,10 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
|
|||||||
info.space_width = font_cid->getWidth(buf, 2);
|
info.space_width = font_cid->getWidth(buf, 2);
|
||||||
}
|
}
|
||||||
ffw_add_empty_char((int32_t)' ', (int)floor(info.space_width * info.em_size + 0.5));
|
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)
|
if(ctu)
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "util/math.h"
|
#include "util/math.h"
|
||||||
#include "util/path.h"
|
#include "util/path.h"
|
||||||
#include "util/css_const.h"
|
#include "util/css_const.h"
|
||||||
|
#include "util/encoding.h"
|
||||||
|
|
||||||
namespace pdf2htmlEX {
|
namespace pdf2htmlEX {
|
||||||
|
|
||||||
@ -505,9 +506,9 @@ void HTMLRenderer::embed_file(ostream & out, const string & path, const string &
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out << iter->second.first
|
out << iter->second.first;
|
||||||
<< fn
|
outputURL(out, fn);
|
||||||
<< iter->second.second << endl;
|
out << iter->second.second << endl;
|
||||||
|
|
||||||
if(copy)
|
if(copy)
|
||||||
{
|
{
|
||||||
|
@ -403,7 +403,8 @@ void HTMLTextLine::optimize()
|
|||||||
// get the text segment covered by current state (*state_iter1)
|
// get the text segment covered by current state (*state_iter1)
|
||||||
const auto text_iter1 = text.begin() + text_idx1;
|
const auto text_iter1 = text.begin() + text_idx1;
|
||||||
const auto text_iter2 = text.begin() + text_idx2;
|
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
|
// 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
|
// note that we may only change word space, no offset will be affected
|
||||||
|
Loading…
Reference in New Issue
Block a user