1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-07-05 09:38:40 +00:00

better private unicode mapping

This commit is contained in:
Lu Wang 2012-08-27 18:37:00 +08:00
parent e33850c2f2
commit 45c7c1e2da
3 changed files with 18 additions and 3 deletions

View File

@ -14,8 +14,8 @@ set(PDF2HTMLEX_VERSION "0.1")
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 (src/config.h.in src/config.h)

View File

@ -18,6 +18,6 @@ void BackgroundRenderer::drawChar(GfxState *state, double x, double y,
double originX, double originY,
CharCode code, int nBytes, Unicode *u, int uLen)
{
SplashOutputDev::drawChar(state,x,y,dx,dy,originX,originY,code, nBytes, u, uLen);
// SplashOutputDev::drawChar(state,x,y,dx,dy,originX,originY,code, nBytes, u, uLen);
}

View File

@ -13,6 +13,7 @@
#include <algorithm>
#include <istream>
#include <ostream>
#include <iostream>
#include <GfxState.h>
#include <GfxFont.h>
@ -27,6 +28,7 @@ using std::ostream;
using std::noskipws;
using std::endl;
using std::flush;
using std::cerr;
// mute gcc warning of unused function
namespace
@ -75,6 +77,19 @@ static inline bool isLegalUnicode(Unicode u)
static inline Unicode check_unicode(Unicode * u, int len, CharCode code, GfxFont * font)
{
Unicode private_mapping = (Unicode)(code + 0xE000);
if(private_mapping > 0xF8FF)
{
private_mapping = (Unicode)((private_mapping - 0xF8FF) + 0xF0000);
if(private_mapping > 0xFFFFD)
{
private_mapping = (Unicode)((private_mapping - 0xFFFFD) + 0x100000);
if(private_mapping > 0x10FFFD)
{
cerr << "Warning: all private use unicode are used" << endl;
}
}
}
if(len == 0)
return private_mapping;