Skip to content

Commit

Permalink
Merge pull request #269 from filipnavara/pango-configure
Browse files Browse the repository at this point in the history
RFC: Support Pango text rendering by default
  • Loading branch information
migueldeicaza authored Jul 25, 2018
2 parents deee23d + 4318f43 commit e653acc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: c
dist: trusty
group: travis_latest
sudo: false

os:
Expand All @@ -9,6 +9,7 @@ os:
addons:
apt:
packages:
- libpango1.0-dev
- libgif-dev
- xvfb
- autoconf
Expand All @@ -20,7 +21,7 @@ addons:
- git

install:
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; brew install glib cairo libexif; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; brew install glib cairo pango libexif; fi

script:
- set -e
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ Run the following command from the root of the repository:

make install

### Optional build options [UNSUPPORTED]
### Optional build options

--with-pango

This builds libgdiplus using Pango to render (measure and draw)
all of it's text. This requires Pango version 1.10 (or later).
all of it's text. This requires Pango version 1.38 (or later).
16 changes: 11 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ GDIPLUS_CFLAGS="`$PKG_CONFIG --cflags glib-2.0 `"
CAIRO_REQUIRED_VERSION="1.6.4"
PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_REQUIRED_VERSION)

# Optional use (experimental and unsupported) of Pango's text rendering on top of Cairo
AC_ARG_WITH(pango, [ --with-pango],[text_v=pango],[text_v=cairo])
# Optional use of Pango's text rendering on top of Cairo
AC_ARG_WITH(pango, [ --with-pango use Pango to measure and draw text],[text_v=pango],[text_v=default])

GDIPLUS_CFLAGS="$GDIPLUS_CFLAGS -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -std=gnu99"

Expand All @@ -44,12 +44,18 @@ CAIRO_CFLAGS="`pkg-config --cflags cairo `"
cairo_info="`pkg-config --modversion cairo ` (system)"
GDIPLUS_PKG_REQ="cairo"

PANGO_REQUIRED_VERSION="1.38"
if test $text_v = "pango"; then
PKG_CHECK_MODULES(PANGO, pango >= $PANGO_REQUIRED_VERSION)
fi
if test $text_v = "default"; then
PKG_CHECK_MODULES(PANGO, pango >= $PANGO_REQUIRED_VERSION,
[text_v=pango], [text_v=cairo])
fi
if test $text_v = "pango"; then
PANGO_REQUIRED_VERSION="1.10"
PKG_CHECK_MODULES(PANGO, pango >= $PANGO_REQUIRED_VERSION)
PANGO_LIBS="`pkg-config --libs pangocairo `"
PANGO_CFLAGS="`pkg-config --cflags pangocairo `"
AC_DEFINE(USE_PANGO_RENDERING,1,[Use Pango to measure and draw text (INCOMPLETE and UNSUPPORTED)])
AC_DEFINE(USE_PANGO_RENDERING,1,[Use Pango to measure and draw text])
GDIPLUS_PKG_REQ="$GDIPLUS_PKG_REQ pangocairo-1.0"
fi

Expand Down
2 changes: 1 addition & 1 deletion src/libgdiplus.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>HAVE_LIBGIF;HAVE_LIBJPEG;HAVE_LIBTIFF;HAVE_LIBPNG;HAVE_FCFINI;_WINDLL;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>HAVE_LIBGIF;HAVE_LIBJPEG;HAVE_LIBTIFF;HAVE_LIBPNG;HAVE_FCFINI;USE_PANGO_RENDERING;_WINDLL;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<!-- FIXME: To align with the GDI+ calling convention, this should be StdCall. Only relevant on x86 -->
<CallingConvention>Cdecl</CallingConvention>
<AdditionalIncludeDirectories>$(ProjectDir)..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
Expand Down

0 comments on commit e653acc

Please sign in to comment.