1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 04:50:09 +00:00

fix some states depends on draw_scale that are not updated correctly

This commit is contained in:
Lu Wang 2012-09-04 12:27:06 +08:00
parent 35809470af
commit 0cfd146173
2 changed files with 25 additions and 12 deletions

View File

@ -13,6 +13,11 @@ pkg_check_modules(FONTFORGE REQUIRED fontforge)
include_directories(${FONTFORGE_INCLUDE_DIRS})
link_directories ( ${FONTFORGE_LIBRARY_DIRS} )
message("*************")
message("fontforge may not be preparing fontforge.pc correctly")
message("consider adding -lfontforge -lpython2.7 if you see lots of linking error")
message("*************")
set(PDF2HTMLEX_VERSION "0.2")
set(ARCHIVE_NAME pdf2htmlex-${PDF2HTMLEX_VERSION})
add_custom_target(dist
@ -21,13 +26,13 @@ add_custom_target(dist
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wunused-function")
#set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -O2")
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -ggdb")
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -O2")
#set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -ggdb")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wunused-function")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb")
configure_file (${CMAKE_SOURCE_DIR}/src/config.h.in ${CMAKE_SOURCE_DIR}/src/config.h)

View File

@ -82,6 +82,7 @@ void HTMLRenderer::check_state_change(GfxState * state)
bool need_recheck_position = false;
bool need_rescale_font = false;
bool draw_scale_changed = false;
// text position
// we've been tracking the text position positively in the update*** functions
@ -145,18 +146,24 @@ void HTMLRenderer::check_state_change(GfxState * state)
double new_draw_ctm[6];
memcpy(new_draw_ctm, cur_ctm, sizeof(new_draw_ctm));
draw_scale = (param->font_size_multiplier) * sqrt(new_draw_ctm[2] * new_draw_ctm[2] + new_draw_ctm[3] * new_draw_ctm[3]);
double new_draw_scale = (param->font_size_multiplier) * sqrt(new_draw_ctm[2] * new_draw_ctm[2] + new_draw_ctm[3] * new_draw_ctm[3]);
double new_draw_font_size = cur_font_size;
if(_is_positive(draw_scale))
if(_is_positive(new_draw_scale))
{
new_draw_font_size *= draw_scale;
new_draw_font_size *= new_draw_scale;
for(int i = 0; i < 4; ++i)
new_draw_ctm[i] /= draw_scale;
new_draw_ctm[i] /= new_draw_scale;
}
else
{
draw_scale = 1.0;
new_draw_scale = 1.0;
}
if(!(_equal(new_draw_scale, draw_scale)))
{
draw_scale_changed = true;
draw_scale = new_draw_scale;
}
if(!(_equal(new_draw_font_size, draw_font_size)))
@ -235,7 +242,7 @@ void HTMLRenderer::check_state_change(GfxState * state)
// letter space
// depends: draw_scale
if(all_changed || letter_space_changed)
if(all_changed || letter_space_changed || draw_scale_changed)
{
double new_letter_space = state->getCharSpace();
if(!_equal(cur_letter_space, new_letter_space))
@ -248,7 +255,7 @@ void HTMLRenderer::check_state_change(GfxState * state)
// word space
// depends draw_scale
if(all_changed || word_space_changed)
if(all_changed || word_space_changed || draw_scale_changed)
{
double new_word_space = state->getWordSpace();
if(!_equal(cur_word_space, new_word_space))
@ -273,7 +280,8 @@ void HTMLRenderer::check_state_change(GfxState * state)
}
// rise
if(all_changed || rise_changed)
// depends draw_scale
if(all_changed || rise_changed || draw_scale_changed)
{
double new_rise = state->getRise();
if(!_equal(cur_rise, new_rise))