diff options
78 files changed, 3556 insertions, 1050 deletions
@@ -1,3 +1,63 @@ +Overview of changes between 1.29.1 and 1.29.3 +============================================= +- Minor fix in 1.29.1 tarball + +Overview of changes between 1.28.4 and 1.29.1 +============================================= +- Lots of introspection markup added +- Misc fixes + +Overview of changes between 1.28.3 and 1.28.4 +============================================= +- Various introspection annotation fixes +- Build fixes +- Require glib >= 2.24.0 +- Bugs fixed: + Bug 636348 - Hex boxes are incorrectly scaled with non identity cairo scale + Bug 639882 - Heap corruption in font parsing with FreeType2 backend + +Overview of changes between 1.28.2 and 1.28.3 +============================================= +- Bugs fixed: + Bug 630857 - introspection: Use --include-uninstalled + +Overview of changes between 1.28.1 and 1.28.2 +============================================= +- Reduce DLL hijack risk and simplify code in basic-win32 module +- Improve performance on Windows especially for non-Latin scripts +- Bugs fixed: + Bug 628497 - Crash in pango_layout_line_get_extents at pango-layout.c + Bug 626966 - SIGFPE _hb_sanitize_array + Bug 629632 - configure bug + Bug 625807 - approximate character width is 0 on pangoft2 + +Overview of changes between 1.28.0 and 1.28.1 +============================================= +- pango-view now accepts --margin +- Various HarfBuzz bug fixes +- Build fixes +- Bugs fixed: + Bug 582698 - Support CSS-style margin specification + Bug 621612 - VPATH build fix + Bug 605870 - Incorrect shaping for Syriac + Bug 457990 - font metrics are not converted to user space in cairo backend + Bug 613015 - [HB] Does not sanitize Device tables referenced from ValueRecords + +Overview of changes between 1.27.1 and 1.28.0 +============================================= +- [HB] Fix leak when duplicating blob +- Misc bug fixes +- Bugs fixed: + Bug 611033 - Layout using ATSUI fontmap treats absolute font sizes a... + Bug 605655 - Pango 1.26.2 introduces kerning bug + Bug 611229 - Pango reads from uninitialized memory + Bug 594101 - [Indic] needed character class data updates to support unicode 5.1 + Bug 345066 - backspace changes independent indic characters + Bug 609326 - Complex script shaping failed in the FT2 backend on Windows + Bug 604128 - Applications crash when displaying Hebrew characters + Bug 608923 - Incorrect/broken ligatures on MacOS + Bug 610791 - checks fail for unused documented symbols + Overview of changes between 1.26.2 and 1.27.1 ============================================= - Enable introspection again diff --git a/build/win32/Makefile.am b/build/win32/Makefile.am index ea035c25..b75548b1 100644 --- a/build/win32/Makefile.am +++ b/build/win32/Makefile.am @@ -1 +1,3 @@ SUBDIRS = vs9 + +EXTRA_DIST = unistd.h diff --git a/build/win32/vs9/unistd.h b/build/win32/unistd.h index 8655b1d5..8655b1d5 100644 --- a/build/win32/vs9/unistd.h +++ b/build/win32/unistd.h diff --git a/build/win32/vs9/Makefile.am b/build/win32/vs9/Makefile.am index 88ec9805..b65e2ebe 100644 --- a/build/win32/vs9/Makefile.am +++ b/build/win32/vs9/Makefile.am @@ -1,5 +1,6 @@ EXTRA_DIST = \ pango.sln \ + pango_fc.sln \ pango.vsprops \ pango.vcprojin \ pango.vcproj \ @@ -8,4 +9,6 @@ EXTRA_DIST = \ pangowin32.vcproj \ pangocairo.vcprojin \ pangocairo.vcproj \ - install.vcproj + install.vcproj \ + stdint.h \ + README.txt diff --git a/build/win32/vs9/README.txt b/build/win32/vs9/README.txt index b7c4e908..a053efbb 100644 --- a/build/win32/vs9/README.txt +++ b/build/win32/vs9/README.txt @@ -6,14 +6,66 @@ first need to use some Unix-like environment or manual work to expand files as needed, for instance the .vcprojin files here into .vcproj
files.
+
+It is recommended that GLib is compiled with VS9 to compile Pango.
+External dependencies are at least Cairo, zlib, libpng,
+gettext-runtime; optional dependencies include fontconfig, freetype,
+and expat. Please see the build\win32\vs9\README.txt file in glib
+for details where to unpack them.
+
+Decide first whether you would want to use fontconfig (which also includes
+freetype) prior to starting this build-Cairo needs to be built with freetype
+*and* fontconfig support before building Pango. You will need fontconfig
+support if you plan on building GIMP, or if you need support for complex
+language scripts via fontconfig.
+
+It is recommended that one builds the dependencies with VS9 as far as
+possible, especially those from and using the GTK+ stack (i.e. GLib and
+Cairo, [Cairo if one is planning to use GTK+ 3.x]), so that crashes
+caused by mixing calls to different CRTs can be kept at a minimum.
+zlib, libpng, and Cairo do contain support for compiling under VS9
+using VS project files and/or makefiles at this time of writing.
+For GLib, VS9 project files are available under
+$(srcroot)\build\vs9 in the case of GLib (stable/unstable).
+
+There is no known official VS9 build support for fontconfig
+(along with freetype and expat which will work with the pre-compiled
+fontconfig binary on ftp.gnome.org) and gettext-runtime, so please use
+the binaries from:
+
+ftp://ftp.gnome.org/pub/GNOME/binaries/win32/dependencies/ (32 bit)
+ftp://ftp.gnome.org/pub/GNOME/binaries/win64/dependencies/ (64 bit)
+
Set up the source tree as follows under some arbitrary top folder
<root>:
-<root>\pango\<this-pango-source-tree>
+<root>\<this-pango-source-tree>
<root>\vs9\<PlatformName>
+Unzip the binaries obtained from ftp.gnome.org in <root>\vs9\<PlatformName>,
+and build the following, if not already done so:
+
+Note: put the resulting zlib, libpng, pcre and Cairo files as follows:
+ .dll files: <root>\vs9\<PlatformName>\bin
+ .lib files: <root>\vs9\<PlatformName>\lib
+ .h files: <root>\vs9\<PlatformName>\include
+
+The recommended build order for these dependencies:
+(first unzip any dependent binaries downloaded from the ftp.gnome.org
+ as described in the README.txt file in the build\win32\vs9 folder)
+-zlib
+-libpng
+-(optional for GLib) PCRE (version 8.12 or later, use of CMake to
+ build PCRE is recommended-see build\win32\vs9\README.txt of GLib)
+-GLib (put the sources in <root>\<GLib-Source-Tree>, and build it from
+ there with VS9)
+-Cairo (inclusive of Cairo-GObject-if using GTK+-3.x)
+
+Use the pango_fc.sln solution if usage of fontconfig is desired; otherwise
+use the pango.sln solution.
+
*this* file you are now reading is thus located at
-<root>\pango\<this-pango-source-tree>\build\win32\vs9\README.txt.
+<root>\<this-pango-source-tree>\build\win32\vs9\README.txt.
<PlatformName> is either Win32 or x64, as in VS9 project files.
@@ -33,3 +85,4 @@ headers are present, and an "install tree" where only public headers are present.
--Tor Lillqvist <tml@iki.fi>
+--Updated by Fan, Chun-wei <fanc999@yahoo.com.tw>
diff --git a/build/win32/vs9/install.vcproj b/build/win32/vs9/install.vcproj index 3b9dad66..fd8d64d5 100644 --- a/build/win32/vs9/install.vcproj +++ b/build/win32/vs9/install.vcproj @@ -20,13 +20,53 @@ </ToolFiles> <Configurations> <Configuration + Name="Debug_FC|Win32" + OutputDirectory="$(GlibEtcInstallRoot)" + ConfigurationType="10" + InheritedPropertySheets=".\pango.vsprops" + CharacterSet="2" + DeleteExtensionsOnClean="" + > + <Tool + Name="VCPreBuildEventTool" + CommandLine="$(PangoDoInstall) $(PangoInstallFCHeaders)" + /> + </Configuration> + <Configuration Name="Debug|Win32" + OutputDirectory="$(GlibEtcInstallRoot)" + ConfigurationType="10" InheritedPropertySheets=".\pango.vsprops" + CharacterSet="2" + DeleteExtensionsOnClean="" + > + <Tool + Name="VCPreBuildEventTool" + CommandLine="$(PangoDoInstall)" + /> + </Configuration> + <Configuration + Name="Release_FC|Win32" OutputDirectory="$(GlibEtcInstallRoot)" - -ConfigurationType="10" + ConfigurationType="10" + InheritedPropertySheets=".\pango.vsprops" CharacterSet="2" DeleteExtensionsOnClean="" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + CommandLine="$(PangoDoInstall) $(PangoInstallFCHeaders)" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(GlibEtcInstallRoot)" + ConfigurationType="10" + InheritedPropertySheets=".\pango.vsprops" + CharacterSet="2" + DeleteExtensionsOnClean="" + WholeProgramOptimization="1" > <Tool Name="VCPreBuildEventTool" @@ -34,6 +74,19 @@ ConfigurationType="10" /> </Configuration> <Configuration + Name="Debug_FC|x64" + InheritedPropertySheets=".\pango.vsprops" + OutputDirectory="$(GlibEtcInstallRoot)" + ConfigurationType="10" + CharacterSet="2" + DeleteExtensionsOnClean="" + > + <Tool + Name="VCPreBuildEventTool" + CommandLine="$(PangoDoInstall) $(PangoInstallFCHeaders)" + /> + </Configuration> + <Configuration Name="Debug|x64" InheritedPropertySheets=".\pango.vsprops" OutputDirectory="$(GlibEtcInstallRoot)" @@ -47,7 +100,7 @@ ConfigurationType="10" /> </Configuration> <Configuration - Name="Release|Win32" + Name="Release_FC|x64" InheritedPropertySheets=".\pango.vsprops" OutputDirectory="$(GlibEtcInstallRoot)" ConfigurationType="10" @@ -57,7 +110,7 @@ ConfigurationType="10" > <Tool Name="VCPreBuildEventTool" - CommandLine="$(PangoDoInstall)" + CommandLine="$(PangoDoInstall) $(PangoInstallFCHeaders)" /> </Configuration> <Configuration @@ -75,4 +128,10 @@ ConfigurationType="10" /> </Configuration> </Configurations> + <References> + </References> + <Files> + </Files> + <Globals> + </Globals> </VisualStudioProject> diff --git a/build/win32/vs9/pango.sln b/build/win32/vs9/pango.sln index ededa745..070f3ed0 100644 --- a/build/win32/vs9/pango.sln +++ b/build/win32/vs9/pango.sln @@ -2,11 +2,6 @@ Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pango", "pango.vcproj", "{68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pangoft2", "pangoft2.vcproj", "{68CC80B9-7225-4FB5-B9AB-9C1DF50B6C73}" - ProjectSection(ProjectDependencies) = postProject - {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72} = {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72} - EndProjectSection -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pangowin32", "pangowin32.vcproj", "{68CC80B9-7225-4FB5-B9AB-9C1DF50B6C74}" ProjectSection(ProjectDependencies) = postProject {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72} = {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72} @@ -15,15 +10,14 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pangocairo", "pangocairo.vcproj", "{68CC80B9-7225-4FB5-B9AB-9C1DF50B6C76}" ProjectSection(ProjectDependencies) = postProject {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72} = {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72} - {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C73} = {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C73} {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C74} = {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C74} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "install", "install.vcproj", "{FC5AADB5-95CD-4BF0-BA8B-0C16FE7073FB}" ProjectSection(ProjectDependencies) = postProject {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72} = {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72} - {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C73} = {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C73} {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C74} = {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C74} + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C76} = {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C76} EndProjectSection EndProject Global @@ -42,14 +36,6 @@ Global {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72}.Release|Win32.Build.0 = Release|Win32 {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72}.Release|x64.ActiveCfg = Release|x64 {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72}.Release|x64.Build.0 = Release|x64 - {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C73}.Debug|Win32.ActiveCfg = Debug|Win32 - {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C73}.Debug|Win32.Build.0 = Debug|Win32 - {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C73}.Debug|x64.ActiveCfg = Debug|x64 - {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C73}.Debug|x64.Build.0 = Debug|x64 - {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C73}.Release|Win32.ActiveCfg = Release|Win32 - {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C73}.Release|Win32.Build.0 = Release|Win32 - {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C73}.Release|x64.ActiveCfg = Release|x64 - {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C73}.Release|x64.Build.0 = Release|x64 {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C74}.Debug|Win32.ActiveCfg = Debug|Win32 {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C74}.Debug|Win32.Build.0 = Debug|Win32 {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C74}.Debug|x64.ActiveCfg = Debug|x64 @@ -59,9 +45,11 @@ Global {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C74}.Release|x64.ActiveCfg = Release|x64 {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C74}.Release|x64.Build.0 = Release|x64 {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C76}.Debug|Win32.ActiveCfg = Debug|Win32 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C76}.Debug|Win32.Build.0 = Debug|Win32 {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C76}.Debug|x64.ActiveCfg = Debug|x64 {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C76}.Debug|x64.Build.0 = Debug|x64 - {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C76}.Release|Win32.ActiveCfg = Release|x64 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C76}.Release|Win32.ActiveCfg = Release|Win32 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C76}.Release|Win32.Build.0 = Release|Win32 {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C76}.Release|x64.ActiveCfg = Release|x64 {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C76}.Release|x64.Build.0 = Release|x64 {FC5AADB5-95CD-4BF0-BA8B-0C16FE7073FB}.Debug|Win32.ActiveCfg = Debug|Win32 diff --git a/build/win32/vs9/pango.vcprojin b/build/win32/vs9/pango.vcprojin index ad7db04f..7c36731a 100644 --- a/build/win32/vs9/pango.vcprojin +++ b/build/win32/vs9/pango.vcprojin @@ -18,12 +18,15 @@ </Platforms> <Configurations> <Configuration - Name="Debug|Win32" - InheritedPropertySheets=".\pango.vsprops" + Name="Debug_FC|Win32" ConfigurationType="2" + InheritedPropertySheets=".\pango.vsprops" CharacterSet="2" > <Tool + Name="VCPreBuildEventTool" + /> + <Tool Name="VCCLCompilerTool" Optimization="0" PreprocessorDefinitions="_DEBUG;$(PangoDefines)" @@ -46,12 +49,46 @@ /> </Configuration> <Configuration - Name="Release|Win32" + Name="Debug|Win32" + ConfigurationType="2" InheritedPropertySheets=".\pango.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="_DEBUG;$(PangoDefines);$(NoFCDef)" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="4" + /> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)\$(PangoDllPrefix)$(ProjectName)$(PangoDllSuffix).dll" + LinkIncremental="2" + ModuleDefinitionFile="..\..\..\pango\pango.def" + GenerateDebugInformation="true" + SubSystem="2" + ImportLibrary="$(TargetDir)$(ProjectName)-$(PangoApiVersion).lib" + TargetMachine="1" + /> + </Configuration> + <Configuration + Name="Release_FC|Win32" ConfigurationType="2" + InheritedPropertySheets=".\pango.vsprops" CharacterSet="2" > <Tool + Name="VCPreBuildEventTool" + /> + <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="$(PangoDefines)" RuntimeLibrary="2" @@ -73,7 +110,37 @@ /> </Configuration> <Configuration - Name="Debug|x64" + Name="Release|Win32" + ConfigurationType="2" + InheritedPropertySheets=".\pango.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="$(PangoDefines);$(NoFCDef)" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + /> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)\$(PangoDllPrefix)$(ProjectName)$(PangoDllSuffix).dll" + LinkIncremental="2" + ModuleDefinitionFile="..\..\..\pango\pango.def" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + ImportLibrary="$(TargetDir)$(ProjectName)-$(PangoApiVersion).lib" + TargetMachine="1" + /> + </Configuration> + <Configuration + Name="Debug_FC|x64" InheritedPropertySheets=".\pango.vsprops" ConfigurationType="2" CharacterSet="2" @@ -101,7 +168,35 @@ /> </Configuration> <Configuration - Name="Release|x64" + Name="Debug|x64" + InheritedPropertySheets=".\pango.vsprops" + ConfigurationType="2" + CharacterSet="2" + > + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="_DEBUG;$(PangoDefines);$(NoFCDef)" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + /> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)\$(PangoDllPrefix)$(ProjectName)$(PangoDllSuffix).dll" + LinkIncremental="2" + ModuleDefinitionFile="..\..\..\pango\pango.def" + GenerateDebugInformation="true" + SubSystem="2" + ImportLibrary="$(TargetDir)$(ProjectName)-$(PangoApiVersion).lib" + TargetMachine="17" + /> + </Configuration> + <Configuration + Name="Release_FC|x64" InheritedPropertySheets=".\pango.vsprops" ConfigurationType="2" CharacterSet="2" @@ -127,6 +222,33 @@ TargetMachine="17" /> </Configuration> + <Configuration + Name="Release|x64" + InheritedPropertySheets=".\pango.vsprops" + ConfigurationType="2" + CharacterSet="2" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="$(PangoDefines);$(NoFCDef)" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + /> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)\$(PangoDllPrefix)$(ProjectName)$(PangoDllSuffix).dll" + LinkIncremental="2" + ModuleDefinitionFile="..\..\..\pango\pango.def" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + ImportLibrary="$(TargetDir)$(ProjectName)-$(PangoApiVersion).lib" + TargetMachine="17" + /> + </Configuration> </Configurations> <References> </References> @@ -152,57 +274,25 @@ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" > - <File RelativePath="..\..\..\modules\arabic\arabic-lang.c"> - <FileConfiguration Name="Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_arabic_lang" - /> - </FileConfiguration> - <FileConfiguration Name="Debug|x64"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_arabic_lang" - /> - </FileConfiguration> - <FileConfiguration Name="Release|Win32"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_arabic_lang" - /> - </FileConfiguration> - <FileConfiguration Name="Release|x64"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_arabic_lang" - /> - </FileConfiguration> + <File RelativePath="..\..\..\modules\arabic\arabic-lang.c" > + <FileConfiguration Name="Debug_FC|Win32"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_arabic_lang" /></FileConfiguration> + <FileConfiguration Name="Debug|Win32"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_arabic_lang" /></FileConfiguration> + <FileConfiguration Name="Release_FC|Win32"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_arabic_lang" /></FileConfiguration> + <FileConfiguration Name="Release|Win32"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_arabic_lang" /></FileConfiguration> + <FileConfiguration Name="Debug_FC|x64"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_arabic_lang" /></FileConfiguration> + <FileConfiguration Name="Debug|x64"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_arabic_lang" /></FileConfiguration> + <FileConfiguration Name="Release_FC|x64"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_arabic_lang" /></FileConfiguration> + <FileConfiguration Name="Release|x64"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_arabic_lang" /></FileConfiguration> </File> - <File RelativePath="..\..\..\modules\indic\indic-lang.c"> - <FileConfiguration Name="Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_indic_lang" - /> - </FileConfiguration> - <FileConfiguration Name="Debug|x64"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_indic_lang" - /> - </FileConfiguration> - <FileConfiguration Name="Release|Win32"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_indic_lang" - /> - </FileConfiguration> - <FileConfiguration Name="Release|x64"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_indic_lang" - /> - </FileConfiguration> + <File RelativePath="..\..\..\modules\indic\indic-lang.c" > + <FileConfiguration Name="Debug_FC|Win32"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_indic_lang" /></FileConfiguration> + <FileConfiguration Name="Debug|Win32"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_indic_lang" /></FileConfiguration> + <FileConfiguration Name="Release_FC|Win32"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_indic_lang" /></FileConfiguration> + <FileConfiguration Name="Release|Win32"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_indic_lang" /></FileConfiguration> + <FileConfiguration Name="Debug_FC|x64"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_indic_lang" /></FileConfiguration> + <FileConfiguration Name="Debug|x64"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_indic_lang" /></FileConfiguration> + <FileConfiguration Name="Release_FC|x64"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_indic_lang" /></FileConfiguration> + <FileConfiguration Name="Release|x64"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_indic_lang" /></FileConfiguration> </File> #include "libpango.sourcefiles" #include "mini-fribidi/libmini-fribidi.sourcefiles" diff --git a/build/win32/vs9/pango.vsprops b/build/win32/vs9/pango.vsprops index f2350069..b41aa1c6 100644 --- a/build/win32/vs9/pango.vsprops +++ b/build/win32/vs9/pango.vsprops @@ -29,16 +29,19 @@ copy /y ..\..\..\pango\module-defs.h.win32 ..\..\..\pango\module-defs.h
&#x copy ..\..\..\pango\module-defs.h.win32 ..\..\..\pango\DONE_MODULE_DEFS_H
 :DONE_MODULE_DEFS_H
 -if exist ..\..\..\pango\module-defs-lang.c goto DONE_MODULE_DEFS_LANG_C
 +if exist ..\..\..\pango\DONE_MODULE_DEFS_LANG_C goto DONE_MODULE_DEFS_LANG_C
 copy ..\..\..\pango\module-defs-lang.c.win32 ..\..\..\pango\module-defs-lang.c
 +copy ..\..\..\pango\module-defs-lang.c.win32 ..\..\..\pango\DONE_MODULE_DEFS_LANG_C
 :DONE_MODULE_DEFS_LANG_C
 -if exist ..\..\..\pango\module-defs-fc.c goto DONE_MODULE_DEFS_FC_C
 +if exist ..\..\..\pango\DONE_MODULE_DEFS_FC_C goto DONE_MODULE_DEFS_FC_C
 copy ..\..\..\pango\module-defs-fc.c.win32 ..\..\..\pango\module-defs-fc.c
 +copy ..\..\..\pango\module-defs-fc.c.win32 ..\..\..\pango\DONE_MODULE_DEFS_FC_C
 :DONE_MODULE_DEFS_FC_C
 -if exist ..\..\..\pango\module-defs-win32.c goto DONE_MODULE_DEFS_WIN32_C
 +if exist ..\..\..\pango\DONE_MODULE_DEFS_WIN32_C goto DONE_MODULE_DEFS_WIN32_C
 copy ..\..\..\pango\module-defs-win32.c.win32 ..\..\..\pango\module-defs-win32.c
 +copy ..\..\..\pango\module-defs-win32.c.win32 ..\..\..\pango\DONE_MODULE_DEFS_WIN32_C
 :DONE_MODULE_DEFS_WIN32_C
 " /> @@ -59,6 +62,10 @@ copy ..\..\..\pango\module-defs-win32.c.win32 ..\..\..\pango\module-defs-win32.c Value="G_LOG_DOMAIN=\"Pango\";PANGO_ENABLE_BACKEND;PANGO_ENABLE_ENGINE;SYSCONFDIR=\"$(PangoDummyPrefix)/etc\";LIBDIR=\"$(PangoDummyPrefix)/lib\"" /> <UserMacro + Name="NoFCDef" + Value="PANGO_VISUALC_NO_FC" + /> + <UserMacro Name="PangoDoInstall" Value=" echo on
 @@ -97,11 +104,22 @@ copy ..\..\..\pango\pango-tabs.h $(OutDir)\include\pango-$(PangoApiVersion)\pang copy ..\..\..\pango\pango-types.h $(OutDir)\include\pango-$(PangoApiVersion)\pango
 copy ..\..\..\pango\pango-utils.h $(OutDir)\include\pango-$(PangoApiVersion)\pango
 copy ..\..\..\pango\pangocairo.h $(OutDir)\include\pango-$(PangoApiVersion)\pango
 +copy ..\..\..\pango\pangowin32.h $(OutDir)\include\pango-$(PangoApiVersion)\pango
 + +mkdir $(OutDir)\etc\pango
 +echo tahoma = "tahoma,browallia new,mingliu,simhei,gulimche,ms gothic,latha,mangal" > $(OutDir)\etc\pango\pango.aliases
 +echo sans = "arial,browallia new,mingliu,simhei,gulimche,ms gothic,latha,mangal" >> $(OutDir)\etc\pango\pango.aliases
 +echo serif = "times new roman,angsana new,mingliu,simsun,gulimche,ms gothic,latha,mangal" >> $(OutDir)\etc\pango\pango.aliases
 +echo monospace = "courier new,courier monothai,mingliu,simsun,gulimche,ms gothic,latha,mangal" >> $(OutDir)\etc\pango\pango.aliases
 +" + /> + <UserMacro + Name="PangoInstallFCHeaders" + Value=" copy ..\..\..\pango\pangofc-decoder.h $(OutDir)\include\pango-$(PangoApiVersion)\pango
 copy ..\..\..\pango\pangofc-font.h $(OutDir)\include\pango-$(PangoApiVersion)\pango
 copy ..\..\..\pango\pangofc-fontmap.h $(OutDir)\include\pango-$(PangoApiVersion)\pango
 copy ..\..\..\pango\pangoft2.h $(OutDir)\include\pango-$(PangoApiVersion)\pango
 -copy ..\..\..\pango\pangowin32.h $(OutDir)\include\pango-$(PangoApiVersion)\pango
 " /> <UserMacro diff --git a/build/win32/vs9/pango_fc.sln b/build/win32/vs9/pango_fc.sln new file mode 100644 index 00000000..6660ca17 --- /dev/null +++ b/build/win32/vs9/pango_fc.sln @@ -0,0 +1,82 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pango", "pango.vcproj", "{68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pangoft2", "pangoft2.vcproj", "{68CC80B9-7225-4FB5-B9AB-9C1DF50B6C73}" + ProjectSection(ProjectDependencies) = postProject + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72} = {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pangowin32", "pangowin32.vcproj", "{68CC80B9-7225-4FB5-B9AB-9C1DF50B6C74}" + ProjectSection(ProjectDependencies) = postProject + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72} = {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pangocairo", "pangocairo.vcproj", "{68CC80B9-7225-4FB5-B9AB-9C1DF50B6C76}" + ProjectSection(ProjectDependencies) = postProject + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72} = {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72} + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C73} = {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C73} + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C74} = {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C74} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "install", "install.vcproj", "{FC5AADB5-95CD-4BF0-BA8B-0C16FE7073FB}" + ProjectSection(ProjectDependencies) = postProject + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72} = {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72} + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C73} = {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C73} + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C74} = {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C74} + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C76} = {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C76} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72}.Debug|Win32.ActiveCfg = Debug_FC|Win32 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72}.Debug|Win32.Build.0 = Debug_FC|Win32 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72}.Debug|x64.ActiveCfg = Debug_FC|x64 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72}.Debug|x64.Build.0 = Debug_FC|x64 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72}.Release|Win32.ActiveCfg = Release_FC|Win32 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72}.Release|Win32.Build.0 = Release_FC|Win32 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72}.Release|x64.ActiveCfg = Release_FC|x64 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C72}.Release|x64.Build.0 = Release_FC|x64 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C73}.Debug|Win32.ActiveCfg = Debug_FC|Win32 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C73}.Debug|Win32.Build.0 = Debug_FC|Win32 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C73}.Debug|x64.ActiveCfg = Debug_FC|x64 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C73}.Debug|x64.Build.0 = Debug_FC|x64 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C73}.Release|Win32.ActiveCfg = Release_FC|Win32 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C73}.Release|Win32.Build.0 = Release_FC|Win32 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C73}.Release|x64.ActiveCfg = Release_FC|Win32 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C73}.Release|x64.Build.0 = Release_FC|x64 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C74}.Debug|Win32.ActiveCfg = Debug_FC|Win32 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C74}.Debug|Win32.Build.0 = Debug_FC|Win32 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C74}.Debug|x64.ActiveCfg = Debug_FC|x64 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C74}.Debug|x64.Build.0 = Debug_FC|x64 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C74}.Release|Win32.ActiveCfg = Release_FC|Win32 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C74}.Release|Win32.Build.0 = Release_FC|Win32 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C74}.Release|x64.ActiveCfg = Release_FC|x64 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C74}.Release|x64.Build.0 = Release_FC|x64 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C76}.Debug|Win32.ActiveCfg = Debug_FC|Win32 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C76}.Debug|Win32.Build.0 = Debug_FC|Win32 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C76}.Debug|x64.ActiveCfg = Debug_FC|x64 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C76}.Debug|x64.Build.0 = Debug_FC|x64 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C76}.Release|Win32.ActiveCfg = Release_FC|Win32 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C76}.Release|Win32.Build.0 = Release_FC|Win32 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C76}.Release|x64.ActiveCfg = Release_FC|x64 + {68CC80B9-7225-4FB5-B9AB-9C1DF50B6C76}.Release|x64.Build.0 = Release_FC|x64 + {FC5AADB5-95CD-4BF0-BA8B-0C16FE7073FB}.Debug|Win32.ActiveCfg = Debug_FC|Win32 + {FC5AADB5-95CD-4BF0-BA8B-0C16FE7073FB}.Debug|Win32.Build.0 = Debug_FC|Win32 + {FC5AADB5-95CD-4BF0-BA8B-0C16FE7073FB}.Debug|x64.ActiveCfg = Debug_FC|x64 + {FC5AADB5-95CD-4BF0-BA8B-0C16FE7073FB}.Debug|x64.Build.0 = Debug_FC|x64 + {FC5AADB5-95CD-4BF0-BA8B-0C16FE7073FB}.Release|Win32.ActiveCfg = Release_FC|Win32 + {FC5AADB5-95CD-4BF0-BA8B-0C16FE7073FB}.Release|Win32.Build.0 = Release_FC|Win32 + {FC5AADB5-95CD-4BF0-BA8B-0C16FE7073FB}.Release|x64.ActiveCfg = Release_FC|x64 + {FC5AADB5-95CD-4BF0-BA8B-0C16FE7073FB}.Release|x64.Build.0 = Release_FC|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/build/win32/vs9/pangocairo.vcprojin b/build/win32/vs9/pangocairo.vcprojin index 8b30b3ed..ed2c4428 100644 --- a/build/win32/vs9/pangocairo.vcprojin +++ b/build/win32/vs9/pangocairo.vcprojin @@ -18,12 +18,15 @@ </Platforms> <Configurations> <Configuration - Name="Debug|Win32" - InheritedPropertySheets=".\pango.vsprops" + Name="Debug_FC|Win32" ConfigurationType="2" + InheritedPropertySheets=".\pango.vsprops" CharacterSet="2" > <Tool + Name="VCPreBuildEventTool" + /> + <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="." @@ -48,12 +51,49 @@ /> </Configuration> <Configuration - Name="Release|Win32" + Name="Debug|Win32" + ConfigurationType="2" InheritedPropertySheets=".\pango.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="." + PreprocessorDefinitions="_DEBUG;$(PangoDefines);$(NoFCDef)" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="4" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="cairo.lib" + OutputFile="$(OutDir)\$(PangoDllPrefix)$(ProjectName)$(PangoDllSuffix).dll" + LinkIncremental="2" + IgnoreDefaultLibraryNames="$(OutDir)\pangoft2-$(PangoApiVersion).lib" + ModuleDefinitionFile="..\..\..\pango\pangocairo.def" + GenerateDebugInformation="true" + SubSystem="2" + ImportLibrary="$(TargetDir)$(ProjectName)-$(PangoApiVersion).lib" + TargetMachine="1" + /> + </Configuration> + <Configuration + Name="Release_FC|Win32" ConfigurationType="2" + InheritedPropertySheets=".\pango.vsprops" CharacterSet="2" > <Tool + Name="VCPreBuildEventTool" + /> + <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="." PreprocessorDefinitions="$(PangoDefines)" @@ -77,7 +117,40 @@ /> </Configuration> <Configuration - Name="Debug|x64" + Name="Release|Win32" + ConfigurationType="2" + InheritedPropertySheets=".\pango.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories="." + PreprocessorDefinitions="$(PangoDefines);$(NoFCDef)" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="cairo.lib" + OutputFile="$(OutDir)\$(PangoDllPrefix)$(ProjectName)$(PangoDllSuffix).dll" + LinkIncremental="2" + IgnoreDefaultLibraryNames="$(OutDir)\pangoft2-$(PangoApiVersion).lib" + ModuleDefinitionFile="..\..\..\pango\pangocairo.def" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + ImportLibrary="$(TargetDir)$(ProjectName)-$(PangoApiVersion).lib" + TargetMachine="1" + /> + </Configuration> + <Configuration + Name="Debug_FC|x64" InheritedPropertySheets=".\pango.vsprops" ConfigurationType="2" CharacterSet="2" @@ -107,7 +180,38 @@ /> </Configuration> <Configuration - Name="Release|x64" + Name="Debug|x64" + InheritedPropertySheets=".\pango.vsprops" + ConfigurationType="2" + CharacterSet="2" + > + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="." + PreprocessorDefinitions="_DEBUG;$(PangoDefines);$(NoFCDef)" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="cairo.lib" + OutputFile="$(OutDir)\$(PangoDllPrefix)$(ProjectName)$(PangoDllSuffix).dll" + LinkIncremental="2" + IgnoreDefaultLibraryNames="$(OutDir)\pangoft2-$(PangoApiVersion).lib" + ModuleDefinitionFile="..\..\..\pango\pangocairo.def" + GenerateDebugInformation="true" + SubSystem="2" + ImportLibrary="$(TargetDir)$(ProjectName)-$(PangoApiVersion).lib" + TargetMachine="17" + /> + </Configuration> + <Configuration + Name="Release_FC|x64" InheritedPropertySheets=".\pango.vsprops" ConfigurationType="2" CharacterSet="2" @@ -135,6 +239,35 @@ TargetMachine="17" /> </Configuration> + <Configuration + Name="Release|x64" + InheritedPropertySheets=".\pango.vsprops" + ConfigurationType="2" + CharacterSet="2" + > + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories="." + PreprocessorDefinitions="$(PangoDefines);$(NoFCDef)" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="cairo.lib" + OutputFile="$(OutDir)\$(PangoDllPrefix)$(ProjectName)$(PangoDllSuffix).dll" + LinkIncremental="2" + ModuleDefinitionFile="..\..\..\pango\pangocairo.def" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + ImportLibrary="$(TargetDir)$(ProjectName)-$(PangoApiVersion).lib" + TargetMachine="17" + /> + </Configuration> </Configurations> <References> </References> @@ -160,8 +293,18 @@ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" > - <File RelativePath="..\..\..\pango\pangocairo-fcfont.c" /> - <File RelativePath="..\..\..\pango\pangocairo-fcfontmap.c" /> + <File RelativePath="..\..\..\pango\pangocairo-fcfont.c" > + <FileConfiguration Name="Debug|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration> + <FileConfiguration Name="Release|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration> + <FileConfiguration Name="Debug|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration> + <FileConfiguration Name="Release|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration> + </File> + <File RelativePath="..\..\..\pango\pangocairo-fcfontmap.c" > + <FileConfiguration Name="Debug|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration> + <FileConfiguration Name="Release|Win32" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration> + <FileConfiguration Name="Debug|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration> + <FileConfiguration Name="Release|x64" ExcludedFromBuild="true" ><Tool Name="VCCLCompilerTool" /></FileConfiguration> + </File> <File RelativePath="..\..\..\pango\pangocairo-win32font.c" /> <File RelativePath="..\..\..\pango\pangocairo-win32fontmap.c" /> #include "libpangocairo.sourcefiles" diff --git a/build/win32/vs9/pangoft2.vcprojin b/build/win32/vs9/pangoft2.vcprojin index caf6e928..12beb157 100644 --- a/build/win32/vs9/pangoft2.vcprojin +++ b/build/win32/vs9/pangoft2.vcprojin @@ -20,15 +20,18 @@ </ToolFiles> <Configurations> <Configuration - Name="Debug|Win32" - InheritedPropertySheets=".\pango.vsprops" + Name="Debug_FC|Win32" ConfigurationType="2" + InheritedPropertySheets=".\pango.vsprops" CharacterSet="2" > <Tool + Name="VCPreBuildEventTool" + /> + <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories="." + AdditionalIncludeDirectories=".;..\" PreprocessorDefinitions="_DEBUG;$(PangoDefines);HAVE_GLIB" MinimalRebuild="true" BasicRuntimeChecks="3" @@ -50,14 +53,18 @@ /> </Configuration> <Configuration - Name="Release|Win32" - InheritedPropertySheets=".\pango.vsprops" + Name="Release_FC|Win32" ConfigurationType="2" + InheritedPropertySheets=".\pango.vsprops" CharacterSet="2" > <Tool + Name="VCPreBuildEventTool" + /> + <Tool Name="VCCLCompilerTool" - PreprocessorDefinitions="$(PangoDefines)" + AdditionalIncludeDirectories=".;..\" + PreprocessorDefinitions="$(PangoDefines);HAVE_GLIB" RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="3" @@ -78,7 +85,7 @@ /> </Configuration> <Configuration - Name="Debug|x64" + Name="Debug_FC|x64" InheritedPropertySheets=".\pango.vsprops" ConfigurationType="2" CharacterSet="2" @@ -86,7 +93,8 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - PreprocessorDefinitions="_DEBUG;$(PangoDefines)" + AdditionalIncludeDirectories=".;..\" + PreprocessorDefinitions="_DEBUG;$(PangoDefines);HAVE_GLIB" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" @@ -107,14 +115,15 @@ /> </Configuration> <Configuration - Name="Release|x64" + Name="Release_FC|x64" InheritedPropertySheets=".\pango.vsprops" ConfigurationType="2" CharacterSet="2" > <Tool Name="VCCLCompilerTool" - PreprocessorDefinitions="$(PangoDefines)" + AdditionalIncludeDirectories=".;..\" + PreprocessorDefinitions="$(PangoDefines);HAVE_GLIB" RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="3" @@ -160,246 +169,66 @@ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" > <File RelativePath="..\..\..\modules\arabic\arabic-fc.c"> - <FileConfiguration Name="Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_arabic_fc" - /> - </FileConfiguration> - <FileConfiguration Name="Debug|x64"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_arabic_fc" - /> - </FileConfiguration> - <FileConfiguration Name="Release|Win32"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_arabic_fc" - /> - </FileConfiguration> - <FileConfiguration Name="Release|x64"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_arabic_fc" - /> - </FileConfiguration> + <FileConfiguration Name="Debug_FC|Win32"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_arabic_fc" /></FileConfiguration> + <FileConfiguration Name="Release_FC|Win32"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_arabic_fc" /></FileConfiguration> + <FileConfiguration Name="Debug_FC|x64"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_arabic_fc" /></FileConfiguration> + <FileConfiguration Name="Release_FC|x64"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_arabic_fc" /></FileConfiguration> </File> <File RelativePath="..\..\..\modules\arabic\arabic-ot.c" /> <File RelativePath="..\..\..\modules\basic\basic-fc.c"> - <FileConfiguration Name="Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_basic_fc" - /> - </FileConfiguration> - <FileConfiguration Name="Debug|x64"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_basic_fc" - /> - </FileConfiguration> - <FileConfiguration Name="Release|Win32"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_basic_fc" - /> - </FileConfiguration> - <FileConfiguration Name="Release|x64"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_basic_fc" - /> - </FileConfiguration> + <FileConfiguration Name="Debug_FC|Win32"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_basic_fc" /></FileConfiguration> + <FileConfiguration Name="Release_FC|Win32"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_basic_fc" /></FileConfiguration> + <FileConfiguration Name="Debug_FC|x64"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_basic_fc" /></FileConfiguration> + <FileConfiguration Name="Release_FC|x64"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_basic_fc" /></FileConfiguration> </File> <File RelativePath="..\..\..\modules\hangul\hangul-fc.c"> - <FileConfiguration Name="Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_hangul_fc" - /> - </FileConfiguration> - <FileConfiguration Name="Debug|x64"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_hangul_fc" - /> - </FileConfiguration> - <FileConfiguration Name="Release|Win32"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_hangul_fc" - /> - </FileConfiguration> - <FileConfiguration Name="Release|x64"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_hangul_fc" - /> - </FileConfiguration> + <FileConfiguration Name="Debug_FC|Win32"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_hangul_fc" /></FileConfiguration> + <FileConfiguration Name="Release_FC|Win32"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_hangul_fc" /></FileConfiguration> + <FileConfiguration Name="Debug_FC|x64"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_hangul_fc" /></FileConfiguration> + <FileConfiguration Name="Release_FC|x64"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_hangul_fc" /></FileConfiguration> </File> <File RelativePath="..\..\..\modules\hebrew\hebrew-fc.c"> - <FileConfiguration Name="Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_hebrew_fc" - /> - </FileConfiguration> - <FileConfiguration Name="Debug|x64"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_hebrew_fc" - /> - </FileConfiguration> - <FileConfiguration Name="Release|Win32"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_hebrew_fc" - /> - </FileConfiguration> - <FileConfiguration Name="Release|x64"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_hebrew_fc" - /> - </FileConfiguration> + <FileConfiguration Name="Debug_FC|Win32"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_hebrew_fc" /></FileConfiguration> + <FileConfiguration Name="Release_FC|Win32"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_hebrew_fc" /></FileConfiguration> + <FileConfiguration Name="Debug_FC|x64"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_hebrew_fc" /></FileConfiguration> + <FileConfiguration Name="Release_FC|x64"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_hebrew_fc" /></FileConfiguration> </File> <File RelativePath="..\..\..\modules\hebrew\hebrew-shaper.c" /> <File RelativePath="..\..\..\modules\indic\indic-fc.c"> - <FileConfiguration Name="Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_indic_fc" - /> - </FileConfiguration> - <FileConfiguration Name="Debug|x64"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_indic_fc" - /> - </FileConfiguration> - <FileConfiguration Name="Release|Win32"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_indic_fc" - /> - </FileConfiguration> - <FileConfiguration Name="Release|x64"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_indic_fc" - /> - </FileConfiguration> + <FileConfiguration Name="Debug_FC|Win32"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_indic_fc" /></FileConfiguration> + <FileConfiguration Name="Release_FC|Win32"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_indic_fc" /></FileConfiguration> + <FileConfiguration Name="Debug_FC|x64"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_indic_fc" /></FileConfiguration> + <FileConfiguration Name="Release_FC|x64"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_indic_fc" /></FileConfiguration> </File> - <File RelativePath="..\..\..\modules\indic\indic-ot.c" /> <File RelativePath="..\..\..\modules\indic\indic-ot-class-tables.c" /> + <File RelativePath="..\..\..\modules\indic\indic-ot.c" /> <File RelativePath="..\..\..\modules\indic\mprefixups.c" /> <File RelativePath="..\..\..\modules\khmer\khmer-fc.c"> - <FileConfiguration Name="Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_khmer_fc" - /> - </FileConfiguration> - <FileConfiguration Name="Debug|x64"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_khmer_fc" - /> - </FileConfiguration> - <FileConfiguration Name="Release|Win32"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_khmer_fc" - /> - </FileConfiguration> - <FileConfiguration Name="Release|x64"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_khmer_fc" - /> - </FileConfiguration> + <FileConfiguration Name="Debug_FC|Win32"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_khmer_fc" /></FileConfiguration> + <FileConfiguration Name="Release_FC|Win32"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_khmer_fc" /></FileConfiguration> + <FileConfiguration Name="Debug_FC|x64"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_khmer_fc" /></FileConfiguration> + <FileConfiguration Name="Release_FC|x64"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_khmer_fc" /></FileConfiguration> </File> <File RelativePath="..\..\..\modules\syriac\syriac-fc.c"> - <FileConfiguration Name="Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_syriac_fc" - /> - </FileConfiguration> - <FileConfiguration Name="Debug|x64"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_syriac_fc" - /> - </FileConfiguration> - <FileConfiguration Name="Release|Win32"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_syriac_fc" - /> - </FileConfiguration> - <FileConfiguration Name="Release|x64"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_syriac_fc" - /> - </FileConfiguration> + <FileConfiguration Name="Debug_FC|Win32"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_syriac_fc" /></FileConfiguration> + <FileConfiguration Name="Release_FC|Win32"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_syriac_fc" /></FileConfiguration> + <FileConfiguration Name="Debug_FC|x64"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_syriac_fc" /></FileConfiguration> + <FileConfiguration Name="Release_FC|x64"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_syriac_fc" /></FileConfiguration> </File> <File RelativePath="..\..\..\modules\syriac\syriac-ot.c" /> <File RelativePath="..\..\..\modules\thai\thai-charprop.c" /> <File RelativePath="..\..\..\modules\thai\thai-fc.c"> - <FileConfiguration Name="Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_thai_fc" - /> - </FileConfiguration> - <FileConfiguration Name="Debug|x64"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_thai_fc" - /> - </FileConfiguration> - <FileConfiguration Name="Release|Win32"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_thai_fc" - /> - </FileConfiguration> - <FileConfiguration Name="Release|x64"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_thai_fc" - /> - </FileConfiguration> + <FileConfiguration Name="Debug_FC|Win32"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_thai_fc" /></FileConfiguration> + <FileConfiguration Name="Release_FC|Win32"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_thai_fc" /></FileConfiguration> + <FileConfiguration Name="Debug_FC|x64"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_thai_fc" /></FileConfiguration> + <FileConfiguration Name="Release_FC|x64"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_thai_fc" /></FileConfiguration> </File> <File RelativePath="..\..\..\modules\thai\thai-shaper.c" /> <File RelativePath="..\..\..\modules\tibetan\tibetan-fc.c"> - <FileConfiguration Name="Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_tibetan_fc" - /> - </FileConfiguration> - <FileConfiguration Name="Debug|x64"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_tibetan_fc" - /> - </FileConfiguration> - <FileConfiguration Name="Release|Win32"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_tibetan_fc" - /> - </FileConfiguration> - <FileConfiguration Name="Release|x64"> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_tibetan_fc" - /> - </FileConfiguration> + <FileConfiguration Name="Debug_FC|Win32"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_tibetan_fc" /></FileConfiguration> + <FileConfiguration Name="Release_FC|Win32"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_tibetan_fc" /></FileConfiguration> + <FileConfiguration Name="Debug_FC|x64"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_tibetan_fc" /></FileConfiguration> + <FileConfiguration Name="Release_FC|x64"><Tool Name="VCCLCompilerTool" PreprocessorDefinitions="PANGO_MODULE_PREFIX=_pango_tibetan_fc" /></FileConfiguration> </File> #include "opentype/libharfbuzz.sourcefiles" #include "libpangoft2.sourcefiles" diff --git a/build/win32/vs9/pangowin32.vcproj b/build/win32/vs9/pangowin32.vcproj index 80e1f205..ce34ae7e 100644 --- a/build/win32/vs9/pangowin32.vcproj +++ b/build/win32/vs9/pangowin32.vcproj @@ -20,12 +20,15 @@ </ToolFiles> <Configurations> <Configuration - Name="Debug|Win32" - InheritedPropertySheets=".\pango.vsprops" + Name="Debug_FC|Win32" ConfigurationType="2" + InheritedPropertySheets=".\pango.vsprops" CharacterSet="2" > <Tool + Name="VCPreBuildEventTool" + /> + <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="." @@ -39,6 +42,7 @@ /> <Tool Name="VCLinkerTool" + AdditionalDependencies="usp10.lib" OutputFile="$(OutDir)\$(PangoDllPrefix)$(ProjectName)$(PangoDllSuffix).dll" LinkIncremental="2" ModuleDefinitionFile="..\..\..\pango\pangowin32.def" @@ -49,12 +53,48 @@ /> </Configuration> <Configuration - Name="Release|Win32" + Name="Debug|Win32" + ConfigurationType="2" InheritedPropertySheets=".\pango.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="." + PreprocessorDefinitions="_DEBUG;$(PangoDefines);$(NoFCDef)" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="4" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="usp10.lib" + OutputFile="$(OutDir)\$(PangoDllPrefix)$(ProjectName)$(PangoDllSuffix).dll" + LinkIncremental="2" + ModuleDefinitionFile="..\..\..\pango\pangowin32.def" + GenerateDebugInformation="true" + SubSystem="2" + ImportLibrary="$(TargetDir)$(ProjectName)-$(PangoApiVersion).lib" + TargetMachine="1" + /> + </Configuration> + <Configuration + Name="Release_FC|Win32" ConfigurationType="2" + InheritedPropertySheets=".\pango.vsprops" CharacterSet="2" > <Tool + Name="VCPreBuildEventTool" + /> + <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="$(PangoDefines)" RuntimeLibrary="2" @@ -64,6 +104,7 @@ /> <Tool Name="VCLinkerTool" + AdditionalDependencies="usp10.lib" OutputFile="$(OutDir)\$(PangoDllPrefix)$(ProjectName)$(PangoDllSuffix).dll" LinkIncremental="2" ModuleDefinitionFile="..\..\..\pango\pangowin32.def" @@ -76,7 +117,38 @@ /> </Configuration> <Configuration - Name="Debug|x64" + Name="Release|Win32" + ConfigurationType="2" + InheritedPropertySheets=".\pango.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="$(PangoDefines);$(NoFCDef)" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="usp10.lib" + OutputFile="$(OutDir)\$(PangoDllPrefix)$(ProjectName)$(PangoDllSuffix).dll" + LinkIncremental="2" + ModuleDefinitionFile="..\..\..\pango\pangowin32.def" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + ImportLibrary="$(TargetDir)$(ProjectName)-$(PangoApiVersion).lib" + TargetMachine="1" + /> + </Configuration> + <Configuration + Name="Debug_FC|x64" InheritedPropertySheets=".\pango.vsprops" ConfigurationType="2" CharacterSet="2" @@ -94,6 +166,7 @@ /> <Tool Name="VCLinkerTool" + AdditionalDependencies="usp10.lib" OutputFile="$(OutDir)\$(PangoDllPrefix)$(ProjectName)$(PangoDllSuffix).dll" LinkIncremental="2" ModuleDefinitionFile="..\..\..\pango\pangowin32.def" @@ -104,7 +177,36 @@ /> </Configuration> <Configuration - Name="Release|x64" + Name="Debug|x64" + InheritedPropertySheets=".\pango.vsprops" + ConfigurationType="2" + CharacterSet="2" + > + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="_DEBUG;$(PangoDefines);$(NoFCDef)" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="usp10.lib" + OutputFile="$(OutDir)\$(PangoDllPrefix)$(ProjectName)$(PangoDllSuffix).dll" + LinkIncremental="2" + ModuleDefinitionFile="..\..\..\pango\pangowin32.def" + GenerateDebugInformation="true" + SubSystem="2" + ImportLibrary="$(TargetDir)$(ProjectName)-$(PangoApiVersion).lib" + TargetMachine="17" + /> + </Configuration> + <Configuration + Name="Release_FC|x64" InheritedPropertySheets=".\pango.vsprops" ConfigurationType="2" CharacterSet="2" @@ -119,6 +221,35 @@ /> <Tool Name="VCLinkerTool" + AdditionalDependencies="usp10.lib" + OutputFile="$(OutDir)\$(PangoDllPrefix)$(ProjectName)$(PangoDllSuffix).dll" + LinkIncremental="2" + ModuleDefinitionFile="..\..\..\pango\pangowin32.def" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + ImportLibrary="$(TargetDir)$(ProjectName)-$(PangoApiVersion).lib" + TargetMachine="17" + /> + </Configuration> + <Configuration + Name="Release|x64" + InheritedPropertySheets=".\pango.vsprops" + ConfigurationType="2" + CharacterSet="2" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="$(PangoDefines);$(NoFCDef)" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="usp10.lib" OutputFile="$(OutDir)\$(PangoDllPrefix)$(ProjectName)$(PangoDllSuffix).dll" LinkIncremental="2" ModuleDefinitionFile="..\..\..\pango\pangowin32.def" @@ -145,10 +276,7 @@ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" > - <File - RelativePath="..\..\..\pango\pangowin32.rc" - > - </File> + <File RelativePath="..\..\..\pango\pangowin32.rc" /> </Filter> <Filter Name="Source Files" @@ -157,9 +285,11 @@ > <File RelativePath="..\..\..\modules\basic\basic-win32.c" /> <File RelativePath="..\..\..\pango\module-defs-win32.c" /> - <File RelativePath="..\..\..\pango\pangowin32.c" /> <File RelativePath="..\..\..\pango\pangowin32-fontcache.c" /> <File RelativePath="..\..\..\pango\pangowin32-fontmap.c" /> + <File RelativePath="..\..\..\pango\pangowin32.c" /> </Filter> </Files> + <Globals> + </Globals> </VisualStudioProject> diff --git a/config.h.win32.in b/config.h.win32.in index 1864ad04..a7b12312 100644 --- a/config.h.win32.in +++ b/config.h.win32.in @@ -9,7 +9,9 @@ /* #undef HAVE_CAIRO_ATSUI */ /* Whether Cairo can use FreeType for fonts */ +#ifndef PANGO_VISUALC_NO_FC #define HAVE_CAIRO_FREETYPE 1 +#endif /* Whether Cairo has PDF support */ #define HAVE_CAIRO_PDF 1 @@ -37,7 +39,9 @@ /* #undef HAVE_FLOCKFILE */ /* Have FreeType 2 library */ +#ifndef PANGO_VISUALC_NO_FC #define HAVE_FREETYPE 1 +#endif /* Define to 1 if you have the `getpagesize' function. */ /* #undef HAVE_GETPAGESIZE */ @@ -55,7 +59,9 @@ /* #undef HAVE_NDIR_H */ /* Define to 1 if you have the <stdint.h> header file. */ -/* #undef HAVE_STDINT_H */ +#if (_MSC_VER >= 1600) +#define HAVE_STDINT_H 1 +#endif /* Define to 1 if you have the <stdlib.h> header file. */ #define HAVE_STDLIB_H 1 @@ -115,7 +121,7 @@ #define PACKAGE_NAME "pango" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "pango @PANGO_VERSION" +#define PACKAGE_STRING "pango @PANGO_VERSION@" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "pango" @@ -130,7 +136,7 @@ #define PANGO_INTERFACE_AGE @PANGO_INTERFACE_AGE@ /* PANGO major version */ -#define PANGO_VERSION_MAJOR @PANEG_VERSION_MAJOR@ +#define PANGO_VERSION_MAJOR @PANGO_VERSION_MAJOR@ /* PANGO micro version */ #define PANGO_VERSION_MICRO @PANGO_VERSION_MICRO@ @@ -148,4 +154,4 @@ #define VERSION "@PANGO_VERSION@" /* Define to 1 if the X Window System is missing or not being used. */ -/* #undef X_DISPLAY_MISSING */ +#define X_DISPLAY_MISSING 1 diff --git a/configure.in b/configure.in index 966bf648..4d9b1575 100644 --- a/configure.in +++ b/configure.in @@ -22,7 +22,7 @@ dnl dnl The triplet m4_define([pango_version_major], [1]) m4_define([pango_version_minor], [29]) -m4_define([pango_version_micro], [0]) +m4_define([pango_version_micro], [3]) m4_define([pango_version], [pango_version_major.pango_version_minor.pango_version_micro]) @@ -337,6 +337,25 @@ fi AC_CHECK_HEADER(Carbon/Carbon.h, [have_atsui=true], [have_atsui=false]) # +# Checks for CoreText +# + +AC_MSG_CHECKING([for CoreText availability]) +pango_save_libs=$LIBS +LIBS="$LIBS -framework ApplicationServices" +AC_TRY_LINK([#include <Carbon/Carbon.h>], [CTGetCoreTextVersion ();], +[have_core_text=yes], [have_core_text=no]) +LIBS=$pango_save_libs + +if test "$have_core_text" = "yes"; then + AC_DEFINE(HAVE_CORE_TEXT, 1, [Whether CoreText is available on the system]) +fi + +AC_MSG_RESULT([$have_core_text]) + +AM_CONDITIONAL(HAVE_CORE_TEXT, test "$have_core_text" = "yes") + +# # Checks for Cairo # have_cairo=false @@ -378,7 +397,7 @@ if $have_cairo ; then have_cairo=true fi - if $have_atsui; then + if test $have_atsui -o $have_core_text; then PKG_CHECK_EXISTS(cairo-quartz-font >= $cairo_required, have_cairo_atsui=true, :) fi if $have_cairo_atsui; then @@ -493,7 +512,7 @@ GOBJECT_INTROSPECTION_CHECK([0.9.5]) # Modules to build # arabic_modules="arabic-lang" -basic_modules="basic-fc,basic-win32,basic-x,basic-atsui" +basic_modules="basic-fc,basic-win32,basic-x,basic-atsui,basic-coretext" hangul_modules="hangul-fc" hebrew_modules="hebrew-fc" indic_modules="indic-fc,indic-lang" @@ -548,12 +567,14 @@ INCLUDED_X_MODULES= INCLUDED_FC_MODULES= INCLUDED_WIN32_MODULES= INCLUDED_ATSUI_MODULES= +INCLUDED_CORE_TEXT_MODULES= INCLUDED_LANG_MODULES= AC_SUBST(INCLUDED_X_MODULES) AC_SUBST(INCLUDED_FC_MODULES) AC_SUBST(INCLUDED_WIN32_MODULES) AC_SUBST(INCLUDED_ATSUI_MODULES) +AC_SUBST(INCLUDED_CORE_TEXT_MODULES) AC_SUBST(INCLUDED_LANG_MODULES) IFS="${IFS= }"; pango_save_ifs="$IFS"; IFS=", " @@ -569,6 +590,7 @@ for module in $included_modules; do *-fc) INCLUDED_FC_MODULES="$INCLUDED_FC_MODULES $included_path" ;; *-win32) INCLUDED_WIN32_MODULES="$INCLUDED_WIN32_MODULES $included_path" ;; *-atsui) INCLUDED_ATSUI_MODULES="$INCLUDED_ATSUI_MODULES $included_path" ;; + *-coretext) INCLUDED_CORE_TEXT_MODULES="$INCLUDED_CORE_TEXT_MODULES $included_path" ;; *-lang) INCLUDED_LANG_MODULES="$INCLUDED_LANG_MODULES $included_path" ;; *) IFS="$pango_save_ifs"; AC_MSG_ERROR([specified module $module not recognized]) ;; esac @@ -580,6 +602,7 @@ AM_CONDITIONAL(INCLUDE_BASIC_FC, echo $included_modules | egrep '(^|,)basic-fc($ AM_CONDITIONAL(INCLUDE_BASIC_WIN32, echo $included_modules | egrep '(^|,)basic-win32($|,)' > /dev/null) AM_CONDITIONAL(INCLUDE_BASIC_X, echo $included_modules | egrep '(^|,)basic-x($|,)' > /dev/null) AM_CONDITIONAL(INCLUDE_BASIC_ATSUI, echo $included_modules | egrep '(^|,)basic-atsui($|,)' > /dev/null) +AM_CONDITIONAL(INCLUDE_BASIC_CORE_TEXT, echo $included_modules | egrep '(^|,)basic-coretext($|,)' > /dev/null) AM_CONDITIONAL(INCLUDE_HANGUL_FC, echo $included_modules | egrep '(^|,)hangul-fc($|,)' > /dev/null) AM_CONDITIONAL(INCLUDE_HEBREW_FC, echo $included_modules | egrep '(^|,)hebrew-fc($|,)' > /dev/null) AM_CONDITIONAL(INCLUDE_INDIC_FC, echo $included_modules | egrep '(^|,)indic-fc($|,)' > /dev/null) @@ -594,6 +617,7 @@ AM_CONDITIONAL(DYNAMIC_BASIC_FC, echo $dynamic_modules | egrep '(^|,)basic-fc($| AM_CONDITIONAL(DYNAMIC_BASIC_WIN32, echo $dynamic_modules | egrep '(^|,)basic-win32($|,)' > /dev/null) AM_CONDITIONAL(DYNAMIC_BASIC_X, echo $dynamic_modules | egrep '(^|,)basic-x($|,)' > /dev/null) AM_CONDITIONAL(DYNAMIC_BASIC_ATSUI, echo $dynamic_modules | egrep '(^|,)basic-atsui($|,)' > /dev/null) +AM_CONDITIONAL(DYNAMIC_BASIC_CORE_TEXT, echo $dynamic_modules | egrep '(^|,)basic-coretext($|,)' > /dev/null) AM_CONDITIONAL(DYNAMIC_HANGUL_FC, echo $dynamic_modules | egrep '(^|,)hangul-fc($|,)' > /dev/null) AM_CONDITIONAL(DYNAMIC_HEBREW_FC, echo $dynamic_modules | egrep '(^|,)hebrew-fc($|,)' > /dev/null) AM_CONDITIONAL(DYNAMIC_INDIC_FC, echo $dynamic_modules | egrep '(^|,)indic-fc($|,)' > /dev/null) @@ -887,6 +911,35 @@ cat >> pango/module-defs-atsui.c <<EOTEXT EOTEXT ]) +AC_CONFIG_COMMANDS([pango/module-defs-coretext.c], +[ +### CoreText modules +cat > pango/module-defs-coretext.c <<EOTEXT +/* Autogenerated by configure. Do not edit */ + +#include "module-defs.h" + +PangoIncludedModule _pango_included_core_text_modules@<:@@:>@ = { +EOTEXT + +IFS="${IFS= }"; pango_save_ifs="$IFS"; IFS="," +for module in $included_modules; do + if echo $module | egrep -- "-coretext($|,)" > /dev/null; then + module_c=`echo $module | sed s/-/_/` + cat >> pango/module-defs-coretext.c <<EOTEXT + { _pango_${module_c}_script_engine_list, _pango_${module_c}_script_engine_init, _pango_${module_c}_script_engine_exit, _pango_${module_c}_script_engine_create }, +EOTEXT + fi +done + +IFS="$pango_save_ifs" + +cat >> pango/module-defs-coretext.c <<EOTEXT + { NULL, NULL, NULL, NULL }, +}; +EOTEXT +]) + AC_CONFIG_COMMANDS([pango/module-defs-lang.c], [ ### lang modules diff --git a/docs/Makefile.am b/docs/Makefile.am index b398e811..129f2cb3 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -7,7 +7,7 @@ DOC_MODULE=pango DOC_MAIN_SGML_FILE=pango-docs.sgml # Extra options to supply to gtkdoc-scan -SCAN_OPTIONS=--deprecated-guards="PANGO_DISABLE_DEPRECATED" +SCAN_OPTIONS=--deprecated-guards="PANGO_DISABLE_DEPRECATED" --rebuild-types # The directory containing the source code. Relative to $(srcdir) DOC_SOURCE_DIR=../pango @@ -45,6 +45,24 @@ IGNORE_HFILES= \ pango-script-lang-table.h \ pango-language-sample-table.h +if HAVE_CORE_TEXT +else +IGNORE_HFILES+= \ + pangocoretext.h \ + pangocoretext-private.h \ + pangocairo-coretext.h \ + pangocairo-coretextfont.h +endif + +if HAVE_CAIRO_ATSUI +else +IGNORE_HFILES+= \ + pangoatsui.h \ + pangoatsui-private.h \ + pangocairo-atsui.h \ + pangocairo-atsuifont.h +endif + # CFLAGS and LDFLAGS for compiling scan program. Only needed # if $(DOC_MODULE).types is non-empty. INCLUDES = \ diff --git a/docs/pango-docs.sgml b/docs/pango-docs.sgml index a769ec1f..a94cb2bc 100644 --- a/docs/pango-docs.sgml +++ b/docs/pango-docs.sgml @@ -136,6 +136,9 @@ <title>Index of new symbols in 1.26</title> </index> <index id="index-1.28" role="1.28"> - <title>Index of new symbols in 1.26</title> + <title>Index of new symbols in 1.28</title> + </index> + <index id="index-1.30" role="1.30"> + <title>Index of new symbols in 1.30</title> </index> </book> diff --git a/docs/pango-sections.txt b/docs/pango-sections.txt index 7b89b875..d8f2c05e 100644 --- a/docs/pango-sections.txt +++ b/docs/pango-sections.txt @@ -442,6 +442,7 @@ pango_layout_context_changed pango_layout_set_text pango_layout_get_text +pango_layout_get_character_count pango_layout_set_markup pango_layout_set_markup_with_accel pango_layout_set_attributes @@ -481,6 +482,7 @@ PANGO_TYPE_ALIGNMENT pango_layout_get_unknown_glyphs_count pango_layout_get_log_attrs +pango_layout_get_log_attrs_readonly pango_layout_index_to_pos pango_layout_index_to_line_x @@ -914,6 +916,48 @@ pango_cairo_atsui_font_get_type </SECTION> <SECTION> +<TITLE>CoreText Fonts</TITLE> +<FILE>coretext-fonts</FILE> +PANGO_RENDER_TYPE_CORE_TEXT +pango_core_text_font_get_ctfont +<SUBSECTION Standard> +PANGO_CAIRO_CORE_TEXT_FONT +PANGO_CAIRO_CORE_TEXT_FONT_CLASS +PANGO_CAIRO_CORE_TEXT_FONT_GET_CLASS +PANGO_CAIRO_CORE_TEXT_FONT_MAP +PANGO_CORE_TEXT_FONT +PANGO_CORE_TEXT_FONT_CLASS +PANGO_CORE_TEXT_FONT_GET_CLASS +PANGO_CORE_TEXT_FONT_MAP +PANGO_CORE_TEXT_FONT_MAP_CLASS +PANGO_CORE_TEXT_FONT_MAP_GET_CLASS +PANGO_CORE_TEXT_IS_FONT_MAP +PANGO_IS_CAIRO_CORE_TEXT_FONT_CLASS +PANGO_IS_CAIRO_CORE_TEXT_FONT_MAP +PANGO_IS_CORE_TEXT_FONT +PANGO_IS_CORE_TEXT_FONT_CLASS +PANGO_IS_CORE_TEXT_FONT_MAP_CLASS +PANGO_TYPE_CAIRO_CORE_TEXT_FONT +PANGO_TYPE_CAIRO_CORE_TEXT_FONT_MAP +PANGO_TYPE_CORE_TEXT_FONT +PANGO_TYPE_CORE_TEXT_FONT_MAP +PangoCairoCoreTextFont +PangoCairoCoreTextFontClass +PangoCairoCoreTextFontMap +PangoCoreTextFace +PangoCoreTextFamily +PangoCoreTextFont +PangoCoreTextFontClass +PangoCoreTextFontMap +PangoCoreTextFontMapClass +PangoCoreTextFontPrivate +pango_cairo_core_text_font_get_type +pango_cairo_core_text_font_map_get_type +pango_core_text_font_get_type +pango_core_text_font_map_get_type +</SECTION> + +<SECTION> <FILE>pangofc-fontmap</FILE> <TITLE>PangoFcFontMap</TITLE> PangoFcFontMap diff --git a/docs/tmpl/atsui-fonts.sgml b/docs/tmpl/atsui-fonts.sgml index c8b6aa06..7f3c9dd3 100644 --- a/docs/tmpl/atsui-fonts.sgml +++ b/docs/tmpl/atsui-fonts.sgml @@ -21,29 +21,3 @@ MacOS systems using the ATSUI text rendering subsystem. <!-- ##### SECTION Image ##### --> -<!-- ##### MACRO PANGO_RENDER_TYPE_ATSUI ##### --> -<para> -A string constant identifying the ATSUI renderer. The associated quark (see -g_quark_from_string()) is used to identify the renderer in pango_find_map(). -</para> - - - -<!-- ##### FUNCTION pango_atsui_font_get_cgfont ##### --> -<para> - -</para> - -@font: -@Returns: - - -<!-- ##### FUNCTION pango_atsui_font_get_atsfont ##### --> -<para> - -</para> - -@font: -@Returns: - - diff --git a/docs/tmpl/fonts.sgml b/docs/tmpl/fonts.sgml index 7b55dea7..16ca84f1 100644 --- a/docs/tmpl/fonts.sgml +++ b/docs/tmpl/fonts.sgml @@ -442,24 +442,6 @@ the documentation of the corresponding getters for documentation of their meaning. </para> -@ref_count: reference count. Used internally. See pango_font_metrics_ref() - and pango_font_metrics_unref(). -@ascent: the distance from the baseline to the highest point of the glyphs of - the font. This is positive in practically all fonts. -@descent: the distance from the baseline to the lowest point of the glyphs of - the font. This is positive in practically all fonts. -@approximate_char_width: approximate average width of the regular glyphs of - the font. Note that for this calculation, East Asian characters - (those passing g_unichar_iswide()) are counted as double-width. - This produces a more uniform value for this measure across languages - and results in more uniform and more expected UI sizes. -@approximate_digit_width: approximate average width of the glyphs for digits - of the font. -@underline_position: position of the underline. This is normally negative. -@underline_thickness: thickness of the underline. -@strikethrough_position: position of the strikethrough line. This is - normally positive. -@strikethrough_thickness: thickness of the strikethrough line. <!-- ##### MACRO PANGO_TYPE_FONT_METRICS ##### --> <para> diff --git a/docs/tmpl/glyphs.sgml b/docs/tmpl/glyphs.sgml index 399319eb..926bf539 100644 --- a/docs/tmpl/glyphs.sgml +++ b/docs/tmpl/glyphs.sgml @@ -168,12 +168,6 @@ horizontal origin. </para> -@xx: -@xy: -@yx: -@yy: -@x0: -@y0: <!-- ##### MACRO PANGO_TYPE_MATRIX ##### --> <para> @@ -395,11 +389,6 @@ The storage for the glyph information is owned by the structure which simplifies memory management. </para> -@num_glyphs: the number of glyphs in the string. -@glyphs: an array of #PangoGlyphInfo structures of length <structfield>num_glyphs</structfield>. -@log_clusters: for each glyph, byte index of the starting character for the -cluster. The indices are relative to the start of the text -corresponding to the PangoGlyphString. <!-- ##### STRUCT PangoGlyphItem ##### --> <para> @@ -410,10 +399,6 @@ of shaping text with #PangoLayout is a list of #PangoLayoutLine, each of which contains a list of #PangoGlyphItem. </para> -@item: a #PangoItem structure that provides information - about a segment of text. -@glyphs: the glyphs obtained by shaping the text - corresponding to @item. <!-- ##### STRUCT PangoGlyphItemIter ##### --> <para> @@ -457,14 +442,6 @@ None of the members of a #PangoGlyphItemIter should be modified manually. </para> -@glyph_item: the #PangoGlyphItem this iterator iterates over -@text: the UTF-8 text that @glyph_item refers to -@start_glyph: starting glyph of the cluster -@start_index: starting text index of the cluster -@start_char: starting number of characters of the cluster -@end_glyph: ending glyph of the cluster -@end_index: ending text index of the cluster -@end_char: ending number of characters of the cluster @Since: 1.22 <!-- ##### MACRO PANGO_TYPE_GLYPH_STRING ##### --> diff --git a/docs/tmpl/layout.sgml b/docs/tmpl/layout.sgml index 54e385ed..997507df 100644 --- a/docs/tmpl/layout.sgml +++ b/docs/tmpl/layout.sgml @@ -119,6 +119,15 @@ has no user-visible fields. @Returns: +<!-- ##### FUNCTION pango_layout_get_character_count ##### --> +<para> + +</para> + +@layout: +@Returns: + + <!-- ##### FUNCTION pango_layout_set_markup ##### --> <para> @@ -464,6 +473,16 @@ The #GObject type for #PangoAlignment. @n_attrs: +<!-- ##### FUNCTION pango_layout_get_log_attrs_readonly ##### --> +<para> + +</para> + +@layout: +@n_attrs: +@Returns: + + <!-- ##### FUNCTION pango_layout_index_to_pos ##### --> <para> @@ -826,12 +845,6 @@ Routines for rendering PangoLayout objects are provided in code specific to each rendering system. </para> -@layout: the parent layout for this line -@start_index: the start of the line as byte index into @layout->text -@length: the length of the line in bytes -@runs: a list containing the runs of the line in visual order -@is_paragraph_start: %TRUE if this is the first line of the paragraph -@resolved_dir: the resolved #PangoDirection of the line <!-- ##### TYPEDEF PangoLayoutRun ##### --> <para> diff --git a/docs/tmpl/main.sgml b/docs/tmpl/main.sgml index 8373b123..112baaaf 100644 --- a/docs/tmpl/main.sgml +++ b/docs/tmpl/main.sgml @@ -36,11 +36,6 @@ The #PangoItem structure stores information about a segment of text. It contains the following fields: </para> -@offset: the offset of the segment from the beginning of the - string in bytes. -@length: the length of the segment in bytes. -@num_chars: the length of the segment in characters. -@analysis: the properties of the segment. <!-- ##### STRUCT PangoAnalysis ##### --> <para> diff --git a/docs/tmpl/tab-stops.sgml b/docs/tmpl/tab-stops.sgml index 62b02020..0e28a72e 100644 --- a/docs/tmpl/tab-stops.sgml +++ b/docs/tmpl/tab-stops.sgml @@ -68,7 +68,7 @@ The #GObject type for #PangoTabAlign. @positions_in_pixels: @first_alignment: @first_position: -@Varargs: +@...: @Returns: diff --git a/docs/tmpl/text-attributes.sgml b/docs/tmpl/text-attributes.sgml index 98158f80..d7b5cb51 100644 --- a/docs/tmpl/text-attributes.sgml +++ b/docs/tmpl/text-attributes.sgml @@ -578,12 +578,6 @@ The #PangoColor structure is used to represent a color in an uncalibrated RGB color-space. </para> -@red: The red component of the color. This is a value between 0 and 65535, - with 65535 indicating full intensity. -@green: The green component of the color. This is a value between 0 and 65535, - with 65535 indicating full intensity. -@blue: The blue component of the color. This is a value between 0 and 65535, - with 65535 indicating full intensity. <!-- ##### MACRO PANGO_TYPE_COLOR ##### --> <para> diff --git a/modules/basic/Makefile.am b/modules/basic/Makefile.am index 646a61ec..70e4b6b1 100644 --- a/modules/basic/Makefile.am +++ b/modules/basic/Makefile.am @@ -54,6 +54,16 @@ libpango_basic_win32_la_SOURCES = basic-win32.c libpango_basic_win32_la_CFLAGS = -DPANGO_MODULE_PREFIX=_pango_basic_win32 if HAVE_CAIRO_ATSUI +if HAVE_CORE_TEXT +INCLUDES += $(CAIRO_CFLAGS) +if INCLUDE_BASIC_CORE_TEXT +noinst_LTLIBRARIES += libpango-basic-coretext.la +else +if DYNAMIC_BASIC_CORE_TEXT +module_LTLIBRARIES += pango-basic-coretext.la +endif +endif +else INCLUDES += $(ATSUI_CFLAGS) $(CAIRO_CFLAGS) if INCLUDE_BASIC_ATSUI noinst_LTLIBRARIES += libpango-basic-atsui.la @@ -63,6 +73,13 @@ module_LTLIBRARIES += pango-basic-atsui.la endif endif endif +endif + +pango_basic_coretext_la_LDFLAGS = -module $(MODULE_LIBTOOL_OPTIONS) -framework Carbon +pango_basic_coretext_la_LIBADD = $(pangocoretextlibs) +pango_basic_coretext_la_SOURCES = basic-coretext.c +libpango_basic_coretext_la_SOURCES = basic-coretext.c +libpango_basic_coretext_la_CFLAGS = -DPANGO_MODULE_PREFIX=_pango_basic_coretext pango_basic_atsui_la_LDFLAGS = -module $(MODULE_LIBTOOL_OPTIONS) -framework Carbon pango_basic_atsui_la_LIBADD = $(pangoatsuilibs) diff --git a/modules/basic/basic-coretext.c b/modules/basic/basic-coretext.c new file mode 100644 index 00000000..8dc3dbab --- /dev/null +++ b/modules/basic/basic-coretext.c @@ -0,0 +1,249 @@ +/* Pango + * basic-coretext.c + * + * Copyright (C) 2005 Imendio AB + * Copyright (C) 2010 Kristian Rietveld <kris@gtk.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "config.h" +#include <glib.h> +#include <string.h> +#include <Carbon/Carbon.h> +#include "pango-engine.h" +#include "pango-utils.h" +#include "pango-fontmap.h" +#include "pangocoretext.h" + +/* No extra fields needed */ +typedef PangoEngineShape BasicEngineCoreText; +typedef PangoEngineShapeClass BasicEngineCoreTextClass ; + +#define SCRIPT_ENGINE_NAME "BasicScriptEngineCoreText" +#define RENDER_TYPE PANGO_RENDER_TYPE_CORE_TEXT + +static PangoEngineScriptInfo basic_scripts[] = { + { PANGO_SCRIPT_COMMON, "" } +}; + +static PangoEngineInfo script_engines[] = { + { + SCRIPT_ENGINE_NAME, + PANGO_ENGINE_TYPE_SHAPE, + RENDER_TYPE, + basic_scripts, G_N_ELEMENTS(basic_scripts) + } +}; + +static void +set_glyph (PangoFont *font, + PangoGlyphString *glyphs, + int i, + int offset, + PangoGlyph glyph) +{ + PangoRectangle logical_rect; + + glyphs->glyphs[i].glyph = glyph; + + glyphs->glyphs[i].geometry.x_offset = 0; + glyphs->glyphs[i].geometry.y_offset = 0; + + glyphs->log_clusters[i] = offset; + pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph, NULL, &logical_rect); + glyphs->glyphs[i].geometry.width = logical_rect.width; +} + +static void +basic_engine_shape (PangoEngineShape *engine, + PangoFont *font, + const char *text, + gint length, + const PangoAnalysis *analysis, + PangoGlyphString *glyphs) +{ + const char *p; + char *copy; + CTLineRef line; + CFStringRef cstr; + CFDictionaryRef attributes; + CFAttributedStringRef attstr; + PangoCoreTextFont *cfont = PANGO_CORE_TEXT_FONT (font); + PangoCoverage *coverage; + CFArrayRef runs; + CTRunRef run; + CTRunStatus run_status; + CFIndex i, glyph_count; + const CGGlyph *cgglyphs; + + CFTypeRef keys[] = { + (CFTypeRef) kCTFontAttributeName + }; + + CFTypeRef values[] = { + pango_core_text_font_get_ctfont (cfont) + }; + + attributes = CFDictionaryCreate (kCFAllocatorDefault, + (const void **)keys, + (const void **)values, + 1, + &kCFCopyStringDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + + copy = g_strndup (text, length + 1); + copy[length] = 0; + + cstr = CFStringCreateWithCString (kCFAllocatorDefault, copy, + kCFStringEncodingUTF8); + g_free (copy); + + attstr = CFAttributedStringCreate (kCFAllocatorDefault, + cstr, + attributes); + + line = CTLineCreateWithAttributedString (attstr); + + runs = CTLineGetGlyphRuns (line); + + /* Since Pango divides things into runs already, we assume there is + * only a single run in this line. + */ + run = CFArrayGetValueAtIndex (runs, 0); + run_status = CTRunGetStatus (run); + glyph_count = CTRunGetGlyphCount (run); + cgglyphs = CTRunGetGlyphsPtr (run); + + p = text; + pango_glyph_string_set_size (glyphs, glyph_count); + coverage = pango_font_get_coverage (PANGO_FONT (cfont), + analysis->language); + + for (i = 0; i < glyph_count; i++) + { + CFIndex real_i, prev_i; + gunichar wc; + gunichar mirrored_ch; + + wc = g_utf8_get_char (p); + + if (analysis->level % 2) + if (pango_get_mirror_char (wc, &mirrored_ch)) + wc = mirrored_ch; + + if (run_status & kCTRunStatusRightToLeft) + { + real_i = glyph_count - i - 1; + prev_i = real_i + 1; + } + else + { + real_i = i; + prev_i = real_i - 1; + } + + if (wc == 0xa0) /* non-break-space */ + wc = 0x20; + + if (pango_is_zero_width (wc)) + { + set_glyph (font, glyphs, real_i, p - text, PANGO_GLYPH_EMPTY); + } + else + { + PangoCoverageLevel result; + + result = pango_coverage_get (coverage, wc); + + if (result != PANGO_COVERAGE_NONE) + { + set_glyph (font, glyphs, real_i, p - text, cgglyphs[real_i]); + + if (g_unichar_type (wc) == G_UNICODE_NON_SPACING_MARK) + { + if (i > 0) + { + PangoRectangle logical_rect, ink_rect; + + glyphs->glyphs[real_i].geometry.width = MAX (glyphs->glyphs[prev_i].geometry.width, + glyphs->glyphs[prev_i].geometry.width); + glyphs->glyphs[prev_i].geometry.width = 0; + glyphs->log_clusters[real_i] = glyphs->log_clusters[prev_i]; + + /* Some heuristics to try to guess how overstrike glyphs are + * done and compensate + */ + pango_font_get_glyph_extents (font, glyphs->glyphs[real_i].glyph, &ink_rect, &logical_rect); + if (logical_rect.width == 0 && ink_rect.x == 0) + glyphs->glyphs[real_i].geometry.x_offset = (glyphs->glyphs[real_i].geometry.width - ink_rect.width) / 2; + } + } + } + else + { + set_glyph (font, glyphs, real_i, p - text, + PANGO_GET_UNKNOWN_GLYPH (wc)); + } + } + + p = g_utf8_next_char (p); + } + + CFRelease (line); + CFRelease (attstr); + CFRelease (cstr); + CFRelease (attributes); + pango_coverage_unref (coverage); +} + +static void +basic_engine_core_text_class_init (PangoEngineShapeClass *class) +{ + class->script_shape = basic_engine_shape; +} + +PANGO_ENGINE_SHAPE_DEFINE_TYPE (BasicEngineCoreText, basic_engine_core_text, + basic_engine_core_text_class_init, NULL); + +void +PANGO_MODULE_ENTRY(init) (GTypeModule *module) +{ + basic_engine_core_text_register_type (module); +} + +void +PANGO_MODULE_ENTRY(exit) (void) +{ +} + +void +PANGO_MODULE_ENTRY(list) (PangoEngineInfo **engines, + int *n_engines) +{ + *engines = script_engines; + *n_engines = G_N_ELEMENTS (script_engines); +} + +PangoEngine * +PANGO_MODULE_ENTRY(create) (const char *id) +{ + if (!strcmp (id, SCRIPT_ENGINE_NAME)) + return g_object_new (basic_engine_core_text_type, NULL); + else + return NULL; +} + diff --git a/modules/hebrew/hebrew-shaper.c b/modules/hebrew/hebrew-shaper.c index 8aa36381..db3055b7 100644 --- a/modules/hebrew/hebrew-shaper.c +++ b/modules/hebrew/hebrew-shaper.c @@ -167,7 +167,7 @@ static const gboolean compose_table[4][4] = { #define is_composible(cur_wc, nxt_wc) (compose_table[char_type_table[ucs2iso8859_8 (cur_wc)]]\ [char_type_table[ucs2iso8859_8 (nxt_wc)]]) -G_CONST_RETURN char * +const char * hebrew_shaper_get_next_cluster(const char *text, gint length, gunichar *cluster, diff --git a/pango/Makefile.am b/pango/Makefile.am index de866d2c..98835348 100644 --- a/pango/Makefile.am +++ b/pango/Makefile.am @@ -378,6 +378,26 @@ libpangocairo_1_0_la_SOURCES += \ endif if HAVE_CAIRO_ATSUI +if HAVE_CORE_TEXT +libpangocairo_1_0_la_SOURCES += \ + modules.h \ + module-defs-coretext.c \ + pangocoretext.h \ + pangocoretext.c \ + pangocoretext-private.h \ + pangocoretext-fontmap.c \ + pangocairo-coretext.h \ + pangocairo-coretextfont.c \ + pangocairo-coretextfont.h \ + pangocairo-coretextfontmap.c +pangoinclude_HEADERS += pangocoretext.h + +libpangocairo_1_0_la_LDFLAGS += -framework CoreFoundation -framework ApplicationServices +libpangocairo_1_0_la_LIBADD += $(INCLUDED_CORE_TEXT_MODULES) +# We don't have an CoreText GIR right now, so this is just hypothetical +PANGOCAIRO_FONT_BACKEND_GI_MODULE = PangoCoreText-1.0 + +else libpangocairo_1_0_la_SOURCES += \ modules.h \ module-defs-atsui.c \ @@ -397,6 +417,7 @@ libpangocairo_1_0_la_LIBADD += $(INCLUDED_ATSUI_MODULES) # We don't have an ATSUI GIR right now, so this is just hypothetical PANGOCAIRO_FONT_BACKEND_GI_MODULE = PangoATSUI-1.0 endif +endif pangocairo_introspection_files = \ $(libpangocairo_1_0_la_SOURCES) \ @@ -598,7 +619,8 @@ MODULE_DEF_FILES = \ module-defs-x.c \ module-defs-fc.c \ module-defs-win32.c \ - module-defs-atsui.c + module-defs-atsui.c \ + module-defs-coretext.c $(MODULE_DEF_FILES): $(top_builddir)/config.status $(AM_V_GEN) cd $(top_builddir) && $(SHELL) ./config.status pango/$@ diff --git a/pango/fonts.c b/pango/fonts.c index 34cd67c3..6d35f83e 100644 --- a/pango/fonts.c +++ b/pango/fonts.c @@ -155,7 +155,7 @@ pango_font_description_set_family_static (PangoFontDescription *desc, * %NULL if not previously set. This has the same life-time * as the font description itself and should not be freed. **/ -G_CONST_RETURN char * +const char * pango_font_description_get_family (const PangoFontDescription *desc) { g_return_val_if_fail (desc != NULL, NULL); @@ -509,7 +509,7 @@ pango_font_description_unset_fields (PangoFontDescription *desc, /** * pango_font_description_merge: * @desc: a #PangoFontDescription - * @desc_to_merge: the #PangoFontDescription to merge from, or %NULL + * @desc_to_merge: (allow-none): the #PangoFontDescription to merge from, or %NULL * @replace_existing: if %TRUE, replace fields in @desc with the * corresponding values from @desc_to_merge, even if they * are already exist. @@ -615,7 +615,7 @@ compute_distance (const PangoFontDescription *a, /** * pango_font_description_better_match: * @desc: a #PangoFontDescription - * @old_match: a #PangoFontDescription, or %NULL + * @old_match: (allow-none): a #PangoFontDescription, or %NULL * @new_match: a #PangoFontDescription * * Determines if the style attributes of @new_match are a closer match @@ -815,7 +815,8 @@ pango_font_description_free (PangoFontDescription *desc) /** * pango_font_descriptions_free: - * @descs: a pointer to an array of #PangoFontDescription, may be %NULL + * @descs: (allow-none) (array length=n_descs) (transfer full): a pointer + * to an array of #PangoFontDescription, may be %NULL * @n_descs: number of font descriptions in @descs * * Frees an array of font descriptions. @@ -1545,10 +1546,10 @@ pango_font_find_shaper (PangoFont *font, * pango_font_get_glyph_extents: * @font: a #PangoFont * @glyph: the glyph index - * @ink_rect: rectangle used to store the extents of the glyph as drawn - * or %NULL to indicate that the result is not needed. - * @logical_rect: rectangle used to store the logical extents of the glyph - * or %NULL to indicate that the result is not needed. + * @ink_rect: (out) (allow-none): rectangle used to store the extents of the glyph + * as drawn or %NULL to indicate that the result is not needed. + * @logical_rect: (out) (allow-none): rectangle used to store the logical extents of + * the glyph or %NULL to indicate that the result is not needed. * * Gets the logical and ink extents of a glyph within a font. The * coordinate system for each rectangle has its origin at the @@ -1592,9 +1593,8 @@ pango_font_get_glyph_extents (PangoFont *font, /** * pango_font_get_metrics: * @font: a #PangoFont - * @language: language tag used to determine which script to get the metrics - * for, or %NULL to indicate to get the metrics for the entire - * font. + * @language: (allow-none): language tag used to determine which script to get the metrics + * for, or %NULL to indicate to get the metrics for the entire font. * * Gets overall metric information for a font. Since the metrics may be * substantially different for different scripts, a language tag can @@ -1644,7 +1644,8 @@ pango_font_get_metrics (PangoFont *font, * alive. In most uses this is not an issue as a #PangoContext holds * a reference to the font map. * - * Return value: the #PangoFontMap for the font, or %NULL if @font is %NULL. + * Return value: (transfer none): the #PangoFontMap for the font, or %NULL + * if @font is %NULL. * * Since: 1.10 **/ @@ -1907,7 +1908,7 @@ pango_font_family_init (PangoFontFamily *family G_GNUC_UNUSED) * Return value: the name of the family. This string is owned * by the family object and must not be modified or freed. **/ -G_CONST_RETURN char * +const char * pango_font_family_get_name (PangoFontFamily *family) { g_return_val_if_fail (PANGO_IS_FONT_FAMILY (family), NULL); @@ -1918,10 +1919,10 @@ pango_font_family_get_name (PangoFontFamily *family) /** * pango_font_family_list_faces: * @family: a #PangoFontFamily - * @faces: location to store an array of pointers to #PangoFontFace + * @faces: (out) (allow-none) (array length=n_faces): location to store an array of pointers to #PangoFontFace * objects, or %NULL. This array should be freed with g_free() * when it is no longer needed. - * @n_faces: location to store number of elements in @faces. + * @n_faces: (out): location to store number of elements in @faces. * * Lists the different font faces that make up @family. The faces * in a family share a common design, but differ in slant, weight, @@ -2040,7 +2041,7 @@ pango_font_face_is_synthesized (PangoFontFace *face) * Return value: the face name for the face. This string is * owned by the face object and must not be modified or freed. **/ -G_CONST_RETURN char * +const char * pango_font_face_get_face_name (PangoFontFace *face) { g_return_val_if_fail (PANGO_IS_FONT_FACE (face), NULL); diff --git a/pango/glyphstring.c b/pango/glyphstring.c index e407bd6a..58a30043 100644 --- a/pango/glyphstring.c +++ b/pango/glyphstring.c @@ -261,10 +261,10 @@ pango_glyph_string_extents_range (PangoGlyphString *glyphs, * pango_glyph_string_extents: * @glyphs: a #PangoGlyphString * @font: a #PangoFont - * @ink_rect: rectangle used to store the extents of the glyph string as drawn - * or %NULL to indicate that the result is not needed. - * @logical_rect: rectangle used to store the logical extents of the glyph string - * or %NULL to indicate that the result is not needed. + * @ink_rect: (out) (allow-none): rectangle used to store the extents of the glyph string + * as drawn or %NULL to indicate that the result is not needed. + * @logical_rect: (out) (allow-none): rectangle used to store the logical extents of the + * glyph string or %NULL to indicate that the result is not needed. * * Compute the logical and ink extents of a glyph string. See the documentation * for pango_font_get_glyph_extents() for details about the interpretation diff --git a/pango/modules.c b/pango/modules.c index dad8aae7..5ef2f315 100644 --- a/pango/modules.c +++ b/pango/modules.c @@ -93,8 +93,6 @@ static GSList *registered_engines = NULL; static GSList *dlloaded_engines = NULL; static GHashTable *dlloaded_modules; -static GObjectClass *parent_class; - static void build_map (PangoMapInfo *info); static void init_modules (void); @@ -178,6 +176,8 @@ pango_find_map (PangoLanguage *language, return map_info->map; } +G_DEFINE_TYPE (PangoModule, pango_module, G_TYPE_TYPE_MODULE); + static gboolean pango_module_load (GTypeModule *module) { @@ -258,7 +258,12 @@ pango_module_finalize (GObject *object) g_free (module->path); - parent_class->finalize (object); + G_OBJECT_CLASS (pango_module_parent_class)->finalize (object); +} + +static void +pango_module_init (PangoModule *self) +{ } static void @@ -267,17 +272,12 @@ pango_module_class_init (PangoModuleClass *class) GTypeModuleClass *module_class = G_TYPE_MODULE_CLASS (class); GObjectClass *gobject_class = G_OBJECT_CLASS (class); - parent_class = G_OBJECT_CLASS (g_type_class_peek_parent (class)); - module_class->load = pango_module_load; module_class->unload = pango_module_unload; gobject_class->finalize = pango_module_finalize; } -static PANGO_DEFINE_TYPE (PangoModule, pango_module, - pango_module_class_init, NULL, - G_TYPE_TYPE_MODULE) static PangoEngine * pango_engine_pair_get_engine (PangoEnginePair *pair) diff --git a/pango/modules.h b/pango/modules.h index ca22701b..7eac8fb6 100644 --- a/pango/modules.h +++ b/pango/modules.h @@ -30,5 +30,6 @@ extern PangoIncludedModule _pango_included_x_modules[]; extern PangoIncludedModule _pango_included_fc_modules[]; extern PangoIncludedModule _pango_included_win32_modules[]; extern PangoIncludedModule _pango_included_atsui_modules[]; +extern PangoIncludedModule _pango_included_core_text_modules[]; #endif /* __MODULES_H__ */ diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c index a253a67c..4b9d5071 100644 --- a/pango/pango-attributes.c +++ b/pango/pango-attributes.c @@ -97,7 +97,7 @@ pango_attr_type_register (const gchar *name) * * Since: 1.22 **/ -G_CONST_RETURN char * +const char * pango_attr_type_get_name (PangoAttrType type) { const char *result = NULL; @@ -960,11 +960,11 @@ pango_attr_shape_equal (const PangoAttribute *attr1, * @ink_rect: ink rectangle to assign to each character * @logical_rect: logical rectangle to assign to each character * @data: user data pointer - * @copy_func: function to copy @data when the attribute - * is copied. If %NULL, @data is simply copied - * as a pointer. - * @destroy_func: function to free @data when the attribute - * is freed, or %NULL + * @copy_func: (allow-none): function to copy @data when the + * attribute is copied. If %NULL, @data is simply + * copied as a pointer. + * @destroy_func: (allow-none): function to free @data when the + * attribute is freed, or %NULL * * Like pango_attr_shape_new(), but a user data pointer is also * provided; this pointer can be accessed when later @@ -1782,9 +1782,9 @@ pango_attr_iterator_get (PangoAttrIterator *iterator, * an attribute in the #PangoAttrList associated with the iterator, * so if you plan to keep it around, you must call: * <literal>pango_font_description_set_family (desc, pango_font_description_get_family (desc))</literal>. - * @language: if non-%NULL, location to store language tag for item, or %NULL + * @language: (allow-none): if non-%NULL, location to store language tag for item, or %NULL * if none is found. - * @extra_attrs: (element type Pango.Attribute) (transfer full): if non-%NULL, + * @extra_attrs: (allow-none) (element-type Pango.Attribute) (transfer full): if non-%NULL, * location in which to store a list of non-font * attributes at the the current position; only the highest priority * value of each attribute will be added to this list. In order @@ -1931,15 +1931,15 @@ pango_attr_iterator_get_font (PangoAttrIterator *iterator, /** * pango_attr_list_filter: * @list: a #PangoAttrList - * @func: callback function; returns %TRUE if an attribute - * should be filtered out. - * @data: Data to be passed to @func + * @func: (scope call) (closure data): callback function; returns %TRUE + * if an attribute should be filtered out. + * @data: (closure): Data to be passed to @func * * Given a #PangoAttrList and callback function, removes any elements * of @list for which @func returns %TRUE and inserts them into * a new list. * - * Return value: the new #PangoAttrList or %NULL if + * Return value: (transfer full): the new #PangoAttrList or %NULL if * no attributes of the given types were found. * * Since: 1.2 diff --git a/pango/pango-attributes.h b/pango/pango-attributes.h index 866e35dd..59f97a3a 100644 --- a/pango/pango-attributes.h +++ b/pango/pango-attributes.h @@ -180,7 +180,7 @@ struct _PangoAttrFontDesc }; PangoAttrType pango_attr_type_register (const gchar *name); -G_CONST_RETURN char * pango_attr_type_get_name (PangoAttrType type) G_GNUC_CONST; +const char * pango_attr_type_get_name (PangoAttrType type) G_GNUC_CONST; void pango_attribute_init (PangoAttribute *attr, const PangoAttrClass *klass); diff --git a/pango/pango-context.c b/pango/pango-context.c index 6ec0b56f..110a6f36 100644 --- a/pango/pango-context.c +++ b/pango/pango-context.c @@ -146,8 +146,8 @@ update_resolved_gravity (PangoContext *context) /** * pango_context_set_matrix: * @context: a #PangoContext - * @matrix: a #PangoMatrix, or %NULL to unset any existing matrix. - * (No matrix set is the same as setting the identity matrix.) + * @matrix: (allow-none): a #PangoMatrix, or %NULL to unset any existing + * matrix. (No matrix set is the same as setting the identity matrix.) * * Sets the transformation matrix that will be applied when rendering * with this context. Note that reported metrics are in the user space @@ -188,7 +188,7 @@ pango_context_set_matrix (PangoContext *context, * * Since: 1.6 **/ -G_CONST_RETURN PangoMatrix * +const PangoMatrix * pango_context_get_matrix (PangoContext *context) { g_return_val_if_fail (PANGO_IS_CONTEXT (context), NULL); @@ -227,8 +227,8 @@ pango_context_set_font_map (PangoContext *context, * * Gets the #PangoFontmap used to look up fonts for this context. * - * Return value: the font map for the #PangoContext. This value - * is owned by Pango and should not be unreferenced. + * Return value: (transfer none): the font map for the #PangoContext. + * This value is owned by Pango and should not be unreferenced. * * Since: 1.6 **/ @@ -243,9 +243,10 @@ pango_context_get_font_map (PangoContext *context) /** * pango_context_list_families: * @context: a #PangoContext - * @families: location to store a pointer to an array of #PangoFontFamily *. - * This array should be freed with g_free(). - * @n_families: location to store the number of elements in @descs + * @families: (out) (array length=n_families): location to store a pointer to + * an array of #PangoFontFamily *. This array should be freed + * with g_free(). + * @n_families: (out): location to store the number of elements in @descs * * List all families for a context. **/ @@ -280,7 +281,8 @@ pango_context_list_families (PangoContext *context, * Loads the font in one of the fontmaps in the context * that is the closest match for @desc. * - * Returns: the font loaded, or %NULL if no font matched. + * Returns: (transfer full): the newly allocated #PangoFont that + * was loaded, or %NULL if no font matched. **/ PangoFont * pango_context_load_font (PangoContext *context, @@ -300,7 +302,8 @@ pango_context_load_font (PangoContext *context, * Load a set of fonts in the context that can be used to render * a font matching @desc. * - * Returns: the fontset, or %NULL if no font matched. + * Returns: (transfer full): the newly allocated #PangoFontset loaded, + * or %NULL if no font matched. **/ PangoFontset * pango_context_load_fontset (PangoContext *context, @@ -1481,23 +1484,23 @@ itemize_state_finish (ItemizeState *state) /** * pango_itemize_with_base_dir: * @context: a structure holding information that affects - the itemization process. + * the itemization process. + * @base_dir: base direction to use for bidirectional processing * @text: the text to itemize. * @start_index: first byte in @text to process * @length: the number of bytes (not characters) to process - * after @start_index. - * This must be >= 0. - * @base_dir: base direction to use for bidirectional processing + * after @start_index. This must be >= 0. * @attrs: the set of attributes that apply to @text. - * @cached_iter: Cached attribute iterator, or %NULL + * @cached_iter: (allow-none): Cached attribute iterator, or %NULL * * Like pango_itemize(), but the base direction to use when * computing bidirectional levels (see pango_context_set_base_dir ()), * is specified explicitly rather than gotten from the #PangoContext. * - * Return value: a #GList of #PangoItem structures. The items should be - * freed using pango_item_free() probably in combination with g_list_foreach(), - * and the list itself using g_list_free(). + * Return value: (transfer full) (element-type Pango.Item): a #GList of + * #PangoItem structures. The items should be freed using + * pango_item_free() probably in combination with + * g_list_foreach(), and the list itself using g_list_free(). * * Since: 1.4 */ @@ -1566,7 +1569,7 @@ itemize_with_font (PangoContext *context, * after @start_index. * This must be >= 0. * @attrs: the set of attributes that apply to @text. - * @cached_iter: Cached attribute iterator, or %NULL + * @cached_iter: (allow-none): Cached attribute iterator, or %NULL * * Breaks a piece of text into segments with consistent * directional level and shaping engine. Each byte of @text will @@ -1579,7 +1582,10 @@ itemize_with_font (PangoContext *context, * the range covering the position just after @start_index + @length. * (i.e. if itemizing in a loop, just keep passing in the same @cached_iter). * - * Return value: a #GList of #PangoItem structures. + * Return value: (transfer full) (element-type Pango.Item): a #GList of #PangoItem + * structures. The items should be freed using pango_item_free() + * probably in combination with g_list_foreach(), and the list itself + * using g_list_free(). */ GList * pango_itemize (PangoContext *context, @@ -1674,13 +1680,13 @@ update_metrics_from_items (PangoFontMetrics *metrics, /** * pango_context_get_metrics: * @context: a #PangoContext - * @desc: a #PangoFontDescription structure. %NULL means that the font - * description from the context will be used. - * @language: language tag used to determine which script to get the metrics - * for. %NULL means that the language tag from the context will - * be used. If no language tag is set on the context, metrics - * for the default language (as determined by - * pango_language_get_default()) will be returned. + * @desc: (allow-none): a #PangoFontDescription structure. %NULL means that the + * font description from the context will be used. + * @language: (allow-none): language tag used to determine which script to get + * the metrics for. %NULL means that the language tag from the context + * will be used. If no language tag is set on the context, metrics + * for the default language (as determined by pango_language_get_default()) + * will be returned. * * Get overall metric information for a particular font * description. Since the metrics may be substantially different for diff --git a/pango/pango-context.h b/pango/pango-context.h index d8c3cb86..d85928a5 100644 --- a/pango/pango-context.h +++ b/pango/pango-context.h @@ -84,9 +84,9 @@ void pango_context_set_gravity_hint (PangoContext PangoGravityHint hint); PangoGravityHint pango_context_get_gravity_hint (PangoContext *context); -void pango_context_set_matrix (PangoContext *context, - const PangoMatrix *matrix); -G_CONST_RETURN PangoMatrix *pango_context_get_matrix (PangoContext *context); +void pango_context_set_matrix (PangoContext *context, + const PangoMatrix *matrix); +const PangoMatrix * pango_context_get_matrix (PangoContext *context); /* Break a string of Unicode characters into segments with * consistent shaping/language engine and bidrectional level. diff --git a/pango/pango-engine.c b/pango/pango-engine.c index 50ba7f40..1a49385b 100644 --- a/pango/pango-engine.c +++ b/pango/pango-engine.c @@ -25,13 +25,32 @@ #include "pango-engine-private.h" #include "pango-impl-utils.h" -PANGO_DEFINE_TYPE_ABSTRACT (PangoEngine, pango_engine, - NULL, NULL, - G_TYPE_OBJECT) -PANGO_DEFINE_TYPE_ABSTRACT (PangoEngineLang, pango_engine_lang, - NULL, NULL, - PANGO_TYPE_ENGINE) +G_DEFINE_ABSTRACT_TYPE (PangoEngine, pango_engine, G_TYPE_OBJECT); + +static void +pango_engine_init (PangoEngine *self) +{ +} + +static void +pango_engine_class_init (PangoEngineClass *klass) +{ +} + + +G_DEFINE_ABSTRACT_TYPE (PangoEngineLang, pango_engine_lang, PANGO_TYPE_ENGINE); + +static void +pango_engine_lang_init (PangoEngineLang *self) +{ +} + +static void +pango_engine_lang_class_init (PangoEngineLangClass *klass) +{ +} + static PangoCoverageLevel pango_engine_shape_real_covers (PangoEngineShape *engine G_GNUC_UNUSED, @@ -48,16 +67,20 @@ pango_engine_shape_real_covers (PangoEngineShape *engine G_GNUC_UNUSED, return result; } + +G_DEFINE_ABSTRACT_TYPE (PangoEngineShape, pango_engine_shape, PANGO_TYPE_ENGINE); + +static void +pango_engine_shape_init (PangoEngineShape *klass) +{ +} + static void pango_engine_shape_class_init (PangoEngineShapeClass *class) { class->covers = pango_engine_shape_real_covers; } -PANGO_DEFINE_TYPE_ABSTRACT (PangoEngineShape, pango_engine_shape, - pango_engine_shape_class_init, NULL, - PANGO_TYPE_ENGINE) - void _pango_engine_shape_shape (PangoEngineShape *engine, PangoFont *font, @@ -154,17 +177,23 @@ fallback_engine_covers (PangoEngineShape *engine G_GNUC_UNUSED, return PANGO_COVERAGE_NONE; } + +static GType pango_fallback_engine_get_type (void); + +G_DEFINE_ABSTRACT_TYPE (PangoFallbackEngine, pango_fallback_engine, PANGO_TYPE_ENGINE_SHAPE); + +static void +pango_fallback_engine_init (PangoFallbackEngine *self) +{ +} + static void -fallback_engine_class_init (PangoEngineShapeClass *class) +pango_fallback_engine_class_init (PangoFallbackEngineClass *class) { class->covers = fallback_engine_covers; class->script_shape = fallback_engine_shape; } -static PANGO_DEFINE_TYPE (PangoFallbackEngine, pango_fallback_engine, - fallback_engine_class_init, NULL, - PANGO_TYPE_ENGINE_SHAPE) - PangoEngineShape * _pango_get_fallback_shaper (void) { diff --git a/pango/pango-font.h b/pango/pango-font.h index b5b2cf14..eea27b4e 100644 --- a/pango/pango-font.h +++ b/pango/pango-font.h @@ -117,7 +117,7 @@ void pango_font_description_set_family (PangoFontDescript const char *family); void pango_font_description_set_family_static (PangoFontDescription *desc, const char *family); -G_CONST_RETURN char *pango_font_description_get_family (const PangoFontDescription *desc) G_GNUC_PURE; +const char *pango_font_description_get_family (const PangoFontDescription *desc) G_GNUC_PURE; void pango_font_description_set_style (PangoFontDescription *desc, PangoStyle style); PangoStyle pango_font_description_get_style (const PangoFontDescription *desc) G_GNUC_PURE; @@ -212,7 +212,7 @@ GType pango_font_family_get_type (void) G_GNUC_CONST; void pango_font_family_list_faces (PangoFontFamily *family, PangoFontFace ***faces, int *n_faces); -G_CONST_RETURN char *pango_font_family_get_name (PangoFontFamily *family) G_GNUC_PURE; +const char *pango_font_family_get_name (PangoFontFamily *family) G_GNUC_PURE; gboolean pango_font_family_is_monospace (PangoFontFamily *family) G_GNUC_PURE; #ifdef PANGO_ENABLE_BACKEND @@ -261,7 +261,7 @@ struct _PangoFontFamilyClass GType pango_font_face_get_type (void) G_GNUC_CONST; PangoFontDescription *pango_font_face_describe (PangoFontFace *face); -G_CONST_RETURN char *pango_font_face_get_face_name (PangoFontFace *face) G_GNUC_PURE; +const char *pango_font_face_get_face_name (PangoFontFace *face) G_GNUC_PURE; void pango_font_face_list_sizes (PangoFontFace *face, int **sizes, int *n_sizes); diff --git a/pango/pango-fontmap.c b/pango/pango-fontmap.c index 13f4263c..ea6bb574 100644 --- a/pango/pango-fontmap.c +++ b/pango/pango-fontmap.c @@ -56,8 +56,8 @@ pango_font_map_init (PangoFontMap *fontmap G_GNUC_UNUSED) * gdk_pango_context_get_for_screen(), and * gtk_widget_get_pango_context(). Use those instead. * - * Return value: the newly allocated #PangoContext, which should - * be freed with g_object_unref(). + * Return value: (transfer full): the newly allocated #PangoContext, + * which should be freed with g_object_unref(). * * Since: 1.22 **/ @@ -82,7 +82,8 @@ pango_font_map_create_context (PangoFontMap *fontmap) * * Load the font in the fontmap that is the closest match for @desc. * - * Returns: the font loaded, or %NULL if no font matched. + * Returns: (transfer full): the newly allocated #PangoFont loaded, + * or %NULL if no font matched. **/ PangoFont * pango_font_map_load_font (PangoFontMap *fontmap, @@ -97,9 +98,9 @@ pango_font_map_load_font (PangoFontMap *fontmap, /** * pango_font_map_list_families: * @fontmap: a #PangoFontMap - * @families: location to store a pointer to an array of #PangoFontFamily *. + * @families: (out) (array length=n_families): location to store a pointer to an array of #PangoFontFamily *. * This array should be freed with g_free(). - * @n_families: location to store the number of elements in @families + * @n_families: (out): location to store the number of elements in @families * * List all families for a fontmap. **/ @@ -123,7 +124,8 @@ pango_font_map_list_families (PangoFontMap *fontmap, * Load a set of fonts in the fontmap that can be used to render * a font matching @desc. * - * Returns: the fontset, or %NULL if no font matched. + * Returns: (transfer full): the newly allocated #PangoFontset + * loaded, or %NULL if no font matched. **/ PangoFontset * pango_font_map_load_fontset (PangoFontMap *fontmap, @@ -290,7 +292,7 @@ pango_font_map_real_load_fontset (PangoFontMap *fontmap, * * Since: 1.4 **/ -G_CONST_RETURN char * +const char * pango_font_map_get_shape_engine_type (PangoFontMap *fontmap) { g_return_val_if_fail (PANGO_IS_FONT_MAP (fontmap), NULL); diff --git a/pango/pango-fontset.c b/pango/pango-fontset.c index ce1eb33d..7c382b34 100644 --- a/pango/pango-fontset.c +++ b/pango/pango-fontset.c @@ -32,14 +32,20 @@ static PangoFontMetrics *pango_fontset_real_get_metrics (PangoFontset *fontset); + +G_DEFINE_ABSTRACT_TYPE (PangoFontset, pango_fontset, G_TYPE_OBJECT); + +static void +pango_fontset_init (PangoFontset *self) +{ +} + static void pango_fontset_class_init (PangoFontsetClass *class) { class->get_metrics = pango_fontset_real_get_metrics; } -PANGO_DEFINE_TYPE_ABSTRACT (PangoFontset, pango_fontset, - pango_fontset_class_init, NULL, G_TYPE_OBJECT) /** * pango_fontset_get_font: @@ -49,8 +55,8 @@ PANGO_DEFINE_TYPE_ABSTRACT (PangoFontset, pango_fontset, * Returns the font in the fontset that contains the best glyph for the * Unicode character @wc. * - * Return value: a #PangoFont. The caller must call g_object_unref when finished - * with the font. + * Return value: (transfer full): a #PangoFont. The caller must call + * g_object_unref when finished with the font. **/ PangoFont * pango_fontset_get_font (PangoFontset *fontset, @@ -82,8 +88,8 @@ pango_fontset_get_metrics (PangoFontset *fontset) /** * pango_fontset_foreach: * @fontset: a #PangoFontset - * @func: Callback function - * @data: data to pass to the callback function + * @func: (closure data) (scope call): Callback function + * @data: (closure): data to pass to the callback function * * Iterates through all the fonts in a fontset, calling @func for * each one. If @func returns %TRUE, that stops the iteration. @@ -202,7 +208,6 @@ pango_fontset_real_get_metrics (PangoFontset *fontset) #define PANGO_FONTSET_SIMPLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONTSET_SIMPLE, PangoFontsetSimpleClass)) static void pango_fontset_simple_finalize (GObject *object); -static void pango_fontset_simple_init (PangoFontsetSimple *fontset); static PangoFontMetrics *pango_fontset_simple_get_metrics (PangoFontset *fontset); static PangoLanguage * pango_fontset_simple_get_language (PangoFontset *fontset); static PangoFont * pango_fontset_simple_get_font (PangoFontset *fontset, @@ -225,8 +230,6 @@ struct _PangoFontsetSimpleClass PangoFontsetClass parent_class; }; -static PangoFontsetClass *simple_parent_class; /* Parent class structure for PangoFontsetSimple */ - /** * pango_fontset_simple_new: * @language: a #PangoLanguage tag @@ -247,15 +250,17 @@ pango_fontset_simple_new (PangoLanguage *language) return fontset; } + +G_DEFINE_TYPE (PangoFontsetSimple, pango_fontset_simple, PANGO_TYPE_FONTSET); + static void pango_fontset_simple_class_init (PangoFontsetSimpleClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); PangoFontsetClass *fontset_class = PANGO_FONTSET_CLASS (class); - simple_parent_class = g_type_class_peek_parent (class); - object_class->finalize = pango_fontset_simple_finalize; + fontset_class->get_font = pango_fontset_simple_get_font; fontset_class->get_metrics = pango_fontset_simple_get_metrics; fontset_class->get_language = pango_fontset_simple_get_language; @@ -270,10 +275,6 @@ pango_fontset_simple_init (PangoFontsetSimple *fontset) fontset->language = NULL; } -PANGO_DEFINE_TYPE (PangoFontsetSimple, pango_fontset_simple, - pango_fontset_simple_class_init, pango_fontset_simple_init, - PANGO_TYPE_FONTSET) - static void pango_fontset_simple_finalize (GObject *object) { @@ -295,7 +296,7 @@ pango_fontset_simple_finalize (GObject *object) g_ptr_array_free (fontset->coverages, TRUE); - G_OBJECT_CLASS (simple_parent_class)->finalize (object); + G_OBJECT_CLASS (pango_fontset_simple_parent_class)->finalize (object); } /** @@ -344,7 +345,7 @@ pango_fontset_simple_get_metrics (PangoFontset *fontset) return pango_font_get_metrics (PANGO_FONT (g_ptr_array_index(simple->fonts, 0)), simple->language); - return PANGO_FONTSET_CLASS (simple_parent_class)->get_metrics (fontset); + return PANGO_FONTSET_CLASS (pango_fontset_simple_parent_class)->get_metrics (fontset); } static PangoFont * diff --git a/pango/pango-glyph-item.c b/pango/pango-glyph-item.c index 49d4b07d..26c3666f 100644 --- a/pango/pango-glyph-item.c +++ b/pango/pango-glyph-item.c @@ -564,9 +564,9 @@ split_before_cluster_start (ApplyAttrsState *state) * This function takes ownership of @glyph_item; it will be reused * as one of the elements in the list. * - * Return value: a list of glyph items resulting from splitting - * @glyph_item. Free the elements using pango_glyph_item_free(), - * the list using g_slist_free(). + * Return value: (transfer full): a list of glyph items resulting + * from splitting @glyph_item. Free the elements using + * pango_glyph_item_free(), the list using g_slist_free(). * * Since: 1.2 **/ diff --git a/pango/pango-impl-utils.h b/pango/pango-impl-utils.h index 6d6c8ff2..da3ef1cb 100644 --- a/pango/pango-impl-utils.h +++ b/pango/pango-impl-utils.h @@ -29,52 +29,6 @@ G_BEGIN_DECLS -#define PANGO_DEFINE_TYPE_FULL(name, prefix, \ - class_init, instance_init, \ - parent_type, abstract) \ -GType \ -prefix ## _get_type (void) \ -{ \ - static GType object_type = 0; \ - \ - if (!object_type) \ - { \ - static const GTypeInfo object_info = \ - { \ - sizeof (name ## Class), \ - (GBaseInitFunc) NULL, \ - (GBaseFinalizeFunc) NULL, \ - (GClassInitFunc) class_init, \ - (GClassFinalizeFunc) NULL, \ - NULL, /* class_data */ \ - sizeof (name), \ - 0, /* n_prelocs */ \ - (GInstanceInitFunc) instance_init, \ - NULL /* value_table */ \ - }; \ - \ - object_type = g_type_register_static (parent_type, \ - g_intern_static_string (# name), \ - &object_info, abstract); \ - } \ - \ - return object_type; \ -} - -#define PANGO_DEFINE_TYPE(name, prefix, \ - class_init, instance_init, \ - parent_type) \ - PANGO_DEFINE_TYPE_FULL (name, prefix, \ - class_init, instance_init, \ - parent_type, 0) - -#define PANGO_DEFINE_TYPE_ABSTRACT(name, prefix, \ - class_init, instance_init, \ - parent_type) \ - PANGO_DEFINE_TYPE_FULL (name, prefix, \ - class_init, instance_init, \ - parent_type, G_TYPE_FLAG_ABSTRACT) - /* String interning for static strings */ #define I_(string) g_intern_static_string (string) diff --git a/pango/pango-language.c b/pango/pango-language.c index a1675886..5b8583e9 100644 --- a/pango/pango-language.c +++ b/pango/pango-language.c @@ -245,7 +245,7 @@ pango_language_get_default (void) /** * pango_language_from_string: - * @language: a string representing a language tag, or %NULL + * @language: (allow-none): a string representing a language tag, or %NULL * * Take a RFC-3066 format language tag as a string and convert it to a * #PangoLanguage pointer that can be efficiently copied (copy the @@ -311,7 +311,7 @@ pango_language_from_string (const char *language) * Returns: a string representing the language tag. This is owned by * Pango and should not be freed. */ -G_CONST_RETURN char * +const char * (pango_language_to_string) (PangoLanguage *language) { return pango_language_to_string (language); @@ -523,7 +523,7 @@ static const LangInfo lang_texts[] = { * Return value: the sample string. This value is owned by Pango * and should not be freed. **/ -G_CONST_RETURN char * +const char * pango_language_get_sample_string (PangoLanguage *language) { const LangInfo *lang_info; @@ -553,8 +553,9 @@ pango_language_get_sample_string (PangoLanguage *language) /** * pango_language_get_scripts: - * @language: a #PangoLanguage, or %NULL - * @num_scripts: location to return number of scripts, or %NULL + * @language: (allow-none): a #PangoLanguage, or %NULL + * @num_scripts: (out caller-allocates) (allow-none): location to return number of scripts, + * or %NULL * * Determines the scripts used to to write @language. * If nothing is known about the language tag @language, @@ -584,7 +585,7 @@ pango_language_get_sample_string (PangoLanguage *language) * Since: 1.22 **/ -G_CONST_RETURN PangoScript * +const PangoScript * pango_language_get_scripts (PangoLanguage *language, int *num_scripts) { diff --git a/pango/pango-language.h b/pango/pango-language.h index 37cdc164..31660ca3 100644 --- a/pango/pango-language.h +++ b/pango/pango-language.h @@ -34,11 +34,11 @@ typedef struct _PangoLanguage PangoLanguage; GType pango_language_get_type (void) G_GNUC_CONST; PangoLanguage *pango_language_from_string (const char *language); -G_CONST_RETURN char *pango_language_to_string (PangoLanguage *language) G_GNUC_CONST; +const char *pango_language_to_string (PangoLanguage *language) G_GNUC_CONST; /* For back compat. Will have to keep indefinitely. */ #define pango_language_to_string(language) ((const char *)language) -G_CONST_RETURN char *pango_language_get_sample_string (PangoLanguage *language) G_GNUC_CONST; +const char *pango_language_get_sample_string (PangoLanguage *language) G_GNUC_CONST; PangoLanguage *pango_language_get_default (void) G_GNUC_CONST; gboolean pango_language_matches (PangoLanguage *language, @@ -48,7 +48,7 @@ gboolean pango_language_matches (PangoLanguage *language, gboolean pango_language_includes_script (PangoLanguage *language, PangoScript script) G_GNUC_PURE; -G_CONST_RETURN PangoScript *pango_language_get_scripts (PangoLanguage *language, +const PangoScript *pango_language_get_scripts (PangoLanguage *language, int *num_scripts); G_END_DECLS diff --git a/pango/pango-layout.c b/pango/pango-layout.c index 02fdf193..40f92fae 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -282,9 +282,9 @@ pango_layout_new (PangoContext *context) * tab array, and text from the original layout are all copied by * value. * - * Return value: the newly allocated #PangoLayout, with a reference - * count of one, which should be freed with - * g_object_unref(). + * Return value: (transfer full): the newly allocated #PangoLayout, + * with a reference count of one, which should be freed + * with g_object_unref(). **/ PangoLayout* pango_layout_copy (PangoLayout *src) @@ -591,7 +591,7 @@ pango_layout_get_spacing (PangoLayout *layout) /** * pango_layout_set_attributes: * @layout: a #PangoLayout - * @attrs: a #PangoAttrList, can be %NULL + * @attrs: (allow-none) (transfer full): a #PangoAttrList, can be %NULL * * Sets the text attributes for a layout object. * References @attrs, so the caller can unref its reference. @@ -638,7 +638,7 @@ pango_layout_get_attributes (PangoLayout *layout) /** * pango_layout_set_font_description: * @layout: a #PangoLayout - * @desc: the new #PangoFontDescription, or %NULL to unset the + * @desc: (allow-none): the new #PangoFontDescription, or %NULL to unset the * current font description * * Sets the default font description for the layout. If no font @@ -677,7 +677,7 @@ pango_layout_set_font_description (PangoLayout *layout, * * Since: 1.8 **/ -G_CONST_RETURN PangoFontDescription * +const PangoFontDescription * pango_layout_get_font_description (PangoLayout *layout) { g_return_val_if_fail (PANGO_IS_LAYOUT (layout), NULL); @@ -832,7 +832,7 @@ pango_layout_get_alignment (PangoLayout *layout) /** * pango_layout_set_tabs: * @layout: a #PangoLayout - * @tabs: a #PangoTabArray, or %NULL + * @tabs: (allow-none): a #PangoTabArray, or %NULL * * Sets the tabs to use for @layout, overriding the default tabs * (by default, tabs are every 8 spaces). If @tabs is %NULL, the default @@ -1087,7 +1087,7 @@ pango_layout_set_text (PangoLayout *layout, * * Return value: the text in the @layout. **/ -G_CONST_RETURN char* +const char* pango_layout_get_text (PangoLayout *layout) { g_return_val_if_fail (PANGO_IS_LAYOUT (layout), NULL); @@ -1096,11 +1096,31 @@ pango_layout_get_text (PangoLayout *layout) } /** + * pango_layout_get_character_count: + * @layout: a #PangoLayout + * + * Returns the number of Unicode characters in the + * the text of @layout. + * + * Return value: the number of Unicode characters + * in the text of @layout + * + * Since: 1.30 + */ +gint +pango_layout_get_character_count (PangoLayout *layout) +{ + g_return_val_if_fail (PANGO_IS_LAYOUT (layout), 0); + + return layout->n_chars; +} + +/** * pango_layout_set_markup: * @layout: a #PangoLayout * @markup: marked-up text * @length: length of marked-up text in bytes, or -1 if @markup is - * nul-terminated + * null-terminated * * Same as pango_layout_set_markup_with_accel(), but * the markup text isn't scanned for accelerators. @@ -1120,9 +1140,10 @@ pango_layout_set_markup (PangoLayout *layout, * @markup: marked-up text * (see <link linkend="PangoMarkupFormat">markup format</link>) * @length: length of marked-up text in bytes, or -1 if @markup is - * nul-terminated + * null-terminated * @accel_marker: marker for accelerators in the text - * @accel_char: return location for first located accelerator, or %NULL + * @accel_char: (out caller-allocates) (allow-none): return location + * for first located accelerator, or %NULL * * Sets the layout text and attribute list from marked-up text (see * <link linkend="PangoMarkupFormat">markup format</link>). Replaces @@ -1276,6 +1297,43 @@ pango_layout_get_log_attrs (PangoLayout *layout, *n_attrs = layout->n_chars + 1; } +/** + * pango_layout_get_log_attrs_readonly: + * @layout: a #PangoLayout + * @n_attrs: location to store the number of the attributes in the array + * + * Retrieves an array of logical attributes for each character in + * the @layout. + * + * This is a faster alternative to pango_layout_get_log_attrs(). + * The returned array is part of @layout and must not be modified. + * Modifying the layout will invalidate the returned array. + * + * The number of attributes returned in @n_attrs will be one more + * than the total number of characters in the layout, since there + * need to be attributes corresponding to both the position before + * the first character and the position after the last character. + * + * Returns: an array of logical attributes + * + * Since: 1.30 + */ +const PangoLogAttr * +pango_layout_get_log_attrs_readonly (PangoLayout *layout, + gint *n_attrs) +{ + if (n_attrs) + *n_attrs = 0; + g_return_val_if_fail (layout != NULL, NULL); + + pango_layout_check_lines (layout); + + if (n_attrs) + *n_attrs = layout->n_chars + 1; + + return layout->log_attrs; +} + /** * pango_layout_get_line_count: @@ -1375,7 +1433,6 @@ pango_layout_get_line (PangoLayout *layout, { GSList *list_item; g_return_val_if_fail (layout != NULL, NULL); - g_return_val_if_fail (line >= 0, NULL); if (line < 0) return NULL; @@ -1421,7 +1478,6 @@ pango_layout_get_line_readonly (PangoLayout *layout, { GSList *list_item; g_return_val_if_fail (layout != NULL, NULL); - g_return_val_if_fail (line >= 0, NULL); if (line < 0) return NULL; @@ -1597,10 +1653,10 @@ pango_layout_index_to_line_and_extents (PangoLayout *layout, * @trailing: an integer indicating the edge of the grapheme to retrieve the * position of. If 0, the trailing edge of the grapheme, if > 0, * the leading of the grapheme. - * @line: (out): location to store resulting line index. (which will - * between 0 and pango_layout_get_line_count(layout) - 1) - * @x_pos (out): location to store resulting position within line - * (%PANGO_SCALE units per device unit) + * @line: (out) (allow-none): location to store resulting line index. (which will + * between 0 and pango_layout_get_line_count(layout) - 1), or %NULL + * @x_pos: (out) (allow-none): location to store resulting position within line + * (%PANGO_SCALE units per device unit), or %NULL * * Converts from byte @index_ within the @layout to line and X position. * (X position is measured from the left edge of the line) @@ -2166,9 +2222,9 @@ pango_layout_line_get_char_direction (PangoLayoutLine *layout_line, * pango_layout_get_cursor_pos: * @layout: a #PangoLayout * @index_: the byte index of the cursor - * @strong_pos: (out): location to store the strong cursor position + * @strong_pos: (out) (allow-none): location to store the strong cursor position * (may be %NULL) - * @weak_pos: (out): location to store the weak cursor position (may be %NULL) + * @weak_pos: (out) (allow-none): location to store the weak cursor position (may be %NULL) * * Given an index within a layout, determines the positions that of the * strong and weak cursors if the insertion point is at that @@ -2588,11 +2644,12 @@ pango_layout_get_extents_internal (PangoLayout *layout, /** * pango_layout_get_extents: * @layout: a #PangoLayout - * @ink_rect: (out): rectangle used to store the extents of the layout as drawn - * or %NULL to indicate that the result is not needed. - * @logical_rect: (out):rectangle used to store the logical extents of the - * layout or %NULL to indicate that the result is not - * needed. + * @ink_rect: (out) (allow-none): rectangle used to store the extents of the + * layout as drawn or %NULL to indicate that the result is + * not needed. + * @logical_rect: (out) (allow-none):rectangle used to store the logical + * extents of the layout or %NULL to indicate that the + * result is not needed. * * Computes the logical and ink extents of @layout. Logical extents * are usually what you want for positioning things. Note that both extents @@ -2617,11 +2674,12 @@ pango_layout_get_extents (PangoLayout *layout, /** * pango_layout_get_pixel_extents: * @layout: a #PangoLayout - * @ink_rect: (out): rectangle used to store the extents of the layout as drawn - * or %NULL to indicate that the result is not needed. - * @logical_rect: (out): rectangle used to store the logical extents of the - * layout or %NULL to indicate that the result is not - * needed. + * @ink_rect: (out) (allow-none): rectangle used to store the extents of the + * layout as drawn or %NULL to indicate that the result is + * not needed. + * @logical_rect: (out) (allow-none): rectangle used to store the logical + * extents of the layout or %NULL to indicate that the + * result is not needed. * * Computes the logical and ink extents of @layout in device units. * This function just calls pango_layout_get_extents() followed by @@ -2644,8 +2702,8 @@ pango_layout_get_pixel_extents (PangoLayout *layout, /** * pango_layout_get_size: * @layout: a #PangoLayout - * @width: (out): location to store the logical width, or %NULL - * @height: (out): location to store the logical height, or %NULL + * @width: (out caller-allocates) (allow-none): location to store the logical width, or %NULL + * @height: (out caller-allocates) (allow-none): location to store the logical height, or %NULL * * Determines the logical width and height of a #PangoLayout * in Pango units (device units scaled by %PANGO_SCALE). This @@ -2669,8 +2727,8 @@ pango_layout_get_size (PangoLayout *layout, /** * pango_layout_get_pixel_size: * @layout: a #PangoLayout - * @width: (out): location to store the logical width, or %NULL - * @height: (out): location to store the logical height, or %NULL + * @width: (out) (allow-none): location to store the logical width, or %NULL + * @height: (out) (allow-none): location to store the logical height, or %NULL * * Determines the logical width and height of a #PangoLayout * in device units. (pango_layout_get_size() returns the width @@ -4176,7 +4234,7 @@ pango_layout_line_get_width (PangoLayoutLine *line) * the last range will extend all the way to the trailing * edge of the layout. Otherwise, it will end at the * trailing edge of the last character. - * @ranges: (out) (array length=n_ranges) (transfer=full): + * @ranges: (out) (array length=n_ranges) (transfer full): * location to store a pointer to an array of ranges. * The array will be of length <literal>2*n_ranges</literal>, * with each range starting at <literal>(*ranges)[2*n]</literal> @@ -4528,10 +4586,10 @@ pango_layout_run_get_extents (PangoLayoutRun *run, /** * pango_layout_line_get_extents: * @line: a #PangoLayoutLine - * @ink_rect: (out): rectangle used to store the extents of the glyph string - * as drawn, or %NULL - * @logical_rect: (out):rectangle used to store the logical extents of the glyph - * string, or %NULL + * @ink_rect: (out) (allow-none): rectangle used to store the extents of + * the glyph string as drawn, or %NULL + * @logical_rect: (out) (allow-none):rectangle used to store the logical + * extents of the glyph string, or %NULL * * Computes the logical and ink extents of a layout line. See * pango_font_get_glyph_extents() for details about the interpretation @@ -4676,10 +4734,10 @@ pango_layout_line_new (PangoLayout *layout) /** * pango_layout_line_get_pixel_extents: * @layout_line: a #PangoLayoutLine - * @ink_rect: (out): rectangle used to store the extents of the glyph string - * as drawn, or %NULL - * @logical_rect: (out): rectangle used to store the logical extents of the - * glyph string, or %NULL + * @ink_rect: (out) (allow-none): rectangle used to store the extents of + * the glyph string as drawn, or %NULL + * @logical_rect: (out) (allow-none): rectangle used to store the logical + * extents of the glyph string, or %NULL * * Computes the logical and ink extents of @layout_line in device units. * This function just calls pango_layout_line_get_extents() followed by @@ -5567,7 +5625,7 @@ pango_layout_iter_get_index (PangoLayoutIter *iter) * Use the faster pango_layout_iter_get_run_readonly() if you do not plan * to modify the contents of the run (glyphs, glyph widths, etc.). * - * Return value: the current run. + * Return value: (transfer none): the current run. **/ PangoLayoutRun* pango_layout_iter_get_run (PangoLayoutIter *iter) @@ -5593,7 +5651,7 @@ pango_layout_iter_get_run (PangoLayoutIter *iter) * but the user is not expected * to modify the contents of the run (glyphs, glyph widths, etc.). * - * Return value: the current run, that should not be modified. + * Return value: (transfer none): the current run, that should not be modified. * * Since: 1.16 **/ @@ -5683,7 +5741,7 @@ pango_layout_iter_at_last_line (PangoLayoutIter *iter) * * Gets the layout associated with a #PangoLayoutIter. * - * Return value: the layout associated with @iter. + * Return value: (transfer none): the layout associated with @iter. * * Since: 1.20 **/ @@ -5995,8 +6053,8 @@ pango_layout_iter_get_char_extents (PangoLayoutIter *iter, /** * pango_layout_iter_get_cluster_extents: * @iter: a #PangoLayoutIter - * @ink_rect: rectangle to fill with ink extents, or %NULL - * @logical_rect: rectangle to fill with logical extents, or %NULL + * @ink_rect: (out) (allow-none): rectangle to fill with ink extents, or %NULL + * @logical_rect: (out) (allow-none): rectangle to fill with logical extents, or %NULL * * Gets the extents of the current cluster, in layout coordinates * (origin is the top left of the entire layout). @@ -6043,8 +6101,8 @@ pango_layout_iter_get_cluster_extents (PangoLayoutIter *iter, /** * pango_layout_iter_get_run_extents: * @iter: a #PangoLayoutIter - * @ink_rect: rectangle to fill with ink extents, or %NULL - * @logical_rect: rectangle to fill with logical extents, or %NULL + * @ink_rect: (out) (allow-none): rectangle to fill with ink extents, or %NULL + * @logical_rect: (out) (allow-none): rectangle to fill with logical extents, or %NULL * * Gets the extents of the current run in layout coordinates * (origin is the top left of the entire layout). @@ -6100,8 +6158,8 @@ pango_layout_iter_get_run_extents (PangoLayoutIter *iter, /** * pango_layout_iter_get_line_extents: * @iter: a #PangoLayoutIter - * @ink_rect: rectangle to fill with ink extents, or %NULL - * @logical_rect: rectangle to fill with logical extents, or %NULL + * @ink_rect: (out) (allow-none): rectangle to fill with ink extents, or %NULL + * @logical_rect: (out) (allow-none): rectangle to fill with logical extents, or %NULL * * Obtains the extents of the current line. @ink_rect or @logical_rect * can be %NULL if you aren't interested in them. Extents are in layout @@ -6140,8 +6198,8 @@ pango_layout_iter_get_line_extents (PangoLayoutIter *iter, /** * pango_layout_iter_get_line_yrange: * @iter: a #PangoLayoutIter - * @y0_: start of line - * @y1_: end of line + * @y0_: (out) (allow-none): start of line, or %NULL + * @y1_: (out) (allow-none): end of line, or %NULL * * Divides the vertical space in the #PangoLayout being iterated over * between the lines in the layout, and returns the space belonging to @@ -6216,8 +6274,10 @@ pango_layout_iter_get_baseline (PangoLayoutIter *iter) /** * pango_layout_iter_get_layout_extents: * @iter: a #PangoLayoutIter - * @ink_rect: rectangle to fill with ink extents, or %NULL - * @logical_rect: rectangle to fill with logical extents, or %NULL + * @ink_rect: (out) (allow-none): rectangle to fill with ink extents, + * or %NULL + * @logical_rect: (out) (allow-none): rectangle to fill with logical + * extents, or %NULL * * Obtains the extents of the #PangoLayout being iterated * over. @ink_rect or @logical_rect can be %NULL if you diff --git a/pango/pango-layout.h b/pango/pango-layout.h index 3b769ffa..bb0a0cf3 100644 --- a/pango/pango-layout.h +++ b/pango/pango-layout.h @@ -103,6 +103,8 @@ void pango_layout_set_text (PangoLayout *layout, int length); const char *pango_layout_get_text (PangoLayout *layout); +gint pango_layout_get_character_count (PangoLayout *layout); + void pango_layout_set_markup (PangoLayout *layout, const char *markup, int length); @@ -116,7 +118,7 @@ void pango_layout_set_markup_with_accel (PangoLayout *layout, void pango_layout_set_font_description (PangoLayout *layout, const PangoFontDescription *desc); -G_CONST_RETURN PangoFontDescription *pango_layout_get_font_description (PangoLayout *layout); +const PangoFontDescription *pango_layout_get_font_description (PangoLayout *layout); void pango_layout_set_width (PangoLayout *layout, int width); @@ -166,6 +168,9 @@ void pango_layout_get_log_attrs (PangoLayout *layout, PangoLogAttr **attrs, gint *n_attrs); +const PangoLogAttr *pango_layout_get_log_attrs_readonly (PangoLayout *layout, + gint *n_attrs); + void pango_layout_index_to_pos (PangoLayout *layout, int index_, PangoRectangle *pos); diff --git a/pango/pango-matrix.c b/pango/pango-matrix.c index f3a47e4b..50a4c800 100644 --- a/pango/pango-matrix.c +++ b/pango/pango-matrix.c @@ -188,7 +188,7 @@ pango_matrix_concat (PangoMatrix *matrix, /** * pango_matrix_get_font_scale_factor: - * @matrix: a #PangoMatrix, may be %NULL + * @matrix: (allow-none): a #PangoMatrix, may be %NULL * * Returns the scale factor of a matrix on the height of the font. * That is, the scale factor in the direction perpendicular to the @@ -244,8 +244,8 @@ pango_matrix_get_font_scale_factor (const PangoMatrix *matrix) /** * pango_matrix_transform_distance: * @matrix: a #PangoMatrix, or %NULL - * @dx: in/out X component of a distance vector - * @dy: yn/out Y component of a distance vector + * @dx: (inout): in/out X component of a distance vector + * @dy: (inout): in/out Y component of a distance vector * * Transforms the distance vector (@dx,@dy) by @matrix. This is * similar to pango_matrix_transform_point() except that the translation @@ -284,8 +284,8 @@ pango_matrix_transform_distance (const PangoMatrix *matrix, /** * pango_matrix_transform_point: * @matrix: a #PangoMatrix, or %NULL - * @x: in/out X position - * @y: in/out Y position + * @x: (inout): in/out X position + * @y: (inout): in/out Y position * * Transforms the point (@x, @y) by @matrix. * @@ -308,7 +308,7 @@ pango_matrix_transform_point (const PangoMatrix *matrix, /** * pango_matrix_transform_rectangle: * @matrix: a #PangoMatrix, or %NULL - * @rect: in/out bounding box in Pango units, or %NULL + * @rect: (inout) (allow-none): in/out bounding box in Pango units, or %NULL * * First transforms @rect using @matrix, then calculates the bounding box * of the transformed rectangle. The rectangle should be in Pango units. @@ -388,7 +388,7 @@ pango_matrix_transform_rectangle (const PangoMatrix *matrix, /** * pango_matrix_transform_pixel_rectangle: * @matrix: a #PangoMatrix, or %NULL - * @rect: in/out bounding box in device units, or %NULL + * @rect: (inout) (allow-none): in/out bounding box in device units, or %NULL * * First transforms the @rect using @matrix, then calculates the bounding box * of the transformed rectangle. The rectangle should be in device units diff --git a/pango/pango-ot-info.c b/pango/pango-ot-info.c index b03fa64b..56d28bfe 100644 --- a/pango/pango-ot-info.c +++ b/pango/pango-ot-info.c @@ -25,44 +25,19 @@ #include "pango-impl-utils.h" #include FT_TRUETYPE_TABLES_H -static void pango_ot_info_class_init (GObjectClass *object_class); static void pango_ot_info_finalize (GObject *object); -static GObjectClass *parent_class; +G_DEFINE_TYPE (PangoOTInfo, pango_ot_info, G_TYPE_OBJECT); -GType -pango_ot_info_get_type (void) +static void +pango_ot_info_init (PangoOTInfo *self) { - static GType object_type = 0; - - if (G_UNLIKELY (!object_type)) - { - const GTypeInfo object_info = - { - sizeof (PangoOTInfoClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc)pango_ot_info_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoOTInfo), - 0, /* n_preallocs */ - NULL, /* init */ - NULL, /* value_table */ - }; - - object_type = g_type_register_static (G_TYPE_OBJECT, - I_("PangoOTInfo"), - &object_info, 0); - } - - return object_type; } static void -pango_ot_info_class_init (GObjectClass *object_class) +pango_ot_info_class_init (PangoOTInfoClass *klass) { - parent_class = g_type_class_peek_parent (object_class); + GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->finalize = pango_ot_info_finalize; } @@ -75,7 +50,7 @@ pango_ot_info_finalize (GObject *object) if (info->hb_face) hb_face_destroy (info->hb_face); - parent_class->finalize (object); + G_OBJECT_CLASS (pango_ot_info_parent_class)->finalize (object); } static void diff --git a/pango/pango-ot-ruleset.c b/pango/pango-ot-ruleset.c index b5e27959..82f82108 100644 --- a/pango/pango-ot-ruleset.c +++ b/pango/pango-ot-ruleset.c @@ -24,45 +24,14 @@ #include "pango-ot-private.h" #include "pango-impl-utils.h" -static void pango_ot_ruleset_class_init (GObjectClass *object_class); -static void pango_ot_ruleset_init (PangoOTRuleset *ruleset); static void pango_ot_ruleset_finalize (GObject *object); -static GObjectClass *parent_class; - -GType -pango_ot_ruleset_get_type (void) -{ - static GType object_type = 0; - - if (G_UNLIKELY (!object_type)) - { - const GTypeInfo object_info = - { - sizeof (PangoOTRulesetClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc)pango_ot_ruleset_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoOTRuleset), - 0, /* n_preallocs */ - (GInstanceInitFunc)pango_ot_ruleset_init, - NULL /* value_table */ - }; - - object_type = g_type_register_static (G_TYPE_OBJECT, - I_("PangoOTRuleset"), - &object_info, 0); - } - - return object_type; -} +G_DEFINE_TYPE (PangoOTRuleset, pango_ot_ruleset, G_TYPE_OBJECT); static void -pango_ot_ruleset_class_init (GObjectClass *object_class) +pango_ot_ruleset_class_init (PangoOTRulesetClass *klass) { - parent_class = g_type_class_peek_parent (object_class); + GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->finalize = pango_ot_ruleset_finalize; } @@ -86,7 +55,7 @@ pango_ot_ruleset_finalize (GObject *object) if (ruleset->info) g_object_remove_weak_pointer (G_OBJECT (ruleset->info), (gpointer *)(void *)&ruleset->info); - parent_class->finalize (object); + G_OBJECT_CLASS (pango_ot_ruleset_parent_class)->finalize (object); } /** @@ -107,7 +76,7 @@ pango_ot_ruleset_finalize (GObject *object) * * Since: 1.18 **/ -G_CONST_RETURN PangoOTRuleset * +const PangoOTRuleset * pango_ot_ruleset_get_for_description (PangoOTInfo *info, const PangoOTRulesetDescription *desc) { diff --git a/pango/pango-renderer.c b/pango/pango-renderer.c index db75446f..1565e640 100644 --- a/pango/pango-renderer.c +++ b/pango/pango-renderer.c @@ -106,15 +106,11 @@ to_device (PangoMatrix *matrix, G_DEFINE_ABSTRACT_TYPE (PangoRenderer, pango_renderer, G_TYPE_OBJECT) -static GObjectClass *parent_class; - static void pango_renderer_class_init (PangoRendererClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - parent_class = G_OBJECT_CLASS (g_type_class_peek_parent (klass)); - klass->draw_glyphs = pango_renderer_default_draw_glyphs; klass->draw_glyph_item = pango_renderer_default_draw_glyph_item; klass->draw_rectangle = pango_renderer_default_draw_rectangle; @@ -143,7 +139,7 @@ pango_renderer_finalize (GObject *gobject) if (renderer->matrix) pango_matrix_free (renderer->matrix); - parent_class->finalize (gobject); + G_OBJECT_CLASS (pango_renderer_parent_class)->finalize (gobject); } /** @@ -676,7 +672,7 @@ pango_renderer_default_draw_glyphs (PangoRenderer *renderer, /** * pango_renderer_draw_glyph_item: * @renderer: a #PangoRenderer - * @text: the UTF-8 text that @glyph_item refers to, or %NULL + * @text: (allow-none): the UTF-8 text that @glyph_item refers to, or %NULL * @glyph_item: a #PangoGlyphItem * @x: X position of left edge of baseline, in user space coordinates * in Pango units. @@ -1145,7 +1141,7 @@ pango_renderer_deactivate (PangoRenderer *renderer) * pango_renderer_set_color: * @renderer: a #PangoRenderer * @part: the part to change the color of - * @color: the new color or %NULL to unset the current color + * @color: (allow-none): the new color or %NULL to unset the current color * * Sets the color for part of the rendering. * @@ -1321,7 +1317,7 @@ pango_renderer_default_prepare_run (PangoRenderer *renderer, /** * pango_renderer_set_matrix: * @renderer: a #PangoRenderer - * @matrix: a #PangoMatrix, or %NULL to unset any existing matrix. + * @matrix: (allow-none): a #PangoMatrix, or %NULL to unset any existing matrix. * (No matrix set is the same as setting the identity matrix.) * * Sets the transformation matrix that will be applied when rendering. @@ -1352,7 +1348,7 @@ pango_renderer_set_matrix (PangoRenderer *renderer, * * Since: 1.8 **/ -G_CONST_RETURN PangoMatrix * +const PangoMatrix * pango_renderer_get_matrix (PangoRenderer *renderer) { g_return_val_if_fail (PANGO_IS_RENDERER (renderer), NULL); @@ -1371,7 +1367,7 @@ pango_renderer_get_matrix (PangoRenderer *renderer) * The returned layout should not be modified while still being * rendered. * - * Return value: the layout, or %NULL if no layout is being + * Return value: (transfer none): the layout, or %NULL if no layout is being * rendered using @renderer at this time. * * Since: 1.20 diff --git a/pango/pango-renderer.h b/pango/pango-renderer.h index 354127b7..5410a9fe 100644 --- a/pango/pango-renderer.h +++ b/pango/pango-renderer.h @@ -249,7 +249,7 @@ PangoColor *pango_renderer_get_color (PangoRenderer *renderer, void pango_renderer_set_matrix (PangoRenderer *renderer, const PangoMatrix *matrix); -G_CONST_RETURN PangoMatrix *pango_renderer_get_matrix (PangoRenderer *renderer); +const PangoMatrix *pango_renderer_get_matrix (PangoRenderer *renderer); PangoLayout *pango_renderer_get_layout (PangoRenderer *renderer); PangoLayoutLine *pango_renderer_get_layout_line (PangoRenderer *renderer); diff --git a/pango/pango-script.c b/pango/pango-script.c index 605e46e2..92f2ef11 100644 --- a/pango/pango-script.c +++ b/pango/pango-script.c @@ -153,9 +153,9 @@ pango_script_iter_free (PangoScriptIter *iter) /** * pango_script_iter_get_range: * @iter: a #PangoScriptIter - * @start: location to store start position of the range, or %NULL - * @end: location to store end position of the range, or %NULL - * @script: location to store script for range, or %NULL + * @start: (out) (allow-none): location to store start position of the range, or %NULL + * @end: (out) (allow-none): location to store end position of the range, or %NULL + * @script: (out) (allow-none): location to store script for range, or %NULL * * Gets information about the range to which @iter currently points. * The range is the set of locations p where *start <= p < *end. @@ -164,10 +164,10 @@ pango_script_iter_free (PangoScriptIter *iter) * Since: 1.4 **/ void -pango_script_iter_get_range (PangoScriptIter *iter, - G_CONST_RETURN char **start, - G_CONST_RETURN char **end, - PangoScript *script) +pango_script_iter_get_range (PangoScriptIter *iter, + const char **start, + const char **end, + PangoScript *script) { if (start) *start = iter->script_start; diff --git a/pango/pango-script.h b/pango/pango-script.h index 32ef7372..ef5f698b 100644 --- a/pango/pango-script.h +++ b/pango/pango-script.h @@ -128,12 +128,12 @@ PangoScript pango_script_for_unichar (gunichar ch) G_GNUC_CO PangoScriptIter *pango_script_iter_new (const char *text, int length); -void pango_script_iter_get_range (PangoScriptIter *iter, - G_CONST_RETURN char **start, - G_CONST_RETURN char **end, - PangoScript *script); -gboolean pango_script_iter_next (PangoScriptIter *iter); -void pango_script_iter_free (PangoScriptIter *iter); +void pango_script_iter_get_range (PangoScriptIter *iter, + const char **start, + const char **end, + PangoScript *script); +gboolean pango_script_iter_next (PangoScriptIter *iter); +void pango_script_iter_free (PangoScriptIter *iter); #include <pango/pango-language.h> diff --git a/pango/pango-tabs.c b/pango/pango-tabs.c index aec86129..ce488173 100644 --- a/pango/pango-tabs.c +++ b/pango/pango-tabs.c @@ -283,8 +283,8 @@ pango_tab_array_set_tab (PangoTabArray *tab_array, * pango_tab_array_get_tab: * @tab_array: a #PangoTabArray * @tab_index: tab stop index - * @alignment: location to store alignment, or %NULL - * @location: location to store tab position, or %NULL + * @alignment: (out) (allow-none): location to store alignment, or %NULL + * @location: (out) (allow-none): location to store tab position, or %NULL * * Gets the alignment and position of a tab stop. * @@ -309,8 +309,10 @@ pango_tab_array_get_tab (PangoTabArray *tab_array, /** * pango_tab_array_get_tabs: * @tab_array: a #PangoTabArray - * @alignments: location to store an array of tab stop alignments, or %NULL - * @locations: location to store an array of tab positions, or %NULL + * @alignments: (out) (allow-none): location to store an array of tab stop + * alignments, or %NULL + * @locations: (out) (allow-none): location to store an array of tab positions, + * or %NULL * * If non-%NULL, @alignments and @locations are filled with allocated * arrays of length pango_tab_array_get_size(). You must free the diff --git a/pango/pango-utils.c b/pango/pango-utils.c index 1e10448c..44ec353d 100644 --- a/pango/pango-utils.c +++ b/pango/pango-utils.c @@ -176,7 +176,8 @@ pango_trim_string (const char *str) * Splits a %G_SEARCHPATH_SEPARATOR-separated list of files, stripping * white space and substituting ~/ with $HOME/. * - * Return value: a list of strings to be freed with g_strfreev() + * Return value: (transfer full) (array zero-terminated=1): a list of + * strings to be freed with g_strfreev() **/ char ** pango_split_file_list (const char *str) @@ -235,7 +236,7 @@ pango_split_file_list (const char *str) /** * pango_read_line: * @stream: a stdio stream - * @str: #GString buffer into which to write the result + * @str: (out): #GString buffer into which to write the result * * Reads an entire line from a file into a buffer. Lines may * be delimited with '\n', '\r', '\n\r', or '\r\n'. The delimiter @@ -343,7 +344,7 @@ pango_read_line (FILE *stream, GString *str) /** * pango_skip_space: - * @pos: in/out string position + * @pos: (inout): in/out string position * * Skips 0 or more characters of white space. * @@ -365,8 +366,8 @@ pango_skip_space (const char **pos) /** * pango_scan_word: - * @pos: in/out string position - * @out: a #GString into which to write the result + * @pos: (inout): in/out string position + * @out: (out): a #GString into which to write the result * * Scans a word into a #GString buffer. A word consists * of [A-Za-z_] followed by zero or more [A-Za-z_0-9] @@ -407,8 +408,8 @@ pango_scan_word (const char **pos, GString *out) /** * pango_scan_string: - * @pos: in/out string position - * @out: a #GString into which to write the result + * @pos: (inout): in/out string position + * @out: (out): a #GString into which to write the result * * Scans a string into a #GString buffer. The string may either * be a sequence of non-white-space characters, or a quoted @@ -497,8 +498,8 @@ pango_scan_string (const char **pos, GString *out) /** * pango_scan_int: - * @pos: in/out string position - * @out: an int into which to write the result + * @pos: (inout): in/out string position + * @out: (out): an int into which to write the result * * Scans an integer. * Leading white space is skipped. @@ -689,7 +690,7 @@ DllMain (HINSTANCE hinstDLL, * Return value: the Pango sysconf directory. The returned string should * not be freed. */ -G_CONST_RETURN char * +const char * pango_get_sysconf_subdirectory (void) { static const gchar *result = NULL; @@ -722,10 +723,10 @@ pango_get_sysconf_subdirectory (void) * Return value: the Pango lib directory. The returned string should * not be freed. */ -G_CONST_RETURN char * +const char * pango_get_lib_subdirectory (void) { - static gchar *result = NULL; + static const gchar *result = NULL; if (result == NULL) { @@ -773,10 +774,10 @@ parse_int (const char *word, /** * pango_parse_enum: * @type: enum type to parse, eg. %PANGO_TYPE_ELLIPSIZE_MODE. - * @str: string to parse. May be %NULL. - * @value: integer to store the result in, or %NULL. + * @str: (allow-none): string to parse. May be %NULL. + * @value: (out) (allow-none): integer to store the result in, or %NULL. * @warn: if %TRUE, issue a g_warning() on bad input. - * @possible_values: place to store list of possible values on failure, or %NULL. + * @possible_values: (out) (allow-none): place to store list of possible values on failure, or %NULL. * * Parses an enum type and stores the result in @value. * @@ -977,7 +978,7 @@ handle_alias_line (GString *line_buffer, #ifdef HAVE_CAIRO_WIN32 -static const char *builtin_aliases[] = { +static const char * const builtin_aliases[] = { "courier = \"courier new\"", "\"segoe ui\" = \"segoe ui,meiryo,malgun gothic,microsoft jhenghei,microsoft yahei,gisha,leelawadee,arial unicode ms,browallia new,mingliu,simhei,gulimche,ms gothic,sylfaen,kartika,latha,mangal,raavi\"", "tahoma = \"tahoma,arial unicode ms,lucida sans unicode,browallia new,mingliu,simhei,gulimche,ms gothic,sylfaen,kartika,latha,mangal,raavi\"", @@ -1094,9 +1095,9 @@ pango_load_aliases (void) /** * pango_lookup_aliases: * @fontname: an ascii string - * @families: will be set to an array of font family names. + * @families: (out) (array length=n_families): will be set to an array of font family names. * this array is owned by pango and should not be freed. - * @n_families: will be set to the length of the @families array. + * @n_families: (out): will be set to the length of the @families array. * * Look up all user defined aliases for the alias @fontname. * The resulting font family names will be stored in @families, @@ -1222,8 +1223,8 @@ pango_is_zero_width (gunichar ch) /** * pango_quantize_line_geometry: - * @thickness: pointer to the thickness of a line, in Pango units - * @position: corresponding position + * @thickness: (inout): pointer to the thickness of a line, in Pango units + * @position: (inout): corresponding position * * Quantizes the thickness and position of a line, typically an * underline or strikethrough, to whole device pixels, that is integer @@ -1294,8 +1295,8 @@ pango_units_to_double (int i) /** * pango_extents_to_pixels: - * @inclusive: rectangle to round to pixels inclusively, or %NULL. - * @nearest: rectangle to round to nearest pixels, or %NULL. + * @inclusive: (allow-none): rectangle to round to pixels inclusively, or %NULL. + * @nearest: (allow-none): rectangle to round to nearest pixels, or %NULL. * * Converts extents from Pango units to device units, dividing by the * %PANGO_SCALE factor and performing rounding. diff --git a/pango/pango-utils.h b/pango/pango-utils.h index 41a8bbb0..f86c6620 100644 --- a/pango/pango-utils.h +++ b/pango/pango-utils.h @@ -82,13 +82,13 @@ gboolean pango_parse_stretch (const char *str, * stored in the registry). The returned string should not be * g_free'd. */ -G_CONST_RETURN char * pango_get_sysconf_subdirectory (void) G_GNUC_PURE; +const char * pango_get_sysconf_subdirectory (void) G_GNUC_PURE; /* Ditto for LIBDIR/pango. On Win32, use the same Pango * installation directory. This returned string should not be * g_free'd either. */ -G_CONST_RETURN char * pango_get_lib_subdirectory (void) G_GNUC_PURE; +const char * pango_get_lib_subdirectory (void) G_GNUC_PURE; #endif /* PANGO_ENABLE_BACKEND */ @@ -131,12 +131,12 @@ gboolean pango_is_zero_width (gunichar ch) G_GNUC_CONST; int pango_version (void) G_GNUC_CONST; /* Return run-time Pango version as an string */ -G_CONST_RETURN char * pango_version_string (void) G_GNUC_CONST; +const char * pango_version_string (void) G_GNUC_CONST; /* Check that run-time Pango is as new as required */ -G_CONST_RETURN char * pango_version_check (int required_major, - int required_minor, - int required_micro) G_GNUC_CONST; +const char * pango_version_check (int required_major, + int required_minor, + int required_micro) G_GNUC_CONST; G_END_DECLS diff --git a/pango/pango.def b/pango/pango.def index 3b1bc766..1b0306d6 100644 --- a/pango/pango.def +++ b/pango/pango.def @@ -232,6 +232,7 @@ EXPORTS pango_layout_get_attributes pango_layout_get_auto_dir pango_layout_get_baseline + pango_layout_get_character_count pango_layout_get_context pango_layout_get_cursor_pos pango_layout_get_ellipsize @@ -247,6 +248,7 @@ EXPORTS pango_layout_get_lines pango_layout_get_lines_readonly pango_layout_get_log_attrs + pango_layout_get_log_attrs_readonly pango_layout_get_pixel_extents pango_layout_get_pixel_size pango_layout_get_single_paragraph_mode diff --git a/pango/pangoatsui-fontmap.c b/pango/pangoatsui-fontmap.c index 12b86bba..8eb123ae 100644 --- a/pango/pangoatsui-fontmap.c +++ b/pango/pangoatsui-fontmap.c @@ -70,9 +70,6 @@ struct _PangoATSUIFace static GType pango_atsui_family_get_type (void); static GType pango_atsui_face_get_type (void); -static gpointer pango_atsui_family_parent_class; -static gpointer pango_atsui_face_parent_class; - static const char * get_real_family (const char *family_name) { @@ -222,14 +219,14 @@ pango_atsui_family_finalize (GObject *object) G_OBJECT_CLASS (pango_atsui_family_parent_class)->finalize (object); } +G_DEFINE_TYPE (PangoATSUIFamilyClass, pango_atsui_family, PANGO_TYPE_FONT_FAMILY); + static void -pango_atsui_family_class_init (PangoFontFamilyClass *class) +pango_atsui_family_class_init (PangoATSUIFamilyClass *class) { GObjectClass *object_class = (GObjectClass *)class; int i; - pango_atsui_family_parent_class = g_type_class_peek_parent (class); - object_class->finalize = pango_atsui_family_finalize; class->list_faces = pango_atsui_family_list_faces; @@ -246,34 +243,6 @@ pango_atsui_family_init (PangoATSUIFamily *family) family->n_faces = -1; } -static GType -pango_atsui_family_get_type (void) -{ - static GType object_type = 0; - - if (G_UNLIKELY (!object_type)) - { - const GTypeInfo object_info = - { - sizeof (PangoFontFamilyClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) pango_atsui_family_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoATSUIFamily), - 0, /* n_preallocs */ - (GInstanceInitFunc) pango_atsui_family_init, - }; - - object_type = g_type_register_static (PANGO_TYPE_FONT_FAMILY, - I_("PangoATSUIFamily"), - &object_info, 0); - } - - return object_type; -} - static PangoFontDescription * pango_atsui_face_describe (PangoFontFace *face) { @@ -368,8 +337,6 @@ pango_atsui_face_class_init (PangoFontFaceClass *class) { GObjectClass *object_class = (GObjectClass *)class; - pango_atsui_face_parent_class = g_type_class_peek_parent (class); - object_class->finalize = pango_atsui_face_finalize; class->describe = pango_atsui_face_describe; diff --git a/pango/pangocairo-context.c b/pango/pangocairo-context.c index 69432f04..df1b889a 100644 --- a/pango/pangocairo-context.c +++ b/pango/pangocairo-context.c @@ -260,7 +260,7 @@ pango_cairo_context_set_font_options (PangoContext *context, * * Since: 1.10 **/ -G_CONST_RETURN cairo_font_options_t * +const cairo_font_options_t * pango_cairo_context_get_font_options (PangoContext *context) { PangoCairoContextInfo *info; @@ -286,7 +286,7 @@ pango_cairo_context_get_font_options (PangoContext *context) * Return value: the combined set of font options. This value is owned * by the context and must not be modified or freed. **/ -G_CONST_RETURN cairo_font_options_t * +const cairo_font_options_t * _pango_cairo_context_get_merged_font_options (PangoContext *context) { PangoCairoContextInfo *info = get_context_info (context, TRUE); @@ -340,7 +340,7 @@ pango_cairo_context_set_shape_renderer (PangoContext *context, } /** - * pango_cairo_context_get_shape_renderer: + * pango_cairo_context_get_shape_renderer: (skip) * @context: a #PangoContext, from a pangocairo font map * @data: Pointer to #gpointer to return user data * @@ -394,7 +394,7 @@ pango_cairo_context_get_shape_renderer (PangoContext *context, * create a layout for use with @cr and do not need to access #PangoContext * directly, you can use pango_cairo_create_layout() instead. * - * Return value: the newly created #PangoContext. Free with + * Return value: (transfer full): the newly created #PangoContext. Free with * g_object_unref(). * * Since: 1.22 @@ -430,7 +430,7 @@ pango_cairo_create_context (cairo_t *cr) * #PangoContext object for each layout. This might matter in an * application that was laying out large amounts of text. * - * Return value: the newly created #PangoLayout. Free with + * Return value: (transfer full): the newly created #PangoLayout. Free with * g_object_unref(). * * Since: 1.10 diff --git a/pango/pangocairo-coretext.h b/pango/pangocairo-coretext.h new file mode 100644 index 00000000..420e1c9e --- /dev/null +++ b/pango/pangocairo-coretext.h @@ -0,0 +1,55 @@ +/* Pango + * pangocairo-coretext.h: + * + * Copyright (C) 2005 Imendio AB + * Copyright (C) 2010 Kristian Rietveld <kris@gtk.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __PANGOCAIRO_CORETEXT_H__ +#define __PANGOCAIRO_CORETEXT_H__ + +#include "pangocoretext-private.h" +#include <pango/pangocairo.h> +#include <cairo-quartz.h> + +G_BEGIN_DECLS + +#define PANGO_TYPE_CAIRO_CORE_TEXT_FONT_MAP (pango_cairo_core_text_font_map_get_type ()) +#define PANGO_CAIRO_CORE_TEXT_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_CAIRO_CORE_TEXT_FONT_MAP, PangoCairoCoreTextFontMap)) +#define PANGO_IS_CAIRO_CORE_TEXT_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_CAIRO_CORE_TEXT_FONT_MAP)) + +typedef struct _PangoCairoCoreTextFontMap PangoCairoCoreTextFontMap; + +struct _PangoCairoCoreTextFontMap +{ + PangoCoreTextFontMap parent_instance; + + gdouble dpi; +}; + +GType pango_cairo_core_text_font_map_get_type (void) G_GNUC_CONST; + +PangoCoreTextFont * +_pango_cairo_core_text_font_new (PangoCairoCoreTextFontMap *cafontmap, + PangoContext *context, + PangoCoreTextFace *face, + const PangoFontDescription *desc); + +G_END_DECLS + +#endif /* __PANGOCAIRO_CORETEXT_H__ */ diff --git a/pango/pangocairo-coretextfont.c b/pango/pangocairo-coretextfont.c new file mode 100644 index 00000000..7b58148c --- /dev/null +++ b/pango/pangocairo-coretextfont.c @@ -0,0 +1,284 @@ +/* Pango + * pangocairo-coretextfont.c + * + * Copyright (C) 2000-2005 Red Hat Software + * Copyright (C) 2005-2007 Imendio AB + * Copyright (C) 2010 Kristian Rietveld <kris@gtk.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include <Carbon/Carbon.h> + +#include "pango-impl-utils.h" +#include "pangocoretext-private.h" +#include "pangocairo.h" +#include "pangocairo-private.h" +#include "pangocairo-coretext.h" +#include "pangocairo-coretextfont.h" + +struct _PangoCairoCoreTextFont +{ + PangoCoreTextFont font; + PangoCairoFontPrivate cf_priv; + + int abs_size; +}; + +struct _PangoCairoCoreTextFontClass +{ + PangoCoreTextFontClass parent_class; +}; + + + +static cairo_font_face_t *pango_cairo_core_text_font_create_font_face (PangoCairoFont *font); +static PangoFontMetrics *pango_cairo_core_text_font_create_base_metrics_for_context (PangoCairoFont *font, + PangoContext *context); + +static void +cairo_font_iface_init (PangoCairoFontIface *iface) +{ + iface->create_font_face = pango_cairo_core_text_font_create_font_face; + iface->create_base_metrics_for_context = pango_cairo_core_text_font_create_base_metrics_for_context; + iface->cf_priv_offset = G_STRUCT_OFFSET (PangoCairoCoreTextFont, cf_priv); +} + +G_DEFINE_TYPE_WITH_CODE (PangoCairoCoreTextFont, pango_cairo_core_text_font, PANGO_TYPE_CORE_TEXT_FONT, + { G_IMPLEMENT_INTERFACE (PANGO_TYPE_CAIRO_FONT, cairo_font_iface_init) }); + +/* we want get_glyph_extents extremely fast, so we use a small wrapper here + * to avoid having to lookup the interface data like we do for get_metrics + * in _pango_cairo_font_get_metrics(). */ +static void +pango_cairo_core_text_font_get_glyph_extents (PangoFont *font, + PangoGlyph glyph, + PangoRectangle *ink_rect, + PangoRectangle *logical_rect) +{ + PangoCairoCoreTextFont *cafont = (PangoCairoCoreTextFont *) (font); + + _pango_cairo_font_private_get_glyph_extents (&cafont->cf_priv, + glyph, + ink_rect, + logical_rect); +} + +static cairo_font_face_t * +pango_cairo_core_text_font_create_font_face (PangoCairoFont *font) +{ + PangoCoreTextFont *ctfont = (PangoCoreTextFont *) (font); + CTFontRef font_id; + CGFontRef cgfont; + cairo_font_face_t *cairo_face; + + font_id = pango_core_text_font_get_ctfont (ctfont); + cgfont = CTFontCopyGraphicsFont (font_id, NULL); + + cairo_face = cairo_quartz_font_face_create_for_cgfont (cgfont); + + CFRelease (cgfont); + + return cairo_face; +} + +static int +max_glyph_width (PangoLayout *layout) +{ + int max_width = 0; + GSList *l, *r; + + for (l = pango_layout_get_lines_readonly (layout); l; l = l->next) + { + PangoLayoutLine *line = l->data; + + for (r = line->runs; r; r = r->next) + { + PangoGlyphString *glyphs = ((PangoGlyphItem *)r->data)->glyphs; + int i; + + for (i = 0; i < glyphs->num_glyphs; i++) + if (glyphs->glyphs[i].geometry.width > max_width) + max_width = glyphs->glyphs[i].geometry.width; + } + } + + return max_width; +} + +static PangoFontMetrics * +pango_cairo_core_text_font_create_base_metrics_for_context (PangoCairoFont *font, + PangoContext *context) +{ + PangoCoreTextFont *cfont = (PangoCoreTextFont *) font; + PangoFontMetrics *metrics; + PangoFontDescription *font_desc; + PangoLayout *layout; + PangoRectangle extents; + PangoLanguage *language = pango_context_get_language (context); + const char *sample_str = pango_language_get_sample_string (language); + CTFontRef ctfont; + + metrics = pango_font_metrics_new (); + + ctfont = pango_core_text_font_get_ctfont (cfont); + + metrics->ascent = CTFontGetAscent (ctfont) * PANGO_SCALE; + metrics->descent = CTFontGetDescent (ctfont) * PANGO_SCALE; + + metrics->underline_position = CTFontGetUnderlinePosition (ctfont) * PANGO_SCALE; + metrics->underline_thickness = CTFontGetUnderlineThickness (ctfont) * PANGO_SCALE; + + metrics->strikethrough_position = metrics->ascent / 3; + metrics->strikethrough_thickness = CTFontGetUnderlineThickness (ctfont) * PANGO_SCALE; + + layout = pango_layout_new (context); + font_desc = pango_font_describe_with_absolute_size ((PangoFont *) font); + pango_layout_set_font_description (layout, font_desc); + pango_layout_set_text (layout, sample_str, -1); + pango_layout_get_extents (layout, NULL, &extents); + + metrics->approximate_char_width = extents.width / pango_utf8_strwidth (sample_str); + + pango_layout_set_text (layout, "0123456789", -1); + metrics->approximate_digit_width = max_glyph_width (layout); + + pango_font_description_free (font_desc); + g_object_unref (layout); + + return metrics; +} + +static PangoFontDescription * +pango_cairo_core_text_font_describe_absolute (PangoFont *font) +{ + PangoFontDescription *desc; + PangoCairoCoreTextFont *cafont = (PangoCairoCoreTextFont *) font; + + desc = pango_font_describe (font); + pango_font_description_set_absolute_size (desc, cafont->abs_size); + + return desc; +} + +static void +pango_cairo_core_text_font_finalize (GObject *object) +{ + PangoCairoCoreTextFont *cafont = (PangoCairoCoreTextFont *) object; + + _pango_cairo_font_private_finalize (&cafont->cf_priv); + + G_OBJECT_CLASS (pango_cairo_core_text_font_parent_class)->finalize (object); +} + +static void +pango_cairo_core_text_font_class_init (PangoCairoCoreTextFontClass *class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (class); + PangoFontClass *font_class = PANGO_FONT_CLASS (class); + + object_class->finalize = pango_cairo_core_text_font_finalize; + + font_class->get_glyph_extents = pango_cairo_core_text_font_get_glyph_extents; + font_class->get_metrics = _pango_cairo_font_get_metrics; + font_class->describe_absolute = pango_cairo_core_text_font_describe_absolute; +} + +static void +pango_cairo_core_text_font_init (PangoCairoCoreTextFont *cafont G_GNUC_UNUSED) +{ +} + +PangoCoreTextFont * +_pango_cairo_core_text_font_new (PangoCairoCoreTextFontMap *cafontmap, + PangoContext *context, + PangoCoreTextFace *face, + const PangoFontDescription *desc) +{ + const char *postscript_name; + gboolean synthesize_italic = FALSE; + PangoCairoCoreTextFont *cafont; + PangoCoreTextFont *cfont; + CFStringRef cfstr; + CTFontRef font_ref; + CGFontRef font_id; + double size, abs_size; + double dpi; + cairo_matrix_t font_matrix; + + postscript_name = _pango_core_text_face_get_postscript_name (face); + + abs_size = size = pango_units_to_double (pango_font_description_get_size (desc)); + + if (context) + { + dpi = pango_cairo_context_get_resolution (context); + + if (dpi <= 0) + dpi = cafontmap->dpi; + } + else + dpi = cafontmap->dpi; + + if (pango_font_description_get_size_is_absolute (desc)) + size *= 72. / dpi; + else + abs_size *= dpi / 72.; + + cfstr = CFStringCreateWithCString (NULL, postscript_name, + kCFStringEncodingUTF8); + font_ref = CTFontCreateWithName (cfstr, size, NULL); + CFRelease (cfstr); + + if (_pango_core_text_face_get_synthetic_italic (face)) + synthesize_italic = TRUE; + + font_id = CTFontCopyGraphicsFont (font_ref, NULL); + if (!font_id) + return NULL; + + cafont = g_object_new (PANGO_TYPE_CAIRO_CORE_TEXT_FONT, NULL); + cfont = PANGO_CORE_TEXT_FONT (cafont); + + _pango_core_text_font_set_font_description (cfont, desc); + _pango_core_text_font_set_face (cfont, face); + + cafont->abs_size = abs_size * PANGO_SCALE; + + _pango_core_text_font_set_ctfont (cfont, font_ref); + + if (synthesize_italic) + cairo_matrix_init (&font_matrix, + 1, 0, + -0.25, 1, + 0, 0); + else + cairo_matrix_init_identity (&font_matrix); + + /* Scale using absolute size */ + cairo_matrix_scale (&font_matrix, abs_size, abs_size); + + _pango_cairo_font_private_initialize (&cafont->cf_priv, + (PangoCairoFont *) cafont, + pango_font_description_get_gravity (desc), + _pango_cairo_context_get_merged_font_options (context), + pango_context_get_matrix (context), + &font_matrix); + + return cfont; +} diff --git a/pango/pangocairo-coretextfont.h b/pango/pangocairo-coretextfont.h new file mode 100644 index 00000000..752dfdd7 --- /dev/null +++ b/pango/pangocairo-coretextfont.h @@ -0,0 +1,37 @@ +/* Pango + * pangocairo-coretextfont.c + * + * Copyright (C) 2005 Imendio AB + * Copyright (C) 2010 Kristian Rietveld <kris@gtk.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __PANGOCAIRO_CORETEXTFONT_H__ +#define __PANGOCAIRO_CORETEXTFONT_H__ + +#define PANGO_TYPE_CAIRO_CORE_TEXT_FONT (pango_cairo_core_text_font_get_type ()) +#define PANGO_CAIRO_CORE_TEXT_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_CAIRO_CORE_TEXT_FONT, PangoCairoCoreTextFont)) +#define PANGO_CAIRO_CORE_TEXT_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_CAIRO_CORE_TEXT_FONT, PangoCairoCoreTextFontClass)) +#define PANGO_IS_CAIRO_CORE_TEXT_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_CAIRO_CORE_TEXT_FONT)) +#define PANGO_CAIRO_CORE_TEXT_FONT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_CAIRO_CORE_TEXT_FONT, PangoCairoCoreTextFontClass)) + +typedef struct _PangoCairoCoreTextFont PangoCairoCoreTextFont; +typedef struct _PangoCairoCoreTextFontClass PangoCairoCoreTextFontClass; + +GType pango_cairo_core_text_font_get_type (void) G_GNUC_CONST; + +#endif /* __PANGOCAIRO_CORETEXTFONT_H__ */ diff --git a/pango/pangocairo-coretextfontmap.c b/pango/pangocairo-coretextfontmap.c new file mode 100644 index 00000000..e05a1d40 --- /dev/null +++ b/pango/pangocairo-coretextfontmap.c @@ -0,0 +1,107 @@ +/* Pango + * pangocairo-coretextfontmap.c + * + * Copyright (C) 2005 Imendio AB + * Copyright (C) 2010 Kristian Rietveld <kris@gtk.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include "pangocoretext-private.h" +#include "pangocairo.h" +#include "pangocairo-private.h" +#include "pangocairo-coretext.h" + +typedef struct _PangoCairoCoreTextFontMapClass PangoCairoCoreTextFontMapClass; + +struct _PangoCairoCoreTextFontMapClass +{ + PangoCoreTextFontMapClass parent_class; +}; + +static void +pango_cairo_core_text_font_map_set_resolution (PangoCairoFontMap *cfontmap, + double dpi) +{ + PangoCairoCoreTextFontMap *cafontmap = PANGO_CAIRO_CORE_TEXT_FONT_MAP (cfontmap); + + cafontmap->dpi = dpi; +} + +static double +pango_cairo_core_text_font_map_get_resolution (PangoCairoFontMap *cfontmap) +{ + PangoCairoCoreTextFontMap *cafontmap = PANGO_CAIRO_CORE_TEXT_FONT_MAP (cfontmap); + + return cafontmap->dpi; +} + +static cairo_font_type_t +pango_cairo_core_text_font_map_get_font_type (PangoCairoFontMap *cfontmap) +{ + /* This is a bit misleading, but Cairo takes a CoreGraphics font + * for rendering and does not use ATSUI. + */ + return CAIRO_FONT_TYPE_ATSUI; +} + +static void +cairo_font_map_iface_init (PangoCairoFontMapIface *iface) +{ + iface->set_resolution = pango_cairo_core_text_font_map_set_resolution; + iface->get_resolution = pango_cairo_core_text_font_map_get_resolution; + iface->get_font_type = pango_cairo_core_text_font_map_get_font_type; +} + +G_DEFINE_TYPE_WITH_CODE (PangoCairoCoreTextFontMap, pango_cairo_core_text_font_map, PANGO_TYPE_CORE_TEXT_FONT_MAP, + { G_IMPLEMENT_INTERFACE (PANGO_TYPE_CAIRO_FONT_MAP, cairo_font_map_iface_init) }); + + +static PangoCoreTextFont * +pango_cairo_core_text_font_map_create_font (PangoCoreTextFontMap *fontmap, + PangoContext *context, + PangoCoreTextFace *face, + const PangoFontDescription *desc) + +{ + return _pango_cairo_core_text_font_new (PANGO_CAIRO_CORE_TEXT_FONT_MAP (fontmap), + context, face, desc); +} + +static void +pango_cairo_core_text_font_map_finalize (GObject *object) +{ + G_OBJECT_CLASS (pango_cairo_core_text_font_map_parent_class)->finalize (object); +} + +static void +pango_cairo_core_text_font_map_class_init (PangoCairoCoreTextFontMapClass *class) +{ + PangoCoreTextFontMapClass *ctfontmapclass = (PangoCoreTextFontMapClass *)class; + GObjectClass *object_class = (GObjectClass *)class; + + object_class->finalize = pango_cairo_core_text_font_map_finalize; + + ctfontmapclass->create_font = pango_cairo_core_text_font_map_create_font; +} + +static void +pango_cairo_core_text_font_map_init (PangoCairoCoreTextFontMap *cafontmap) +{ + cafontmap->dpi = 72.; +} diff --git a/pango/pangocairo-font.c b/pango/pangocairo-font.c index df0a7777..8dc8df04 100644 --- a/pango/pangocairo-font.c +++ b/pango/pangocairo-font.c @@ -34,37 +34,15 @@ G_STRUCT_MEMBER_P (font, \ PANGO_CAIRO_FONT_GET_IFACE(PANGO_CAIRO_FONT(font))->cf_priv_offset))) -GType -pango_cairo_font_get_type (void) -{ - static GType cairo_font_type = 0; - - if (! cairo_font_type) - { - const GTypeInfo cairo_font_info = - { - sizeof (PangoCairoFontIface), /* class_size */ - NULL, /* base_init */ - NULL, /* base_finalize */ - NULL, - NULL, /* class_finalize */ - NULL, /* class_data */ - 0, - 0, - NULL, - NULL - }; - - cairo_font_type = - g_type_register_static (G_TYPE_INTERFACE, I_("PangoCairoFont"), - &cairo_font_info, 0); - - g_type_interface_add_prerequisite (cairo_font_type, PANGO_TYPE_FONT); - } +typedef PangoCairoFontIface PangoCairoFontInterface; +G_DEFINE_INTERFACE (PangoCairoFont, pango_cairo_font, PANGO_TYPE_FONT) - return cairo_font_type; +static void +pango_cairo_font_default_init (PangoCairoFontIface *iface) +{ } + static PangoCairoFontPrivateScaledFontData * _pango_cairo_font_private_scaled_font_data_create (void) { diff --git a/pango/pangocairo-fontmap.c b/pango/pangocairo-fontmap.c index ae917d06..d5bff788 100644 --- a/pango/pangocairo-fontmap.c +++ b/pango/pangocairo-fontmap.c @@ -26,7 +26,11 @@ #include "pango-impl-utils.h" #if defined (HAVE_CAIRO_ATSUI) -# include "pangocairo-atsui.h" +# if defined (HAVE_CORE_TEXT) +# include "pangocairo-coretext.h" +# else +# include "pangocairo-atsui.h" +# endif #endif #if defined (HAVE_CAIRO_WIN32) # include "pangocairo-win32.h" @@ -35,35 +39,13 @@ # include "pangocairo-fc.h" #endif -GType -pango_cairo_font_map_get_type (void) -{ - static GType cairo_font_map_type = 0; - - if (! cairo_font_map_type) - { - const GTypeInfo cairo_font_map_info = - { - sizeof (PangoCairoFontMapIface), /* class_size */ - NULL, /* base_init */ - NULL, /* base_finalize */ - NULL, - NULL, /* class_finalize */ - NULL, /* class_data */ - 0, - 0, - NULL, - NULL - }; - cairo_font_map_type = - g_type_register_static (G_TYPE_INTERFACE, I_("PangoCairoFontMap"), - &cairo_font_map_info, 0); +typedef PangoCairoFontMapIface PangoCairoFontMapInterface; +G_DEFINE_INTERFACE (PangoCairoFontMap, pango_cairo_font_map, PANGO_TYPE_FONT_MAP) - g_type_interface_add_prerequisite (cairo_font_map_type, PANGO_TYPE_FONT_MAP); - } - - return cairo_font_map_type; +static void +pango_cairo_font_map_default_init (PangoCairoFontMapIface *iface) +{ } /** @@ -80,8 +62,8 @@ pango_cairo_font_map_get_type (void) * You generally should only use the #PangoFontMap and * #PangoCairoFontMap interfaces on the returned object. * - * Return value: the newly allocated #PangoFontMap, which should - * be freed with g_object_unref(). + * Return value: (transfer full): the newly allocated #PangoFontMap, + * which should be freed with g_object_unref(). * * Since: 1.10 **/ @@ -92,7 +74,11 @@ pango_cairo_font_map_new (void) g_type_init (); #if defined(HAVE_CAIRO_ATSUI) +#if defined(HAVE_CORE_TEXT) + return g_object_new (PANGO_TYPE_CAIRO_CORE_TEXT_FONT_MAP, NULL); +#else return g_object_new (PANGO_TYPE_CAIRO_ATSUI_FONT_MAP, NULL); +#endif #elif defined(HAVE_CAIRO_WIN32) return g_object_new (PANGO_TYPE_CAIRO_WIN32_FONT_MAP, NULL); #elif defined(HAVE_CAIRO_FREETYPE) @@ -114,10 +100,10 @@ pango_cairo_font_map_new (void) * or in fact in most of those cases, just use * @pango_cairo_font_map_get_default(). * - * Return value: the newly allocated #PangoFontMap of suitable type - * which should be freed with g_object_unref(), - * or %NULL if the requested cairo font backend is - * not supported / compiled in. + * Return value: (transfer full) : the newly allocated #PangoFontMap + * of suitable type which should be freed with + * g_object_unref(), or %NULL if the requested cairo + * font backend is not supported / compiled in. * * Since: 1.18 **/ @@ -131,8 +117,12 @@ pango_cairo_font_map_new_for_font_type (cairo_font_type_t fonttype) { #if defined(HAVE_CAIRO_ATSUI) case CAIRO_FONT_TYPE_QUARTZ: +#if defined(HAVE_CORE_TEXT) + return g_object_new (PANGO_TYPE_CAIRO_CORE_TEXT_FONT_MAP, NULL); +#else return g_object_new (PANGO_TYPE_CAIRO_ATSUI_FONT_MAP, NULL); #endif +#endif #if defined(HAVE_CAIRO_WIN32) case CAIRO_FONT_TYPE_WIN32: return g_object_new (PANGO_TYPE_CAIRO_WIN32_FONT_MAP, NULL); @@ -163,8 +153,8 @@ static PangoFontMap *default_font_map = NULL; * change the Cairo font backend that the default fontmap * uses for example. * - * Return value: the default Cairo fontmap for Pango. This - * object is owned by Pango and must not be freed. + * Return value: (transfer none): the default Cairo fontmap + * for Pango. This object is owned by Pango and must not be freed. * * Since: 1.10 **/ @@ -250,7 +240,7 @@ pango_cairo_font_map_get_resolution (PangoCairoFontMap *fontmap) } /** - * pango_cairo_font_map_create_context: + * pango_cairo_font_map_create_context: (skip) * @fontmap: a #PangoCairoFontMap * * Create a #PangoContext for the given fontmap. diff --git a/pango/pangocoretext-fontmap.c b/pango/pangocoretext-fontmap.c new file mode 100644 index 00000000..542665e0 --- /dev/null +++ b/pango/pangocoretext-fontmap.c @@ -0,0 +1,1000 @@ +/* Pango + * pangocoretext-fontmap.c + * + * Copyright (C) 2000-2003 Red Hat, Inc. + * Copyright (C) 2005-2007 Imendio AB + * Copyright (C) 2010 Kristian Rietveld <kris@gtk.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include "pango-fontmap.h" +#include "pangocoretext-private.h" +#include "pango-impl-utils.h" +#include "modules.h" + +#include <Carbon/Carbon.h> + +typedef struct _FontHashKey FontHashKey; + + +#define PANGO_TYPE_CORE_TEXT_FAMILY (pango_core_text_family_get_type ()) +#define PANGO_CORE_TEXT_FAMILY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_CORE_TEXT_FAMILY, PangoCoreTextFamily)) +#define PANGO_IS_CORE_TEXT_FAMILY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_CORE_TEXT_FAMILY)) +#define PANGO_CORE_TEXT_FAMILY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_CORE_TEXT_FAMILY, PangoCoreTextFamilyClass)) +#define PANGO_IS_CORE_TEXT_FAMILY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_CORE_TEXT_FAMILY)) +#define PANGO_CORE_TEXT_FAMILY_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), PANGO_CORE_TEXT_FAMILY, PangoCoreTextFamilyClass)) + +struct _PangoCoreTextFamily +{ + PangoFontFamily parent_instance; + + char *family_name; + + guint is_monospace : 1; + + PangoFontFace **faces; + gint n_faces; +}; + +struct _PangoCoreTextFamilyClass +{ + PangoFontFamilyClass parent_class; +}; + +typedef struct _PangoCoreTextFamilyClass PangoCoreTextFamilyClass; + +#define PANGO_TYPE_CORE_TEXT_FACE (pango_core_text_face_get_type ()) +#define PANGO_CORE_TEXT_FACE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_CORE_TEXT_FACE, PangoCoreTextFace)) +#define PANGO_IS_CORE_TEXT_FACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_CORE_TEXT_FACE)) +#define PANGO_CORE_TEXT_FACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_CORE_TEXT_FACE, PangoCoreTextFaceClass)) +#define PANGO_IS_CORE_TEXT_FACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_CORE_TEXT_FACE)) +#define PANGO_CORE_TEXT_FACE_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), PANGO_CORE_TEXT_FACE, PangoCoreTextFaceClass)) + +struct _PangoCoreTextFace +{ + PangoFontFace parent_instance; + + PangoCoreTextFamily *family; + + PangoCoverage *coverage; + + char *postscript_name; + char *style_name; + + PangoWeight weight; + int traits; + guint synthetic_italic : 1; +}; + +struct _PangoCoreTextFaceClass +{ + PangoFontFaceClass parent_class; +}; + +typedef struct _PangoCoreTextFaceClass PangoCoreTextFaceClass; + +static GType pango_core_text_family_get_type (void); +static GType pango_core_text_face_get_type (void); + +typedef struct +{ + float bound; + PangoWeight weight; +} PangoCTWeight; + +static const float ct_weight_min = -1.00f; +static const float ct_weight_max = 1.00f; + +static const PangoCTWeight ct_weight_limits[] = { + { -0.70, PANGO_WEIGHT_THIN}, + { -0.50, PANGO_WEIGHT_ULTRALIGHT }, + { -0.35, PANGO_WEIGHT_LIGHT }, + { -0.10, PANGO_WEIGHT_BOOK }, + { 0.10, PANGO_WEIGHT_NORMAL }, + { 0.24, PANGO_WEIGHT_MEDIUM }, + { 0.36, PANGO_WEIGHT_SEMIBOLD }, + { 0.50, PANGO_WEIGHT_BOLD }, + { 0.75, PANGO_WEIGHT_ULTRABOLD }, + { 1.00, PANGO_WEIGHT_HEAVY } +}; + +static const char * +get_real_family (const char *family_name) +{ + switch (family_name[0]) + { + case 'm': + case 'M': + if (g_ascii_strcasecmp (family_name, "monospace") == 0) + return "Courier"; + break; + case 's': + case 'S': + if (g_ascii_strcasecmp (family_name, "sans") == 0) + return "Helvetica"; + else if (g_ascii_strcasecmp (family_name, "serif") == 0) + return "Times"; + break; + } + + return family_name; +} + +static gchar * +gchar_from_cf_string (CFStringRef str) +{ + CFIndex len; + gchar *buffer; + + /* GetLength returns the number of UTF-16 pairs, so this number + * times 2 should definitely gives us enough space for UTF8. + * We add one for the terminating zero. + */ + len = CFStringGetLength (str) * 2 + 1; + buffer = g_new0 (char, len); + CFStringGetCString (str, buffer, len, kCFStringEncodingUTF8); + + return buffer; +} + +static PangoCoverage * +pango_coverage_from_cf_charset (CFCharacterSetRef charset) +{ + CFIndex i, length; + CFDataRef bitmap; + const UInt8 *ptr; + PangoCoverage *coverage; + + coverage = pango_coverage_new (); + + bitmap = CFCharacterSetCreateBitmapRepresentation (kCFAllocatorDefault, + charset); + + /* We only handle the BMP plane */ + length = MIN (CFDataGetLength (bitmap), 8192); + ptr = CFDataGetBytePtr (bitmap); + + /* FIXME: can and should this be done more efficiently? */ + for (i = 0; i < length; i++) + { + int j; + + for (j = 0; j < 8; j++) + pango_coverage_set (coverage, i * 8 + j, + ((ptr[i] & (1 << j)) == (1 << j)) ? + PANGO_COVERAGE_EXACT : PANGO_COVERAGE_NONE); + } + + CFRelease (bitmap); + + return coverage; +} + +static inline gboolean +pango_core_text_face_is_oblique (PangoCoreTextFace *face) +{ + return g_strrstr (face->style_name, "Oblique") != NULL; +} + +static inline PangoCoreTextFace * +pango_core_text_face_from_ct_font_descriptor (CTFontDescriptorRef desc) +{ + int font_traits; + char *buffer; + CFStringRef str; + CFNumberRef number; + CGFloat value; + CFDictionaryRef dict; + CFCharacterSetRef charset; + PangoCoreTextFace *face = g_object_new (PANGO_TYPE_CORE_TEXT_FACE, + NULL); + + face->synthetic_italic = FALSE; + + /* Get font name */ + str = CTFontDescriptorCopyAttribute (desc, kCTFontNameAttribute); + buffer = gchar_from_cf_string (str); + + /* We strdup again to save space. */ + face->postscript_name = g_strdup (buffer); + + CFRelease (str); + g_free (buffer); + + /* Get style name */ + str = CTFontDescriptorCopyAttribute (desc, kCTFontStyleNameAttribute); + buffer = gchar_from_cf_string (str); + + face->style_name = g_strdup (buffer); + + CFRelease (str); + g_free (buffer); + + /* Get font traits, symbolic traits */ + dict = CTFontDescriptorCopyAttribute (desc, kCTFontTraitsAttribute); + number = (CFNumberRef)CFDictionaryGetValue (dict, + kCTFontWeightTrait); + if (CFNumberGetValue (number, kCFNumberCGFloatType, &value)) + { + if (value < ct_weight_min || value > ct_weight_max) + { + face->weight = PANGO_WEIGHT_NORMAL; /* This is really an error */ + } + else + { + guint i; + for (i = 0; i < G_N_ELEMENTS(ct_weight_limits); i++) + if (value < ct_weight_limits[i].bound) + { + face->weight = ct_weight_limits[i].weight; + break; + } + } + } + else + face->weight = PANGO_WEIGHT_NORMAL; + + number = (CFNumberRef)CFDictionaryGetValue (dict, kCTFontSymbolicTrait); + if (CFNumberGetValue (number, kCFNumberIntType, &font_traits)) + { + face->traits = font_traits; + } + CFRelease (dict); + + /* Get font coverage */ + charset = CTFontDescriptorCopyAttribute (desc, + kCTFontCharacterSetAttribute); + face->coverage = pango_coverage_from_cf_charset (charset); + CFRelease (charset); + + return face; +} + +static void +pango_core_text_family_list_faces (PangoFontFamily *family, + PangoFontFace ***faces, + int *n_faces) +{ + PangoCoreTextFamily *ctfamily = PANGO_CORE_TEXT_FAMILY (family); + + if (ctfamily->n_faces < 0) + { + GList *l; + GList *faces = NULL; + GList *synthetic_faces = NULL; + GHashTable *italic_faces; + const char *real_family = get_real_family (ctfamily->family_name); + CTFontCollectionRef collection; + CFArrayRef ctfaces; + CFArrayRef font_descriptors; + CFDictionaryRef attributes; + CFIndex i, count; + + CFTypeRef keys[] = { + (CFTypeRef) kCTFontFamilyNameAttribute + }; + + CFStringRef values[] = { + CFStringCreateWithCString (kCFAllocatorDefault, + real_family, + kCFStringEncodingUTF8) + }; + + CTFontDescriptorRef descriptors[1]; + + attributes = CFDictionaryCreate (kCFAllocatorDefault, + (const void **)keys, + (const void **)values, + 1, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + descriptors[0] = CTFontDescriptorCreateWithAttributes (attributes); + font_descriptors = CFArrayCreate (kCFAllocatorDefault, + (const void **)descriptors, + 1, + &kCFTypeArrayCallBacks); + collection = CTFontCollectionCreateWithFontDescriptors (font_descriptors, + NULL); + + ctfaces = CTFontCollectionCreateMatchingFontDescriptors (collection); + + italic_faces = g_hash_table_new (g_direct_hash, g_direct_equal); + + count = CFArrayGetCount (ctfaces); + for (i = 0; i < count; i++) + { + PangoCoreTextFace *face; + CTFontDescriptorRef desc = CFArrayGetValueAtIndex (ctfaces, i); + + face = pango_core_text_face_from_ct_font_descriptor (desc); + face->family = ctfamily; + + faces = g_list_prepend (faces, face); + + if (face->traits & kCTFontItalicTrait + || pango_core_text_face_is_oblique (face)) + g_hash_table_insert (italic_faces, + GINT_TO_POINTER ((gint)face->weight), + face); + } + + CFRelease (font_descriptors); + CFRelease (attributes); + CFRelease (ctfaces); + + /* For all fonts for which a non-synthetic italic variant does + * not exist on the system, we create synthesized versions here. + */ + for (l = faces; l; l = l->next) + { + PangoCoreTextFace *face = l->data; + + if (!g_hash_table_lookup (italic_faces, + GINT_TO_POINTER ((gint)face->weight))) + { + PangoCoreTextFace *italic_face; + + italic_face = g_object_new (PANGO_TYPE_CORE_TEXT_FACE, NULL); + + italic_face->family = ctfamily; + italic_face->postscript_name = g_strdup (face->postscript_name); + italic_face->weight = face->weight; + italic_face->traits = face->traits | kCTFontItalicTrait; + italic_face->synthetic_italic = TRUE; + italic_face->coverage = pango_coverage_ref (face->coverage); + + /* Try to create a sensible face name. */ + if (strcasecmp (face->style_name, "regular") == 0) + italic_face->style_name = g_strdup ("Oblique"); + else + italic_face->style_name = g_strdup_printf ("%s Oblique", + face->style_name); + + synthetic_faces = g_list_prepend (synthetic_faces, italic_face); + } + } + + faces = g_list_concat (faces, synthetic_faces); + + ctfamily->n_faces = g_list_length (faces); + ctfamily->faces = g_new (PangoFontFace *, ctfamily->n_faces); + + for (l = faces, i = 0; l; l = l->next, i++) + ctfamily->faces[i] = l->data; + + g_list_free (faces); + g_hash_table_destroy (italic_faces); + } + + if (n_faces) + *n_faces = ctfamily->n_faces; + + if (faces) + *faces = g_memdup (ctfamily->faces, ctfamily->n_faces * sizeof (PangoFontFace *)); +} + +static const char * +pango_core_text_family_get_name (PangoFontFamily *family) +{ + PangoCoreTextFamily *ctfamily = PANGO_CORE_TEXT_FAMILY (family); + + return ctfamily->family_name; +} + +static gboolean +pango_core_text_family_is_monospace (PangoFontFamily *family) +{ + PangoCoreTextFamily *ctfamily = PANGO_CORE_TEXT_FAMILY (family); + + return ctfamily->is_monospace; +} + +G_DEFINE_TYPE (PangoCoreTextFamily, pango_core_text_family, PANGO_TYPE_FONT_FAMILY); + +static void +pango_core_text_family_finalize (GObject *object) +{ + PangoCoreTextFamily *family = PANGO_CORE_TEXT_FAMILY (object); + int i; + + g_free (family->family_name); + + if (family->n_faces != -1) + { + for (i = 0; i < family->n_faces; i++) + g_object_unref (family->faces[i]); + + g_free (family->faces); + } + + G_OBJECT_CLASS (pango_core_text_family_parent_class)->finalize (object); +} + + +static void +pango_core_text_family_class_init (PangoCoreTextFamilyClass *klass) +{ + GObjectClass *object_class = (GObjectClass *)klass; + int i; + PangoFontFamilyClass *pfclass = PANGO_FONT_FAMILY_CLASS(klass); + + object_class->finalize = pango_core_text_family_finalize; + + pfclass->list_faces = pango_core_text_family_list_faces; + pfclass->get_name = pango_core_text_family_get_name; + pfclass->is_monospace = pango_core_text_family_is_monospace; + + for (i = 0; _pango_included_core_text_modules[i].list; i++) + pango_module_register (&_pango_included_core_text_modules[i]); +} + +static void +pango_core_text_family_init (PangoCoreTextFamily *family) +{ + family->n_faces = -1; +} + +static PangoFontDescription * +pango_core_text_face_describe (PangoFontFace *face) +{ + PangoCoreTextFace *ctface = PANGO_CORE_TEXT_FACE (face); + PangoFontDescription *description; + PangoStyle pango_style; + PangoVariant pango_variant; + + description = pango_font_description_new (); + + pango_font_description_set_family (description, ctface->family->family_name); + + + if (ctface->traits & kCTFontItalicTrait) + pango_style = PANGO_STYLE_ITALIC; + else if (pango_core_text_face_is_oblique (ctface)) + pango_style = PANGO_STYLE_OBLIQUE; + else + pango_style = PANGO_STYLE_NORMAL; + + /* FIXME: How can this be figured using CoreText? */ +#if 0 + if (ctface->traits & NSSmallCapsFontMask) + pango_variant = PANGO_VARIANT_SMALL_CAPS; + else +#endif + pango_variant = PANGO_VARIANT_NORMAL; + + pango_font_description_set_weight (description, ctface->weight); + pango_font_description_set_style (description, pango_style); + pango_font_description_set_variant (description, pango_variant); + + return description; +} + +static const char * +pango_core_text_face_get_face_name (PangoFontFace *face) +{ + PangoCoreTextFace *ctface = PANGO_CORE_TEXT_FACE (face); + + return ctface->style_name; +} + +static void +pango_core_text_face_list_sizes (PangoFontFace *face, + int **sizes, + int *n_sizes) +{ + *n_sizes = 0; + *sizes = NULL; +} + +G_DEFINE_TYPE (PangoCoreTextFace, pango_core_text_face, PANGO_TYPE_FONT_FACE); + +static void +pango_core_text_face_init (PangoCoreTextFace *face) +{ + face->family = NULL; + face->coverage = NULL; +} + + + +static void +pango_core_text_face_finalize (GObject *object) +{ + PangoCoreTextFace *ctface = PANGO_CORE_TEXT_FACE (object); + + if (ctface->coverage) + pango_coverage_unref (ctface->coverage); + + g_free (ctface->postscript_name); + g_free (ctface->style_name); + + G_OBJECT_CLASS (pango_core_text_face_parent_class)->finalize (object); +} + +static gboolean +pango_core_text_face_is_synthesized (PangoFontFace *face) +{ + PangoCoreTextFace *cface = PANGO_CORE_TEXT_FACE (face); + + return cface->synthetic_italic; +} + +static void +pango_core_text_face_class_init (PangoCoreTextFaceClass *klass) +{ + GObjectClass *object_class = (GObjectClass *)klass; + PangoFontFaceClass *pfclass = PANGO_FONT_FACE_CLASS(klass); + + object_class->finalize = pango_core_text_face_finalize; + + pfclass->describe = pango_core_text_face_describe; + pfclass->get_face_name = pango_core_text_face_get_face_name; + pfclass->list_sizes = pango_core_text_face_list_sizes; + pfclass->is_synthesized = pango_core_text_face_is_synthesized; +} + +const char * +_pango_core_text_face_get_postscript_name (PangoCoreTextFace *face) +{ + return face->postscript_name; +} + +gboolean +_pango_core_text_face_get_synthetic_italic (PangoCoreTextFace *face) +{ + return face->synthetic_italic; +} + +PangoCoverage * +_pango_core_text_face_get_coverage (PangoCoreTextFace *face, + PangoLanguage *language) +{ + return face->coverage; +} + +static void pango_core_text_font_map_class_init (PangoCoreTextFontMapClass *class); +static void pango_core_text_font_map_init (PangoCoreTextFontMap *ctfontmap); + +static guint font_hash_key_hash (const FontHashKey *key); +static gboolean font_hash_key_equal (const FontHashKey *key_a, + const FontHashKey *key_b); +static void font_hash_key_free (FontHashKey *key); + +G_DEFINE_TYPE (PangoCoreTextFontMap, pango_core_text_font_map, PANGO_TYPE_FONT_MAP); + +static void +pango_core_text_font_map_finalize (GObject *object) +{ + PangoCoreTextFontMap *fontmap = PANGO_CORE_TEXT_FONT_MAP (object); + + g_hash_table_destroy (fontmap->font_hash); + g_hash_table_destroy (fontmap->families); + + G_OBJECT_CLASS (pango_core_text_font_map_parent_class)->finalize (object); +} + +struct _FontHashKey { + PangoCoreTextFontMap *fontmap; + PangoMatrix matrix; + PangoFontDescription *desc; + char *postscript_name; + gpointer context_key; +}; + +/* Fowler / Noll / Vo (FNV) Hash (http://www.isthe.com/chongo/tech/comp/fnv/) + * + * Not necessarily better than a lot of other hashes, but should be OK, and + * well tested with binary data. + */ + +#define FNV_32_PRIME ((guint32)0x01000193) +#define FNV1_32_INIT ((guint32)0x811c9dc5) + +static guint32 +hash_bytes_fnv (unsigned char *buffer, + int len, + guint32 hval) +{ + while (len--) + { + hval *= FNV_32_PRIME; + hval ^= *buffer++; + } + + return hval; +} + +static gboolean +font_hash_key_equal (const FontHashKey *key_a, + const FontHashKey *key_b) +{ + if (key_a->matrix.xx == key_b->matrix.xx && + key_a->matrix.xy == key_b->matrix.xy && + key_a->matrix.yx == key_b->matrix.yx && + key_a->matrix.yy == key_b->matrix.yy && + pango_font_description_equal (key_a->desc, key_b->desc) && + strcmp (key_a->postscript_name, key_b->postscript_name) == 0) + { + if (key_a->context_key) + return PANGO_CORE_TEXT_FONT_MAP_GET_CLASS (key_a->fontmap)->context_key_equal (key_a->fontmap, + key_a->context_key, + key_b->context_key); + else + return TRUE; + } + else + return FALSE; +} + +static guint +font_hash_key_hash (const FontHashKey *key) +{ + guint32 hash = FNV1_32_INIT; + + /* We do a bytewise hash on the context matrix */ + hash = hash_bytes_fnv ((unsigned char *)(&key->matrix), + sizeof(double) * 4, + hash); + + if (key->context_key) + hash ^= PANGO_CORE_TEXT_FONT_MAP_GET_CLASS (key->fontmap)->context_key_hash (key->fontmap, + key->context_key); + + hash ^= g_str_hash (key->postscript_name); + + return (hash ^ pango_font_description_hash (key->desc)); +} + +static void +font_hash_key_free (FontHashKey *key) +{ + if (key->context_key) + PANGO_CORE_TEXT_FONT_MAP_GET_CLASS (key->fontmap)->context_key_free (key->fontmap, + key->context_key); + + g_slice_free (FontHashKey, key); +} + +static FontHashKey * +font_hash_key_copy (FontHashKey *old) +{ + FontHashKey *key = g_slice_new (FontHashKey); + + key->fontmap = old->fontmap; + key->matrix = old->matrix; + key->desc = pango_font_description_copy (old->desc); + key->postscript_name = g_strdup (old->postscript_name); + if (old->context_key) + key->context_key = PANGO_CORE_TEXT_FONT_MAP_GET_CLASS (key->fontmap)->context_key_copy (key->fontmap, old->context_key); + else + key->context_key = NULL; + + return key; +} + + +static void +get_context_matrix (PangoContext *context, + PangoMatrix *matrix) +{ + const PangoMatrix *set_matrix; + static const PangoMatrix identity = PANGO_MATRIX_INIT; + + if (context) + set_matrix = pango_context_get_matrix (context); + else + set_matrix = NULL; + + if (set_matrix) + *matrix = *set_matrix; + else + *matrix = identity; +} + +static void +font_hash_key_for_context (PangoCoreTextFontMap *fcfontmap, + PangoContext *context, + FontHashKey *key) +{ + key->fontmap = fcfontmap; + get_context_matrix (context, &key->matrix); + + if (PANGO_CORE_TEXT_FONT_MAP_GET_CLASS (fcfontmap)->context_key_get) + key->context_key = (gpointer)PANGO_CORE_TEXT_FONT_MAP_GET_CLASS (fcfontmap)->context_key_get (fcfontmap, context); + else + key->context_key = NULL; +} + +static void +pango_core_text_font_map_add (PangoCoreTextFontMap *ctfontmap, + PangoContext *context, + PangoCoreTextFont *ctfont) +{ + FontHashKey key; + FontHashKey *key_copy; + PangoCoreTextFace *face; + + _pango_core_text_font_set_font_map (ctfont, ctfontmap); + + font_hash_key_for_context (ctfontmap, context, &key); + face = _pango_core_text_font_get_face (ctfont); + key.postscript_name = (char *)_pango_core_text_face_get_postscript_name (face); + key.desc = _pango_core_text_font_get_font_description (ctfont); + + key_copy = font_hash_key_copy (&key); + _pango_core_text_font_set_context_key (ctfont, key_copy->context_key); + g_hash_table_insert (ctfontmap->font_hash, key_copy, g_object_ref (ctfont)); +} + +static PangoCoreTextFont * +pango_core_text_font_map_lookup (PangoCoreTextFontMap *ctfontmap, + PangoContext *context, + PangoFontDescription *desc, + PangoCoreTextFace *face) +{ + FontHashKey key; + + font_hash_key_for_context (ctfontmap, context, &key); + key.postscript_name = (char *)_pango_core_text_face_get_postscript_name (face); + key.desc = desc; + + return g_hash_table_lookup (ctfontmap->font_hash, &key); +} + +static gboolean +find_best_match (PangoCoreTextFamily *font_family, + const PangoFontDescription *description, + PangoFontDescription **best_description, + PangoCoreTextFace **best_face) +{ + PangoFontDescription *new_desc; + int i; + + *best_description = NULL; + *best_face = NULL; + + for (i = 0; i < font_family->n_faces; i++) + { + new_desc = pango_font_face_describe (font_family->faces[i]); + + if (pango_font_description_better_match (description, *best_description, new_desc)) + { + pango_font_description_free (*best_description); + *best_description = new_desc; + *best_face = (PangoCoreTextFace *)font_family->faces[i]; + } + else + pango_font_description_free (new_desc); + } + + if (*best_description) + return TRUE; + + return FALSE; +} + +static PangoFont * +pango_core_text_font_map_load_font (PangoFontMap *fontmap, + PangoContext *context, + const PangoFontDescription *description) +{ + PangoCoreTextFontMap *ctfontmap = (PangoCoreTextFontMap *)fontmap; + PangoCoreTextFamily *font_family; + const gchar *family; + gchar *name; + gint size; + gboolean is_absolute; + + size = pango_font_description_get_size (description); + if (size < 0) + return NULL; + + is_absolute = pango_font_description_get_size_is_absolute (description); + + family = pango_font_description_get_family (description); + family = family ? family : ""; + name = g_utf8_casefold (family, -1); + font_family = g_hash_table_lookup (ctfontmap->families, name); + g_free (name); + + if (font_family) + { + PangoFontDescription *best_description; + PangoCoreTextFace *best_face; + PangoCoreTextFont *best_font; + + /* Force a listing of the available faces */ + pango_font_family_list_faces ((PangoFontFamily *)font_family, NULL, NULL); + + if (!find_best_match (font_family, description, &best_description, &best_face)) + return NULL; + + if (is_absolute) + pango_font_description_set_absolute_size (best_description, size); + else + pango_font_description_set_size (best_description, size); + + best_font = pango_core_text_font_map_lookup (ctfontmap, + context, + best_description, + best_face); + + if (best_font) + g_object_ref (best_font); + else + { + PangoCoreTextFontMapClass *klass; + + klass = PANGO_CORE_TEXT_FONT_MAP_GET_CLASS (ctfontmap); + best_font = klass->create_font (ctfontmap, context, + best_face, best_description); + + if (best_font) + pango_core_text_font_map_add (ctfontmap, context, best_font); + /* FIXME: Handle the else case here. */ + } + + pango_font_description_free (best_description); + + return (PangoFont *)best_font; + } + + return NULL; +} + +static void +list_families_foreach (gpointer key, + gpointer value, + gpointer user_data) +{ + GSList **list = user_data; + + *list = g_slist_prepend (*list, value); +} + +static void +pango_core_text_font_map_list_families (PangoFontMap *fontmap, + PangoFontFamily ***families, + int *n_families) +{ + GSList *family_list = NULL; + GSList *tmp_list; + PangoCoreTextFontMap *ctfontmap = (PangoCoreTextFontMap *)fontmap; + + if (!n_families) + return; + + g_hash_table_foreach (ctfontmap->families, + list_families_foreach, &family_list); + + *n_families = g_slist_length (family_list); + + if (families) + { + int i = 0; + + *families = g_new (PangoFontFamily *, *n_families); + + tmp_list = family_list; + while (tmp_list) + { + (*families)[i] = tmp_list->data; + i++; + tmp_list = tmp_list->next; + } + } + + g_slist_free (family_list); +} + +static void +pango_core_text_font_map_init (PangoCoreTextFontMap *ctfontmap) +{ + PangoCoreTextFamily *family; + CTFontCollectionRef collection; + CFArrayRef ctfaces; + CFIndex i, count; + + ctfontmap->families = g_hash_table_new_full (g_str_hash, g_str_equal, + g_free, g_object_unref); + + + ctfontmap->font_hash = g_hash_table_new_full ((GHashFunc)font_hash_key_hash, + (GEqualFunc)font_hash_key_equal, + (GDestroyNotify)font_hash_key_free, + NULL); + + collection = CTFontCollectionCreateFromAvailableFonts (0); + ctfaces = CTFontCollectionCreateMatchingFontDescriptors (collection); + count = CFArrayGetCount (ctfaces); + + for (i = 0; i < count; i++) + { + int font_traits; + char *buffer; + char *family_name; + CFStringRef str; + CFNumberRef number; + CFDictionaryRef dict; + CTFontDescriptorRef desc = CFArrayGetValueAtIndex (ctfaces, i); + + str = CTFontDescriptorCopyAttribute (desc, kCTFontFamilyNameAttribute); + buffer = gchar_from_cf_string (str); + + family_name = g_utf8_casefold (buffer, -1); + + family = g_hash_table_lookup (ctfontmap->families, family_name); + if (!family) + { + family = g_object_new (PANGO_TYPE_CORE_TEXT_FAMILY, NULL); + g_hash_table_insert (ctfontmap->families, g_strdup (family_name), + family); + + family->family_name = g_strdup (buffer); + } + + CFRelease (str); + g_free (buffer); + + g_free (family_name); + + /* We assume that all faces in the family are monospaced or none. */ + dict = CTFontDescriptorCopyAttribute (desc, kCTFontTraitsAttribute); + number = (CFNumberRef)CFDictionaryGetValue (dict, + kCTFontSymbolicTrait); + + if (CFNumberGetValue (number, kCFNumberIntType, &font_traits)) + { + if (font_traits & kCTFontMonoSpaceTrait) + family->is_monospace = TRUE; + } + + CFRelease (dict); + } + + /* Insert aliases */ + family = g_object_new (PANGO_TYPE_CORE_TEXT_FAMILY, NULL); + family->family_name = g_strdup ("Sans"); + g_hash_table_insert (ctfontmap->families, + g_utf8_casefold (family->family_name, -1), family); + + family = g_object_new (PANGO_TYPE_CORE_TEXT_FAMILY, NULL); + family->family_name = g_strdup ("Serif"); + g_hash_table_insert (ctfontmap->families, + g_utf8_casefold (family->family_name, -1), family); + + family = g_object_new (PANGO_TYPE_CORE_TEXT_FAMILY, NULL); + family->family_name = g_strdup ("Monospace"); + family->is_monospace = TRUE; + g_hash_table_insert (ctfontmap->families, + g_utf8_casefold (family->family_name, -1), family); +} + +static void +pango_core_text_font_map_class_init (PangoCoreTextFontMapClass *class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (class); + PangoFontMapClass *fontmap_class = PANGO_FONT_MAP_CLASS (class); + + object_class->finalize = pango_core_text_font_map_finalize; + + fontmap_class->load_font = pango_core_text_font_map_load_font; + fontmap_class->list_families = pango_core_text_font_map_list_families; + fontmap_class->shape_engine_type = PANGO_RENDER_TYPE_CORE_TEXT; +} diff --git a/pango/pangocoretext-private.h b/pango/pangocoretext-private.h new file mode 100644 index 00000000..4ed0e8e5 --- /dev/null +++ b/pango/pangocoretext-private.h @@ -0,0 +1,102 @@ +/* Pango + * pangocoretext-private.h: + * + * Copyright (C) 2003 Red Hat Software + * Copyright (C) 2005-2007 Imendio AB + * Copyright (C) 2010 Kristian Rietveld <kris@gtk.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __PANGOCORETEXT_PRIVATE_H__ +#define __PANGOCORETEXT_PRIVATE_H__ + +#include <pango/pango-fontmap.h> +#include <pango/pango-context.h> +#include "pangocoretext.h" + +G_BEGIN_DECLS + +#define PANGO_TYPE_CORE_TEXT_FONT_MAP (pango_core_text_font_map_get_type ()) +#define PANGO_CORE_TEXT_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_CORE_TEXT_FONT_MAP, PangoCoreTextFontMap)) +#define PANGO_CORE_TEXT_IS_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_CORE_TEXT_FONT_MAP)) +#define PANGO_CORE_TEXT_FONT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_CORE_TEXT_FONT_MAP, PangoCoreTextFontMapClass)) +#define PANGO_IS_CORE_TEXT_FONT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_CORE_TEXT_FONT_MAP)) +#define PANGO_CORE_TEXT_FONT_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_CORE_TEXT_FONT_MAP, PangoCoreTextFontMapClass)) + + +typedef struct _PangoCoreTextFamily PangoCoreTextFamily; +typedef struct _PangoCoreTextFace PangoCoreTextFace; + +typedef struct _PangoCoreTextFontMap PangoCoreTextFontMap; +typedef struct _PangoCoreTextFontMapClass PangoCoreTextFontMapClass; + +struct _PangoCoreTextFontMap +{ + PangoFontMap parent_instance; + + GHashTable *font_hash; + + GHashTable *families; +}; + +struct _PangoCoreTextFontMapClass +{ + PangoFontMapClass parent_class; + + gconstpointer (*context_key_get) (PangoCoreTextFontMap *ctfontmap, + PangoContext *context); + gpointer (*context_key_copy) (PangoCoreTextFontMap *ctfontmap, + gconstpointer key); + void (*context_key_free) (PangoCoreTextFontMap *ctfontmap, + gpointer key); + guint32 (*context_key_hash) (PangoCoreTextFontMap *ctfontmap, + gconstpointer key); + gboolean (*context_key_equal) (PangoCoreTextFontMap *ctfontmap, + gconstpointer key_a, + gconstpointer key_b); + + PangoCoreTextFont * (* create_font) (PangoCoreTextFontMap *fontmap, + PangoContext *context, + PangoCoreTextFace *face, + const PangoFontDescription *desc); +}; + + +GType pango_core_text_font_map_get_type (void) G_GNUC_CONST; + +const char * _pango_core_text_face_get_postscript_name (PangoCoreTextFace *face); +gboolean _pango_core_text_face_get_synthetic_italic (PangoCoreTextFace *face); +PangoCoverage * _pango_core_text_face_get_coverage (PangoCoreTextFace *face, + PangoLanguage *language); + +void _pango_core_text_font_set_font_description (PangoCoreTextFont *afont, + const PangoFontDescription *desc); +PangoFontDescription *_pango_core_text_font_get_font_description (PangoCoreTextFont *afont); +void _pango_core_text_font_set_font_map (PangoCoreTextFont *afont, + PangoCoreTextFontMap *fontmap); +void _pango_core_text_font_set_face (PangoCoreTextFont *afont, + PangoCoreTextFace *aface); +PangoCoreTextFace * _pango_core_text_font_get_face (PangoCoreTextFont *font); +gpointer _pango_core_text_font_get_context_key (PangoCoreTextFont *afont); +void _pango_core_text_font_set_context_key (PangoCoreTextFont *afont, + gpointer context_key); +void _pango_core_text_font_set_ctfont (PangoCoreTextFont *font, + CTFontRef font_ref); + +G_END_DECLS + +#endif /* __PANGOCORETEXT_PRIVATE_H__ */ diff --git a/pango/pangocoretext.c b/pango/pangocoretext.c new file mode 100644 index 00000000..36e5a373 --- /dev/null +++ b/pango/pangocoretext.c @@ -0,0 +1,204 @@ +/* Pango + * pangocoretext.c + * + * Copyright (C) 2005-2007 Imendio AB + * Copyright (C) 2010 Kristian Rietveld <kris@gtk.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include "pangocoretext.h" +#include "pangocoretext-private.h" + +G_DEFINE_TYPE (PangoCoreTextFont, pango_core_text_font, PANGO_TYPE_FONT); + +struct _PangoCoreTextFontPrivate +{ + PangoCoreTextFace *face; + PangoFontDescription *desc; + gpointer context_key; + + CTFontRef font_ref; + + PangoFontMap *fontmap; +}; + +static void +pango_core_text_font_finalize (GObject *object) +{ + PangoCoreTextFont *ctfont = (PangoCoreTextFont *)object; + PangoCoreTextFontPrivate *priv = ctfont->priv; + + pango_font_description_free (priv->desc); + + g_assert (priv->fontmap != NULL); + g_object_remove_weak_pointer (G_OBJECT (priv->fontmap), (gpointer *) (gpointer) &priv->fontmap); + priv->fontmap = NULL; + + G_OBJECT_CLASS (pango_core_text_font_parent_class)->finalize (object); +} + +static PangoFontDescription * +pango_core_text_font_describe (PangoFont *font) +{ + PangoCoreTextFont *ctfont = (PangoCoreTextFont *)font; + PangoCoreTextFontPrivate *priv = ctfont->priv; + + return pango_font_description_copy (priv->desc); +} + +static PangoCoverage * +pango_core_text_font_get_coverage (PangoFont *font, + PangoLanguage *language) +{ + PangoCoreTextFont *ctfont = (PangoCoreTextFont *)font; + PangoCoreTextFontPrivate *priv = ctfont->priv; + + return pango_coverage_ref (_pango_core_text_face_get_coverage (priv->face, + language)); +} + +static PangoEngineShape * +pango_core_text_font_find_shaper (PangoFont *font, + PangoLanguage *language, + guint32 ch) +{ + /* FIXME: Implement */ + return NULL; +} + +static PangoFontMap * +pango_core_text_font_get_font_map (PangoFont *font) +{ + PangoCoreTextFont *ctfont = (PangoCoreTextFont *)font; + + return ctfont->priv->fontmap; +} + +static void +pango_core_text_font_init (PangoCoreTextFont *ctfont) +{ + ctfont->priv = G_TYPE_INSTANCE_GET_PRIVATE (ctfont, + PANGO_TYPE_CORE_TEXT_FONT, + PangoCoreTextFontPrivate); +} + +static void +pango_core_text_font_class_init (PangoCoreTextFontClass *class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (class); + PangoFontClass *font_class = PANGO_FONT_CLASS (class); + + object_class->finalize = pango_core_text_font_finalize; + + font_class->describe = pango_core_text_font_describe; + font_class->get_coverage = pango_core_text_font_get_coverage; + font_class->find_shaper = pango_core_text_font_find_shaper; + font_class->get_font_map = pango_core_text_font_get_font_map; + + g_type_class_add_private (object_class, sizeof (PangoCoreTextFontPrivate)); +} + +void +_pango_core_text_font_set_font_description (PangoCoreTextFont *font, + const PangoFontDescription *desc) +{ + PangoCoreTextFontPrivate *priv = font->priv; + + priv->desc = pango_font_description_copy (desc); +} + +PangoFontDescription * +_pango_core_text_font_get_font_description (PangoCoreTextFont *font) +{ + PangoCoreTextFontPrivate *priv = font->priv; + + return priv->desc; +} + +void +_pango_core_text_font_set_font_map (PangoCoreTextFont *font, + PangoCoreTextFontMap *fontmap) +{ + PangoCoreTextFontPrivate *priv = font->priv; + + g_assert (priv->fontmap == NULL); + priv->fontmap = (PangoFontMap *) fontmap; + g_object_add_weak_pointer (G_OBJECT (priv->fontmap), (gpointer *) (gpointer) &priv->fontmap); +} + +void +_pango_core_text_font_set_face (PangoCoreTextFont *ctfont, + PangoCoreTextFace *ctface) +{ + PangoCoreTextFontPrivate *priv = ctfont->priv; + + priv->face = ctface; +} + +PangoCoreTextFace * +_pango_core_text_font_get_face (PangoCoreTextFont *font) +{ + PangoCoreTextFontPrivate *priv = font->priv; + + return priv->face; +} + +gpointer +_pango_core_text_font_get_context_key (PangoCoreTextFont *font) +{ + PangoCoreTextFontPrivate *priv = font->priv; + + return priv->context_key; +} + +void +_pango_core_text_font_set_context_key (PangoCoreTextFont *font, + gpointer context_key) +{ + PangoCoreTextFontPrivate *priv = font->priv; + + priv->context_key = context_key; +} + +void +_pango_core_text_font_set_ctfont (PangoCoreTextFont *font, + CTFontRef font_ref) +{ + PangoCoreTextFontPrivate *priv = font->priv; + + priv->font_ref = font_ref; +} + +/** + * pango_core_text_font_get_ctfont: + * @font: A #PangoCoreTextFont + * + * Returns the CTFontRef of a font. + * + * Return value: the CTFontRef associated to @font. + * + * Since: 1.24 + */ +CTFontRef +pango_core_text_font_get_ctfont (PangoCoreTextFont *font) +{ + PangoCoreTextFontPrivate *priv = font->priv; + + return priv->font_ref; +} diff --git a/pango/pangocoretext.h b/pango/pangocoretext.h new file mode 100644 index 00000000..22dd9cb0 --- /dev/null +++ b/pango/pangocoretext.h @@ -0,0 +1,80 @@ +/* Pango + * pangocoretext.h: + * + * Copyright (C) 2005 Imendio AB + * Copyright (C) 2010 Kristian Rietveld <kris@gtk.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __PANGOCORETEXT_H__ +#define __PANGOCORETEXT_H__ + +#include <pango/pango-context.h> +#include <pango/pango-font.h> +#include <Carbon/Carbon.h> + +G_BEGIN_DECLS + +#define PANGO_TYPE_CORE_TEXT_FONT (pango_core_text_font_get_type ()) +#define PANGO_CORE_TEXT_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_CORE_TEXT_FONT, PangoCoreTextFont)) +#define PANGO_IS_CORE_TEXT_FONT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_CORE_TEXT_FONT)) + +typedef struct _PangoCoreTextFont PangoCoreTextFont; +typedef struct _PangoCoreTextFontClass PangoCoreTextFontClass; + +#if defined(PANGO_ENABLE_ENGINE) || defined(PANGO_ENABLE_BACKEND) + +#define PANGO_RENDER_TYPE_CORE_TEXT "PangoRenderCoreText" + +#ifdef PANGO_ENABLE_BACKEND + +#define PANGO_CORE_TEXT_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_CORE_TEXT_FONT, PangoCoreTextFontClass)) +#define PANGO_IS_CORE_TEXT_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_CORE_TEXT_FONT)) +#define PANGO_CORE_TEXT_FONT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_CORE_TEXT_FONT, PangoCoreTextFontClass)) + +typedef struct _PangoCoreTextFontPrivate PangoCoreTextFontPrivate; + +struct _PangoCoreTextFont +{ + PangoFont parent_instance; + PangoCoreTextFontPrivate *priv; +}; + +struct _PangoCoreTextFontClass +{ + PangoFontClass parent_class; + + /*< private >*/ + + /* Padding for future expansion */ + void (*_pango_reserved1) (void); + void (*_pango_reserved2) (void); + void (*_pango_reserved3) (void); + void (*_pango_reserved4) (void); +}; + +#endif /* PANGO_ENABLE_BACKEND */ + +CTFontRef pango_core_text_font_get_ctfont (PangoCoreTextFont *font); + +#endif /* PANGO_ENABLE_ENGINE || PANGO_ENABLE_BACKEND */ + +GType pango_core_text_font_get_type (void) G_GNUC_CONST; + +G_END_DECLS + +#endif /* __PANGOCORETEXT_H__ */ diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c index 5211361a..23489684 100644 --- a/pango/pangofc-fontmap.c +++ b/pango/pangofc-fontmap.c @@ -790,7 +790,6 @@ pango_fc_patterns_get_font_pattern (PangoFcPatterns *pats, int i) */ static void pango_fc_fontset_finalize (GObject *object); -static void pango_fc_fontset_init (PangoFcFontset *fontset); static PangoLanguage * pango_fc_fontset_get_language (PangoFontset *fontset); static PangoFont * pango_fc_fontset_get_font (PangoFontset *fontset, guint wc); @@ -814,8 +813,7 @@ struct _PangoFcFontset }; typedef PangoFontsetClass PangoFcFontsetClass; - -static PangoFontsetClass *fc_fontset_parent_class; /* Parent class structure for PangoFcFontset */ +G_DEFINE_TYPE (PangoFcFontset, pango_fc_fontset, PANGO_TYPE_FONTSET); static PangoFcFontset * pango_fc_fontset_new (PangoFcFontsetKey *key, @@ -892,9 +890,8 @@ pango_fc_fontset_class_init (PangoFcFontsetClass *class) GObjectClass *object_class = G_OBJECT_CLASS (class); PangoFontsetClass *fontset_class = PANGO_FONTSET_CLASS (class); - fc_fontset_parent_class = g_type_class_peek_parent (class); - object_class->finalize = pango_fc_fontset_finalize; + fontset_class->get_font = pango_fc_fontset_get_font; fontset_class->get_language = pango_fc_fontset_get_language; fontset_class->foreach = pango_fc_fontset_foreach; @@ -935,7 +932,7 @@ pango_fc_fontset_finalize (GObject *object) if (fontset->patterns) pango_fc_patterns_unref (fontset->patterns); - G_OBJECT_CLASS (fc_fontset_parent_class)->finalize (object); + G_OBJECT_CLASS (pango_fc_fontset_parent_class)->finalize (object); } static PangoLanguage * @@ -1008,9 +1005,6 @@ pango_fc_fontset_foreach (PangoFontset *fontset, } } -static PANGO_DEFINE_TYPE (PangoFcFontset, pango_fc_fontset, - pango_fc_fontset_class_init, pango_fc_fontset_init, - PANGO_TYPE_FONTSET) /* * PangoFcFontMap @@ -2180,7 +2174,8 @@ pango_fc_font_description_from_pattern (FcPattern *pattern, gboolean include_siz * PangoFcFace */ -static GObjectClass *pango_fc_face_parent_class = NULL; +typedef PangoFontFaceClass PangoFcFaceClass; +G_DEFINE_TYPE (PangoFcFace, pango_fc_face, PANGO_TYPE_FONT_FACE); static PangoFontDescription * make_alias_description (PangoFcFamily *fcfamily, @@ -2359,17 +2354,19 @@ pango_fc_face_finalize (GObject *object) g_free (fcface->style); - pango_fc_face_parent_class->finalize (object); + G_OBJECT_CLASS (pango_fc_face_parent_class)->finalize (object); } -typedef PangoFontFaceClass PangoFcFaceClass; +static void +pango_fc_face_init (PangoFcFace *self) +{ +} static void pango_fc_face_class_init (PangoFcFaceClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); - pango_fc_face_parent_class = g_type_class_peek_parent (class); object_class->finalize = pango_fc_face_finalize; class->describe = pango_fc_face_describe; @@ -2378,15 +2375,13 @@ pango_fc_face_class_init (PangoFcFaceClass *class) class->is_synthesized = pango_fc_face_is_synthesized; } -static PANGO_DEFINE_TYPE (PangoFcFace, pango_fc_face, - pango_fc_face_class_init, NULL, - PANGO_TYPE_FONT_FACE) /* * PangoFcFamily */ -static GObjectClass *pango_fc_family_parent_class = NULL; +typedef PangoFontFamilyClass PangoFcFamilyClass; +G_DEFINE_TYPE (PangoFcFamily, pango_fc_family, PANGO_TYPE_FONT_FAMILY); static PangoFcFace * create_face (PangoFcFamily *fcfamily, @@ -2567,17 +2562,14 @@ pango_fc_family_finalize (GObject *object) } g_free (fcfamily->faces); - pango_fc_family_parent_class->finalize (object); + G_OBJECT_CLASS (pango_fc_family_parent_class)->finalize (object); } -typedef PangoFontFamilyClass PangoFcFamilyClass; - static void pango_fc_family_class_init (PangoFcFamilyClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); - pango_fc_family_parent_class = g_type_class_peek_parent (class); object_class->finalize = pango_fc_family_finalize; class->list_faces = pango_fc_family_list_faces; @@ -2590,7 +2582,3 @@ pango_fc_family_init (PangoFcFamily *fcfamily) { fcfamily->n_faces = -1; } - -static PANGO_DEFINE_TYPE (PangoFcFamily, pango_fc_family, - pango_fc_family_class_init, pango_fc_family_init, - PANGO_TYPE_FONT_FAMILY) diff --git a/pango/pangoft2.c b/pango/pangoft2.c index f4a3864b..b41c468a 100644 --- a/pango/pangoft2.c +++ b/pango/pangoft2.c @@ -520,7 +520,7 @@ ft_error_compare (const void *pkey, return ((ft_error_description *) pkey)->code - ((ft_error_description *) pbase)->code; } -G_CONST_RETURN char * +const char * _pango_ft2_ft_strerror (FT_Error error) { #undef __FTERRORS_H__ diff --git a/pango/pangox-fontmap.c b/pango/pangox-fontmap.c index 6d5e547e..30946452 100644 --- a/pango/pangox-fontmap.c +++ b/pango/pangox-fontmap.c @@ -41,6 +41,7 @@ #include "pangox-private.h" typedef struct _PangoXFamily PangoXFamily; +typedef struct _PangoXFamilyClass PangoXFamilyClass; typedef struct _PangoXSizeInfo PangoXSizeInfo; /* Number of freed fonts */ @@ -79,6 +80,11 @@ struct _PangoXFamily GSList *font_entries; }; +struct _PangoXFamilyClass +{ + PangoFontFamilyClass parent_class; +}; + struct _PangoXFace { PangoFontFace parent_instance; @@ -133,9 +139,6 @@ static const struct { { "condensed", PANGO_STRETCH_CONDENSED }, }; -static void pango_x_font_map_init (PangoXFontMap *fontmap); -static void pango_x_font_map_class_init (PangoFontMapClass *class); - static void pango_x_font_map_finalize (GObject *object); static PangoFont *pango_x_font_map_load_font (PangoFontMap *fontmap, PangoContext *context, @@ -171,37 +174,7 @@ GType pango_x_family_get_type (void); GType pango_x_face_get_type (void); - -static PangoFontClass *font_map_parent_class; /* Parent class structure for PangoXFontMap */ - -GType -pango_x_font_map_get_type (void) -{ - static GType object_type = 0; - - if (G_UNLIKELY (!object_type)) - { - const GTypeInfo object_info = - { - sizeof (PangoFontMapClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) pango_x_font_map_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoXFontMap), - 0, /* n_preallocs */ - (GInstanceInitFunc) pango_x_font_map_init, - NULL /* value_table */ - }; - - object_type = g_type_register_static (PANGO_TYPE_FONT_MAP, - I_("PangoXFontMap"), - &object_info, 0); - } - - return object_type; -} +G_DEFINE_TYPE (PangoXFontMap, pango_x_font_map, PANGO_TYPE_FONT_MAP); static void pango_x_font_map_init (PangoXFontMap *xfontmap) @@ -214,16 +187,16 @@ pango_x_font_map_init (PangoXFontMap *xfontmap) } static void -pango_x_font_map_class_init (PangoFontMapClass *class) +pango_x_font_map_class_init (PangoXFontMapClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); - - font_map_parent_class = g_type_class_peek_parent (class); + PangoFontMapClass *font_map_class = PANGO_FONT_MAP_CLASS (class); object_class->finalize = pango_x_font_map_finalize; - class->load_font = pango_x_font_map_load_font; - class->list_families = pango_x_font_map_list_families; - class->shape_engine_type = PANGO_RENDER_TYPE_X; + + font_map_class->load_font = pango_x_font_map_load_font; + font_map_class->list_families = pango_x_font_map_list_families; + font_map_class->shape_engine_type = PANGO_RENDER_TYPE_X; } /* @@ -393,7 +366,7 @@ pango_x_font_map_finalize (GObject *object) fontmaps = g_list_remove (fontmaps, xfontmap); - G_OBJECT_CLASS (font_map_parent_class)->finalize (object); + G_OBJECT_CLASS (pango_x_font_map_parent_class)->finalize (object); } static void @@ -1441,7 +1414,7 @@ pango_x_fontmap_atom_from_name (PangoFontMap *fontmap, } -G_CONST_RETURN char * +const char * pango_x_fontmap_name_from_atom (PangoFontMap *fontmap, Atom atom) { @@ -1494,40 +1467,19 @@ pango_x_face_get_face_name (PangoFontFace *face) return xface->face_name; } +typedef PangoFontFaceClass PangoXFaceClass; +G_DEFINE_TYPE (PangoXFace, pango_x_face, PANGO_TYPE_FONT_FACE); + static void -pango_x_face_class_init (PangoFontFaceClass *class) +pango_x_face_class_init (PangoXFaceClass *class) { class->describe = pango_x_face_describe; class->get_face_name = pango_x_face_get_face_name; } -GType -pango_x_face_get_type (void) +static void +pango_x_face_init (PangoXFace *self) { - static GType object_type = 0; - - if (G_UNLIKELY (!object_type)) - { - const GTypeInfo object_info = - { - sizeof (PangoFontFaceClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) pango_x_face_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoXFace), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, - NULL /* value_table */ - }; - - object_type = g_type_register_static (PANGO_TYPE_FONT_FACE, - I_("PangoXFace"), - &object_info, 0); - } - - return object_type; } /* Cut and paste here to avoid an inter-module dependency */ @@ -1645,7 +1597,7 @@ pango_x_family_list_faces (PangoFontFamily *family, } } -static G_CONST_RETURN char * +static const char * pango_x_family_get_name (PangoFontFamily *family) { PangoXFamily *xfamily = PANGO_X_FAMILY (family); @@ -1653,39 +1605,18 @@ pango_x_family_get_name (PangoFontFamily *family) return xfamily->family_name; } +G_DEFINE_TYPE (PangoXFamily, pango_x_family, PANGO_TYPE_FONT_FAMILY); + static void -pango_x_family_class_init (PangoFontFamilyClass *class) +pango_x_family_class_init (PangoXFamilyClass *klass) { - class->list_faces = pango_x_family_list_faces; - class->get_name = pango_x_family_get_name; + PangoFontFamilyClass *font_family_class = PANGO_FONT_FAMILY_CLASS (klass); + + font_family_class->list_faces = pango_x_family_list_faces; + font_family_class->get_name = pango_x_family_get_name; } -GType -pango_x_family_get_type (void) +static void +pango_x_family_init (PangoXFamily *self) { - static GType object_type = 0; - - if (G_UNLIKELY (!object_type)) - { - const GTypeInfo object_info = - { - sizeof (PangoFontFamilyClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) pango_x_family_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoXFamily), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, - NULL /* value_table */ - }; - - object_type = g_type_register_static (PANGO_TYPE_FONT_FAMILY, - I_("PangoXFamily"), - &object_info, 0); - } - - return object_type; } - diff --git a/pango/pangox-private.h b/pango/pangox-private.h index b3a9c8f3..e28ab8b7 100644 --- a/pango/pangox-private.h +++ b/pango/pangox-private.h @@ -92,6 +92,11 @@ struct _PangoXFontMap Window coverage_win; }; +struct _PangoXFontMapClass +{ + PangoFontMapClass parent_class; +}; + GType pango_x_font_map_get_type (void) G_GNUC_CONST; PangoXFont * pango_x_font_new (PangoFontMap *fontmap, diff --git a/pango/pangox.c b/pango/pangox.c index c49024f0..24bca5ea 100644 --- a/pango/pangox.c +++ b/pango/pangox.c @@ -69,10 +69,6 @@ struct _PangoXFontClass PangoFontClass parent_class; }; -static PangoFontClass *parent_class; /* Parent class structure for PangoXFont */ - -static void pango_x_font_class_init (PangoXFontClass *class); -static void pango_x_font_init (PangoXFont *xfont); static void pango_x_font_dispose (GObject *object); static void pango_x_font_finalize (GObject *object); @@ -224,34 +220,7 @@ pango_x_context_set_funcs (PangoContext *context, info->free_gc_func = free_gc_func; } -static GType -pango_x_font_get_type (void) -{ - static GType object_type = 0; - - if (G_UNLIKELY (!object_type)) - { - const GTypeInfo object_info = - { - sizeof (PangoXFontClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) pango_x_font_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PangoXFont), - 0, /* n_preallocs */ - (GInstanceInitFunc) pango_x_font_init, - NULL /* value_table */ - }; - - object_type = g_type_register_static (PANGO_TYPE_FONT, - I_("PangoXFont"), - &object_info, 0); - } - - return object_type; -} +G_DEFINE_TYPE (PangoXFont, pango_x_font, PANGO_TYPE_FONT); static void pango_x_font_init (PangoXFont *xfont) @@ -275,8 +244,6 @@ pango_x_font_class_init (PangoXFontClass *class) GObjectClass *object_class = G_OBJECT_CLASS (class); PangoFontClass *font_class = PANGO_FONT_CLASS (class); - parent_class = g_type_class_peek_parent (class); - object_class->finalize = pango_x_font_finalize; object_class->dispose = pango_x_font_dispose; @@ -1271,7 +1238,7 @@ pango_x_font_dispose (GObject *object) if (!xfont->in_cache && xfont->fontmap) pango_x_fontmap_cache_add (xfont->fontmap, xfont); - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (pango_x_font_parent_class)->dispose (object); } @@ -1326,7 +1293,7 @@ pango_x_font_finalize (GObject *object) g_strfreev (xfont->fonts); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (pango_x_font_parent_class)->finalize (object); } static PangoFontDescription * diff --git a/pango/pangox.def b/pango/pangox.def index e70ca70c..36d7e3f4 100644 --- a/pango/pangox.def +++ b/pango/pangox.def @@ -11,6 +11,7 @@ pango_x_font_cache_free pango_x_font_cache_load pango_x_font_cache_new pango_x_font_cache_unload +pango_x_font_get_type pango_x_font_get_unknown_glyph pango_x_font_map_for_display pango_x_font_map_get_font_cache diff --git a/pango/pangoxft-fontmap.c b/pango/pangoxft-fontmap.c index 2feb4982..3e6034e9 100644 --- a/pango/pangoxft-fontmap.c +++ b/pango/pangoxft-fontmap.c @@ -176,7 +176,7 @@ register_display (Display *display) * The fontmap is owned by Pango and will be valid until * the display is closed. * - * Return value: a #PangoFontMap object, owned by Pango. + * Return value: (transfer none): a #PangoFontMap object, owned by Pango. * * Since: 1.2 **/ @@ -310,7 +310,7 @@ _pango_xft_font_map_get_info (PangoFontMap *fontmap, } /** - * pango_xft_get_context: + * pango_xft_get_context: (skip) * @display: an X display. * @screen: an X screen. * diff --git a/pango/reorder-items.c b/pango/reorder-items.c index 25433509..73342248 100644 --- a/pango/reorder-items.c +++ b/pango/reorder-items.c @@ -37,7 +37,8 @@ static GList *reorder_items_recurse (GList *items, int n_items); * directional levels, produce a list in visual order. * The original list is unmodified. * - * Returns: a #GList of #PangoItem structures in visual order. + * Returns: (transfer full) (element-type Pango.Item): a #GList + * of #PangoItem structures in visual order. * * (Please open a bug if you use this function. * It is not a particularly convenient interface, and the code |