[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 7 commits - configure.in lingucomponent/source nss/makefile.mk odk/configure.pl odk/setsdkenv_unix.sh.in odk/settings postprocess/packcomponents scaddins/source scp2/source set_soenv.in solenv/gbuild solenv/inc vcl/aqua vcl/inc vcl/Library_vcl.mk vcl/source
Herbert Dürr
hdu at apache.org
Thu Jan 23 10:09:00 PST 2014
configure.in | 121 +
lingucomponent/source/spellcheck/macosxspell/macspellimp.cxx | 2
nss/makefile.mk | 2
odk/configure.pl | 37
odk/setsdkenv_unix.sh.in | 8
odk/settings/settings.mk | 54
odk/settings/std.mk | 11
postprocess/packcomponents/makefile.mk | 2
scaddins/source/analysis/analysishelper.hxx | 8
scp2/source/ooo/file_library_ooo.scp | 4
scp2/source/ooo/makefile.mk | 2
set_soenv.in | 30
solenv/gbuild/platform/macosx.mk | 11
solenv/inc/_tg_app.mk | 2
solenv/inc/tg_app.mk | 2
solenv/inc/unxmacc.mk | 34
vcl/Library_vcl.mk | 4
vcl/aqua/source/a11y/aqua11ywrapperrow.mm | 3
vcl/aqua/source/app/salinst.cxx | 4
vcl/aqua/source/app/vclnsapp.mm | 2
vcl/aqua/source/dtrans/DropTarget.cxx | 13
vcl/aqua/source/gdi/atsfonts.cxx | 517 ++++++--
vcl/aqua/source/gdi/atsfonts.hxx | 40
vcl/aqua/source/gdi/atslayout.cxx | 29
vcl/aqua/source/gdi/salgdi.cxx | 679 +++--------
vcl/aqua/source/gdi/salgdiutils.cxx | 2
vcl/aqua/source/window/salframe.cxx | 2
vcl/aqua/source/window/salframeview.mm | 6
vcl/aqua/source/window/salmenu.cxx | 2
vcl/inc/aqua/aquavcltypes.h | 3
vcl/inc/aqua/salframeview.h | 5
vcl/inc/aqua/salgdi.h | 73 -
vcl/source/gdi/outdev3.cxx | 8
33 files changed, 884 insertions(+), 838 deletions(-)
New commits:
commit 1137f0de24ebab25efcc8a9166de9974aa8c30c1
Author: Herbert Dürr <hdu at apache.org>
Date: Thu Jan 23 17:13:05 2014 +0000
#123509# adapt settings etc. to work with 64 bit office and environment
merge from revision 1536312 in the branch rejuvenate01
Patch by: Juergen Schmidt <jsc at apache.org>
diff --git a/odk/configure.pl b/odk/configure.pl
index 9f6e2a4..4bd1269 100755
--- a/odk/configure.pl
+++ b/odk/configure.pl
@@ -82,8 +82,19 @@ if ( $main::operatingSystem =~ m/solaris/ )
$main::cppName = "CC";
$main::cppVersion = "5.2";
}
+if ( $main::operatingSystem =~ m/darwin/ )
+{
+ $main::cppName = "clang";
+ $main::cppVersion = "4.2";
+}
$main::OO_SDK_CC_55_OR_HIGHER = "";
-$main::OO_SDK_CPP_HOME_SUGGESTION = searchprog($main::cppName);
+if ( $main::operatingSystem =~ m/darwin/ )
+{
+ $clangpath = `xcrun -f clang++`;
+ $main::OO_SDK_CPP_HOME_SUGGESTION = substr($clangpath, 0, rindex($clangpath, "/"));
+} else {
+ $main::OO_SDK_CPP_HOME_SUGGESTION = searchprog($main::cppName);
+}
$main::OO_SDK_JAVA_HOME = "";
$main::OO_SDK_JAVA_BIN_DIR = "bin";
@@ -348,18 +359,28 @@ while ( (!$main::correctVersion) &&
print " C++ compilers where for example a language binding exist:\n";
print " - Solaris, Sun WorkShop 6 update 1 C++ 5.2 2000/09/11 or higher\n";
print " - Linux, GNU C++ compiler, gcc version 4.0.1 or higher\n";
- print " - MacOS, GNU C++ compiler, gcc version 4.0.1 or higher\n";
- print " Enter the directory of the C++ compiler, the directory\n";
- print " where the compiler is located (optional) [$main::OO_SDK_CPP_HOME_SUGGESTION]: ";
+ print " - MacOS 64bit, Apple LLVM version 4.2 (clang-425.0.28) or higher\n";
+ print " on MacOS auto detected using xcrun -f clang'\n";
- $main::OO_SDK_CPP_HOME = readStdIn();
- chop($main::OO_SDK_CPP_HOME);
- if ( $main::OO_SDK_CPP_HOME eq "" )
+ if ( $main::operatingSystem =~ m/darwin/ )
{
+ # xcrun is used to find the correct clang compiler, just print the result as information
$main::OO_SDK_CPP_HOME = $main::OO_SDK_CPP_HOME_SUGGESTION;
+ print " Used clang compiler: $main::OO_SDK_CPP_HOME\n";
+ } else
+ {
+ print " Enter the directory of the C++ compiler, the directory\n";
+ print " where the compiler is located (optional) [$main::OO_SDK_CPP_HOME_SUGGESTION]: ";
+
+ $main::OO_SDK_CPP_HOME = readStdIn();
+ chop($main::OO_SDK_CPP_HOME);
+ if ( $main::OO_SDK_CPP_HOME eq "" )
+ {
+ $main::OO_SDK_CPP_HOME = $main::OO_SDK_CPP_HOME_SUGGESTION;
+ }
}
- if ( ! $main::OO_SDK_CPP_HOME eq "" )
+ if ( (!$main::operatingSystem =~ m/darwin/) && (! $main::OO_SDK_CPP_HOME eq "") )
{
if ( (! -d "$main::OO_SDK_CPP_HOME") ||
((-d "$main::OO_SDK_CPP_HOME") && (! -e "$main::OO_SDK_CPP_HOME/$main::cppName")) )
diff --git a/odk/setsdkenv_unix.sh.in b/odk/setsdkenv_unix.sh.in
index 4055a64..96ced44 100644
--- a/odk/setsdkenv_unix.sh.in
+++ b/odk/setsdkenv_unix.sh.in
@@ -151,7 +151,6 @@ case ${sdk_platform} in
platform='Solaris x86'
fi
comid=C52
- pltfrm=sunpro
soext=so
exampleout=SOLARISexample.out
stldebug=_debug
@@ -162,13 +161,12 @@ case ${sdk_platform} in
darwin*)
if [ -n "$OO_SDK_CPP_HOME" ]
then
- SDK_GXX_INCLUDE_PATH=`echo "#include <cstring>" | ${OO_SDK_CPP_HOME}/g++ -E -xc++ - | sed -n '/.*1*"\(.*\)\/cstring".*/s//\1/p' | head -n 1`
+ SDK_GXX_INCLUDE_PATH=`echo "#include <cstring>" | ${OO_SDK_CPP_HOME}/clang++ -E -xc++ - | sed -n '/.*1*"\(.*\)\/cstring".*/s//\1/p' | head -n 1`
export SDK_GXX_INCLUDE_PATH
fi
directoryname=macosx
- comid=gcc3
- pltfrm=gcc
+ comid=s5abi
soext=dylib
exampleout=MACOSXexample.out
platform=MacOSX
@@ -186,7 +184,6 @@ case ${sdk_platform} in
directoryname=linux
comid=gcc3
- pltfrm=gcc
soext=so
exampleout=LINUXexample.out
platform=Linux
@@ -204,7 +201,6 @@ case ${sdk_platform} in
directoryname=freebsd
comid=gcc3
- pltfrm=gcc
soext=so
exampleout=FREEBSDexample.out
platform=FreeBSD
diff --git a/odk/settings/settings.mk b/odk/settings/settings.mk
index b3f0c43..b4bb4f5 100644
--- a/odk/settings/settings.mk
+++ b/odk/settings/settings.mk
@@ -72,7 +72,6 @@ EXE_EXT=.exe
COPY=copy
SHAREDLIB_EXT=dll
SHAREDLIB_OUT=$(OUT_BIN)
-PACKAGE_LIB_DIR=windows.plt
UNOPKG_PLATFORM=Windows
OSEP=^<
@@ -153,18 +152,15 @@ PROCTYPE := $(shell $(PRJ)/config.guess | cut -d"-" -f1)$(shell /usr/ccs/bin/elf
ifeq "$(PROCTYPE)" "sparc"
PLATFORM=solsparc
-PACKAGE_LIB_DIR=solaris_sparc.plt
UNOPKG_PLATFORM=Solaris_SPARC
JAVA_PROC_TYPE=sparc
else
ifeq "$(PROCTYPE)" "sparc64"
PLATFORM=solsparc
-PACKAGE_LIB_DIR=solaris_sparc64.plt
UNOPKG_PLATFORM=Solaris_SPARC64
JAVA_PROC_TYPE=sparcv9
else
PLATFORM=solintel
-PACKAGE_LIB_DIR=solaris_x86.plt
UNOPKG_PLATFORM=Solaris_x86
JAVA_PROC_TYPE=i386
endif
@@ -260,24 +256,20 @@ ifneq (,$(findstring linux,$(PLATFORM)))
PROCTYPE := $(shell $(PRJ)/config.guess | cut -d "-" -f1 | sed -e 's/^i.86$$/i386/')
PLATFORM=linux
-PACKAGE_LIB_DIR=linux_$(PROCTYPE).plt
UNOPKG_PLATFORM=Linux_$(PROCTYPE)
JAVA_PROC_TYPE=$(PROCTYPE)
ifeq "$(PROCTYPE)" "i386"
-PACKAGE_LIB_DIR=linux_x86.plt
UNOPKG_PLATFORM=Linux_x86
JAVA_PROC_TYPE=i386
endif
ifeq "$(PROCTYPE)" "powerpc"
-PACKAGE_LIB_DIR=linux_powerpc.plt
UNOPKG_PLATFORM=Linux_PowerPC
JAVA_PROC_TYPE=ppc
endif
ifeq "$(PROCTYPE)" "sparc"
-PACKAGE_LIB_DIR=linux_sparc.plt
UNOPKG_PLATFORM=Linux_SPARC
JAVA_PROC_TYPE=sparc
endif
@@ -383,41 +375,30 @@ endif
#
###########################################################################
ifneq (,$(findstring darwin,$(PLATFORM)))
-# Settings for MacOSX using gcc 4.0.1 compiler
+# Settings for MacOSX using LLVM version 4.2 (clang-425.0.28)
PROCTYPE := $(shell $(PRJ)/config.guess | cut -d"-" -f1)
# Default is MacOSX on a Intel machine
PLATFORM=macosx
-ifeq "$(PROCTYPE)" "i386"
-PACKAGE_LIB_DIR=macosx_x86.plt
-UNOPKG_PLATFORM=MacOSX_x86
-JAVA_PROC_TYPE=x86
-else
ifeq "$(PROCTYPE)" "x86_64"
-PACKAGE_LIB_DIR=macosx_x86.plt
-UNOPKG_PLATFORM=MacOSX_x86
-JAVA_PROC_TYPE=x86
-else
-PACKAGE_LIB_DIR=macosx_ppc.plt
-UNOPKG_PLATFORM=MacOSX_PowerPC
-JAVA_PROC_TYPE=ppc
-endif
+UNOPKG_PLATFORM=MacOSX_x86_64
endif
+
JAVABIN=Commands
-GCC_VERSION =$(shell gcc -dumpversion| cut -d"." -f1,2)
-ifeq "$(GCC_VERSION)" "4.2"
-GCC_ARCH_OPTION=-arch i386
-endif
+GCC_ARCH_OPTION=-arch x86_64
OS=MACOSX
PS=/
ICL=\$$
-CC=gcc-$(GCC_VERSION)
-LINK=g++-$(GCC_VERSION)
-LIB=g++-$(GCC_VERSION)
+CC=`xcrun -f clang` -arch x86_64
+CXX=`xcrun -f clang++` -arch x86_64 -std=c++11
+LINK=`xcrun -f clang++` -arch x86_64 -std=c++11
+LIB=`xcrun -f clang++` -arch x86_64 -std=c++11
+INSTALLTOOL=`xcrun -f install_name_tool`
+
ECHO=@echo
MKDIR=mkdir -p
CAT=cat
@@ -428,6 +409,8 @@ SHAREDLIB_OUT=$(OUT_LIB)
COMID=gcc3
CPPU_ENV=gcc3
+COMID=s5abi
+CPPU_ENV=s5abi
OSEP=\<
CSEP=\>
@@ -459,15 +442,16 @@ SALHELPERDYLIB=-Wl,-dylib_file, at ________________________________________________
REGDYLIB=-Wl,-dylib_file, at __________________________________________________URELIB/libreg.dylib.3:'$(OO_SDK_OFFICE_LIB_DIR)/libreg.dylib'
STOREDYLIB=-Wl,-dylib_file, at __________________________________________________URELIB/libstore.dylib.3:'$(OO_SDK_OFFICE_LIB_DIR)/libstore.dylib'
-INSTALL_NAME_URELIBS=install_name_tool -change @__________________________________________________URELIB/libuno_sal.dylib.3 @executable_path/libuno_sal.dylib.3 -change @__________________________________________________URELIB/libuno_cppu.dylib.3 @executable_path/libuno_cppu.dylib.3 -change @__________________________________________________URELIB/libuno_cppuhelper$(COMID).dylib.3 @executable_path/libuno_cppuhelper$(COMID).dylib.3 -change @__________________________________________________URELIB/libuno_salhelper$(COMID).dylib.3 @executable_path/libuno_salhelper$(COMID).dylib.3 -change @__________________________________________________URELIB/libreg.dylib.3 @executable_path/libreg.dylib.3 -change @__________________________________________________URELIB/libstore.dylib.3 @executable_path/libstore.dylib.3
+INSTALL_NAME_URELIBS=$(INSTALLTOOL) -change @__________________________________________________URELIB/libuno_sal.dylib.3 @executable_path/libuno_sal.dylib.3 -change @__________________________________________________URELIB/libuno_cppu.dylib.3 @executable_path/libuno_cppu.dylib.3 -change @__________________________________________________URELIB/libuno_cppuhelper$(COMID).dylib.3 @executable_path/libuno_cppuhelper$(COMID).dylib.3 -change @__________________________________________________URELIB/libuno_salhelper$(COMID).dylib.3 @executable_path/libuno_salhelper$(COMID).dylib.3 -change @__________________________________________________URELIB/libreg.dylib.3 @executable_path/libreg.dylib.3 -change @__________________________________________________URELIB/libstore.dylib.3 @executable_path/libstore.dylib.3
-INSTALL_NAME_URELIBS_BIN=install_name_tool -change @__________________________________________________URELIB/libuno_sal.dylib.3 libuno_sal.dylib.3 -change @__________________________________________________URELIB/libuno_cppu.dylib.3 libuno_cppu.dylib.3 -change @__________________________________________________URELIB/libuno_cppuhelper$(COMID).dylib.3 libuno_cppuhelper$(COMID).dylib.3 -change @__________________________________________________URELIB/libuno_salhelper$(COMID).dylib.3 libuno_salhelper$(COMID).dylib.3 -change @__________________________________________________URELIB/libreg.dylib.3 libreg.dylib.3 -change @__________________________________________________URELIB/libstore.dylib.3 libstore.dylib.3
+INSTALL_NAME_URELIBS_BIN=$(INSTALLTOOL) -change @__________________________________________________URELIB/libuno_sal.dylib.3 libuno_sal.dylib.3 -change @__________________________________________________URELIB/libuno_cppu.dylib.3 libuno_cppu.dylib.3 -change @__________________________________________________URELIB/libuno_cppuhelper$(COMID).dylib.3 libuno_cppuhelper$(COMID).dylib.3 -change @__________________________________________________URELIB/libuno_salhelper$(COMID).dylib.3 libuno_salhelper$(COMID).dylib.3 -change @__________________________________________________URELIB/libreg.dylib.3 libreg.dylib.3 -change @__________________________________________________URELIB/libstore.dylib.3 libstore.dylib.3
EMPTYSTRING=
PATH_SEPARATOR=:
-CC_FLAGS_JNI=-malign-natural -c -fPIC -fno-common $(GCC_ARCH_OPTION)
-CC_FLAGS=-malign-natural -c -fPIC -fno-common $(GCC_ARCH_OPTION) -fvisibility=hidden
+CC_FLAGS_JNI=-c -fPIC -fno-common $(GCC_ARCH_OPTION)
+CC_FLAGS=-c -fPIC -fno-common $(GCC_ARCH_OPTION) -fvisibility=hidden
+
# -O is necessary for inlining (see gcc documentation)
ifeq "$(DEBUG)" "yes"
CC_FLAGS_JNI+=-g
@@ -512,19 +496,15 @@ PROCTYPE := $(shell $(PRJ)/config.guess | cut -d"-" -f1)
ifeq (kfreebsd,$(findstring kfreebsd,$(PLATFORM)))
PLATFORM=kfreebsd
ifeq "$(PROCTYPE)" "x86_64"
-PACKAGE_LIB_DIR=kfreebsd_x86_64.plt
UNOPKG_PLATFORM=kFreeBSD_x86_64
else
-PACKAGE_LIB_DIR=kfreebsd_x86.plt
UNOPKG_PLATFORM=kFreeBSD_x86
endif
else
PLATFORM=freebsd
ifeq "$(PROCTYPE)" "x86_64"
-PACKAGE_LIB_DIR=freebsd_x86_64.plt
UNOPKG_PLATFORM=FreeBSD_x86_64
else
-PACKAGE_LIB_DIR=freebsd_x86.plt
UNOPKG_PLATFORM=FreeBSD_x86
endif
endif
diff --git a/odk/settings/std.mk b/odk/settings/std.mk
index a5b3b2b..65d0961 100644
--- a/odk/settings/std.mk
+++ b/odk/settings/std.mk
@@ -54,13 +54,18 @@ OFFICE_SERVICES="$(subst \\,\,$(OFFICE_PROGRAM_PATH)$(PS)services.rdb)"
OFFICE_TYPE_LIBRARY="$(OFFICE_TYPES)"
-JAVA_OPTIONS=
ifneq "$(OO_SDK_JAVA_HOME)" ""
JAVA_BITS := $(shell $(OO_SDK_JAVA_HOME)/$(JAVABIN)/java -version 2>&1 | tail -1 | cut -d " " -f3)
ifeq "$(JAVA_BITS)" "64-Bit"
-ifneq "$(PLATFORM)" "linux"
-JAVA_OPTIONS=-d32
+JAVA_OPTIONS=-32
+
+ifeq "$(PLATFORM)" "linux"
+JAVA_OPTIONS=
endif
+ifeq "$(PLATFORM)" "macosx"
+JAVA_OPTIONS=
+endif
+
endif
endif
commit c722509338709bcda3d397f9fdde1304c7e6341d
Author: Herbert Dürr <hdu at apache.org>
Date: Thu Jan 23 17:10:13 2014 +0000
#114728# use 10.7 SDK as default, but allow newer SDK in configure
Patch by: Juergen Schmidt <jsc at apache.org>
diff --git a/configure.in b/configure.in
index 443ce47..c3a2ff4 100644
--- a/configure.in
+++ b/configure.in
@@ -937,6 +937,10 @@ AC_ARG_WITH(rat-scan,
a separately installed library.
],with_rat_scan=$withval,)
+AC_ARG_WITH(macosx-sdk-version,
+[ --with-macosx-sdk-version=<version> Specify the MacOSX platform SDK version, default is 10.7. Only 10.7 or higher is supported.
+],,)
+
BUILD_TYPE="OOo"
ADDITIONAL_REPOSITORIES="../ext_libraries"
SCPDEFS=""
@@ -1142,6 +1146,12 @@ case "$build_os" in
echo "Disabling gtk-quickstarter - not supported on Mac. Use --disable-systray" >>warn
enable_systray=no
fi
+ if test ! -n "$CC"; then
+ CC="`xcrun -f clang` -arch x86_64"
+ fi
+ if test ! -n "$CXX"; then
+ CXX="`xcrun -f clang++` -arch x86_64 -std=c++11"
+ fi
;;
os2*)
test_x=no
@@ -3895,6 +3905,44 @@ AC_SUBST(SYSTEM_LIBXML)
AC_SUBST(LIBXML_CFLAGS)
AC_SUBST(LIBXML_LIBS)
+
+dnl ===================================================================
+dnl Checks for MacOS platform SDK. Default is 10.7
+dnl ===================================================================
+if test "$_os" = "Darwin"; then
+ AC_MSG_CHECKING([checking MacOS platform SDK])
+ sdk_version=10.7
+
+ if test -n "$with_macosx_sdk_version"; then
+ sdk_version=$with_macosx_sdk_version
+ fi
+
+ sdk_minor=`echo $sdk_version | cut -d"." -f2`
+
+ if test "$sdk_minor" -lt "7"; then
+ AC_MSG_ERROR([SDK version < 10.7 is not longer supported])
+ else
+ AC_MSG_RESULT([yes])
+ if test "$sdk_minor" -ge "7"; then
+ MACOSX_DEPLOYMENT_TARGET=$sdk_version
+ fi
+
+ sdk_path=`xcodebuild -version -sdk macosx$MACOSX_DEPLOYMENT_TARGET Path`
+ AC_MSG_CHECKING([for $sdk_path])
+ if test -d "$sdk_path"; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_ERROR([No proper MacOS platform SDK, not found])
+ fi
+
+ MACOSX_SDK_PATH=$sdk_path
+ fi
+
+fi
+AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
+AC_SUBST(MACOSX_SDK_PATH)
+
+
dnl ===================================================================
dnl Check for system python
dnl ===================================================================
@@ -3919,10 +3967,10 @@ if test "$_os" = "Darwin" && test "$with_system_python" != "no"; then
if test -d "/Library/Frameworks/Python.framework/Versions/$_python_ver/include/python$_python_ver"; then
PYTHON_CFLAGS="-I/Library/Frameworks/Python.framework/Versions/$_python_ver/include/python$_python_ver"
- elif test -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/python$_python_ver"; then
- PYTHON_CFLAGS="-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/python$_python_ver"
+ elif test -d "$MACOSX_SDK_PATH/usr/include/python$_python_ver"; then
+ PYTHON_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/python$_python_ver"
else
- PYTHON_CFLAGS="-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Python.framework/Versions/$_python_ver/include/python$_python_ver"
+ PYTHON_CFLAGS="-I$MACOSX_SDK_PATH/System/Library/Frameworks/Python.framework/Versions/$_python_ver/include/python$_python_ver"
fi
else
AC_MSG_ERROR([Python 2.7.1 or higher is required])
@@ -4782,6 +4830,7 @@ AC_SUBST(SYSTEM_GRAPHITE)
AC_SUBST(GRAPHITE_LIBS)
AC_SUBST(GRAPHITE_CFLAGS)
+
dnl ===================================================================
dnl Checks for libraries.
dnl ===================================================================
diff --git a/set_soenv.in b/set_soenv.in
index c6370ce..2364a60 100644
--- a/set_soenv.in
+++ b/set_soenv.in
@@ -96,7 +96,7 @@ my ( $oldPATH, $SRC_ROOT, $SO_HOME, $JAVA_HOME, $JDK, $JAVAFLAGS, $OOO_SHELL,
$SOLARSRC, $DEVROOT, $SOLARVER, $SOLARVERSION, $WORKDIR, $OUTDIR, $SOLARENV,
$STAR_INIROOT, $STAR_INIROOTOLD, $STAR_STANDLST, $STAR_SSCOMMON, $STAR_SSOLARINI,
$DMAKEROOT, $CLASSPATH, $XCLASSPATH, $COMPATH, $CXX_X64_BINARY, $LINK_X64_BINARY, $LIBMGR_X64_BINARY,
- $MSPDB_PATH, $MIDL_PATH, $CSC_PATH, $SDK_PATH,
+ $MSPDB_PATH, $MIDL_PATH, $CSC_PATH, $MACOSX_DEPLOYMENT_TARGET, $MACOSX_SDK_PATH,
$PATH, $SOLAREXTRAINC, $SOLAREXTRALIB, $SOLARLIB,
$SOLARINC, $LOCALINI, $FRAMEWORKSHOME, $COMEX, $PERL,
$COMP_ENV, $ILIB, $JAVAHOME, $PSDK_HOME, $DIRECTXSDK_LIB, $USE_NEW_SDK, $FRAME_HOME,
@@ -1440,8 +1440,7 @@ elsif ($platform =~ m/cygwin/)
}
elsif ($platform =~ m/darwin/)
{
- $SDK_PATH = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk";
- $FRAMEWORKSHOME = $SDK_PATH."/System/Library/Frameworks";
+ $FRAMEWORKSHOME = "@MACOSX_SDK_PATH@/System/Library/Frameworks";
my $STLINC .= $I."/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/";
$SOLARINC .= $STLINC . $I.$FRAMEWORKSHOME.$ds."JavaVM.framework".$ds."Headers";
$GUIBASE = "aqua";
@@ -1675,11 +1674,10 @@ if ( $platform =~ m/darwin/ )
{
# MAXOSX_DEPLOYMENT_TARGET : The minimum version required to run the build,
# build can assume functions/libraries of that version to be available
-# unless you want to do runtime checks for 10.5 api, you also want to use the 10.7 sdk
# (safer/easier than dealing with the MAC_OS_X_VERSION_MAX_ALLOWED macro)
# http://developer.apple.com/technotes/tn2002/tn2064.html
- ToFile( "MACOSX_DEPLOYMENT_TARGET", "10.7", "e" );
- ToFile( "SDK_PATH", $SDK_PATH, "e" );
+ ToFile( "MACOSX_DEPLOYMENT_TARGET", "@MACOSX_DEPLOYMENT_TARGET@", "e" );
+ ToFile( "MACOSX_SDK_PATH", "@MACOSX_SDK_PATH@", "e" );
}
#
diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk
index d0d8c4f..3391389 100644
--- a/solenv/gbuild/platform/macosx.mk
+++ b/solenv/gbuild/platform/macosx.mk
@@ -71,9 +71,9 @@ gb_CPUDEFS := -DX86_64
endif
ifeq ($(strip $(SYSBASE)),)
-gb_SDKDIR := $(SDK_PATH)
+ gb_SDKDIR := $(MACOSX_SDK_PATH)
else
-gb_SDKDIR := $(SYSBASE)/MacOSX10.7.sdk
+ gb_SDKDIR := $(SYSBASE)/MacOSX$(MACOSX_DEPLOYMENT_TARGET).sdk
endif
diff --git a/solenv/inc/unxmacc.mk b/solenv/inc/unxmacc.mk
index 84759bb..3688420 100644
--- a/solenv/inc/unxmacc.mk
+++ b/solenv/inc/unxmacc.mk
@@ -40,10 +40,8 @@ CDEFS+=-DGLIBC=2 -D_PTHREADS -D_REENTRANT -DNO_PTHREAD_PRIORITY $(PROCESSOR_DEFI
# (safer/easier than dealing with the MAC_OS_X_VERSION_MAX_ALLOWED macro)
# http://developer.apple.com/technotes/tn2002/tn2064.html
# done in setsolar/configure now. left here for documentation
-#MACOSX_DEPLOYMENT_TARGET=10.7
-#.EXPORT: MACOSX_DEPLOYMENT_TARGET
CDEFS+=-DQUARTZ
-EXTRA_CDEFS*=-isysroot $(SDK_PATH)
+EXTRA_CDEFS*=-isysroot $(MACOSX_SDK_PATH)
# Name of library where static data members are initialized
# STATICLIBNAME=static$(DLLPOSTFIX)
@@ -169,7 +167,7 @@ LINK*=$(CXX)
LINKC*=$(CC)
###LINKFLAGSDEFS*=-Wl,-multiply_defined,suppress
-EXTRA_LINKFLAGS*=-L$(SDK_PATH)
+EXTRA_LINKFLAGS*=-L$(MACOSX_SDK_PATH)
# Very long install_names are needed so that install_name_tool -change later on
# does not complain that "larger updated load commands do not fit:"
LINKFLAGSRUNPATH_URELIB=-install_name '@__________________________________________________URELIB/$(@:f)'
commit 8028df6f2840a40f5cdea9a29d6cd1266ea2a6b6
Author: Herbert Dürr <hdu at apache.org>
Date: Thu Jan 23 17:05:32 2014 +0000
#i121715# do not enable java's -d32 option on 32bit capable jre
merged from revision 1560617 in branch rejuvenate01
diff --git a/configure.in b/configure.in
index 5a22c81..443ce47 100644
--- a/configure.in
+++ b/configure.in
@@ -2933,16 +2933,7 @@ if test "$SOLAR_JAVA" != ""; then
JAVAINTERPRETER=`cygpath -d "$JAVAINTERPRETER"`
JAVAINTERPRETER=`cygpath -u "$JAVAINTERPRETER"`
elif test "$_os" = "Darwin"; then
- dnl HACK: There currently is only a 32 bit version of OOo for Mac OS X,
- dnl and Tiger java complains about -d32 while Snow Leopard java needs it
- dnl to run in 32 bit mode and be able to load OOo jnilibs:
- AC_MSG_CHECKING([whether to pass -d32 to Java interpreter])
- if "$JAVAINTERPRETER" -d32 >&5 2>&5; then
- AC_MSG_RESULT([yes])
- JAVAIFLAGS=-d32
- else
- AC_MSG_RESULT([no])
- fi
+ JAVAIFLAGS=""
fi
fi
commit c389daff156f8cff83c992ace60435f24a6cadbe
Author: Herbert Dürr <hdu at apache.org>
Date: Thu Jan 23 17:00:44 2014 +0000
#i123951# switch Mac port to CoreText API
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 1d3d963..59a3195 100755
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -161,8 +161,8 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/aqua/source/dtrans/PictToBmpFlt \
vcl/aqua/source/dtrans/aqua_clipboard \
vcl/aqua/source/dtrans/service_entry \
- vcl/aqua/source/gdi/atslayout \
- vcl/aqua/source/gdi/atsfonts \
+ vcl/aqua/source/gdi/ctfonts \
+ vcl/aqua/source/gdi/ctlayout \
vcl/aqua/source/gdi/salbmp \
vcl/aqua/source/gdi/salcolorutils \
vcl/aqua/source/gdi/salgdi \
diff --git a/vcl/aqua/source/gdi/atsfonts.cxx b/vcl/aqua/source/gdi/atsfonts.cxx
index 4aeb008..ce8d993 100644
--- a/vcl/aqua/source/gdi/atsfonts.cxx
+++ b/vcl/aqua/source/gdi/atsfonts.cxx
@@ -19,24 +19,318 @@
*
*************************************************************/
-
-
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
#include <boost/assert.hpp>
#include <vector>
+#include <hash_map>
#include <set>
+#include "salgdi.h"
+#include "atsfonts.hxx"
+
#include "vcl/svapp.hxx"
+#include "vcl/impfont.hxx"
-#include "aqua/salgdi.h"
-#include "aqua/saldata.hxx"
-#include "atsfonts.hxx"
-#include "impfont.hxx"
+#include "basegfx/polygon/b2dpolygon.hxx"
+#include "basegfx/matrix/b2dhommatrix.hxx"
+
+typedef GlyphID ATSGlyphID;
+
+// =======================================================================
+
+// mac specific physically available font face
+class AtsFontData
+: public ImplMacFontData
+{
+public:
+ explicit AtsFontData( const ImplDevFontAttributes&, ATSUFontID );
+ virtual ~AtsFontData( void );
+ virtual ImplFontData* Clone( void ) const;
+
+ virtual ImplMacTextStyle* CreateMacTextStyle( const ImplFontSelectData& ) const;
+ virtual ImplFontEntry* CreateFontInstance( /*const*/ ImplFontSelectData& ) const;
+ virtual int GetFontTable( const char pTagName[5], unsigned char* ) const;
+};
+
+// =======================================================================
+
+class AtsFontList
+: public SystemFontList
+{
+public:
+ explicit AtsFontList( void );
+ virtual ~AtsFontList( void );
+
+ virtual void AnnounceFonts( ImplDevFontList& ) const;
+ virtual ImplMacFontData* GetFontDataFromId( sal_IntPtr nFontId ) const;
+
+private:
+ typedef std::hash_map<sal_IntPtr,AtsFontData*> AtsFontContainer;
+ AtsFontContainer maFontContainer;
+
+ void InitGlyphFallbacks( void );
+ ATSUFontFallbacks maFontFallbacks;
+};
+
+// =======================================================================
+
+AtsFontData::AtsFontData( const ImplDevFontAttributes& rDFA, ATSUFontID nFontId )
+: ImplMacFontData( rDFA, (sal_IntPtr)nFontId )
+{}
// -----------------------------------------------------------------------
+AtsFontData::~AtsFontData( void )
+{}
+
+// -----------------------------------------------------------------------
+
+ImplFontData* AtsFontData::Clone( void ) const
+{
+ AtsFontData* pClone = new AtsFontData(*this);
+ return pClone;
+}
+
+// -----------------------------------------------------------------------
+
+ImplMacTextStyle* AtsFontData::CreateMacTextStyle( const ImplFontSelectData& rFSD ) const
+{
+ return new AtsTextStyle( rFSD );
+}
+
+// -----------------------------------------------------------------------
+
+ImplFontEntry* AtsFontData::CreateFontInstance( /*const*/ ImplFontSelectData& rFSD ) const
+{
+ return new ImplFontEntry( rFSD );
+}
+
+// -----------------------------------------------------------------------
+
+int AtsFontData::GetFontTable( const char pTagName[5], unsigned char* pResultBuf ) const
+{
+ DBG_ASSERT( aTagName[4]=='\0', "AtsFontData::GetFontTable with invalid tagname!\n" );
+
+ const FourCharCode pTagCode = (pTagName[0]<<24) + (pTagName[1]<<16) + (pTagName[2]<<8) + (pTagName[3]<<0);
+
+ // get the byte size of the raw table
+ ATSFontRef rATSFont = FMGetATSFontRefFromFont( (ATSUFontID)mnFontId );
+ ByteCount nBufSize = 0;
+ OSStatus eStatus = ATSFontGetTable( rATSFont, pTagCode, 0, 0, NULL, &nBufSize );
+ if( eStatus != noErr )
+ return 0;
+
+ // get the raw table data if requested
+ if( pResultBuf && (nBufSize > 0))
+ {
+ ByteCount nRawLength = 0;
+ eStatus = ATSFontGetTable( rATSFont, pTagCode, 0, nBufSize, (void*)pResultBuf, &nRawLength );
+ if( eStatus != noErr )
+ return 0;
+ DBG_ASSERT( (nBufSize==nRawLength), "AtsFontData::GetFontTable ByteCount mismatch!\n");
+ }
+
+ return nBufSize;
+}
+
+// =======================================================================
+
+AtsTextStyle::AtsTextStyle( const ImplFontSelectData& rFSD )
+: ImplMacTextStyle( rFSD )
+{
+ // create the style object for ATSUI font attributes
+ ATSUCreateStyle( &maATSUStyle );
+ const ImplFontSelectData* const pReqFont = &rFSD;
+
+ mpFontData = (AtsFontData*)rFSD.mpFontData;
+
+ // limit the ATS font size to avoid Fixed16.16 overflows
+ double fScaledFontHeight = pReqFont->mfExactHeight;
+ static const float fMaxFontHeight = 144.0;
+ if( fScaledFontHeight > fMaxFontHeight )
+ {
+ mfFontScale = fScaledFontHeight / fMaxFontHeight;
+ fScaledFontHeight = fMaxFontHeight;
+ }
+
+ // convert font rotation to radian
+ mfFontRotation = pReqFont->mnOrientation * (M_PI / 1800.0);
+
+ // determine if font stretching is needed
+ if( (pReqFont->mnWidth != 0) && (pReqFont->mnWidth != pReqFont->mnHeight) )
+ {
+ mfFontStretch = (float)pReqFont->mnWidth / pReqFont->mnHeight;
+ // set text style to stretching matrix
+ CGAffineTransform aMatrix = CGAffineTransformMakeScale( mfFontStretch, 1.0F );
+ const ATSUAttributeTag aMatrixTag = kATSUFontMatrixTag;
+ const ATSUAttributeValuePtr aAttr = &aMatrix;
+ const ByteCount aMatrixBytes = sizeof(aMatrix);
+ /*OSStatus eStatus =*/ ATSUSetAttributes( maATSUStyle, 1, &aMatrixTag, &aMatrixBytes, &aAttr );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+AtsTextStyle::~AtsTextStyle( void )
+{
+ ATSUDisposeStyle( maATSUStyle );
+}
+
+// -----------------------------------------------------------------------
+
+void AtsTextStyle::GetFontMetric( float fDPIY, ImplFontMetricData& rMetric ) const
+{
+ // get the font metrics (in point units)
+ // of the font that has eventually been size-limited
+
+ // get the matching ATSU font handle
+ ATSUFontID fontId;
+ OSStatus err = ::ATSUGetAttribute( maATSUStyle, kATSUFontTag, sizeof(ATSUFontID), &fontId, 0 );
+ DBG_ASSERT( (err==noErr), "AquaSalGraphics::GetFontMetric() : could not get font id\n");
+
+ ATSFontMetrics aMetrics;
+ ATSFontRef rFont = FMGetATSFontRefFromFont( fontId );
+ err = ATSFontGetHorizontalMetrics ( rFont, kATSOptionFlagsDefault, &aMetrics );
+ DBG_ASSERT( (err==noErr), "AquaSalGraphics::GetFontMetric() : could not get font metrics\n");
+ if( err != noErr )
+ return;
+
+ // all ATS fonts are scalable fonts
+ rMetric.mbScalableFont = true;
+ // TODO: check if any kerning is possible
+ rMetric.mbKernableFont = true;
+
+ // convert into VCL font metrics (in unscaled pixel units)
+
+ Fixed ptSize;
+ err = ATSUGetAttribute( maATSUStyle, kATSUSizeTag, sizeof(Fixed), &ptSize, 0);
+ DBG_ASSERT( (err==noErr), "AquaSalGraphics::GetFontMetric() : could not get font size\n");
+ const double fPointSize = Fix2X( ptSize );
+
+ // convert quartz units to pixel units
+ // please see the comment in AquaSalGraphics::SetFont() for details
+ const double fPixelSize = (mfFontScale * fDPIY * fPointSize);
+ rMetric.mnAscent = static_cast<long>(+aMetrics.ascent * fPixelSize + 0.5);
+ rMetric.mnDescent = static_cast<long>(-aMetrics.descent * fPixelSize + 0.5);
+ const long nExtDescent = static_cast<long>((-aMetrics.descent + aMetrics.leading) * fPixelSize + 0.5);
+ rMetric.mnExtLeading = nExtDescent - rMetric.mnDescent;
+ rMetric.mnIntLeading = 0;
+ // since ImplFontMetricData::mnWidth is only used for stretching/squeezing fonts
+ // setting this width to the pixel height of the fontsize is good enough
+ // it also makes the calculation of the stretch factor simple
+ rMetric.mnWidth = static_cast<long>(mfFontStretch * fPixelSize + 0.5);
+}
+
+// -----------------------------------------------------------------------
+
+void AtsTextStyle::SetTextColor( const RGBAColor& rColor )
+{
+ RGBColor aAtsColor;
+ aAtsColor.red = (unsigned short)( rColor.GetRed() * 65535.0 );
+ aAtsColor.green = (unsigned short)( rColor.GetGreen() * 65535.0 );
+ aAtsColor.blue = (unsigned short)( rColor.GetColor() * 65535.0 );
+
+ ATSUAttributeTag aTag = kATSUColorTag;
+ ByteCount aValueSize = sizeof( aAtsColor );
+ ATSUAttributeValuePtr aValue = &aAtsColor;
+
+ /*OSStatus err =*/ ATSUSetAttributes( maATSUStyle, 1, &aTag, &aValueSize, &aValue );
+}
+
+// -----------------------------------------------------------------------
+
+bool AtsTextStyle::GetGlyphBoundRect( sal_GlyphId aGlyphId, Rectangle& rRect ) const
+{
+ ATSUStyle rATSUStyle = maATSUStyle; // TODO: handle glyph fallback
+ ATSGlyphID aGlyphId = aGlyphId;
+ ATSGlyphScreenMetrics aGlyphMetrics;
+ const bool bNonAntialiasedText = false;
+ OSStatus eStatus = ATSUGlyphGetScreenMetrics( rATSUStyle,
+ 1, &aGlyphId, 0, FALSE, !bNonAntialiasedText, &aGlyphMetrics );
+ if( eStatus != noErr )
+ return false;
+
+ const long nMinX = (long)(+aGlyphMetrics.topLeft.x * mfFontScale - 0.5);
+ const long nMaxX = (long)(aGlyphMetrics.width * mfFontScale + 0.5) + nMinX;
+ const long nMinY = (long)(-aGlyphMetrics.topLeft.y * mfFontScale - 0.5);
+ const long nMaxY = (long)(aGlyphMetrics.height * mfFontScale + 0.5) + nMinY;
+ rRect = Rectangle( nMinX, nMinY, nMaxX, nMaxY );
+ return true;
+}
+
+// -----------------------------------------------------------------------
+
+// callbacks from ATSUGlyphGetCubicPaths() fore GetGlyphOutline()
+struct GgoData { basegfx::B2DPolygon maPolygon; basegfx::B2DPolyPolygon* mpPolyPoly; };
+
+static OSStatus GgoLineToProc( const Float32Point* pPoint, void* pData )
+{
+ basegfx::B2DPolygon& rPolygon = static_cast<GgoData*>(pData)->maPolygon;
+ const basegfx::B2DPoint aB2DPoint( pPoint->x, pPoint->y );
+ rPolygon.append( aB2DPoint );
+ return noErr;
+}
+
+static OSStatus GgoCurveToProc( const Float32Point* pCP1, const Float32Point* pCP2,
+ const Float32Point* pPoint, void* pData )
+{
+ basegfx::B2DPolygon& rPolygon = static_cast<GgoData*>(pData)->maPolygon;
+ const sal_uInt32 nPointCount = rPolygon.count();
+ const basegfx::B2DPoint aB2DControlPoint1( pCP1->x, pCP1->y );
+ rPolygon.setNextControlPoint( nPointCount-1, aB2DControlPoint1 );
+ const basegfx::B2DPoint aB2DEndPoint( pPoint->x, pPoint->y );
+ rPolygon.append( aB2DEndPoint );
+ const basegfx::B2DPoint aB2DControlPoint2( pCP2->x, pCP2->y );
+ rPolygon.setPrevControlPoint( nPointCount, aB2DControlPoint2 );
+ return noErr;
+}
+
+static OSStatus GgoClosePathProc( void* pData )
+{
+ GgoData* pGgoData = static_cast<GgoData*>(pData);
+ basegfx::B2DPolygon& rPolygon = pGgoData->maPolygon;
+ if( rPolygon.count() > 0 )
+ pGgoData->mpPolyPoly->append( rPolygon );
+ rPolygon.clear();
+ return noErr;
+}
+
+static OSStatus GgoMoveToProc( const Float32Point* pPoint, void* pData )
+{
+ GgoClosePathProc( pData );
+ OSStatus eStatus = GgoLineToProc( pPoint, pData );
+ return eStatus;
+}
+
+bool AtsTextStyle::GetGlyphOutline( sal_GlyphId aGlyphId, basegfx::B2DPolyPolygon& rResult ) const
+{
+ GgoData aGgoData;
+ aGgoData.mpPolyPoly = &rResult;
+ rResult.clear();
+
+ OSStatus eGgoStatus = noErr;
+ OSStatus eStatus = ATSUGlyphGetCubicPaths( maATSUStyle, aGlyphId,
+ GgoMoveToProc, GgoLineToProc, GgoCurveToProc, GgoClosePathProc,
+ &aGgoData, &eGgoStatus );
+ if( (eStatus != noErr) ) // TODO: why is (eGgoStatus!=noErr) when curves are involved?
+ return false;
+
+ GgoClosePathProc( &aGgoData );
+
+ // apply the font scale
+ if( mfFontScale != 1.0 ) {
+ basegfx::B2DHomMatrix aScale;
+ aScale.scale( +mfFontScale, +mfFontScale );
+ rResult.transform( aScale );
+ }
+
+ return true;
+}
+
+// =======================================================================
+
static bool GetDevFontAttributes( ATSUFontID nFontID, ImplDevFontAttributes& rDFA )
{
// all ATSU fonts are device fonts that can be directly rotated
@@ -62,6 +356,9 @@ static bool GetDevFontAttributes( ATSUFontID nFontID, ImplDevFontAttributes& rDF
// all scalable fonts on this platform are subsettable
rDFA.mbSubsettable = true;
rDFA.mbEmbeddable = false;
+ // TODO: these members are needed only for our X11 platform targets
+ rDFA.meAntiAlias = ANTIALIAS_DONTKNOW;
+ rDFA.meEmbeddedBitmap = EMBEDDEDBITMAP_DONTKNOW;
// prepare iterating over all name strings of the font
ItemCount nFontNameCount = 0;
@@ -109,16 +406,16 @@ static bool GetDevFontAttributes( ATSUFontID nFontID, ImplDevFontAttributes& rDF
case 0x301: nNameValue += 27; break; // Win UCS-2
case 0x004: // UCS-4
case 0x30A: nNameValue += 0; // Win-UCS-4
- eEncoding = RTL_TEXTENCODING_UCS4;
- break;
+ eEncoding = RTL_TEXTENCODING_UCS4;
+ break;
case 0x100: nNameValue += 21; // Mac Roman
- eEncoding = RTL_TEXTENCODING_APPLE_ROMAN;
- break;
+ eEncoding = RTL_TEXTENCODING_APPLE_ROMAN;
+ break;
case 0x300: nNameValue = 0; // Win Symbol encoded name!
- rDFA.mbSymbolFlag = true; // (often seen for symbol fonts)
- break;
- default: nNameValue = 0; // ignore other encodings
- break;
+ rDFA.mbSymbolFlag = true; // (often seen for symbol fonts)
+ break;
+ default: nNameValue = 0; // ignore other encodings
+ break;
}
// ignore name entries with no useful encoding
@@ -130,7 +427,7 @@ static bool GetDevFontAttributes( ATSUFontID nFontID, ImplDevFontAttributes& rDF
// get the encoded name
aNameBuffer.reserve( nNameLength+1 ); // extra byte helps for debugging
rc = ATSUGetIndFontName( nFontID, nNameIndex, nNameLength, &aNameBuffer[0],
- &nNameLength, &eFontNameCode, &eFontNamePlatform, &eFontNameScript, &eFontNameLanguage );
+ &nNameLength, &eFontNameCode, &eFontNamePlatform, &eFontNameScript, &eFontNameLanguage );
if( rc != noErr )
continue;
@@ -150,112 +447,43 @@ static bool GetDevFontAttributes( ATSUFontID nFontID, ImplDevFontAttributes& rDF
// handle the name depending on its namecode
switch( eFontNameCode )
{
- case kFontFamilyName:
- // ignore font names starting with '.'
- if( aUtf16Name.GetChar(0) == '.' )
- nNameValue = 0;
- else if( rDFA.maName.Len() )
- {
- // even if a family name is not the one we are looking for
- // it is still useful as a font name alternative
- if( rDFA.maMapNames.Len() )
- rDFA.maMapNames += ';';
- rDFA.maMapNames += (nBestNameValue < nNameValue) ? rDFA.maName : aUtf16Name;
- }
- if( nBestNameValue < nNameValue )
- {
- // get the best family name
- nBestNameValue = nNameValue;
- eBestLangCode = eFontNameLanguage;
- rDFA.maName = aUtf16Name;
- }
- break;
- case kFontStyleName:
- // get a style name matching to the family name
- if( nBestStyleValue < nNameValue )
- {
- nBestStyleValue = nNameValue;
- rDFA.maStyleName = aUtf16Name;
- }
- break;
- case kFontPostscriptName:
- // use the postscript name to get some useful info
- UpdateAttributesFromPSName( aUtf16Name, rDFA );
- break;
- default:
- // TODO: use other name entries too?
- break;
- }
- }
-
-#if 0 // multiple-master fonts are mostly obsolete nowadays
- // if we still want to support them this should probably be done one frame higher
- ItemCount nMaxInstances = 0;
- rc = ATSUCountFontInstances ( nFontID, &nMaxInstances );
- for( ItemCount nInstanceIndex = 0; nInstanceIndex < nMaxInstances; ++nInstanceIndex )
- {
- ItemCount nMaxVariations = 0;
- rc = ATSUGetFontInstance( nFontID, nInstanceIndex, 0, NULL, NULL, &nMaxVariations );
- if( (rc == noErr) && (nMaxVariations > 0) )
- {
- fprintf(stderr,"\tnMaxVariations=%d\n",(int)nMaxVariations);
- typedef ::std::vector<ATSUFontVariationAxis> VariationAxisVector;
- typedef ::std::vector<ATSUFontVariationValue> VariationValueVector;
- VariationAxisVector aVariationAxes( nMaxVariations );
- VariationValueVector aVariationValues( nMaxVariations );
- ItemCount nVariationCount = 0;
- rc = ATSUGetFontInstance ( nFontID, nInstanceIndex, nMaxVariations,
- &aVariationAxes[0], &aVariationValues[0], &nVariationCount );
- fprintf(stderr,"\tnVariationCount=%d\n",(int)nVariationCount);
- for( ItemCount nVariationIndex = 0; nVariationIndex < nMaxVariations; ++nVariationIndex )
+ case kFontFamilyName:
+ // ignore font names starting with '.'
+ if( aUtf16Name.GetChar(0) == '.' )
+ nNameValue = 0;
+ else if( rDFA.maName.Len() )
{
- const char* pTag = (const char*)&aVariationAxes[nVariationIndex];
- fprintf(stderr,"\tvariation[%d] \'%c%c%c%c\' is %d\n", (int)nVariationIndex,
- pTag[3],pTag[2],pTag[1],pTag[0], (int)aVariationValues[nVariationIndex]);
+ // even if a family name is not the one we are looking for
+ // it is still useful as a font name alternative
+ if( rDFA.maMapNames.Len() )
+ rDFA.maMapNames += ';';
+ rDFA.maMapNames += (nBestNameValue < nNameValue) ? rDFA.maName : aUtf16Name;
}
- }
- }
-#endif
-
-#if 0 // selecting non-defaulted font features is not enabled yet
- ByteString aFName( rDFA.maName, RTL_TEXTENCODING_UTF8 );
- ByteString aSName( rDFA.maStyleName, RTL_TEXTENCODING_UTF8 );
- ItemCount nMaxFeatures = 0;
- rc = ATSUCountFontFeatureTypes( nFontID, &nMaxFeatures );
- fprintf(stderr,"Font \"%s\" \"%s\" has %d features\n",aFName.GetBuffer(),aSName.GetBuffer(),rc);
- if( (rc == noErr) && (nMaxFeatures > 0) )
- {
- typedef std::vector<ATSUFontFeatureType> FeatureVector;
- FeatureVector aFeatureVector( nMaxFeatures );
- ItemCount nFeatureCount = 0;
- rc = ATSUGetFontFeatureTypes( nFontID, nMaxFeatures, &aFeatureVector[0], &nFeatureCount );
- fprintf(stderr,"nFeatureCount=%d\n",(int)nFeatureCount);
- for( ItemCount nFeatureIndex = 0; nFeatureIndex < nFeatureCount; ++nFeatureIndex )
- {
- ItemCount nMaxSelectors = 0;
- rc = ATSUCountFontFeatureSelectors( nFontID, aFeatureVector[nFeatureIndex], &nMaxSelectors );
- fprintf(stderr,"\tFeature[%d] = %d has %d selectors\n",
- (int)nFeatureIndex, (int)aFeatureVector[nFeatureIndex], (int)nMaxSelectors );
- typedef std::vector<ATSUFontFeatureSelector> SelectorVector;
- SelectorVector aSelectorVector( nMaxSelectors );
- typedef std::vector<MacOSBoolean> BooleanVector;
- BooleanVector aEnabledVector( nMaxSelectors );
- BooleanVector aExclusiveVector( nMaxSelectors );
- ItemCount nSelectorCount = 0;
- rc = ATSUGetFontFeatureSelectors ( nFontID, aFeatureVector[nFeatureIndex], nMaxSelectors,
- &aSelectorVector[0], &aEnabledVector[0], &nSelectorCount, &aExclusiveVector[0]);
- for( ItemCount nSelectorIndex = 0; nSelectorIndex < nSelectorCount; ++nSelectorIndex )
+ if( nBestNameValue < nNameValue )
+ {
+ // get the best family name
+ nBestNameValue = nNameValue;
+ eBestLangCode = eFontNameLanguage;
+ rDFA.maName = aUtf16Name;
+ }
+ break;
+ case kFontStyleName:
+ // get a style name matching to the family name
+ if( nBestStyleValue < nNameValue )
{
- FontNameCode eFontNameCode;
- rc = ATSUGetFontFeatureNameCode( nFontID, aFeatureVector[nFeatureIndex],
- aSelectorVector[nSelectorIndex], &eFontNameCode );
- fprintf(stderr,"\t\tselector[%d] n=%d e=%d, x=%d\n",
- (int)nSelectorIndex, (int)eFontNameCode,
- aEnabledVector[nSelectorIndex], aExclusiveVector[nSelectorIndex] );
+ nBestStyleValue = nNameValue;
+ rDFA.maStyleName = aUtf16Name;
}
+ break;
+ case kFontPostscriptName:
+ // use the postscript name to get some useful info
+ UpdateAttributesFromPSName( aUtf16Name, rDFA );
+ break;
+ default:
+ // TODO: use other name entries too?
+ break;
}
}
-#endif
bool bRet = (rDFA.maName.Len() > 0);
return bRet;
@@ -263,21 +491,28 @@ static bool GetDevFontAttributes( ATSUFontID nFontID, ImplDevFontAttributes& rDF
// =======================================================================
-SystemFontList::SystemFontList()
+SystemFontList* GetAtsFontList( void )
+{
+ return new AtsFontList();
+}
+
+// =======================================================================
+
+AtsFontList::AtsFontList()
{
// count available system fonts
ItemCount nATSUICompatibleFontsAvailable = 0;
if( ATSUFontCount(&nATSUICompatibleFontsAvailable) != noErr )
return;
if( nATSUICompatibleFontsAvailable <= 0 )
- return;
+ return;
// enumerate available system fonts
typedef std::vector<ATSUFontID> AtsFontIDVector;
AtsFontIDVector aFontIDVector( nATSUICompatibleFontsAvailable );
ItemCount nFontItemsCount = 0;
if( ATSUGetFontIDs( &aFontIDVector[0], aFontIDVector.capacity(), &nFontItemsCount ) != noErr )
- return;
+ return;
BOOST_ASSERT(nATSUICompatibleFontsAvailable == nFontItemsCount && "Strange I would expect them to be equal");
@@ -285,11 +520,11 @@ SystemFontList::SystemFontList()
AtsFontIDVector::const_iterator it = aFontIDVector.begin();
for(; it != aFontIDVector.end(); ++it )
{
- const ATSUFontID nFontID = *it;
+ const ATSUFontID nFontID = *it;
ImplDevFontAttributes aDevFontAttr;
if( !GetDevFontAttributes( nFontID, aDevFontAttr ) )
continue;
- ImplMacFontData* pFontData = new ImplMacFontData( aDevFontAttr, nFontID );
+ AtsFontData* pFontData = new AtsFontData( aDevFontAttr, nFontID );
maFontContainer[ nFontID ] = pFontData;
}
@@ -298,9 +533,9 @@ SystemFontList::SystemFontList()
// -----------------------------------------------------------------------
-SystemFontList::~SystemFontList()
+AtsFontList::~AtsFontList()
{
- MacFontContainer::const_iterator it = maFontContainer.begin();
+ AtsFontContainer::const_iterator it = maFontContainer.begin();
for(; it != maFontContainer.end(); ++it )
delete (*it).second;
maFontContainer.clear();
@@ -310,15 +545,25 @@ SystemFontList::~SystemFontList()
// -----------------------------------------------------------------------
-void SystemFontList::AnnounceFonts( ImplDevFontList& rFontList ) const
+void AtsFontList::AnnounceFonts( ImplDevFontList& rFontList ) const
{
- MacFontContainer::const_iterator it = maFontContainer.begin();
+ AtsFontContainer::const_iterator it = maFontContainer.begin();
for(; it != maFontContainer.end(); ++it )
rFontList.Add( (*it).second->Clone() );
}
// -----------------------------------------------------------------------
+ImplMacFontData* AtsFontList::GetFontDataFromId( sal_IntPtr nFontId ) const
+{
+ AtsFontContainer::const_iterator it = maFontContainer.find( nFontId );
+ if( it == maFontContainer.end() )
+ return NULL;
+ return (*it).second;
+}
+
+// -----------------------------------------------------------------------
+
// not all fonts are suitable for glyph fallback => sort them
struct GfbCompare{ bool operator()(const ImplMacFontData*, const ImplMacFontData*); };
@@ -352,18 +597,20 @@ inline bool GfbCompare::operator()( const ImplMacFontData* pA, const ImplMacFont
return false;
}
-void SystemFontList::InitGlyphFallbacks()
+// -----------------------------------------------------------------------
+
+void AtsFontList::InitGlyphFallbacks()
{
// sort fonts for "glyph fallback"
typedef std::multiset<const ImplMacFontData*,GfbCompare> FallbackSet;
FallbackSet aFallbackSet;
- MacFontContainer::const_iterator it = maFontContainer.begin();
+ AtsFontContainer::const_iterator it = maFontContainer.begin();
for(; it != maFontContainer.end(); ++it )
{
- const ImplMacFontData* pIFD = (*it).second;
- // TODO: subsettable/embeddable glyph fallback only for PDF export?
+ const ImplMacFontData* pIFD = (*it).second;
+ // TODO: subsettable/embeddable glyph fallback only for PDF export?
if( pIFD->IsSubsettable() || pIFD->IsEmbeddable() )
- aFallbackSet.insert( pIFD );
+ aFallbackSet.insert( pIFD );
}
// tell ATSU about font preferences for "glyph fallback"
@@ -383,15 +630,5 @@ void SystemFontList::InitGlyphFallbacks()
aFallbackVector.size(), &aFallbackVector[0], kATSUSequentialFallbacksPreferred );
}
-// -----------------------------------------------------------------------
-
-ImplMacFontData* SystemFontList::GetFontDataFromId( ATSUFontID nFontId ) const
-{
- MacFontContainer::const_iterator it = maFontContainer.find( nFontId );
- if( it == maFontContainer.end() )
- return NULL;
- return (*it).second;
-}
-
-// -----------------------------------------------------------------------
+// =======================================================================
diff --git a/vcl/aqua/source/gdi/atsfonts.hxx b/vcl/aqua/source/gdi/atsfonts.hxx
index e2218de..66ae628 100644
--- a/vcl/aqua/source/gdi/atsfonts.hxx
+++ b/vcl/aqua/source/gdi/atsfonts.hxx
@@ -19,39 +19,27 @@
*
*************************************************************/
-#ifndef _ATSFONTS_HXX
-#define _ATSFONTS_HXX
+// =======================================================================
-class ImplMacFontData;
-class ImplDevFontList;
-
-#include <premac.h>
-#include <ApplicationServices/ApplicationServices.h>
-#include <postmac.h>
-
-#include <map>
-
-/* This class has the responsibility of assembling a list
- of atsui compatible fonts available on the system and
- enabling access to that list.
- */
-class SystemFontList
+class AtsTextStyle
+: public ImplMacTextStyle
{
public:
- SystemFontList();
- ~SystemFontList();
+ explicit AtsTextStyle( const ImplFontSelectData& );
+ virtual ~AtsTextStyle( void );
- void AnnounceFonts( ImplDevFontList& ) const;
- ImplMacFontData* GetFontDataFromId( ATSUFontID ) const;
+ virtual SalLayout* GetTextLayout( void ) const;
- ATSUFontFallbacks maFontFallbacks;
+ virtual void GetFontMetric( float fDPIY, ImplFontMetricData& ) const;
+ virtual bool GetGlyphBoundRect( sal_GlyphId, Rectangle& ) const;
+ virtual bool GetGlyphOutline( sal_GlyphId, basegfx::B2DPolyPolygon& ) const;
-private:
- typedef std::hash_map<ATSUFontID,ImplMacFontData*> MacFontContainer;
- MacFontContainer maFontContainer;
+ virtual void SetTextColor( const RGBAColor& );
- void InitGlyphFallbacks();
+private:
+ /// ATSU text style object
+ ATSUStyle maATSUStyle;
};
-#endif // _ATSFONTS_HXX
+// =======================================================================
diff --git a/vcl/aqua/source/gdi/atslayout.cxx b/vcl/aqua/source/gdi/atslayout.cxx
index 049777b..c75e727 100644
--- a/vcl/aqua/source/gdi/atslayout.cxx
+++ b/vcl/aqua/source/gdi/atslayout.cxx
@@ -37,14 +37,14 @@
class ATSLayout : public SalLayout
{
public:
- ATSLayout( ATSUStyle&, float fFontScale );
+ explicit ATSLayout( ATSUStyle&, float fFontScale );
virtual ~ATSLayout();
virtual bool LayoutText( ImplLayoutArgs& );
virtual void AdjustLayout( ImplLayoutArgs& );
virtual void DrawText( SalGraphics& ) const;
- virtual int GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, int&,
+ virtual int GetNextGlyphs( int nLen, sal_GlyphId* pOutGlyphIds, Point& rPos, int&,
sal_Int32* pGlyphAdvances, int* pCharIndexes ) const;
virtual long GetTextWidth() const;
@@ -110,7 +110,7 @@ private:
class FallbackInfo
{
public:
- FallbackInfo() : mnMaxLevel(0) {}
+ FallbackInfo() : mnMaxLevel(0) {}
int AddFallback( ATSUFontID );
const ImplFontData* GetFallbackFontData( int nLevel ) const;
@@ -219,23 +219,12 @@ bool ATSLayout::LayoutText( ImplLayoutArgs& rArgs )
if( mnCharCount<=0 )
return false;
-#if (OSL_DEBUG_LEVEL > 3)
- Fixed fFontSize = 0;
- ByteCount nDummy;
- ATSUGetAttribute( mrATSUStyle, kATSUSizeTag, sizeof(fFontSize), &fFontSize, &nDummy);
- String aUniName( &rArgs.mpStr[rArgs.mnMinCharPos], mnCharCount );
- ByteString aCName( aUniName, RTL_TEXTENCODING_UTF8 );
- fprintf( stderr, "ATSLayout( \"%s\" %d..%d of %d) with h=%4.1f\n",
- aCName.GetBuffer(),rArgs.mnMinCharPos,rArgs.mnEndCharPos,rArgs.mnLength,Fix2X(fFontSize) );
-#endif
-
// create the ATSUI layout
UniCharCount nRunLengths[1] = { mnCharCount };
const int nRunCount = sizeof(nRunLengths)/sizeof(*nRunLengths);
OSStatus eStatus = ATSUCreateTextLayoutWithTextPtr( rArgs.mpStr,
rArgs.mnMinCharPos, mnCharCount, rArgs.mnLength,
- nRunCount, &nRunLengths[0], &mrATSUStyle,
- &maATSULayout);
+ nRunCount, &nRunLengths[0], &mrATSUStyle, &maATSULayout);
DBG_ASSERT( (eStatus==noErr), "ATSUCreateTextLayoutWithTextPtr failed\n");
if( eStatus != noErr )
@@ -271,7 +260,7 @@ bool ATSLayout::LayoutText( ImplLayoutArgs& rArgs )
aTagSizes[0] = sizeof( nLineDirTag );
aTagValues[0] = &nLineDirTag;
// set run-specific layout controls
-#if 0 // why don't line-controls work as reliably as layout-controls???
+#if 0 // why don't line-controls work as reliable as layout-controls???
ATSUSetLineControls( maATSULayout, rArgs.mnMinCharPos, 1, aTagAttrs, aTagSizes, aTagValues );
#else
ATSUSetLayoutControls( maATSULayout, 1, aTagAttrs, aTagSizes, aTagValues );
@@ -454,8 +443,8 @@ void ATSLayout::DrawText( SalGraphics& rGraphics ) const
drawRect.top -= d;
drawRect.bottom += d;
CGRect aRect = CGRectMake( drawRect.left, drawRect.top,
- drawRect.right - drawRect.left,
- drawRect.bottom - drawRect.top );
+ drawRect.right - drawRect.left,
+ drawRect.bottom - drawRect.top );
aRect = CGContextConvertRectToDeviceSpace( rAquaGraphics.mrContext, aRect );
rAquaGraphics.RefreshRect( aRect );
}
@@ -539,7 +528,7 @@ int ATSLayout::GetNextGlyphs( int nLen, sal_GlyphId* pOutGlyphIds, Point& rPos,
while( nCount < nLen )
{
++nCount;
- sal_GlyphId aGlyphId = mpGlyphIds[ nStart];
+ sal_GlyphId aGlyphId = mpGlyphIds[nStart];
// check if glyph fallback is needed for this glyph
// TODO: use ATSUDirectGetLayoutDataArrayPtrFromTextLayout(kATSUDirectDataStyleIndex) API instead?
@@ -548,7 +537,7 @@ int ATSLayout::GetNextGlyphs( int nLen, sal_GlyphId* pOutGlyphIds, Point& rPos,
UniCharArrayOffset nChangedOffset = 0;
UniCharCount nChangedLength = 0;
OSStatus eStatus = ATSUMatchFontsToText( maATSULayout, nCharPos, kATSUToTextEnd,
- &nFallbackFontID, &nChangedOffset, &nChangedLength );
+ &nFallbackFontID, &nChangedOffset, &nChangedLength );
if( (eStatus == kATSUFontsMatched) && ((int)nChangedOffset == nCharPos) )
{
// fallback is needed
diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx
index 672c33a..aee2512 100644
--- a/vcl/aqua/source/gdi/salgdi.cxx
+++ b/vcl/aqua/source/gdi/salgdi.cxx
@@ -19,8 +19,6 @@
*
*************************************************************/
-
-
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
@@ -46,23 +44,41 @@
#include "aqua/salbmp.h"
#include "aqua/salframe.h"
#include "aqua/salcolorutils.hxx"
+#ifdef USE_ATSU
#include "atsfonts.hxx"
+#else // !USE_ATSU
+#include "ctfonts.hxx"
+#endif
#include "fontsubset.hxx"
#include "impfont.hxx"
#include "sallayout.hxx"
#include "sft.hxx"
-
using namespace vcl;
-//typedef unsigned char Boolean; // copied from MacTypes.h, should be properly included
-typedef std::vector<unsigned char> ByteVector;
+// =======================================================================
+
+SystemFontList::~SystemFontList( void )
+{}
+
+// =======================================================================
+
+ImplMacTextStyle::ImplMacTextStyle( const ImplFontSelectData& rReqFont )
+: mpFontData( (ImplMacFontData*)rReqFont.mpFontData )
+, mfFontScale( 1.0 )
+, mfFontStretch( 1.0 )
+, mfFontRotation( 0.0 )
+{}
+// -----------------------------------------------------------------------
+
+ImplMacTextStyle::~ImplMacTextStyle( void )
+{}
// =======================================================================
-ImplMacFontData::ImplMacFontData( const ImplDevFontAttributes& rDFA, ATSUFontID nFontId )
+ImplMacFontData::ImplMacFontData( const ImplDevFontAttributes& rDFA, sal_IntPtr nFontId )
: ImplFontData( rDFA, 0 )
, mnFontId( nFontId )
, mpCharMap( NULL )
@@ -74,27 +90,32 @@ ImplMacFontData::ImplMacFontData( const ImplDevFontAttributes& rDFA, ATSUFontID
// -----------------------------------------------------------------------
-ImplMacFontData::~ImplMacFontData()
+ImplMacFontData::ImplMacFontData( const ImplMacFontData& rSrc )
+: ImplFontData( rSrc)
+, mnFontId( rSrc.mnFontId)
+, mpCharMap( rSrc.mpCharMap)
+, mbOs2Read( rSrc.mbOs2Read)
+, mbHasOs2Table( rSrc.mbHasOs2Table)
+, mbCmapEncodingRead( rSrc.mbCmapEncodingRead)
+, mbHasCJKSupport( rSrc.mbHasCJKSupport)
{
if( mpCharMap )
- mpCharMap->DeReference();
+ mpCharMap->AddReference();
}
// -----------------------------------------------------------------------
-sal_IntPtr ImplMacFontData::GetFontId() const
+ImplMacFontData::~ImplMacFontData()
{
- return (sal_IntPtr)mnFontId;
+ if( mpCharMap )
+ mpCharMap->DeReference();
}
// -----------------------------------------------------------------------
-ImplFontData* ImplMacFontData::Clone() const
+sal_IntPtr ImplMacFontData::GetFontId() const
{
- ImplMacFontData* pClone = new ImplMacFontData(*this);
- if( mpCharMap )
- mpCharMap->AddReference();
- return pClone;
+ return reinterpret_cast<sal_IntPtr>( mnFontId);
}
// -----------------------------------------------------------------------
@@ -106,11 +127,6 @@ ImplFontEntry* ImplMacFontData::CreateFontInstance(ImplFontSelectData& rFSD) con
// -----------------------------------------------------------------------
-inline FourCharCode GetTag(const char aTagName[5])
-{
- return (aTagName[0]<<24)+(aTagName[1]<<16)+(aTagName[2]<<8)+(aTagName[3]);
-}
-
static unsigned GetUShort( const unsigned char* p ){return((p[0]<<8)+p[1]);}
static unsigned GetUInt( const unsigned char* p ) { return((p[0]<<24)+(p[1]<<16)+(p[2]<<8)+p[3]);}
@@ -125,27 +141,23 @@ const ImplFontCharMap* ImplMacFontData::GetImplFontCharMap() const
mpCharMap->AddReference();
// get the CMAP byte size
- ATSFontRef rFont = FMGetATSFontRefFromFont( mnFontId );
- ByteCount nBufSize = 0;
- OSStatus eStatus = ATSFontGetTable( rFont, GetTag("cmap"), 0, 0, NULL, &nBufSize );
- DBG_ASSERT( (eStatus==noErr), "ImplMacFontData::GetImplFontCharMap : ATSFontGetTable1 failed!\n");
- if( eStatus != noErr )
- return mpCharMap;
-
// allocate a buffer for the CMAP raw data
- ByteVector aBuffer( nBufSize );
+ const int nBufSize = GetFontTable( "cmap", NULL );
+ DBG_ASSERT( (nBufSize > 0), "ImplMacFontData::GetImplFontCharMap : FontGetTable1 failed!\n");
+ if( nBufSize <= 0 )
+ return mpCharMap;
// get the CMAP raw data
- ByteCount nRawLength = 0;
- eStatus = ATSFontGetTable( rFont, GetTag("cmap"), 0, nBufSize, (void*)&aBuffer[0], &nRawLength );
- DBG_ASSERT( (eStatus==noErr), "ImplMacFontData::GetImplFontCharMap : ATSFontGetTable2 failed!\n");
- if( eStatus != noErr )
+ ByteVector aBuffer( nBufSize );
+ const int nRawSize = GetFontTable( "cmap", &aBuffer[0] );
+ DBG_ASSERT( (nRawSize > 0), "ImplMacFontData::GetImplFontCharMap : ATSFontGetTable2 failed!\n");
+ if( nRawSize <= 0 )
return mpCharMap;
- DBG_ASSERT( (nBufSize==nRawLength), "ImplMacFontData::GetImplFontCharMap : ByteCount mismatch!\n");
+ DBG_ASSERT( (nBufSize==nRawSize), "ImplMacFontData::GetImplFontCharMap : ByteCount mismatch!\n");
// parse the CMAP
CmapResult aCmapResult;
- if( ParseCMAP( &aBuffer[0], nRawLength, aCmapResult ) )
+ if( ParseCMAP( &aBuffer[0], nRawSize, aCmapResult ) )
{
// create the matching charmap
mpCharMap->DeReference();
@@ -164,25 +176,21 @@ void ImplMacFontData::ReadOs2Table( void ) const
if( mbOs2Read )
return;
mbOs2Read = true;
+ mbHasOs2Table = false;
// prepare to get the OS/2 table raw data
- ATSFontRef rFont = FMGetATSFontRefFromFont( mnFontId );
- ByteCount nBufSize = 0;
- OSStatus eStatus = ATSFontGetTable( rFont, GetTag("OS/2"), 0, 0, NULL, &nBufSize );
- DBG_ASSERT( (eStatus==noErr), "ImplMacFontData::ReadOs2Table : ATSFontGetTable1 failed!\n");
- if( eStatus != noErr )
+ const int nBufSize = GetFontTable( "OS/2", NULL );
+ DBG_ASSERT( (nBufSize > 0), "ImplMacFontData::ReadOs2Table : FontGetTable1 failed!\n");
+ if( nBufSize <= 0 )
return;
- // allocate a buffer for the OS/2 raw data
- ByteVector aBuffer( nBufSize );
-
// get the OS/2 raw data
- ByteCount nRawLength = 0;
- eStatus = ATSFontGetTable( rFont, GetTag("OS/2"), 0, nBufSize, (void*)&aBuffer[0], &nRawLength );
- DBG_ASSERT( (eStatus==noErr), "ImplMacFontData::ReadOs2Table : ATSFontGetTable2 failed!\n");
- if( eStatus != noErr )
+ ByteVector aBuffer( nBufSize );
+ const int nRawSize = GetFontTable( "cmap", &aBuffer[0] );
+ DBG_ASSERT( (nRawSize > 0), "ImplMacFontData::ReadOs2Table : ATSFontGetTable2 failed!\n");
+ if( nRawSize <= 0 )
return;
- DBG_ASSERT( (nBufSize==nRawLength), "ImplMacFontData::ReadOs2Table : ByteCount mismatch!\n");
+ DBG_ASSERT( (nBufSize == nRawSize), "ImplMacFontData::ReadOs2Table : ByteCount mismatch!\n");
mbHasOs2Table = true;
// parse the OS/2 raw data
@@ -193,7 +201,7 @@ void ImplMacFontData::ReadOs2Table( void ) const
const sal_uInt32 nVersion = GetUShort( pOS2map );
if( nVersion >= 0x0001 )
{
- sal_uInt32 ulUnicodeRange2 = GetUInt( pOS2map + 46 );
+ const sal_uInt32 ulUnicodeRange2 = GetUInt( pOS2map + 46 );
if( ulUnicodeRange2 & 0x2DF00000 )
mbHasCJKSupport = true;
}
@@ -206,37 +214,27 @@ void ImplMacFontData::ReadMacCmapEncoding( void ) const
return;
mbCmapEncodingRead = true;
- ATSFontRef rFont = FMGetATSFontRefFromFont( mnFontId );
- ByteCount nBufSize = 0;
- OSStatus eStatus = ATSFontGetTable( rFont, GetTag("cmap"), 0, 0, NULL, &nBufSize );
- DBG_ASSERT( (eStatus==noErr), "ImplMacFontData::ReadMacCmapEncoding : ATSFontGetTable1 failed!\n");
- if( eStatus != noErr )
+ const int nBufSize = GetFontTable( "cmap", NULL );
+ if( nBufSize <= 0 )
return;
+ // get the CMAP raw data
ByteVector aBuffer( nBufSize );
-
- ByteCount nRawLength = 0;
- eStatus = ATSFontGetTable( rFont, GetTag("cmap"), 0, nBufSize, (void*)&aBuffer[0], &nRawLength );
- DBG_ASSERT( (eStatus==noErr), "ImplMacFontData::ReadMacCmapEncoding : ATSFontGetTable2 failed!\n");
- if( eStatus != noErr )
+ const int nRawSize = GetFontTable( "cmap", &aBuffer[0] );
+ if( nRawSize < 24 )
return;
- DBG_ASSERT( (nBufSize==nRawLength), "ImplMacFontData::ReadMacCmapEncoding : ByteCount mismatch!\n");
const unsigned char* pCmap = &aBuffer[0];
-
- if (nRawLength < 24 )
- return;
if( GetUShort( pCmap ) != 0x0000 )
return;
// check if the fonts needs the "CJK extra leading" heuristic
int nSubTables = GetUShort( pCmap + 2 );
-
for( const unsigned char* p = pCmap + 4; --nSubTables >= 0; p += 8 )
{
int nPlatform = GetUShort( p );
if( nPlatform == kFontMacintoshPlatform ) {
- int nEncoding = GetUShort (p + 2 );
+ const int nEncoding = GetUShort (p + 2 );
if( nEncoding == kFontJapaneseScript ||
nEncoding == kFontTraditionalChineseScript ||
nEncoding == kFontKoreanScript ||
@@ -278,30 +276,21 @@ AquaSalGraphics::AquaSalGraphics()
, maLineColor( COL_WHITE )
, maFillColor( COL_BLACK )
, mpMacFontData( NULL )
- , mnATSUIRotation( 0 )
- , mfFontScale( 1.0 )
- , mfFontStretch( 1.0 )
+ , mpMacTextStyle( NULL )
+ , maTextColor( COL_BLACK )
, mbNonAntialiasedText( false )
, mbPrinter( false )
, mbVirDev( false )
, mbWindow( false )
-{
- // create the style object for font attributes
- ATSUCreateStyle( &maATSUStyle );
-}
+{}
// -----------------------------------------------------------------------
AquaSalGraphics::~AquaSalGraphics()
{
-/*
- if( mnUpdateGraphicsEvent )
- {
- Application::RemoveUserEvent( mnUpdateGraphicsEvent );
- }
-*/
CGPathRelease( mxClipPath );
- ATSUDisposeStyle( maATSUStyle );
+
+ delete mpMacTextStyle;
if( mpXorEmulation )
delete mpXorEmulation;
@@ -322,12 +311,13 @@ bool AquaSalGraphics::supportsOperation( OutDevSupportType eType ) const
bool bRet = false;
switch( eType )
{
- case OutDevSupport_TransparentRect:
- case OutDevSupport_B2DClip:
- case OutDevSupport_B2DDraw:
- bRet = true;
- break;
- default: break;
+ case OutDevSupport_TransparentRect:
+ case OutDevSupport_B2DClip:
+ case OutDevSupport_B2DDraw:
+ bRet = true;
+ break;
+ default:
+ break;
}
return bRet;
}
@@ -1606,66 +1596,16 @@ bool AquaSalGraphics::drawAlphaRect( long nX, long nY, long nWidth,
void AquaSalGraphics::SetTextColor( SalColor nSalColor )
{
- RGBColor color;
- color.red = (unsigned short) ( SALCOLOR_RED(nSalColor) * 65535.0 / 255.0 );
- color.green = (unsigned short) ( SALCOLOR_GREEN(nSalColor) * 65535.0 / 255.0 );
- color.blue = (unsigned short) ( SALCOLOR_BLUE(nSalColor) * 65535.0 / 255.0 );
-
- ATSUAttributeTag aTag = kATSUColorTag;
- ByteCount aValueSize = sizeof( color );
- ATSUAttributeValuePtr aValue = &color;
-
- OSStatus err = ATSUSetAttributes( maATSUStyle, 1, &aTag, &aValueSize, &aValue );
- DBG_ASSERT( (err==noErr), "AquaSalGraphics::SetTextColor() : Could not set font attributes!\n");
- if( err != noErr )
- return;
+ maTextColor = RGBAColor( nSalColor );
+ if( mpMacTextStyle)
+ mpMacTextStyle->SetTextColor( maTextColor );
}
// -----------------------------------------------------------------------
-void AquaSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackLevel )
+void AquaSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int /*nFallbackLevel*/ )
{
- (void)nFallbackLevel; // glyph-fallback on ATSU is done differently -> no fallback level
-
- // get the ATSU font metrics (in point units)
- // of the font that has eventually been size-limited
-
- ATSUFontID fontId;
- OSStatus err = ATSUGetAttribute( maATSUStyle, kATSUFontTag, sizeof(ATSUFontID), &fontId, 0 );
- DBG_ASSERT( (err==noErr), "AquaSalGraphics::GetFontMetric() : could not get font id\n");
-
- ATSFontMetrics aMetrics;
- ATSFontRef rFont = FMGetATSFontRefFromFont( fontId );
- err = ATSFontGetHorizontalMetrics ( rFont, kATSOptionFlagsDefault, &aMetrics );
- DBG_ASSERT( (err==noErr), "AquaSalGraphics::GetFontMetric() : could not get font metrics\n");
- if( err != noErr )
- return;
-
- // all ATS fonts are scalable fonts
- pMetric->mbScalableFont = true;
- // TODO: check if any kerning is possible
- pMetric->mbKernableFont = true;
-
- // convert into VCL font metrics (in unscaled pixel units)
-
- Fixed ptSize;
- err = ATSUGetAttribute( maATSUStyle, kATSUSizeTag, sizeof(Fixed), &ptSize, 0);
- DBG_ASSERT( (err==noErr), "AquaSalGraphics::GetFontMetric() : could not get font size\n");
- const double fPointSize = Fix2X( ptSize );
-
- // convert quartz units to pixel units
- // please see the comment in AquaSalGraphics::SetFont() for details
- const double fPixelSize = (mfFontScale * mfFakeDPIScale * fPointSize);
- pMetric->mnAscent = static_cast<long>(+aMetrics.ascent * fPixelSize + 0.5);
- pMetric->mnDescent = static_cast<long>(-aMetrics.descent * fPixelSize + 0.5);
- const long nExtDescent = static_cast<long>((-aMetrics.descent + aMetrics.leading) * fPixelSize + 0.5);
- pMetric->mnExtLeading = nExtDescent - pMetric->mnDescent;
- pMetric->mnIntLeading = 0;
- // ATSFontMetrics.avgAdvanceWidth is obsolete, so it is usually set to zero
- // since ImplFontMetricData::mnWidth is only used for stretching/squeezing fonts
- // setting this width to the pixel height of the fontsize is good enough
- // it also makes the calculation of the stretch factor simple
- pMetric->mnWidth = static_cast<long>(mfFontStretch * fPixelSize + 0.5);
+ mpMacTextStyle->GetFontMetric( mfFakeDPIScale, *pMetric );
}
// -----------------------------------------------------------------------
@@ -1759,8 +1699,15 @@ void AquaSalGraphics::GetDevFontList( ImplDevFontList* pFontList )
// through it as should be all event handlers
SalData* pSalData = GetSalData();
- if (pSalData->mpFontList == NULL)
- pSalData->mpFontList = new SystemFontList();
+#ifdef USE_ATSU
+ SystemFontList* GetAtsFontList(void); // forward declaration
+ if( !pSalData->mpFontList )
+ pSalData->mpFontList = GetAtsFontList();
+#else
+ SystemFontList* GetCoretextFontList(void); // forward declaration
+ if( !pSalData->mpFontList )
+ pSalData->mpFontList = GetCoretextFontList();
+#endif // DISABLE_ATSUI
// Copy all ImplFontData objects contained in the SystemFontList
pSalData->mpFontList->AnnounceFonts( *pFontList );
@@ -1810,71 +1757,6 @@ bool AquaSalGraphics::AddTempDevFont( ImplDevFontList*,
// -----------------------------------------------------------------------
-// callbacks from ATSUGlyphGetCubicPaths() fore GetGlyphOutline()
-struct GgoData { basegfx::B2DPolygon maPolygon; basegfx::B2DPolyPolygon* mpPolyPoly; };
-
-static OSStatus GgoLineToProc( const Float32Point* pPoint, void* pData )
-{
- basegfx::B2DPolygon& rPolygon = static_cast<GgoData*>(pData)->maPolygon;
- const basegfx::B2DPoint aB2DPoint( pPoint->x, pPoint->y );
- rPolygon.append( aB2DPoint );
- return noErr;
-}
-
-static OSStatus GgoCurveToProc( const Float32Point* pCP1, const Float32Point* pCP2,
- const Float32Point* pPoint, void* pData )
-{
- basegfx::B2DPolygon& rPolygon = static_cast<GgoData*>(pData)->maPolygon;
- const sal_uInt32 nPointCount = rPolygon.count();
- const basegfx::B2DPoint aB2DControlPoint1( pCP1->x, pCP1->y );
- rPolygon.setNextControlPoint( nPointCount-1, aB2DControlPoint1 );
- const basegfx::B2DPoint aB2DEndPoint( pPoint->x, pPoint->y );
- rPolygon.append( aB2DEndPoint );
- const basegfx::B2DPoint aB2DControlPoint2( pCP2->x, pCP2->y );
- rPolygon.setPrevControlPoint( nPointCount, aB2DControlPoint2 );
- return noErr;
-}
-
-static OSStatus GgoClosePathProc( void* pData )
-{
- GgoData* pGgoData = static_cast<GgoData*>(pData);
- basegfx::B2DPolygon& rPolygon = pGgoData->maPolygon;
- if( rPolygon.count() > 0 )
- pGgoData->mpPolyPoly->append( rPolygon );
- rPolygon.clear();
- return noErr;
-}
-
-static OSStatus GgoMoveToProc( const Float32Point* pPoint, void* pData )
-{
- GgoClosePathProc( pData );
- OSStatus eStatus = GgoLineToProc( pPoint, pData );
- return eStatus;
-}
-
-bool AquaSalGraphics::GetGlyphOutline( sal_GlyphId aGlyphId, basegfx::B2DPolyPolygon& rPolyPoly )
-{
- GgoData aGgoData;
- aGgoData.mpPolyPoly = &rPolyPoly;
- rPolyPoly.clear();
-
- ATSUStyle rATSUStyle = maATSUStyle; // TODO: handle glyph fallback when CWS pdffix02 is integrated
- OSStatus eGgoStatus = noErr;
- OSStatus eStatus = ATSUGlyphGetCubicPaths( rATSUStyle, aGlyphId,
- GgoMoveToProc, GgoLineToProc, GgoCurveToProc, GgoClosePathProc,
- &aGgoData, &eGgoStatus );
- if( (eStatus != noErr) ) // TODO: why is (eGgoStatus!=noErr) when curves are involved?
- return false;
-
- GgoClosePathProc( &aGgoData );
- if( mfFontScale != 1.0 ) {
- rPolyPoly.transform(basegfx::tools::createScaleB2DHomMatrix(+mfFontScale, +mfFontScale));
- }
- return true;
-}
-
-// -----------------------------------------------------------------------
-
long AquaSalGraphics::GetGraphicsWidth() const
{
long w = 0;
@@ -1896,20 +1778,16 @@ long AquaSalGraphics::GetGraphicsWidth() const
bool AquaSalGraphics::GetGlyphBoundRect( sal_GlyphId aGlyphId, Rectangle& rRect )
{
- ATSUStyle rATSUStyle = maATSUStyle; // TODO: handle glyph fallback
- ATSGlyphScreenMetrics aGlyphMetrics;
- GlyphID nAtsGlyphId = aGlyphId;
- OSStatus eStatus = ATSUGlyphGetScreenMetrics( rATSUStyle,
- 1, &nAtsGlyphId, 0, FALSE, !mbNonAntialiasedText, &aGlyphMetrics );
- if( eStatus != noErr )
- return false;
+ const bool bRC = mpMacTextStyle->GetGlyphBoundRect( aGlyphId, rRect );
+ return bRC;
+}
- const long nMinX = (long)(+aGlyphMetrics.topLeft.x * mfFontScale - 0.5);
- const long nMaxX = (long)(aGlyphMetrics.width * mfFontScale + 0.5) + nMinX;
- const long nMinY = (long)(-aGlyphMetrics.topLeft.y * mfFontScale - 0.5);
- const long nMaxY = (long)(aGlyphMetrics.height * mfFontScale + 0.5) + nMinY;
- rRect = Rectangle( nMinX, nMinY, nMaxX, nMaxY );
- return true;
+// -----------------------------------------------------------------------
+
+bool AquaSalGraphics::GetGlyphOutline( sal_GlyphId aGlyphId, basegfx::B2DPolyPolygon& rPolyPoly )
+{
+ const bool bRC = mpMacTextStyle->GetGlyphOutline( aGlyphId, rPolyPoly );
+ return bRC;
}
// -----------------------------------------------------------------------
@@ -1922,138 +1800,40 @@ void AquaSalGraphics::GetDevFontSubstList( OutputDevice* )
// -----------------------------------------------------------------------
void AquaSalGraphics::DrawServerFontLayout( const ServerFontLayout& )
-{
-}
+{}
// -----------------------------------------------------------------------
sal_uInt16 AquaSalGraphics::SetFont( ImplFontSelectData* pReqFont, int /*nFallbackLevel*/ )
{
- if( !pReqFont )
- {
- ATSUClearStyle( maATSUStyle );
- mpMacFontData = NULL;
- return 0;
- }
-
- // store the requested device font entry
- const ImplMacFontData* pMacFont = static_cast<const ImplMacFontData*>( pReqFont->mpFontData );
- mpMacFontData = pMacFont;
+ // release the text style
+ delete mpMacTextStyle;
+ mpMacTextStyle = NULL;
- // convert pixel units (as seen by upper layers) to typographic point units
- double fScaledAtsHeight = pReqFont->mfExactHeight;
- // avoid Fixed16.16 overflows by limiting the ATS font size
- static const float fMaxAtsHeight = 144.0;
- if( fScaledAtsHeight <= fMaxAtsHeight )
- mfFontScale = 1.0;
- else
- {
- mfFontScale = fScaledAtsHeight / fMaxAtsHeight;
- fScaledAtsHeight = fMaxAtsHeight;
- }
- Fixed fFixedSize = FloatToFixed( fScaledAtsHeight );
- // enable bold-emulation if needed
- Boolean bFakeBold = FALSE;
- if( (pReqFont->GetWeight() >= WEIGHT_BOLD)
- && (pMacFont->GetWeight() < WEIGHT_SEMIBOLD) )
- bFakeBold = TRUE;
- // enable italic-emulation if needed
- Boolean bFakeItalic = FALSE;
- if( ((pReqFont->GetSlant() == ITALIC_NORMAL) || (pReqFont->GetSlant() == ITALIC_OBLIQUE))
- && !((pMacFont->GetSlant() == ITALIC_NORMAL) || (pMacFont->GetSlant() == ITALIC_OBLIQUE)) )
- bFakeItalic = TRUE;
-
- // enable/disable antialiased text
- mbNonAntialiasedText = pReqFont->mbNonAntialiased;
- UInt32 nStyleRenderingOptions = kATSStyleNoOptions;
- if( pReqFont->mbNonAntialiased )
- nStyleRenderingOptions |= kATSStyleNoAntiAliasing;
-
- // set horizontal/vertical mode
- ATSUVerticalCharacterType aVerticalCharacterType = kATSUStronglyHorizontal;
- if( pReqFont->mbVertical )
- aVerticalCharacterType = kATSUStronglyVertical;
-
- // prepare ATS-fontid as type matching to the kATSUFontTag request
- ATSUFontID nFontID = static_cast<ATSUFontID>(pMacFont->GetFontId());
-
- // update ATSU style attributes with requested font parameters
- // TODO: no need to set styles which are already defaulted
-
- const ATSUAttributeTag aTag[] =
- {
- kATSUFontTag,
- kATSUSizeTag,
- kATSUQDBoldfaceTag,
- kATSUQDItalicTag,
- kATSUStyleRenderingOptionsTag,
- kATSUVerticalCharacterTag
- };
-
- const ByteCount aValueSize[] =
- {
- sizeof(ATSUFontID),
- sizeof(fFixedSize),
- sizeof(bFakeBold),
- sizeof(bFakeItalic),
- sizeof(nStyleRenderingOptions),
- sizeof(aVerticalCharacterType)
- };
-
- const ATSUAttributeValuePtr aValue[] =
- {
- &nFontID,
- &fFixedSize,
- &bFakeBold,
- &bFakeItalic,
- &nStyleRenderingOptions,
- &aVerticalCharacterType
- };
-
- static const int nTagCount = sizeof(aTag) / sizeof(*aTag);
- OSStatus eStatus = ATSUSetAttributes( maATSUStyle, nTagCount,
- aTag, aValueSize, aValue );
- // reset ATSUstyle if there was an error
- if( eStatus != noErr )
+ // handle NULL request meaning: release-font-resources request
+ if( !pReqFont )
{
- DBG_WARNING( "AquaSalGraphics::SetFont() : Could not set font attributes!\n");
- ATSUClearStyle( maATSUStyle );
mpMacFontData = NULL;
return 0;
}
- // prepare font stretching
- const ATSUAttributeTag aMatrixTag = kATSUFontMatrixTag;
- if( (pReqFont->mnWidth == 0) || (pReqFont->mnWidth == pReqFont->mnHeight) )
- {
- mfFontStretch = 1.0;
- ATSUClearAttributes( maATSUStyle, 1, &aMatrixTag );
- }
- else
- {
- mfFontStretch = (float)pReqFont->mnWidth / pReqFont->mnHeight;
- CGAffineTransform aMatrix = CGAffineTransformMakeScale( mfFontStretch, 1.0F );
- const ATSUAttributeValuePtr aAttr = &aMatrix;
- const ByteCount aMatrixBytes = sizeof(aMatrix);
- eStatus = ATSUSetAttributes( maATSUStyle, 1, &aMatrixTag, &aMatrixBytes, &aAttr );
- DBG_ASSERT( (eStatus==noErr), "AquaSalGraphics::SetFont() : Could not set font matrix\n");
- }
-
- // prepare font rotation
- mnATSUIRotation = FloatToFixed( pReqFont->mnOrientation / 10.0 );
+ // update the text style
+ mpMacFontData = static_cast<const ImplMacFontData*>( pReqFont->mpFontData );
+ mpMacTextStyle = mpMacFontData->CreateMacTextStyle( *pReqFont );
+ mpMacTextStyle->SetTextColor( maTextColor );
-#if OSL_DEBUG_LEVEL > 3
+#if (OSL_DEBUG_LEVEL > 3)
fprintf( stderr, "SetFont to (\"%s\", \"%s\", fontid=%d) for (\"%s\" \"%s\" weight=%d, slant=%d size=%dx%d orientation=%d)\n",
- ::rtl::OUStringToOString( pMacFont->GetFamilyName(), RTL_TEXTENCODING_UTF8 ).getStr(),
- ::rtl::OUStringToOString( pMacFont->GetStyleName(), RTL_TEXTENCODING_UTF8 ).getStr(),
- (int)nFontID,
- ::rtl::OUStringToOString( pReqFont->GetFamilyName(), RTL_TEXTENCODING_UTF8 ).getStr(),
- ::rtl::OUStringToOString( pReqFont->GetStyleName(), RTL_TEXTENCODING_UTF8 ).getStr(),
- pReqFont->GetWeight(),
- pReqFont->GetSlant(),
- pReqFont->mnHeight,
- pReqFont->mnWidth,
- pReqFont->mnOrientation);
+ ::rtl::OUStringToOString( mpMacFontData->GetFamilyName(), RTL_TEXTENCODING_UTF8 ).getStr(),
+ ::rtl::OUStringToOString( mpMacFontData->GetStyleName(), RTL_TEXTENCODING_UTF8 ).getStr(),
+ (int)pMacFont->GetFontId(),
+ ::rtl::OUStringToOString( mpMacFontData->GetFamilyName(), RTL_TEXTENCODING_UTF8 ).getStr(),
+ ::rtl::OUStringToOString( mpMacFontData->GetStyleName(), RTL_TEXTENCODING_UTF8 ).getStr(),
+ pReqFont->GetWeight(),
+ pReqFont->GetSlant(),
+ pReqFont->mnHeight,
+ pReqFont->mnWidth,
+ pReqFont->mnOrientation);
#endif
return 0;
@@ -2061,6 +1841,14 @@ sal_uInt16 AquaSalGraphics::SetFont( ImplFontSelectData* pReqFont, int /*nFallba
// -----------------------------------------------------------------------
+SalLayout* AquaSalGraphics::GetTextLayout( ImplLayoutArgs& /*rArgs*/, int /*nFallbackLevel*/ )
+{
+ SalLayout* pSalLayout = mpMacTextStyle->GetTextLayout();
+ return pSalLayout;
+}
+
+// -----------------------------------------------------------------------
+
const ImplFontCharMap* AquaSalGraphics::GetImplFontCharMap() const
{
if( !mpMacFontData )
@@ -2073,17 +1861,17 @@ const ImplFontCharMap* AquaSalGraphics::GetImplFontCharMap() const
// fake a SFNT font directory entry for a font table
// see http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6.html#Directory
-static void FakeDirEntry( FourCharCode eFCC, ByteCount nOfs, ByteCount nLen,
+static void FakeDirEntry( const char aTag[5], ByteCount nOfs, ByteCount nLen,
const unsigned char* /*pData*/, unsigned char*& rpDest )
{
// write entry tag
- rpDest[ 0] = (char)(eFCC >> 24);
- rpDest[ 1] = (char)(eFCC >> 16);
- rpDest[ 2] = (char)(eFCC >> 8);
- rpDest[ 3] = (char)(eFCC >> 0);
+ rpDest[ 0] = aTag[0];
+ rpDest[ 1] = aTag[1];
+ rpDest[ 2] = aTag[2];
+ rpDest[ 3] = aTag[3];
// TODO: get entry checksum and write it
- // not too important since the subsetter doesn't care currently
- // for( pData+nOfs ... pData+nOfs+nLen )
+ // not too important since the subsetter doesn't care currently
+ // for( pData+nOfs ... pData+nOfs+nLen )
// write entry offset
rpDest[ 8] = (char)(nOfs >> 24);
rpDest[ 9] = (char)(nOfs >> 16);
@@ -2098,88 +1886,82 @@ static void FakeDirEntry( FourCharCode eFCC, ByteCount nOfs, ByteCount nLen,
rpDest += 16;
}
+// fake a TTF or CFF font as directly accessing font file is not possible
+// when only the fontid is known. This approach also handles *.dfont fonts.
static bool GetRawFontData( const ImplFontData* pFontData,
ByteVector& rBuffer, bool* pJustCFF )
{
const ImplMacFontData* pMacFont = static_cast<const ImplMacFontData*>(pFontData);
- const ATSUFontID nFontId = static_cast<ATSUFontID>(pMacFont->GetFontId());
- ATSFontRef rFont = FMGetATSFontRefFromFont( nFontId );
- ByteCount nCffLen = 0;
- OSStatus eStatus = ATSFontGetTable( rFont, GetTag("CFF "), 0, 0, NULL, &nCffLen);
+ // short circuit for CFF-only fonts
+ const int nCffSize = pMacFont->GetFontTable( "CFF ", NULL);
if( pJustCFF != NULL )
{
- *pJustCFF = (eStatus == noErr) && (nCffLen > 0);
- if( *pJustCFF )
+ *pJustCFF = (nCffSize > 0);
+ if( *pJustCFF)
{
- rBuffer.resize( nCffLen );
- eStatus = ATSFontGetTable( rFont, GetTag("CFF "), 0, nCffLen, (void*)&rBuffer[0], &nCffLen);
- if( (eStatus != noErr) || (nCffLen <= 0) )
+ rBuffer.resize( nCffSize);
+ const int nCffRead = pMacFont->GetFontTable( "CFF ", &rBuffer[0]);
+ if( nCffRead != nCffSize)
return false;
return true;
}
}
// get font table availability and size in bytes
- ByteCount nHeadLen = 0;
- eStatus = ATSFontGetTable( rFont, GetTag("head"), 0, 0, NULL, &nHeadLen);
- if( (eStatus != noErr) || (nHeadLen <= 0) )
+ const int nHeadSize = pMacFont->GetFontTable( "head", NULL);
+ if( nHeadSize <= 0)
return false;
- ByteCount nMaxpLen = 0;
- eStatus = ATSFontGetTable( rFont, GetTag("maxp"), 0, 0, NULL, &nMaxpLen);
- if( (eStatus != noErr) || (nMaxpLen <= 0) )
+ const int nMaxpSize = pMacFont->GetFontTable( "maxp", NULL);
+ if( nMaxpSize <= 0)
return false;
- ByteCount nCmapLen = 0;
- eStatus = ATSFontGetTable( rFont, GetTag("cmap"), 0, 0, NULL, &nCmapLen);
- if( (eStatus != noErr) || (nCmapLen <= 0) )
+ const int nCmapSize = pMacFont->GetFontTable( "cmap", NULL);
+ if( nCmapSize <= 0)
return false;
- ByteCount nNameLen = 0;
- eStatus = ATSFontGetTable( rFont, GetTag("name"), 0, 0, NULL, &nNameLen);
- if( (eStatus != noErr) || (nNameLen <= 0) )
+ const int nNameSize = pMacFont->GetFontTable( "name", NULL);
+ if( nNameSize <= 0)
return false;
- ByteCount nHheaLen = 0;
- eStatus = ATSFontGetTable( rFont, GetTag("hhea"), 0, 0, NULL, &nHheaLen);
- if( (eStatus != noErr) || (nHheaLen <= 0) )
+ const int nHheaSize = pMacFont->GetFontTable( "hhea", NULL);
+ if( nHheaSize <= 0)
return false;
- ByteCount nHmtxLen = 0;
- eStatus = ATSFontGetTable( rFont, GetTag("hmtx"), 0, 0, NULL, &nHmtxLen);
- if( (eStatus != noErr) || (nHmtxLen <= 0) )
+ const int nHmtxSize = pMacFont->GetFontTable( "hmtx", NULL);
+ if( nHmtxSize <= 0)
return false;
- // get the glyph outline tables
- ByteCount nLocaLen = 0;
- ByteCount nGlyfLen = 0;
- if( (eStatus != noErr) || (nCffLen <= 0) )
+ // get the ttf-glyf outline tables
+ int nLocaSize = 0;
+ int nGlyfSize = 0;
+ if( nCffSize <= 0)
{
- eStatus = ATSFontGetTable( rFont, GetTag("loca"), 0, 0, NULL, &nLocaLen);
- if( (eStatus != noErr) || (nLocaLen <= 0) )
+ nLocaSize = pMacFont->GetFontTable( "loca", NULL);
+ if( nLocaSize <= 0)
return false;
- eStatus = ATSFontGetTable( rFont, GetTag("glyf"), 0, 0, NULL, &nGlyfLen);
- if( (eStatus != noErr) || (nGlyfLen <= 0) )
+ nGlyfSize = pMacFont->GetFontTable( "glyf", NULL);
+ if( nGlyfSize <= 0)
return false;
}
- ByteCount nPrepLen=0, nCvtLen=0, nFpgmLen=0;
- if( nGlyfLen ) // TODO: reduce PDF size by making hint subsetting optional
+ int nPrepSize = 0, nCvtSize = 0, nFpgmSize = 0;
+ if( nGlyfSize) // TODO: reduce PDF size by making hint subsetting optional
{
- eStatus = ATSFontGetTable( rFont, GetTag("prep"), 0, 0, NULL, &nPrepLen);
- eStatus = ATSFontGetTable( rFont, GetTag("cvt "), 0, 0, NULL, &nCvtLen);
- eStatus = ATSFontGetTable( rFont, GetTag("fpgm"), 0, 0, NULL, &nFpgmLen);
+ nPrepSize = pMacFont->GetFontTable( "prep", NULL);
+ nCvtSize = pMacFont->GetFontTable( "cvt ", NULL);
+ nFpgmSize = pMacFont->GetFontTable( "fpgm", NULL);
}
// prepare a byte buffer for a fake font
int nTableCount = 7;
- nTableCount += (nPrepLen>0) + (nCvtLen>0) + (nFpgmLen>0) + (nGlyfLen>0);
- const ByteCount nFdirLen = 12 + 16*nTableCount;
- ByteCount nTotalLen = nFdirLen;
- nTotalLen += nHeadLen + nMaxpLen + nNameLen + nCmapLen;
- if( nGlyfLen )
- nTotalLen += nLocaLen + nGlyfLen;
+ nTableCount += (nPrepSize>0) + (nCvtSize>0) + (nFpgmSize>0) + (nGlyfSize>0);
+ const ByteCount nFdirSize = 12 + 16*nTableCount;
+ ByteCount nTotalSize = nFdirSize;
+ nTotalSize += nHeadSize + nMaxpSize + nNameSize + nCmapSize;
+ if( nGlyfSize )
+ nTotalSize += nLocaSize + nGlyfSize;
else
- nTotalLen += nCffLen;
- nTotalLen += nHheaLen + nHmtxLen;
- nTotalLen += nPrepLen + nCvtLen + nFpgmLen;
- rBuffer.resize( nTotalLen );
+ nTotalSize += nCffSize;
+ nTotalSize += nHheaSize + nHmtxSize;
+ nTotalSize += nPrepSize + nCvtSize + nFpgmSize;
+ rBuffer.resize( nTotalSize );
// fake a SFNT font directory header
if( nTableCount < 16 )
@@ -2194,57 +1976,69 @@ static bool GetRawFontData( const ImplFontData* pFontData,
}
// get font table raw data and update the fake directory entries
- ByteCount nOfs = nFdirLen;
+ ByteCount nOfs = nFdirSize;
unsigned char* pFakeEntry = &rBuffer[12];
- eStatus = ATSFontGetTable( rFont, GetTag("cmap"), 0, nCmapLen, (void*)&rBuffer[nOfs], &nCmapLen);
- FakeDirEntry( GetTag("cmap"), nOfs, nCmapLen, &rBuffer[0], pFakeEntry );
- nOfs += nCmapLen;
- if( nCvtLen ) {
- eStatus = ATSFontGetTable( rFont, GetTag("cvt "), 0, nCvtLen, (void*)&rBuffer[nOfs], &nCvtLen);
- FakeDirEntry( GetTag("cvt "), nOfs, nCvtLen, &rBuffer[0], pFakeEntry );
- nOfs += nCvtLen;
+ if( nCmapSize != pMacFont->GetFontTable( "cmap", &rBuffer[nOfs]))
+ return false;
+ FakeDirEntry( "cmap", nOfs, nCmapSize, &rBuffer[0], pFakeEntry );
+ nOfs += nCmapSize;
+ if( nCvtSize ) {
+ if( nCvtSize != pMacFont->GetFontTable( "cvt ", &rBuffer[nOfs]))
+ return false;
+ FakeDirEntry( "cvt ", nOfs, nCvtSize, &rBuffer[0], pFakeEntry );
+ nOfs += nCvtSize;
}
- if( nFpgmLen ) {
- eStatus = ATSFontGetTable( rFont, GetTag("fpgm"), 0, nFpgmLen, (void*)&rBuffer[nOfs], &nFpgmLen);
- FakeDirEntry( GetTag("fpgm"), nOfs, nFpgmLen, &rBuffer[0], pFakeEntry );
- nOfs += nFpgmLen;
+ if( nFpgmSize ) {
+ if( nFpgmSize != pMacFont->GetFontTable( "fpgm", &rBuffer[nOfs]))
+ return false;
+ FakeDirEntry( "fpgm", nOfs, nFpgmSize, &rBuffer[0], pFakeEntry );
+ nOfs += nFpgmSize;
}
- if( nCffLen ) {
- eStatus = ATSFontGetTable( rFont, GetTag("CFF "), 0, nCffLen, (void*)&rBuffer[nOfs], &nCffLen);
- FakeDirEntry( GetTag("CFF "), nOfs, nCffLen, &rBuffer[0], pFakeEntry );
- nOfs += nGlyfLen;
+ if( nCffSize ) {
+ if( nCffSize != pMacFont->GetFontTable( "CFF ", &rBuffer[nOfs]))
+ return false;
+ FakeDirEntry( "CFF ", nOfs, nCffSize, &rBuffer[0], pFakeEntry );
+ nOfs += nGlyfSize;
} else {
- eStatus = ATSFontGetTable( rFont, GetTag("glyf"), 0, nGlyfLen, (void*)&rBuffer[nOfs], &nGlyfLen);
- FakeDirEntry( GetTag("glyf"), nOfs, nGlyfLen, &rBuffer[0], pFakeEntry );
- nOfs += nGlyfLen;
- eStatus = ATSFontGetTable( rFont, GetTag("loca"), 0, nLocaLen, (void*)&rBuffer[nOfs], &nLocaLen);
- FakeDirEntry( GetTag("loca"), nOfs, nLocaLen, &rBuffer[0], pFakeEntry );
- nOfs += nLocaLen;
+ if( nGlyfSize != pMacFont->GetFontTable( "glyf", &rBuffer[nOfs]))
+ return false;
+ FakeDirEntry( "glyf", nOfs, nGlyfSize, &rBuffer[0], pFakeEntry );
+ nOfs += nGlyfSize;
+ if( nLocaSize != pMacFont->GetFontTable( "loca", &rBuffer[nOfs]))
+ return false;
+ FakeDirEntry( "loca", nOfs, nLocaSize, &rBuffer[0], pFakeEntry );
+ nOfs += nLocaSize;
}
- eStatus = ATSFontGetTable( rFont, GetTag("head"), 0, nHeadLen, (void*)&rBuffer[nOfs], &nHeadLen);
- FakeDirEntry( GetTag("head"), nOfs, nHeadLen, &rBuffer[0], pFakeEntry );
- nOfs += nHeadLen;
- eStatus = ATSFontGetTable( rFont, GetTag("hhea"), 0, nHheaLen, (void*)&rBuffer[nOfs], &nHheaLen);
- FakeDirEntry( GetTag("hhea"), nOfs, nHheaLen, &rBuffer[0], pFakeEntry );
- nOfs += nHheaLen;
- eStatus = ATSFontGetTable( rFont, GetTag("hmtx"), 0, nHmtxLen, (void*)&rBuffer[nOfs], &nHmtxLen);
- FakeDirEntry( GetTag("hmtx"), nOfs, nHmtxLen, &rBuffer[0], pFakeEntry );
- nOfs += nHmtxLen;
- eStatus = ATSFontGetTable( rFont, GetTag("maxp"), 0, nMaxpLen, (void*)&rBuffer[nOfs], &nMaxpLen);
- FakeDirEntry( GetTag("maxp"), nOfs, nMaxpLen, &rBuffer[0], pFakeEntry );
- nOfs += nMaxpLen;
- eStatus = ATSFontGetTable( rFont, GetTag("name"), 0, nNameLen, (void*)&rBuffer[nOfs], &nNameLen);
- FakeDirEntry( GetTag("name"), nOfs, nNameLen, &rBuffer[0], pFakeEntry );
- nOfs += nNameLen;
- if( nPrepLen ) {
- eStatus = ATSFontGetTable( rFont, GetTag("prep"), 0, nPrepLen, (void*)&rBuffer[nOfs], &nPrepLen);
- FakeDirEntry( GetTag("prep"), nOfs, nPrepLen, &rBuffer[0], pFakeEntry );
- nOfs += nPrepLen;
+ if( nHeadSize != pMacFont->GetFontTable( "head", &rBuffer[nOfs]))
+ return false;
+ FakeDirEntry( "head", nOfs, nHeadSize, &rBuffer[0], pFakeEntry );
+ nOfs += nHeadSize;
+ if( nHheaSize != pMacFont->GetFontTable( "hhea", &rBuffer[nOfs]))
+ return false;
+ FakeDirEntry( "hhea", nOfs, nHheaSize, &rBuffer[0], pFakeEntry );
+ nOfs += nHheaSize;
+ if( nHmtxSize != pMacFont->GetFontTable( "hmtx", &rBuffer[nOfs]))
+ return false;
+ FakeDirEntry( "hmtx", nOfs, nHmtxSize, &rBuffer[0], pFakeEntry );
+ nOfs += nHmtxSize;
+ if( nMaxpSize != pMacFont->GetFontTable( "maxp", &rBuffer[nOfs]))
+ return false;
+ FakeDirEntry( "maxp", nOfs, nMaxpSize, &rBuffer[0], pFakeEntry );
+ nOfs += nMaxpSize;
+ if( nNameSize != pMacFont->GetFontTable( "name", &rBuffer[nOfs]))
+ return false;
+ FakeDirEntry( "name", nOfs, nNameSize, &rBuffer[0], pFakeEntry );
+ nOfs += nNameSize;
+ if( nPrepSize ) {
+ if( nPrepSize != pMacFont->GetFontTable( "prep", &rBuffer[nOfs]))
+ return false;
+ FakeDirEntry( "prep", nOfs, nPrepSize, &rBuffer[0], pFakeEntry );
+ nOfs += nPrepSize;
}
- DBG_ASSERT( (nOfs==nTotalLen), "AquaSalGraphics::CreateFontSubset (nOfs!=nTotalLen)");
+ DBG_ASSERT( (nOfs==nTotalSize), "AquaSalGraphics::CreateFontSubset (nOfs!=nTotalSize)");
- return sal_True;
+ return true;
}
sal_Bool AquaSalGraphics::CreateFontSubset( const rtl::OUString& rToFile,
@@ -2270,7 +2064,7 @@ sal_Bool AquaSalGraphics::CreateFontSubset( const rtl::OUString& rToFile,
if( bCffOnly )
{
// provide the raw-CFF data to the subsetter
- ByteCount nCffLen = aBuffer.size();
+ const ByteCount nCffLen = aBuffer.size();
rInfo.LoadFont( FontSubsetInfo::CFF_FONT, &aBuffer[0], nCffLen );
// NOTE: assuming that all glyphids requested on Aqua are fully translated
@@ -2317,7 +2111,7 @@ sal_Bool AquaSalGraphics::CreateFontSubset( const rtl::OUString& rToFile,
// subset glyphs and get their properties
// take care that subset fonts require the NotDef glyph in pos 0
int nOrigCount = nGlyphCount;
- sal_uInt16 aShortIDs[ 256 ];
+ sal_uInt16 aShortIDs[ 256 ];
sal_uInt8 aTempEncs[ 256 ];
int nNotDef = -1;
@@ -2498,11 +2292,12 @@ void AquaSalGraphics::FreeEmbedFontData( const void* pData, long /*nDataLen*/ )
SystemFontData AquaSalGraphics::GetSysFontData( int /* nFallbacklevel */ ) const
{
SystemFontData aSysFontData;
- OSStatus err;
aSysFontData.nSize = sizeof( SystemFontData );
+#ifdef USE_ATSU
// NOTE: Native ATSU font fallbacks are used, not the VCL fallbacks.
ATSUFontID fontId;
+ OSStatus err;
err = ATSUGetAttribute( maATSUStyle, kATSUFontTag, sizeof(fontId), &fontId, 0 );
if (err) fontId = 0;
aSysFontData.aATSUFontID = (void *) fontId;
@@ -2524,6 +2319,7 @@ SystemFontData AquaSalGraphics::GetSysFontData( int /* nFallbacklevel */ ) const
} else {
aSysFontData.bVerticalCharacterType = false;
}
+#endif // USE_ATSU
aSysFontData.bAntialias = !mbNonAntialiasedText;
@@ -2753,4 +2549,3 @@ bool XorEmulation::UpdateTarget()
}
// =======================================================================
-
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index 2657f23..cb65e9d 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -6043,6 +6043,14 @@ SalLayout* OutputDevice::ImplLayout( const String& rOrigStr,
ImplLayoutArgs aLayoutArgs = ImplPrepareLayoutArgs( aStr, nMinIndex, nLen, nPixelWidth, pDXArray );
+#ifdef MACOSX
+ // CoreText layouts are immutable and already contain the text color
+ // so we need to provide the color already for the layout request
+ // even if this layout will never be drawn
+ if( mbInitTextColor )
+ const_cast<OutputDevice&>(*this).ImplInitTextColor();
+#endif
+
// get matching layout object for base font
SalLayout* pSalLayout = NULL;
if( mpPDFWriter )
commit a8cd6dde4e3ad2e8b282841e1d36fe75b1f691c9
Author: Herbert Dürr <hdu at apache.org>
Date: Thu Jan 23 16:58:26 2014 +0000
#i122301# switch Mac port to SDK 10.7 / 64bit
diff --git a/configure.in b/configure.in
index 7f9ecef..5a22c81 100644
--- a/configure.in
+++ b/configure.in
@@ -1679,6 +1679,7 @@ if test "$COMPATH" = "." ; then
dnl double square bracket to get single because of M4 quote...
COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`;
fi
+CC_PATH="$COMPATH/"
COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`;
dnl ===================================================================
@@ -1700,20 +1701,8 @@ if test \( "$_os" != "WINNT" -o "$WITH_MINGWIN" = "yes" \) -a "$GCC" = "yes"; th
fi
fi
fi
- if test "$_os" = "Darwin" -a "$GCCVER" -ge "040100" ; then
- if test -z "$save_CC" -a -x "$GCC_HOME/bin/gcc-4.0" ; then
- export CC=$GCC_HOME/bin/gcc-4.0
- dnl export CC to have it available in set_soenv -> config.guess
- GCCVER2=`"$CC" -dumpversion | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
- if test "$GCCVER2" -ge "040000" -a "$GCCVER2" -lt "040100" ; then
- GCCVER=$GCCVER2
- fi
- fi
- if test "$GCCVER" -ge "040100" ; then
- AC_MSG_ERROR([You need to use the gcc-4.0 compiler (gcc $_gcc_version won't work with the MacOSX10.4u.sdk) - set CC accordingly])
- else
+ if test "$_os" = "Darwin" ; then
AC_MSG_RESULT([implicitly using CC=$CC])
- fi
else
AC_MSG_RESULT([checked (gcc $_gcc_version)])
fi
@@ -1798,16 +1787,12 @@ dnl ===================================================================
dnl Search for a pre-installed dmake
dnl ===================================================================
AC_MSG_CHECKING([for dmake])
-DMAKE="no"
-# Override system dmake if --with-dmake-path or --with-dmake-url is used.
-if test -z "$with_dmake_path" && test -z "$with_dmake_url"; then
- AC_PATH_PROG(DMAKE, dmake, no)
- IS_SYSTEM_DMAKE=NO
- if test "$DMAKE" != "no"; then
- AC_MSG_RESULT([using system dmake])
- DMAKE_PATH="$DMAKE"
- IS_SYSTEM_DMAKE=YES
- fi
+AC_PATH_PROG(DMAKE, dmake, no)
+IS_SYSTEM_DMAKE=NO
+if test "$DMAKE" != "no"; then
+ AC_MSG_RESULT([using system dmake])
+ DMAKE_PATH="$DMAKE"
+ IS_SYSTEM_DMAKE=YES
elif test -n "$with_dmake_path" ; then
# Did not find pre-installed dmake.
# Is it at a nonstandard location provided by --with-dmake-path ?
@@ -2364,22 +2349,7 @@ if test "$GXX" = "yes"; then
_gpp_version=`$CXX -dumpversion`
_gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
- if test "$_os" = "Darwin" -a "$_gpp_majmin" -ge "401" ; then
- if test -z "$save_CXX" -a -x "$GCC_HOME/bin/g++-4.0" ; then
- CXX=$GCC_HOME/bin/g++-4.0
- _gpp_majmin_2=`"$CXX" -dumpversion | $AWK -F. '{ print \$1*100+\$2 }'`
- if test "$_gpp_majmin_2" -ge "400" -a "$_gpp_majmin_2" -lt "401" ; then
- _gpp_majmin=$_gpp_majmin_2
- fi
- fi
- if test "$_gpp_majmin" -ge "401" ; then
- AC_MSG_ERROR([You need to use the g++-4.0 compiler (g++ $_gpp_version won't work with the MacOSX10.4u.sdk) - set CXX accordingly])
- else
- AC_MSG_RESULT([implicitly using CXX=$CXX])
- fi
- else
- AC_MSG_RESULT([checked (g++ $_gpp_version)])
- fi
+ AC_MSG_RESULT([checked (g++ $_gpp_version)])
if test "$_gpp_majmin" = "304"; then
AC_MSG_CHECKING([whether $CXX has the enum bug])
@@ -3812,7 +3782,7 @@ if test -n "$with_system_cppunit" -o -n "$with_system_libs" && \
PKG_CHECK_MODULES( CPPUNIT,
cppunit >= 1.12.0,
WITH_CPPUNIT="YES",
- WITH_CPPUNIT=")
+ WITH_CPPUNIT="")
if test -n "$WITH_CPPUNIT"; then
AC_MSG_RESULT([found system cppunit $CPPUNIT])
else
@@ -3951,15 +3921,15 @@ if test "$_os" = "Darwin" && test "$with_system_python" != "no"; then
dnl hex version of Python 2.7.1 = 34013680
if test $_python_hexversion -ge 34013680 ; then
- _python_version=`$_python -c "import sys; print sys.version;" | head -n 1`
+ _python_version=`$_python -c "import sys; print sys.version;" | head -c 3`
AC_MSG_RESULT([compiling against system python (version $_python_version)])
_python_ver=`$_python -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
if test -d "/Library/Frameworks/Python.framework/Versions/$_python_ver/include/python$_python_ver"; then
PYTHON_CFLAGS="-I/Library/Frameworks/Python.framework/Versions/$_python_ver/include/python$_python_ver"
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list