Skip to content

Commit

Permalink
implement RFC98 (#4673) and RFC99 (#4704)
Browse files Browse the repository at this point in the history
- implement complex scrit shaping via harfbuzz
- refactor text rendering pipeline
- remove support for GD renderer
- remove support for deprecated annotation layers
  • Loading branch information
tbonfort committed Sep 23, 2013
1 parent 42733c2 commit 18b51c4
Show file tree
Hide file tree
Showing 95 changed files with 7,816 additions and 8,375 deletions.
12 changes: 11 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,22 @@ env:

compiler:
- gcc
- clang

before_install:
- mkdir tmp
- cd tmp
- wget http://www.freedesktop.org/software/harfbuzz/release/harfbuzz-0.9.19.tar.bz2
- tar xjf harfbuzz-0.9.19.tar.bz2
- cd harfbuzz-0.9.19
- ./configure --without-cairo --without-glib --without-icu
- make -j3
- sudo make install && sudo ldconfig
- cd ../..
- git submodule update --init --recursive
- sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable
- sudo apt-get update -qq
- sudo apt-get install -qq bison flex swig cmake librsvg2-dev colordiff postgis postgresql-9.1-postgis-2.0-scripts libpq-dev libpng12-dev libjpeg-dev libgif-dev libgeos-dev libgd2-noxpm-dev libfreetype6-dev libfcgi-dev libcurl4-gnutls-dev libcairo2-dev libgdal1-dev libproj-dev libxml2-dev python-dev php5-dev libexempi-dev lcov lftp
- sudo apt-get install -qq libfribidi-dev swig cmake librsvg2-dev colordiff postgis postgresql-9.1-postgis-2.0-scripts libpq-dev libpng12-dev libjpeg-dev libgif-dev libgeos-dev libgd2-noxpm-dev libfreetype6-dev libfcgi-dev libcurl4-gnutls-dev libcairo2-dev libgdal1-dev libproj-dev libxml2-dev python-dev php5-dev libexempi-dev lcov lftp
- sudo pip install git+git://github.com/tbonfort/cpp-coveralls.git@extensions
- cd msautotest
- ./create_postgis_test_data.sh
Expand Down
93 changes: 52 additions & 41 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ endif (APPLE)


macro (ms_link_libraries)
target_link_libraries(mapserver ${ARGV})
if(BUILD_DYNAMIC)
target_link_libraries(mapserver ${ARGV})
endif(BUILD_DYNAMIC)
if(BUILD_STATIC)
target_link_libraries(mapserver_static ${ARGV})
endif(BUILD_STATIC)
Expand All @@ -59,9 +61,10 @@ macro( report_dependency_error component dependency)
endmacro()

SET(CMAKE_REQUIRED_INCLUDES "math.h")
if(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_REQUIRED_LIBRARIES "m")
endif(CMAKE_COMPILER_IS_GNUCXX)
if(NOT(WIN32))
SET(CMAKE_REQUIRED_LIBRARIES "m")
endif(NOT(WIN32))

check_function_exists("strrstr" HAVE_STRRSTR)
check_function_exists("strcasecmp" HAVE_STRCASECMP)
check_function_exists("strcasestr" HAVE_STRCASESTR)
Expand Down Expand Up @@ -93,8 +96,8 @@ option(WITH_PROJ "Choose if reprojection support should be built in" ON)
option(WITH_KML "Enable native KML output support (requires libxml2 support)" OFF)
option(WITH_SOS "Enable SOS Server support (requires PROJ and libxml2 support)" OFF)
option(WITH_WMS "Enable WMS Server support (requires proj support)" ON)
option(WITH_GD "Choose if (old) GD support should be built in" OFF)
option(WITH_FRIBIDI "Choose if FriBidi glyph shaping support should be built in (usefull for left-to-right languages)" ON)
option(WITH_FRIBIDI "Choose if FriBidi glyph shaping support should be built in (usefull for left-to-right languages) (requires HARFBUZZ)" ON)
option(WITH_HARFBUZZ "Choose if Harfbuzz complex text layout should be included (needed for e.g. arabic and hindi) (requires FRIBIDI)" ON)
option(WITH_ICONV "Choose if Iconv Internationalization support should be built in" ON)
option(WITH_CAIRO "Choose if CAIRO rendering support should be built in (required for SVG and PDF output)" ON)
option(WITH_SVGCAIRO "Choose if SVG symbology support (via libsvgcairo) should be built in (requires cairo, libsvg, libsvg-cairo. Incompatible with librsvg)" OFF)
Expand Down Expand Up @@ -138,7 +141,7 @@ option(WITH_GENERIC_NINT "generic rounding" OFF)
# PERLV_ld_DETECT?

# Add compiler flags for warnings
if(CMAKE_COMPILER_IS_GNUCXX)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wdeclaration-after-statement")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
endif()
Expand All @@ -148,8 +151,10 @@ SET(CMAKE_MACOSX_RPATH ON)

if(LINK_STATIC_LIBMAPSERVER)
set(BUILD_STATIC 1)
set(BUILD_DYNAMIC 0)
set(MAPSERVER_LIBMAPSERVER mapserver_static)
else(LINK_STATIC_LIBMAPSERVER)
set(BUILD_DYNAMIC 1)
set(MAPSERVER_LIBMAPSERVER mapserver)
endif(LINK_STATIC_LIBMAPSERVER)

Expand All @@ -166,7 +171,7 @@ renderers/agg/src/agg_line_aa_basics.cpp
renderers/agg/src/clipper.cpp
)
include_directories(renderers/agg/include)

#add_definitions(-DHASH_DEBUG=1)
if(WIN32)
set(REGEX_SOURCES ${REGEX_DIR}/regex.c)
include_directories(${REGEX_DIR})
Expand All @@ -179,7 +184,7 @@ else(WIN32)
set(REGEX_SOURCES "")
endif(WIN32)

set(mapserver_SOURCES
set(mapserver_SOURCES fontcache.c
cgiutil.c mapgeos.c maporaclespatial.c mapsearch.c mapwms.c classobject.c
mapgml.c mapoutput.c mapwmslayer.c layerobject.c mapgraticule.c mapows.c
mapservutil.c mapxbase.c maphash.c mapowscommon.c mapshape.c mapxml.c mapbits.c
Expand All @@ -192,17 +197,20 @@ mapprojhack.c maptree.c mapdebug.c maplexer.c mapquantization.c mapunion.c
mapdraw.c maplibxml2.c mapquery.c maputil.c strptime.c mapdrawgdal.c
mapraster.c mapuvraster.c mapdummyrenderer.c mapobject.c maprasterquery.c
mapwcs.c maperror.c mapogcfilter.c mapregex.c mapwcs11.c mapfile.c
mapogcfiltercommon.c maprendering.c mapwcs20.c mapgd.c mapogcsld.c
mapogcfiltercommon.c maprendering.c mapwcs20.c mapogcsld.c
mapresample.c mapwfs.c mapgdal.c mapogcsos.c mapscale.c mapwfs11.c
mapgeomtransform.c mapogroutput.c mapsde.c mapwfslayer.c mapagg.cpp mapkml.cpp
mapgeomutil.cpp mapkmlrenderer.cpp
mapgeomutil.cpp mapkmlrenderer.cpp fontcache.c textlayout.c
mapogr.cpp mapcontour.c mapsmoothing.c ${REGEX_SOURCES})

add_library(mapserver SHARED ${mapserver_SOURCES} ${agg_SOURCES})
set_target_properties( mapserver PROPERTIES
VERSION ${MapServer_VERSION_STRING}
SOVERSION 1
if(BUILD_DYNAMIC)
add_library(mapserver SHARED ${mapserver_SOURCES} ${agg_SOURCES})
set_target_properties( mapserver PROPERTIES
VERSION ${MapServer_VERSION_STRING}
SOVERSION 1
)
endif(BUILD_DYNAMIC)

if(BUILD_STATIC)
add_library(mapserver_static STATIC ${mapserver_SOURCES} ${agg_SOURCES})
set_target_properties( mapserver_static PROPERTIES
Expand Down Expand Up @@ -240,6 +248,10 @@ add_executable(shptreetst shptreetst.c)
target_link_libraries(shptreetst ${MAPSERVER_LIBMAPSERVER})


if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(USE_EXTENDED_DEBUG 1)
endif (CMAKE_BUILD_TYPE STREQUAL "Debug")

find_package(PNG)
if(PNG_FOUND)
include_directories(${PNG_INCLUDE_DIR})
Expand Down Expand Up @@ -285,30 +297,6 @@ if(WITH_WMS)
endif(USE_PROJ)
endif(WITH_WMS)


if(WITH_GD)
find_package(GD)
if(NOT GD_FOUND)
report_optional_not_found(GD)
else(NOT GD_FOUND)
include_directories(${GD_INCLUDE_DIR})
ms_link_libraries( ${GD_LIBRARY})
set (USE_GD 1)
if(GD_SUPPORTS_PNG)
set(USE_GD_PNG 1)
endif(GD_SUPPORTS_PNG)
if(GD_SUPPORTS_GIF)
set(USE_GD_GIF 1)
endif(GD_SUPPORTS_GIF)
if(GD_SUPPORTS_JPEG)
set(USE_GD_JPEG 1)
endif(GD_SUPPORTS_JPEG)
if(GD_SUPPORTS_FREETYPE)
set(USE_GD_FREETYPE 1)
endif(GD_SUPPORTS_FREETYPE)
endif(NOT GD_FOUND)
endif (WITH_GD)

if(WITH_FRIBIDI)
find_package(FriBiDi)
if(NOT FRIBIDI_FOUND)
Expand All @@ -323,6 +311,25 @@ if(WITH_FRIBIDI)
endif(NOT FRIBIDI_FOUND)
endif (WITH_FRIBIDI)

if(WITH_HARFBUZZ)
find_package(HarfBuzz)
if(NOT HARFBUZZ_FOUND)
report_optional_not_found(HARFBUZZ)
else(NOT HARFBUZZ_FOUND)
include_directories(${HARFBUZZ_INCLUDE_DIR})
ms_link_libraries( ${HARFBUZZ_LIBRARY})
set (USE_HARFBUZZ 1)
endif(NOT HARFBUZZ_FOUND)
endif (WITH_HARFBUZZ)

if( USE_HARFBUZZ AND NOT(USE_FRIBIDI) )
report_dependency_error(HARFBUZZ FRIBIDI)
endif( USE_HARFBUZZ AND NOT(USE_FRIBIDI) )
if( USE_FRIBIDI AND NOT(USE_HARFBUZZ) )
report_dependency_error(FRIBIDI HARFBUZZ)
endif( USE_FRIBIDI AND NOT(USE_HARFBUZZ) )


if(WITH_ICONV)
find_package(ICONV)
if(ICONV_FOUND)
Expand Down Expand Up @@ -719,6 +726,8 @@ if(WITH_EXEMPI)
endif(LIBEXEMPI_FOUND)
endif(WITH_EXEMPI)

ms_link_libraries(harfbuzz)

if(WITH_PYTHON)
add_subdirectory("mapscript/python")
set(USE_PYTHON_MAPSCRIPT 1)
Expand Down Expand Up @@ -798,7 +807,6 @@ message(STATUS " * freetype: ${FREETYPE_LIBRARY}")
message(STATUS " * Optional components")
status_optional_component("GDAL" "${USE_GDAL}" "${GDAL_LIBRARY}")
status_optional_component("OGR" "${USE_OGR}" "${GDAL_LIBRARY}")
status_optional_component("GD" "${USE_GD}" "${GD_LIBRARY}")
status_optional_component("GIF" "${USE_GIF}" "${GIF_LIBRARY}")
status_optional_component("MYSQL" "${USE_MYSQL}" "${MYSQL_LIBRARY}")
status_optional_component("FRIBIDI" "${USE_FRIBIDI}" "${FRIBIDI_LIBRARY}")
Expand Down Expand Up @@ -885,8 +893,11 @@ if(USE_SDE92)
INSTALL(TARGETS msplugin_sde92 DESTINATION lib)
endif(USE_SDE92)

INSTALL(TARGETS sortshp shptree shptreevis msencrypt legend scalebar tile4ms shptreetst shp2img mapserv mapserver RUNTIME DESTINATION bin LIBRARY DESTINATION lib)
INSTALL(TARGETS sortshp shptree shptreevis msencrypt legend scalebar tile4ms shptreetst shp2img mapserv RUNTIME DESTINATION bin LIBRARY DESTINATION lib)
if(BUILD_STATIC)
INSTALL(TARGETS mapserver_static DESTINATION lib)
endif(BUILD_STATIC)
if(BUILD_DYNAMIC)
INSTALL(TARGETS mapserver DESTINATION lib)
endif(BUILD_DYNAMIC)

3 changes: 3 additions & 0 deletions INSTALL.CMAKE
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ default (in which case the cmake step will fail if the dependency cannot be foun
of these can be enabled or disabled by passing "-DWITH_XXX=0" or "-DWITH_XXX=1" to the
"cmake .." invocation in order to override a default selection.

This Readme file may be out of sync with the actual CMakeLists files shipped.
Refer to the CMakeLists.txt file for up-to-date options.

- option(WITH_PROJ "Choose if reprojection support should be built in" ON)
- option(WITH_KML "Enable native KML output support (requires libxml2 support)" OFF)
- option(WITH_SOS "Enable SOS Server support (requires PROJ and libxml2 support)" OFF)
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ BUILDPATH=../../build
FLEX=flex
YACC=yacc
CMAKEFLAGS=-DCMAKE_C_FLAGS="--coverage" -DCMAKE_CXX_FLAGS="--coverage" \
-DCMAKE_SHARED_LINKER_FLAGS="-lgcov" -DWITH_GD=1 -DWITH_CLIENT_WMS=1 \
-DCMAKE_SHARED_LINKER_FLAGS="-lgcov" -DWITH_CLIENT_WMS=1 \
-DWITH_CLIENT_WFS=1 -DWITH_KML=1 -DWITH_SOS=1 -DWITH_PHP=1 \
-DWITH_PYTHON=1 -DWITH_JAVA=1 -DWITH_THREAD_SAFETY=1 -DWITH_FRIBIDI=0 -DWITH_FCGI=0 -DWITH_EXEMPI=1 \
-DCMAKE_BUILD_TYPE=Release -DWITH_RSVG=1 -DWITH_CURL=1
-DWITH_PYTHON=1 -DWITH_JAVA=1 -DWITH_THREAD_SAFETY=1 -DWITH_FRIBIDI=1 -DWITH_FCGI=0 -DWITH_EXEMPI=1 \
-DCMAKE_BUILD_TYPE=Release -DWITH_RSVG=1 -DWITH_CURL=1 -DWITH_HARFBUZZ=1
all: cmakebuild

cmakebuild: lexer parser
Expand Down
50 changes: 50 additions & 0 deletions cmake/FindHarfBuzz.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Original Licence:
# Copyright (c) 2012, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Intel Corporation nor the names of its contributors may
# be used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Try to find Harfbuzz include and library directories.
#
# After successful discovery, this will set for inclusion where needed:
# HARFBUZZ_INCLUDE_DIR - containg the HarfBuzz headers
# HARFBUZZ_LIBRARY - containg the HarfBuzz library

include(FindPkgConfig)

pkg_check_modules(PC_HARFBUZZ harfbuzz>=0.9.18)

find_path(HARFBUZZ_INCLUDE_DIR NAMES hb.h
HINTS ${PC_HARFBUZZ_INCLUDE_DIRS} ${PC_HARFBUZZ_INCLUDEDIR}
)

find_library(HARFBUZZ_LIBRARY NAMES harfbuzz
HINTS ${PC_HARFBUZZ_LIBRARY_DIRS} ${PC_HARFBUZZ_LIBDIR}
)

set(HARFBUZZ_INCLUDE_DIRS ${HARFBUZZ_INCLUDE_DIR})
set(HARFBUZZ_LIBRARIES ${HARFBUZZ_LIBRARY})
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(HarfBuzz DEFAULT_MSG HARFBUZZ_INCLUDE_DIR HARFBUZZ_LIBRARY)
mark_as_advanced(HARFBUZZ_LIBRARY HARFBUZZ_INCLUDE_DIR)
Loading

0 comments on commit 18b51c4

Please sign in to comment.