rollback to 3428, before the mysterious removal of libs/* at 3431/3432

git-svn-id: svn://localhost/ardour2/branches/3.0@3435 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2008-06-02 21:41:35 +00:00
parent 9c0d7d72d7
commit 449aab3c46
2869 changed files with 1026749 additions and 0 deletions

View file

@ -0,0 +1,16 @@
## Copyright (c) 2001
## The gtkmm development team.
sublib_name = pangomm
sublib_namespace = Pango
sublib_parentdir = pangomm
files_defs = pango.defs pango_methods.defs pango_enums.defs pango_vfuncs.defs \
pango_docs.xml pango_docs_override.xml
include $(top_srcdir)/build_shared/Makefile_gensrc.am_fragment

View file

@ -0,0 +1,464 @@
# Makefile.in generated by automake 1.10 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# This file is include by other Makefile.am files, using the new automake include feature.
# The include happens in Makefile.am, not Makefile.in or Makefile,
# so it's like copy-and-pasting this into each of those Makefile.am files.
# Built files
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
DIST_COMMON = $(srcdir)/../src/Makefile_list_of_hg.am_fragment \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/build_shared/Makefile_build_gensrc.am_fragment \
$(top_srcdir)/build_shared/Makefile_gensrc.am_fragment \
$(top_srcdir)/tools/Makefile_list_of_sources.am_fragment \
$(top_srcdir)/tools/m4/Makefile_list_of_sources.am_fragment
subdir = pango/src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/scripts/docgen.m4 \
$(top_srcdir)/scripts/macros.m4 \
$(top_srcdir)/scripts/reduced.m4 $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h \
$(top_builddir)/gdk/gdkmmconfig.h \
$(top_builddir)/gtk/gtkmmconfig.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
ATKMM_CFLAGS = @ATKMM_CFLAGS@
ATKMM_LIBS = @ATKMM_LIBS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEMO_SUBDIR = @DEMO_SUBDIR@
DEPDIR = @DEPDIR@
DISABLE_DEPRECATED_API_CFLAGS = @DISABLE_DEPRECATED_API_CFLAGS@
DISABLE_DEPRECATED_CFLAGS = @DISABLE_DEPRECATED_CFLAGS@
DLLTOOL = @DLLTOOL@
DOCS_SUBDIR = @DOCS_SUBDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXAMPLE_SUBDIR = @EXAMPLE_SUBDIR@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
GDKMM_CFLAGS = @GDKMM_CFLAGS@
GDKMM_LIBS = @GDKMM_LIBS@
GMMPROC = @GMMPROC@
GMMPROC_DIR = @GMMPROC_DIR@
GREP = @GREP@
GTHREAD_CFLAGS = @GTHREAD_CFLAGS@
GTHREAD_LIBS = @GTHREAD_LIBS@
GTKMM_CFLAGS = @GTKMM_CFLAGS@
GTKMM_DOXYGEN_INPUT = @GTKMM_DOXYGEN_INPUT@
GTKMM_LIBS = @GTKMM_LIBS@
GTKMM_MAJOR_VERSION = @GTKMM_MAJOR_VERSION@
GTKMM_MICRO_VERSION = @GTKMM_MICRO_VERSION@
GTKMM_MINOR_VERSION = @GTKMM_MINOR_VERSION@
GTKMM_PC_ATKMM_DEP = @GTKMM_PC_ATKMM_DEP@
GTKMM_RELEASE = @GTKMM_RELEASE@
GTKMM_VERSION = @GTKMM_VERSION@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBGTKMM_SO_VERSION = @LIBGTKMM_SO_VERSION@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M4 = @M4@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PANGOMM_CFLAGS = @PANGOMM_CFLAGS@
PANGOMM_LIBS = @PANGOMM_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL_PATH = @PERL_PATH@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
sublib_name = pangomm
sublib_namespace = Pango
sublib_parentdir = pangomm
files_defs = pango.defs pango_methods.defs pango_enums.defs pango_vfuncs.defs \
pango_docs.xml pango_docs_override.xml
tools_dir = $(top_srcdir)/tools
tools_dir_m4 = $(top_srcdir)/tools/m4
tools_dir_pm = $(top_srcdir)/tools/pm
gensrc_destdir = $(srcdir)/../$(sublib_name)
stamp_dir = $(srcdir)/.stamps
files_tools_m4 = convert.m4 convert_gtkmm.m4 convert_atk.m4 convert_gdk.m4 \
convert_gtk.m4 convert_pango.m4
tools_m4 = $(files_tools_m4:%.m4=$(tools_dir_m4)/%.m4)
files_posix_hg =
files_win32_hg =
files_general_hg = attributes.hg attriter.hg attrlist.hg cairofontmap.hg color.hg context.hg coverage.hg \
font.hg fontdescription.hg fontface.hg fontfamily.hg fontmap.hg fontmetrics.hg fontset.hg \
glyph.hg glyphstring.hg item.hg language.hg layout.hg layoutiter.hg layoutline.hg layoutrun.hg \
rectangle.hg renderer.hg tabarray.hg
files_general_deprecated_hg =
files_all_hg = \
$(files_posix_hg) \
$(files_win32_hg) \
$(files_general_hg) \
$(files_general_deprecated_hg)
@OS_WIN32_FALSE@files_hg = $(files_general_hg) $(files_posix_hg) $(files_general_deprecated_hg)
@OS_WIN32_TRUE@files_hg = $(files_general_hg) $(files_win32_hg) $(files_general_deprecated_hg)
files_built_cc = $(files_hg:.hg=.cc) wrap_init.cc
files_built_h = $(files_hg:.hg=.h)
files_all_built_cc = $(files_all_hg:.hg=.cc) wrap_init.cc
files_all_built_h = $(files_all_hg:.hg=.h)
# Extra files
files_all_extra_cc = \
$(sublib_files_extra_posix_cc) \
$(sublib_files_extra_win32_cc) \
$(sublib_files_extra_general_cc) \
$(sublib_files_extra_general_deprecated_cc)
files_all_extra_h = $(sublib_files_extra_posix_h) \
$(sublib_files_extra_win32_h) $(sublib_files_extra_general_h) \
$(sublib_files_extra_general_deprecated_h) wrap_init.h
@OS_WIN32_FALSE@files_extra_cc = \
@OS_WIN32_FALSE@ $(sublib_files_extra_posix_cc) \
@OS_WIN32_FALSE@ $(sublib_files_extra_general_cc)
@OS_WIN32_TRUE@files_extra_cc = \
@OS_WIN32_TRUE@ $(sublib_files_extra_win32_cc) \
@OS_WIN32_TRUE@ $(sublib_files_extra_general_cc)
@OS_WIN32_FALSE@files_extra_h = $(sublib_files_extra_posix_h) \
@OS_WIN32_FALSE@ $(sublib_files_extra_general_h) wrap_init.h
@OS_WIN32_TRUE@files_extra_h = $(sublib_files_extra_win32_h) \
@OS_WIN32_TRUE@ $(sublib_files_extra_general_h) wrap_init.h
# tools_pm = $(files_tools_pm:%.pm=$(tools_dir_pm)/%.pm)
files_all_ccg = $(files_all_hg:%.hg=%.ccg)
files_h = $(files_all_hg:%.hg=$(gensrc_destdir)/%.h)
files_cc = $(files_all_hg:%.hg=$(gensrc_destdir)/%.cc)
files_stamp = $(files_all_hg:%.hg=$(stamp_dir)/stamp-%)
#Installed gmmproc stuff, from glibmm:
gmmproc_path = $(GMMPROC)
gmmproc_dir = $(GMMPROC_DIR)
# We use our own m4 and pm files as well as the ones installed by gtkmm:
# Our override m4 include seems to need to be before the default one.
gmmproc_args = -I $(tools_dir_m4) --defs $(srcdir)
run_gmmproc = $(gmmproc_path) $(gmmproc_args)
gen_wrap_init_path = $(gmmproc_dir)/generate_wrap_init.pl
gen_wrap_init_args = --namespace=$(sublib_namespace) --parent_dir=$(sublib_parentdir)
run_gen_wrap_init = $(gen_wrap_init_path) $(gen_wrap_init_args)
EXTRA_DIST = Makefile_list_of_hg.am_fragment \
$(files_defs) $(files_all_hg) $(files_all_ccg)
sublib_srcdir = $(srcdir)/../src
files_hg_with_path = $(patsubst %.hg,$(sublib_srcdir)/%.hg,$(files_all_hg))
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/build_shared/Makefile_gensrc.am_fragment $(top_srcdir)/tools/Makefile_list_of_sources.am_fragment $(top_srcdir)/tools/m4/Makefile_list_of_sources.am_fragment $(srcdir)/../src/Makefile_list_of_hg.am_fragment $(top_srcdir)/build_shared/Makefile_build_gensrc.am_fragment $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu pango/src/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu pango/src/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
@MAINTAINER_MODE_FALSE@all-local:
all-am: Makefile all-local
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-exec-am:
install-html: install-html-am
install-info: install-info-am
install-man:
install-pdf: install-pdf-am
install-ps: install-ps-am
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic \
maintainer-clean-local
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: all all-am all-local check check-am clean clean-generic \
clean-libtool distclean distclean-generic distclean-libtool \
distdir dvi dvi-am html html-am info info-am install \
install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic \
maintainer-clean-local mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
$(stamp_dir)/stamp-%: %.hg %.ccg $(tools_m4) $(files_defs)
$(run_gmmproc) $(notdir $*) $(srcdir) $(gensrc_destdir)
@echo 'timestamp' > $@
$(gensrc_destdir)/wrap_init.cc: $(gen_wrap_init_path) $(files_hg_with_path)
$(run_gen_wrap_init) $(files_all_hg:%.hg=$(srcdir)/%.hg) >$@
create-stamp-dir:
@(test -d $(stamp_dir) || mkdir $(stamp_dir))
@MAINTAINER_MODE_TRUE@all-local: create-stamp-dir $(files_stamp) $(gensrc_destdir)/wrap_init.cc
maintainer-clean-local:
rm -rf $(stamp_dir)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View file

@ -0,0 +1,15 @@
# This file is include by other Makefile.am files, using the new automake include feature.
# The include happens in Makefile.am, not Makefile.in or Makefile,
# so it's like copy-and-pasting this into each of those Makefile.am files.
files_posix_hg =
files_win32_hg =
files_general_hg = attributes.hg attriter.hg attrlist.hg cairofontmap.hg color.hg context.hg coverage.hg \
font.hg fontdescription.hg fontface.hg fontfamily.hg fontmap.hg fontmetrics.hg fontset.hg \
glyph.hg glyphstring.hg item.hg language.hg layout.hg layoutiter.hg layoutline.hg layoutrun.hg \
rectangle.hg renderer.hg tabarray.hg
files_general_deprecated_hg =
include $(top_srcdir)/build_shared/Makefile_build_gensrc.am_fragment

View file

@ -0,0 +1,351 @@
/*
*
* Copyright 2002 Free Software Foundation
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
namespace Pango
{
Attribute::Attribute()
:
gobject_(0)
{}
Attribute::Attribute(const Attribute& src)
:
gobject_(src.gobject_ ? pango_attribute_copy(src.gobject_) : 0)
{}
Attribute::Attribute(PangoAttribute* castitem, bool take_copy)
{
if(take_copy)
{
if(castitem)
gobject_ = pango_attribute_copy(castitem);
else
gobject_ = 0;
}
else
{
// It was given to us by a function which has already made a copy for us to keep.
gobject_ = castitem;
}
}
Attribute::~Attribute()
{
if(gobject_)
pango_attribute_destroy(gobject_);
gobject_ = 0;
}
Attribute& Attribute::operator=(const Attribute& src)
{
PangoAttribute *const new_gobject = (src.gobject_ ? pango_attribute_copy(src.gobject_) : 0);
if(gobject_)
pango_attribute_destroy(gobject_);
gobject_ = new_gobject;
return *this;
}
AttrType Attribute::get_type() const
{
return (AttrType) ((gobject_) ? gobj()->klass->type : PANGO_ATTR_INVALID);
}
AttrType Attribute::register_type(const Glib::ustring& name)
{
return (AttrType)pango_attr_type_register(name.c_str());
}
AttrString Attribute::create_attr_family(const Glib::ustring& family)
{
return Glib::wrap((PangoAttrString*)pango_attr_family_new(family.c_str()));
}
AttrLanguage Attribute::create_attr_language(const Language& language)
{
return Glib::wrap((PangoAttrLanguage*)pango_attr_language_new(const_cast<PangoLanguage*>(language.gobj())));
}
AttrColor Attribute::create_attr_foreground(guint16 red, guint16 green, guint16 blue)
{
return Glib::wrap((PangoAttrColor*)pango_attr_foreground_new(red, green, blue));
}
AttrColor Attribute::create_attr_background(guint16 red, guint16 green, guint16 blue)
{
return Glib::wrap((PangoAttrColor*)pango_attr_background_new(red, green, blue));
}
AttrInt Attribute::create_attr_size(int size)
{
return Glib::wrap((PangoAttrInt*)pango_attr_size_new(size));
}
AttrInt Attribute::create_attr_style(Style style)
{
return Glib::wrap((PangoAttrInt*)pango_attr_style_new((PangoStyle)style));
}
AttrInt Attribute::create_attr_weight(Weight weight)
{
return Glib::wrap((PangoAttrInt*)pango_attr_weight_new((PangoWeight)weight));
}
AttrInt Attribute::create_attr_variant(Variant variant)
{
return Glib::wrap((PangoAttrInt*)pango_attr_variant_new((PangoVariant)variant));
}
AttrInt Attribute::create_attr_stretch(Stretch stretch)
{
return Glib::wrap((PangoAttrInt*)pango_attr_stretch_new((PangoStretch)stretch));
}
AttrFontDesc Attribute::create_attr_font_desc(const FontDescription& desc)
{
return Glib::wrap((PangoAttrFontDesc*)pango_attr_font_desc_new(desc.gobj()));
}
AttrInt Attribute::create_attr_underline(Underline underline)
{
return Glib::wrap((PangoAttrInt*)pango_attr_underline_new((PangoUnderline)underline));
}
AttrInt Attribute::create_attr_strikethrough(bool strikethrough)
{
return Glib::wrap((PangoAttrInt*)pango_attr_strikethrough_new(strikethrough));
}
AttrInt Attribute::create_attr_rise(int rise)
{
return Glib::wrap((PangoAttrInt*)pango_attr_rise_new(rise));
}
AttrFloat Attribute::create_attr_scale(double scale_factor)
{
return Glib::wrap((PangoAttrFloat*)pango_attr_scale_new(scale_factor));
}
AttrShape Attribute::create_attr_shape(const Rectangle& ink_rect, const Rectangle& logical_rect)
{
return Glib::wrap((PangoAttrShape*)pango_attr_shape_new(ink_rect.gobj(), logical_rect.gobj()));
}
AttrString::AttrString()
{}
AttrString::AttrString(const AttrString& src)
:
Attribute(src)
{}
AttrString::AttrString(PangoAttrString* castitem, bool take_copy)
:
Attribute((PangoAttribute*)castitem, take_copy)
{}
AttrString& AttrString::operator=(const AttrString& src)
{
Attribute::operator=(src);
return *this;
}
void AttrString::set_string(const Glib::ustring& str)
{
g_free(gobj()->value);
gobj()->value = g_strdup(str.c_str());
}
AttrLanguage::AttrLanguage()
{}
AttrLanguage::AttrLanguage(const AttrLanguage& src)
:
Attribute(src)
{}
AttrLanguage::AttrLanguage(PangoAttrLanguage* castitem, bool take_copy)
:
Attribute((PangoAttribute*)castitem, take_copy)
{}
AttrLanguage& AttrLanguage::operator=(const AttrLanguage& src)
{
Attribute::operator=(src);
return *this;
}
AttrColor::AttrColor()
{}
AttrColor::AttrColor(const AttrColor& src)
:
Attribute(src)
{}
AttrColor::AttrColor(PangoAttrColor* castitem, bool take_copy)
:
Attribute((PangoAttribute*)castitem, take_copy)
{}
AttrColor& AttrColor::operator=(const AttrColor& src)
{
Attribute::operator=(src);
return *this;
}
AttrInt::AttrInt()
{}
AttrInt::AttrInt(const AttrInt& src)
:
Attribute(src)
{}
AttrInt::AttrInt(PangoAttrInt* castitem, bool take_copy)
:
Attribute((PangoAttribute*)castitem, take_copy)
{}
AttrInt& AttrInt::operator=(const AttrInt& src)
{
Attribute::operator=(src);
return *this;
}
AttrFloat::AttrFloat()
{}
AttrFloat::AttrFloat(const AttrFloat& src)
:
Attribute(src)
{}
AttrFloat::AttrFloat(PangoAttrFloat* castitem, bool take_copy)
:
Attribute((PangoAttribute*)castitem, take_copy)
{}
AttrFloat& AttrFloat::operator=(const AttrFloat& src)
{
Attribute::operator=(src);
return *this;
}
AttrFontDesc::AttrFontDesc()
{}
AttrFontDesc::AttrFontDesc(const AttrFontDesc& src)
:
Attribute(src)
{}
AttrFontDesc::AttrFontDesc(PangoAttrFontDesc* castitem, bool take_copy)
:
Attribute((PangoAttribute*)castitem, take_copy)
{}
AttrFontDesc& AttrFontDesc::operator=(const AttrFontDesc& src)
{
Attribute::operator=(src);
return *this;
}
void AttrFontDesc::set_desc(const FontDescription& desc)
{
pango_font_description_free(gobj()->desc);
gobj()->desc = pango_font_description_copy(desc.gobj());
}
AttrShape::AttrShape()
{}
AttrShape::AttrShape(const AttrShape& src)
:
Attribute(src)
{}
AttrShape::AttrShape(PangoAttrShape* castitem, bool take_copy)
:
Attribute((PangoAttribute*)castitem, take_copy)
{}
AttrShape& AttrShape::operator=(const AttrShape& src)
{
Attribute::operator=(src);
return *this;
}
} //namespace Pango
namespace Glib
{
Pango::Attribute wrap(PangoAttribute* object, bool take_copy)
{
return Pango::Attribute(object, take_copy);
}
Pango::AttrString wrap(PangoAttrString* object, bool take_copy)
{
return Pango::AttrString(object, take_copy);
}
Pango::AttrLanguage wrap(PangoAttrLanguage* object, bool take_copy)
{
return Pango::AttrLanguage(object, take_copy);
}
Pango::AttrColor wrap(PangoAttrColor* object, bool take_copy)
{
return Pango::AttrColor(object, take_copy);
}
Pango::AttrInt wrap(PangoAttrInt* object, bool take_copy)
{
return Pango::AttrInt(object, take_copy);
}
Pango::AttrFloat wrap(PangoAttrFloat* object, bool take_copy)
{
return Pango::AttrFloat(object, take_copy);
}
Pango::AttrFontDesc wrap(PangoAttrFontDesc* object, bool take_copy)
{
return Pango::AttrFontDesc(object, take_copy);
}
Pango::AttrShape wrap(PangoAttrShape* object, bool take_copy)
{
return Pango::AttrShape(object, take_copy);
}
} //namespace Glib

View file

@ -0,0 +1,508 @@
/* attributes.h
*
* Copyright (C) 2002 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <pangomm/language.h>
#include <pangomm/rectangle.h>
#include <pangomm/color.h>
#include <pangomm/fontdescription.h>
#include <pango/pango-attributes.h>
_DEFS(pangomm,pango)
namespace Pango
{
_CC_INCLUDE(pango/pango-enum-types.h)
/** Pango::AttrType distinguishes between different types of attributes.
* Along with the predefined values, it is possible to allocate additional values for
* custom attributes using Pango::Attribute::register_type(). The predefined values
* are given below.
*/
_WRAP_ENUM(AttrType, PangoAttrType)
/** A Pango::Underline is used to specify whether text should be underlined, and if so, the type of underlining.
*/
_WRAP_ENUM(Underline, PangoUnderline)
/** A Pango::LogAttr stores information about the attributes of a single character.
*/
typedef PangoLogAttr LogAttr;
class AttrString;
class AttrLanguage;
class AttrColor;
class AttrInt;
class AttrFloat;
class AttrFontDesc;
class AttrShape;
/** The Pango::Attribute structure represents the common portions of all attributes.
* Particular types of attributes derive this class. It holds the range in which the
* value in the type-specific part of the attribute applies.
*
* Attributed text is used in a number of places in pango. It is used as the input to
* the itemization process and also when creating a Pango::Layout.
*/
class Attribute
{
_CLASS_GENERIC(Attribute, PangoAttribute)
_IGNORE(pango_attribute_copy,pango_attribute_destroy)
public:
/** Constructs an invalid attribute.
*/
Attribute();
Attribute(const Attribute& src);
explicit Attribute(PangoAttribute* castitem, bool take_copy=true);
~Attribute();
Attribute& operator=(const Attribute& src);
/** Gets the type ID for this attribute.
* @return The type ID for this attribute or ATTR_INVALID if the attribute is invalid.
*/
AttrType get_type() const;
/** Allocate a new attribute type ID.
* @param name An identifier for the type (currently unused).
* @return The new type ID.
*/
static AttrType register_type(const Glib::ustring& name);
/** Gets the start index of the range.
* @return The start index of the range.
*/
_MEMBER_GET(start_index, start_index, unsigned int, guint)
/** Gets the end index of the range. The character at this index is not included in the range.
* @return The end index of the range.
*/
_MEMBER_GET(end_index, end_index, unsigned int, guint)
/** Sets the start index of the range.
* @param value The new start index.
*/
_MEMBER_SET(start_index, start_index, unsigned int, guint)
/** Sets the end index of the range. The character at this index is not included in the range.
* @param value The new end index.
*/
_MEMBER_SET(end_index, end_index, unsigned int, guint)
_WRAP_METHOD(bool equal(const Attribute& attr2) const, pango_attribute_equal)
/// Provides access to the underlying C GObject.
PangoAttribute* gobj() { return gobject_; }
/// Provides access to the underlying C GObject.
PangoAttribute* const gobj() const { return gobject_; }
/** Create a new font family attribute.
* @param family The family or comma separated list of families.
* @return An attribute of type AttrString.
*/
static AttrString create_attr_family(const Glib::ustring& family);
/** Create a new language tag attribute
* @param language The language tag.
* @return An attribute of type AttrLanguage.
*/
static AttrLanguage create_attr_language(const Language& language);
/** Create a new foreground color attribute.
* @param red The red value (ranging from 0 to 65535).
* @param green The green value (ranging from 0 to 65535).
* @param blue The blue value (ranging from 0 to 65535).
* @return An attribute of type AttrColor.
*/
static AttrColor create_attr_foreground(guint16 red, guint16 green, guint16 blue);
/** Create a new background color attribute.
* @param red The red value (ranging from 0 to 65535).
* @param green The green value (ranging from 0 to 65535).
* @param blue The blue value (ranging from 0 to 65535).
* @return An attribute of type AttrColor.
*/
static AttrColor create_attr_background(guint16 red, guint16 green, guint16 blue);
/** Create a new font-size attribute.
* @param size The font size, in 1000ths of a point.
* @return An attribute of type AttrInt.
*/
static AttrInt create_attr_size(int size);
/** Create a new font slant style attribute.
* @param style The slant style.
* @return An attribute of type AttrInt.
*/
static AttrInt create_attr_style(Style style);
/** Create a new font weight attribute.
* @param weight The weight.
* @return An attribute of type AttrInt.
*/
static AttrInt create_attr_weight(Weight weight);
/** Create a new font variant attribute (normal or small caps).
* @param variant The variant.
* @return An attribute of type AttrInt.
*/
static AttrInt create_attr_variant(Variant variant);
/** Create a new font stretch attribute.
* @param stretch The stretch.
* @return An attribute of type AttrInt.
*/
static AttrInt create_attr_stretch(Stretch stretch);
/** Create a new font description attribute.
* This attribute allows setting family, style, weight, variant, stretch, and size simultaneously.
* @param desc The font description.
* @return An attribute of type AttrFontDesc.
*/
static AttrFontDesc create_attr_font_desc(const FontDescription& desc);
/** Create a new underline-style object.
* @param underline The underline style.
* @return An attribute of type AttrInt.
*/
static AttrInt create_attr_underline(Underline underline);
/** Create a new font strike-through attribute.
* @param strikethrough True indicates the text should be struck-through.
* @return An attribute of type AttrInt.
*/
static AttrInt create_attr_strikethrough(bool strikethrough);
/** Create a new baseline displacement attribute.
* @param rise The amount that the text should be displaced vertically, in 10'000ths of an em. Positive values displace the text upwards.
* @return An attribute of type AttrInt.
*/
static AttrInt create_attr_rise(int rise);
/** Create a new font size scale attribute.
* The base font for the affected text will have its size multiplied by scale_factor.
* @param scale_factor Factor to scale the font.
* @return An attribute of type AttrFloat.
*/
static AttrFloat create_attr_scale(double scale_factor);
/** Create a new shape attribute.
* A shape is used to impose a particular ink and logical rect on the result of shaping a particular glyph.
* This might be used, for instance, for embedding a picture or a widget inside a PangoLayout.
* @param ink_rect Ink rectangle to assign to each character.
* @param logical_rect Logical rectangle assign to each character.
* @return An attribute of type AttrShape.
*/
static AttrShape create_attr_shape(const Rectangle& ink_rect, const Rectangle& logical_rect);
protected:
PangoAttribute* gobject_;
};
/** @relates Pango::Attribute */
inline bool operator==(const Attribute& lhs, const Attribute& rhs)
{
return lhs.equal(rhs);
}
/** @relates Pango::Attribute */
inline bool operator!=(const Attribute& lhs, const Attribute& rhs)
{
return lhs.equal(rhs);
}
/** A Pango::AttrString is used to represent an attribute with a string value.
*/
class AttrString : public Attribute
{
_CLASS_GENERIC(AttrString, PangoAttrString)
protected:
AttrString();
public:
AttrString(const AttrString& src);
explicit AttrString(PangoAttrString* castitem, bool take_copy=true);
AttrString& operator=(const AttrString& src);
/** Gets the string which is the value of the attribute.
* @return The string value of the attribute.
*/
_MEMBER_GET(string, value, Glib::ustring, char*)
/** Sets the string which is the value of the attribute.
* @param string The new string value for the attribute.
*/
void set_string(const Glib::ustring& string);
/// Provides access to the underlying C GObject.
PangoAttrString* gobj() { return reinterpret_cast<PangoAttrString*>(gobject_); }
/// Provides access to the underlying C GObject.
const PangoAttrString* gobj() const { return reinterpret_cast<const PangoAttrString*>(gobject_); }
};
/** A Pango::AttrLanguage is used to represent an attribute that is a language.
*/
class AttrLanguage : public Attribute
{
_CLASS_GENERIC(AttrLanguage, PangoAttrLanguage)
protected:
AttrLanguage();
public:
AttrLanguage(const AttrLanguage& src);
explicit AttrLanguage(PangoAttrLanguage* castitem, bool take_copy=true);
AttrLanguage& operator=(const AttrLanguage& src);
/** Gets the language which is the value of the attribute.
* @return The language tag of the attribute.
*/
_MEMBER_GET(language, value, Language, PangoLanguage*)
/** Sets the language which is the value of the attribute.
* @param value The new language tag for the attribute.
*/
_MEMBER_SET_PTR(language, value, const Language&, PangoLanguage*)
/// Provides access to the underlying C GObject.
PangoAttrLanguage* gobj() { return reinterpret_cast<PangoAttrLanguage*>(gobject_); }
/// Provides access to the underlying C GObject.
const PangoAttrLanguage* gobj() const { return reinterpret_cast<const PangoAttrLanguage*>(gobject_); }
};
/** A Pango::AttrColor is used to represent an attribute which is a color.
*/
class AttrColor : public Attribute
{
_CLASS_GENERIC(AttrColor, PangoAttrColor)
protected:
AttrColor();
public:
AttrColor(const AttrColor& src);
explicit AttrColor(PangoAttrColor* castitem, bool take_copy=true);
AttrColor& operator=(const AttrColor& src);
/** Gets the color which is the value of the attribute.
* @return The color value of the attribute.
*/
_MEMBER_GET(color, color, Color, PangoColor)
/** Sets the color which is the value of the attribute.
* @param value The new color value for the attribute.
*/
_MEMBER_SET(color, color, Color, PangoColor)
/// Provides access to the underlying C GObject.
PangoAttrColor* gobj() { return reinterpret_cast<PangoAttrColor*>(gobject_); }
/// Provides access to the underlying C GObject.
const PangoAttrColor* gobj() const { return reinterpret_cast<const PangoAttrColor*>(gobject_); }
};
/** A Pango::AttrInt is used to represent an attribute with an integer or enumeration value.
*/
class AttrInt : public Attribute
{
_CLASS_GENERIC(AttrInt, PangoAttrInt)
protected:
AttrInt();
public:
AttrInt(const AttrInt& src);
explicit AttrInt(PangoAttrInt* castitem, bool take_copy=true);
AttrInt& operator=(const AttrInt& src);
/** Gets the integer value of the attribute.
* @return The integer value of the attribute.
*/
_MEMBER_GET(value, value, int, int)
/** Sets the integer value of the attribute.
* @param value The new integer value for the attribute.
*/
_MEMBER_SET(value, value, int, int)
/// Provides access to the underlying C GObject.
PangoAttrInt* gobj() { return reinterpret_cast<PangoAttrInt*>(gobject_); }
/// Provides access to the underlying C GObject.
const PangoAttrInt* gobj() const { return reinterpret_cast<const PangoAttrInt*>(gobject_); }
};
/** A Pango::AttrFloat is used to represent an attribute with a float or double value.
*/
class AttrFloat : public Attribute
{
_CLASS_GENERIC(AttrFloat, PangoAttrFloat)
protected:
AttrFloat();
public:
AttrFloat(const AttrFloat& src);
explicit AttrFloat(PangoAttrFloat* castitem, bool take_copy=true);
AttrFloat& operator=(const AttrFloat& src);
/** Gets the floating point value of the attribute.
* @return The floating point value of the attribute.
*/
_MEMBER_GET(value, value, double, double)
/** Sets the floating point value of the attribute.
* @param value The new floating point value for the attribute.
*/
_MEMBER_SET(value, value, double, double)
/// Provides access to the underlying C GObject.
PangoAttrFloat* gobj() { return reinterpret_cast<PangoAttrFloat*>(gobject_); }
/// Provides access to the underlying C GObject.
const PangoAttrFloat* gobj() const { return reinterpret_cast<const PangoAttrFloat*>(gobject_); }
};
/** A Pango::AttrFontDesc is used to represent an attribute that sets all aspects of the font description at once.
*/
class AttrFontDesc : public Attribute
{
_CLASS_GENERIC(AttrFontDesc, PangoAttrFontDesc)
protected:
AttrFontDesc();
public:
AttrFontDesc(const AttrFontDesc& src);
explicit AttrFontDesc(PangoAttrFontDesc* castitem, bool take_copy=true);
AttrFontDesc& operator=(const AttrFontDesc& src);
/** Gets the font description which is the value of the attribute.
* @return The font description of the attribute.
*/
_MEMBER_GET(desc, desc, FontDescription, PangoFontDescription*)
/** Sets the font description which is the value of the attribute.
* @param desc The new font description for the attribute.
*/
void set_desc(const FontDescription& desc);
/// Provides access to the underlying C GObject.
PangoAttrFontDesc* gobj() { return reinterpret_cast<PangoAttrFontDesc*>(gobject_); }
/// Provides access to the underlying C GObject.
const PangoAttrFontDesc* gobj() const { return reinterpret_cast<const PangoAttrFontDesc*>(gobject_); }
};
/** A Pango::AttrShape structure is used to represent an attribute which imposes shape restrictions.
*/
class AttrShape : public Attribute
{
_CLASS_GENERIC(AttrShape, PangoAttrShape)
protected:
AttrShape();
public:
AttrShape(const AttrShape& src);
explicit AttrShape(PangoAttrShape* castitem, bool take_copy=true);
AttrShape& operator=(const AttrShape& src);
/** Gets the ink rectangle to restrict to.
* @return The ink rectangle of the attribute.
*/
_MEMBER_GET(ink_rect, ink_rect, Rectangle, PangoRectangle)
/** Gets the logical rectangle to restrict to.
* @return The logical rectangle of the attribute.
*/
_MEMBER_GET(logical_rect, logical_rect, Rectangle, PangoRectangle)
/** Sets the ink rectangle to restrict to.
* @param value The new ink rectangle for the attribute.
*/
_MEMBER_SET(ink_rect, ink_rect, Rectangle, PangoRectangle)
/** Sets the logical rectangle to restrict to.
* @param value The new logical rectangle for the attribute.
*/
_MEMBER_SET(logical_rect, logical_rect, Rectangle, PangoRectangle)
/// Provides access to the underlying C GObject.
PangoAttrShape* gobj() { return reinterpret_cast<PangoAttrShape*>(gobject_); }
/// Provides access to the underlying C GObject.
const PangoAttrShape* gobj() const { return reinterpret_cast<const PangoAttrShape*>(gobject_); }
};
struct AttributeTraits
{
typedef Pango::Attribute CppType;
typedef const PangoAttribute* CType;
typedef PangoAttribute* CTypeNonConst;
static CType to_c_type (const CppType& obj) { return obj.gobj(); }
static CType to_c_type (CType ptr) { return ptr; }
static CppType to_cpp_type (CType ptr) { return CppType(const_cast<CTypeNonConst>(ptr), true); }
static void release_c_type (CType ptr) { pango_attribute_destroy(const_cast<CTypeNonConst>(ptr)); }
};
typedef Glib::SListHandle<Attribute, AttributeTraits> SListHandle_Attribute;
} // namespace Pango
namespace Glib
{
/** @relates Pango::Attribute */
Pango::Attribute wrap(PangoAttribute* object, bool take_copy = false);
/** @relates Pango::AttrString */
Pango::AttrString wrap(PangoAttrString* object, bool take_copy = false);
/** @relates Pango::AttrLanguage */
Pango::AttrLanguage wrap(PangoAttrLanguage* object, bool take_copy = false);
/** @relates Pango::AttrColor */
Pango::AttrColor wrap(PangoAttrColor* object, bool take_copy = false);
/** @relates Pango::AttrInt */
Pango::AttrInt wrap(PangoAttrInt* object, bool take_copy = false);
/** @relates Pango::AttrFloat */
Pango::AttrFloat wrap(PangoAttrFloat* object, bool take_copy = false);
/** @relates Pango::AttrFontDesc */
Pango::AttrFontDesc wrap(PangoAttrFontDesc* object, bool take_copy = false);
/** @relates Pango::AttrShape */
Pango::AttrShape wrap(PangoAttrShape* object, bool take_copy = false);
} //namespace Glib

View file

@ -0,0 +1,151 @@
/*
*
* Copyright 1998-1999 The Gtk-- Development Team
* Copyright 2001 Free Software Foundation
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
namespace Pango
{
AttrIter::AttrIter()
:
gobject_(0)
{}
AttrIter::AttrIter(const AttrIter& src)
:
gobject_(src.gobject_ ? pango_attr_iterator_copy(src.gobject_) : 0)
{}
AttrIter::AttrIter(PangoAttrIterator* castitem, bool take_copy)
{
if(take_copy)
{
if(castitem)
gobject_ = pango_attr_iterator_copy(castitem);
else
gobject_ = 0;
}
else
{
gobject_ = castitem;
}
}
AttrIter::~AttrIter()
{
if(gobject_)
pango_attr_iterator_destroy(gobject_);
}
AttrIter& AttrIter::operator=(const AttrIter& src)
{
PangoAttrIterator *const new_gobject = (src.gobject_ ? pango_attr_iterator_copy(src.gobject_) : 0);
if(gobject_)
pango_attr_iterator_destroy(gobject_);
gobject_ = new_gobject;
return *this;
}
AttrIter& AttrIter::operator++()
{
next();
return *this;
}
const AttrIter AttrIter::operator++(int)
{
AttrIter previous(*this);
next();
return previous;
}
/* operator bool() cannot be implemented to work properly if a Pango::AttrIter is created
* from an already invalid PangoAttrIterator* because there is no way to validate it.
* Otherwise the iterator can only become invalid after some call to Pango::AttrIter::next()
* in which case gobject_ is destroyed thus marking the iterator as invalid.
*/
AttrIter::operator bool() const
{
return (gobject_ != 0);
}
bool AttrIter::next()
{
if(!pango_attr_iterator_next(gobj()))
{
pango_attr_iterator_destroy(gobject_);
gobject_ = 0; // Mark as invalid. There is no other way to determine whether the iterator is valid later.
return false;
}
else
return true;
}
FontDescription AttrIter::get_font_desc() const
{
FontDescription desc;
pango_attr_iterator_get_font(const_cast<PangoAttrIterator*>(gobj()), desc.gobj(), 0, 0);
// See pango ref docs for pango_attr_iterator_get_font.
pango_font_description_set_family(desc.gobj(), pango_font_description_get_family(desc.gobj()));
return desc;
}
Language AttrIter::get_language() const
{
FontDescription desc;
PangoLanguage* language = 0;
pango_attr_iterator_get_font(const_cast<PangoAttrIterator*>(gobj()), desc.gobj(), &language, 0);
return Language(language, true);
}
SListHandle_Attribute AttrIter::get_extra_attrs() const
{
FontDescription desc;
GSList* extra_attrs = 0;
pango_attr_iterator_get_font(const_cast<PangoAttrIterator*>(gobj()), desc.gobj(), 0, &extra_attrs);
return SListHandle_Attribute(extra_attrs, Glib::OWNERSHIP_DEEP);
}
SListHandle_Attribute AttrIter::get_attrs() const
{
GSList* attrs = pango_attr_iterator_get_attrs( const_cast<PangoAttrIterator*>(gobj()) );
return SListHandle_Attribute(attrs, Glib::OWNERSHIP_DEEP);
}
} /* namespace Pango */
namespace Glib
{
Pango::AttrIter wrap(PangoAttrIterator* object, bool take_copy)
{
return Pango::AttrIter(object, take_copy);
}
} /* namespace Glib */

View file

@ -0,0 +1,114 @@
/* attriter.h
*
* Copyright (C) 1998-1999 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/slisthandle.h>
#include <pangomm/attributes.h>
_DEFS(pangomm,pango)
namespace Pango
{
/** A Pango::AttrIter is used to represent an iterator through a Pango::AttrList.
* A new iterator is created with Pango::AttrList::get_iter(). Once the iterator is created,
* it can be advanced through the style changes in the text using Pango::AttrIter::next().
* At each style change, the range of the current style segment and the attributes currently in effect can be queried.
*/
class AttrIter
{
_CLASS_GENERIC(AttrIter, PangoAttrIterator)
_IGNORE(pango_attr_iterator_copy, pango_attr_iterator_destroy, pango_attr_iterator_next, pango_attr_iterator_get_font)
public:
typedef std::forward_iterator_tag iterator_category;
typedef int difference_type;
protected:
AttrIter();
public:
explicit AttrIter(PangoAttrIterator* castitem, bool take_copy=true);
AttrIter(const AttrIter& src);
~AttrIter();
AttrIter& operator=(const AttrIter& src);
/** Advance the iterator until the next change of style.
* The iterator becomes invalid if the end of the list is reached.
* @return The iterator itself.
*/
AttrIter& operator++();
const AttrIter operator++(int);
/** Check whether the iterator is valid.
* @return <tt>true</tt> if the iterator is valid.
*/
operator bool() const;
/** The same as operator++().
* @return <tt>false</tt> if the end of the list is reached.
*/
bool next();
_WRAP_METHOD(void get_range(int& start, int& end) const, pango_attr_iterator_range)
_WRAP_METHOD(Attribute get_attribute(AttrType type) const, pango_attr_iterator_get)
/** Get the font description used at the current iterator position.
* @return The font description used at the current iterator position.
*/
FontDescription get_font_desc() const;
/** Gets the language tag used at current iterator position.
* @return The language tag or an empty Pango::Language object if non is found.
*/
Language get_language() const;
/** Gets a list of non-font attributes at the the current iterator position.
* Only the highest priority value of each attribute will be added to this list.
* @return The list of non-font attributes at the current iterator position.
*/
SListHandle_Attribute get_extra_attrs() const;
/** Gets a list all attributes a the current position of the
* iterator.
*
* @result A list of all attributes for the current range.
*/
SListHandle_Attribute get_attrs() const;
_IGNORE(pango_attr_iterator_get_attrs)
PangoAttrIterator* gobj() { return gobject_; }
const PangoAttrIterator* gobj() const { return gobject_; }
protected:
PangoAttrIterator* gobject_;
};
} // namespace Pango
namespace Glib
{
/** @relates Pango::AttrIter */
Pango::AttrIter wrap(PangoAttrIterator* object, bool take_copy=false);
} // namespace Glib

View file

@ -0,0 +1,75 @@
// -*- c++ -*-
/* $Id: attrlist.ccg,v 1.3 2005/11/22 15:00:17 murrayc Exp $ */
/*
*
* Copyright 1998-1999 The Gtk-- Development Team
* Copyright 2001 Free Software Foundation
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
namespace Pango
{
AttrList::AttrList(const Glib::ustring& markup_text, gunichar accel_marker)
{
gboolean bTest = pango_parse_markup(markup_text.c_str(), -1 /* means null-terminated */, accel_marker,
&gobject_, 0, 0, 0);
if(bTest == FALSE)
gobject_ = 0;
}
AttrList::operator bool()
{
return gobj() != 0;
}
AttrList::AttrList(const Glib::ustring& markup_text, gunichar accel_marker, Glib::ustring& text, gunichar& accel_char)
{
//initialize output parameters:
text.erase();
accel_char = 0;
gchar* pchText = 0;
gboolean bTest = pango_parse_markup(markup_text.c_str(), -1 /* means null-terminated */, accel_marker,
&gobject_, &pchText, &accel_char, 0);
if(bTest == FALSE)
{
gobject_ = 0;
}
else
{
text = pchText;
g_free(pchText);
}
}
void AttrList::insert(Attribute& attr)
{
pango_attr_list_insert(gobj(), pango_attribute_copy(attr.gobj()));
}
void AttrList::insert_before(Attribute& attr)
{
pango_attr_list_insert_before(gobj(), pango_attribute_copy(attr.gobj()));
}
void AttrList::change(Attribute& attr)
{
pango_attr_list_change(gobj(), pango_attribute_copy(attr.gobj()));
}
} /* namespace Pango */

View file

@ -0,0 +1,89 @@
/* $Id: attrlist.hg,v 1.4 2005/11/22 15:00:17 murrayc Exp $ */
/* attrlist.h
*
* Copyright (C) 1998-1999 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <pangomm/attributes.h>
#include <pangomm/attriter.h>
_DEFS(pangomm,pango)
namespace Pango
{
/** A Pango::AttrList represents a list of attributes that apply to a section of text.
* The attributes are, in general, allowed to overlap in an arbitrary fashion, however,
* if the attributes are manipulated only through Pango::AttrList::change(), the overlap between properties will meet stricter criteria.
*
* Since the Pango::AttrList structure is stored as a linear list, it is not suitable for storing attributes for large amounts of text.
* In general, you should not use a single Pango::AttrList for more than one paragraph of text.
*
* When obtaining an AttrList, you should check that it is valid. For instance, if(attrlist).
*/
class AttrList
{
_CLASS_BOXEDTYPE(AttrList, PangoAttrList, pango_attr_list_new, pango_attr_list_copy, pango_attr_list_unref)
_IGNORE(pango_attr_list_copy, pango_attr_list_ref, pango_attr_list_unref)
public:
/** Constructs an attribute list by parsing a marked-up text (see markup format).
* If @a accel_marker is nonzero, the given character will mark the character
* following it as an accelerator. For example, the accel marker might be an
* ampersand or underscore. All characters marked as an accelerator will receive
* a Pango::UNDERLINE_LOW attribute.
* Two @a accel_marker characters following each other
* produce a single literal @a accel_marker character.
*
* @param markup_text Markup to parse (see markup format).
* @param accel_marker Character that precedes an accelerator, or <tt>0</tt> for none.
*/
explicit AttrList(const Glib::ustring& markup_text, gunichar accel_marker=0);
/** Constructs an attribute list by parsing a marked-up text (see markup format).
* @a text is set to the plaintext string.
* If @a accel_marker is nonzero, the given character will mark the character
* following it as an accelerator. For example, the accel marker might be an
* ampersand or underscore. All characters marked as an accelerator will receive
* a Pango::UNDERLINE_LOW attribute. The first character so marked will be
* returned in @a accel_char. Two @a accel_marker characters following each other
* produce a single literal @a accel_marker character.
*
* @param markup_text Markup to parse (see markup format).
* @param accel_marker Character that precedes an accelerator, or <tt>0</tt> for none.
* @param text Return location for text with tags stripped.
* @param accel_char Return location for accelerator char.
*/
AttrList(const Glib::ustring& markup_text, gunichar accel_marker, Glib::ustring& text, gunichar& accel_char);
///Tests whether the AttrList is valid.
operator bool();
void insert(Attribute& attr);
_IGNORE(pango_attr_list_insert) // hand code because we need to pass a copy of the attribute
void insert_before(Attribute& attr);
_IGNORE(pango_attr_list_insert_before) // hand code because we need to pass a copy of the attribute
void change(Attribute& attr);
_IGNORE(pango_attr_list_change) // hand code because we need to pass a copy of the attribute
_WRAP_METHOD(void splice(AttrList& other, int pos, int len), pango_attr_list_splice)
_WRAP_METHOD(AttrIter get_iter(), pango_attr_list_get_iterator)
//TODO: Though it doesn't seem important:
//PangoAttrList* pango_attr_list_filter (PangoAttrList* list, PangoAttrFilterFunc func, gpointer data)
};
} //namespace Pango

View file

@ -0,0 +1,30 @@
// -*- c++ -*-
/* $Id: cairofontmap.ccg,v 1.1 2006/05/30 17:14:21 murrayc Exp $ */
/*
*
* Copyright 2001 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <pangomm/context.h>
#include <pango/pangocairo.h>
namespace Pango
{
} /* namespace Pango */

View file

@ -0,0 +1,56 @@
/* $Id: cairofontmap.hg,v 1.1 2006/05/30 17:14:21 murrayc Exp $ */
/* fontmap.h
*
* Copyright 2001 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/interface.h>
#include <pangomm/context.h>
#include <pango/pangocairo.h>
_DEFS(pangomm,pango)
_PINCLUDE(glibmm/private/interface_p.h)
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _PangoCairoFontMapIface PangoCairoFontMapIface;
#endif //DOXYGEN_SHOULD_SKIP_THIS
namespace Pango
{
class Context;
/** A Pango::CairoFontMap represents the set of fonts available for a particular rendering system.
*/
class CairoFontMap : public Glib::Interface
{
_CLASS_INTERFACE(CairoFontMap, PangoCairoFontMap, PANGO_CAIRO_FONT_MAP, PangoCairoFontMapIface)
public:
//_WRAP_METHOD(static Glib::RefPtr<PangoFontMap> get_default(), pango_cairo_font_map_get_default) //TODO: ref this?
#m4 _CONVERSION(`cairo_font_type_t',`Cairo::FontType',`static_cast<Cairo::FontType>($3)')
_WRAP_METHOD(Cairo::FontType get_font_type() const, pango_cairo_font_map_get_font_type)
_WRAP_METHOD(void set_resolution(double dpi), pango_cairo_font_map_set_resolution)
_WRAP_METHOD(double get_resolution() const, pango_cairo_font_map_get_resolution)
_WRAP_METHOD(Glib::RefPtr<Context> create_context(), pango_cairo_font_map_create_context)
};
} /* namespace Pango */

View file

@ -0,0 +1,33 @@
/* Copyright (C) 2002 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
namespace Pango
{
/* For some unknown reason pango doesn't provide pango_color_new(). Let's define an
* equivalent function ourself! */
PangoColor* _pango_color_new()
{
return g_new(PangoColor, 1);
}
Color::operator bool()
{
return gobj() != 0;
}
} /* namespace Pango */

View file

@ -0,0 +1,72 @@
/* Copyright (C) 2002 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <pango/pango-attributes.h>
_DEFS(pangomm,pango)
namespace Pango
{
/** A Pango::Color is used to represent a color in an uncalibrated RGB colorspace.
*/
class Color
{
_CLASS_BOXEDTYPE_STATIC(Color, PangoColor, _pango_color_new, pango_color_copy, pango_color_free)
_IGNORE(pango_color_copy, pango_color_free)
public:
/// Tests whether the Color is valid.
operator bool();
/** Gets the red component of the color.
* @return The red component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity.
*/
_MEMBER_GET(red, red, guint16, guint16)
/** Gets the green component of the color.
* @return The green component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity.
*/
_MEMBER_GET(green, green, guint16, guint16)
/** Gets the blue component of the color.
* @return The blue component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity.
*/
_MEMBER_GET(blue, blue, guint16, guint16)
/** Sets the red component of the color.
* @param value The red component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity.
*/
_MEMBER_SET(red, red, guint16, guint16)
/** Sets the green component of the color.
* @param value The green component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity.
*/
_MEMBER_SET(green, green, guint16, guint16)
/** Sets the blue component of the color.
* @param value The blue component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity.
*/
_MEMBER_SET(blue, blue, guint16, guint16)
_WRAP_METHOD(bool parse(const Glib::ustring& spec), pango_color_parse)
_WRAP_METHOD(Glib::ustring to_string() const, pango_color_to_string)
};
} /* namespace Pango */

View file

@ -0,0 +1,83 @@
// -*- c++ -*-
/* $Id: context.ccg,v 1.3 2006/06/10 15:26:24 murrayc Exp $ */
/*
*
* Copyright 1998-1999 The Gtk-- Development Team
* Copyright 2001 Free Software Foundation
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <pango/pangocairo.h>
#include <pango/pango-types.h> //For PANGO_MATRIX_INIT
namespace Pango
{
Glib::ArrayHandle< Glib::RefPtr<FontFamily> > Context::list_families() const
{
//Get array:
PangoFontFamily** pFamilies = 0;
int n_families = 0;
pango_context_list_families(const_cast<PangoContext*>(gobj()), &pFamilies, &n_families);
return Glib::ArrayHandle< Glib::RefPtr<FontFamily> >
(pFamilies, n_families, Glib::OWNERSHIP_SHALLOW);
}
Pango::FontMetrics Context::get_metrics(const FontDescription& desc) const
{
return FontMetrics(pango_context_get_metrics(const_cast<PangoContext*>(gobj()), desc.gobj(), 0));
}
ListHandle_Item Context::itemize(const Glib::ustring& text, const AttrList& attrs) const
{
return ListHandle_Item(
pango_itemize(const_cast<PangoContext*>(gobj()),
text.c_str(), 0, text.bytes(),
const_cast<PangoAttrList*>(attrs.gobj()), 0),
Glib::OWNERSHIP_DEEP);
}
ListHandle_Item Context::itemize(const Glib::ustring& text, int start_index, int length,
const AttrList& attrs, AttrIter& cached_iter) const
{
return ListHandle_Item(
pango_itemize(const_cast<PangoContext*>(gobj()),
text.c_str(), start_index, length,
const_cast<PangoAttrList*>(attrs.gobj()), cached_iter.gobj()),
Glib::OWNERSHIP_DEEP);
}
void Context::update_from_cairo_context(const Cairo::RefPtr<Cairo::Context>& context)
{
pango_cairo_update_context(context->cobj(), gobj());
}
Matrix Context::get_matrix() const
{
const PangoMatrix* matrix = pango_context_get_matrix(const_cast<PangoContext*>(gobj()));
if(matrix)
return *matrix;
else
{
PangoMatrix identity_transform = PANGO_MATRIX_INIT;
return identity_transform;
}
}
} /* namespace Pango */

View file

@ -0,0 +1,173 @@
/* $Id: context.hg,v 1.7 2006/06/10 15:26:24 murrayc Exp $ */
/* context.h
*
* Copyright (C) 1998-1999 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/object.h>
#include <glibmm/arrayhandle.h>
#include <glibmm/listhandle.h>
#include <pangomm/fontdescription.h>
#include <pangomm/fontmetrics.h>
#include <pangomm/fontset.h>
#include <pangomm/fontmap.h>
#include <pangomm/item.h>
#include <pangomm/attrlist.h>
#include <pangomm/types.h> //For Matrix
#include <pango/pango-context.h>
#include <cairomm/context.h>
#include <cairomm/fontoptions.h>
_DEFS(pangomm,pango)
_PINCLUDE(glibmm/private/object_p.h)
namespace Pango
{
_CC_INCLUDE(pango/pango-enum-types.h)
_WRAP_ENUM(Direction, PangoDirection)
_WRAP_ENUM(GravityHint, PangoGravityHint)
/** A Pango::Context stores global information used to control the itemization process.
* You can retrieve a Pango::Context object with Gtk::Widget::create_pango_context() or
* Gtk::Widget::get_pango_context(). If you don't use gtkmm call some c function of the
* pango backend you intend to use and create a wrapper for the returned context,
* e.g. Glib::wrap(pango_x_get_context()).
*
* Creating a Pango::Context object is the starting point of every rendering process.
* You can either use it to create a high level Pango::Layout object which does all
* the hard work for you by passing it into
* Pango::Layout::create() or to generate glyph strings from character strings with
* the help of itemize() and Pango::Item::shape() subsequently.
*
* Which fonts are used for rendering can be influenced by setting the default
* font description, language and base direction of the context.
*
* If you want to calculate the space some text will need to be displayed you
* might find the functions of Pango::FontMetrics useful. Use get_metrics() to
* obtain the Pango::FontMetrics object for a specific Pango::FontDescription.
* For more detailed calculations in a rendering-system-independant manner
* and to determine whether specific characters can be represented by the
* font that would be used for a specific Pango::FontDescription load a
* Pango::Fontset with load_fontset() (load_font() returns the Pango::Font
* that is the closest match for a Pango::FontDescription; however that's not
* necessarily the font that will be used for rendering).
*/
class Context : public Glib::Object
{
_CLASS_GOBJECT(Context, PangoContext, PANGO_CONTEXT, Glib::Object, GObject)
_IGNORE(pango_context_new, pango_context_set_font_map) //PANGO_ENABLE_BACKEND
_IGNORE(pango_context_list_families)
protected:
_CTOR_DEFAULT
public:
/** List all available font families for a context.
* You can specify one of these as your desired font family in the Pango::FontDesciption
* objects you use, e.g. in the default font description of the context.
* @return An array of Pango::FontFamily objects.
*/
Glib::ArrayHandle< Glib::RefPtr<FontFamily> > list_families() const;
_WRAP_METHOD(Glib::RefPtr<FontMap> get_font_map(), pango_context_get_font_map)
_WRAP_METHOD(Glib::RefPtr<const FontMap> get_font_map() const, pango_context_get_font_map)
_WRAP_METHOD(Glib::RefPtr<Font> load_font(const FontDescription& desc) const, pango_context_load_font)
_WRAP_METHOD(Glib::RefPtr<Fontset> load_fontset(const FontDescription& desc, const Language& language) const, pango_context_load_fontset)
/** Get overall metric information for a particular font description.
* The metrics may be substantially different for different scripts. However this
* function overload returns the metrics of the entire font.
* @param desc A Pango::FontDescription object.
* @return A Pango::FontMetrics object.
*/
FontMetrics get_metrics(const FontDescription& desc) const;
_WRAP_METHOD(FontMetrics get_metrics(const FontDescription& desc, const Language& language) const, pango_context_get_metrics)
_WRAP_METHOD(void set_font_description(const FontDescription& desc), pango_context_set_font_description)
_WRAP_METHOD(FontDescription get_font_description() const, pango_context_get_font_description)
_WRAP_METHOD(Language get_language() const, pango_context_get_language)
_WRAP_METHOD(void set_language(const Language& language), pango_context_set_language)
_WRAP_METHOD(void set_base_dir(Direction direction), pango_context_set_base_dir)
_WRAP_METHOD(Direction get_base_dir() const, pango_context_get_base_dir)
_WRAP_METHOD(void set_base_gravity(Gravity gravity), pango_context_set_base_gravity)
_WRAP_METHOD(Gravity get_base_gravity() const, pango_context_get_base_gravity)
_WRAP_METHOD(Gravity get_gravity() const, pango_context_get_gravity)
_WRAP_METHOD(void set_gravity_hint(GravityHint hint), pango_context_set_gravity_hint)
_WRAP_METHOD(GravityHint get_gravity_hint() const, pango_context_get_gravity_hint)
_WRAP_METHOD(void set_matrix(const Matrix& matrix), pango_context_set_matrix)
Matrix get_matrix() const;
_IGNORE(pango_context_get_matrix)
/** Breaks a piece of text into segments with consistent directional level and shaping engine.
* Each byte of @a text will be contained in exactly one of the items in the returned list.
* The generated list of items will be in logical order (the start offsets of the items
* are ascending).
* @param text The text to itemize.
* @param attrs The set of attributes that apply.
* @return A list of Pango::Item objects.
*/
ListHandle_Item itemize(const Glib::ustring& text, const AttrList& attrs) const;
/** Breaks a piece of text into segments with consistent directional level and shaping engine.
* Each byte of @a text will be contained in exactly one of the items in the returned list.
* The generated list of items will be in logical order (the start offsets of the items
* are ascending).
*
* @a cached_iter should be an iterator over @a attrs currently positioned at a range before
* or containing @a start_index. @a cached_iter will be advanced to the range covering the
* position just after @a start_index + @a length. (i.e. if itemizing in a loop, just keep
* passing in the same @a cached_iter).
*
* @param text The text to itemize.
* @param start_index First byte in @a text to process.
* @param length The number of bytes (not characters) to process after @a start_index. This must be >= <tt>0</tt>.
* @param attrs The set of attributes that apply to @a text.
* @param cached_iter Cached attribute iterator.
* @return A list of Pango::Item structures.
*/
ListHandle_Item itemize(const Glib::ustring& text, int start_index, int length,
const AttrList& attrs, AttrIter& cached_iter) const;
/** Updates a Pango Context previously created for use with Cairo to
* match the current transformation and target surface of a Cairo
* Context. If any layouts have been created for the context,
* it's necessary to call Pango::Layout::context_changed() on those
* layouts.
*
* @param context A Cairo context, from CairoFontMap::create_context().
*/
void update_from_cairo_context(const Cairo::RefPtr<Cairo::Context>& context);
_WRAP_METHOD(void set_cairo_font_options(const Cairo::FontOptions& options), pango_cairo_context_set_font_options)
#m4 _CONVERSION(`const cairo_font_options_t*',`Cairo::FontOptions',`Cairo::FontOptions(const_cast< cairo_font_options_t*>($3), false /* take_copy */)')
_WRAP_METHOD(Cairo::FontOptions get_font_options() const, pango_cairo_context_get_font_options)
_WRAP_METHOD(void set_resolution(double dpi), pango_cairo_context_set_resolution)
_WRAP_METHOD(double get_resolution() const, pango_cairo_context_get_resolution)
};
} /* namespace Pango */

View file

@ -0,0 +1,35 @@
// -*- c++ -*-
/* $Id: coverage.ccg,v 1.1 2003/01/21 13:41:02 murrayc Exp $ */
/*
*
* Copyright 1998-1999 The Gtk-- Development Team
* Copyright 2001 Free Software Foundation
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
namespace Pango
{
Glib::ArrayHandle<unsigned char> Coverage::to_bytes() const
{
guchar* bytes = 0;
int n_bytes = 0;
pango_coverage_to_bytes(const_cast<PangoCoverage*>(gobj()), &bytes, &n_bytes);
return Glib::ArrayHandle<unsigned char>(bytes, n_bytes, Glib::OWNERSHIP_SHALLOW);
}
} /* namespace Pango */

View file

@ -0,0 +1,60 @@
/* $Id: coverage.hg,v 1.1 2003/01/21 13:41:03 murrayc Exp $ */
/* coverage.h
*
* Copyright (C) 1998-1999 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/arrayhandle.h>
#include <pango/pango-font.h>
_DEFS(pangomm,pango)
namespace Pango
{
_CC_INCLUDE(pango/pango-enum-types.h)
_WRAP_ENUM(CoverageLevel, PangoCoverageLevel)
/** A Pango::Coverage represents a map from ISO-10646 character point to Pango::CoverageLevel.
* It is often necessary in pango to determine if a particular font can represent a particular character,
* and also how well it can represent that character. Pango::Coverage holds this information.
*/
class Coverage
{
_CLASS_OPAQUE_REFCOUNTED(Coverage, PangoCoverage, pango_coverage_new, pango_coverage_ref, pango_coverage_unref)
_IGNORE(pango_coverage_ref, pango_coverage_unref)
_IGNORE(pango_coverage_copy) //pango ref doc: "This function may now be unecessary since we refcount the structure. Mail otaylor redhat.com if you use it."
_IGNORE(pango_coverage_to_bytes)
public:
_WRAP_METHOD(static Glib::RefPtr<Coverage> create(const guchar* bytes, int n_bytes), pango_coverage_from_bytes)
//_WRAP_METHOD(Glib::RefPtr<Coverage> copy() const, pango_coverage_copy) //see above
_WRAP_METHOD(CoverageLevel get(int index) const, pango_coverage_get)
_WRAP_METHOD(void set(int index, CoverageLevel level), pango_coverage_set)
_WRAP_METHOD(void max(const Glib::RefPtr<Coverage>& other) const, pango_coverage_max)
/** Convert the coverage map into a flat binary format.
* @return An array of bytes representing the coverage map.
*/
Glib::ArrayHandle<unsigned char> to_bytes() const;
};
} // namespace Pango

View file

@ -0,0 +1,50 @@
// -*- c++ -*-
/* $Id: font.ccg,v 1.2 2006/06/08 20:39:39 murrayc Exp $ */
/*
*
* Copyright 1998-1999 The Gtk-- Development Team
* Copyright 2001 Free Software Foundation
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <pangomm/fontmap.h>
namespace Pango
{
FontMetrics Font::get_metrics() const
{
return FontMetrics(pango_font_get_metrics(const_cast<PangoFont*>(gobj()), 0));
}
Rectangle Font::get_glyph_ink_extents(Glyph glyph) const
{
Rectangle ink_rect;
pango_font_get_glyph_extents(const_cast<PangoFont*>(gobj()), glyph, ink_rect.gobj(), 0);
return ink_rect;
}
Rectangle Font::get_glyph_logical_extents(Glyph glyph) const
{
Rectangle logical_rect;
pango_font_get_glyph_extents(const_cast<PangoFont*>(gobj()), glyph, 0, logical_rect.gobj());
return logical_rect;
}
} /* namespace Pango */

View file

@ -0,0 +1,89 @@
/* $Id: font.hg,v 1.2 2006/06/08 20:39:39 murrayc Exp $ */
/* font.h
*
* Copyright (C) 1998-1999 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/object.h>
#include <pangomm/rectangle.h>
#include <pangomm/language.h>
#include <pangomm/glyph.h>
#include <pangomm/fontdescription.h>
#include <pangomm/fontmetrics.h>
#include <pangomm/coverage.h>
#include <pango/pango-font.h>
_DEFS(pangomm,pango)
_PINCLUDE(glibmm/private/object_p.h)
namespace Pango
{
const int SCALE = 1024;
const double SCALE_XX_SMALL = 0.5787037037037;
const double SCALE_X_SMALL = 0.6444444444444;
const double SCALE_SMALL = 0.8333333333333;
const double SCALE_MEDIUM = 1.0;
const double SCALE_LARGE = 1.2;
const double SCALE_X_LARGE = 1.4399999999999;
const double SCALE_XX_LARGE = 1.728;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
class FontMap;
#endif //DOXYGEN_SHOULD_SKIP_THIS
/** A Pango::Font is used to represent a font in a rendering-system-independent matter.
*/
class Font : public Glib::Object
{
_CLASS_GOBJECT(Font, PangoFont, PANGO_FONT, Glib::Object, GObject)
_IGNORE(pango_font_find_shaper) //This would return a PangoEngineShape* but the definition of the struct is surrounded by #define PANGO_ENABLE_BACKEND [...] #endif. So don't wrap it.
public:
_WRAP_METHOD(FontDescription describe() const, pango_font_describe)
_WRAP_METHOD(FontDescription describe_with_absolute_size() const, pango_font_describe_with_absolute_size)
_WRAP_METHOD(Glib::RefPtr<Coverage> get_coverage(const Language& language) const, pango_font_get_coverage)
/** Gets overall metric information for a font.
* The metrics may be substantially different for different scripts.
* However, this function overload returns the metrics for the entire font.
*/
FontMetrics get_metrics() const;
_WRAP_METHOD(FontMetrics get_metrics(const Language& language) const, pango_font_get_metrics)
_WRAP_METHOD(void get_glyph_extents(Glyph glyph, Rectangle& ink_rect, Rectangle& logical_rect) const, pango_font_get_glyph_extents)
_WRAP_METHOD(Glib::RefPtr<FontMap> get_font_map(), pango_font_get_font_map)
_WRAP_METHOD(Glib::RefPtr<const FontMap> get_font_map() const, pango_font_get_font_map, constversion)
/** Get the ink extents of a glyph within the font.
* @param glyph The glyph index.
* @return The extents of the glyph as drawn.
*/
Rectangle get_glyph_ink_extents(Glyph glyph) const;
/** Gets the logical extents of a glyph within the font.
* @param glyph The glyph index.
* @return The logical extents of the glyph.
*/
Rectangle get_glyph_logical_extents(Glyph glyph) const;
};
} /* namespace Pango */

View file

@ -0,0 +1,35 @@
// -*- c++ -*-
/* $Id: fontdescription.ccg,v 1.1 2003/01/21 13:41:03 murrayc Exp $ */
/*
*
* Copyright 1998-2002 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/utility.h>
namespace Pango
{
FontDescription::FontDescription(const Glib::ustring& font_name)
{
gobject_ = pango_font_description_from_string(font_name.c_str());
}
} // namespace Pango

View file

@ -0,0 +1,100 @@
/* $Id: fontdescription.hg,v 1.2 2006/06/08 20:39:39 murrayc Exp $ */
/* fontdescription.h
*
* Copyright (C) 1998-2002 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <pango/pango-font.h>
_DEFS(pangomm,pango)
namespace Pango
{
_CC_INCLUDE(pango/pango-enum-types.h)
_WRAP_ENUM(Style, PangoStyle)
_WRAP_ENUM(Variant, PangoVariant)
_WRAP_ENUM(Stretch, PangoStretch)
_WRAP_ENUM(Weight, PangoWeight)
_WRAP_ENUM(FontMask, PangoFontMask)
_WRAP_ENUM(Gravity, PangoGravity)
/** A Pango::FontDescription represents the description of an ideal font.
* It is used both to list what fonts are available on the system and also for specifying the characteristics of a font to load.
*/
class FontDescription
{
_CLASS_BOXEDTYPE(FontDescription, PangoFontDescription, pango_font_description_new, pango_font_description_copy, pango_font_description_free)
_IGNORE(pango_font_description_free, pango_font_description_copy, pango_font_description_copy_static, pango_font_description_equal)
/* These functions are dangerous! The first casts the "const" from the parameter away
* copying the pointer and keep it hanging around.
* So desc.set_family_static("some_family") would lead to a segfault.
* The latter makes a shallow copy of the parameter's "family" data member.
* So if the FontDescription you passed in dies, a pointer to its (deleted)
* family data member still hangs around!
* This is why we can't wrap these functions!
*/
_IGNORE(pango_font_description_set_family_static, pango_font_description_merge_static)
public:
/** Constructs a font description from a string representation.
* @a font_name must have the form
* "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]", where FAMILY-LIST is a comma separated
* list of families optionally terminated by a comma, STYLE_OPTIONS is a whitespace
* separated list of words where each WORD describes one of style, variant, weight,
* or stretch, and SIZE is an decimal number (size in points). Any one of the
* options may be absent. If FAMILY-LIST is absent, then the family_name field
* of the resulting font description will be initialized to 0. If STYLE-OPTIONS
* is missing, then all style options will be set to the default values. If SIZE
* is missing, the size in the resulting font description will be set to 0.
* @param font_name String representation of a font description.
*/
explicit FontDescription(const Glib::ustring& font_name);
_WRAP_METHOD(guint hash() const, pango_font_description_hash)
_WRAP_METHOD(void set_family(const Glib::ustring& family), pango_font_description_set_family)
_WRAP_METHOD(Glib::ustring get_family() const, pango_font_description_get_family)
_WRAP_METHOD(void set_style(Style style), pango_font_description_set_style)
_WRAP_METHOD(Style get_style() const, pango_font_description_get_style)
_WRAP_METHOD(void set_variant(Variant variant),pango_font_description_set_variant)
_WRAP_METHOD(Variant get_variant() const, pango_font_description_get_variant)
_WRAP_METHOD(void set_weight(Weight weight), pango_font_description_set_weight)
_WRAP_METHOD(Weight get_weight() const, pango_font_description_get_weight)
_WRAP_METHOD(void set_stretch(Stretch stretch), pango_font_description_set_stretch)
_WRAP_METHOD(Stretch get_stretch() const, pango_font_description_get_stretch)
_WRAP_METHOD(void set_size(int size), pango_font_description_set_size)
_WRAP_METHOD(int get_size() const, pango_font_description_get_size)
_WRAP_METHOD(void set_absolute_size(double size), pango_font_description_set_absolute_size)
_WRAP_METHOD(bool get_size_is_absolute() const, pango_font_description_get_size_is_absolute)
_WRAP_METHOD(void set_gravity(Gravity gravity), pango_font_description_set_gravity)
_WRAP_METHOD(Gravity get_gravity() const, pango_font_description_get_gravity)
_WRAP_METHOD(FontMask get_set_fields() const, pango_font_description_get_set_fields)
_WRAP_METHOD(void unset_fields(FontMask to_unset), pango_font_description_unset_fields)
_WRAP_METHOD(void merge(const FontDescription& desc_to_merge, bool replace_existing), pango_font_description_merge)
_WRAP_METHOD(bool better_match(const FontDescription& old_match, const FontDescription& new_match) const, pango_font_description_better_match)
_WRAP_METHOD(Glib::ustring to_string() const, pango_font_description_to_string)
_WRAP_METHOD(Glib::ustring to_filename() const, pango_font_description_to_filename)
#m4begin
_WRAP_EQUAL(pango_font_description_equal)
#m4end
};
} //namespace Pango

View file

@ -0,0 +1,38 @@
// -*- c++ -*-
/* $Id: fontface.ccg,v 1.2 2004/03/03 01:07:40 murrayc Exp $ */
/*
*
* Copyright 1998-2002 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
namespace Pango
{
Glib::ArrayHandle<int> FontFace::list_sizes() const
{
int* sizes = 0;
int n_sizes = 0;
pango_font_face_list_sizes(const_cast<PangoFontFace*>(gobj()), &sizes, &n_sizes);
return Glib::ArrayHandle<int>(sizes, n_sizes, Glib::OWNERSHIP_SHALLOW); //The ArrayHandle will free the array.
}
} //namespace Pango

View file

@ -0,0 +1,60 @@
/* $Id: fontface.hg,v 1.3 2004/03/03 01:07:40 murrayc Exp $ */
/* fontface.h
*
* Copyright 2001 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/object.h>
#include <pangomm/fontdescription.h>
#include <pango/pango-font.h>
_DEFS(pangomm,pango)
_PINCLUDE(glibmm/private/object_p.h)
namespace Pango
{
/** A Pango::FontFace is used to represent a group of fonts with the same family, slant, weight, width, but varying sizes.
*/
class FontFace : public Glib::Object
{
_CLASS_GOBJECT(FontFace, PangoFontFace, PANGO_FONT_FACE, Glib::Object, GObject)
public:
_WRAP_METHOD(FontDescription describe() const, pango_font_face_describe)
_WRAP_METHOD(Glib::ustring get_name() const, pango_font_face_get_face_name)
/** List the available sizes for a font. This is only applicable to bitmap fonts.
* For scalable fonts this returns an empty array.
* The sizes returned are in Pango units and are sorted in ascending order.
*/
Glib::ArrayHandle<int> list_sizes() const;
_IGNORE(pango_font_face_list_sizes)
_WRAP_METHOD(bool is_synthesized() const, pango_font_face_is_synthesized)
protected:
//We can't wrap the virtual functions because PangoFontFace has a hidden class.
//We probably don't need to subclass this anyway.
//_WRAP_VFUNC(const char* get_name() const, "get_face_name")
//_WRAP_VFUNC(PangoFontDescription* describe(), "describe")
};
} /* namespace Pango */

View file

@ -0,0 +1,38 @@
// -*- c++ -*-
/* $Id: fontfamily.ccg,v 1.1 2003/01/21 13:41:03 murrayc Exp $ */
/*
*
* Copyright 2001 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
namespace Pango
{
Glib::ArrayHandle< Glib::RefPtr<FontFace> > FontFamily::list_faces() const
{
//Get the array:
PangoFontFace** pFontFaces = 0;
int n_fonts = 0;
pango_font_family_list_faces(const_cast<PangoFontFamily*>(gobj()), &pFontFaces, &n_fonts);
return Glib::ArrayHandle<Glib::RefPtr <FontFace> > (pFontFaces, n_fonts, Glib::OWNERSHIP_SHALLOW);
}
} /* namespace Pango */

View file

@ -0,0 +1,68 @@
/* $Id: fontfamily.hg,v 1.2 2004/03/03 01:07:40 murrayc Exp $ */
/* fontfamily.h
*
* Copyright 2001 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/object.h>
#include <glibmm/arrayhandle.h>
#include <pangomm/fontface.h>
#include <pango/pango-font.h>
_DEFS(pangomm,pango)
_PINCLUDE(glibmm/private/object_p.h)
namespace Pango
{
/** A Pango::FontFamily is used to represent a family of related font faces.
* The faces in a family share a common design, but differ in slant, weight, width and other aspects.
*/
class FontFamily : public Glib::Object
{
_CLASS_GOBJECT(FontFamily, PangoFontFamily, PANGO_FONT_FAMILY, Glib::Object, GObject)
_IGNORE(pango_font_family_list_faces)
public:
/** Lists the different font faces that make up family.
* The faces in a family share a common design, but differ in slant, weight, width and other aspects.
* @return an array of pointers to Pango::FontFace objects.
*/
Glib::ArrayHandle< Glib::RefPtr<FontFace> > list_faces() const;
_WRAP_METHOD(Glib::ustring get_name() const, pango_font_family_get_name)
_WRAP_METHOD(bool is_monospace() const, pango_font_family_is_monospace)
};
/*
struct FontFamilyRefPtrTraits
{
typedef Glib::RefPtr<FontFamily> CppType;
typedef PangoFontFamily * CType;
typedef PangoFontFamily * CTypeNonConst;
static CType to_c_type (const CppType& ptr) { return Glib::unwrap (ptr); }
static CType to_c_type (CType ptr) { return ptr; }
static CppType to_cpp_type (CType ptr) { return FontFamily::wrap_specific_type (ptr); }
static void release_c_type (CType ptr) { g_object_unref (ptr); }
};
*/
} // namespace Pango

View file

@ -0,0 +1,41 @@
// -*- c++ -*-
/* $Id: fontmap.ccg,v 1.2 2004/03/03 01:07:40 murrayc Exp $ */
/*
*
* Copyright 2001 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <pangomm/context.h>
#include <pango/pango-fontmap.h>
namespace Pango
{
Glib::ArrayHandle< Glib::RefPtr<FontFamily> > FontMap::list_families() const
{
//Get the array:
PangoFontFamily** pFamilies = 0;
int n_families = 0;
pango_font_map_list_families(const_cast<PangoFontMap*>(gobj()), &pFamilies, &n_families);
return Glib::ArrayHandle< Glib::RefPtr<FontFamily> >
(pFamilies, n_families, Glib::OWNERSHIP_SHALLOW);
}
} /* namespace Pango */

View file

@ -0,0 +1,59 @@
/* $Id: fontmap.hg,v 1.2 2004/03/03 01:07:40 murrayc Exp $ */
/* fontmap.h
*
* Copyright 2001 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/object.h>
#include <glibmm/arrayhandle.h>
#include <pangomm/font.h>
#include <pangomm/fontset.h>
#include <pangomm/fontfamily.h>
#include <pango/pango-fontmap.h>
_DEFS(pangomm,pango)
_PINCLUDE(glibmm/private/object_p.h)
namespace Pango
{
class Context;
/** A Pango::FontMap represents the set of fonts available for a particular rendering system.
*/
class FontMap : public Glib::Object
{
_CLASS_GOBJECT(FontMap, PangoFontMap, PANGO_FONT_MAP, Glib::Object, GObject)
_IGNORE(pango_font_map_list_families)
public:
_WRAP_METHOD(Glib::RefPtr<Font> load_font(const Glib::RefPtr<Context>& context, const FontDescription& desc) const, pango_font_map_load_font)
_WRAP_METHOD(Glib::RefPtr<Fontset> load_fontset(const Glib::RefPtr<Context>& context, const FontDescription& desc, const Language& language) const, pango_font_map_load_fontset)
/** List all families for the fontmap.
* @return an array of pointers to Pango::FontFamily objects.
*/
Glib::ArrayHandle< Glib::RefPtr<FontFamily> > list_families() const;
//This is not used unless ENABLE_BACKEND is defined: _WRAP_METHOD(Glib::ustring get_shape_engine_type() const, pango_font_map_get_shape_engine_type)
_IGNORE(pango_font_map_get_shape_engine_type)
};
} /* namespace Pango */

View file

@ -0,0 +1,22 @@
// -*- c++ -*-
/* $Id: fontmetrics.ccg,v 1.1 2003/01/21 13:41:04 murrayc Exp $ */
/*
*
* Copyright 1998-1999 The Gtk-- Development Team
* Copyright 2001 Free Software Foundation
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

View file

@ -0,0 +1,48 @@
/* $Id: fontmetrics.hg,v 1.2 2004/12/01 11:46:29 murrayc Exp $ */
/* fontmetrics.h
*
* Copyright (C) 1998-1999 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <pango/pango-font.h>
_DEFS(pangomm,pango)
namespace Pango
{
/** A Pango::FontMetrics holds the overall metric information for a font (possibly restricted to a script).
*/
class FontMetrics
{
_CLASS_BOXEDTYPE(FontMetrics, PangoFontMetrics, NONE, pango_font_metrics_ref, pango_font_metrics_unref)
_IGNORE(pango_font_metrics_unref, pango_font_metrics_ref)
public:
_WRAP_METHOD(int get_ascent() const, pango_font_metrics_get_ascent)
_WRAP_METHOD(int get_descent() const, pango_font_metrics_get_descent)
_WRAP_METHOD(int get_approximate_char_width() const, pango_font_metrics_get_approximate_char_width)
_WRAP_METHOD(int get_approximate_digit_width() const, pango_font_metrics_get_approximate_digit_width)
_WRAP_METHOD(int get_underline_position() const, pango_font_metrics_get_underline_position)
_WRAP_METHOD(int get_underline_thickness() const, pango_font_metrics_get_underline_thickness)
_WRAP_METHOD(int get_strikethrough_position() const, pango_font_metrics_get_strikethrough_position)
_WRAP_METHOD(int get_strikethrough_thickness() const, pango_font_metrics_get_strikethrough_thickness)
};
} //namespace Pango

View file

@ -0,0 +1,53 @@
// -*- c++ -*-
/* $Id: fontset.ccg,v 1.5 2006/05/11 11:40:24 murrayc Exp $ */
/*
*
* Copyright 2001 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
static gboolean fontset_foreach_callback(PangoFontset* /* fontset */, PangoFont* font, gpointer data)
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
#endif //GLIBMM_EXCEPTIONS_ENABLED
Pango::Fontset::ForeachSlot& slot = *static_cast<Pango::Fontset::ForeachSlot*>(data);
Glib::RefPtr<Pango::Font> cppFont = Glib::wrap(font, true /* take_copy */);
return slot(cppFont);
#ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(...)
{
Glib::exception_handlers_invoke();
}
return false; //arbitrary default
#endif //GLIBMM_EXCEPTIONS_ENABLED
}
namespace Pango
{
void Fontset::foreach(const ForeachSlot& slot)
{
pango_fontset_foreach(gobj(), &fontset_foreach_callback, (void*)&slot);
}
} //namespace

View file

@ -0,0 +1,60 @@
/* $Id: fontset.hg,v 1.3 2005/11/30 14:10:50 murrayc Exp $ */
/* fontset.h
*
* Copyright 2001 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/object.h>
#include <pangomm/language.h>
#include <pangomm/font.h>
#include <pangomm/fontmetrics.h>
#include <pango/pango-fontset.h>
_DEFS(pangomm,pango)
_PINCLUDE(glibmm/private/object_p.h)
namespace Pango
{
/** A Pango::Fontset is used to represent a set of fonts.
*/
class Fontset : public Glib::Object
{
_CLASS_GOBJECT(Fontset, PangoFontset, PANGO_FONTSET, Glib::Object, GObject)
public:
_WRAP_METHOD(Glib::RefPtr<Font> get_font(guint wc) const, pango_fontset_get_font)
_WRAP_METHOD(FontMetrics get_metrics() const, pango_fontset_get_metrics)
/** For instance,
* bool on_foreach(const Glib::RefPtr<Pango::Font>& font);
*/
typedef sigc::slot< bool, const Glib::RefPtr<Font>& > ForeachSlot;
/** Iterates through all the fonts in a fontset, calling @a slot for
* each one. If @a slot returns true, that stops the iteration.
*
* @since-1.4
*
* @param slot Callback function
*/
void foreach(const ForeachSlot& slot);
_IGNORE(pango_fontset_foreach)
};
} /* namespace Pango */

View file

@ -0,0 +1,87 @@
/*
* Copyright 2001 Free Software Foundation
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
namespace Pango
{
GlyphInfo::GlyphInfo()
{
gobject_.glyph = 0;
}
GlyphGeometry::GlyphGeometry()
{
gobject_.width = gobject_.x_offset = gobject_.y_offset = 0;
}
GlyphGeometry::GlyphGeometry(const PangoGlyphGeometry* src)
{
gobject_.width = src->width;
gobject_.x_offset = src->x_offset;
gobject_.y_offset = src->y_offset;
}
/*GlyphVisAttr::GlyphVisAttr()
{
gobject_.is_cluster_start = 0;
}
GlyphVisAttr::GlyphVisAttr(const PangoGlyphVisAttr* src)
{
gobject_.is_cluster_start = src->is_cluster_start;
}*/
} //namespace Pango
namespace Glib
{
Pango::GlyphInfo& wrap(PangoGlyphInfo* object)
{
return *reinterpret_cast<Pango::GlyphInfo*>(object);
}
const Pango::GlyphInfo& wrap(const PangoGlyphInfo* object)
{
return *reinterpret_cast<const Pango::GlyphInfo*>(object);
}
Pango::GlyphGeometry& wrap(PangoGlyphGeometry* object)
{
return *reinterpret_cast<Pango::GlyphGeometry*>(object);
}
const Pango::GlyphGeometry& wrap(const PangoGlyphGeometry* object)
{
return *reinterpret_cast<const Pango::GlyphGeometry*>(object);
}
/*Pango::GlyphVisAttr& wrap(PangoGlyphVisAttr* object)
{
return *reinterpret_cast<Pango::GlyphVisAttr*>(object);
}
const Pango::GlyphVisAttr& wrap(const PangoGlyphVisAttr* object)
{
return *reinterpret_cast<const Pango::GlyphVisAttr*>(object);
}*/
} //namespace Glib

View file

@ -0,0 +1,195 @@
/* glyph.h
*
* Copyright (C) 1998-1999 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <pango/pango-glyph.h>
_DEFS(pangomm,pango)
namespace Pango
{
class GlyphInfo;
class GlyphGeometry;
/** A Pango::Glyph represents a single glyph in the output form of a string.
*/
typedef PangoGlyph Glyph; //This is defined as a guint32
/** A Pango::GlyphUnit is used to store dimensions within Pango. Dimensions are stored in 1/64ths of a point.
*/
typedef PangoGlyphUnit GlyphUnit;
/** A Pango::GlyphVisAttr is used to communicate information between the shaping phase and the rendering phase. It's contents are still evolving.
*/
typedef PangoGlyphVisAttr GlyphVisAttr;
/** A Pango::GlyphInfo represents a single glyph together with positioning information and visual attributes.
*/
class GlyphInfo
{
_CLASS_GENERIC(GlyphInfo, PangoGlyphInfo)
public:
GlyphInfo();
/** Gets the glyph itself.
* @return The glyph.
*/
_MEMBER_GET(glyph, glyph, Glyph, PangoGlyph)
/** Gets the positional information about the glyph.
* @return A GylphGeometry object.
*/
_MEMBER_GET(geometry, geometry, GlyphGeometry, PangoGlyphGeometry)
/** Gets the visual attributes of the glyph.
* @return A GlyphVisAttr structure.
*/
_MEMBER_GET(attr, attr, GlyphVisAttr, PangoGlyphVisAttr)
//I don't think that we need these set_* functions!
//TODO: Who wrote this comment? Investigate. murrayc.
/* Sets the glyph itself.
* @param glyph The new glyph.
*/
// _MEMBER_SET(glyph, glyph, Glyph, PangoGlyph)
/* Sets the positional information about the glyph.
* @param geometry A GlyphGeometry object.
*/
// _MEMBER_SET(geometry, geometry, GlyphGeometry, PangoGlyphGeometry)
/* Sets the visual attributes of the glyph.
* @param attr A GylphVisAttr structure.
*/
// _MEMBER_SET(attr, attr, GlyphVisAttr, PangoGlyphVisAttr)
/// Provides access to the underlying C GObject.
PangoGlyphInfo* gobj() { return &gobject_; }
/// Provides access to the underlying C GObject.
const PangoGlyphInfo* gobj() const { return &gobject_; }
protected:
PangoGlyphInfo gobject_;
};
/** A Pango::GlyphGeometry contains width and positioning information for a single glyph. Distances are in 1/64ths of a point.
*/
class GlyphGeometry
{
_CLASS_GENERIC(GlyphGeometry, PangoGlyphGeometry)
public:
GlyphGeometry();
explicit GlyphGeometry(const PangoGlyphGeometry* src);
/** Gets the logical width to use for the character.
* @return The logical width.
*/
_MEMBER_GET(width, width, GlyphUnit, PangoGlyphUnit)
/** Gets the horizontal offset from nominal character position.
* @return The horizontal offset.
*/
_MEMBER_GET(x_offset, x_offset, GlyphUnit, PangoGlyphUnit)
/** Gets the vertical offset from nominal character position.
* @return The vertical offset.
*/
_MEMBER_GET(y_offset, y_offset, GlyphUnit, PangoGlyphUnit)
//I don't think that we need these set_* functions!
/* Sets the logical width to use for the character.
* @param width The new logical width.
*/
// _MEMBER_SET(width, width, GlyphUnit, PangoGlyphUnit)
/* Sets the horizontal offset from nominal character position.
* @param x_offset The new horizontal offset.
*/
// _MEMBER_SET(x_offset, x_offset, GlyphUnit, PangoGlyphUnit)
/* Sets the vertical offset from nominal character position.
* @param y_offset The new vertical offset.
*/
// _MEMBER_SET(y_offset, y_offset, GlyphUnit, PangoGlyphUnit)
PangoGlyphGeometry* gobj() { return &gobject_; }
const PangoGlyphGeometry* gobj() const { return &gobject_; }
protected:
PangoGlyphGeometry gobject_;
};
/* Since "the contents [of this struct] are still evolving" it might get necessary
* to create a wrapper class for PangoGlyphVisAttr in future. Currently, however,
* PangoGlyphVisAttr just contains one simple data field (guint is_cluster_start).
*/
/*class GlyphVisAttr
{
_CLASS_GENERIC(GlyphVisAttr, PangoGlyphVisAttr)
public:
GlyphVisAttr();
explicit GlyphVisAttr(const PangoGlyphVisAttr* src);
_MEMBER_GET(cluster_start, is_cluster_start, bool, guint)
_MEMBER_SET(cluster_start, is_cluster_start, bool, guint)
/// Provides access to the underlying C GObject.
PangoGlyphVisAttr* gobj() { return &gobject_; }
/// Provides access to the underlying C GObject.
const PangoGlyphVisAttr* gobj() const { return &gobject_; }
protected:
PangoGlyphVisAttr gobject_;
};*/
} //namespace Pango
namespace Glib
{
/** @relates Pango::GlyphInfo */
Pango::GlyphInfo& wrap(PangoGlyphInfo* object);
/** @relates Pango::GlyphInfo */
const Pango::GlyphInfo& wrap(const PangoGlyphInfo* object);
/** @relates Pango::GlyphGeometry */
Pango::GlyphGeometry& wrap(PangoGlyphGeometry* object);
/** @relates Pango::GlyphGeometry */
const Pango::GlyphGeometry& wrap(const PangoGlyphGeometry* object);
/* @relates Pango::GlyphVisAttr */
//Pango::GlyphVisAttr& wrap(PangoGlyphVisAttr* object);
/* @relates Pango::GlyphVisAttr */
//const Pango::GlyphVisAttr& wrap(const PangoGlyphVisAttr* object);
} //namespace Glib

View file

@ -0,0 +1,90 @@
// -*- c++ -*-
/* $Id: glyphstring.ccg,v 1.2 2006/05/30 17:14:21 murrayc Exp $ */
/*
*
* Copyright 1998-2002 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/utility.h>
#include <pango/pangocairo.h>
namespace Pango
{
GlyphString::GlyphString(const Glib::ustring& text, const Analysis& analysis)
:
gobject_(pango_glyph_string_new())
{
pango_shape(text.c_str(), text.bytes(), const_cast<PangoAnalysis*>(analysis.gobj()), gobj());
}
Rectangle GlyphString::get_ink_extents(const Glib::RefPtr<const Font>& font) const
{
Rectangle ink_rect;
pango_glyph_string_extents(const_cast<PangoGlyphString*>(gobj()), const_cast<PangoFont*>(font->gobj()), ink_rect.gobj(), 0);
return ink_rect;
}
Rectangle GlyphString::get_ink_extents(int start, int end, const Glib::RefPtr<const Font>& font) const
{
Rectangle ink_rect;
pango_glyph_string_extents_range(const_cast<PangoGlyphString*>(gobj()), start, end, const_cast<PangoFont*>(font->gobj()), ink_rect.gobj(), 0);
return ink_rect;
}
Rectangle GlyphString::get_logical_extents(const Glib::RefPtr<const Font>& font) const
{
Rectangle logical_rect;
pango_glyph_string_extents(const_cast<PangoGlyphString*>(gobj()), const_cast<PangoFont*>(font->gobj()), 0, logical_rect.gobj());
return logical_rect;
}
Rectangle GlyphString::get_logical_extents(int start, int end, const Glib::RefPtr<const Font>& font) const
{
Rectangle logical_rect;
pango_glyph_string_extents_range(const_cast<PangoGlyphString*>(gobj()), start, end, const_cast<PangoFont*>(font->gobj()), 0, logical_rect.gobj());
return logical_rect;
}
Glib::ArrayHandle<int> GlyphString::get_logical_widths(const Glib::ustring& text, int embedding_level) const
{
int* logical_widths = g_new(int, text.length());
pango_glyph_string_get_logical_widths(const_cast<PangoGlyphString*>(gobj()), text.c_str(), text.bytes(), embedding_level, logical_widths);
return Glib::ArrayHandle<int>(logical_widths, text.length(), Glib::OWNERSHIP_SHALLOW);
}
int GlyphString::index_to_x(const Glib::ustring& text, const Analysis& analysis, int index, bool trailing) const
{
int x_pos;
pango_glyph_string_index_to_x(const_cast<PangoGlyphString*>(gobj()), const_cast<gchar*>(text.c_str()), text.bytes(), const_cast<PangoAnalysis*>(analysis.gobj()), index, static_cast<int>(trailing), &x_pos);
return x_pos;
}
void GlyphString::x_to_index(const Glib::ustring& text, const Analysis& analysis, int x_pos, int& index, bool& trailing) const
{
gboolean trailing_temp = FALSE;
pango_glyph_string_x_to_index(const_cast<PangoGlyphString*>(gobj()), const_cast<char*>(text.c_str()), text.bytes(), const_cast<PangoAnalysis*>(analysis.gobj()), x_pos, &index, &trailing_temp);
trailing = trailing_temp;
}
Glib::ArrayHandle<GlyphInfo> GlyphString::get_glyphs() const
{
return Glib::ArrayHandle<GlyphInfo>(reinterpret_cast<GlyphInfo*>(gobj()->glyphs), gobj()->num_glyphs, Glib::OWNERSHIP_NONE);
}
} //namespace Pango

View file

@ -0,0 +1,131 @@
/* $Id: glyphstring.hg,v 1.2 2006/05/30 17:14:21 murrayc Exp $ */
/* glyphstring.h
*
* Copyright (C) 1998-1999 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <pangomm/font.h>
#include <pangomm/glyph.h>
#include <pangomm/item.h>
#include <cairomm/context.h>
#include <pango/pango-glyph.h>
#include <pango/pango-item.h> //For PangoAnalysis.
_DEFS(pangomm,pango)
namespace Pango
{
/** A Pango::GlyphString is used to store strings of glyphs with geometry and visual attribute information.
* It can be measured or drawn to the screen.
*/
class GlyphString
{
_CLASS_BOXEDTYPE(GlyphString, PangoGlyphString, pango_glyph_string_new, pango_glyph_string_copy, pango_glyph_string_free)
_IGNORE(pango_glyph_string_free, pango_glyph_string_copy, pango_glyph_string_copy_static, pango_glyph_string_equal)
_IGNORE(pango_glyph_string_index_to_x, pango_glyph_string_x_to_index, pango_glyph_string_get_logical_widths)
public:
/** Construct a string of glyphs from a string of characters.
* Given a segment of text and the corresponding Pango::Analysis structure
* returned from Pango::Context::itemize(), convert the characters into glyphs.
* You may also pass in only a sub-string of the item.
* @param text The text to process. You must pass the same string into those member functions expecting a const Glib::ustring&.
* @param analysis The analysis information return from Pango::Context::itemize().
*/
GlyphString(const Glib::ustring& text, const Analysis& analysis);
_WRAP_METHOD(void set_size (int new_len), pango_glyph_string_set_size)
_WRAP_METHOD(void get_extents(const Glib::RefPtr<const Font>& font, Rectangle& ink_rect, Rectangle& logical_rect) const, pango_glyph_string_extents)
_WRAP_METHOD(void get_extents(int start, int end, const Glib::RefPtr<const Font>& font, Rectangle& ink_rect, Rectangle& logical_rect) const, pango_glyph_string_extents_range)
_WRAP_METHOD(int get_width() const, pango_glyph_string_get_width)
/** Computes the extents of the glyph string as drawn.
* @param font A Pango::Font.
* @return The extents of the glyph string as drawn.
*/
Rectangle get_ink_extents(const Glib::RefPtr<const Font>& font) const;
/** Computes the extents of a sub-portion of the glyph string as drawn.
* @param start The start index.
* @param end The end index.
* @param font A Panog::Font
* @return The extents of the sub-portion of the glyph string as drawn.
*/
Rectangle get_ink_extents(int start, int end, const Glib::RefPtr<const Font>& font) const;
/** Computes the logical extents of a sub-portion of the glyph string.
* @param font A Pango::Font.
* @return The logical extents of the glyph string.
*/
Rectangle get_logical_extents(const Glib::RefPtr<const Font>& font) const;
/** Computes the logical extents of a sub-portion of the glyph string.
* @param start The start index.
* @param end The end index.
* @param font A Pango::Font.
* @return The logical extents of the sub-portion of the glyph string.
*/
Rectangle get_logical_extents(int start, int end, const Glib::RefPtr<const Font>& font) const;
/** Determine the screen width corresponding to each character.
* When multiple characters compose a single cluster, the width of the entire cluster
* is divided equally among the characters.
* @param text The text corresponding to the glyphs.
* @param embedding_level The embedding level of the string.
* @return An array of integers representing the resulting character widths.
*/
Glib::ArrayHandle<int> get_logical_widths(const Glib::ustring& text, int embedding_level) const;
/** Converts from character position to x position.
* (X position is measured from the left edge of the run). Character positions are computed by dividing up each cluster into equal portions.
* @param text The text corresponding to the glyphs.
* @param analysis The analysis information return from Pango::Context::itemize().
* @param index The byte index within text.
* @param trailing Whether we should compute the result for the beginning or end of the character.
* @return The x position.
*/
int index_to_x(const Glib::ustring& text, const Analysis& analysis, int index, bool trailing) const;
/** Convert from x offset to character position.
* Character positions are computed by dividing up each cluster into equal portions.
* In scripts where positioning within a cluster is not allowed (such as Thai),
* the returned value may not be a valid cursor position; the caller must combine the
* result with the logical attributes for the text to compute the valid cursor position.
* @param text The text corresponding to the glyphs.
* @param analysis The analysis information return from Pango::Context::itemize().
* @param x_pos The x offset (in thousands of a device unit).
* @param index The location to store calculated byte index within.
* @param trailing The location to store a boolean indicating whether the user clicked on the leading or trailing edge of the character.
*/
void x_to_index(const Glib::ustring& text, const Analysis& analysis, int x_pos, int& index, bool& trailing) const;
/** Gharacter positions are computed by dividing up each cluster into equal portions.
* @return An array of Pango::GlyphInfo objects.
*/
Glib::ArrayHandle<GlyphInfo> get_glyphs() const;
//TODO:
//void pango_cairo_glyph_string_path (cairo_t *cr,
// PangoFont *font,
// PangoGlyphString *glyphs);
};
} //namespace Pango

View file

@ -0,0 +1,124 @@
/* Copyright (C) 2002 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <pangomm/font.h>
#include <pangomm/attributes.h>
#include <pangomm/glyphstring.h>
namespace Pango
{
Analysis::Analysis()
{}
Analysis::Analysis(const PangoAnalysis* src)
:
gobject_ (*src)
{}
SListHandle_Attribute Analysis::get_extra_attrs() const
{
return SListHandle_Attribute(gobj()->extra_attrs, Glib::OWNERSHIP_NONE);
}
Item::Item(const Item& src)
:
gobject_ ((src.gobject_) ? pango_item_copy(src.gobject_) : 0)
{}
Item::Item(PangoItem* castitem, bool make_a_copy)
{
// For BoxedType wrappers, make_a_copy is true by default. The static
// BoxedType wrappers must always take a copy, thus make_a_copy = true
// ensures identical behaviour if the default argument is used.
if(make_a_copy)
{
if(castitem)
gobject_ = pango_item_copy(castitem);
else
gobject_ = 0;
}
else
{
// It was given to us by a function which has already made a copy for us to keep.
gobject_ = castitem;
}
}
Item& Item::operator=(const Item& src)
{
PangoItem *const new_gobject = (src.gobject_) ? pango_item_copy(src.gobject_) : 0;
if(gobject_)
pango_item_free(gobject_);
gobject_ = new_gobject;
return *this;
}
Item::~Item()
{
if(gobject_)
pango_item_free(gobject_);
}
PangoItem* Item::gobj_copy() const
{
return pango_item_copy(gobject_);
}
Analysis Item::get_analysis() const
{
return Analysis(&gobj()->analysis);
}
Glib::ustring Item::get_segment(const Glib::ustring& text) const
{
const char *const start = text.data() + gobj()->offset;
return Glib::ustring(start, start + gobj()->length);
}
Pango::GlyphString Item::shape(const Glib::ustring& text) const
{
return GlyphString(text, get_analysis());
}
} /* namespace Pango */
namespace Glib
{
Pango::Analysis& wrap(PangoAnalysis* object)
{
return *reinterpret_cast<Pango::Analysis*>(object);
}
const Pango::Analysis& wrap(const PangoAnalysis* object)
{
return *reinterpret_cast<const Pango::Analysis*>(object);
}
Pango::Item wrap(PangoItem* object, bool take_copy)
{
return Pango::Item(object, take_copy);
}
} /* namespace Glib */

View file

@ -0,0 +1,182 @@
/* Copyright (C) 2002 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <pangomm/attributes.h>
#include <pangomm/language.h>
#include <pango/pango-item.h>
_DEFS(pangomm,pango)
namespace Pango
{
class Font;
class GlyphString;
/** A Pango::Analysis stores information about the properties of a segment of text.
* Pango::Analysis is used as an output type only so there is no public default constructor.
* You can retrieve an object of this type from an object of type Pango::Item by
* calling Pango::Item::get_analysis(). Objects of this class can be used for some
* calculations in Pango::GlyphString.
*/
class Analysis
{
_CLASS_GENERIC(Analysis, PangoAnalysis)
protected:
// This class is only used as an output type.
Analysis();
public:
explicit Analysis(const PangoAnalysis* src);
public:
// _MEMBER_GET_PTR(engine_shape, shape_engine, EngineShape*, PangoEngineShape*) //We don't wrap the Engine* stuff.
// _MEMBER_GET_PTR(engine_lang, lang_engine, EngineLang*, PangoEngineLang*)
/** Gets the font used to render this segment.
* @return The font used to render this segment.
*/
_MEMBER_GET_GOBJECT(font, font, Font, PangoFont*)
/** Gets the bidrectional level for this segment.
* @return The bidirectional level for this segment.
*/
_MEMBER_GET(level, level, guint8, guint8)
/** Gets the language of this segment.
* @return The language of this segment.
*/
_MEMBER_GET(language, language, Language, PangoLanguage*)
/** Gets a list of non-font attributes for this segment.
* @return A list of non-font attributes for this segment.
*/
SListHandle_Attribute get_extra_attrs() const;
/// Provides access to the underlying C GObject.
PangoAnalysis* gobj() { return &gobject_; }
/// Provides access to the underlying C GObject.
const PangoAnalysis* gobj() const { return &gobject_; }
protected:
PangoAnalysis gobject_;
};
/** A Pango::Item stores information about a segment of text.
* Pango::Item is used as an output type only so there is no public default constructor.
* You retrieve objects of this type by calling Pango::Context::itemize() with some text.
* The actual rendering of the segment of text that corresponds to a particular Pango::Item
* (or some sub-string) into a string of glyphs is done with shape().
* The segment of text that corresponds to a Pango::Item can be computed from the
* text passed into Pango::Context::itemize() with get_segment(). Together with
* the Pango::Analysis data member that can be accessed with get_analysis()
* it is needed for further calculations in Pango::GlyphString.
*/
class Item
{
_CLASS_GENERIC(Item, PangoItem) //There is the whole set of functions for _CLASS_BOXEDTYPE but unfortunately PangoItem is not registered as a boxed type and lacks pango_item_get_type...
_IGNORE(pango_item_copy,pango_item_free)
public:
// There is no default constructor. This class is only used as an output type.
explicit Item(PangoItem* castitem, bool make_a_copy = true);
Item(const Item& src);
Item& operator=(const Item& src);
~Item();
/// Provides access to the underlying C GObject. The caller is responsible for freeing it. Use when directly setting fields in structs.
PangoItem* gobj_copy() const;
public:
_WRAP_METHOD(Item split(int split_index, int split_offset), pango_item_split)
/** Gets the offset of the segment from the beginning of the string in bytes.
* @return The offset of the segment from the beginning of the string in bytes.
*/
_MEMBER_GET(offset, offset, int, gint)
/** Gets the length of the segment in bytes.
* @return The length of the segment in bytes.
*/
_MEMBER_GET(length, length, int, gint)
/** Gets the length of the segment in characters.
* @return The length of the semgment in characters.
*/
_MEMBER_GET(num_chars, num_chars, int, gint)
/** Gets the properties of the segment.
* @return The properties of the segment.
*/
Analysis get_analysis() const;
/** Computes the segment of text that is represented by the item.
* @param text The text that has been passed into Pango::Context::itemize().
* @return The sub-string of @a text that corresponds to the item.
*/
Glib::ustring get_segment(const Glib::ustring& text) const;
/** Convert a segment of text into a string of glyphs.
* @param text The text to process. This must either be the whole segment of text that corresponds to the item as returned by get_segment() or a sub-string of that segment. You need to pass the same text to the member functions of Pango::GlyphString for further calculations.
* @return A Pango::GlyphString object that can be measured or drawn.
*/
GlyphString shape(const Glib::ustring& text) const;
/// Provides access to the underlying C GObject.
PangoItem* gobj() { return gobject_; }
/// Provides access to the underlying C GObject.
const PangoItem* gobj() const { return gobject_; }
protected:
PangoItem* gobject_;
};
struct ItemTraits
{
typedef Pango::Item CppType;
typedef const PangoItem* CType;
typedef PangoItem* CTypeNonConst;
static CType to_c_type (const CppType& obj) { return obj.gobj(); }
static CType to_c_type (CType ptr) { return ptr; }
static CppType to_cpp_type (CType ptr) { return CppType(const_cast<CTypeNonConst>(ptr), true); }
static void release_c_type (CType ptr) { pango_item_free(const_cast<CTypeNonConst>(ptr)); }
};
typedef Glib::ListHandle<Item, ItemTraits> ListHandle_Item;
} // namespace Pango
namespace Glib
{
/** @relates Pango::Analysis */
Pango::Analysis& wrap(PangoAnalysis* object);
/** @relates Pango::Analysis */
const Pango::Analysis& wrap(const PangoAnalysis* object);
/** @relates Pango::Item */
Pango::Item wrap(PangoItem* object, bool take_copy=true);
} // namespace Glib

View file

@ -0,0 +1,65 @@
/* Copyright (C) 2002 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <pango/pango-enum-types.h>
#include <pango/pango-script.h>
namespace Pango
{
/* PangoLanguage is just another example of inconsistent coding in atk/pango/gtk:
* on the one hand it is defined and registered as a boxed type, on the other
* hand it is always a pointer to some statically allocated string and thus
* neither allocated by itself, nor copied by value, nor freed. Similar dummy
* functions as below are defined in pango/pango-util.c but they are not exported.
* Compare with pango/pango-util.c for reference. */
//(I wonder who wrote this - it wasn't me. murrayc)
inline PangoLanguage* _pango_language_new()
{
return 0;
}
inline PangoLanguage* _pango_language_copy(const PangoLanguage* language)
{
return const_cast<PangoLanguage*>(language);
}
inline void _pango_language_free(PangoLanguage*)
{
return;
}
Language::Language()
:
gobject_(0)
{}
Language::Language(const Glib::ustring& language)
:
gobject_(pango_language_from_string(language.c_str()))
{}
Glib::ustring Language::get_string() const
{
if (gobject_)
return pango_language_to_string(const_cast<PangoLanguage*>(gobj()));
else
return Glib::ustring();
}
} /* namespace Pango */

View file

@ -0,0 +1,56 @@
/* Copyright (C) 2002 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <pango/pango-attributes.h>
_DEFS(pangomm,pango)
namespace Pango
{
_WRAP_ENUM(Script, PangoScript)
/** A Pango::Language is used to represent a language.
*/
class Language
{
_CLASS_BOXEDTYPE(Language, PangoLanguage, _pango_language_new, _pango_language_copy, _pango_language_free)
_IGNORE(pango_language_get_sample_string) //This function is a bad hack for internal use by renderers and Pango (from pango/pango-utils.c)
_IGNORE(pango_language_to_string) //This is defined as a macro
_CUSTOM_DEFAULT_CTOR
public:
/** Constructs an empty language tag.
*/
Language();
/** Constructs a Pango::Language object from a RFC-3066 format language tag.
* This function first canonicalizes the string by converting it to lowercase,
* mapping '_' to '-', and stripping all characters other than letters and '-'.
*/
Language(const Glib::ustring& language);
/** Gets a RFC-3066 format string representing the given language tag.
* @return A string representing the language tag. An empty string is returned if the language tag is empty.
*/
Glib::ustring get_string() const;
_WRAP_METHOD(bool matches(const Glib::ustring & range_list) const, pango_language_matches)
_WRAP_METHOD(bool includes_script(Script script) const, pango_language_includes_script)
};
} /* namespace Pango */

View file

@ -0,0 +1,132 @@
// -*- c++ -*-
/* $Id: layout.ccg,v 1.3 2006/05/30 17:14:21 murrayc Exp $ */
/*
*
* Copyright 1998-2002 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <pango/pangocairo.h>
namespace Pango
{
Layout::Layout(const Glib::RefPtr<Context>& context)
:
Glib::Object(G_OBJECT(pango_layout_new(context->gobj())))
{}
Glib::RefPtr<Layout> Layout::create(const Cairo::RefPtr<Cairo::Context>& context)
{
return Glib::wrap( pango_cairo_create_layout(context->cobj()) );
}
void Layout::update_from_cairo_context(const Cairo::RefPtr<Cairo::Context>& context)
{
pango_cairo_update_layout(context->cobj(), gobj());
}
void Layout::set_text(const Glib::ustring& text)
{
pango_layout_set_text(gobj(), text.c_str(), text.bytes());
}
void Layout::set_markup(const Glib::ustring& markup)
{
return pango_layout_set_markup(gobj(), markup.c_str(), markup.bytes());
}
void Layout::set_markup(const Glib::ustring& markup, gunichar accel_marker, gunichar& accel_char)
{
return pango_layout_set_markup_with_accel(gobj(), markup.c_str(), markup.bytes(), accel_marker, &accel_char);
}
Glib::ArrayHandle<PangoLogAttr> Layout::get_log_attrs() const
{
//Get array:
PangoLogAttr* pAttrs = 0;
int n_attrs = 0;
pango_layout_get_log_attrs(const_cast<PangoLayout*>(gobj()), &pAttrs, &n_attrs);
return Glib::ArrayHandle<PangoLogAttr>(pAttrs, n_attrs, Glib::OWNERSHIP_SHALLOW);
}
Rectangle Layout::index_to_pos(int index) const
{
Rectangle pos;
pango_layout_index_to_pos(const_cast<PangoLayout*>(gobj()), index, pos.gobj());
return pos;
}
Rectangle Layout::get_cursor_strong_pos(int index) const
{
Rectangle strong_pos;
pango_layout_get_cursor_pos(const_cast<PangoLayout*>(gobj()), index, strong_pos.gobj(), 0);
return strong_pos;
}
Rectangle Layout::get_cursor_weak_pos(int index) const
{
Rectangle weak_pos;
pango_layout_get_cursor_pos(const_cast<PangoLayout*>(gobj()), index, 0, weak_pos.gobj());
return weak_pos;
}
Rectangle Layout::get_ink_extents() const
{
Rectangle ink_extents;
pango_layout_get_extents(const_cast<PangoLayout*>(gobj()), ink_extents.gobj(), 0);
return ink_extents;
}
Rectangle Layout::get_logical_extents() const
{
Rectangle logical_extents;
pango_layout_get_extents(const_cast<PangoLayout*>(gobj()), 0, logical_extents.gobj());
return logical_extents;
}
Rectangle Layout::get_pixel_ink_extents() const
{
Rectangle ink_extents;
pango_layout_get_pixel_extents(const_cast<PangoLayout*>(gobj()), ink_extents.gobj(), 0);
return ink_extents;
}
Rectangle Layout::get_pixel_logical_extents() const
{
Rectangle logical_extents;
pango_layout_get_pixel_extents(const_cast<PangoLayout*>(gobj()), 0, logical_extents.gobj());
return logical_extents;
}
void Layout::get_iter(LayoutIter& iter)
{
iter.assign_gobj(pango_layout_get_iter(gobj()));
}
void Layout::unset_font_description()
{
pango_layout_set_font_description(gobj(), 0);
}
void Layout::add_to_cairo_context(const Cairo::RefPtr<Cairo::Context>& context)
{
pango_cairo_layout_path(context->cobj(), gobj());
}
} /* namespace Pango */

View file

@ -0,0 +1,248 @@
/* $Id: layout.hg,v 1.9 2006/06/08 20:39:39 murrayc Exp $ */
/* layout.h
*
* Copyright(C) 1998-1999 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/object.h>
#include <glibmm/slisthandle.h>
#include <pangomm/font.h>
#include <pangomm/fontdescription.h>
#include <pangomm/context.h>
#include <pangomm/attrlist.h>
#include <pangomm/tabarray.h>
#include <pangomm/layoutline.h>
#include <pangomm/layoutiter.h>
#include <pango/pango-layout.h>
_DEFS(pangomm,pango)
_PINCLUDE(glibmm/private/object_p.h)
namespace Pango
{
_CC_INCLUDE(pango/pango-enum-types.h)
_WRAP_ENUM(Alignment, PangoAlignment)
_WRAP_ENUM(WrapMode, PangoWrapMode)
_WRAP_ENUM(EllipsizeMode, PangoEllipsizeMode)
/** A Pango::Layout represents an entire paragraph of text.
* It is initialized with a Pango::Context, UTF-8 string and set of attributes for that string.
* Once that is done, the set of formatted lines can be extracted from the object,
* the layout can be rendered, and conversion between logical character positions
* within the layout's text, and the physical position of the resulting glyphs can be made.
*/
class Layout : public Glib::Object
{
_CLASS_GOBJECT(Layout, PangoLayout, PANGO_LAYOUT, Glib::Object, GObject)
_IGNORE(pango_layout_set_text, pango_layout_set_markup, pango_layout_set_markup_with_accel, pango_layout_get_log_attrs, pango_layout_get_iter)
protected:
explicit Layout(const Glib::RefPtr<Context>& context);
public:
_WRAP_CREATE(const Glib::RefPtr<Context>& context)
/** Creates a layout object set up to match the current transformation
* and target surface of the Cairo context. This layout can then be
* used for text measurement with functions like
* get_size() or drawing with methods like show_in_cairo_contet().
* If you change the transformation or target surface for @a context,
* you need to call update_from_cairo_context()
*
* This is the most convenient way to use Cairo with Pango.
* However it is slightly inefficient since it creates a separate
* Pango Context object for each layout. This might matter in an
* application that is laying out large amounts of text.
*
* @param context A Cairo context.
* @result The newly created Pango Layout.
*/
static Glib::RefPtr<Layout> create(const Cairo::RefPtr<Cairo::Context>& context);
/** Updates the private Pango Context of a Pango Layout created with
* create(const Cairo::RefPtr<Cairo::Context>&) to match the current transformation
* and target surface of a Cairo Context.
*
* @param context A Cairo context.
*/
void update_from_cairo_context(const Cairo::RefPtr<Cairo::Context>& context);
_WRAP_METHOD(Glib::RefPtr<Layout> copy(), pango_layout_copy)
_WRAP_METHOD(Glib::RefPtr<Context> get_context() const, pango_layout_get_context, refreturn)
_WRAP_METHOD(void set_attributes(AttrList& attrs), pango_layout_set_attributes)
_WRAP_METHOD(AttrList get_attributes() const, pango_layout_get_attributes)
/** Set the text of the layout.
* @param text The text for the layout.
*/
void set_text(const Glib::ustring& text);
_WRAP_METHOD(Glib::ustring get_text() const, pango_layout_get_text)
/** Sets the layout text and attribute list from marked-up text (see markup format).
* Replaces the current text and attribute list.
* @param markup Some marked-up text.
*/
void set_markup(const Glib::ustring& markup);
/** Sets the layout text and attribute list from marked-up text (see markup format).
* Replaces the current text and attribute list.
*
* If @a accel_marker is nonzero, the given character will mark the character following
* it as an accelerator. For example, the accel marker might be an ampersand or
* underscore. All characters marked as an accelerator will receive a
* Pango::UNDERLINE_LOW attribute, and the first character so marked will be returned
* in @a accel_char. Two @a accel_marker characters following each other produce a
* single literal @a accel_marker character.
* @param markup Some marked-up text.
* @param accel_marker Marker for accelerators in the text.
* @param accel_char Return location for any located accelerators.
*/
void set_markup(const Glib::ustring& markup, gunichar accel_marker, gunichar& accel_char);
_WRAP_METHOD(void set_font_description(const FontDescription& desc), pango_layout_set_font_description)
void unset_font_description();
_WRAP_METHOD(FontDescription get_font_description() const, pango_layout_get_font_description)
_WRAP_METHOD(void set_width(int width), pango_layout_set_width)
_WRAP_METHOD(int get_width() const, pango_layout_get_width)
_WRAP_METHOD(void set_wrap(WrapMode wrap), pango_layout_set_wrap)
_WRAP_METHOD(WrapMode get_wrap() const, pango_layout_get_wrap)
_WRAP_METHOD(bool is_wrapped() const, pango_layout_is_wrapped)
_WRAP_METHOD(void set_indent(int indent), pango_layout_set_indent)
_WRAP_METHOD(int get_indent() const, pango_layout_get_indent)
_WRAP_METHOD(void set_spacing(int spacing), pango_layout_set_spacing)
_WRAP_METHOD(int get_spacing() const, pango_layout_get_spacing)
_WRAP_METHOD(void set_justify(bool justify = true), pango_layout_set_justify)
_WRAP_METHOD(bool get_justify() const, pango_layout_get_justify)
_WRAP_METHOD(bool get_auto_dir() const, pango_layout_get_auto_dir)
_WRAP_METHOD(void set_auto_dir(bool auto_dir = true), pango_layout_set_auto_dir)
_WRAP_METHOD(void set_alignment(Alignment alignment), pango_layout_set_alignment)
_WRAP_METHOD(Alignment get_alignment() const, pango_layout_get_alignment)
_WRAP_METHOD(void set_tabs(TabArray& tabs), pango_layout_set_tabs)
_WRAP_METHOD(TabArray get_tabs() const, pango_layout_get_tabs)
_WRAP_METHOD(void set_single_paragraph_mode(bool setting = true), pango_layout_set_single_paragraph_mode)
_WRAP_METHOD(bool get_single_paragraph_mode() const, pango_layout_get_single_paragraph_mode)
_WRAP_METHOD(void set_ellipsize(EllipsizeMode ellipsize), pango_layout_set_ellipsize)
_WRAP_METHOD(EllipsizeMode get_ellipsize() const, pango_layout_get_ellipsize)
_WRAP_METHOD(bool is_ellipsized() const, pango_layout_is_ellipsized)
_WRAP_METHOD(int get_unknown_glyphs_count() const, pango_layout_get_unknown_glyphs_count)
_WRAP_METHOD(void context_changed(), pango_layout_context_changed)
/** Retrieve an array of logical attributes for each character in the layout.
* @return An array of logical attributes.
*/
Glib::ArrayHandle<LogAttr> get_log_attrs() const;
/** Convert from an index within the layout to the onscreen position corresponding to the grapheme at that index, which is represented as rectangle.
* Note that @a x in the returned rectangle is always the leading edge of the grapheme
* and @a x + @a width the trailing edge of the grapheme.
* If the directionality of the grapheme is right-to-left, then @a width will be negative.
* @param index Byte index within layout.
* @return The position of the grapheme.
*/
Rectangle index_to_pos(int index) const;
_IGNORE(pango_layout_index_to_pos)
_WRAP_METHOD(void index_to_line_x(int index_, bool trailing, int& line, int& x_pos) const, pango_layout_index_to_line_x)
_WRAP_METHOD(void get_cursor_pos(int index, Rectangle& strong_pos, Rectangle& weak_pos) const, pango_layout_get_cursor_pos)
/** Given an index within the layout, determine the positions that of the strong cursors if the insertion point is at that index.
* @param index The byte index of the cursor.
* @return The strong cursor position.
*/
Rectangle get_cursor_strong_pos(int index) const;
/** Given an index within the layout, determine the positions that of the weak cursors if the insertion point is at that index.
* @param index The byte index of the cursor.
* @return The weak cursor position.
*/
Rectangle get_cursor_weak_pos(int index) const;
_WRAP_METHOD(void move_cursor_visually(bool strong,
int old_index, int old_trailing, int direction,
int& new_index, int& new_trailing) const, pango_layout_move_cursor_visually)
_WRAP_METHOD(bool xy_to_index(int x, int y, int& index, int& trailing) const, pango_layout_xy_to_index)
_WRAP_METHOD(void get_extents(Rectangle& ink_rect, Rectangle& logical_rect) const, pango_layout_get_extents)
/** Compute the ink extents of layout.
* @return The extents of the layout as drawn.
*/
Rectangle get_ink_extents() const;
/** Compute the logical extents of layout.
* @return The logical extents of the layout.
*/
Rectangle get_logical_extents() const;
_WRAP_METHOD(void get_pixel_extents(Rectangle& ink_rect, Rectangle& logical_rect) const, pango_layout_get_pixel_extents)
/** Compute the ink extents of the layout in device units.
* @return The extents of the layout as drawn.
*/
Rectangle get_pixel_ink_extents() const;
/** Compute the logical extents of the layout in device units.
* @return The logical extents of the layout.
*/
Rectangle get_pixel_logical_extents() const;
_WRAP_METHOD(void get_size(int& width, int& height) const, pango_layout_get_size)
_WRAP_METHOD(void get_pixel_size(int& width, int& height) const, pango_layout_get_pixel_size)
_WRAP_METHOD(int get_line_count() const, pango_layout_get_line_count)
//Note that the const version uses a different (faster) C function:
_WRAP_METHOD(Glib::RefPtr<LayoutLine> get_line(int line), pango_layout_get_line, refreturn)
_WRAP_METHOD(Glib::RefPtr<const LayoutLine> get_line(int line) const, pango_layout_get_line_readonly, refreturn)
//Note that the const version uses a different (faster) C function:
_WRAP_METHOD(SListHandle_LayoutLine get_lines(), pango_layout_get_lines)
_WRAP_METHOD(SListHandle_ConstLayoutLine get_lines() const, pango_layout_get_lines_readonly)
/** Gets an iterator to iterate over the visual extents of the layout.
* @param iter Location to store the iterator.
*/
void get_iter(LayoutIter& iter);
/** Adds the text in this LayoutLine to the current path in the
* specified Cairo @a context. The origin of the glyphs (the left edge
* of the line) will be at the current point of the cairo context.
*
* @param context A Cairo context.
*/
void add_to_cairo_context(const Cairo::RefPtr<Cairo::Context>& context);
};
} /* namespace Pango */

View file

@ -0,0 +1,112 @@
// -*- c++ -*-
/* $Id: layoutiter.ccg,v 1.1 2003/01/21 13:41:06 murrayc Exp $ */
/*
*
* Copyright 2001-2002 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
namespace Pango
{
LayoutIter::LayoutIter()
:
gobject_ (0)
{}
LayoutIter::~LayoutIter()
{
if(gobject_)
pango_layout_iter_free(gobject_);
}
void LayoutIter::assign_gobj(PangoLayoutIter* src)
{
if(src != gobject_)
{
if(gobject_)
pango_layout_iter_free(gobject_);
gobject_ = src;
}
}
Rectangle LayoutIter::get_char_extents() const
{
Rectangle logical_rect;
pango_layout_iter_get_char_extents(const_cast<PangoLayoutIter*>(gobj()), logical_rect.gobj());
return logical_rect;
}
Rectangle LayoutIter::get_cluster_ink_extents() const
{
Rectangle ink_rect;
pango_layout_iter_get_cluster_extents(const_cast<PangoLayoutIter*>(gobj()), ink_rect.gobj(), 0);
return ink_rect;
}
Rectangle LayoutIter::get_cluster_logical_extents() const
{
Rectangle logical_rect;
pango_layout_iter_get_cluster_extents(const_cast<PangoLayoutIter*>(gobj()), 0, logical_rect.gobj());
return logical_rect;
}
Rectangle LayoutIter::get_run_ink_extents() const
{
Rectangle ink_rect;
pango_layout_iter_get_run_extents(const_cast<PangoLayoutIter*>(gobj()), ink_rect.gobj(), 0);
return ink_rect;
}
Rectangle LayoutIter::get_run_logical_extents() const
{
Rectangle logical_rect;
pango_layout_iter_get_run_extents(const_cast<PangoLayoutIter*>(gobj()), 0, logical_rect.gobj());
return logical_rect;
}
Rectangle LayoutIter::get_line_ink_extents() const
{
Rectangle ink_rect;
pango_layout_iter_get_line_extents(const_cast<PangoLayoutIter*>(gobj()), ink_rect.gobj(), 0);
return ink_rect;
}
Rectangle LayoutIter::get_line_logical_extents() const
{
Rectangle logical_rect;
pango_layout_iter_get_line_extents(const_cast<PangoLayoutIter*>(gobj()), 0, logical_rect.gobj());
return logical_rect;
}
Rectangle LayoutIter::get_layout_ink_extents() const
{
Rectangle ink_rect;
pango_layout_iter_get_layout_extents(const_cast<PangoLayoutIter*>(gobj()), ink_rect.gobj(), 0);
return ink_rect;
}
Rectangle LayoutIter::get_layout_logical_extents() const
{
Rectangle logical_rect;
pango_layout_iter_get_layout_extents(const_cast<PangoLayoutIter*>(gobj()), 0, logical_rect.gobj());
return logical_rect;
}
} // namespace Pango

View file

@ -0,0 +1,135 @@
/* $Id: layoutiter.hg,v 1.2 2003/12/14 11:54:05 murrayc Exp $ */
/* layoutiter.h
*
* Copyright 2001-2002 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <pangomm/layoutline.h>
#include <pangomm/layoutrun.h>
#include <pango/pango-layout.h>
_DEFS(pangomm,pango)
namespace Pango
{
/** A Pango::LayoutIter can be used to iterate over the visual extents of a Pango::Layout.
*/
class LayoutIter
{
_CLASS_GENERIC(LayoutIter, PangoLayoutIter)
_IGNORE(pango_layout_iter_free, pango_layout_iter_get_char_extents)
public:
// There's no other ctor, and the default ctor creates an invalid object.
// Therefore, Pango::LayoutIter is usable only as output argument.
LayoutIter();
~LayoutIter();
_WRAP_METHOD(int get_index() const, pango_layout_iter_get_index)
_WRAP_METHOD(LayoutRun get_run() const, pango_layout_iter_get_run)
//TODO: Use pango_layout_iter_get_run_readonly()?
_WRAP_METHOD(Glib::RefPtr<LayoutLine> get_line() const, pango_layout_iter_get_line, refreturn)
//TODO: We should really have a const and non-const version: _WRAP_METHOD(Glib::RefPtr<const LayoutLine> get_line() const, pango_layout_iter_get_line_readonly, refreturn)
_WRAP_METHOD(bool at_last_line() const, pango_layout_iter_at_last_line)
_WRAP_METHOD(bool next_char(), pango_layout_iter_next_char)
_WRAP_METHOD(bool next_cluster(), pango_layout_iter_next_cluster)
_WRAP_METHOD(bool next_run(), pango_layout_iter_next_run)
_WRAP_METHOD(bool next_line(), pango_layout_iter_next_line)
/** Gets the extents of the current character, in layout coordinates (origin is the top left of the entire layout).
* Only logical extents can sensibly be obtained for characters; ink extents make sense only down to the level of clusters.
* @return The logical extents of the current character.
*/
Rectangle get_char_extents() const;
_WRAP_METHOD(void get_cluster_extents(Rectangle& ink_rect, Rectangle& logical_rect) const, pango_layout_iter_get_cluster_extents)
/** Gets the ink extents of the current cluster, in layout coordinates (origin is the top left of the entire layout).
* @return The extents of the current cluster as drawn.
*/
Rectangle get_cluster_ink_extents() const;
/** Gets the logical extents of the current cluster, in layout coordinates (origin is the top left of the entire layout).
* @return The logical extents of the current cluster.
*/
Rectangle get_cluster_logical_extents() const;
_WRAP_METHOD(void get_run_extents(Rectangle& ink_rect, Rectangle& logical_rect) const, pango_layout_iter_get_run_extents)
/** Gets the ink extents of the current run in layout coordinates (origin is the top left of the entire layout).
* @return The extents of the current run as drawn.
*/
Rectangle get_run_ink_extents() const;
/** Gets the logical extents of the current run in layout coordinates (origin is the top left of the entire layout).
* @return The logical extents of the current run.
*/
Rectangle get_run_logical_extents() const;
_WRAP_METHOD(void get_line_extents(Rectangle& ink_rect, Rectangle& logical_rect) const, pango_layout_iter_get_line_extents)
/** Obtains the ink extents of the current line.
* @return The extents of the current line as drawn.
*/
Rectangle get_line_ink_extents() const;
/** Obtains the logical extents of the current line.
* @return The logical extents of the current line.
*/
Rectangle get_line_logical_extents() const;
_WRAP_METHOD(void get_line_yrange(int& y0, int& y1) const, pango_layout_iter_get_line_yrange)
_WRAP_METHOD(void get_layout_extents(Rectangle& ink_rect, Rectangle& logical_rect) const, pango_layout_iter_get_layout_extents)
/** Obtains the ink extents of the Pango::Layout being iterated over.
* @return The extents of the layout as drawn.
*/
Rectangle get_layout_ink_extents() const;
/** Obtains the logical extents of the Pango::Layout being iterated over.
* @return The logical extents of the layout.
*/
Rectangle get_layout_logical_extents() const;
_WRAP_METHOD(int get_baseline() const, pango_layout_iter_get_baseline)
/// Provides access to the underlying C GObject.
PangoLayoutIter* gobj() { return gobject_; }
/// Provides access to the underlying C GObject.
const PangoLayoutIter* gobj() const { return gobject_; }
#ifndef DOXYGEN_SHOULD_SKIP_THIS
void assign_gobj(PangoLayoutIter* src);
#endif
protected:
PangoLayoutIter* gobject_;
private:
// noncopyable
LayoutIter(const LayoutIter&);
LayoutIter& operator=(const LayoutIter&);
};
} //namespace Pango

View file

@ -0,0 +1,81 @@
// -*- c++ -*-
/* $Id: layoutline.ccg,v 1.3 2006/05/30 17:14:21 murrayc Exp $ */
/*
*
* Copyright 1998-2002 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <pangomm/layout.h>
#include <pango/pangocairo.h>
namespace Pango {
Rectangle LayoutLine::get_ink_extents() const
{
Rectangle ink_rect;
pango_layout_line_get_extents(const_cast<PangoLayoutLine*>(gobj()), ink_rect.gobj(), 0);
return ink_rect;
}
Rectangle LayoutLine::get_logical_extents() const
{
Rectangle logical_rect;
pango_layout_line_get_extents(const_cast<PangoLayoutLine*>(gobj()), 0, logical_rect.gobj());
return logical_rect;
}
Rectangle LayoutLine::get_pixel_ink_extents() const
{
Rectangle ink_rect;
pango_layout_line_get_pixel_extents(const_cast<PangoLayoutLine*>(gobj()), ink_rect.gobj(), 0);
return ink_rect;
}
Rectangle LayoutLine::get_pixel_logical_extents() const
{
Rectangle logical_rect;
pango_layout_line_get_pixel_extents(const_cast<PangoLayoutLine*>(gobj()), 0, logical_rect.gobj());
return logical_rect;
}
int LayoutLine::index_to_x(int index, bool trailing) const
{
int x_pos;
pango_layout_line_index_to_x(const_cast<PangoLayoutLine*>(gobj()), index, trailing, &x_pos);
return x_pos;
}
Glib::ArrayHandle<std::pair<int,int> > LayoutLine::get_x_ranges(int start_index, int end_index) const
{
int* ranges = 0;
int n_ranges = 0;
pango_layout_line_get_x_ranges(const_cast<PangoLayoutLine*>(gobj()), start_index, end_index, &ranges, &n_ranges);
return Glib::ArrayHandle<std::pair<int,int> >(reinterpret_cast<std::pair<int,int>*>(ranges), n_ranges, Glib::OWNERSHIP_SHALLOW);
}
void LayoutLine::show_in_cairo_context(const Cairo::RefPtr<Cairo::Context>& context)
{
pango_cairo_show_layout_line(context->cobj(), gobj());
}
void LayoutLine::add_to_cairo_context(const Cairo::RefPtr<Cairo::Context>& context)
{
pango_cairo_layout_line_path(context->cobj(), gobj());
}
} /* namespace Pango */

View file

@ -0,0 +1,151 @@
/* $Id: layoutline.hg,v 1.5 2006/05/30 17:14:21 murrayc Exp $ */
/* layoutline.h
*
* Copyright (C) 1998-1999 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/slisthandle.h> // For the Glib::SListHandle typedef
#include <pangomm/rectangle.h>
#include <cairomm/context.h>
#include <pango/pango-layout.h>
_DEFS(pangomm,pango)
namespace Pango
{
class Layout;
/** A Pango::LayoutLine represents one of the lines resulting from laying out a paragraph via Pango::Layout.
* Pango::LayoutLine objects are obtained by calling Pango::Layout::get_line()
* and are only valid until the text, attributes, or settings of the parent Pango::Layout are modified.
* Routines for rendering Pango::Layout objects are provided in code specific to each rendering system.
*/
class LayoutLine
{
_CLASS_OPAQUE_REFCOUNTED(LayoutLine, PangoLayoutLine, NONE, pango_layout_line_ref, pango_layout_line_unref)
_IGNORE(pango_layout_line_ref, pango_layout_line_unref)
_IGNORE(pango_layout_line_get_x_ranges)
public:
_WRAP_METHOD(bool x_to_index(int x_pos, int& index, int& trailing) const, pango_layout_line_x_to_index)
/** Converts an index within a line to a @a x position.
* @param index Byte offset of a grapheme within the layout.
* @param trailing A boolean indicating the edge of the grapheme to retrieve the position of. If <tt>false</tt>, the trailing edge of the grapheme, if <tt>true</tt> the leading of the grapheme.
* @return The x offset (in thousands of a device unit).
*/
int index_to_x(int index, bool trailing) const;
_IGNORE(pango_layout_line_index_to_x)
/** Get a list of visual ranges corresponding to a given logical range.
* This list is not necessarily minimal - there may be consecutive ranges which are adjacent.
* The ranges will be sorted from left to right. The ranges are with respect to the
* left edge of the entire layout, not with respect to the line.
* @param start_index The start byte index of the logical range.
* If the value of @a start_index is less than the start index for the line,
* then the first range will extend all the way to the leading edge of the layout.
* Otherwise it will start at the leading edge of the first character.
* @param end_index The end byte index of the logical range.
* If the value of @a end_index is greater than the end index for the line,
* then 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.
* @return An array of ranges represented by pairs of integers marking the start and end pixel coordinates of the ranges.
*/
Glib::ArrayHandle<std::pair<int,int> > get_x_ranges(int start_index, int end_index) const;
_WRAP_METHOD(void get_extents(Rectangle& ink_rect, Rectangle& logical_rect) const, pango_layout_line_get_extents)
/** Compute the ink extents of a layout line.
* @return The extents of the layout line as drawn.
*/
Rectangle get_ink_extents() const;
/** Compute the logical extents of a layout line.
* @return The logical extents of the layout line.
*/
Rectangle get_logical_extents() const;
_WRAP_METHOD(void get_pixel_extents(Rectangle& ink_rect, Rectangle& logical_rect) const, pango_layout_line_get_pixel_extents)
/** Compute the ink extents of a layout line in device units.
* @return The extents of the layout line as drawn.
*/
Rectangle get_pixel_ink_extents() const;
/** Compute the logical extents of a layout line in device units.
* @return The logical extents of the layout line.
*/
Rectangle get_pixel_logical_extents() const;
/** Draws this LayoutLine in the specified Cairo context.
* The origin of the glyphs (the left edge of the line) will
* be drawn at the current point of the cairo context.
*
* @param context A Cairo context.
*/
void show_in_cairo_context(const Cairo::RefPtr<Cairo::Context>& context);
/** Adds the text in this LayoutLine to the current path in the
* specified Cairo @a context. The origin of the glyphs (the left edge
* of the line) will be at the current point of the cairo context.
*
* @param context A Cairo context.
*/
void add_to_cairo_context(const Cairo::RefPtr<Cairo::Context>& context);
_MEMBER_GET_GOBJECT(layout, layout, Pango::Layout, PangoLayout*)
//_MEMBER_SET_GOBJECT(layout, layout, Pango::Layout, PangoLayout*)
_MEMBER_GET(length, length, int, gint)
_MEMBER_GET(start_index, start_index, int, gint)
};
} // namespace Pango
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Glib
{
// forward declaration needed by LayoutLineTraits
Glib::RefPtr<Pango::LayoutLine> wrap(PangoLayoutLine* object, bool take_copy /* = false */);
} // namespace Glib
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
namespace Pango
{
struct LayoutLineTraits
{
typedef Glib::RefPtr<LayoutLine> CppType;
typedef PangoLayoutLine * CType;
typedef PangoLayoutLine * CTypeNonConst;
static CType to_c_type (const CppType& ptr) { return Glib::unwrap(ptr); }
static CType to_c_type (CType ptr) { return ptr; }
static CppType to_cpp_type (CType ptr) { return Glib::wrap(ptr, true); }
static void release_c_type (CType ptr) { pango_layout_line_unref(ptr); }
};
typedef Glib::SListHandle< Glib::RefPtr<LayoutLine>, LayoutLineTraits > SListHandle_LayoutLine;
typedef Glib::SListHandle< Glib::RefPtr<const LayoutLine>, LayoutLineTraits > SListHandle_ConstLayoutLine;
} // namespace Pango

View file

@ -0,0 +1,49 @@
/*
* Copyright 2002 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <pangomm/item.h>
#include <pangomm/glyphstring.h>
namespace Pango
{
LayoutRun::LayoutRun()
{}
LayoutRun::LayoutRun(const PangoLayoutRun* src)
{
gobject_ = *src;
}
} /* namespace Pango */
namespace Glib
{
Pango::LayoutRun& wrap(PangoLayoutRun* object)
{
return *reinterpret_cast<Pango::LayoutRun*>(object);
}
const Pango::LayoutRun& wrap(const PangoLayoutRun* object)
{
return *reinterpret_cast<const Pango::LayoutRun*>(object);
}
} /* namespace Glib */

View file

@ -0,0 +1,74 @@
/* layoutrun.h
*
* Copyright (C) 1998-1999 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <pango/pango-layout.h>
_DEFS(pangomm,pango)
namespace Pango
{
class Item;
class GlyphString;
/** A Pango::LayoutRun represents a single run within a PangoLayoutLine.
*/
class LayoutRun
{
_CLASS_GENERIC(LayoutRun, PangoLayoutRun)
protected:
LayoutRun();
public:
explicit LayoutRun(const PangoLayoutRun* src);
/** Gets the Pango::Item object that provides information about the segment of text in this run.
* @return A Pango::Item object.
*/
_MEMBER_GET(item, item, Item, PangoItem*)
/** Gets the string of glyphs obtained by shaping the text for this item.
* @return A Pango::GlyphString object.
*/
_MEMBER_GET(glyphs, glyphs, GlyphString, PangoGlyphString*)
/// Provides access to the underlying C GObject.
PangoLayoutRun* gobj() { return &gobject_; }
/// Provides access to the underlying C GObject.
const PangoLayoutRun* gobj() const { return &gobject_; }
protected:
PangoLayoutRun gobject_;
};
} /* namespace Pango */
namespace Glib
{
/** @relates Pango::LayoutRun */
Pango::LayoutRun& wrap(PangoLayoutRun* object);
/** @relates Pango::LayoutRun */
const Pango::LayoutRun& wrap(const PangoLayoutRun* object);
} /* namepspace Glib */

View file

@ -0,0 +1,5 @@
(include pango_methods.defs)
(include pango_vfuncs.defs)
(include pango_enums.defs)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,372 @@
<root>
<function name="pango_font_face_describe">
<description>
Returns the family, style, variant, weight and stretch of
a #PangoFontFace. The size field of the resulting font description
will be unset.
</description>
<parameters>
<parameter name="face">
<parameter_description> a #PangoFontFace
</parameter_description>
</parameter>
</parameters>
<return> a #PangoFontDescription
holding the description of the face.
</return>
</function>
<function name="pango_layout_get_tabs">
<description>
Get the current #PangoTabArray used by this layout. If no
#PangoTabArray has been set, then the default tabs are in use
and an invalid instance is returned. Default tabs are every 8 spaces.
</description>
<parameters>
<parameter name="layout">
<parameter_description> a #PangoLayout
</parameter_description>
</parameter>
</parameters>
<return> a copy of the tabs for this layout.
</return>
</function>
<function name="pango_context_get_metrics">
<description>
Get overall metric information for a font particular font
description. Since the metrics may be substantially different for
different scripts, a language tag can be provided to indicate that
the metrics should be retrieved that correspond to the script(s)
used by that language.
The #PangoFontDescription is interpreted in the same way as
by pango_itemize(), and the family name may be a comma separated
list of figures. If characters from multiple of these families
would be used to render the string, then the returned fonts would
be a composite of the metrics for the fonts loaded for the
individual families.
</description>
<parameters>
<parameter name="context">
<parameter_description> a #PangoContext
</parameter_description>
</parameter>
<parameter name="desc">
<parameter_description> a #PangoFontDescription structure
</parameter_description>
</parameter>
<parameter name="language">
<parameter_description> language tag used to determine which script to get the metrics
for.
</parameter_description>
</parameter>
</parameters>
<return> a #PangoMetrics object.
</return>
</function>
<function name="pango_font_get_glyph_extents">
<description>
Gets the logical and ink extents of a glyph within a font. The
coordinate system for each rectangle has its origin at the
base line and horizontal origin of the character with increasing
coordinates extending to the right and down. The macros PANGO_ASCENT(),
PANGO_DESCENT(), PANGO_LBEARING(), and PANGO_RBEARING can be used to convert
from the extents rectangle to more traditional font metrics. The units
of the rectangles are in 1/PANGO_SCALE of a device unit.
</description>
<parameters>
<parameter name="font">
<parameter_description> a #PangoFont
</parameter_description>
</parameter>
<parameter name="glyph">
<parameter_description> the glyph index
</parameter_description>
</parameter>
<parameter name="ink_rect">
<parameter_description> rectangle used to store the extents of the glyph as drawn.
</parameter_description>
</parameter>
<parameter name="logical_rect">
<parameter_description> rectangle used to store the logical extents of the glyph.
</parameter_description>
</parameter>
</parameters>
<return></return>
</function>
<function name="pango_glyph_string_extents_range">
<description>
Computes the extents of a sub-portion of a glyph string. The extents are
relative to the start of the glyph string range (the origin of their
coordinate system is at the start of the range, not at the start of the entire
glyph string).
</description>
<parameters>
<parameter name="glyphs">
<parameter_description> a #PangoGlyphString
</parameter_description>
</parameter>
<parameter name="start">
<parameter_description> start index
</parameter_description>
</parameter>
<parameter name="end">
<parameter_description> end index (the range is the set of bytes with
indices such that start &amp;lt;= index &amp;lt; end)
</parameter_description>
</parameter>
<parameter name="font">
<parameter_description> a #PangoFont
</parameter_description>
</parameter>
<parameter name="ink_rect">
<parameter_description> rectangle used to store the extents of the glyph string range as drawn.
</parameter_description>
</parameter>
<parameter name="logical_rect">
<parameter_description> rectangle used to store the logical extents of the glyph string range.
</parameter_description>
</parameter>
</parameters>
<return></return>
</function>
<function name="pango_layout_get_extents">
<description>
Compute the logical and ink extents of @layout. Logical extents
are usually what you want for positioning things. The extents
are given in layout coordinates; layout coordinates begin at the
top left corner of the layout.
</description>
<parameters>
<parameter name="layout">
<parameter_description> a #PangoLayout
</parameter_description>
</parameter>
<parameter name="ink_rect">
<parameter_description> rectangle used to store the extents of the layout as drawn.
</parameter_description>
</parameter>
<parameter name="logical_rect">
<parameter_description> rectangle used to store the logical extents of the layout.
</parameter_description>
</parameter>
</parameters>
<return></return>
</function>
<function name="pango_layout_get_pixel_extents">
<description>
Compute the logical and ink extents of @layout in device units.
See pango_layout_get_extents(); this function just calls
pango_layout_get_extents() and then converts the extents to
pixels using the #PANGO_SCALE factor.
</description>
<parameters>
<parameter name="layout">
<parameter_description> a #PangoLayout
</parameter_description>
</parameter>
<parameter name="ink_rect">
<parameter_description> rectangle used to store the extents of the layout as drawn.
</parameter_description>
</parameter>
<parameter name="logical_rect">
<parameter_description> rectangle used to store the logical extents of the
layout.
</parameter_description>
</parameter>
</parameters>
<return></return>
</function>
<function name="pango_layout_set_font_description">
<description>
Set the default font description for the layout. If no font
description is set on the layout, the font description from
the layout&apos;s context is used.
</description>
<parameters>
<parameter name="layout">
<parameter_description> a #PangoLayout
</parameter_description>
</parameter>
<parameter name="desc">
<parameter_description> the new pango font description.
</parameter_description>
</parameter>
</parameters>
<return></return>
</function>
<function name="pango_layout_line_get_extents">
<description>
Compute the logical and ink extents of a layout line. See the documentation
for pango_font_get_glyph_extents() for details about the interpretation
of the rectangles.
</description>
<parameters>
<parameter name="line">
<parameter_description> a #PangoLayoutLine
</parameter_description>
</parameter>
<parameter name="ink_rect">
<parameter_description> rectangle used to store the extents of the glyph string as drawn.
</parameter_description>
</parameter>
<parameter name="logical_rect">
<parameter_description> rectangle used to store the logical extents of the glyph string.
</parameter_description>
</parameter>
</parameters>
<return></return>
</function>
<function name="pango_layout_line_get_pixel_extents">
<description>
Compute the logical and ink extents of a layout line. See the documentation
for pango_font_get_glyph_extents() for details about the interpretation
of the rectangles. The returned rectangles are in device units, as
opposed to pango_layout_line_get_extents(), which returns the extents in
units of device unit / PANGO_SCALE.
</description>
<parameters>
<parameter name="layout_line">
<parameter_description> a #PangoLayoutLine
</parameter_description>
</parameter>
<parameter name="ink_rect">
<parameter_description> rectangle used to store the extents of the glyph string as drawn.
</parameter_description>
</parameter>
<parameter name="logical_rect">
<parameter_description> rectangle used to store the logical extents of the glyph string.
</parameter_description>
</parameter>
</parameters>
<return></return>
</function>
<function name="pango_font_get_metrics">
<description>
Gets overall metric information for a font. Since the metrics may be
substantially different for different scripts, a language tag can
be provided to indicate that the metrics should be retrieved that
correspond to the script(s) used by that language.
</description>
<parameters>
<parameter name="font">
<parameter_description> a #PangoFont
</parameter_description>
</parameter>
<parameter name="language">
<parameter_description> language tag used to determine which script to get the metrics
for.
</parameter_description>
</parameter>
</parameters>
<return> a #PangoMetrics object.
</return>
</function>
<function name="pango_glyph_string_extents">
<description>
Compute the logical and ink extents of a glyph string. See the documentation
for pango_font_get_glyph_extents() for details about the interpretation
of the rectangles.
</description>
<parameters>
<parameter name="glyphs">
<parameter_description> a #PangoGlyphString
</parameter_description>
</parameter>
<parameter name="font">
<parameter_description> a #PangoFont
</parameter_description>
</parameter>
<parameter name="ink_rect">
<parameter_description> rectangle used to store the extents of the glyph string as drawn.
</parameter_description>
</parameter>
<parameter name="logical_rect">
<parameter_description> rectangle used to store the logical extents of the glyph string.
</parameter_description>
</parameter>
</parameters>
<return></return>
</function>
<function name="pango_font_description_to_string">
<description>
Creates a string representation of a font description. See
pango_font_description_from_string() for a description of the
format of the string representation. The family list in the
string description will only have a terminating comma if the
last word of the list is a valid style option.
</description>
<parameters>
<parameter name="desc">
<parameter_description> a #PangoFontDescription
</parameter_description>
</parameter>
</parameters>
<return> The string.
</return>
</function>
<function name="pango_font_description_to_filename">
<description>
Creates a filename representation of a font description. The
filename is identical to the result from calling
pango_font_description_to_string(), but with underscores instead of
characters that are untypical in filenames, and in lower case only.
</description>
<parameters>
<parameter name="desc">
<parameter_description> a #PangoFontDescription
</parameter_description>
</parameter>
</parameters>
<return> The filename.
</return>
</function>
<function name="pango_color_parse">
<description>
Fill in the fields of a color from a string specification. The
string can either one of a large set of standard names. (Taken
from the X11 &amp;lt;filename&amp;gt;rgb.txt&amp;lt;/filename&amp;gt; file), or it can be a hex value in the
form &apos;#rgb&apos; &apos;#rrggbb&apos; &apos;#rrrgggbbb&apos; or &apos;#rrrrggggbbbb&apos; where
&apos;r&apos;, &apos;g&apos; and &apos;b&apos; are hex digits of the red, green, and blue
components of the color, respectively. (White in the four
forms is &apos;#fff&apos; &apos;#ffffff&apos; &apos;#fffffffff&apos; and &apos;#ffffffffffff&apos;)
</description>
</function>
</root>

View file

@ -0,0 +1,322 @@
;; From /home/murrayc/svn/gnome218/pango/pango/pango-attributes.h
(define-enum-extended AttrType
(in-module "Pango")
(c-name "PangoAttrType")
(values
'("invalid" "PANGO_ATTR_INVALID" "0")
'("language" "PANGO_ATTR_LANGUAGE" "1")
'("family" "PANGO_ATTR_FAMILY" "2")
'("style" "PANGO_ATTR_STYLE" "3")
'("weight" "PANGO_ATTR_WEIGHT" "4")
'("variant" "PANGO_ATTR_VARIANT" "5")
'("stretch" "PANGO_ATTR_STRETCH" "6")
'("size" "PANGO_ATTR_SIZE" "7")
'("font-desc" "PANGO_ATTR_FONT_DESC" "8")
'("foreground" "PANGO_ATTR_FOREGROUND" "9")
'("background" "PANGO_ATTR_BACKGROUND" "10")
'("underline" "PANGO_ATTR_UNDERLINE" "11")
'("strikethrough" "PANGO_ATTR_STRIKETHROUGH" "12")
'("rise" "PANGO_ATTR_RISE" "13")
'("shape" "PANGO_ATTR_SHAPE" "14")
'("scale" "PANGO_ATTR_SCALE" "15")
'("fallback" "PANGO_ATTR_FALLBACK" "16")
'("letter-spacing" "PANGO_ATTR_LETTER_SPACING" "17")
'("underline-color" "PANGO_ATTR_UNDERLINE_COLOR" "18")
'("strikethrough-color" "PANGO_ATTR_STRIKETHROUGH_COLOR" "19")
'("absolute-size" "PANGO_ATTR_ABSOLUTE_SIZE" "20")
'("gravity" "PANGO_ATTR_GRAVITY" "21")
'("gravity-hint" "PANGO_ATTR_GRAVITY_HINT" "22")
)
)
(define-enum-extended Underline
(in-module "Pango")
(c-name "PangoUnderline")
(values
'("none" "PANGO_UNDERLINE_NONE" "0")
'("single" "PANGO_UNDERLINE_SINGLE" "1")
'("double" "PANGO_UNDERLINE_DOUBLE" "2")
'("low" "PANGO_UNDERLINE_LOW" "3")
'("error" "PANGO_UNDERLINE_ERROR" "4")
)
)
;; From /home/murrayc/svn/gnome218/pango/pango/pango-coverage.h
(define-enum-extended CoverageLevel
(in-module "Pango")
(c-name "PangoCoverageLevel")
(values
'("none" "PANGO_COVERAGE_NONE" "0")
'("fallback" "PANGO_COVERAGE_FALLBACK" "1")
'("approximate" "PANGO_COVERAGE_APPROXIMATE" "2")
'("exact" "PANGO_COVERAGE_EXACT" "3")
)
)
;; From /home/murrayc/svn/gnome218/pango/pango/pango-font.h
(define-enum-extended Style
(in-module "Pango")
(c-name "PangoStyle")
(values
'("normal" "PANGO_STYLE_NORMAL" "0")
'("oblique" "PANGO_STYLE_OBLIQUE" "1")
'("italic" "PANGO_STYLE_ITALIC" "2")
)
)
(define-enum-extended Variant
(in-module "Pango")
(c-name "PangoVariant")
(values
'("normal" "PANGO_VARIANT_NORMAL" "0")
'("small-caps" "PANGO_VARIANT_SMALL_CAPS" "1")
)
)
(define-enum-extended Weight
(in-module "Pango")
(c-name "PangoWeight")
(values
'("ultralight" "PANGO_WEIGHT_ULTRALIGHT" "200")
'("light" "PANGO_WEIGHT_LIGHT" "300")
'("normal" "PANGO_WEIGHT_NORMAL" "400")
'("semibold" "PANGO_WEIGHT_SEMIBOLD" "600")
'("bold" "PANGO_WEIGHT_BOLD" "700")
'("ultrabold" "PANGO_WEIGHT_ULTRABOLD" "800")
'("heavy" "PANGO_WEIGHT_HEAVY" "900")
)
)
(define-enum-extended Stretch
(in-module "Pango")
(c-name "PangoStretch")
(values
'("ultra-condensed" "PANGO_STRETCH_ULTRA_CONDENSED" "0")
'("extra-condensed" "PANGO_STRETCH_EXTRA_CONDENSED" "1")
'("condensed" "PANGO_STRETCH_CONDENSED" "2")
'("semi-condensed" "PANGO_STRETCH_SEMI_CONDENSED" "3")
'("normal" "PANGO_STRETCH_NORMAL" "4")
'("semi-expanded" "PANGO_STRETCH_SEMI_EXPANDED" "5")
'("expanded" "PANGO_STRETCH_EXPANDED" "6")
'("extra-expanded" "PANGO_STRETCH_EXTRA_EXPANDED" "7")
'("ultra-expanded" "PANGO_STRETCH_ULTRA_EXPANDED" "8")
)
)
(define-flags-extended FontMask
(in-module "Pango")
(c-name "PangoFontMask")
(values
'("family" "PANGO_FONT_MASK_FAMILY" "1 << 0")
'("style" "PANGO_FONT_MASK_STYLE" "1 << 1")
'("variant" "PANGO_FONT_MASK_VARIANT" "1 << 2")
'("weight" "PANGO_FONT_MASK_WEIGHT" "1 << 3")
'("stretch" "PANGO_FONT_MASK_STRETCH" "1 << 4")
'("size" "PANGO_FONT_MASK_SIZE" "1 << 5")
'("gravity" "PANGO_FONT_MASK_GRAVITY" "1 << 6")
)
)
;; From /home/murrayc/svn/gnome218/pango/pango/pango-gravity.h
(define-enum-extended Gravity
(in-module "Pango")
(c-name "PangoGravity")
(values
'("south" "PANGO_GRAVITY_SOUTH" "0")
'("east" "PANGO_GRAVITY_EAST" "1")
'("north" "PANGO_GRAVITY_NORTH" "2")
'("west" "PANGO_GRAVITY_WEST" "3")
'("auto" "PANGO_GRAVITY_AUTO" "4")
)
)
(define-enum-extended GravityHint
(in-module "Pango")
(c-name "PangoGravityHint")
(values
'("natural" "PANGO_GRAVITY_HINT_NATURAL" "0")
'("strong" "PANGO_GRAVITY_HINT_STRONG" "1")
'("line" "PANGO_GRAVITY_HINT_LINE" "2")
)
)
;; From /home/murrayc/svn/gnome218/pango/pango/pango-layout.h
(define-enum-extended Alignment
(in-module "Pango")
(c-name "PangoAlignment")
(values
'("left" "PANGO_ALIGN_LEFT" "0")
'("center" "PANGO_ALIGN_CENTER" "1")
'("right" "PANGO_ALIGN_RIGHT" "2")
)
)
(define-enum-extended WrapMode
(in-module "Pango")
(c-name "PangoWrapMode")
(values
'("word" "PANGO_WRAP_WORD" "0")
'("char" "PANGO_WRAP_CHAR" "1")
'("word-char" "PANGO_WRAP_WORD_CHAR" "2")
)
)
(define-enum-extended EllipsizeMode
(in-module "Pango")
(c-name "PangoEllipsizeMode")
(values
'("none" "PANGO_ELLIPSIZE_NONE" "0")
'("start" "PANGO_ELLIPSIZE_START" "1")
'("middle" "PANGO_ELLIPSIZE_MIDDLE" "2")
'("end" "PANGO_ELLIPSIZE_END" "3")
)
)
;; From /home/murrayc/svn/gnome218/pango/pango/pango-ot.h
(define-enum-extended OTTableType
(in-module "Pango")
(c-name "PangoOTTableType")
(values
'("gsub" "PANGO_OT_TABLE_GSUB" "0")
'("gpos" "PANGO_OT_TABLE_GPOS" "1")
)
)
;; From /home/murrayc/svn/gnome218/pango/pango/pango-renderer.h
(define-enum-extended RenderPart
(in-module "Pango")
(c-name "PangoRenderPart")
(values
'("foreground" "PANGO_RENDER_PART_FOREGROUND" "0")
'("background" "PANGO_RENDER_PART_BACKGROUND" "1")
'("underline" "PANGO_RENDER_PART_UNDERLINE" "2")
'("strikethrough" "PANGO_RENDER_PART_STRIKETHROUGH" "3")
)
)
;; From /home/murrayc/svn/gnome218/pango/pango/pango-script.h
(define-enum-extended Script
(in-module "Pango")
(c-name "PangoScript")
(values
'("invalid-code" "PANGO_SCRIPT_INVALID_CODE" "-1")
'("common" "PANGO_SCRIPT_COMMON" "0")
'("inherited" "PANGO_SCRIPT_INHERITED" "1")
'("arabic" "PANGO_SCRIPT_ARABIC" "2")
'("armenian" "PANGO_SCRIPT_ARMENIAN" "3")
'("bengali" "PANGO_SCRIPT_BENGALI" "4")
'("bopomofo" "PANGO_SCRIPT_BOPOMOFO" "5")
'("cherokee" "PANGO_SCRIPT_CHEROKEE" "6")
'("coptic" "PANGO_SCRIPT_COPTIC" "7")
'("cyrillic" "PANGO_SCRIPT_CYRILLIC" "8")
'("deseret" "PANGO_SCRIPT_DESERET" "9")
'("devanagari" "PANGO_SCRIPT_DEVANAGARI" "10")
'("ethiopic" "PANGO_SCRIPT_ETHIOPIC" "11")
'("georgian" "PANGO_SCRIPT_GEORGIAN" "12")
'("gothic" "PANGO_SCRIPT_GOTHIC" "13")
'("greek" "PANGO_SCRIPT_GREEK" "14")
'("gujarati" "PANGO_SCRIPT_GUJARATI" "15")
'("gurmukhi" "PANGO_SCRIPT_GURMUKHI" "16")
'("han" "PANGO_SCRIPT_HAN" "17")
'("hangul" "PANGO_SCRIPT_HANGUL" "18")
'("hebrew" "PANGO_SCRIPT_HEBREW" "19")
'("hiragana" "PANGO_SCRIPT_HIRAGANA" "20")
'("kannada" "PANGO_SCRIPT_KANNADA" "21")
'("katakana" "PANGO_SCRIPT_KATAKANA" "22")
'("khmer" "PANGO_SCRIPT_KHMER" "23")
'("lao" "PANGO_SCRIPT_LAO" "24")
'("latin" "PANGO_SCRIPT_LATIN" "25")
'("malayalam" "PANGO_SCRIPT_MALAYALAM" "26")
'("mongolian" "PANGO_SCRIPT_MONGOLIAN" "27")
'("myanmar" "PANGO_SCRIPT_MYANMAR" "28")
'("ogham" "PANGO_SCRIPT_OGHAM" "29")
'("old-italic" "PANGO_SCRIPT_OLD_ITALIC" "30")
'("oriya" "PANGO_SCRIPT_ORIYA" "31")
'("runic" "PANGO_SCRIPT_RUNIC" "32")
'("sinhala" "PANGO_SCRIPT_SINHALA" "33")
'("syriac" "PANGO_SCRIPT_SYRIAC" "34")
'("tamil" "PANGO_SCRIPT_TAMIL" "35")
'("telugu" "PANGO_SCRIPT_TELUGU" "36")
'("thaana" "PANGO_SCRIPT_THAANA" "37")
'("thai" "PANGO_SCRIPT_THAI" "38")
'("tibetan" "PANGO_SCRIPT_TIBETAN" "39")
'("canadian-aboriginal" "PANGO_SCRIPT_CANADIAN_ABORIGINAL" "40")
'("yi" "PANGO_SCRIPT_YI" "41")
'("tagalog" "PANGO_SCRIPT_TAGALOG" "42")
'("hanunoo" "PANGO_SCRIPT_HANUNOO" "43")
'("buhid" "PANGO_SCRIPT_BUHID" "44")
'("tagbanwa" "PANGO_SCRIPT_TAGBANWA" "45")
'("braille" "PANGO_SCRIPT_BRAILLE" "46")
'("cypriot" "PANGO_SCRIPT_CYPRIOT" "47")
'("limbu" "PANGO_SCRIPT_LIMBU" "48")
'("osmanya" "PANGO_SCRIPT_OSMANYA" "49")
'("shavian" "PANGO_SCRIPT_SHAVIAN" "50")
'("linear-b" "PANGO_SCRIPT_LINEAR_B" "51")
'("tai-le" "PANGO_SCRIPT_TAI_LE" "52")
'("ugaritic" "PANGO_SCRIPT_UGARITIC" "53")
'("new-tai-lue" "PANGO_SCRIPT_NEW_TAI_LUE" "54")
'("buginese" "PANGO_SCRIPT_BUGINESE" "55")
'("glagolitic" "PANGO_SCRIPT_GLAGOLITIC" "56")
'("tifinagh" "PANGO_SCRIPT_TIFINAGH" "57")
'("syloti-nagri" "PANGO_SCRIPT_SYLOTI_NAGRI" "58")
'("old-persian" "PANGO_SCRIPT_OLD_PERSIAN" "59")
'("kharoshthi" "PANGO_SCRIPT_KHAROSHTHI" "60")
'("unknown" "PANGO_SCRIPT_UNKNOWN" "61")
'("balinese" "PANGO_SCRIPT_BALINESE" "62")
'("cuneiform" "PANGO_SCRIPT_CUNEIFORM" "63")
'("phoenician" "PANGO_SCRIPT_PHOENICIAN" "64")
'("phags-pa" "PANGO_SCRIPT_PHAGS_PA" "65")
'("nko" "PANGO_SCRIPT_NKO" "66")
)
)
;; From /home/murrayc/svn/gnome218/pango/pango/pango-tabs.h
(define-enum-extended TabAlign
(in-module "Pango")
(c-name "PangoTabAlign")
(values
'("t" "PANGO_TAB_LEFT" "0")
)
)
;; From /home/murrayc/svn/gnome218/pango/pango/pango-types.h
(define-enum-extended Direction
(in-module "Pango")
(c-name "PangoDirection")
(values
'("ltr" "PANGO_DIRECTION_LTR" "0")
'("rtl" "PANGO_DIRECTION_RTL" "1")
'("ttb-ltr" "PANGO_DIRECTION_TTB_LTR" "2")
'("ttb-rtl" "PANGO_DIRECTION_TTB_RTL" "3")
'("weak-ltr" "PANGO_DIRECTION_WEAK_LTR" "4")
'("weak-rtl" "PANGO_DIRECTION_WEAK_RTL" "5")
'("neutral" "PANGO_DIRECTION_NEUTRAL" "6")
)
)
;; From /home/murrayc/svn/gnome218/pango/pango/pangowin32-private.h
(define-enum-extended Win32CoverageLanguageClass
(in-module "Pango")
(c-name "PangoWin32CoverageLanguageClass")
(values
'("coverage-unspec" "PANGO_WIN32_COVERAGE_UNSPEC" "0")
'("coverage-zh-tw" "PANGO_WIN32_COVERAGE_ZH_TW" "1")
'("coverage-zh-cn" "PANGO_WIN32_COVERAGE_ZH_CN" "2")
'("coverage-ja" "PANGO_WIN32_COVERAGE_JA" "3")
'("coverage-ko" "PANGO_WIN32_COVERAGE_KO" "4")
'("coverage-vi" "PANGO_WIN32_COVERAGE_VI" "5")
'("n-coverages" "PANGO_WIN32_N_COVERAGES" "6")
)
)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,17 @@
;; -*- scheme -*-
; virtual function definitions
; define-vfunc is gtkmm-specific
; PangoFontFace
(define-vfunc get_face_name
(of-object "PangoFontFace")
(return-type "const-gchar*")
)
(define-vfunc describe
(of-object "PangoFontFace")
(return-type "PangoFontDescription*")
)

View file

@ -0,0 +1,65 @@
/* Copyright (C) 2002 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
namespace Pango
{
Rectangle::Rectangle()
{
gobject_.x = gobject_.y = 0;
gobject_.width = gobject_.height = 0;
}
Rectangle::Rectangle(int x, int y, int width, int height)
{
gobject_.x = x;
gobject_.y = y;
gobject_.width = width;
gobject_.height = height;
}
Rectangle::Rectangle(const PangoRectangle* src)
{
gobject_.x = src->x;
gobject_.y = src->y;
gobject_.width = src->width;
gobject_.height = src->height;
}
bool Rectangle::equal(const Rectangle& rhs) const
{
return (get_x() == rhs.get_x() && get_y() == rhs.get_y() &&
get_width() == rhs.get_width() && get_height() == rhs.get_height());
}
} /* namespace Pango */
namespace Glib
{
Pango::Rectangle& wrap(PangoRectangle* object)
{
return *reinterpret_cast<Pango::Rectangle*>(object);
}
const Pango::Rectangle& wrap(const PangoRectangle* object)
{
return *reinterpret_cast<const Pango::Rectangle*>(object);
}
} /* namespace Glib */

View file

@ -0,0 +1,145 @@
/* Copyright (C) 2002 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <pango/pango-types.h>
_DEFS(pangomm,pango)
namespace Pango
{
/** A Pango::Rectangle represents a rectangle.
* It is frequently used to represent the logical or ink extents of a single glyph or section of text.
* The coordinate system for each rectangle has its origin at the base line and the horizontal
* origin of the character with increasing coordinates extending to the right and down.
* get_ascent(), get_descent(), get_lbearing(), and get_rbearing() can be used to convert
* from the extents rectangle to more traditional font metrics.
* The units of rectangles usually are in 1/Pango::SCALE of a device unit.
*/
class Rectangle
{
_CLASS_GENERIC(Rectangle, PangoRectangle)
public:
Rectangle();
Rectangle(int x, int y, int width, int height);
explicit Rectangle(const PangoRectangle* src);
/** Sets the X coordinate of the left side of the rectangle.
* @param x The new X coordinate.
*/
void set_x(int x) { gobject_.x = x; }
/** Sets the Y coordinate of the top side of the rectangle.
* @param y The new Y coordinate.
*/
void set_y(int y) { gobject_.y = y; }
/** Sets the width of the rectangle.
* @param w The new width.
*/
void set_width(int w) { gobject_.width = w; }
/** Sets the height of the rectangle.
* @param h The new height.
*/
void set_height(int h) { gobject_.height = h; }
/** Gets the X coordinate of the left side of the rectangle.
* @return The X coordinate.
*/
int get_x() const { return gobject_.x; }
/** Gets the Y coordinate of the top side of the rectangle.
* @return The Y coordinate.
*/
int get_y() const { return gobject_.y; }
/** Gets the width of the rectangle.
* @return The width.
*/
int get_width() const { return gobject_.width; }
/** Gets the height of the rectangle.
* @return The height.
*/
int get_height() const { return gobject_.height; }
/** Extracts the ascent from a Pango::Rectangle representing glyph extents.
* The ascent is the distance from the baseline to the highest point of the character.
* This is positive if the glyph ascends above the baseline.
* @return The ascent of the character.
*/
int get_ascent() const { return PANGO_ASCENT(*gobj()); }
/** Extracts the descent from a Pango::Rectangle representing glyph extents.
* The descent is the distance from the baseline to the lowest point of the character.
* This is positive if the glyph descends below the baseline.
* @return The descent of the character.
*/
int get_descent() const { return PANGO_DESCENT(*gobj()); }
/** Extracts the left bearing from a Pango::Rectangle representing glyph extents.
* The left bearing is the distance from the horizontal origin to the farthest left point of the character.
* This is positive for characters drawn completely to the right of the glyph origin.
* @return The left bearing of the character.
*/
int get_lbearing() const { return PANGO_LBEARING(*gobj()); }
/** Extracts the right bearing from a Pango::Rectangle representing glyph extents.
* The right bearing is the distance from the horizontal origin to the farthest right point of the character.
* This is positive except for characters drawn completely to the left of the horizontal origin.
* @return The right bearing of the character.
*/
int get_rbearing() const { return PANGO_RBEARING(*gobj()); }
/** Checks for equality of two Pango::Rectangles.
* @param rhs The Pango::Rectangle to compare with.
* @return true if @a rhs is equal with the rectangle.
*/
bool equal(const Rectangle& rhs) const;
/// Provides access to the underlying C GObject.
PangoRectangle* gobj() { return &gobject_; }
/// Provides access to the underlying C GObject.
const PangoRectangle* gobj() const { return &gobject_; }
protected:
PangoRectangle gobject_;
};
/** @relates Pango::Rectangle */
inline bool operator==(const Rectangle& lhs, const Rectangle& rhs)
{ return lhs.equal(rhs); }
/** @relates Pango::Rectangle */
inline bool operator!=(const Rectangle& lhs, const Rectangle& rhs)
{ return !lhs.equal(rhs); }
} /* namespace Pango */
namespace Glib
{
/** @relates Pango::Rectangle */
Pango::Rectangle& wrap(PangoRectangle* object);
/** @relates Pango::Rectangle */
const Pango::Rectangle& wrap(const PangoRectangle* object);
} /* namespace Glib */

View file

@ -0,0 +1,41 @@
// -*- c++ -*-
/* $Id: renderer.ccg,v 1.2 2006/06/10 15:26:24 murrayc Exp $ */
/*
*
* Copyright 2004 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <pango/pango-renderer.h>
#include <pango/pango-types.h> //For PANGO_MATRIX_INIT
namespace Pango
{
Matrix Renderer::get_matrix() const
{
const PangoMatrix* matrix = pango_renderer_get_matrix(const_cast<PangoRenderer*>(gobj()));
if(matrix)
return *matrix;
else
{
PangoMatrix identity_transform = PANGO_MATRIX_INIT;
return identity_transform;
}
}
} /* namespace Pango */

View file

@ -0,0 +1,75 @@
/* $Id: renderer.hg,v 1.4 2006/06/10 15:26:24 murrayc Exp $ */
/* renderer.h
*
* Copyright(C) 2004 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/object.h>
#include <pangomm/context.h>
#include <pangomm/glyphstring.h>
#include <pangomm/layout.h>
#include <pangomm/layoutline.h>
_DEFS(pangomm,pango)
_PINCLUDE(glibmm/private/object_p.h)
namespace Pango
{
_CC_INCLUDE(pango/pango-enum-types.h)
_WRAP_ENUM(RenderPart, PangoRenderPart)
/** Pango::Renderer is a base class that contains the necessary logic for rendering a Pango::Layout or Pango::LayoutLine.
* By subclassing Pango::Renderer and overriding operations such as draw_glyphs and draw_rectangle,
* renderers for particular font backends and destinations can be created.
*/
class Renderer : public Glib::Object
{
_CLASS_GOBJECT(Renderer, PangoRenderer, PANGO_RENDERER, Glib::Object, GObject)
protected:
public:
_WRAP_METHOD(void draw_layout(const Glib::RefPtr<Layout>& layout, int x, int y), pango_renderer_draw_layout)
_WRAP_METHOD(void draw_layout_line(const Glib::RefPtr<LayoutLine>& line, int x, int y), pango_renderer_draw_layout_line)
_WRAP_METHOD(void draw_glyphs(const Glib::RefPtr<Font>& font, const GlyphString& glyphs, int x, int y), pango_renderer_draw_glyphs)
_WRAP_METHOD(void draw_rectangle(RenderPart part, int x, int y, int width, int height), pango_renderer_draw_rectangle)
_WRAP_METHOD(void draw_error_underline(int x, int y, int width, int height), pango_renderer_draw_error_underline)
_WRAP_METHOD(void draw_trapezoid(RenderPart part, double y1, double x11, double x21, double y2, double x12, double x22), pango_renderer_draw_trapezoid)
_WRAP_METHOD(void draw_glyph(const Glib::RefPtr<Font>& font, Glyph glyph, double x, double y), pango_renderer_draw_glyph)
_WRAP_METHOD(void activate(), pango_renderer_activate)
_WRAP_METHOD(void deactivate(), pango_renderer_deactivate)
_WRAP_METHOD(void part_changed(RenderPart part), pango_renderer_part_changed)
_WRAP_METHOD(void set_color(RenderPart part, const Color& color), pango_renderer_set_color)
#m4 _CONVERSION(`PangoColor*',`Color',`Color($3)')
_WRAP_METHOD(Color get_color(RenderPart part) const, pango_renderer_get_color)
_WRAP_METHOD(void set_matrix(const Matrix& matrix), pango_renderer_set_matrix)
Matrix get_matrix() const;
_IGNORE(pango_renderer_get_matrix)
};
} /* namespace Pango */

View file

@ -0,0 +1,76 @@
// -*- c++ -*-
/* $Id: tabarray.ccg,v 1.2 2006/07/05 18:46:36 markoa Exp $ */
/*
*
* Copyright 2002 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
namespace Pango
{
TabArray::TabArray(int initial_size, bool positions_in_pixels)
{
gobject_ = pango_tab_array_new(initial_size, (gboolean)positions_in_pixels);
}
std::pair<TabAlign,int> TabArray::get_tab(int tab_index) const
{
PangoTabAlign p_alignment;
TabAlign alignment;
int location;
pango_tab_array_get_tab(const_cast<PangoTabArray*>(gobj()), tab_index, &p_alignment, &location);
alignment = static_cast<TabAlign>(p_alignment);
return std::pair<TabAlign,int>(alignment, location);
}
Glib::ArrayHandle< std::pair<TabAlign,int> > TabArray::get_tabs() const
{
typedef std::pair<TabAlign,int> PairType;
PairType* pair_buffer = 0;
const int size = pango_tab_array_get_size(const_cast<PangoTabArray*>(gobj()));
if(size > 0)
{
// Get arrays
PangoTabAlign* pAlignments = 0;
int* pLocations = 0;
pango_tab_array_get_tabs(const_cast<PangoTabArray*>(gobj()), &pAlignments, &pLocations);
if(pAlignments && pLocations)
{
// Create temporary C array. Fortunately, the C++ type is POD,
// so we can safely store it in the array.
pair_buffer = g_new(PairType, size);
for(int i = 0; i < size; ++i)
{
pair_buffer[i].first = (TabAlign)(pAlignments[i]);
pair_buffer[i].second = pLocations[i];
}
}
g_free(pAlignments);
g_free(pLocations);
}
return Glib::ArrayHandle<PairType>(pair_buffer, size, Glib::OWNERSHIP_SHALLOW);
}
} /* namespace Pango */

View file

@ -0,0 +1,67 @@
/* $Id: tabarray.hg,v 1.2 2003/01/22 12:10:11 murrayc Exp $ */
/* tabarray.h
*
* Copyright (C) 1998-1999 The gtkmm Development Team
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <pangomm/attrlist.h>
#include <pango/pango-tabs.h>
#include <pango/pango-break.h> //For PangoLogAttrs.
#include <utility>
#include <glibmmconfig.h>
GLIBMM_USING_STD(pair)
_DEFS(pangomm,pango)
namespace Pango
{
_CC_INCLUDE(pango/pango-enum-types.h)
_WRAP_ENUM(TabAlign, PangoTabAlign)
/** A Pango::TabArray contains an array of tab stops.
* Each tab stop has an alignment and a position.
*/
class TabArray
{
_CLASS_BOXEDTYPE(TabArray, PangoTabArray, NONE, pango_tab_array_copy, pango_tab_array_free)
_IGNORE(pango_tab_array_free, pango_tab_array_copy, pango_tab_array_get_tab, pango_tab_array_get_tabs, pango_tab_array_new_with_positions)
public:
explicit TabArray(int initial_size, bool positions_in_pixels = true);
_WRAP_METHOD(int get_size() const, pango_tab_array_get_size)
_WRAP_METHOD(void resize(int new_size), pango_tab_array_resize)
_WRAP_METHOD(void set_tab(int tab_index, TabAlign alignment, int location), pango_tab_array_set_tab)
/** Gets the alignment and position of a tab stop.
* @return An std::pair<TabAlign, int>. The first element represents the tab stop alignment, the second one is the tab position.
*/
std::pair<TabAlign,int> get_tab(int tab_index) const;
/** Gets an array of std::pairs containing the tab stop alignments and tab positions.
* @return An array of std::pair<TabAlign, int>. The first element in each pair represents the tab stop alignment, the second one is the tab position.
*/
Glib::ArrayHandle< std::pair<TabAlign,int> > get_tabs() const;
_WRAP_METHOD(bool get_positions_in_pixels() const, pango_tab_array_get_positions_in_pixels)
};
} //namespace Pango