re-enable harfbuzz shaper
This commit is contained in:
parent
726d27866c
commit
3f6a5ae246
4 changed files with 338 additions and 5 deletions
124
common.gypi
Normal file
124
common.gypi
Normal file
|
@ -0,0 +1,124 @@
|
|||
{
|
||||
'target_defaults': {
|
||||
'default_configuration': 'Release',
|
||||
'msbuild_toolset':'CTP_Nov2013',
|
||||
'msvs_configuration_platform': 'Win32',
|
||||
'msvs_disabled_warnings': [ 4068,4244,4005,4506,4345,4804,4805,4661 ],
|
||||
'xcode_settings': {
|
||||
'CLANG_CXX_LIBRARY': 'libstdc++',
|
||||
'CLANG_CXX_LANGUAGE_STANDARD':'c++03',
|
||||
'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
|
||||
'MACOSX_DEPLOYMENT_TARGET':'10.9',
|
||||
'WARNING_CFLAGS': [
|
||||
'-Wall',
|
||||
'-Wextra',
|
||||
'-pedantic',
|
||||
'-Wno-parentheses',
|
||||
'-Wno-char-subscripts',
|
||||
'-Wno-unused-parameter',
|
||||
'-Wno-c++11-narrowing',
|
||||
'-Wno-c++11-long-long',
|
||||
'-Wno-unsequenced',
|
||||
'-Wno-sign-compare',
|
||||
'-Wno-unused-function',
|
||||
'-Wno-redeclared-class-member',
|
||||
'-Wno-c99-extensions',
|
||||
'-Wno-c++11-extra-semi',
|
||||
'-Wno-variadic-macros',
|
||||
'-Wno-c++11-extensions',
|
||||
'-Wno-unused-const-variable'
|
||||
]
|
||||
},
|
||||
'msvs_settings': {
|
||||
'VCCLCompilerTool': {
|
||||
'ObjectFile': '$(IntDir)/%(RelativeDir)/', # support similiarly named files in different directories
|
||||
'ExceptionHandling': 1, # /EHsc
|
||||
'RuntimeTypeInfo': 'true', # /GR
|
||||
'RuntimeLibrary': '2' # 2:/MD
|
||||
}
|
||||
},
|
||||
'defines': [ 'BOOST_SPIRIT_USE_PHOENIX_V3=1' ],
|
||||
'cflags_cc': ['-std=c++03'],
|
||||
'conditions': [
|
||||
['OS=="win"', {
|
||||
'defines': ['_WINDOWS']
|
||||
}]
|
||||
],
|
||||
'configurations': {
|
||||
'Debug': {
|
||||
'defines!': [
|
||||
'NDEBUG'
|
||||
],
|
||||
'cflags_cc!': [
|
||||
'-O3',
|
||||
'-O2',
|
||||
'-Os',
|
||||
'-DNDEBUG'
|
||||
],
|
||||
'cflags': [ '-g', '-O0' ],
|
||||
'defines': [ 'DEBUG' ],
|
||||
'xcode_settings': {
|
||||
'GCC_OPTIMIZATION_LEVEL': '0',
|
||||
'GCC_GENERATE_DEBUGGING_SYMBOLS': 'YES',
|
||||
'DEAD_CODE_STRIPPING': 'NO',
|
||||
'GCC_INLINES_ARE_PRIVATE_EXTERN': 'NO'
|
||||
},
|
||||
'msvs_settings': {
|
||||
'VCCLCompilerTool': {
|
||||
'RuntimeLibrary': '3', # /MDd
|
||||
'Optimization': 0, # /Od, no optimization
|
||||
'MinimalRebuild': 'false',
|
||||
'OmitFramePointers': 'false',
|
||||
'BasicRuntimeChecks': 3 # /RTC1
|
||||
},
|
||||
'VCLinkerTool': {
|
||||
'AdditionalOptions': [
|
||||
#'/NODEFAULTLIB:msvcrt.lib'
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
'Release': {
|
||||
'cflags': [ '-O3' ],
|
||||
'defines': [ 'NDEBUG' ],
|
||||
'xcode_settings': {
|
||||
'GCC_OPTIMIZATION_LEVEL': '3',
|
||||
'GCC_GENERATE_DEBUGGING_SYMBOLS': 'NO',
|
||||
'DEAD_CODE_STRIPPING': 'YES',
|
||||
'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES'
|
||||
},
|
||||
'msvs_settings': {
|
||||
'VCCLCompilerTool': {
|
||||
'RuntimeLibrary': '2', #0:/MT, 2:/MD,
|
||||
'Optimization': 3, # /Ox, full optimization
|
||||
'FavorSizeOrSpeed': 1, # /Ot, favour speed over size
|
||||
'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible
|
||||
#'WholeProgramOptimization': 'true', # /GL, whole program optimization, needed for LTCG
|
||||
'OmitFramePointers': 'true',
|
||||
#'EnableFunctionLevelLinking': 'true',
|
||||
'EnableIntrinsicFunctions': 'true',
|
||||
'AdditionalOptions': [
|
||||
'/MP', # compile across multiple CPUs
|
||||
],
|
||||
'DebugInformationFormat': '0'
|
||||
},
|
||||
'VCLibrarianTool': {
|
||||
'AdditionalOptions': [
|
||||
'/LTCG' # link time code generation
|
||||
],
|
||||
},
|
||||
'VCLinkerTool': {
|
||||
#'LinkTimeCodeGeneration': 1, # link-time code generation
|
||||
#'OptimizeReferences': 2, # /OPT:REF
|
||||
#'EnableCOMDATFolding': 2, # /OPT:ICF
|
||||
'LinkIncremental': 2, # force incremental linking
|
||||
'GenerateDebugInformation': 'false',
|
||||
'AdditionalOptions': [
|
||||
#'/NODEFAULTLIB:libcmt.lib'
|
||||
],
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -33,11 +33,17 @@
|
|||
// harfbuzz
|
||||
#include <harfbuzz/hb.h>
|
||||
#include <harfbuzz/hb-ft.h>
|
||||
#include <harfbuzz/hb-icu.h>
|
||||
//#include <harfbuzz/hb-icu.h>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
static inline hb_script_t _icu_script_to_script(UScriptCode script)
|
||||
{
|
||||
if (script == USCRIPT_INVALID_CODE) return HB_SCRIPT_INVALID;
|
||||
return hb_script_from_string(uscript_getShortName(script), -1);
|
||||
}
|
||||
|
||||
struct harfbuzz_shaper
|
||||
{
|
||||
static void shape_text(text_line & line,
|
||||
|
@ -55,7 +61,7 @@ static void shape_text(text_line & line,
|
|||
|
||||
auto hb_buffer_deleter = [](hb_buffer_t * buffer) { hb_buffer_destroy(buffer);};
|
||||
const std::unique_ptr<hb_buffer_t, decltype(hb_buffer_deleter)> buffer(hb_buffer_create(),hb_buffer_deleter);
|
||||
hb_buffer_set_unicode_funcs(buffer.get(), hb_icu_get_unicode_funcs());
|
||||
//hb_buffer_set_unicode_funcs(buffer.get(), hb_icu_get_unicode_funcs());
|
||||
hb_buffer_pre_allocate(buffer.get(), length);
|
||||
mapnik::value_unicode_string const& text = itemizer.text();
|
||||
|
||||
|
@ -72,7 +78,7 @@ static void shape_text(text_line & line,
|
|||
hb_buffer_clear_contents(buffer.get());
|
||||
hb_buffer_add_utf16(buffer.get(), text.getBuffer(), text.length(), text_item.start, text_item.end - text_item.start);
|
||||
hb_buffer_set_direction(buffer.get(), (text_item.rtl == UBIDI_RTL)?HB_DIRECTION_RTL:HB_DIRECTION_LTR);
|
||||
hb_buffer_set_script(buffer.get(), hb_icu_script_to_script(text_item.script));
|
||||
hb_buffer_set_script(buffer.get(), _icu_script_to_script(text_item.script));
|
||||
hb_font_t *font(hb_ft_font_create(face->get_face(), nullptr));
|
||||
hb_shape(font, buffer.get(), nullptr, 0);
|
||||
hb_font_destroy(font);
|
||||
|
|
203
mapnik-config.bat
Normal file
203
mapnik-config.bat
Normal file
|
@ -0,0 +1,203 @@
|
|||
@echo off
|
||||
|
||||
set MAPNIK_VERSION=2.3.0
|
||||
set MAPNIK_VERSION_NUMBER=200300
|
||||
::SET CUR_PATH=%CD%
|
||||
::cd %CD%/../
|
||||
set MAPNIK_PREFIX=%~dp0
|
||||
:: strip trailing \
|
||||
set MAPNIK_PREFIX=%MAPNIK_PREFIX:~0,-1%
|
||||
:: get dirname
|
||||
for %%F in (%MAPNIK_PREFIX%) do set MAPNIK_PREFIX=%%~dpF
|
||||
:: strip trailing \
|
||||
set MAPNIK_PREFIX=%MAPNIK_PREFIX:~0,-1%
|
||||
:: now make double \\ for gyp
|
||||
set MAPNIK_PREFIX=%MAPNIK_PREFIX:\=\\%
|
||||
set MAPNIK_LIBS=%MAPNIK_PREFIX%\\libs
|
||||
set MAPNIK_INCLUDES=%MAPNIK_PREFIX%\\includes
|
||||
set MAPNIK_INPUT_PLUGINS_DIRECTORY=%MAPNIK_PREFIX%\\libs\\mapnik\\input
|
||||
set MAPNIK_FONTS_DIRECTORY=%MAPNIK_PREFIX%\\libs\\mapnik\\fonts
|
||||
|
||||
if /i "%1"=="" (
|
||||
goto help
|
||||
goto exit_error
|
||||
)
|
||||
|
||||
if /i "%1"=="-v" (
|
||||
echo %MAPNIK_VERSION%
|
||||
goto exit_ok
|
||||
)
|
||||
|
||||
if /i "%1"=="--version" (
|
||||
echo %MAPNIK_VERSION%
|
||||
goto exit_ok
|
||||
)
|
||||
|
||||
if /i "%1"=="--version-number" (
|
||||
echo %MAPNIK_VERSION_NUMBER%
|
||||
goto exit_ok
|
||||
)
|
||||
|
||||
if /i "%1"=="--git-revision" (
|
||||
echo TODO
|
||||
goto exit_ok
|
||||
)
|
||||
|
||||
if /i "%1"=="--git-describe" (
|
||||
echo TODO
|
||||
goto exit_ok
|
||||
)
|
||||
|
||||
if /i "%1"=="help" (
|
||||
goto help
|
||||
goto exit_ok
|
||||
)
|
||||
|
||||
if /i "%1"=="--help" (
|
||||
goto help
|
||||
goto exit_ok
|
||||
)
|
||||
|
||||
if /i "%1"=="-help" (
|
||||
goto help
|
||||
goto exit_ok
|
||||
)
|
||||
|
||||
if /i "%1"=="-h" (
|
||||
goto help
|
||||
goto exit_ok
|
||||
)
|
||||
|
||||
if /i "%1"=="/help" (
|
||||
goto help
|
||||
goto exit_ok
|
||||
)
|
||||
|
||||
if /i "%1"=="?" (
|
||||
goto help
|
||||
goto exit_ok
|
||||
)
|
||||
|
||||
if /i "%1"=="-?" (
|
||||
goto help
|
||||
goto exit_ok
|
||||
)
|
||||
|
||||
if /i "%1"=="--?" (
|
||||
goto help
|
||||
goto exit_ok
|
||||
)
|
||||
|
||||
if /i "%1"=="/?" (
|
||||
goto help
|
||||
goto exit_ok
|
||||
)
|
||||
|
||||
set hit=""
|
||||
|
||||
if /i "%1"=="--prefix" (
|
||||
echo %MAPNIK_PREFIX%
|
||||
set hit="yes"
|
||||
)
|
||||
|
||||
if /i "%1"=="--input-plugins" (
|
||||
echo %MAPNIK_INPUT_PLUGINS_DIRECTORY%
|
||||
set hit="yes"
|
||||
)
|
||||
|
||||
if /i "%1"=="--fonts" (
|
||||
echo %MAPNIK_FONTS_DIRECTORY%
|
||||
set hit="yes"
|
||||
)
|
||||
|
||||
if /i "%1"=="--lib-name" (
|
||||
echo mapnik
|
||||
set hit="yes"
|
||||
)
|
||||
|
||||
if /i "%1"=="--libs" (
|
||||
echo mapnik.lib
|
||||
set hit="yes"
|
||||
)
|
||||
|
||||
@rem TODO - figure out how to avoid hardcoding these library names
|
||||
if /i "%1"=="--dep-libs" (
|
||||
echo libpng16.lib zlib.lib libwebp.lib libjpeg.lib icuuc.lib icuin.lib cairo.lib libboost_system-vc120-mt-1_56.lib libxml2_a.lib ws2_32.lib
|
||||
set hit="yes"
|
||||
)
|
||||
|
||||
if /i "%1"=="--ldflags" (
|
||||
echo %MAPNIK_LIBS%
|
||||
set hit="yes"
|
||||
)
|
||||
|
||||
if /i "%1"=="--defines" (
|
||||
echo _WINDOWS HAVE_JPEG HAVE_PNG HAVE_WEBP HAVE_TIFF MAPNIK_USE_PROJ4 BOOST_REGEX_HAS_ICU GRID_RENDERER SVG_RENDERER MAPNIK_THREADSAFE BIGINT HAVE_LIBXML2 HAVE_CAIRO LIBXML_STATIC
|
||||
set hit="yes"
|
||||
)
|
||||
|
||||
@rem /MD is multithreaded dynamic linking - http://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx
|
||||
@rem /EHsc is to support c++ exceptions - http://msdn.microsoft.com/en-us/library/1deeycx5(v=vs.80).aspx
|
||||
@rem /GR is to support rtti (runtime type detection) - http://msdn.microsoft.com/en-us/library/we6hfdy0.aspx
|
||||
if /i "%1"=="--cxxflags" (
|
||||
echo /MD /EHsc /GR
|
||||
set hit="yes"
|
||||
)
|
||||
|
||||
if /i "%1"=="--includes" (
|
||||
echo %MAPNIK_INCLUDES% %MAPNIK_INCLUDES%\\mapnik\\agg
|
||||
set hit="yes"
|
||||
)
|
||||
|
||||
if /i "%1"=="--all-flags" (
|
||||
@rem nothing here yet
|
||||
echo ""
|
||||
set hit="yes"
|
||||
)
|
||||
|
||||
if /i "%1"=="--cxx" (
|
||||
@rem nothing here yet
|
||||
echo ""
|
||||
set hit="yes"
|
||||
)
|
||||
|
||||
if /i "%1"=="--cflags" (
|
||||
@rem nothing here yet
|
||||
echo ""
|
||||
set hit="yes"
|
||||
)
|
||||
|
||||
if /i "%1"=="--dep-includes" (
|
||||
@rem nothing here yet
|
||||
echo %MAPNIK_INCLUDES%\\cairo %MAPNIK_INCLUDES%\\freetype2 %MAPNIK_INCLUDES%\\google %MAPNIK_INCLUDES%\\libxml2
|
||||
set hit="yes"
|
||||
)
|
||||
|
||||
@rem if we got here print warning
|
||||
if /i %hit%=="" (
|
||||
echo unknown option %1 1>&2
|
||||
)
|
||||
|
||||
goto exit_ok
|
||||
|
||||
:help
|
||||
echo Usage: mapnik-config
|
||||
echo Examples:
|
||||
echo --libs : provide lib name for mapnik.dll
|
||||
echo --defines : provide compiler defines needed for this mapnik build
|
||||
echo --dep-libs : provide lib names of depedencies
|
||||
echo --ldflags : provide lib paths to depedencies
|
||||
echo --cxxflags : provide compiler flags
|
||||
echo --includes : provide header paths for mapnik
|
||||
echo --dep-includes : provide header paths for dependencies
|
||||
echo --input-plugins : provide path to input plugins directory
|
||||
echo --fonts : provide path to fonts directory
|
||||
|
||||
|
||||
:exit_error
|
||||
@rem exit /b 1
|
||||
goto :EOF
|
||||
|
||||
:exit_ok
|
||||
@rem exit /b 0
|
||||
goto :EOF
|
|
@ -24,7 +24,7 @@
|
|||
#include <mapnik/text/text_properties.hpp>
|
||||
#include <mapnik/expression_evaluator.hpp>
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/text/icu_shaper.hpp>
|
||||
#include <mapnik/text/harfbuzz_shaper.hpp>
|
||||
|
||||
// ICU
|
||||
#include <unicode/brkiter.h>
|
||||
|
@ -229,7 +229,7 @@ void text_layout::clear()
|
|||
|
||||
void text_layout::shape_text(text_line & line)
|
||||
{
|
||||
icu_shaper::shape_text(line, itemizer_, width_map_, font_manager_, scale_factor_);
|
||||
harfbuzz_shaper::shape_text(line, itemizer_, width_map_, font_manager_, scale_factor_);
|
||||
}
|
||||
|
||||
void text_layout::evaluate_properties(feature_impl const& feature, attributes const& attrs)
|
||||
|
|
Loading…
Add table
Reference in a new issue