[hb-old] Start adding HarfBuzz-old as a new backend
This commit is contained in:
parent
478fd0529b
commit
1512a73575
|
@ -219,6 +219,7 @@ Makefile
|
||||||
harfbuzz.pc
|
harfbuzz.pc
|
||||||
src/Makefile
|
src/Makefile
|
||||||
src/hb-version.h
|
src/hb-version.h
|
||||||
|
src/hb-old/Makefile
|
||||||
util/Makefile
|
util/Makefile
|
||||||
test/Makefile
|
test/Makefile
|
||||||
test/api/Makefile
|
test/api/Makefile
|
||||||
|
|
|
@ -8,6 +8,9 @@ DISTCLEANFILES =
|
||||||
MAINTAINERCLEANFILES =
|
MAINTAINERCLEANFILES =
|
||||||
DISTCHECK_CONFIGURE_FLAGS = --enable-introspection
|
DISTCHECK_CONFIGURE_FLAGS = --enable-introspection
|
||||||
|
|
||||||
|
SUBDIRS = hb-old
|
||||||
|
DIST_SUBDIRS = hb-old
|
||||||
|
|
||||||
# The following warning options are useful for debugging: -Wpadded
|
# The following warning options are useful for debugging: -Wpadded
|
||||||
#AM_CXXFLAGS =
|
#AM_CXXFLAGS =
|
||||||
|
|
||||||
|
@ -145,6 +148,8 @@ HBSOURCES += hb-coretext.cc hb-coretext-private.hh
|
||||||
HBHEADERS += hb-coretext.h
|
HBHEADERS += hb-coretext.h
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
HBLIBS += hb-old/libhb-old.la
|
||||||
|
|
||||||
# Use a C linker, not C++; Don't link to libstdc++
|
# Use a C linker, not C++; Don't link to libstdc++
|
||||||
libharfbuzz_la_LINK = $(LINK) $(libharfbuzz_la_LDFLAGS)
|
libharfbuzz_la_LINK = $(LINK) $(libharfbuzz_la_LDFLAGS)
|
||||||
libharfbuzz_la_SOURCES = $(HBSOURCES) $(HBHEADERS)
|
libharfbuzz_la_SOURCES = $(HBSOURCES) $(HBHEADERS)
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
*.o
|
||||||
|
*.lo
|
||||||
|
Makefile
|
||||||
|
*.la
|
||||||
|
.deps
|
||||||
|
.libs
|
||||||
|
*~
|
|
@ -0,0 +1,24 @@
|
||||||
|
HarfBuzz-old was previously licensed under different licenses. This was
|
||||||
|
changed in January 2008. If you need to relicense your old copies,
|
||||||
|
consult the announcement of the license change on the internet.
|
||||||
|
Other than that, each copy of HarfBuzz-old is licensed under the COPYING
|
||||||
|
file included with it. The actual license follows:
|
||||||
|
|
||||||
|
|
||||||
|
Permission is hereby granted, without written agreement and without
|
||||||
|
license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
software and its documentation for any purpose, provided that the
|
||||||
|
above copyright notice and the following two paragraphs appear in
|
||||||
|
all copies of this software.
|
||||||
|
|
||||||
|
IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
DAMAGE.
|
||||||
|
|
||||||
|
THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
|
@ -0,0 +1,56 @@
|
||||||
|
## Process this file with automake to produce Makefile.in
|
||||||
|
|
||||||
|
noinst_LTLIBRARIES = libhb-old.la
|
||||||
|
|
||||||
|
MAINSOURCES = \
|
||||||
|
harfbuzz-buffer.c \
|
||||||
|
harfbuzz-stream.c \
|
||||||
|
harfbuzz-gdef.c \
|
||||||
|
harfbuzz-gpos.c \
|
||||||
|
harfbuzz-gsub.c \
|
||||||
|
harfbuzz-impl.c \
|
||||||
|
harfbuzz-open.c \
|
||||||
|
harfbuzz-shaper.cpp \
|
||||||
|
harfbuzz-greek.c \
|
||||||
|
harfbuzz-tibetan.c \
|
||||||
|
harfbuzz-khmer.c \
|
||||||
|
harfbuzz-indic.cpp \
|
||||||
|
harfbuzz-hebrew.c \
|
||||||
|
harfbuzz-arabic.c \
|
||||||
|
harfbuzz-hangul.c \
|
||||||
|
harfbuzz-myanmar.c \
|
||||||
|
harfbuzz-thai.c
|
||||||
|
|
||||||
|
EXTRA_SOURCES = harfbuzz.c
|
||||||
|
|
||||||
|
PUBLICHEADERS = \
|
||||||
|
harfbuzz.h \
|
||||||
|
harfbuzz-buffer.h \
|
||||||
|
harfbuzz-gdef.h \
|
||||||
|
harfbuzz-gpos.h \
|
||||||
|
harfbuzz-gsub.h \
|
||||||
|
harfbuzz-open.h \
|
||||||
|
harfbuzz-global.h \
|
||||||
|
harfbuzz-external.h \
|
||||||
|
harfbuzz-shaper.h \
|
||||||
|
harfbuzz-stream.h
|
||||||
|
|
||||||
|
PRIVATEHEADERS = \
|
||||||
|
harfbuzz-impl.h \
|
||||||
|
harfbuzz-buffer-private.h \
|
||||||
|
harfbuzz-stream-private.h \
|
||||||
|
harfbuzz-gdef-private.h \
|
||||||
|
harfbuzz-gpos-private.h \
|
||||||
|
harfbuzz-gsub-private.h \
|
||||||
|
harfbuzz-open-private.h \
|
||||||
|
harfbuzz-shaper-private.h
|
||||||
|
|
||||||
|
libhb_old_la_SOURCES = \
|
||||||
|
$(MAINSOURCES) \
|
||||||
|
$(PUBLICHEADERS) \
|
||||||
|
$(PRIVATEHEADERS)
|
||||||
|
|
||||||
|
EXTRA_DIST = \
|
||||||
|
README \
|
||||||
|
COPYING \
|
||||||
|
$(EXTRA_SOURCES)
|
|
@ -0,0 +1,631 @@
|
||||||
|
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||||
|
# @configure_input@
|
||||||
|
|
||||||
|
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||||
|
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@
|
||||||
|
|
||||||
|
VPATH = @srcdir@
|
||||||
|
pkgdatadir = $(datadir)/@PACKAGE@
|
||||||
|
pkgincludedir = $(includedir)/@PACKAGE@
|
||||||
|
pkglibdir = $(libdir)/@PACKAGE@
|
||||||
|
pkglibexecdir = $(libexecdir)/@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@
|
||||||
|
subdir = src/hb-old
|
||||||
|
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
|
||||||
|
COPYING
|
||||||
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
|
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||||
|
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||||
|
$(ACLOCAL_M4)
|
||||||
|
mkinstalldirs = $(install_sh) -d
|
||||||
|
CONFIG_HEADER = $(top_builddir)/config.h
|
||||||
|
CONFIG_CLEAN_FILES =
|
||||||
|
CONFIG_CLEAN_VPATH_FILES =
|
||||||
|
LTLIBRARIES = $(noinst_LTLIBRARIES)
|
||||||
|
libhb_old_la_LIBADD =
|
||||||
|
am__objects_1 = harfbuzz-buffer.lo harfbuzz-stream.lo harfbuzz-gdef.lo \
|
||||||
|
harfbuzz-gpos.lo harfbuzz-gsub.lo harfbuzz-impl.lo \
|
||||||
|
harfbuzz-open.lo harfbuzz-shaper.lo harfbuzz-greek.lo \
|
||||||
|
harfbuzz-tibetan.lo harfbuzz-khmer.lo harfbuzz-indic.lo \
|
||||||
|
harfbuzz-hebrew.lo harfbuzz-arabic.lo harfbuzz-hangul.lo \
|
||||||
|
harfbuzz-myanmar.lo harfbuzz-thai.lo
|
||||||
|
am__objects_2 =
|
||||||
|
am_libhb_old_la_OBJECTS = $(am__objects_1) $(am__objects_2) \
|
||||||
|
$(am__objects_2)
|
||||||
|
libhb_old_la_OBJECTS = $(am_libhb_old_la_OBJECTS)
|
||||||
|
AM_V_lt = $(am__v_lt_$(V))
|
||||||
|
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
|
||||||
|
am__v_lt_0 = --silent
|
||||||
|
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||||
|
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||||
|
am__depfiles_maybe = depfiles
|
||||||
|
am__mv = mv -f
|
||||||
|
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||||
|
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||||
|
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||||
|
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
|
||||||
|
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||||
|
$(AM_CFLAGS) $(CFLAGS)
|
||||||
|
AM_V_CC = $(am__v_CC_$(V))
|
||||||
|
am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
|
||||||
|
am__v_CC_0 = @echo " CC " $@;
|
||||||
|
AM_V_at = $(am__v_at_$(V))
|
||||||
|
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
|
||||||
|
am__v_at_0 = @
|
||||||
|
CCLD = $(CC)
|
||||||
|
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||||
|
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||||
|
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||||
|
AM_V_CCLD = $(am__v_CCLD_$(V))
|
||||||
|
am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
|
||||||
|
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||||
|
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
||||||
|
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
||||||
|
LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
|
||||||
|
$(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
|
||||||
|
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||||
|
$(AM_CXXFLAGS) $(CXXFLAGS)
|
||||||
|
AM_V_CXX = $(am__v_CXX_$(V))
|
||||||
|
am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY))
|
||||||
|
am__v_CXX_0 = @echo " CXX " $@;
|
||||||
|
CXXLD = $(CXX)
|
||||||
|
CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
|
||||||
|
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
|
||||||
|
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||||
|
AM_V_CXXLD = $(am__v_CXXLD_$(V))
|
||||||
|
am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY))
|
||||||
|
am__v_CXXLD_0 = @echo " CXXLD " $@;
|
||||||
|
AM_V_GEN = $(am__v_GEN_$(V))
|
||||||
|
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
|
||||||
|
am__v_GEN_0 = @echo " GEN " $@;
|
||||||
|
SOURCES = $(libhb_old_la_SOURCES)
|
||||||
|
DIST_SOURCES = $(libhb_old_la_SOURCES)
|
||||||
|
ETAGS = etags
|
||||||
|
CTAGS = ctags
|
||||||
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
|
ACLOCAL = @ACLOCAL@
|
||||||
|
AMTAR = @AMTAR@
|
||||||
|
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||||
|
AR = @AR@
|
||||||
|
AUTOCONF = @AUTOCONF@
|
||||||
|
AUTOHEADER = @AUTOHEADER@
|
||||||
|
AUTOMAKE = @AUTOMAKE@
|
||||||
|
AWK = @AWK@
|
||||||
|
CAIRO_CFLAGS = @CAIRO_CFLAGS@
|
||||||
|
CAIRO_FT_CFLAGS = @CAIRO_FT_CFLAGS@
|
||||||
|
CAIRO_FT_LIBS = @CAIRO_FT_LIBS@
|
||||||
|
CAIRO_LIBS = @CAIRO_LIBS@
|
||||||
|
CC = @CC@
|
||||||
|
CCDEPMODE = @CCDEPMODE@
|
||||||
|
CFLAGS = @CFLAGS@
|
||||||
|
CORETEXT_CFLAGS = @CORETEXT_CFLAGS@
|
||||||
|
CORETEXT_LIBS = @CORETEXT_LIBS@
|
||||||
|
CPP = @CPP@
|
||||||
|
CPPFLAGS = @CPPFLAGS@
|
||||||
|
CXX = @CXX@
|
||||||
|
CXXCPP = @CXXCPP@
|
||||||
|
CXXDEPMODE = @CXXDEPMODE@
|
||||||
|
CXXFLAGS = @CXXFLAGS@
|
||||||
|
CYGPATH_W = @CYGPATH_W@
|
||||||
|
DEFS = @DEFS@
|
||||||
|
DEPDIR = @DEPDIR@
|
||||||
|
DSYMUTIL = @DSYMUTIL@
|
||||||
|
DUMPBIN = @DUMPBIN@
|
||||||
|
ECHO_C = @ECHO_C@
|
||||||
|
ECHO_N = @ECHO_N@
|
||||||
|
ECHO_T = @ECHO_T@
|
||||||
|
EGREP = @EGREP@
|
||||||
|
EXEEXT = @EXEEXT@
|
||||||
|
FGREP = @FGREP@
|
||||||
|
FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
|
||||||
|
FREETYPE_LIBS = @FREETYPE_LIBS@
|
||||||
|
GLIB_CFLAGS = @GLIB_CFLAGS@
|
||||||
|
GLIB_LIBS = @GLIB_LIBS@
|
||||||
|
GLIB_MKENUMS = @GLIB_MKENUMS@
|
||||||
|
GOBJECT_CFLAGS = @GOBJECT_CFLAGS@
|
||||||
|
GOBJECT_LIBS = @GOBJECT_LIBS@
|
||||||
|
GRAPHITE2_CFLAGS = @GRAPHITE2_CFLAGS@
|
||||||
|
GRAPHITE2_LIBS = @GRAPHITE2_LIBS@
|
||||||
|
GREP = @GREP@
|
||||||
|
GTHREAD_CFLAGS = @GTHREAD_CFLAGS@
|
||||||
|
GTHREAD_LIBS = @GTHREAD_LIBS@
|
||||||
|
HB_LIBTOOL_VERSION_INFO = @HB_LIBTOOL_VERSION_INFO@
|
||||||
|
HB_VERSION = @HB_VERSION@
|
||||||
|
HB_VERSION_MAJOR = @HB_VERSION_MAJOR@
|
||||||
|
HB_VERSION_MICRO = @HB_VERSION_MICRO@
|
||||||
|
HB_VERSION_MINOR = @HB_VERSION_MINOR@
|
||||||
|
ICU_CFLAGS = @ICU_CFLAGS@
|
||||||
|
ICU_LIBS = @ICU_LIBS@
|
||||||
|
INSTALL = @INSTALL@
|
||||||
|
INSTALL_DATA = @INSTALL_DATA@
|
||||||
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||||
|
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||||
|
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||||
|
LD = @LD@
|
||||||
|
LDFLAGS = @LDFLAGS@
|
||||||
|
LIBOBJS = @LIBOBJS@
|
||||||
|
LIBS = @LIBS@
|
||||||
|
LIBTOOL = @LIBTOOL@
|
||||||
|
LIPO = @LIPO@
|
||||||
|
LN_S = @LN_S@
|
||||||
|
LTLIBOBJS = @LTLIBOBJS@
|
||||||
|
MAKEINFO = @MAKEINFO@
|
||||||
|
MKDIR_P = @MKDIR_P@
|
||||||
|
NM = @NM@
|
||||||
|
NMEDIT = @NMEDIT@
|
||||||
|
OBJDUMP = @OBJDUMP@
|
||||||
|
OBJEXT = @OBJEXT@
|
||||||
|
OTOOL = @OTOOL@
|
||||||
|
OTOOL64 = @OTOOL64@
|
||||||
|
PACKAGE = @PACKAGE@
|
||||||
|
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||||
|
PACKAGE_NAME = @PACKAGE_NAME@
|
||||||
|
PACKAGE_STRING = @PACKAGE_STRING@
|
||||||
|
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||||
|
PACKAGE_URL = @PACKAGE_URL@
|
||||||
|
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||||
|
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||||
|
PKG_CONFIG = @PKG_CONFIG@
|
||||||
|
RANLIB = @RANLIB@
|
||||||
|
SED = @SED@
|
||||||
|
SET_MAKE = @SET_MAKE@
|
||||||
|
SHELL = @SHELL@
|
||||||
|
STRIP = @STRIP@
|
||||||
|
UNISCRIBE_CFLAGS = @UNISCRIBE_CFLAGS@
|
||||||
|
UNISCRIBE_LIBS = @UNISCRIBE_LIBS@
|
||||||
|
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_DUMPBIN = @ac_ct_DUMPBIN@
|
||||||
|
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@
|
||||||
|
lt_ECHO = @lt_ECHO@
|
||||||
|
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_build_prefix = @top_build_prefix@
|
||||||
|
top_builddir = @top_builddir@
|
||||||
|
top_srcdir = @top_srcdir@
|
||||||
|
noinst_LTLIBRARIES = libhb-old.la
|
||||||
|
MAINSOURCES = \
|
||||||
|
harfbuzz-buffer.c \
|
||||||
|
harfbuzz-stream.c \
|
||||||
|
harfbuzz-gdef.c \
|
||||||
|
harfbuzz-gpos.c \
|
||||||
|
harfbuzz-gsub.c \
|
||||||
|
harfbuzz-impl.c \
|
||||||
|
harfbuzz-open.c \
|
||||||
|
harfbuzz-shaper.cpp \
|
||||||
|
harfbuzz-greek.c \
|
||||||
|
harfbuzz-tibetan.c \
|
||||||
|
harfbuzz-khmer.c \
|
||||||
|
harfbuzz-indic.cpp \
|
||||||
|
harfbuzz-hebrew.c \
|
||||||
|
harfbuzz-arabic.c \
|
||||||
|
harfbuzz-hangul.c \
|
||||||
|
harfbuzz-myanmar.c \
|
||||||
|
harfbuzz-thai.c
|
||||||
|
|
||||||
|
EXTRA_SOURCES = harfbuzz.c
|
||||||
|
PUBLICHEADERS = \
|
||||||
|
harfbuzz.h \
|
||||||
|
harfbuzz-buffer.h \
|
||||||
|
harfbuzz-gdef.h \
|
||||||
|
harfbuzz-gpos.h \
|
||||||
|
harfbuzz-gsub.h \
|
||||||
|
harfbuzz-open.h \
|
||||||
|
harfbuzz-global.h \
|
||||||
|
harfbuzz-external.h \
|
||||||
|
harfbuzz-shaper.h \
|
||||||
|
harfbuzz-stream.h
|
||||||
|
|
||||||
|
PRIVATEHEADERS = \
|
||||||
|
harfbuzz-impl.h \
|
||||||
|
harfbuzz-buffer-private.h \
|
||||||
|
harfbuzz-stream-private.h \
|
||||||
|
harfbuzz-gdef-private.h \
|
||||||
|
harfbuzz-gpos-private.h \
|
||||||
|
harfbuzz-gsub-private.h \
|
||||||
|
harfbuzz-open-private.h \
|
||||||
|
harfbuzz-shaper-private.h
|
||||||
|
|
||||||
|
libhb_old_la_SOURCES = \
|
||||||
|
$(MAINSOURCES) \
|
||||||
|
$(PUBLICHEADERS) \
|
||||||
|
$(PRIVATEHEADERS)
|
||||||
|
|
||||||
|
EXTRA_DIST = \
|
||||||
|
README \
|
||||||
|
COPYING \
|
||||||
|
$(EXTRA_SOURCES)
|
||||||
|
|
||||||
|
all: all-am
|
||||||
|
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .c .cpp .lo .o .obj
|
||||||
|
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||||
|
@for dep in $?; do \
|
||||||
|
case '$(am__configure_deps)' in \
|
||||||
|
*$$dep*) \
|
||||||
|
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||||
|
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||||
|
exit 1;; \
|
||||||
|
esac; \
|
||||||
|
done; \
|
||||||
|
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/hb-old/Makefile'; \
|
||||||
|
$(am__cd) $(top_srcdir) && \
|
||||||
|
$(AUTOMAKE) --gnu src/hb-old/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: $(am__configure_deps)
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
|
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
|
$(am__aclocal_m4_deps):
|
||||||
|
|
||||||
|
clean-noinstLTLIBRARIES:
|
||||||
|
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
|
||||||
|
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
|
||||||
|
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
|
||||||
|
test "$$dir" != "$$p" || dir=.; \
|
||||||
|
echo "rm -f \"$${dir}/so_locations\""; \
|
||||||
|
rm -f "$${dir}/so_locations"; \
|
||||||
|
done
|
||||||
|
libhb-old.la: $(libhb_old_la_OBJECTS) $(libhb_old_la_DEPENDENCIES)
|
||||||
|
$(AM_V_CXXLD)$(CXXLINK) $(libhb_old_la_OBJECTS) $(libhb_old_la_LIBADD) $(LIBS)
|
||||||
|
|
||||||
|
mostlyclean-compile:
|
||||||
|
-rm -f *.$(OBJEXT)
|
||||||
|
|
||||||
|
distclean-compile:
|
||||||
|
-rm -f *.tab.c
|
||||||
|
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/harfbuzz-arabic.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/harfbuzz-buffer.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/harfbuzz-gdef.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/harfbuzz-gpos.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/harfbuzz-greek.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/harfbuzz-gsub.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/harfbuzz-hangul.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/harfbuzz-hebrew.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/harfbuzz-impl.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/harfbuzz-indic.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/harfbuzz-khmer.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/harfbuzz-myanmar.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/harfbuzz-open.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/harfbuzz-shaper.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/harfbuzz-stream.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/harfbuzz-thai.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/harfbuzz-tibetan.Plo@am__quote@
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||||
|
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||||
|
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||||
|
|
||||||
|
.c.obj:
|
||||||
|
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||||
|
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||||
|
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||||
|
|
||||||
|
.c.lo:
|
||||||
|
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||||
|
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
|
||||||
|
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
|
||||||
|
|
||||||
|
.cpp.o:
|
||||||
|
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||||
|
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||||
|
@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
|
||||||
|
|
||||||
|
.cpp.obj:
|
||||||
|
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||||
|
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||||
|
@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
|
||||||
|
|
||||||
|
.cpp.lo:
|
||||||
|
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||||
|
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
|
||||||
|
@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
|
||||||
|
|
||||||
|
mostlyclean-libtool:
|
||||||
|
-rm -f *.lo
|
||||||
|
|
||||||
|
clean-libtool:
|
||||||
|
-rm -rf .libs _libs
|
||||||
|
|
||||||
|
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||||
|
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||||
|
unique=`for i in $$list; do \
|
||||||
|
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||||
|
done | \
|
||||||
|
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||||
|
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||||
|
mkid -fID $$unique
|
||||||
|
tags: TAGS
|
||||||
|
|
||||||
|
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||||
|
$(TAGS_FILES) $(LISP)
|
||||||
|
set x; \
|
||||||
|
here=`pwd`; \
|
||||||
|
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||||
|
unique=`for i in $$list; do \
|
||||||
|
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||||
|
done | \
|
||||||
|
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||||
|
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||||
|
shift; \
|
||||||
|
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||||
|
test -n "$$unique" || unique=$$empty_fix; \
|
||||||
|
if test $$# -gt 0; then \
|
||||||
|
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||||
|
"$$@" $$unique; \
|
||||||
|
else \
|
||||||
|
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||||
|
$$unique; \
|
||||||
|
fi; \
|
||||||
|
fi
|
||||||
|
ctags: CTAGS
|
||||||
|
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||||
|
$(TAGS_FILES) $(LISP)
|
||||||
|
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||||
|
unique=`for i in $$list; do \
|
||||||
|
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||||
|
done | \
|
||||||
|
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||||
|
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||||
|
test -z "$(CTAGS_ARGS)$$unique" \
|
||||||
|
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||||
|
$$unique
|
||||||
|
|
||||||
|
GTAGS:
|
||||||
|
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||||
|
&& $(am__cd) $(top_srcdir) \
|
||||||
|
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||||
|
|
||||||
|
distclean-tags:
|
||||||
|
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||||
|
|
||||||
|
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 "$(distdir)/$$file"; then \
|
||||||
|
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||||
|
fi; \
|
||||||
|
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||||
|
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||||
|
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||||
|
fi; \
|
||||||
|
cp -fpR $$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
|
||||||
|
all-am: Makefile $(LTLIBRARIES)
|
||||||
|
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)
|
||||||
|
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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 clean-noinstLTLIBRARIES \
|
||||||
|
mostlyclean-am
|
||||||
|
|
||||||
|
distclean: distclean-am
|
||||||
|
-rm -rf ./$(DEPDIR)
|
||||||
|
-rm -f Makefile
|
||||||
|
distclean-am: clean-am distclean-compile distclean-generic \
|
||||||
|
distclean-tags
|
||||||
|
|
||||||
|
dvi: dvi-am
|
||||||
|
|
||||||
|
dvi-am:
|
||||||
|
|
||||||
|
html: html-am
|
||||||
|
|
||||||
|
html-am:
|
||||||
|
|
||||||
|
info: info-am
|
||||||
|
|
||||||
|
info-am:
|
||||||
|
|
||||||
|
install-data-am:
|
||||||
|
|
||||||
|
install-dvi: install-dvi-am
|
||||||
|
|
||||||
|
install-dvi-am:
|
||||||
|
|
||||||
|
install-exec-am:
|
||||||
|
|
||||||
|
install-html: install-html-am
|
||||||
|
|
||||||
|
install-html-am:
|
||||||
|
|
||||||
|
install-info: install-info-am
|
||||||
|
|
||||||
|
install-info-am:
|
||||||
|
|
||||||
|
install-man:
|
||||||
|
|
||||||
|
install-pdf: install-pdf-am
|
||||||
|
|
||||||
|
install-pdf-am:
|
||||||
|
|
||||||
|
install-ps: install-ps-am
|
||||||
|
|
||||||
|
install-ps-am:
|
||||||
|
|
||||||
|
installcheck-am:
|
||||||
|
|
||||||
|
maintainer-clean: maintainer-clean-am
|
||||||
|
-rm -rf ./$(DEPDIR)
|
||||||
|
-rm -f Makefile
|
||||||
|
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||||
|
|
||||||
|
mostlyclean: mostlyclean-am
|
||||||
|
|
||||||
|
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||||
|
mostlyclean-libtool
|
||||||
|
|
||||||
|
pdf: pdf-am
|
||||||
|
|
||||||
|
pdf-am:
|
||||||
|
|
||||||
|
ps: ps-am
|
||||||
|
|
||||||
|
ps-am:
|
||||||
|
|
||||||
|
uninstall-am:
|
||||||
|
|
||||||
|
.MAKE: install-am install-strip
|
||||||
|
|
||||||
|
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||||
|
clean-libtool clean-noinstLTLIBRARIES ctags distclean \
|
||||||
|
distclean-compile distclean-generic distclean-libtool \
|
||||||
|
distclean-tags 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 mostlyclean \
|
||||||
|
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
|
||||||
|
pdf pdf-am ps ps-am tags uninstall uninstall-am
|
||||||
|
|
||||||
|
|
||||||
|
# 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:
|
|
@ -0,0 +1,7 @@
|
||||||
|
This is HarfBuzz-old, an OpenType Layout engine library.
|
||||||
|
|
||||||
|
To report bugs or post to discussion mailing list, see:
|
||||||
|
|
||||||
|
http://freedesktop.org/wiki/Software/HarfBuzz
|
||||||
|
|
||||||
|
For license information, see the file COPYING.
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,107 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
|
||||||
|
* Copyright (C) 2004,2007 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*
|
||||||
|
* Red Hat Author(s): Owen Taylor, Behdad Esfahbod
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HARFBUZZ_BUFFER_PRIVATE_H
|
||||||
|
#define HARFBUZZ_BUFFER_PRIVATE_H
|
||||||
|
|
||||||
|
#include "harfbuzz-impl.h"
|
||||||
|
#include "harfbuzz-buffer.h"
|
||||||
|
|
||||||
|
HB_BEGIN_HEADER
|
||||||
|
|
||||||
|
#define HB_GLYPH_PROPERTIES_UNKNOWN 0xFFFF
|
||||||
|
|
||||||
|
HB_INTERNAL void
|
||||||
|
_hb_buffer_swap( HB_Buffer buffer );
|
||||||
|
|
||||||
|
HB_INTERNAL void
|
||||||
|
_hb_buffer_clear_output( HB_Buffer buffer );
|
||||||
|
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_hb_buffer_clear_positions( HB_Buffer buffer );
|
||||||
|
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_hb_buffer_add_output_glyphs( HB_Buffer buffer,
|
||||||
|
HB_UShort num_in,
|
||||||
|
HB_UShort num_out,
|
||||||
|
HB_UShort *glyph_data,
|
||||||
|
HB_UShort component,
|
||||||
|
HB_UShort ligID );
|
||||||
|
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_hb_buffer_add_output_glyph ( HB_Buffer buffer,
|
||||||
|
HB_UInt glyph_index,
|
||||||
|
HB_UShort component,
|
||||||
|
HB_UShort ligID );
|
||||||
|
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_hb_buffer_copy_output_glyph ( HB_Buffer buffer );
|
||||||
|
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_hb_buffer_replace_output_glyph ( HB_Buffer buffer,
|
||||||
|
HB_UInt glyph_index,
|
||||||
|
HB_Bool inplace );
|
||||||
|
|
||||||
|
HB_INTERNAL HB_UShort
|
||||||
|
_hb_buffer_allocate_ligid( HB_Buffer buffer );
|
||||||
|
|
||||||
|
|
||||||
|
/* convenience macros */
|
||||||
|
|
||||||
|
#define IN_GLYPH( pos ) (buffer->in_string[(pos)].gindex)
|
||||||
|
#define IN_ITEM( pos ) (&buffer->in_string[(pos)])
|
||||||
|
#define IN_CURGLYPH() (buffer->in_string[buffer->in_pos].gindex)
|
||||||
|
#define IN_CURITEM() (&buffer->in_string[buffer->in_pos])
|
||||||
|
#define IN_PROPERTIES( pos ) (buffer->in_string[(pos)].properties)
|
||||||
|
#define IN_LIGID( pos ) (buffer->in_string[(pos)].ligID)
|
||||||
|
#define IN_COMPONENT( pos ) (buffer->in_string[(pos)].component)
|
||||||
|
#define POSITION( pos ) (&buffer->positions[(pos)])
|
||||||
|
#define OUT_GLYPH( pos ) (buffer->out_string[(pos)].gindex)
|
||||||
|
#define OUT_ITEM( pos ) (&buffer->out_string[(pos)])
|
||||||
|
|
||||||
|
#define CHECK_Property( gdef, index, flags, property ) \
|
||||||
|
( ( error = _HB_GDEF_Check_Property( (gdef), (index), (flags), \
|
||||||
|
(property) ) ) != HB_Err_Ok )
|
||||||
|
|
||||||
|
#define ADD_String( buffer, num_in, num_out, glyph_data, component, ligID ) \
|
||||||
|
( ( error = _hb_buffer_add_output_glyphs( (buffer), \
|
||||||
|
(num_in), (num_out), \
|
||||||
|
(glyph_data), (component), (ligID) \
|
||||||
|
) ) != HB_Err_Ok )
|
||||||
|
#define ADD_Glyph( buffer, glyph_index, component, ligID ) \
|
||||||
|
( ( error = _hb_buffer_add_output_glyph( (buffer), \
|
||||||
|
(glyph_index), (component), (ligID) \
|
||||||
|
) ) != HB_Err_Ok )
|
||||||
|
#define REPLACE_Glyph( buffer, glyph_index, nesting_level ) \
|
||||||
|
( ( error = _hb_buffer_replace_output_glyph( (buffer), (glyph_index), \
|
||||||
|
(nesting_level) == 1 ) ) != HB_Err_Ok )
|
||||||
|
#define COPY_Glyph( buffer ) \
|
||||||
|
( (error = _hb_buffer_copy_output_glyph ( buffer ) ) != HB_Err_Ok )
|
||||||
|
|
||||||
|
HB_END_HEADER
|
||||||
|
|
||||||
|
#endif /* HARFBUZZ_BUFFER_PRIVATE_H */
|
|
@ -0,0 +1,383 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
|
||||||
|
* Copyright (C) 2004,2007 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*
|
||||||
|
* Red Hat Author(s): Owen Taylor, Behdad Esfahbod
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "harfbuzz-impl.h"
|
||||||
|
#include "harfbuzz-buffer-private.h"
|
||||||
|
#include "harfbuzz-gsub-private.h"
|
||||||
|
#include "harfbuzz-gpos-private.h"
|
||||||
|
|
||||||
|
/* Here is how the buffer works internally:
|
||||||
|
*
|
||||||
|
* There are two string pointers: in_string and out_string. They
|
||||||
|
* always have same allocated size, but different length and positions.
|
||||||
|
*
|
||||||
|
* As an optimization, both in_string and out_string may point to the
|
||||||
|
* same piece of memory, which is owned by in_string. This remains the
|
||||||
|
* case as long as:
|
||||||
|
*
|
||||||
|
* - copy_glyph() is called
|
||||||
|
* - replace_glyph() is called with inplace=TRUE
|
||||||
|
* - add_output_glyph() and add_output_glyphs() are not called
|
||||||
|
*
|
||||||
|
* In that case swap(), and copy_glyph(), and replace_glyph() are all
|
||||||
|
* mostly no-op.
|
||||||
|
*
|
||||||
|
* As soon an add_output_glyph[s]() or replace_glyph() with inplace=FALSE is
|
||||||
|
* called, out_string is moved over to an alternate buffer (alt_string), and
|
||||||
|
* its current contents (out_length entries) are copied to the alt buffer.
|
||||||
|
* This should all remain transparent to the user. swap() then switches
|
||||||
|
* in_string and alt_string. alt_string is not allocated until its needed,
|
||||||
|
* but after that it's grown with in_string unconditionally.
|
||||||
|
*
|
||||||
|
* The buffer->separate_out boolean keeps status of whether out_string points
|
||||||
|
* to in_string (FALSE) or alt_string (TRUE).
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Internal API */
|
||||||
|
|
||||||
|
static HB_Error
|
||||||
|
hb_buffer_ensure( HB_Buffer buffer,
|
||||||
|
HB_UInt size )
|
||||||
|
{
|
||||||
|
HB_UInt new_allocated = buffer->allocated;
|
||||||
|
|
||||||
|
if (size > new_allocated)
|
||||||
|
{
|
||||||
|
HB_Error error;
|
||||||
|
|
||||||
|
while (size > new_allocated)
|
||||||
|
new_allocated += (new_allocated >> 1) + 8;
|
||||||
|
|
||||||
|
if ( buffer->positions )
|
||||||
|
{
|
||||||
|
if ( REALLOC_ARRAY( buffer->positions, new_allocated, HB_PositionRec ) )
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( REALLOC_ARRAY( buffer->in_string, new_allocated, HB_GlyphItemRec ) )
|
||||||
|
return error;
|
||||||
|
|
||||||
|
if ( buffer->separate_out )
|
||||||
|
{
|
||||||
|
if ( REALLOC_ARRAY( buffer->alt_string, new_allocated, HB_GlyphItemRec ) )
|
||||||
|
return error;
|
||||||
|
|
||||||
|
buffer->out_string = buffer->alt_string;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buffer->out_string = buffer->in_string;
|
||||||
|
|
||||||
|
if ( buffer->alt_string )
|
||||||
|
{
|
||||||
|
if ( REALLOC_ARRAY( buffer->alt_string, new_allocated, HB_GlyphItemRec ) )
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer->allocated = new_allocated;
|
||||||
|
}
|
||||||
|
|
||||||
|
return HB_Err_Ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HB_Error
|
||||||
|
hb_buffer_duplicate_out_buffer( HB_Buffer buffer )
|
||||||
|
{
|
||||||
|
if ( !buffer->alt_string )
|
||||||
|
{
|
||||||
|
HB_Error error;
|
||||||
|
|
||||||
|
if ( ALLOC_ARRAY( buffer->alt_string, buffer->allocated, HB_GlyphItemRec ) )
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer->out_string = buffer->alt_string;
|
||||||
|
memcpy( buffer->out_string, buffer->in_string, buffer->out_length * sizeof (buffer->out_string[0]) );
|
||||||
|
buffer->separate_out = TRUE;
|
||||||
|
|
||||||
|
return HB_Err_Ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Public API */
|
||||||
|
|
||||||
|
HB_Error
|
||||||
|
hb_buffer_new( HB_Buffer *pbuffer )
|
||||||
|
{
|
||||||
|
HB_Buffer buffer;
|
||||||
|
HB_Error error;
|
||||||
|
|
||||||
|
if ( ALLOC( buffer, sizeof( HB_BufferRec ) ) )
|
||||||
|
return error;
|
||||||
|
|
||||||
|
buffer->allocated = 0;
|
||||||
|
buffer->in_string = NULL;
|
||||||
|
buffer->alt_string = NULL;
|
||||||
|
buffer->positions = NULL;
|
||||||
|
|
||||||
|
hb_buffer_clear( buffer );
|
||||||
|
|
||||||
|
*pbuffer = buffer;
|
||||||
|
|
||||||
|
return HB_Err_Ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
hb_buffer_free( HB_Buffer buffer )
|
||||||
|
{
|
||||||
|
FREE( buffer->in_string );
|
||||||
|
FREE( buffer->alt_string );
|
||||||
|
buffer->out_string = NULL;
|
||||||
|
FREE( buffer->positions );
|
||||||
|
FREE( buffer );
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
hb_buffer_clear( HB_Buffer buffer )
|
||||||
|
{
|
||||||
|
buffer->in_length = 0;
|
||||||
|
buffer->out_length = 0;
|
||||||
|
buffer->in_pos = 0;
|
||||||
|
buffer->out_pos = 0;
|
||||||
|
buffer->out_string = buffer->in_string;
|
||||||
|
buffer->separate_out = FALSE;
|
||||||
|
buffer->max_ligID = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
HB_Error
|
||||||
|
hb_buffer_add_glyph( HB_Buffer buffer,
|
||||||
|
HB_UInt glyph_index,
|
||||||
|
HB_UInt properties,
|
||||||
|
HB_UInt cluster )
|
||||||
|
{
|
||||||
|
HB_Error error;
|
||||||
|
HB_GlyphItem glyph;
|
||||||
|
|
||||||
|
error = hb_buffer_ensure( buffer, buffer->in_length + 1 );
|
||||||
|
if ( error )
|
||||||
|
return error;
|
||||||
|
|
||||||
|
glyph = &buffer->in_string[buffer->in_length];
|
||||||
|
glyph->gindex = glyph_index;
|
||||||
|
glyph->properties = properties;
|
||||||
|
glyph->cluster = cluster;
|
||||||
|
glyph->component = 0;
|
||||||
|
glyph->ligID = 0;
|
||||||
|
glyph->gproperties = HB_GLYPH_PROPERTIES_UNKNOWN;
|
||||||
|
|
||||||
|
buffer->in_length++;
|
||||||
|
|
||||||
|
return HB_Err_Ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* HarfBuzz-Internal API */
|
||||||
|
|
||||||
|
HB_INTERNAL void
|
||||||
|
_hb_buffer_clear_output( HB_Buffer buffer )
|
||||||
|
{
|
||||||
|
buffer->out_length = 0;
|
||||||
|
buffer->out_pos = 0;
|
||||||
|
buffer->out_string = buffer->in_string;
|
||||||
|
buffer->separate_out = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_hb_buffer_clear_positions( HB_Buffer buffer )
|
||||||
|
{
|
||||||
|
if ( !buffer->positions )
|
||||||
|
{
|
||||||
|
HB_Error error;
|
||||||
|
|
||||||
|
if ( ALLOC_ARRAY( buffer->positions, buffer->allocated, HB_PositionRec ) )
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset (buffer->positions, 0, sizeof (buffer->positions[0]) * buffer->in_length);
|
||||||
|
|
||||||
|
return HB_Err_Ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
HB_INTERNAL void
|
||||||
|
_hb_buffer_swap( HB_Buffer buffer )
|
||||||
|
{
|
||||||
|
HB_GlyphItem tmp_string;
|
||||||
|
int tmp_length;
|
||||||
|
int tmp_pos;
|
||||||
|
|
||||||
|
if ( buffer->separate_out )
|
||||||
|
{
|
||||||
|
tmp_string = buffer->in_string;
|
||||||
|
buffer->in_string = buffer->out_string;
|
||||||
|
buffer->out_string = tmp_string;
|
||||||
|
buffer->alt_string = buffer->out_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp_length = buffer->in_length;
|
||||||
|
buffer->in_length = buffer->out_length;
|
||||||
|
buffer->out_length = tmp_length;
|
||||||
|
|
||||||
|
tmp_pos = buffer->in_pos;
|
||||||
|
buffer->in_pos = buffer->out_pos;
|
||||||
|
buffer->out_pos = tmp_pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The following function copies `num_out' elements from `glyph_data'
|
||||||
|
to `buffer->out_string', advancing the in array pointer in the structure
|
||||||
|
by `num_in' elements, and the out array pointer by `num_out' elements.
|
||||||
|
Finally, it sets the `length' field of `out' equal to
|
||||||
|
`pos' of the `out' structure.
|
||||||
|
|
||||||
|
If `component' is 0xFFFF, the component value from buffer->in_pos
|
||||||
|
will copied `num_out' times, otherwise `component' itself will
|
||||||
|
be used to fill the `component' fields.
|
||||||
|
|
||||||
|
If `ligID' is 0xFFFF, the ligID value from buffer->in_pos
|
||||||
|
will copied `num_out' times, otherwise `ligID' itself will
|
||||||
|
be used to fill the `ligID' fields.
|
||||||
|
|
||||||
|
The properties for all replacement glyphs are taken
|
||||||
|
from the glyph at position `buffer->in_pos'.
|
||||||
|
|
||||||
|
The cluster value for the glyph at position buffer->in_pos is used
|
||||||
|
for all replacement glyphs */
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_hb_buffer_add_output_glyphs( HB_Buffer buffer,
|
||||||
|
HB_UShort num_in,
|
||||||
|
HB_UShort num_out,
|
||||||
|
HB_UShort *glyph_data,
|
||||||
|
HB_UShort component,
|
||||||
|
HB_UShort ligID )
|
||||||
|
{
|
||||||
|
HB_Error error;
|
||||||
|
HB_UShort i;
|
||||||
|
HB_UInt properties;
|
||||||
|
HB_UInt cluster;
|
||||||
|
|
||||||
|
error = hb_buffer_ensure( buffer, buffer->out_pos + num_out );
|
||||||
|
if ( error )
|
||||||
|
return error;
|
||||||
|
|
||||||
|
if ( !buffer->separate_out )
|
||||||
|
{
|
||||||
|
error = hb_buffer_duplicate_out_buffer( buffer );
|
||||||
|
if ( error )
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
properties = buffer->in_string[buffer->in_pos].properties;
|
||||||
|
cluster = buffer->in_string[buffer->in_pos].cluster;
|
||||||
|
if ( component == 0xFFFF )
|
||||||
|
component = buffer->in_string[buffer->in_pos].component;
|
||||||
|
if ( ligID == 0xFFFF )
|
||||||
|
ligID = buffer->in_string[buffer->in_pos].ligID;
|
||||||
|
|
||||||
|
for ( i = 0; i < num_out; i++ )
|
||||||
|
{
|
||||||
|
HB_GlyphItem item = &buffer->out_string[buffer->out_pos + i];
|
||||||
|
|
||||||
|
item->gindex = glyph_data[i];
|
||||||
|
item->properties = properties;
|
||||||
|
item->cluster = cluster;
|
||||||
|
item->component = component;
|
||||||
|
item->ligID = ligID;
|
||||||
|
item->gproperties = HB_GLYPH_PROPERTIES_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer->in_pos += num_in;
|
||||||
|
buffer->out_pos += num_out;
|
||||||
|
|
||||||
|
buffer->out_length = buffer->out_pos;
|
||||||
|
|
||||||
|
return HB_Err_Ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_hb_buffer_add_output_glyph( HB_Buffer buffer,
|
||||||
|
HB_UInt glyph_index,
|
||||||
|
HB_UShort component,
|
||||||
|
HB_UShort ligID )
|
||||||
|
{
|
||||||
|
HB_UShort glyph_data = glyph_index;
|
||||||
|
|
||||||
|
return _hb_buffer_add_output_glyphs ( buffer, 1, 1,
|
||||||
|
&glyph_data, component, ligID );
|
||||||
|
}
|
||||||
|
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_hb_buffer_copy_output_glyph ( HB_Buffer buffer )
|
||||||
|
{
|
||||||
|
HB_Error error;
|
||||||
|
|
||||||
|
error = hb_buffer_ensure( buffer, buffer->out_pos + 1 );
|
||||||
|
if ( error )
|
||||||
|
return error;
|
||||||
|
|
||||||
|
if ( buffer->separate_out )
|
||||||
|
{
|
||||||
|
buffer->out_string[buffer->out_pos] = buffer->in_string[buffer->in_pos];
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer->in_pos++;
|
||||||
|
buffer->out_pos++;
|
||||||
|
buffer->out_length = buffer->out_pos;
|
||||||
|
|
||||||
|
return HB_Err_Ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_hb_buffer_replace_output_glyph( HB_Buffer buffer,
|
||||||
|
HB_UInt glyph_index,
|
||||||
|
HB_Bool inplace )
|
||||||
|
{
|
||||||
|
|
||||||
|
HB_Error error;
|
||||||
|
|
||||||
|
if ( inplace )
|
||||||
|
{
|
||||||
|
error = _hb_buffer_copy_output_glyph ( buffer );
|
||||||
|
if ( error )
|
||||||
|
return error;
|
||||||
|
|
||||||
|
buffer->out_string[buffer->out_pos-1].gindex = glyph_index;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return _hb_buffer_add_output_glyph( buffer, glyph_index, 0xFFFF, 0xFFFF );
|
||||||
|
}
|
||||||
|
|
||||||
|
return HB_Err_Ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
HB_INTERNAL HB_UShort
|
||||||
|
_hb_buffer_allocate_ligid( HB_Buffer buffer )
|
||||||
|
{
|
||||||
|
buffer->max_ligID++;
|
||||||
|
if (HB_UNLIKELY (buffer->max_ligID == 0))
|
||||||
|
buffer->max_ligID++;
|
||||||
|
|
||||||
|
return buffer->max_ligID;
|
||||||
|
}
|
|
@ -0,0 +1,102 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
|
||||||
|
* Copyright (C) 2004,2007 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*
|
||||||
|
* Red Hat Author(s): Owen Taylor, Behdad Esfahbod
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HARFBUZZ_BUFFER_H
|
||||||
|
#define HARFBUZZ_BUFFER_H
|
||||||
|
|
||||||
|
#include "harfbuzz-global.h"
|
||||||
|
|
||||||
|
HB_BEGIN_HEADER
|
||||||
|
|
||||||
|
#ifdef HB_USE_PACKED_STRUCTS
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct HB_GlyphItemRec_ {
|
||||||
|
HB_UInt gindex;
|
||||||
|
HB_UInt properties;
|
||||||
|
HB_UInt cluster;
|
||||||
|
HB_UShort component;
|
||||||
|
HB_UShort ligID;
|
||||||
|
HB_UShort gproperties;
|
||||||
|
} HB_GlyphItemRec, *HB_GlyphItem;
|
||||||
|
|
||||||
|
typedef struct HB_PositionRec_ {
|
||||||
|
HB_Fixed x_pos;
|
||||||
|
HB_Fixed y_pos;
|
||||||
|
HB_Fixed x_advance;
|
||||||
|
HB_Fixed y_advance;
|
||||||
|
HB_UShort back; /* number of glyphs to go back
|
||||||
|
for drawing current glyph */
|
||||||
|
HB_Short cursive_chain; /* character to which this connects,
|
||||||
|
may be positive or negative; used
|
||||||
|
only internally */
|
||||||
|
HB_Bool new_advance; /* if set, the advance width values are
|
||||||
|
absolute, i.e., they won't be
|
||||||
|
added to the original glyph's value
|
||||||
|
but rather replace them. */
|
||||||
|
} HB_PositionRec, *HB_Position;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct HB_BufferRec_{
|
||||||
|
HB_UInt allocated;
|
||||||
|
|
||||||
|
HB_UInt in_length;
|
||||||
|
HB_UInt out_length;
|
||||||
|
HB_UInt in_pos;
|
||||||
|
HB_UInt out_pos;
|
||||||
|
|
||||||
|
HB_GlyphItem in_string;
|
||||||
|
HB_GlyphItem out_string;
|
||||||
|
HB_GlyphItem alt_string;
|
||||||
|
HB_Position positions;
|
||||||
|
HB_UShort max_ligID;
|
||||||
|
HB_Bool separate_out;
|
||||||
|
} HB_BufferRec, *HB_Buffer;
|
||||||
|
|
||||||
|
HB_Error
|
||||||
|
hb_buffer_new( HB_Buffer *buffer );
|
||||||
|
|
||||||
|
void
|
||||||
|
hb_buffer_free( HB_Buffer buffer );
|
||||||
|
|
||||||
|
void
|
||||||
|
hb_buffer_clear( HB_Buffer buffer );
|
||||||
|
|
||||||
|
HB_Error
|
||||||
|
hb_buffer_add_glyph( HB_Buffer buffer,
|
||||||
|
HB_UInt glyph_index,
|
||||||
|
HB_UInt properties,
|
||||||
|
HB_UInt cluster );
|
||||||
|
|
||||||
|
#ifdef HB_USE_PACKED_STRUCTS
|
||||||
|
#pragma pack(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
HB_END_HEADER
|
||||||
|
|
||||||
|
#endif /* HARFBUZZ_BUFFER_H */
|
|
@ -0,0 +1,151 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HARFBUZZ_EXTERNAL_H
|
||||||
|
#define HARFBUZZ_EXTERNAL_H
|
||||||
|
|
||||||
|
#include "harfbuzz-global.h"
|
||||||
|
|
||||||
|
HB_BEGIN_HEADER
|
||||||
|
|
||||||
|
/* This header contains some methods that are not part of
|
||||||
|
Harfbuzz itself, but referenced by it.
|
||||||
|
They need to be provided by the application/library
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
see http://www.unicode.org/reports/tr14/tr14-19.html
|
||||||
|
we don't use the XX, AI and CB properties and map them to AL instead.
|
||||||
|
as we don't support any EBDIC based OS'es, NL is ignored and mapped to AL as well.
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
HB_LineBreak_OP, HB_LineBreak_CL, HB_LineBreak_QU, HB_LineBreak_GL, HB_LineBreak_NS,
|
||||||
|
HB_LineBreak_EX, HB_LineBreak_SY, HB_LineBreak_IS, HB_LineBreak_PR, HB_LineBreak_PO,
|
||||||
|
HB_LineBreak_NU, HB_LineBreak_AL, HB_LineBreak_ID, HB_LineBreak_IN, HB_LineBreak_HY,
|
||||||
|
HB_LineBreak_BA, HB_LineBreak_BB, HB_LineBreak_B2, HB_LineBreak_ZW, HB_LineBreak_CM,
|
||||||
|
HB_LineBreak_WJ, HB_LineBreak_H2, HB_LineBreak_H3, HB_LineBreak_JL, HB_LineBreak_JV,
|
||||||
|
HB_LineBreak_JT, HB_LineBreak_SA, HB_LineBreak_SG,
|
||||||
|
HB_LineBreak_SP, HB_LineBreak_CR, HB_LineBreak_LF, HB_LineBreak_BK
|
||||||
|
} HB_LineBreakClass;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
HB_Mark_NonSpacing, /* Mn */
|
||||||
|
HB_Mark_SpacingCombining, /* Mc */
|
||||||
|
HB_Mark_Enclosing, /* Me */
|
||||||
|
|
||||||
|
HB_Number_DecimalDigit, /* Nd */
|
||||||
|
HB_Number_Letter, /* Nl */
|
||||||
|
HB_Number_Other, /* No */
|
||||||
|
|
||||||
|
HB_Separator_Space, /* Zs */
|
||||||
|
HB_Separator_Line, /* Zl */
|
||||||
|
HB_Separator_Paragraph, /* Zp */
|
||||||
|
|
||||||
|
HB_Other_Control, /* Cc */
|
||||||
|
HB_Other_Format, /* Cf */
|
||||||
|
HB_Other_Surrogate, /* Cs */
|
||||||
|
HB_Other_PrivateUse, /* Co */
|
||||||
|
HB_Other_NotAssigned, /* Cn */
|
||||||
|
|
||||||
|
HB_Letter_Uppercase, /* Lu */
|
||||||
|
HB_Letter_Lowercase, /* Ll */
|
||||||
|
HB_Letter_Titlecase, /* Lt */
|
||||||
|
HB_Letter_Modifier, /* Lm */
|
||||||
|
HB_Letter_Other, /* Lo */
|
||||||
|
|
||||||
|
HB_Punctuation_Connector, /* Pc */
|
||||||
|
HB_Punctuation_Dash, /* Pd */
|
||||||
|
HB_Punctuation_Open, /* Ps */
|
||||||
|
HB_Punctuation_Close, /* Pe */
|
||||||
|
HB_Punctuation_InitialQuote, /* Pi */
|
||||||
|
HB_Punctuation_FinalQuote, /* Pf */
|
||||||
|
HB_Punctuation_Other, /* Po */
|
||||||
|
|
||||||
|
HB_Symbol_Math, /* Sm */
|
||||||
|
HB_Symbol_Currency, /* Sc */
|
||||||
|
HB_Symbol_Modifier, /* Sk */
|
||||||
|
HB_Symbol_Other /* So */
|
||||||
|
} HB_CharCategory;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
HB_Grapheme_Other,
|
||||||
|
HB_Grapheme_CR,
|
||||||
|
HB_Grapheme_LF,
|
||||||
|
HB_Grapheme_Control,
|
||||||
|
HB_Grapheme_Extend,
|
||||||
|
HB_Grapheme_L,
|
||||||
|
HB_Grapheme_V,
|
||||||
|
HB_Grapheme_T,
|
||||||
|
HB_Grapheme_LV,
|
||||||
|
HB_Grapheme_LVT
|
||||||
|
} HB_GraphemeClass;
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
HB_Word_Other,
|
||||||
|
HB_Word_Format,
|
||||||
|
HB_Word_Katakana,
|
||||||
|
HB_Word_ALetter,
|
||||||
|
HB_Word_MidLetter,
|
||||||
|
HB_Word_MidNum,
|
||||||
|
HB_Word_Numeric,
|
||||||
|
HB_Word_ExtendNumLet
|
||||||
|
} HB_WordClass;
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
HB_Sentence_Other,
|
||||||
|
HB_Sentence_Sep,
|
||||||
|
HB_Sentence_Format,
|
||||||
|
HB_Sentence_Sp,
|
||||||
|
HB_Sentence_Lower,
|
||||||
|
HB_Sentence_Upper,
|
||||||
|
HB_Sentence_OLetter,
|
||||||
|
HB_Sentence_Numeric,
|
||||||
|
HB_Sentence_ATerm,
|
||||||
|
HB_Sentence_STerm,
|
||||||
|
HB_Sentence_Close
|
||||||
|
} HB_SentenceClass;
|
||||||
|
|
||||||
|
HB_GraphemeClass HB_GetGraphemeClass(HB_UChar32 ch);
|
||||||
|
HB_WordClass HB_GetWordClass(HB_UChar32 ch);
|
||||||
|
HB_SentenceClass HB_GetSentenceClass(HB_UChar32 ch);
|
||||||
|
HB_LineBreakClass HB_GetLineBreakClass(HB_UChar32 ch);
|
||||||
|
|
||||||
|
void HB_GetGraphemeAndLineBreakClass(HB_UChar32 ch, HB_GraphemeClass *grapheme, HB_LineBreakClass *lineBreak);
|
||||||
|
void HB_GetUnicodeCharProperties(HB_UChar32 ch, HB_CharCategory *category, int *combiningClass);
|
||||||
|
HB_CharCategory HB_GetUnicodeCharCategory(HB_UChar32 ch);
|
||||||
|
int HB_GetUnicodeCharCombiningClass(HB_UChar32 ch);
|
||||||
|
HB_UChar16 HB_GetMirroredChar(HB_UChar16 ch);
|
||||||
|
|
||||||
|
void *HB_Library_Resolve(const char *library, int version, const char *symbol);
|
||||||
|
|
||||||
|
HB_END_HEADER
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,135 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
|
||||||
|
* Copyright (C) 2006 Behdad Esfahbod
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HARFBUZZ_GDEF_PRIVATE_H
|
||||||
|
#define HARFBUZZ_GDEF_PRIVATE_H
|
||||||
|
|
||||||
|
#include "harfbuzz-impl.h"
|
||||||
|
#include "harfbuzz-stream-private.h"
|
||||||
|
#include "harfbuzz-buffer-private.h"
|
||||||
|
#include "harfbuzz-gdef.h"
|
||||||
|
|
||||||
|
HB_BEGIN_HEADER
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HB_USE_PACKED_STRUCTS
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Attachment related structures */
|
||||||
|
|
||||||
|
struct HB_AttachPoint_
|
||||||
|
{
|
||||||
|
HB_UShort* PointIndex; /* array of contour points */
|
||||||
|
HB_UShort PointCount; /* size of the PointIndex array */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Ligature Caret related structures */
|
||||||
|
|
||||||
|
struct HB_CaretValueFormat1_
|
||||||
|
{
|
||||||
|
HB_Short Coordinate; /* x or y value (in design units) */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_CaretValueFormat1_ HB_CaretValueFormat1;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_CaretValueFormat2_
|
||||||
|
{
|
||||||
|
HB_UShort CaretValuePoint; /* contour point index on glyph */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_CaretValueFormat2_ HB_CaretValueFormat2;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_CaretValueFormat3_
|
||||||
|
{
|
||||||
|
HB_Device* Device; /* Device table for x or y value */
|
||||||
|
HB_Short Coordinate; /* x or y value (in design units) */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_CaretValueFormat3_ HB_CaretValueFormat3;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HB_SUPPORT_MULTIPLE_MASTER
|
||||||
|
struct HB_CaretValueFormat4_
|
||||||
|
{
|
||||||
|
HB_UShort IdCaretValue; /* metric ID */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_CaretValueFormat4_ HB_CaretValueFormat4;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_CaretValue_
|
||||||
|
{
|
||||||
|
union
|
||||||
|
{
|
||||||
|
HB_CaretValueFormat1 cvf1;
|
||||||
|
HB_CaretValueFormat2 cvf2;
|
||||||
|
HB_CaretValueFormat3 cvf3;
|
||||||
|
#ifdef HB_SUPPORT_MULTIPLE_MASTER
|
||||||
|
HB_CaretValueFormat4 cvf4;
|
||||||
|
#endif
|
||||||
|
} cvf;
|
||||||
|
|
||||||
|
HB_Byte CaretValueFormat; /* 1, 2, 3, or 4 */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_CaretValue_ HB_CaretValue;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_LigGlyph_
|
||||||
|
{
|
||||||
|
HB_CaretValue* CaretValue; /* array of caret values */
|
||||||
|
HB_UShort CaretCount; /* number of caret values */
|
||||||
|
HB_Bool loaded;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_HB_GDEF_Add_Glyph_Property( HB_GDEFHeader* gdef,
|
||||||
|
HB_UShort glyphID,
|
||||||
|
HB_UShort property );
|
||||||
|
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_HB_GDEF_Check_Property( HB_GDEFHeader* gdef,
|
||||||
|
HB_GlyphItem item,
|
||||||
|
HB_UShort flags,
|
||||||
|
HB_UShort* property );
|
||||||
|
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_HB_GDEF_LoadMarkAttachClassDef_From_LookupFlags( HB_GDEFHeader* gdef,
|
||||||
|
HB_Stream input,
|
||||||
|
HB_Lookup* lo,
|
||||||
|
HB_UShort num_lookups );
|
||||||
|
|
||||||
|
#ifdef HB_USE_PACKED_STRUCTS
|
||||||
|
#pragma pack(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
HB_END_HEADER
|
||||||
|
|
||||||
|
#endif /* HARFBUZZ_GDEF_PRIVATE_H */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,140 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
|
||||||
|
* Copyright (C) 2006 Behdad Esfahbod
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HARFBUZZ_GDEF_H
|
||||||
|
#define HARFBUZZ_GDEF_H
|
||||||
|
|
||||||
|
#include "harfbuzz-open.h"
|
||||||
|
#include "harfbuzz-stream.h"
|
||||||
|
|
||||||
|
HB_BEGIN_HEADER
|
||||||
|
|
||||||
|
#ifdef HB_USE_PACKED_STRUCTS
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* GDEF glyph properties. Note that HB_GDEF_COMPONENT has no corresponding
|
||||||
|
* flag in the LookupFlag field. */
|
||||||
|
#define HB_GDEF_BASE_GLYPH 0x0002
|
||||||
|
#define HB_GDEF_LIGATURE 0x0004
|
||||||
|
#define HB_GDEF_MARK 0x0008
|
||||||
|
#define HB_GDEF_COMPONENT 0x0010
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct HB_AttachPoint_ HB_AttachPoint;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_AttachList_
|
||||||
|
{
|
||||||
|
HB_AttachPoint* AttachPoint; /* array of AttachPoint tables */
|
||||||
|
HB_Coverage Coverage; /* Coverage table */
|
||||||
|
HB_UShort GlyphCount; /* number of glyphs with
|
||||||
|
attachments */
|
||||||
|
HB_Bool loaded;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_AttachList_ HB_AttachList;
|
||||||
|
|
||||||
|
typedef struct HB_LigGlyph_ HB_LigGlyph;
|
||||||
|
|
||||||
|
struct HB_LigCaretList_
|
||||||
|
{
|
||||||
|
HB_LigGlyph* LigGlyph; /* array of LigGlyph tables */
|
||||||
|
HB_Coverage Coverage; /* Coverage table */
|
||||||
|
HB_UShort LigGlyphCount; /* number of ligature glyphs */
|
||||||
|
HB_Bool loaded;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_LigCaretList_ HB_LigCaretList;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* The `NewGlyphClasses' field is not defined in the TTO specification.
|
||||||
|
We use it for fonts with a constructed `GlyphClassDef' structure
|
||||||
|
(i.e., which don't have a GDEF table) to collect glyph classes
|
||||||
|
assigned during the lookup process. The number of arrays in this
|
||||||
|
pointer array is GlyphClassDef->cd.cd2.ClassRangeCount+1; the nth
|
||||||
|
array then contains the glyph class values of the glyphs not covered
|
||||||
|
by the ClassRangeRecords structures with index n-1 and n. We store
|
||||||
|
glyph class values for four glyphs in a single array element.
|
||||||
|
|
||||||
|
`LastGlyph' is identical to the number of glyphs minus one in the
|
||||||
|
font; we need it only if `NewGlyphClasses' is not NULL (to have an
|
||||||
|
upper bound for the last array).
|
||||||
|
|
||||||
|
Note that we first store the file offset to the `MarkAttachClassDef'
|
||||||
|
field (which has been introduced in OpenType 1.2) -- since the
|
||||||
|
`Version' field value hasn't been increased to indicate that we have
|
||||||
|
one more field for some obscure reason, we must parse the GSUB table
|
||||||
|
to find out whether class values refer to this table. Only then we
|
||||||
|
can finally load the MarkAttachClassDef structure if necessary. */
|
||||||
|
|
||||||
|
struct HB_GDEFHeader_
|
||||||
|
{
|
||||||
|
HB_UShort** NewGlyphClasses;
|
||||||
|
HB_UInt offset;
|
||||||
|
HB_UInt MarkAttachClassDef_offset;
|
||||||
|
|
||||||
|
HB_16Dot16 Version;
|
||||||
|
|
||||||
|
HB_ClassDefinition GlyphClassDef;
|
||||||
|
HB_AttachList AttachList;
|
||||||
|
HB_LigCaretList LigCaretList;
|
||||||
|
HB_ClassDefinition MarkAttachClassDef; /* new in OT 1.2 */
|
||||||
|
|
||||||
|
HB_UShort LastGlyph;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_GDEFHeader_ HB_GDEFHeader;
|
||||||
|
typedef struct HB_GDEFHeader_* HB_GDEF;
|
||||||
|
|
||||||
|
|
||||||
|
HB_Error HB_New_GDEF_Table( HB_GDEFHeader** retptr );
|
||||||
|
|
||||||
|
|
||||||
|
HB_Error HB_Load_GDEF_Table( HB_Stream stream,
|
||||||
|
HB_GDEFHeader** gdef );
|
||||||
|
|
||||||
|
|
||||||
|
HB_Error HB_Done_GDEF_Table ( HB_GDEFHeader* gdef );
|
||||||
|
|
||||||
|
|
||||||
|
HB_Error HB_GDEF_Get_Glyph_Property( HB_GDEFHeader* gdef,
|
||||||
|
HB_UShort glyphID,
|
||||||
|
HB_UShort* property );
|
||||||
|
|
||||||
|
HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef,
|
||||||
|
HB_UShort num_glyphs,
|
||||||
|
HB_UShort glyph_count,
|
||||||
|
HB_UShort* glyph_array,
|
||||||
|
HB_UShort* class_array );
|
||||||
|
|
||||||
|
#ifdef HB_USE_PACKED_STRUCTS
|
||||||
|
#pragma pack(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
HB_END_HEADER
|
||||||
|
|
||||||
|
#endif /* HARFBUZZ_GDEF_H */
|
|
@ -0,0 +1,118 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
|
||||||
|
* Copyright (C) 2007 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*
|
||||||
|
* Red Hat Author(s): Behdad Esfahbod
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HARFBUZZ_GLOBAL_H
|
||||||
|
#define HARFBUZZ_GLOBAL_H
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define HB_BEGIN_HEADER extern "C" {
|
||||||
|
#define HB_END_HEADER }
|
||||||
|
#else
|
||||||
|
#define HB_BEGIN_HEADER /* nothing */
|
||||||
|
#define HB_END_HEADER /* nothing */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
HB_BEGIN_HEADER
|
||||||
|
|
||||||
|
#ifndef FALSE
|
||||||
|
#define FALSE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef TRUE
|
||||||
|
#define TRUE (!FALSE)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define HB_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
|
||||||
|
( ( (HB_UInt)_x1 << 24 ) | \
|
||||||
|
( (HB_UInt)_x2 << 16 ) | \
|
||||||
|
( (HB_UInt)_x3 << 8 ) | \
|
||||||
|
(HB_UInt)_x4 )
|
||||||
|
|
||||||
|
typedef char hb_int8;
|
||||||
|
typedef unsigned char hb_uint8;
|
||||||
|
typedef short hb_int16;
|
||||||
|
typedef unsigned short hb_uint16;
|
||||||
|
typedef int hb_int32;
|
||||||
|
typedef unsigned int hb_uint32;
|
||||||
|
|
||||||
|
typedef hb_uint8 HB_Bool;
|
||||||
|
|
||||||
|
typedef hb_uint8 HB_Byte;
|
||||||
|
typedef hb_uint16 HB_UShort;
|
||||||
|
typedef hb_uint32 HB_UInt;
|
||||||
|
typedef hb_int8 HB_Char;
|
||||||
|
typedef hb_int16 HB_Short;
|
||||||
|
typedef hb_int32 HB_Int;
|
||||||
|
|
||||||
|
typedef hb_uint16 HB_UChar16;
|
||||||
|
typedef hb_uint32 HB_UChar32;
|
||||||
|
typedef hb_uint32 HB_Glyph;
|
||||||
|
typedef hb_int32 HB_Fixed; /* 26.6 */
|
||||||
|
|
||||||
|
#define HB_FIXED_CONSTANT(v) ((v) * 64)
|
||||||
|
#define HB_FIXED_ROUND(v) (((v)+32) & -64)
|
||||||
|
|
||||||
|
typedef hb_int32 HB_16Dot16; /* 16.16 */
|
||||||
|
|
||||||
|
typedef void * HB_Pointer;
|
||||||
|
typedef hb_uint32 HB_Tag;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
/* no error */
|
||||||
|
HB_Err_Ok = 0x0000,
|
||||||
|
HB_Err_Not_Covered = 0xFFFF,
|
||||||
|
|
||||||
|
/* _hb_err() is called whenever returning the following errors,
|
||||||
|
* and in a couple places for HB_Err_Not_Covered too. */
|
||||||
|
|
||||||
|
/* programmer error */
|
||||||
|
HB_Err_Invalid_Argument = 0x1A66,
|
||||||
|
|
||||||
|
/* font error */
|
||||||
|
HB_Err_Invalid_SubTable_Format = 0x157F,
|
||||||
|
HB_Err_Invalid_SubTable = 0x1570,
|
||||||
|
HB_Err_Read_Error = 0x6EAD,
|
||||||
|
|
||||||
|
/* system error */
|
||||||
|
HB_Err_Out_Of_Memory = 0xDEAD
|
||||||
|
} HB_Error;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
HB_Fixed x;
|
||||||
|
HB_Fixed y;
|
||||||
|
} HB_FixedPoint;
|
||||||
|
|
||||||
|
typedef struct HB_Font_ *HB_Font;
|
||||||
|
typedef struct HB_StreamRec_ *HB_Stream;
|
||||||
|
typedef struct HB_FaceRec_ *HB_Face;
|
||||||
|
|
||||||
|
HB_END_HEADER
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,729 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
|
||||||
|
* Copyright (C) 2006 Behdad Esfahbod
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HARFBUZZ_GPOS_PRIVATE_H
|
||||||
|
#define HARFBUZZ_GPOS_PRIVATE_H
|
||||||
|
|
||||||
|
#include "harfbuzz-impl.h"
|
||||||
|
#include "harfbuzz-stream-private.h"
|
||||||
|
#include "harfbuzz-gpos.h"
|
||||||
|
|
||||||
|
HB_BEGIN_HEADER
|
||||||
|
|
||||||
|
#ifdef HB_USE_PACKED_STRUCTS
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* shared tables */
|
||||||
|
|
||||||
|
#define VR_X_PLACEMENT_DEVICE 0
|
||||||
|
#define VR_Y_PLACEMENT_DEVICE 1
|
||||||
|
#define VR_X_ADVANCE_DEVICE 2
|
||||||
|
#define VR_Y_ADVANCE_DEVICE 3
|
||||||
|
|
||||||
|
struct HB_ValueRecord_
|
||||||
|
{
|
||||||
|
HB_Short XPlacement; /* horizontal adjustment for
|
||||||
|
placement */
|
||||||
|
HB_Short YPlacement; /* vertical adjustment for
|
||||||
|
placement */
|
||||||
|
HB_Short XAdvance; /* horizontal adjustment for
|
||||||
|
advance */
|
||||||
|
HB_Short YAdvance; /* vertical adjustment for
|
||||||
|
advance */
|
||||||
|
|
||||||
|
HB_Device** DeviceTables; /* device tables for placement
|
||||||
|
and advance */
|
||||||
|
|
||||||
|
#ifdef HB_SUPPORT_MULTIPLE_MASTER
|
||||||
|
HB_UShort XIdPlacement; /* horizontal placement metric ID */
|
||||||
|
HB_UShort YIdPlacement; /* vertical placement metric ID */
|
||||||
|
HB_UShort XIdAdvance; /* horizontal advance metric ID */
|
||||||
|
HB_UShort YIdAdvance; /* vertical advance metric ID */
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ValueRecord_ HB_ValueRecord;
|
||||||
|
|
||||||
|
|
||||||
|
/* Mask values to scan the value format of the ValueRecord structure.
|
||||||
|
We always expand compressed ValueRecords of the font. */
|
||||||
|
|
||||||
|
#define HB_GPOS_FORMAT_HAVE_DEVICE_TABLES 0x00F0
|
||||||
|
|
||||||
|
#define HB_GPOS_FORMAT_HAVE_X_PLACEMENT 0x0001
|
||||||
|
#define HB_GPOS_FORMAT_HAVE_Y_PLACEMENT 0x0002
|
||||||
|
#define HB_GPOS_FORMAT_HAVE_X_ADVANCE 0x0004
|
||||||
|
#define HB_GPOS_FORMAT_HAVE_Y_ADVANCE 0x0008
|
||||||
|
#define HB_GPOS_FORMAT_HAVE_X_PLACEMENT_DEVICE 0x0010
|
||||||
|
#define HB_GPOS_FORMAT_HAVE_Y_PLACEMENT_DEVICE 0x0020
|
||||||
|
#define HB_GPOS_FORMAT_HAVE_X_ADVANCE_DEVICE 0x0040
|
||||||
|
#define HB_GPOS_FORMAT_HAVE_Y_ADVANCE_DEVICE 0x0080
|
||||||
|
#define HB_GPOS_FORMAT_HAVE_X_ID_PLACEMENT 0x0100
|
||||||
|
#define HB_GPOS_FORMAT_HAVE_Y_ID_PLACEMENT 0x0200
|
||||||
|
#define HB_GPOS_FORMAT_HAVE_X_ID_ADVANCE 0x0400
|
||||||
|
#define HB_GPOS_FORMAT_HAVE_Y_ID_ADVANCE 0x0800
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_AnchorFormat1_
|
||||||
|
{
|
||||||
|
HB_Short XCoordinate; /* horizontal value */
|
||||||
|
HB_Short YCoordinate; /* vertical value */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_AnchorFormat1_ HB_AnchorFormat1;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_AnchorFormat2_
|
||||||
|
{
|
||||||
|
HB_Short XCoordinate; /* horizontal value */
|
||||||
|
HB_Short YCoordinate; /* vertical value */
|
||||||
|
HB_UShort AnchorPoint; /* index to glyph contour point */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_AnchorFormat2_ HB_AnchorFormat2;
|
||||||
|
|
||||||
|
#define AF3_X_DEVICE_TABLE 0
|
||||||
|
#define AF3_Y_DEVICE_TABLE 1
|
||||||
|
|
||||||
|
struct HB_AnchorFormat3_
|
||||||
|
{
|
||||||
|
HB_Short XCoordinate; /* horizontal value */
|
||||||
|
HB_Short YCoordinate; /* vertical value */
|
||||||
|
HB_Device** DeviceTables; /* device tables for coordinates */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_AnchorFormat3_ HB_AnchorFormat3;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HB_SUPPORT_MULTIPLE_MASTER
|
||||||
|
struct HB_AnchorFormat4_
|
||||||
|
{
|
||||||
|
HB_UShort XIdAnchor; /* horizontal metric ID */
|
||||||
|
HB_UShort YIdAnchor; /* vertical metric ID */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_AnchorFormat4_ HB_AnchorFormat4;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_Anchor_
|
||||||
|
{
|
||||||
|
HB_Byte PosFormat; /* 1, 2, 3, or 4 -- 0 indicates
|
||||||
|
that there is no Anchor table */
|
||||||
|
|
||||||
|
union
|
||||||
|
{
|
||||||
|
HB_AnchorFormat1 af1;
|
||||||
|
HB_AnchorFormat2 af2;
|
||||||
|
HB_AnchorFormat3 af3;
|
||||||
|
#ifdef HB_SUPPORT_MULTIPLE_MASTER
|
||||||
|
HB_AnchorFormat4 af4;
|
||||||
|
#endif
|
||||||
|
} af;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_Anchor_ HB_Anchor;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_MarkRecord_
|
||||||
|
{
|
||||||
|
HB_UShort Class; /* mark class */
|
||||||
|
HB_Anchor MarkAnchor; /* anchor table */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_MarkRecord_ HB_MarkRecord;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_MarkArray_
|
||||||
|
{
|
||||||
|
HB_UShort MarkCount; /* number of MarkRecord tables */
|
||||||
|
HB_MarkRecord* MarkRecord; /* array of MarkRecord tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_MarkArray_ HB_MarkArray;
|
||||||
|
|
||||||
|
|
||||||
|
/* LookupType 1 */
|
||||||
|
|
||||||
|
struct HB_SinglePosFormat1_
|
||||||
|
{
|
||||||
|
HB_ValueRecord Value; /* ValueRecord for all covered
|
||||||
|
glyphs */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_SinglePosFormat1_ HB_SinglePosFormat1;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_SinglePosFormat2_
|
||||||
|
{
|
||||||
|
HB_UShort ValueCount; /* number of ValueRecord tables */
|
||||||
|
HB_ValueRecord* Value; /* array of ValueRecord tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_SinglePosFormat2_ HB_SinglePosFormat2;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_SinglePos_
|
||||||
|
{
|
||||||
|
HB_Byte PosFormat; /* 1 or 2 */
|
||||||
|
HB_Coverage Coverage; /* Coverage table */
|
||||||
|
|
||||||
|
HB_UShort ValueFormat; /* format of ValueRecord table */
|
||||||
|
|
||||||
|
union
|
||||||
|
{
|
||||||
|
HB_SinglePosFormat1 spf1;
|
||||||
|
HB_SinglePosFormat2 spf2;
|
||||||
|
} spf;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_SinglePos_ HB_SinglePos;
|
||||||
|
|
||||||
|
|
||||||
|
/* LookupType 2 */
|
||||||
|
|
||||||
|
struct HB_PairValueRecord_
|
||||||
|
{
|
||||||
|
HB_UShort SecondGlyph; /* glyph ID for second glyph */
|
||||||
|
HB_ValueRecord Value1; /* pos. data for first glyph */
|
||||||
|
HB_ValueRecord Value2; /* pos. data for second glyph */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_PairValueRecord_ HB_PairValueRecord;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_PairSet_
|
||||||
|
{
|
||||||
|
HB_UShort PairValueCount;
|
||||||
|
/* number of PairValueRecord tables */
|
||||||
|
HB_PairValueRecord* PairValueRecord;
|
||||||
|
/* array of PairValueRecord tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_PairSet_ HB_PairSet;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_PairPosFormat1_
|
||||||
|
{
|
||||||
|
HB_UShort PairSetCount; /* number of PairSet tables */
|
||||||
|
HB_PairSet* PairSet; /* array of PairSet tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_PairPosFormat1_ HB_PairPosFormat1;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_Class2Record_
|
||||||
|
{
|
||||||
|
HB_ValueRecord Value1; /* pos. data for first glyph */
|
||||||
|
HB_ValueRecord Value2; /* pos. data for second glyph */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_Class2Record_ HB_Class2Record;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_Class1Record_
|
||||||
|
{
|
||||||
|
HB_Class2Record* Class2Record; /* array of Class2Record tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_Class1Record_ HB_Class1Record;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_PairPosFormat2_
|
||||||
|
{
|
||||||
|
HB_ClassDefinition ClassDef1; /* class def. for first glyph */
|
||||||
|
HB_ClassDefinition ClassDef2; /* class def. for second glyph */
|
||||||
|
HB_UShort Class1Count; /* number of classes in ClassDef1
|
||||||
|
table */
|
||||||
|
HB_UShort Class2Count; /* number of classes in ClassDef2
|
||||||
|
table */
|
||||||
|
HB_Class1Record* Class1Record; /* array of Class1Record tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_PairPosFormat2_ HB_PairPosFormat2;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_PairPos_
|
||||||
|
{
|
||||||
|
HB_Byte PosFormat; /* 1 or 2 */
|
||||||
|
HB_Coverage Coverage; /* Coverage table */
|
||||||
|
HB_UShort ValueFormat1; /* format of ValueRecord table
|
||||||
|
for first glyph */
|
||||||
|
HB_UShort ValueFormat2; /* format of ValueRecord table
|
||||||
|
for second glyph */
|
||||||
|
|
||||||
|
union
|
||||||
|
{
|
||||||
|
HB_PairPosFormat1 ppf1;
|
||||||
|
HB_PairPosFormat2 ppf2;
|
||||||
|
} ppf;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_PairPos_ HB_PairPos;
|
||||||
|
|
||||||
|
|
||||||
|
/* LookupType 3 */
|
||||||
|
|
||||||
|
struct HB_EntryExitRecord_
|
||||||
|
{
|
||||||
|
HB_Anchor EntryAnchor; /* entry Anchor table */
|
||||||
|
HB_Anchor ExitAnchor; /* exit Anchor table */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct HB_EntryExitRecord_ HB_EntryExitRecord;
|
||||||
|
|
||||||
|
struct HB_CursivePos_
|
||||||
|
{
|
||||||
|
HB_UShort PosFormat; /* always 1 */
|
||||||
|
HB_Coverage Coverage; /* Coverage table */
|
||||||
|
HB_UShort EntryExitCount;
|
||||||
|
/* number of EntryExitRecord tables */
|
||||||
|
HB_EntryExitRecord* EntryExitRecord;
|
||||||
|
/* array of EntryExitRecord tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_CursivePos_ HB_CursivePos;
|
||||||
|
|
||||||
|
|
||||||
|
/* LookupType 4 */
|
||||||
|
|
||||||
|
struct HB_BaseRecord_
|
||||||
|
{
|
||||||
|
HB_Anchor* BaseAnchor; /* array of base glyph anchor
|
||||||
|
tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_BaseRecord_ HB_BaseRecord;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_BaseArray_
|
||||||
|
{
|
||||||
|
HB_UShort BaseCount; /* number of BaseRecord tables */
|
||||||
|
HB_BaseRecord* BaseRecord; /* array of BaseRecord tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_BaseArray_ HB_BaseArray;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_MarkBasePos_
|
||||||
|
{
|
||||||
|
HB_UShort PosFormat; /* always 1 */
|
||||||
|
HB_Coverage MarkCoverage; /* mark glyph coverage table */
|
||||||
|
HB_Coverage BaseCoverage; /* base glyph coverage table */
|
||||||
|
HB_UShort ClassCount; /* number of mark classes */
|
||||||
|
HB_MarkArray MarkArray; /* mark array table */
|
||||||
|
HB_BaseArray BaseArray; /* base array table */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_MarkBasePos_ HB_MarkBasePos;
|
||||||
|
|
||||||
|
|
||||||
|
/* LookupType 5 */
|
||||||
|
|
||||||
|
struct HB_ComponentRecord_
|
||||||
|
{
|
||||||
|
HB_Anchor* LigatureAnchor; /* array of ligature glyph anchor
|
||||||
|
tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ComponentRecord_ HB_ComponentRecord;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_LigatureAttach_
|
||||||
|
{
|
||||||
|
HB_UShort ComponentCount;
|
||||||
|
/* number of ComponentRecord tables */
|
||||||
|
HB_ComponentRecord* ComponentRecord;
|
||||||
|
/* array of ComponentRecord tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_LigatureAttach_ HB_LigatureAttach;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_LigatureArray_
|
||||||
|
{
|
||||||
|
HB_UShort LigatureCount; /* number of LigatureAttach tables */
|
||||||
|
HB_LigatureAttach* LigatureAttach;
|
||||||
|
/* array of LigatureAttach tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_LigatureArray_ HB_LigatureArray;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_MarkLigPos_
|
||||||
|
{
|
||||||
|
HB_UShort PosFormat; /* always 1 */
|
||||||
|
HB_Coverage MarkCoverage; /* mark glyph coverage table */
|
||||||
|
HB_Coverage LigatureCoverage;
|
||||||
|
/* ligature glyph coverage table */
|
||||||
|
HB_UShort ClassCount; /* number of mark classes */
|
||||||
|
HB_MarkArray MarkArray; /* mark array table */
|
||||||
|
HB_LigatureArray LigatureArray; /* ligature array table */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_MarkLigPos_ HB_MarkLigPos;
|
||||||
|
|
||||||
|
|
||||||
|
/* LookupType 6 */
|
||||||
|
|
||||||
|
struct HB_Mark2Record_
|
||||||
|
{
|
||||||
|
HB_Anchor* Mark2Anchor; /* array of mark glyph anchor
|
||||||
|
tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_Mark2Record_ HB_Mark2Record;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_Mark2Array_
|
||||||
|
{
|
||||||
|
HB_UShort Mark2Count; /* number of Mark2Record tables */
|
||||||
|
HB_Mark2Record* Mark2Record; /* array of Mark2Record tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_Mark2Array_ HB_Mark2Array;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_MarkMarkPos_
|
||||||
|
{
|
||||||
|
HB_UShort PosFormat; /* always 1 */
|
||||||
|
HB_Coverage Mark1Coverage; /* first mark glyph coverage table */
|
||||||
|
HB_Coverage Mark2Coverage; /* second mark glyph coverave table */
|
||||||
|
HB_UShort ClassCount; /* number of combining mark classes */
|
||||||
|
HB_MarkArray Mark1Array; /* MarkArray table for first mark */
|
||||||
|
HB_Mark2Array Mark2Array; /* MarkArray table for second mark */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_MarkMarkPos_ HB_MarkMarkPos;
|
||||||
|
|
||||||
|
|
||||||
|
/* needed by both lookup type 7 and 8 */
|
||||||
|
|
||||||
|
struct HB_PosLookupRecord_
|
||||||
|
{
|
||||||
|
HB_UShort SequenceIndex; /* index into current
|
||||||
|
glyph sequence */
|
||||||
|
HB_UShort LookupListIndex; /* Lookup to apply to that pos. */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_PosLookupRecord_ HB_PosLookupRecord;
|
||||||
|
|
||||||
|
|
||||||
|
/* LookupType 7 */
|
||||||
|
|
||||||
|
struct HB_PosRule_
|
||||||
|
{
|
||||||
|
HB_UShort GlyphCount; /* total number of input glyphs */
|
||||||
|
HB_UShort PosCount; /* number of PosLookupRecord tables */
|
||||||
|
HB_UShort* Input; /* array of input glyph IDs */
|
||||||
|
HB_PosLookupRecord* PosLookupRecord;
|
||||||
|
/* array of PosLookupRecord tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_PosRule_ HB_PosRule;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_PosRuleSet_
|
||||||
|
{
|
||||||
|
HB_UShort PosRuleCount; /* number of PosRule tables */
|
||||||
|
HB_PosRule* PosRule; /* array of PosRule tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_PosRuleSet_ HB_PosRuleSet;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_ContextPosFormat1_
|
||||||
|
{
|
||||||
|
HB_Coverage Coverage; /* Coverage table */
|
||||||
|
HB_UShort PosRuleSetCount; /* number of PosRuleSet tables */
|
||||||
|
HB_PosRuleSet* PosRuleSet; /* array of PosRuleSet tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ContextPosFormat1_ HB_ContextPosFormat1;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_PosClassRule_
|
||||||
|
{
|
||||||
|
HB_UShort GlyphCount; /* total number of context classes */
|
||||||
|
HB_UShort PosCount; /* number of PosLookupRecord tables */
|
||||||
|
HB_UShort* Class; /* array of classes */
|
||||||
|
HB_PosLookupRecord* PosLookupRecord;
|
||||||
|
/* array of PosLookupRecord tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_PosClassRule_ HB_PosClassRule;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_PosClassSet_
|
||||||
|
{
|
||||||
|
HB_UShort PosClassRuleCount;
|
||||||
|
/* number of PosClassRule tables */
|
||||||
|
HB_PosClassRule* PosClassRule; /* array of PosClassRule tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_PosClassSet_ HB_PosClassSet;
|
||||||
|
|
||||||
|
|
||||||
|
/* The `MaxContextLength' field is not defined in the TTO specification
|
||||||
|
but simplifies the implementation of this format. It holds the
|
||||||
|
maximal context length used in the context rules. */
|
||||||
|
|
||||||
|
struct HB_ContextPosFormat2_
|
||||||
|
{
|
||||||
|
HB_UShort MaxContextLength;
|
||||||
|
/* maximal context length */
|
||||||
|
HB_Coverage Coverage; /* Coverage table */
|
||||||
|
HB_ClassDefinition ClassDef; /* ClassDef table */
|
||||||
|
HB_UShort PosClassSetCount;
|
||||||
|
/* number of PosClassSet tables */
|
||||||
|
HB_PosClassSet* PosClassSet; /* array of PosClassSet tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ContextPosFormat2_ HB_ContextPosFormat2;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_ContextPosFormat3_
|
||||||
|
{
|
||||||
|
HB_UShort GlyphCount; /* number of input glyphs */
|
||||||
|
HB_UShort PosCount; /* number of PosLookupRecord tables */
|
||||||
|
HB_Coverage* Coverage; /* array of Coverage tables */
|
||||||
|
HB_PosLookupRecord* PosLookupRecord;
|
||||||
|
/* array of PosLookupRecord tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ContextPosFormat3_ HB_ContextPosFormat3;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_ContextPos_
|
||||||
|
{
|
||||||
|
HB_Byte PosFormat; /* 1, 2, or 3 */
|
||||||
|
|
||||||
|
union
|
||||||
|
{
|
||||||
|
HB_ContextPosFormat1 cpf1;
|
||||||
|
HB_ContextPosFormat2 cpf2;
|
||||||
|
HB_ContextPosFormat3 cpf3;
|
||||||
|
} cpf;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ContextPos_ HB_ContextPos;
|
||||||
|
|
||||||
|
|
||||||
|
/* LookupType 8 */
|
||||||
|
|
||||||
|
struct HB_ChainPosRule_
|
||||||
|
{
|
||||||
|
HB_UShort* Backtrack; /* array of backtrack glyph IDs */
|
||||||
|
HB_UShort* Input; /* array of input glyph IDs */
|
||||||
|
HB_UShort* Lookahead; /* array of lookahead glyph IDs */
|
||||||
|
HB_PosLookupRecord* PosLookupRecord;
|
||||||
|
/* array of PosLookupRecords */
|
||||||
|
HB_UShort BacktrackGlyphCount;
|
||||||
|
/* total number of backtrack glyphs */
|
||||||
|
HB_UShort InputGlyphCount;
|
||||||
|
/* total number of input glyphs */
|
||||||
|
HB_UShort LookaheadGlyphCount;
|
||||||
|
/* total number of lookahead glyphs */
|
||||||
|
HB_UShort PosCount; /* number of PosLookupRecords */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ChainPosRule_ HB_ChainPosRule;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_ChainPosRuleSet_
|
||||||
|
{
|
||||||
|
HB_UShort ChainPosRuleCount;
|
||||||
|
/* number of ChainPosRule tables */
|
||||||
|
HB_ChainPosRule* ChainPosRule; /* array of ChainPosRule tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ChainPosRuleSet_ HB_ChainPosRuleSet;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_ChainContextPosFormat1_
|
||||||
|
{
|
||||||
|
HB_Coverage Coverage; /* Coverage table */
|
||||||
|
HB_UShort ChainPosRuleSetCount;
|
||||||
|
/* number of ChainPosRuleSet tables */
|
||||||
|
HB_ChainPosRuleSet* ChainPosRuleSet;
|
||||||
|
/* array of ChainPosRuleSet tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ChainContextPosFormat1_ HB_ChainContextPosFormat1;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_ChainPosClassRule_
|
||||||
|
{
|
||||||
|
HB_UShort* Backtrack; /* array of backtrack classes */
|
||||||
|
HB_UShort* Input; /* array of context classes */
|
||||||
|
HB_UShort* Lookahead; /* array of lookahead classes */
|
||||||
|
HB_PosLookupRecord* PosLookupRecord;
|
||||||
|
/* array of substitution lookups */
|
||||||
|
HB_UShort BacktrackGlyphCount;
|
||||||
|
/* total number of backtrack
|
||||||
|
classes */
|
||||||
|
HB_UShort InputGlyphCount;
|
||||||
|
/* total number of context classes */
|
||||||
|
HB_UShort LookaheadGlyphCount;
|
||||||
|
/* total number of lookahead
|
||||||
|
classes */
|
||||||
|
HB_UShort PosCount; /* number of PosLookupRecords */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ChainPosClassRule_ HB_ChainPosClassRule;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_ChainPosClassSet_
|
||||||
|
{
|
||||||
|
HB_UShort ChainPosClassRuleCount;
|
||||||
|
/* number of ChainPosClassRule
|
||||||
|
tables */
|
||||||
|
HB_ChainPosClassRule* ChainPosClassRule;
|
||||||
|
/* array of ChainPosClassRule
|
||||||
|
tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ChainPosClassSet_ HB_ChainPosClassSet;
|
||||||
|
|
||||||
|
|
||||||
|
/* The `MaxXXXLength' fields are not defined in the TTO specification
|
||||||
|
but simplifies the implementation of this format. It holds the
|
||||||
|
maximal context length used in the specific context rules. */
|
||||||
|
|
||||||
|
struct HB_ChainContextPosFormat2_
|
||||||
|
{
|
||||||
|
HB_Coverage Coverage; /* Coverage table */
|
||||||
|
|
||||||
|
HB_UShort MaxBacktrackLength;
|
||||||
|
/* maximal backtrack length */
|
||||||
|
HB_ClassDefinition BacktrackClassDef;
|
||||||
|
/* BacktrackClassDef table */
|
||||||
|
HB_UShort MaxInputLength;
|
||||||
|
/* maximal input length */
|
||||||
|
HB_ClassDefinition InputClassDef;
|
||||||
|
/* InputClassDef table */
|
||||||
|
HB_UShort MaxLookaheadLength;
|
||||||
|
/* maximal lookahead length */
|
||||||
|
HB_ClassDefinition LookaheadClassDef;
|
||||||
|
/* LookaheadClassDef table */
|
||||||
|
|
||||||
|
HB_UShort ChainPosClassSetCount;
|
||||||
|
/* number of ChainPosClassSet
|
||||||
|
tables */
|
||||||
|
HB_ChainPosClassSet* ChainPosClassSet;
|
||||||
|
/* array of ChainPosClassSet
|
||||||
|
tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ChainContextPosFormat2_ HB_ChainContextPosFormat2;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_ChainContextPosFormat3_
|
||||||
|
{
|
||||||
|
HB_UShort BacktrackGlyphCount;
|
||||||
|
/* number of backtrack glyphs */
|
||||||
|
HB_Coverage* BacktrackCoverage;
|
||||||
|
/* array of backtrack Coverage
|
||||||
|
tables */
|
||||||
|
HB_UShort InputGlyphCount;
|
||||||
|
/* number of input glyphs */
|
||||||
|
HB_Coverage* InputCoverage;
|
||||||
|
/* array of input coverage
|
||||||
|
tables */
|
||||||
|
HB_UShort LookaheadGlyphCount;
|
||||||
|
/* number of lookahead glyphs */
|
||||||
|
HB_Coverage* LookaheadCoverage;
|
||||||
|
/* array of lookahead coverage
|
||||||
|
tables */
|
||||||
|
HB_UShort PosCount; /* number of PosLookupRecords */
|
||||||
|
HB_PosLookupRecord* PosLookupRecord;
|
||||||
|
/* array of substitution lookups */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ChainContextPosFormat3_ HB_ChainContextPosFormat3;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_ChainContextPos_
|
||||||
|
{
|
||||||
|
HB_Byte PosFormat; /* 1, 2, or 3 */
|
||||||
|
|
||||||
|
union
|
||||||
|
{
|
||||||
|
HB_ChainContextPosFormat1 ccpf1;
|
||||||
|
HB_ChainContextPosFormat2 ccpf2;
|
||||||
|
HB_ChainContextPosFormat3 ccpf3;
|
||||||
|
} ccpf;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ChainContextPos_ HB_ChainContextPos;
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* LookupType 10 */
|
||||||
|
struct HB_ExtensionPos_
|
||||||
|
{
|
||||||
|
HB_UShort PosFormat; /* always 1 */
|
||||||
|
HB_UShort LookuptType; /* lookup-type of referenced subtable */
|
||||||
|
HB_GPOS_SubTable *subtable; /* referenced subtable */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ExtensionPos_ HB_ExtensionPos;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
union HB_GPOS_SubTable_
|
||||||
|
{
|
||||||
|
HB_SinglePos single;
|
||||||
|
HB_PairPos pair;
|
||||||
|
HB_CursivePos cursive;
|
||||||
|
HB_MarkBasePos markbase;
|
||||||
|
HB_MarkLigPos marklig;
|
||||||
|
HB_MarkMarkPos markmark;
|
||||||
|
HB_ContextPos context;
|
||||||
|
HB_ChainContextPos chain;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef union HB_GPOS_SubTable_ HB_GPOS_SubTable;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_HB_GPOS_Load_SubTable( HB_GPOS_SubTable* st,
|
||||||
|
HB_Stream stream,
|
||||||
|
HB_UShort lookup_type );
|
||||||
|
|
||||||
|
HB_INTERNAL void
|
||||||
|
_HB_GPOS_Free_SubTable( HB_GPOS_SubTable* st,
|
||||||
|
HB_UShort lookup_type );
|
||||||
|
|
||||||
|
#ifdef HB_USE_PACKED_STRUCTS
|
||||||
|
#pragma pack(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
HB_END_HEADER
|
||||||
|
|
||||||
|
#endif /* HARFBUZZ_GPOS_PRIVATE_H */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,155 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
|
||||||
|
* Copyright (C) 2006 Behdad Esfahbod
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HARFBUZZ_GPOS_H
|
||||||
|
#define HARFBUZZ_GPOS_H
|
||||||
|
|
||||||
|
#include "harfbuzz-gdef.h"
|
||||||
|
#include "harfbuzz-buffer.h"
|
||||||
|
|
||||||
|
HB_BEGIN_HEADER
|
||||||
|
|
||||||
|
|
||||||
|
/* Lookup types for glyph positioning */
|
||||||
|
|
||||||
|
#define HB_GPOS_LOOKUP_SINGLE 1
|
||||||
|
#define HB_GPOS_LOOKUP_PAIR 2
|
||||||
|
#define HB_GPOS_LOOKUP_CURSIVE 3
|
||||||
|
#define HB_GPOS_LOOKUP_MARKBASE 4
|
||||||
|
#define HB_GPOS_LOOKUP_MARKLIG 5
|
||||||
|
#define HB_GPOS_LOOKUP_MARKMARK 6
|
||||||
|
#define HB_GPOS_LOOKUP_CONTEXT 7
|
||||||
|
#define HB_GPOS_LOOKUP_CHAIN 8
|
||||||
|
#define HB_GPOS_LOOKUP_EXTENSION 9
|
||||||
|
|
||||||
|
#ifdef HB_SUPPORT_MULTIPLE_MASTER
|
||||||
|
/* A pointer to a function which accesses the PostScript interpreter.
|
||||||
|
Multiple Master fonts need this interface to convert a metric ID
|
||||||
|
(as stored in an OpenType font version 1.2 or higher) `metric_id'
|
||||||
|
into a metric value (returned in `metric_value').
|
||||||
|
|
||||||
|
`data' points to the user-defined structure specified during a
|
||||||
|
call to HB_GPOS_Register_MM_Function().
|
||||||
|
|
||||||
|
`metric_value' must be returned as a scaled value (but shouldn't
|
||||||
|
be rounded). */
|
||||||
|
|
||||||
|
typedef HB_Error (*HB_MMFunction)(HB_Font font,
|
||||||
|
HB_UShort metric_id,
|
||||||
|
HB_Fixed* metric_value,
|
||||||
|
void* data );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_GPOSHeader_
|
||||||
|
{
|
||||||
|
HB_16Dot16 Version;
|
||||||
|
|
||||||
|
HB_ScriptList ScriptList;
|
||||||
|
HB_FeatureList FeatureList;
|
||||||
|
HB_LookupList LookupList;
|
||||||
|
|
||||||
|
HB_GDEFHeader* gdef;
|
||||||
|
|
||||||
|
#ifdef HB_SUPPORT_MULTIPLE_MASTER
|
||||||
|
/* this is OpenType 1.2 -- Multiple Master fonts need this
|
||||||
|
callback function to get various metric values from the
|
||||||
|
PostScript interpreter. */
|
||||||
|
|
||||||
|
HB_MMFunction mmfunc;
|
||||||
|
void* data;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_GPOSHeader_ HB_GPOSHeader;
|
||||||
|
typedef HB_GPOSHeader* HB_GPOS;
|
||||||
|
|
||||||
|
|
||||||
|
HB_Error HB_Load_GPOS_Table( HB_Stream stream,
|
||||||
|
HB_GPOSHeader** gpos,
|
||||||
|
HB_GDEFHeader* gdef,
|
||||||
|
HB_Stream gdefStream );
|
||||||
|
|
||||||
|
|
||||||
|
HB_Error HB_Done_GPOS_Table( HB_GPOSHeader* gpos );
|
||||||
|
|
||||||
|
|
||||||
|
HB_Error HB_GPOS_Select_Script( HB_GPOSHeader* gpos,
|
||||||
|
HB_UInt script_tag,
|
||||||
|
HB_UShort* script_index );
|
||||||
|
|
||||||
|
HB_Error HB_GPOS_Select_Language( HB_GPOSHeader* gpos,
|
||||||
|
HB_UInt language_tag,
|
||||||
|
HB_UShort script_index,
|
||||||
|
HB_UShort* language_index,
|
||||||
|
HB_UShort* req_feature_index );
|
||||||
|
|
||||||
|
HB_Error HB_GPOS_Select_Feature( HB_GPOSHeader* gpos,
|
||||||
|
HB_UInt feature_tag,
|
||||||
|
HB_UShort script_index,
|
||||||
|
HB_UShort language_index,
|
||||||
|
HB_UShort* feature_index );
|
||||||
|
|
||||||
|
|
||||||
|
HB_Error HB_GPOS_Query_Scripts( HB_GPOSHeader* gpos,
|
||||||
|
HB_UInt** script_tag_list );
|
||||||
|
|
||||||
|
HB_Error HB_GPOS_Query_Languages( HB_GPOSHeader* gpos,
|
||||||
|
HB_UShort script_index,
|
||||||
|
HB_UInt** language_tag_list );
|
||||||
|
|
||||||
|
HB_Error HB_GPOS_Query_Features( HB_GPOSHeader* gpos,
|
||||||
|
HB_UShort script_index,
|
||||||
|
HB_UShort language_index,
|
||||||
|
HB_UInt** feature_tag_list );
|
||||||
|
|
||||||
|
|
||||||
|
HB_Error HB_GPOS_Add_Feature( HB_GPOSHeader* gpos,
|
||||||
|
HB_UShort feature_index,
|
||||||
|
HB_UInt property );
|
||||||
|
|
||||||
|
HB_Error HB_GPOS_Clear_Features( HB_GPOSHeader* gpos );
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HB_SUPPORT_MULTIPLE_MASTER
|
||||||
|
HB_Error HB_GPOS_Register_MM_Function( HB_GPOSHeader* gpos,
|
||||||
|
HB_MMFunction mmfunc,
|
||||||
|
void* data );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* If `dvi' is TRUE, glyph contour points for anchor points and device
|
||||||
|
tables are ignored -- you will get device independent values. */
|
||||||
|
|
||||||
|
|
||||||
|
HB_Error HB_GPOS_Apply_String( HB_Font font,
|
||||||
|
HB_GPOSHeader* gpos,
|
||||||
|
HB_UShort load_flags,
|
||||||
|
HB_Buffer buffer,
|
||||||
|
HB_Bool dvi,
|
||||||
|
HB_Bool r2l );
|
||||||
|
|
||||||
|
HB_END_HEADER
|
||||||
|
|
||||||
|
#endif /* HARFBUZZ_GPOS_H */
|
|
@ -0,0 +1,447 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "harfbuzz-shaper.h"
|
||||||
|
#include "harfbuzz-shaper-private.h"
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
#ifndef NO_OPENTYPE
|
||||||
|
static const HB_OpenTypeFeature greek_features[] = {
|
||||||
|
{ HB_MAKE_TAG('c', 'c', 'm', 'p'), CcmpProperty },
|
||||||
|
{ HB_MAKE_TAG('l', 'i', 'g', 'a'), CcmpProperty },
|
||||||
|
{ HB_MAKE_TAG('c', 'l', 'i', 'g'), CcmpProperty },
|
||||||
|
{0, 0}
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
Greek decompositions
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _hb_greek_decomposition {
|
||||||
|
HB_UChar16 composed;
|
||||||
|
HB_UChar16 base;
|
||||||
|
} hb_greek_decomposition;
|
||||||
|
|
||||||
|
static const hb_greek_decomposition decompose_0x300[] = {
|
||||||
|
{ 0x1FBA, 0x0391 },
|
||||||
|
{ 0x1FC8, 0x0395 },
|
||||||
|
{ 0x1FCA, 0x0397 },
|
||||||
|
{ 0x1FDA, 0x0399 },
|
||||||
|
{ 0x1FF8, 0x039F },
|
||||||
|
{ 0x1FEA, 0x03A5 },
|
||||||
|
{ 0x1FFA, 0x03A9 },
|
||||||
|
{ 0x1F70, 0x03B1 },
|
||||||
|
{ 0x1F72, 0x03B5 },
|
||||||
|
{ 0x1F74, 0x03B7 },
|
||||||
|
{ 0x1F76, 0x03B9 },
|
||||||
|
{ 0x1F78, 0x03BF },
|
||||||
|
{ 0x1F7A, 0x03C5 },
|
||||||
|
{ 0x1F7C, 0x03C9 },
|
||||||
|
{ 0x1FD2, 0x03CA },
|
||||||
|
{ 0x1FE2, 0x03CB },
|
||||||
|
{ 0x1F02, 0x1F00 },
|
||||||
|
{ 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static HB_UChar16 compose_0x300(HB_UChar16 base)
|
||||||
|
{
|
||||||
|
if ((base ^ 0x1f00) < 0x100) {
|
||||||
|
if (base <= 0x1f69 && !(base & 0x6))
|
||||||
|
return base + 2;
|
||||||
|
if (base == 0x1fbf)
|
||||||
|
return 0x1fcd;
|
||||||
|
if (base == 0x1ffe)
|
||||||
|
return 0x1fdd;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
const hb_greek_decomposition *d = decompose_0x300;
|
||||||
|
while (d->base && d->base != base)
|
||||||
|
++d;
|
||||||
|
return d->composed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static const hb_greek_decomposition decompose_0x301[] = {
|
||||||
|
{ 0x0386, 0x0391 },
|
||||||
|
{ 0x0388, 0x0395 },
|
||||||
|
{ 0x0389, 0x0397 },
|
||||||
|
{ 0x038A, 0x0399 },
|
||||||
|
{ 0x038C, 0x039F },
|
||||||
|
{ 0x038E, 0x03A5 },
|
||||||
|
{ 0x038F, 0x03A9 },
|
||||||
|
{ 0x03AC, 0x03B1 },
|
||||||
|
{ 0x03AD, 0x03B5 },
|
||||||
|
{ 0x03AE, 0x03B7 },
|
||||||
|
{ 0x03AF, 0x03B9 },
|
||||||
|
{ 0x03CC, 0x03BF },
|
||||||
|
{ 0x03CD, 0x03C5 },
|
||||||
|
{ 0x03CE, 0x03C9 },
|
||||||
|
{ 0x0390, 0x03CA },
|
||||||
|
{ 0x03B0, 0x03CB },
|
||||||
|
{ 0x03D3, 0x03D2 },
|
||||||
|
{ 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static HB_UChar16 compose_0x301(HB_UChar16 base)
|
||||||
|
{
|
||||||
|
if ((base ^ 0x1f00) < 0x100) {
|
||||||
|
if (base <= 0x1f69 && !(base & 0x6))
|
||||||
|
return base + 4;
|
||||||
|
if (base == 0x1fbf)
|
||||||
|
return 0x1fce;
|
||||||
|
if (base == 0x1ffe)
|
||||||
|
return 0x1fde;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
const hb_greek_decomposition *d = decompose_0x301;
|
||||||
|
while (d->base && d->base != base)
|
||||||
|
++d;
|
||||||
|
return d->composed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static const hb_greek_decomposition decompose_0x304[] = {
|
||||||
|
{ 0x1FB9, 0x0391 },
|
||||||
|
{ 0x1FD9, 0x0399 },
|
||||||
|
{ 0x1FE9, 0x03A5 },
|
||||||
|
{ 0x1FB1, 0x03B1 },
|
||||||
|
{ 0x1FD1, 0x03B9 },
|
||||||
|
{ 0x1FE1, 0x03C5 },
|
||||||
|
{ 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static HB_UChar16 compose_0x304(HB_UChar16 base)
|
||||||
|
{
|
||||||
|
const hb_greek_decomposition *d = decompose_0x304;
|
||||||
|
while (d->base && d->base != base)
|
||||||
|
++d;
|
||||||
|
return d->composed;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const hb_greek_decomposition decompose_0x306[] = {
|
||||||
|
{ 0x1FB8, 0x0391 },
|
||||||
|
{ 0x1FD8, 0x0399 },
|
||||||
|
{ 0x1FE8, 0x03A5 },
|
||||||
|
{ 0x1FB0, 0x03B1 },
|
||||||
|
{ 0x1FD0, 0x03B9 },
|
||||||
|
{ 0x1FE0, 0x03C5 },
|
||||||
|
{ 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static HB_UChar16 compose_0x306(HB_UChar16 base)
|
||||||
|
{
|
||||||
|
const hb_greek_decomposition *d = decompose_0x306;
|
||||||
|
while (d->base && d->base != base)
|
||||||
|
++d;
|
||||||
|
return d->composed;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const hb_greek_decomposition decompose_0x308[] = {
|
||||||
|
{ 0x03AA, 0x0399 },
|
||||||
|
{ 0x03AB, 0x03A5 },
|
||||||
|
{ 0x03CA, 0x03B9 },
|
||||||
|
{ 0x03CB, 0x03C5 },
|
||||||
|
{ 0x03D4, 0x03D2 },
|
||||||
|
{ 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static HB_UChar16 compose_0x308(HB_UChar16 base)
|
||||||
|
{
|
||||||
|
const hb_greek_decomposition *d = decompose_0x308;
|
||||||
|
while (d->base && d->base != base)
|
||||||
|
++d;
|
||||||
|
return d->composed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static const hb_greek_decomposition decompose_0x313[] = {
|
||||||
|
{ 0x1F08, 0x0391 },
|
||||||
|
{ 0x1F18, 0x0395 },
|
||||||
|
{ 0x1F28, 0x0397 },
|
||||||
|
{ 0x1F38, 0x0399 },
|
||||||
|
{ 0x1F48, 0x039F },
|
||||||
|
{ 0x1F68, 0x03A9 },
|
||||||
|
{ 0x1F00, 0x03B1 },
|
||||||
|
{ 0x1F10, 0x03B5 },
|
||||||
|
{ 0x1F20, 0x03B7 },
|
||||||
|
{ 0x1F30, 0x03B9 },
|
||||||
|
{ 0x1F40, 0x03BF },
|
||||||
|
{ 0x1FE4, 0x03C1 },
|
||||||
|
{ 0x1F50, 0x03C5 },
|
||||||
|
{ 0x1F60, 0x03C9 },
|
||||||
|
{ 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static HB_UChar16 compose_0x313(HB_UChar16 base)
|
||||||
|
{
|
||||||
|
const hb_greek_decomposition *d = decompose_0x313;
|
||||||
|
while (d->base && d->base != base)
|
||||||
|
++d;
|
||||||
|
return d->composed;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const hb_greek_decomposition decompose_0x314[] = {
|
||||||
|
{ 0x1F09, 0x0391 },
|
||||||
|
{ 0x1F19, 0x0395 },
|
||||||
|
{ 0x1F29, 0x0397 },
|
||||||
|
{ 0x1F39, 0x0399 },
|
||||||
|
{ 0x1F49, 0x039F },
|
||||||
|
{ 0x1FEC, 0x03A1 },
|
||||||
|
{ 0x1F59, 0x03A5 },
|
||||||
|
{ 0x1F69, 0x03A9 },
|
||||||
|
{ 0x1F01, 0x03B1 },
|
||||||
|
{ 0x1F11, 0x03B5 },
|
||||||
|
{ 0x1F21, 0x03B7 },
|
||||||
|
{ 0x1F31, 0x03B9 },
|
||||||
|
{ 0x1F41, 0x03BF },
|
||||||
|
{ 0x1FE5, 0x03C1 },
|
||||||
|
{ 0x1F51, 0x03C5 },
|
||||||
|
{ 0x1F61, 0x03C9 },
|
||||||
|
{ 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static HB_UChar16 compose_0x314(HB_UChar16 base)
|
||||||
|
{
|
||||||
|
const hb_greek_decomposition *d = decompose_0x314;
|
||||||
|
while (d->base && d->base != base)
|
||||||
|
++d;
|
||||||
|
return d->composed;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const hb_greek_decomposition decompose_0x342[] = {
|
||||||
|
{ 0x1FB6, 0x03B1 },
|
||||||
|
{ 0x1FC6, 0x03B7 },
|
||||||
|
{ 0x1FD6, 0x03B9 },
|
||||||
|
{ 0x1FE6, 0x03C5 },
|
||||||
|
{ 0x1FF6, 0x03C9 },
|
||||||
|
{ 0x1FD7, 0x03CA },
|
||||||
|
{ 0x1FE7, 0x03CB },
|
||||||
|
{ 0x1F06, 0x1F00 },
|
||||||
|
{ 0x1F07, 0x1F01 },
|
||||||
|
{ 0x1F0E, 0x1F08 },
|
||||||
|
{ 0x1F0F, 0x1F09 },
|
||||||
|
{ 0x1F26, 0x1F20 },
|
||||||
|
{ 0x1F27, 0x1F21 },
|
||||||
|
{ 0x1F2E, 0x1F28 },
|
||||||
|
{ 0x1F2F, 0x1F29 },
|
||||||
|
{ 0x1F36, 0x1F30 },
|
||||||
|
{ 0x1F37, 0x1F31 },
|
||||||
|
{ 0x1F3E, 0x1F38 },
|
||||||
|
{ 0x1F3F, 0x1F39 },
|
||||||
|
{ 0x1F56, 0x1F50 },
|
||||||
|
{ 0x1F57, 0x1F51 },
|
||||||
|
{ 0x1F5F, 0x1F59 },
|
||||||
|
{ 0x1F66, 0x1F60 },
|
||||||
|
{ 0x1F67, 0x1F61 },
|
||||||
|
{ 0x1F6E, 0x1F68 },
|
||||||
|
{ 0x1F6F, 0x1F69 },
|
||||||
|
{ 0x1FCF, 0x1FBF },
|
||||||
|
{ 0x1FDF, 0x1FFE },
|
||||||
|
{ 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static HB_UChar16 compose_0x342(HB_UChar16 base)
|
||||||
|
{
|
||||||
|
const hb_greek_decomposition *d = decompose_0x342;
|
||||||
|
while (d->base && d->base != base)
|
||||||
|
++d;
|
||||||
|
return d->composed;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const hb_greek_decomposition decompose_0x345[] = {
|
||||||
|
{ 0x1FBC, 0x0391 },
|
||||||
|
{ 0x1FCC, 0x0397 },
|
||||||
|
{ 0x1FFC, 0x03A9 },
|
||||||
|
{ 0x1FB4, 0x03AC },
|
||||||
|
{ 0x1FC4, 0x03AE },
|
||||||
|
{ 0x1FB3, 0x03B1 },
|
||||||
|
{ 0x1FC3, 0x03B7 },
|
||||||
|
{ 0x1FF3, 0x03C9 },
|
||||||
|
{ 0x1FF4, 0x03CE },
|
||||||
|
{ 0x1F80, 0x1F00 },
|
||||||
|
{ 0x1F81, 0x1F01 },
|
||||||
|
{ 0x1F82, 0x1F02 },
|
||||||
|
{ 0x1F83, 0x1F03 },
|
||||||
|
{ 0x1F84, 0x1F04 },
|
||||||
|
{ 0x1F85, 0x1F05 },
|
||||||
|
{ 0x1F86, 0x1F06 },
|
||||||
|
{ 0x1F87, 0x1F07 },
|
||||||
|
{ 0x1F88, 0x1F08 },
|
||||||
|
{ 0x1F89, 0x1F09 },
|
||||||
|
{ 0x1F8A, 0x1F0A },
|
||||||
|
{ 0x1F8B, 0x1F0B },
|
||||||
|
{ 0x1F8C, 0x1F0C },
|
||||||
|
{ 0x1F8D, 0x1F0D },
|
||||||
|
{ 0x1F8E, 0x1F0E },
|
||||||
|
{ 0x1F8F, 0x1F0F },
|
||||||
|
{ 0x1F90, 0x1F20 },
|
||||||
|
{ 0x1F91, 0x1F21 },
|
||||||
|
{ 0x1F92, 0x1F22 },
|
||||||
|
{ 0x1F93, 0x1F23 },
|
||||||
|
{ 0x1F94, 0x1F24 },
|
||||||
|
{ 0x1F95, 0x1F25 },
|
||||||
|
{ 0x1F96, 0x1F26 },
|
||||||
|
{ 0x1F97, 0x1F27 },
|
||||||
|
{ 0x1F98, 0x1F28 },
|
||||||
|
{ 0x1F99, 0x1F29 },
|
||||||
|
{ 0x1F9A, 0x1F2A },
|
||||||
|
{ 0x1F9B, 0x1F2B },
|
||||||
|
{ 0x1F9C, 0x1F2C },
|
||||||
|
{ 0x1F9D, 0x1F2D },
|
||||||
|
{ 0x1F9E, 0x1F2E },
|
||||||
|
{ 0x1F9F, 0x1F2F },
|
||||||
|
{ 0x1FA0, 0x1F60 },
|
||||||
|
{ 0x1FA1, 0x1F61 },
|
||||||
|
{ 0x1FA2, 0x1F62 },
|
||||||
|
{ 0x1FA3, 0x1F63 },
|
||||||
|
{ 0x1FA4, 0x1F64 },
|
||||||
|
{ 0x1FA5, 0x1F65 },
|
||||||
|
{ 0x1FA6, 0x1F66 },
|
||||||
|
{ 0x1FA7, 0x1F67 },
|
||||||
|
{ 0x1FA8, 0x1F68 },
|
||||||
|
{ 0x1FA9, 0x1F69 },
|
||||||
|
{ 0x1FAA, 0x1F6A },
|
||||||
|
{ 0x1FAB, 0x1F6B },
|
||||||
|
{ 0x1FAC, 0x1F6C },
|
||||||
|
{ 0x1FAD, 0x1F6D },
|
||||||
|
{ 0x1FAE, 0x1F6E },
|
||||||
|
{ 0x1FAF, 0x1F6F },
|
||||||
|
{ 0x1FB2, 0x1F70 },
|
||||||
|
{ 0x1FC2, 0x1F74 },
|
||||||
|
{ 0x1FF2, 0x1F7C },
|
||||||
|
{ 0x1FB7, 0x1FB6 },
|
||||||
|
{ 0x1FC7, 0x1FC6 },
|
||||||
|
{ 0x1FF7, 0x1FF6 },
|
||||||
|
{ 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static HB_UChar16 compose_0x345(HB_UChar16 base)
|
||||||
|
{
|
||||||
|
const hb_greek_decomposition *d = decompose_0x345;
|
||||||
|
while (d->base && d->base != base)
|
||||||
|
++d;
|
||||||
|
return d->composed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Greek shaping. Heuristic positioning can't render polytonic greek correctly. We're a lot
|
||||||
|
better off mapping greek chars with diacritics to the characters in the extended greek
|
||||||
|
region in Unicode if possible.
|
||||||
|
*/
|
||||||
|
HB_Bool HB_GreekShape(HB_ShaperItem *shaper_item)
|
||||||
|
{
|
||||||
|
const int availableGlyphs = shaper_item->num_glyphs;
|
||||||
|
const HB_UChar16 *uc = shaper_item->string + shaper_item->item.pos;
|
||||||
|
unsigned short *logClusters = shaper_item->log_clusters;
|
||||||
|
HB_GlyphAttributes *attributes = shaper_item->attributes;
|
||||||
|
|
||||||
|
HB_Bool haveGlyphs;
|
||||||
|
int slen = 1;
|
||||||
|
int cluster_start = 0;
|
||||||
|
hb_uint32 i;
|
||||||
|
|
||||||
|
HB_STACKARRAY(HB_UChar16, shapedChars, 2 * shaper_item->item.length);
|
||||||
|
|
||||||
|
assert(shaper_item->item.script == HB_Script_Greek);
|
||||||
|
|
||||||
|
*shapedChars = *uc;
|
||||||
|
logClusters[0] = 0;
|
||||||
|
|
||||||
|
for (i = 1; i < shaper_item->item.length; ++i) {
|
||||||
|
hb_uint16 base = shapedChars[slen-1];
|
||||||
|
hb_uint16 shaped = 0;
|
||||||
|
if (uc[i] == 0x300)
|
||||||
|
shaped = compose_0x300(base);
|
||||||
|
else if (uc[i] == 0x301)
|
||||||
|
shaped = compose_0x301(base);
|
||||||
|
else if (uc[i] == 0x304)
|
||||||
|
shaped = compose_0x304(base);
|
||||||
|
else if (uc[i] == 0x306)
|
||||||
|
shaped = compose_0x306(base);
|
||||||
|
else if (uc[i] == 0x308)
|
||||||
|
shaped = compose_0x308(base);
|
||||||
|
else if (uc[i] == 0x313)
|
||||||
|
shaped = compose_0x313(base);
|
||||||
|
else if (uc[i] == 0x314)
|
||||||
|
shaped = compose_0x314(base);
|
||||||
|
else if (uc[i] == 0x342)
|
||||||
|
shaped = compose_0x342(base);
|
||||||
|
else if (uc[i] == 0x345)
|
||||||
|
shaped = compose_0x345(base);
|
||||||
|
|
||||||
|
if (shaped) {
|
||||||
|
if (shaper_item->font->klass->canRender(shaper_item->font, (HB_UChar16 *)&shaped, 1)) {
|
||||||
|
shapedChars[slen-1] = shaped;
|
||||||
|
} else {
|
||||||
|
shaped = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!shaped) {
|
||||||
|
HB_CharCategory category;
|
||||||
|
int cmb;
|
||||||
|
shapedChars[slen] = uc[i];
|
||||||
|
HB_GetUnicodeCharProperties(uc[i], &category, &cmb);
|
||||||
|
if (category != HB_Mark_NonSpacing) {
|
||||||
|
attributes[slen].clusterStart = TRUE;
|
||||||
|
attributes[slen].mark = FALSE;
|
||||||
|
attributes[slen].combiningClass = 0;
|
||||||
|
attributes[slen].dontPrint = HB_IsControlChar(uc[i]);
|
||||||
|
cluster_start = slen;
|
||||||
|
} else {
|
||||||
|
attributes[slen].clusterStart = FALSE;
|
||||||
|
attributes[slen].mark = TRUE;
|
||||||
|
attributes[slen].combiningClass = cmb;
|
||||||
|
}
|
||||||
|
++slen;
|
||||||
|
}
|
||||||
|
logClusters[i] = cluster_start;
|
||||||
|
}
|
||||||
|
|
||||||
|
haveGlyphs = shaper_item->font->klass
|
||||||
|
->convertStringToGlyphIndices(shaper_item->font,
|
||||||
|
shapedChars, slen,
|
||||||
|
shaper_item->glyphs, &shaper_item->num_glyphs,
|
||||||
|
shaper_item->item.bidiLevel % 2);
|
||||||
|
|
||||||
|
HB_FREE_STACKARRAY(shapedChars);
|
||||||
|
|
||||||
|
if (!haveGlyphs)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
#ifndef NO_OPENTYPE
|
||||||
|
if (HB_SelectScript(shaper_item, greek_features)) {
|
||||||
|
HB_OpenTypeShape(shaper_item, /*properties*/0);
|
||||||
|
return HB_OpenTypePosition(shaper_item, availableGlyphs, /*doLogClusters*/TRUE);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
HB_HeuristicPosition(shaper_item);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,483 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
|
||||||
|
* Copyright (C) 2006 Behdad Esfahbod
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HARFBUZZ_GSUB_PRIVATE_H
|
||||||
|
#define HARFBUZZ_GSUB_PRIVATE_H
|
||||||
|
|
||||||
|
#include "harfbuzz-impl.h"
|
||||||
|
#include "harfbuzz-stream-private.h"
|
||||||
|
#include "harfbuzz-gsub.h"
|
||||||
|
|
||||||
|
HB_BEGIN_HEADER
|
||||||
|
|
||||||
|
#ifdef HB_USE_PACKED_STRUCTS
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef union HB_GSUB_SubTable_ HB_GSUB_SubTable;
|
||||||
|
|
||||||
|
/* LookupType 1 */
|
||||||
|
|
||||||
|
struct HB_SingleSubstFormat1_
|
||||||
|
{
|
||||||
|
HB_Short DeltaGlyphID; /* constant added to get
|
||||||
|
substitution glyph index */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_SingleSubstFormat1_ HB_SingleSubstFormat1;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_SingleSubstFormat2_
|
||||||
|
{
|
||||||
|
HB_UShort* Substitute; /* array of substitute glyph IDs */
|
||||||
|
HB_UShort GlyphCount; /* number of glyph IDs in
|
||||||
|
Substitute array */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_SingleSubstFormat2_ HB_SingleSubstFormat2;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_SingleSubst_
|
||||||
|
{
|
||||||
|
union
|
||||||
|
{
|
||||||
|
HB_SingleSubstFormat1 ssf1;
|
||||||
|
HB_SingleSubstFormat2 ssf2;
|
||||||
|
} ssf;
|
||||||
|
|
||||||
|
HB_Coverage Coverage; /* Coverage table */
|
||||||
|
HB_Byte SubstFormat; /* 1 or 2 */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_SingleSubst_ HB_SingleSubst;
|
||||||
|
|
||||||
|
|
||||||
|
/* LookupType 2 */
|
||||||
|
|
||||||
|
struct HB_Sequence_
|
||||||
|
{
|
||||||
|
HB_UShort* Substitute; /* string of glyph IDs to
|
||||||
|
substitute */
|
||||||
|
HB_UShort GlyphCount; /* number of glyph IDs in the
|
||||||
|
Substitute array */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_Sequence_ HB_Sequence;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_MultipleSubst_
|
||||||
|
{
|
||||||
|
HB_Sequence* Sequence; /* array of Sequence tables */
|
||||||
|
HB_Coverage Coverage; /* Coverage table */
|
||||||
|
HB_UShort SubstFormat; /* always 1 */
|
||||||
|
HB_UShort SequenceCount; /* number of Sequence tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_MultipleSubst_ HB_MultipleSubst;
|
||||||
|
|
||||||
|
|
||||||
|
/* LookupType 3 */
|
||||||
|
|
||||||
|
struct HB_AlternateSet_
|
||||||
|
{
|
||||||
|
HB_UShort* Alternate; /* array of alternate glyph IDs */
|
||||||
|
HB_UShort GlyphCount; /* number of glyph IDs in the
|
||||||
|
Alternate array */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_AlternateSet_ HB_AlternateSet;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_AlternateSubst_
|
||||||
|
{
|
||||||
|
HB_AlternateSet* AlternateSet; /* array of AlternateSet tables */
|
||||||
|
HB_Coverage Coverage; /* Coverage table */
|
||||||
|
HB_UShort SubstFormat; /* always 1 */
|
||||||
|
HB_UShort AlternateSetCount;
|
||||||
|
/* number of AlternateSet tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_AlternateSubst_ HB_AlternateSubst;
|
||||||
|
|
||||||
|
|
||||||
|
/* LookupType 4 */
|
||||||
|
|
||||||
|
struct HB_Ligature_
|
||||||
|
{
|
||||||
|
HB_UShort* Component; /* array of component glyph IDs */
|
||||||
|
HB_UShort LigGlyph; /* glyphID of ligature
|
||||||
|
to substitute */
|
||||||
|
HB_UShort ComponentCount; /* number of components in ligature */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_Ligature_ HB_Ligature;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_LigatureSet_
|
||||||
|
{
|
||||||
|
HB_Ligature* Ligature; /* array of Ligature tables */
|
||||||
|
HB_UShort LigatureCount; /* number of Ligature tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_LigatureSet_ HB_LigatureSet;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_LigatureSubst_
|
||||||
|
{
|
||||||
|
HB_LigatureSet* LigatureSet; /* array of LigatureSet tables */
|
||||||
|
HB_Coverage Coverage; /* Coverage table */
|
||||||
|
HB_UShort SubstFormat; /* always 1 */
|
||||||
|
HB_UShort LigatureSetCount; /* number of LigatureSet tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_LigatureSubst_ HB_LigatureSubst;
|
||||||
|
|
||||||
|
|
||||||
|
/* needed by both lookup type 5 and 6 */
|
||||||
|
|
||||||
|
struct HB_SubstLookupRecord_
|
||||||
|
{
|
||||||
|
HB_UShort SequenceIndex; /* index into current
|
||||||
|
glyph sequence */
|
||||||
|
HB_UShort LookupListIndex; /* Lookup to apply to that pos. */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_SubstLookupRecord_ HB_SubstLookupRecord;
|
||||||
|
|
||||||
|
|
||||||
|
/* LookupType 5 */
|
||||||
|
|
||||||
|
struct HB_SubRule_
|
||||||
|
{
|
||||||
|
HB_UShort* Input; /* array of input glyph IDs */
|
||||||
|
HB_SubstLookupRecord* SubstLookupRecord;
|
||||||
|
/* array of SubstLookupRecord
|
||||||
|
tables */
|
||||||
|
HB_UShort GlyphCount; /* total number of input glyphs */
|
||||||
|
HB_UShort SubstCount; /* number of SubstLookupRecord
|
||||||
|
tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_SubRule_ HB_SubRule;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_SubRuleSet_
|
||||||
|
{
|
||||||
|
HB_SubRule* SubRule; /* array of SubRule tables */
|
||||||
|
HB_UShort SubRuleCount; /* number of SubRule tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_SubRuleSet_ HB_SubRuleSet;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_ContextSubstFormat1_
|
||||||
|
{
|
||||||
|
HB_SubRuleSet* SubRuleSet; /* array of SubRuleSet tables */
|
||||||
|
HB_Coverage Coverage; /* Coverage table */
|
||||||
|
HB_UShort SubRuleSetCount; /* number of SubRuleSet tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ContextSubstFormat1_ HB_ContextSubstFormat1;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_SubClassRule_
|
||||||
|
{
|
||||||
|
HB_UShort* Class; /* array of classes */
|
||||||
|
HB_SubstLookupRecord* SubstLookupRecord;
|
||||||
|
/* array of SubstLookupRecord
|
||||||
|
tables */
|
||||||
|
HB_UShort GlyphCount; /* total number of context classes */
|
||||||
|
HB_UShort SubstCount; /* number of SubstLookupRecord
|
||||||
|
tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_SubClassRule_ HB_SubClassRule;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_SubClassSet_
|
||||||
|
{
|
||||||
|
HB_SubClassRule* SubClassRule; /* array of SubClassRule tables */
|
||||||
|
HB_UShort SubClassRuleCount;
|
||||||
|
/* number of SubClassRule tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_SubClassSet_ HB_SubClassSet;
|
||||||
|
|
||||||
|
|
||||||
|
/* The `MaxContextLength' field is not defined in the TTO specification
|
||||||
|
but simplifies the implementation of this format. It holds the
|
||||||
|
maximal context length used in the context rules. */
|
||||||
|
|
||||||
|
struct HB_ContextSubstFormat2_
|
||||||
|
{
|
||||||
|
HB_SubClassSet* SubClassSet; /* array of SubClassSet tables */
|
||||||
|
HB_Coverage Coverage; /* Coverage table */
|
||||||
|
HB_ClassDefinition ClassDef; /* ClassDef table */
|
||||||
|
HB_UShort SubClassSetCount;
|
||||||
|
/* number of SubClassSet tables */
|
||||||
|
HB_UShort MaxContextLength;
|
||||||
|
/* maximal context length */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ContextSubstFormat2_ HB_ContextSubstFormat2;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_ContextSubstFormat3_
|
||||||
|
{
|
||||||
|
HB_Coverage* Coverage; /* array of Coverage tables */
|
||||||
|
HB_SubstLookupRecord* SubstLookupRecord;
|
||||||
|
/* array of substitution lookups */
|
||||||
|
HB_UShort GlyphCount; /* number of input glyphs */
|
||||||
|
HB_UShort SubstCount; /* number of SubstLookupRecords */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ContextSubstFormat3_ HB_ContextSubstFormat3;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_ContextSubst_
|
||||||
|
{
|
||||||
|
union
|
||||||
|
{
|
||||||
|
HB_ContextSubstFormat1 csf1;
|
||||||
|
HB_ContextSubstFormat2 csf2;
|
||||||
|
HB_ContextSubstFormat3 csf3;
|
||||||
|
} csf;
|
||||||
|
|
||||||
|
HB_Byte SubstFormat; /* 1, 2, or 3 */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ContextSubst_ HB_ContextSubst;
|
||||||
|
|
||||||
|
|
||||||
|
/* LookupType 6 */
|
||||||
|
|
||||||
|
struct HB_ChainSubRule_
|
||||||
|
{
|
||||||
|
HB_UShort* Backtrack; /* array of backtrack glyph IDs */
|
||||||
|
HB_UShort* Input; /* array of input glyph IDs */
|
||||||
|
HB_UShort* Lookahead; /* array of lookahead glyph IDs */
|
||||||
|
HB_SubstLookupRecord* SubstLookupRecord;
|
||||||
|
/* array of SubstLookupRecords */
|
||||||
|
HB_UShort BacktrackGlyphCount;
|
||||||
|
/* total number of backtrack glyphs */
|
||||||
|
HB_UShort InputGlyphCount;
|
||||||
|
/* total number of input glyphs */
|
||||||
|
HB_UShort LookaheadGlyphCount;
|
||||||
|
/* total number of lookahead glyphs */
|
||||||
|
HB_UShort SubstCount; /* number of SubstLookupRecords */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ChainSubRule_ HB_ChainSubRule;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_ChainSubRuleSet_
|
||||||
|
{
|
||||||
|
HB_ChainSubRule* ChainSubRule; /* array of ChainSubRule tables */
|
||||||
|
HB_UShort ChainSubRuleCount;
|
||||||
|
/* number of ChainSubRule tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ChainSubRuleSet_ HB_ChainSubRuleSet;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_ChainContextSubstFormat1_
|
||||||
|
{
|
||||||
|
HB_ChainSubRuleSet* ChainSubRuleSet;
|
||||||
|
/* array of ChainSubRuleSet tables */
|
||||||
|
HB_Coverage Coverage; /* Coverage table */
|
||||||
|
HB_UShort ChainSubRuleSetCount;
|
||||||
|
/* number of ChainSubRuleSet tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ChainContextSubstFormat1_ HB_ChainContextSubstFormat1;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_ChainSubClassRule_
|
||||||
|
{
|
||||||
|
HB_UShort* Backtrack; /* array of backtrack classes */
|
||||||
|
HB_UShort* Input; /* array of context classes */
|
||||||
|
HB_UShort* Lookahead; /* array of lookahead classes */
|
||||||
|
HB_SubstLookupRecord* SubstLookupRecord;
|
||||||
|
/* array of substitution lookups */
|
||||||
|
HB_UShort BacktrackGlyphCount;
|
||||||
|
/* total number of backtrack
|
||||||
|
classes */
|
||||||
|
HB_UShort InputGlyphCount;
|
||||||
|
/* total number of context classes */
|
||||||
|
HB_UShort LookaheadGlyphCount;
|
||||||
|
/* total number of lookahead
|
||||||
|
classes */
|
||||||
|
HB_UShort SubstCount; /* number of SubstLookupRecords */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ChainSubClassRule_ HB_ChainSubClassRule;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_ChainSubClassSet_
|
||||||
|
{
|
||||||
|
HB_ChainSubClassRule* ChainSubClassRule;
|
||||||
|
/* array of ChainSubClassRule
|
||||||
|
tables */
|
||||||
|
HB_UShort ChainSubClassRuleCount;
|
||||||
|
/* number of ChainSubClassRule
|
||||||
|
tables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ChainSubClassSet_ HB_ChainSubClassSet;
|
||||||
|
|
||||||
|
|
||||||
|
/* The `MaxXXXLength' fields are not defined in the TTO specification
|
||||||
|
but simplifies the implementation of this format. It holds the
|
||||||
|
maximal context length used in the specific context rules. */
|
||||||
|
|
||||||
|
struct HB_ChainContextSubstFormat2_
|
||||||
|
{
|
||||||
|
HB_ChainSubClassSet* ChainSubClassSet;
|
||||||
|
/* array of ChainSubClassSet
|
||||||
|
tables */
|
||||||
|
HB_Coverage Coverage; /* Coverage table */
|
||||||
|
|
||||||
|
HB_ClassDefinition BacktrackClassDef;
|
||||||
|
/* BacktrackClassDef table */
|
||||||
|
HB_ClassDefinition InputClassDef;
|
||||||
|
/* InputClassDef table */
|
||||||
|
HB_ClassDefinition LookaheadClassDef;
|
||||||
|
/* LookaheadClassDef table */
|
||||||
|
|
||||||
|
HB_UShort ChainSubClassSetCount;
|
||||||
|
/* number of ChainSubClassSet
|
||||||
|
tables */
|
||||||
|
HB_UShort MaxBacktrackLength;
|
||||||
|
/* maximal backtrack length */
|
||||||
|
HB_UShort MaxLookaheadLength;
|
||||||
|
/* maximal lookahead length */
|
||||||
|
HB_UShort MaxInputLength;
|
||||||
|
/* maximal input length */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ChainContextSubstFormat2_ HB_ChainContextSubstFormat2;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_ChainContextSubstFormat3_
|
||||||
|
{
|
||||||
|
HB_Coverage* BacktrackCoverage;
|
||||||
|
/* array of backtrack Coverage
|
||||||
|
tables */
|
||||||
|
HB_Coverage* InputCoverage;
|
||||||
|
/* array of input coverage
|
||||||
|
tables */
|
||||||
|
HB_Coverage* LookaheadCoverage;
|
||||||
|
/* array of lookahead coverage
|
||||||
|
tables */
|
||||||
|
HB_SubstLookupRecord* SubstLookupRecord;
|
||||||
|
/* array of substitution lookups */
|
||||||
|
HB_UShort BacktrackGlyphCount;
|
||||||
|
/* number of backtrack glyphs */
|
||||||
|
HB_UShort InputGlyphCount;
|
||||||
|
/* number of input glyphs */
|
||||||
|
HB_UShort LookaheadGlyphCount;
|
||||||
|
/* number of lookahead glyphs */
|
||||||
|
HB_UShort SubstCount; /* number of SubstLookupRecords */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ChainContextSubstFormat3_ HB_ChainContextSubstFormat3;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_ChainContextSubst_
|
||||||
|
{
|
||||||
|
union
|
||||||
|
{
|
||||||
|
HB_ChainContextSubstFormat1 ccsf1;
|
||||||
|
HB_ChainContextSubstFormat2 ccsf2;
|
||||||
|
HB_ChainContextSubstFormat3 ccsf3;
|
||||||
|
} ccsf;
|
||||||
|
|
||||||
|
HB_Byte SubstFormat; /* 1, 2, or 3 */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ChainContextSubst_ HB_ChainContextSubst;
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* LookupType 7 */
|
||||||
|
struct HB_ExtensionSubst_
|
||||||
|
{
|
||||||
|
HB_GSUB_SubTable *subtable; /* referenced subtable */
|
||||||
|
HB_UShort SubstFormat; /* always 1 */
|
||||||
|
HB_UShort LookuptType; /* lookup-type of referenced subtable */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ExtensionSubst_ HB_ExtensionSubst;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* LookupType 8 */
|
||||||
|
struct HB_ReverseChainContextSubst_
|
||||||
|
{
|
||||||
|
HB_Coverage* LookaheadCoverage; /* array of lookahead Coverage
|
||||||
|
tables */
|
||||||
|
HB_UShort* Substitute; /* array of substitute Glyph ID */
|
||||||
|
HB_Coverage* BacktrackCoverage; /* array of backtrack Coverage
|
||||||
|
tables */
|
||||||
|
HB_Coverage Coverage; /* coverage table for input glyphs */
|
||||||
|
HB_UShort SubstFormat; /* always 1 */
|
||||||
|
HB_UShort BacktrackGlyphCount; /* number of backtrack glyphs */
|
||||||
|
HB_UShort LookaheadGlyphCount; /* number of lookahead glyphs */
|
||||||
|
HB_UShort GlyphCount; /* number of Glyph IDs */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ReverseChainContextSubst_ HB_ReverseChainContextSubst;
|
||||||
|
|
||||||
|
|
||||||
|
union HB_GSUB_SubTable_
|
||||||
|
{
|
||||||
|
HB_SingleSubst single;
|
||||||
|
HB_MultipleSubst multiple;
|
||||||
|
HB_AlternateSubst alternate;
|
||||||
|
HB_LigatureSubst ligature;
|
||||||
|
HB_ContextSubst context;
|
||||||
|
HB_ChainContextSubst chain;
|
||||||
|
HB_ReverseChainContextSubst reverse;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_HB_GSUB_Load_SubTable( HB_GSUB_SubTable* st,
|
||||||
|
HB_Stream stream,
|
||||||
|
HB_UShort lookup_type );
|
||||||
|
|
||||||
|
HB_INTERNAL void
|
||||||
|
_HB_GSUB_Free_SubTable( HB_GSUB_SubTable* st,
|
||||||
|
HB_UShort lookup_type );
|
||||||
|
|
||||||
|
#ifdef HB_USE_PACKED_STRUCTS
|
||||||
|
#pragma pack(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
HB_END_HEADER
|
||||||
|
|
||||||
|
#endif /* HARFBUZZ_GSUB_PRIVATE_H */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,148 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
|
||||||
|
* Copyright (C) 2006 Behdad Esfahbod
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HARFBUZZ_GSUB_H
|
||||||
|
#define HARFBUZZ_GSUB_H
|
||||||
|
|
||||||
|
#include "harfbuzz-gdef.h"
|
||||||
|
#include "harfbuzz-buffer.h"
|
||||||
|
|
||||||
|
HB_BEGIN_HEADER
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HB_USE_PACKED_STRUCTS
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Lookup types for glyph substitution */
|
||||||
|
|
||||||
|
#define HB_GSUB_LOOKUP_SINGLE 1
|
||||||
|
#define HB_GSUB_LOOKUP_MULTIPLE 2
|
||||||
|
#define HB_GSUB_LOOKUP_ALTERNATE 3
|
||||||
|
#define HB_GSUB_LOOKUP_LIGATURE 4
|
||||||
|
#define HB_GSUB_LOOKUP_CONTEXT 5
|
||||||
|
#define HB_GSUB_LOOKUP_CHAIN 6
|
||||||
|
#define HB_GSUB_LOOKUP_EXTENSION 7
|
||||||
|
#define HB_GSUB_LOOKUP_REVERSE_CHAIN 8
|
||||||
|
|
||||||
|
|
||||||
|
/* A pointer to a function which selects the alternate glyph. `pos' is
|
||||||
|
the position of the glyph with index `glyphID', `num_alternates'
|
||||||
|
gives the number of alternates in the `alternates' array. `data'
|
||||||
|
points to the user-defined structure specified during a call to
|
||||||
|
HB_GSUB_Register_Alternate_Function(). The function must return an
|
||||||
|
index into the `alternates' array. */
|
||||||
|
|
||||||
|
typedef HB_UShort (*HB_AltFunction)(HB_UInt pos,
|
||||||
|
HB_UShort glyphID,
|
||||||
|
HB_UShort num_alternates,
|
||||||
|
HB_UShort* alternates,
|
||||||
|
void* data );
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_GSUBHeader_
|
||||||
|
{
|
||||||
|
HB_GDEFHeader* gdef;
|
||||||
|
|
||||||
|
/* the next two fields are used for an alternate substitution callback
|
||||||
|
function to select the proper alternate glyph. */
|
||||||
|
|
||||||
|
void* data;
|
||||||
|
HB_AltFunction altfunc;
|
||||||
|
|
||||||
|
HB_UInt offset;
|
||||||
|
|
||||||
|
HB_16Dot16 Version;
|
||||||
|
|
||||||
|
HB_ScriptList ScriptList;
|
||||||
|
HB_FeatureList FeatureList;
|
||||||
|
HB_LookupList LookupList;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_GSUBHeader_ HB_GSUBHeader;
|
||||||
|
typedef HB_GSUBHeader* HB_GSUB;
|
||||||
|
|
||||||
|
|
||||||
|
HB_Error HB_Load_GSUB_Table( HB_Stream stream,
|
||||||
|
HB_GSUBHeader** gsub,
|
||||||
|
HB_GDEFHeader* gdef,
|
||||||
|
HB_Stream gdefStream );
|
||||||
|
|
||||||
|
|
||||||
|
HB_Error HB_Done_GSUB_Table( HB_GSUBHeader* gsub );
|
||||||
|
|
||||||
|
|
||||||
|
HB_Error HB_GSUB_Select_Script( HB_GSUBHeader* gsub,
|
||||||
|
HB_UInt script_tag,
|
||||||
|
HB_UShort* script_index );
|
||||||
|
|
||||||
|
HB_Error HB_GSUB_Select_Language( HB_GSUBHeader* gsub,
|
||||||
|
HB_UInt language_tag,
|
||||||
|
HB_UShort script_index,
|
||||||
|
HB_UShort* language_index,
|
||||||
|
HB_UShort* req_feature_index );
|
||||||
|
|
||||||
|
HB_Error HB_GSUB_Select_Feature( HB_GSUBHeader* gsub,
|
||||||
|
HB_UInt feature_tag,
|
||||||
|
HB_UShort script_index,
|
||||||
|
HB_UShort language_index,
|
||||||
|
HB_UShort* feature_index );
|
||||||
|
|
||||||
|
|
||||||
|
HB_Error HB_GSUB_Query_Scripts( HB_GSUBHeader* gsub,
|
||||||
|
HB_UInt** script_tag_list );
|
||||||
|
|
||||||
|
HB_Error HB_GSUB_Query_Languages( HB_GSUBHeader* gsub,
|
||||||
|
HB_UShort script_index,
|
||||||
|
HB_UInt** language_tag_list );
|
||||||
|
|
||||||
|
HB_Error HB_GSUB_Query_Features( HB_GSUBHeader* gsub,
|
||||||
|
HB_UShort script_index,
|
||||||
|
HB_UShort language_index,
|
||||||
|
HB_UInt** feature_tag_list );
|
||||||
|
|
||||||
|
|
||||||
|
HB_Error HB_GSUB_Add_Feature( HB_GSUBHeader* gsub,
|
||||||
|
HB_UShort feature_index,
|
||||||
|
HB_UInt property );
|
||||||
|
|
||||||
|
HB_Error HB_GSUB_Clear_Features( HB_GSUBHeader* gsub );
|
||||||
|
|
||||||
|
|
||||||
|
HB_Error HB_GSUB_Register_Alternate_Function( HB_GSUBHeader* gsub,
|
||||||
|
HB_AltFunction altfunc,
|
||||||
|
void* data );
|
||||||
|
|
||||||
|
|
||||||
|
HB_Error HB_GSUB_Apply_String( HB_GSUBHeader* gsub,
|
||||||
|
HB_Buffer buffer );
|
||||||
|
|
||||||
|
#ifdef HB_USE_PACKED_STRUCTS
|
||||||
|
#pragma pack(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
HB_END_HEADER
|
||||||
|
|
||||||
|
#endif /* HARFBUZZ_GSUB_H */
|
|
@ -0,0 +1,268 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "harfbuzz-shaper.h"
|
||||||
|
#include "harfbuzz-shaper-private.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Hangul is a syllable based script. Unicode reserves a large range
|
||||||
|
// for precomposed hangul, where syllables are already precomposed to
|
||||||
|
// their final glyph shape. In addition, a so called jamo range is
|
||||||
|
// defined, that can be used to express old Hangul. Modern hangul
|
||||||
|
// syllables can also be expressed as jamo, and should be composed
|
||||||
|
// into syllables. The operation is rather simple and mathematical.
|
||||||
|
|
||||||
|
// Every hangul jamo is classified as being either a Leading consonant
|
||||||
|
// (L), and intermediat Vowel (V) or a trailing consonant (T). Modern
|
||||||
|
// hangul syllables (the ones in the precomposed area can be of type
|
||||||
|
// LV or LVT.
|
||||||
|
//
|
||||||
|
// Syllable breaks do _not_ occur between:
|
||||||
|
//
|
||||||
|
// L L, V or precomposed
|
||||||
|
// V, LV V, T
|
||||||
|
// LVT, T T
|
||||||
|
//
|
||||||
|
// A standard syllable is of the form L+V+T*. The above rules allow
|
||||||
|
// nonstandard syllables L*V*T*. To transform them into standard
|
||||||
|
// syllables fill characters L_f and V_f can be inserted.
|
||||||
|
*/
|
||||||
|
|
||||||
|
enum {
|
||||||
|
Hangul_SBase = 0xac00,
|
||||||
|
Hangul_LBase = 0x1100,
|
||||||
|
Hangul_VBase = 0x1161,
|
||||||
|
Hangul_TBase = 0x11a7,
|
||||||
|
Hangul_SCount = 11172,
|
||||||
|
Hangul_LCount = 19,
|
||||||
|
Hangul_VCount = 21,
|
||||||
|
Hangul_TCount = 28,
|
||||||
|
Hangul_NCount = 21*28
|
||||||
|
};
|
||||||
|
|
||||||
|
#define hangul_isPrecomposed(uc) \
|
||||||
|
(uc >= Hangul_SBase && uc < Hangul_SBase + Hangul_SCount)
|
||||||
|
|
||||||
|
#define hangul_isLV(uc) \
|
||||||
|
((uc - Hangul_SBase) % Hangul_TCount == 0)
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
L,
|
||||||
|
V,
|
||||||
|
T,
|
||||||
|
LV,
|
||||||
|
LVT,
|
||||||
|
X
|
||||||
|
} HangulType;
|
||||||
|
|
||||||
|
static HangulType hangul_type(unsigned short uc) {
|
||||||
|
if (uc > Hangul_SBase && uc < Hangul_SBase + Hangul_SCount)
|
||||||
|
return hangul_isLV(uc) ? LV : LVT;
|
||||||
|
if (uc < Hangul_LBase || uc > 0x11ff)
|
||||||
|
return X;
|
||||||
|
if (uc < Hangul_VBase)
|
||||||
|
return L;
|
||||||
|
if (uc < Hangul_TBase)
|
||||||
|
return V;
|
||||||
|
return T;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int hangul_nextSyllableBoundary(const HB_UChar16 *s, int start, int end)
|
||||||
|
{
|
||||||
|
const HB_UChar16 *uc = s + start;
|
||||||
|
|
||||||
|
HangulType state = hangul_type(*uc);
|
||||||
|
int pos = 1;
|
||||||
|
|
||||||
|
while (pos < end - start) {
|
||||||
|
HangulType newState = hangul_type(uc[pos]);
|
||||||
|
switch(newState) {
|
||||||
|
case X:
|
||||||
|
goto finish;
|
||||||
|
case L:
|
||||||
|
case V:
|
||||||
|
case T:
|
||||||
|
if (state > newState)
|
||||||
|
goto finish;
|
||||||
|
state = newState;
|
||||||
|
break;
|
||||||
|
case LV:
|
||||||
|
if (state > L)
|
||||||
|
goto finish;
|
||||||
|
state = V;
|
||||||
|
break;
|
||||||
|
case LVT:
|
||||||
|
if (state > L)
|
||||||
|
goto finish;
|
||||||
|
state = T;
|
||||||
|
}
|
||||||
|
++pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
finish:
|
||||||
|
return start+pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NO_OPENTYPE
|
||||||
|
static const HB_OpenTypeFeature hangul_features [] = {
|
||||||
|
{ HB_MAKE_TAG('c', 'c', 'm', 'p'), CcmpProperty },
|
||||||
|
{ HB_MAKE_TAG('l', 'j', 'm', 'o'), CcmpProperty },
|
||||||
|
{ HB_MAKE_TAG('v', 'j', 'm', 'o'), CcmpProperty },
|
||||||
|
{ HB_MAKE_TAG('t', 'j', 'm', 'o'), CcmpProperty },
|
||||||
|
{ 0, 0 }
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static HB_Bool hangul_shape_syllable(HB_ShaperItem *item, HB_Bool openType)
|
||||||
|
{
|
||||||
|
const HB_UChar16 *ch = item->string + item->item.pos;
|
||||||
|
int len = item->item.length;
|
||||||
|
#ifndef NO_OPENTYPE
|
||||||
|
const int availableGlyphs = item->num_glyphs;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int i;
|
||||||
|
HB_UChar16 composed = 0;
|
||||||
|
/* see if we can compose the syllable into a modern hangul */
|
||||||
|
if (item->item.length == 2) {
|
||||||
|
int LIndex = ch[0] - Hangul_LBase;
|
||||||
|
int VIndex = ch[1] - Hangul_VBase;
|
||||||
|
if (LIndex >= 0 && LIndex < Hangul_LCount &&
|
||||||
|
VIndex >= 0 && VIndex < Hangul_VCount)
|
||||||
|
composed = (LIndex * Hangul_VCount + VIndex) * Hangul_TCount + Hangul_SBase;
|
||||||
|
} else if (item->item.length == 3) {
|
||||||
|
int LIndex = ch[0] - Hangul_LBase;
|
||||||
|
int VIndex = ch[1] - Hangul_VBase;
|
||||||
|
int TIndex = ch[2] - Hangul_TBase;
|
||||||
|
if (LIndex >= 0 && LIndex < Hangul_LCount &&
|
||||||
|
VIndex >= 0 && VIndex < Hangul_VCount &&
|
||||||
|
TIndex >= 0 && TIndex < Hangul_TCount)
|
||||||
|
composed = (LIndex * Hangul_VCount + VIndex) * Hangul_TCount + TIndex + Hangul_SBase;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* if we have a modern hangul use the composed form */
|
||||||
|
if (composed) {
|
||||||
|
ch = &composed;
|
||||||
|
len = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!item->font->klass->convertStringToGlyphIndices(item->font,
|
||||||
|
ch, len,
|
||||||
|
item->glyphs, &item->num_glyphs,
|
||||||
|
item->item.bidiLevel % 2))
|
||||||
|
return FALSE;
|
||||||
|
for (i = 0; i < len; i++) {
|
||||||
|
item->attributes[i].mark = FALSE;
|
||||||
|
item->attributes[i].clusterStart = FALSE;
|
||||||
|
item->attributes[i].justification = 0;
|
||||||
|
item->attributes[i].zeroWidth = FALSE;
|
||||||
|
/*IDEBUG(" %d: %4x", i, ch[i].unicode()); */
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NO_OPENTYPE
|
||||||
|
if (!composed && openType) {
|
||||||
|
HB_Bool positioned;
|
||||||
|
|
||||||
|
HB_STACKARRAY(unsigned short, logClusters, len);
|
||||||
|
for (i = 0; i < len; ++i)
|
||||||
|
logClusters[i] = i;
|
||||||
|
item->log_clusters = logClusters;
|
||||||
|
|
||||||
|
HB_OpenTypeShape(item, /*properties*/0);
|
||||||
|
|
||||||
|
positioned = HB_OpenTypePosition(item, availableGlyphs, /*doLogClusters*/FALSE);
|
||||||
|
|
||||||
|
HB_FREE_STACKARRAY(logClusters);
|
||||||
|
|
||||||
|
if (!positioned)
|
||||||
|
return FALSE;
|
||||||
|
} else {
|
||||||
|
HB_HeuristicPosition(item);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
item->attributes[0].clusterStart = TRUE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
HB_Bool HB_HangulShape(HB_ShaperItem *item)
|
||||||
|
{
|
||||||
|
const HB_UChar16 *uc = item->string + item->item.pos;
|
||||||
|
HB_Bool allPrecomposed = TRUE;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
assert(item->item.script == HB_Script_Hangul);
|
||||||
|
|
||||||
|
for (i = 0; i < (int)item->item.length; ++i) {
|
||||||
|
if (!hangul_isPrecomposed(uc[i])) {
|
||||||
|
allPrecomposed = FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!allPrecomposed) {
|
||||||
|
HB_Bool openType = FALSE;
|
||||||
|
unsigned short *logClusters = item->log_clusters;
|
||||||
|
HB_ShaperItem syllable;
|
||||||
|
int first_glyph = 0;
|
||||||
|
int sstart = item->item.pos;
|
||||||
|
int end = sstart + item->item.length;
|
||||||
|
|
||||||
|
#ifndef NO_OPENTYPE
|
||||||
|
openType = HB_SelectScript(item, hangul_features);
|
||||||
|
#endif
|
||||||
|
syllable = *item;
|
||||||
|
|
||||||
|
while (sstart < end) {
|
||||||
|
int send = hangul_nextSyllableBoundary(item->string, sstart, end);
|
||||||
|
|
||||||
|
syllable.item.pos = sstart;
|
||||||
|
syllable.item.length = send-sstart;
|
||||||
|
syllable.glyphs = item->glyphs + first_glyph;
|
||||||
|
syllable.attributes = item->attributes + first_glyph;
|
||||||
|
syllable.offsets = item->offsets + first_glyph;
|
||||||
|
syllable.advances = item->advances + first_glyph;
|
||||||
|
syllable.num_glyphs = item->num_glyphs - first_glyph;
|
||||||
|
if (!hangul_shape_syllable(&syllable, openType)) {
|
||||||
|
item->num_glyphs += syllable.num_glyphs;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
/* fix logcluster array */
|
||||||
|
for (i = sstart; i < send; ++i)
|
||||||
|
logClusters[i-item->item.pos] = first_glyph;
|
||||||
|
sstart = send;
|
||||||
|
first_glyph += syllable.num_glyphs;
|
||||||
|
}
|
||||||
|
item->num_glyphs = first_glyph;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return HB_BasicShape(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,187 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "harfbuzz-shaper.h"
|
||||||
|
#include "harfbuzz-shaper-private.h"
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Uniscribe also defines dlig for Hebrew, but we leave this out for now, as it's mostly
|
||||||
|
// ligatures one does not want in modern Hebrew (as lam-alef ligatures).
|
||||||
|
*/
|
||||||
|
#ifndef NO_OPENTYPE
|
||||||
|
static const HB_OpenTypeFeature hebrew_features[] = {
|
||||||
|
{ HB_MAKE_TAG('c', 'c', 'm', 'p'), CcmpProperty },
|
||||||
|
{0, 0}
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Hebrew shaping. In the non opentype case we try to use the
|
||||||
|
presentation forms specified for Hebrew. Especially for the
|
||||||
|
ligatures with Dagesh this gives much better results than we could
|
||||||
|
achieve manually.
|
||||||
|
*/
|
||||||
|
HB_Bool HB_HebrewShape(HB_ShaperItem *shaper_item)
|
||||||
|
{
|
||||||
|
enum {
|
||||||
|
Dagesh = 0x5bc,
|
||||||
|
ShinDot = 0x5c1,
|
||||||
|
SinDot = 0x5c2,
|
||||||
|
Patah = 0x5b7,
|
||||||
|
Qamats = 0x5b8,
|
||||||
|
Holam = 0x5b9,
|
||||||
|
Rafe = 0x5bf
|
||||||
|
};
|
||||||
|
|
||||||
|
assert(shaper_item->item.script == HB_Script_Hebrew);
|
||||||
|
|
||||||
|
#ifndef NO_OPENTYPE
|
||||||
|
if (HB_SelectScript(shaper_item, hebrew_features)) {
|
||||||
|
|
||||||
|
const int availableGlyphs = shaper_item->num_glyphs;
|
||||||
|
if (!HB_ConvertStringToGlyphIndices(shaper_item))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
HB_HeuristicSetGlyphAttributes(shaper_item);
|
||||||
|
HB_OpenTypeShape(shaper_item, /*properties*/0);
|
||||||
|
return HB_OpenTypePosition(shaper_item, availableGlyphs, /*doLogClusters*/TRUE);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
{
|
||||||
|
const HB_UChar16 *uc = shaper_item->string + shaper_item->item.pos;
|
||||||
|
unsigned short *logClusters = shaper_item->log_clusters;
|
||||||
|
HB_GlyphAttributes *attributes = shaper_item->attributes;
|
||||||
|
|
||||||
|
HB_Bool haveGlyphs;
|
||||||
|
int slen = 1;
|
||||||
|
int cluster_start = 0;
|
||||||
|
hb_uint32 i;
|
||||||
|
|
||||||
|
HB_STACKARRAY(HB_UChar16, shapedChars, 2 * shaper_item->item.length);
|
||||||
|
*shapedChars = *uc;
|
||||||
|
logClusters[0] = 0;
|
||||||
|
|
||||||
|
for (i = 1; i < shaper_item->item.length; ++i) {
|
||||||
|
hb_uint16 base = shapedChars[cluster_start];
|
||||||
|
hb_uint16 shaped = 0;
|
||||||
|
HB_Bool invalid = FALSE;
|
||||||
|
if (uc[i] == Dagesh) {
|
||||||
|
if (base >= 0x5d0
|
||||||
|
&& base <= 0x5ea
|
||||||
|
&& base != 0x5d7
|
||||||
|
&& base != 0x5dd
|
||||||
|
&& base != 0x5df
|
||||||
|
&& base != 0x5e2
|
||||||
|
&& base != 0x5e5) {
|
||||||
|
shaped = base - 0x5d0 + 0xfb30;
|
||||||
|
} else if (base == 0xfb2a || base == 0xfb2b /* Shin with Shin or Sin dot */) {
|
||||||
|
shaped = base + 2;
|
||||||
|
} else {
|
||||||
|
invalid = TRUE;
|
||||||
|
}
|
||||||
|
} else if (uc[i] == ShinDot) {
|
||||||
|
if (base == 0x05e9)
|
||||||
|
shaped = 0xfb2a;
|
||||||
|
else if (base == 0xfb49)
|
||||||
|
shaped = 0xfb2c;
|
||||||
|
else
|
||||||
|
invalid = TRUE;
|
||||||
|
} else if (uc[i] == SinDot) {
|
||||||
|
if (base == 0x05e9)
|
||||||
|
shaped = 0xfb2b;
|
||||||
|
else if (base == 0xfb49)
|
||||||
|
shaped = 0xfb2d;
|
||||||
|
else
|
||||||
|
invalid = TRUE;
|
||||||
|
} else if (uc[i] == Patah) {
|
||||||
|
if (base == 0x5d0)
|
||||||
|
shaped = 0xfb2e;
|
||||||
|
} else if (uc[i] == Qamats) {
|
||||||
|
if (base == 0x5d0)
|
||||||
|
shaped = 0xfb2f;
|
||||||
|
} else if (uc[i] == Holam) {
|
||||||
|
if (base == 0x5d5)
|
||||||
|
shaped = 0xfb4b;
|
||||||
|
} else if (uc[i] == Rafe) {
|
||||||
|
if (base == 0x5d1)
|
||||||
|
shaped = 0xfb4c;
|
||||||
|
else if (base == 0x5db)
|
||||||
|
shaped = 0xfb4d;
|
||||||
|
else if (base == 0x5e4)
|
||||||
|
shaped = 0xfb4e;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (invalid) {
|
||||||
|
shapedChars[slen] = 0x25cc;
|
||||||
|
attributes[slen].clusterStart = TRUE;
|
||||||
|
attributes[slen].mark = FALSE;
|
||||||
|
attributes[slen].combiningClass = 0;
|
||||||
|
cluster_start = slen;
|
||||||
|
++slen;
|
||||||
|
}
|
||||||
|
if (shaped) {
|
||||||
|
if (shaper_item->font->klass->canRender(shaper_item->font, (HB_UChar16 *)&shaped, 1)) {
|
||||||
|
shapedChars[cluster_start] = shaped;
|
||||||
|
} else
|
||||||
|
shaped = 0;
|
||||||
|
}
|
||||||
|
if (!shaped) {
|
||||||
|
HB_CharCategory category;
|
||||||
|
int cmb;
|
||||||
|
shapedChars[slen] = uc[i];
|
||||||
|
HB_GetUnicodeCharProperties(uc[i], &category, &cmb);
|
||||||
|
if (category != HB_Mark_NonSpacing) {
|
||||||
|
attributes[slen].clusterStart = TRUE;
|
||||||
|
attributes[slen].mark = FALSE;
|
||||||
|
attributes[slen].combiningClass = 0;
|
||||||
|
attributes[slen].dontPrint = HB_IsControlChar(uc[i]);
|
||||||
|
cluster_start = slen;
|
||||||
|
} else {
|
||||||
|
attributes[slen].clusterStart = FALSE;
|
||||||
|
attributes[slen].mark = TRUE;
|
||||||
|
attributes[slen].combiningClass = cmb;
|
||||||
|
}
|
||||||
|
++slen;
|
||||||
|
}
|
||||||
|
logClusters[i] = cluster_start;
|
||||||
|
}
|
||||||
|
|
||||||
|
haveGlyphs = shaper_item->font->klass
|
||||||
|
->convertStringToGlyphIndices(shaper_item->font,
|
||||||
|
shapedChars, slen,
|
||||||
|
shaper_item->glyphs, &shaper_item->num_glyphs,
|
||||||
|
shaper_item->item.bidiLevel % 2);
|
||||||
|
|
||||||
|
HB_FREE_STACKARRAY(shapedChars);
|
||||||
|
|
||||||
|
if (!haveGlyphs)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
HB_HeuristicPosition(shaper_item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
|
||||||
|
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
|
||||||
|
* Copyright (C) 2007 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*
|
||||||
|
* Red Hat Author(s): Behdad Esfahbod
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "harfbuzz-impl.h"
|
||||||
|
|
||||||
|
|
||||||
|
HB_INTERNAL HB_Pointer
|
||||||
|
_hb_alloc(size_t size,
|
||||||
|
HB_Error *perror )
|
||||||
|
{
|
||||||
|
HB_Error error = (HB_Error)0;
|
||||||
|
HB_Pointer block = NULL;
|
||||||
|
|
||||||
|
if ( size > 0 )
|
||||||
|
{
|
||||||
|
block = calloc( 1, size );
|
||||||
|
if ( !block )
|
||||||
|
error = ERR(HB_Err_Out_Of_Memory);
|
||||||
|
}
|
||||||
|
|
||||||
|
*perror = error;
|
||||||
|
return block;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HB_INTERNAL HB_Pointer
|
||||||
|
_hb_realloc(HB_Pointer block,
|
||||||
|
size_t new_size,
|
||||||
|
HB_Error *perror )
|
||||||
|
{
|
||||||
|
HB_Pointer block2 = NULL;
|
||||||
|
HB_Error error = (HB_Error)0;
|
||||||
|
|
||||||
|
block2 = realloc( block, new_size );
|
||||||
|
if ( block2 == NULL && new_size != 0 )
|
||||||
|
error = ERR(HB_Err_Out_Of_Memory);
|
||||||
|
|
||||||
|
if ( !error )
|
||||||
|
block = block2;
|
||||||
|
|
||||||
|
*perror = error;
|
||||||
|
return block;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HB_INTERNAL void
|
||||||
|
_hb_free( HB_Pointer block )
|
||||||
|
{
|
||||||
|
if ( block )
|
||||||
|
free( block );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* helper func to set a breakpoint on */
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_hb_err (HB_Error code)
|
||||||
|
{
|
||||||
|
return code;
|
||||||
|
}
|
|
@ -0,0 +1,131 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
|
||||||
|
* Copyright (C) 2006 Behdad Esfahbod
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HARFBUZZ_IMPL_H
|
||||||
|
#define HARFBUZZ_IMPL_H
|
||||||
|
|
||||||
|
#include "harfbuzz-global.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
HB_BEGIN_HEADER
|
||||||
|
|
||||||
|
#ifndef HB_INTERNAL
|
||||||
|
# define HB_INTERNAL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef NULL
|
||||||
|
# define NULL ((void *)0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FALSE
|
||||||
|
# define FALSE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef TRUE
|
||||||
|
# define TRUE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef TTAG_GDEF
|
||||||
|
# define TTAG_GDEF HB_MAKE_TAG( 'G', 'D', 'E', 'F' )
|
||||||
|
#endif
|
||||||
|
#ifndef TTAG_GPOS
|
||||||
|
# define TTAG_GPOS HB_MAKE_TAG( 'G', 'P', 'O', 'S' )
|
||||||
|
#endif
|
||||||
|
#ifndef TTAG_GSUB
|
||||||
|
# define TTAG_GSUB HB_MAKE_TAG( 'G', 'S', 'U', 'B' )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HB_UNUSED
|
||||||
|
# define HB_UNUSED(arg) ((arg) = (arg))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define HB_LIKELY(cond) (cond)
|
||||||
|
#define HB_UNLIKELY(cond) (cond)
|
||||||
|
|
||||||
|
#define ARRAY_LEN(Array) ((int)(sizeof (Array) / sizeof (Array)[0]))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define HB_IsHighSurrogate(ucs) \
|
||||||
|
(((ucs) & 0xfc00) == 0xd800)
|
||||||
|
|
||||||
|
#define HB_IsLowSurrogate(ucs) \
|
||||||
|
(((ucs) & 0xfc00) == 0xdc00)
|
||||||
|
|
||||||
|
#define HB_SurrogateToUcs4(high, low) \
|
||||||
|
(((HB_UChar32)(high))<<10) + (low) - 0x35fdc00;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define ALLOC(_ptr,_size) \
|
||||||
|
( (_ptr) = _hb_alloc( _size, &error ), error != 0 )
|
||||||
|
|
||||||
|
#define REALLOC(_ptr,_newsz) \
|
||||||
|
( (_ptr) = _hb_realloc( (_ptr), (_newsz), &error ), error != 0 )
|
||||||
|
|
||||||
|
#define FREE(_ptr) \
|
||||||
|
do { \
|
||||||
|
if ( (_ptr) ) \
|
||||||
|
{ \
|
||||||
|
_hb_free( _ptr ); \
|
||||||
|
_ptr = NULL; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ALLOC_ARRAY(_ptr,_count,_type) \
|
||||||
|
ALLOC(_ptr,(_count)*sizeof(_type))
|
||||||
|
|
||||||
|
#define REALLOC_ARRAY(_ptr,_newcnt,_type) \
|
||||||
|
REALLOC(_ptr,(_newcnt)*sizeof(_type))
|
||||||
|
|
||||||
|
#define MEM_Copy(dest,source,count) memcpy( (char*)(dest), (const char*)(source), (size_t)(count) )
|
||||||
|
|
||||||
|
#define ERR(err) _hb_err (err)
|
||||||
|
|
||||||
|
|
||||||
|
HB_INTERNAL HB_Pointer
|
||||||
|
_hb_alloc( size_t size,
|
||||||
|
HB_Error *perror_ );
|
||||||
|
|
||||||
|
HB_INTERNAL HB_Pointer
|
||||||
|
_hb_realloc( HB_Pointer block,
|
||||||
|
size_t new_size,
|
||||||
|
HB_Error *perror_ );
|
||||||
|
|
||||||
|
HB_INTERNAL void
|
||||||
|
_hb_free( HB_Pointer block );
|
||||||
|
|
||||||
|
|
||||||
|
/* helper func to set a breakpoint on */
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_hb_err (HB_Error code);
|
||||||
|
|
||||||
|
|
||||||
|
HB_END_HEADER
|
||||||
|
|
||||||
|
#endif /* HARFBUZZ_IMPL_H */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,667 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "harfbuzz-shaper.h"
|
||||||
|
#include "harfbuzz-shaper-private.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Vocabulary
|
||||||
|
// Base -> A consonant or an independent vowel in its full (not subscript) form. It is the
|
||||||
|
// center of the syllable, it can be surrounded by coeng (subscript) consonants, vowels,
|
||||||
|
// split vowels, signs... but there is only one base in a syllable, it has to be coded as
|
||||||
|
// the first character of the syllable.
|
||||||
|
// split vowel --> vowel that has two parts placed separately (e.g. Before and after the consonant).
|
||||||
|
// Khmer language has five of them. Khmer split vowels either have one part before the
|
||||||
|
// base and one after the base or they have a part before the base and a part above the base.
|
||||||
|
// The first part of all Khmer split vowels is the same character, identical to
|
||||||
|
// the glyph of Khmer dependent vowel SRA EI
|
||||||
|
// coeng --> modifier used in Khmer to construct coeng (subscript) consonants
|
||||||
|
// Differently than indian languages, the coeng modifies the consonant that follows it,
|
||||||
|
// not the one preceding it Each consonant has two forms, the base form and the subscript form
|
||||||
|
// the base form is the normal one (using the consonants code-point), the subscript form is
|
||||||
|
// displayed when the combination coeng + consonant is encountered.
|
||||||
|
// Consonant of type 1 -> A consonant which has subscript for that only occupies space under a base consonant
|
||||||
|
// Consonant of type 2.-> Its subscript form occupies space under and before the base (only one, RO)
|
||||||
|
// Consonant of Type 3 -> Its subscript form occupies space under and after the base (KHO, CHHO, THHO, BA, YO, SA)
|
||||||
|
// Consonant shifter -> Khmer has to series of consonants. The same dependent vowel has different sounds
|
||||||
|
// if it is attached to a consonant of the first series or a consonant of the second series
|
||||||
|
// Most consonants have an equivalent in the other series, but some of theme exist only in
|
||||||
|
// one series (for example SA). If we want to use the consonant SA with a vowel sound that
|
||||||
|
// can only be done with a vowel sound that corresponds to a vowel accompanying a consonant
|
||||||
|
// of the other series, then we need to use a consonant shifter: TRIISAP or MUSIKATOAN
|
||||||
|
// x17C9 y x17CA. TRIISAP changes a first series consonant to second series sound and
|
||||||
|
// MUSIKATOAN a second series consonant to have a first series vowel sound.
|
||||||
|
// Consonant shifter are both normally supercript marks, but, when they are followed by a
|
||||||
|
// superscript, they change shape and take the form of subscript dependent vowel SRA U.
|
||||||
|
// If they are in the same syllable as a coeng consonant, Unicode 3.0 says that they
|
||||||
|
// should be typed before the coeng. Unicode 4.0 breaks the standard and says that it should
|
||||||
|
// be placed after the coeng consonant.
|
||||||
|
// Dependent vowel -> In khmer dependent vowels can be placed above, below, before or after the base
|
||||||
|
// Each vowel has its own position. Only one vowel per syllable is allowed.
|
||||||
|
// Signs -> Khmer has above signs and post signs. Only one above sign and/or one post sign are
|
||||||
|
// Allowed in a syllable.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// order is important here! This order must be the same that is found in each horizontal
|
||||||
|
// line in the statetable for Khmer (see khmerStateTable) .
|
||||||
|
*/
|
||||||
|
enum KhmerCharClassValues {
|
||||||
|
CC_RESERVED = 0,
|
||||||
|
CC_CONSONANT = 1, /* Consonant of type 1 or independent vowel */
|
||||||
|
CC_CONSONANT2 = 2, /* Consonant of type 2 */
|
||||||
|
CC_CONSONANT3 = 3, /* Consonant of type 3 */
|
||||||
|
CC_ZERO_WIDTH_NJ_MARK = 4, /* Zero Width non joiner character (0x200C) */
|
||||||
|
CC_CONSONANT_SHIFTER = 5,
|
||||||
|
CC_ROBAT = 6, /* Khmer special diacritic accent -treated differently in state table */
|
||||||
|
CC_COENG = 7, /* Subscript consonant combining character */
|
||||||
|
CC_DEPENDENT_VOWEL = 8,
|
||||||
|
CC_SIGN_ABOVE = 9,
|
||||||
|
CC_SIGN_AFTER = 10,
|
||||||
|
CC_ZERO_WIDTH_J_MARK = 11, /* Zero width joiner character */
|
||||||
|
CC_COUNT = 12 /* This is the number of character classes */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
enum KhmerCharClassFlags {
|
||||||
|
CF_CLASS_MASK = 0x0000FFFF,
|
||||||
|
|
||||||
|
CF_CONSONANT = 0x01000000, /* flag to speed up comparing */
|
||||||
|
CF_SPLIT_VOWEL = 0x02000000, /* flag for a split vowel -> the first part is added in front of the syllable */
|
||||||
|
CF_DOTTED_CIRCLE = 0x04000000, /* add a dotted circle if a character with this flag is the first in a syllable */
|
||||||
|
CF_COENG = 0x08000000, /* flag to speed up comparing */
|
||||||
|
CF_SHIFTER = 0x10000000, /* flag to speed up comparing */
|
||||||
|
CF_ABOVE_VOWEL = 0x20000000, /* flag to speed up comparing */
|
||||||
|
|
||||||
|
/* position flags */
|
||||||
|
CF_POS_BEFORE = 0x00080000,
|
||||||
|
CF_POS_BELOW = 0x00040000,
|
||||||
|
CF_POS_ABOVE = 0x00020000,
|
||||||
|
CF_POS_AFTER = 0x00010000,
|
||||||
|
CF_POS_MASK = 0x000f0000
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Characters that get referred to by name */
|
||||||
|
enum KhmerChar {
|
||||||
|
C_SIGN_ZWNJ = 0x200C,
|
||||||
|
C_SIGN_ZWJ = 0x200D,
|
||||||
|
C_RO = 0x179A,
|
||||||
|
C_VOWEL_AA = 0x17B6,
|
||||||
|
C_SIGN_NIKAHIT = 0x17C6,
|
||||||
|
C_VOWEL_E = 0x17C1,
|
||||||
|
C_COENG = 0x17D2
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
// simple classes, they are used in the statetable (in this file) to control the length of a syllable
|
||||||
|
// they are also used to know where a character should be placed (location in reference to the base character)
|
||||||
|
// and also to know if a character, when independently displayed, should be displayed with a dotted-circle to
|
||||||
|
// indicate error in syllable construction
|
||||||
|
*/
|
||||||
|
enum {
|
||||||
|
_xx = CC_RESERVED,
|
||||||
|
_sa = CC_SIGN_ABOVE | CF_DOTTED_CIRCLE | CF_POS_ABOVE,
|
||||||
|
_sp = CC_SIGN_AFTER | CF_DOTTED_CIRCLE| CF_POS_AFTER,
|
||||||
|
_c1 = CC_CONSONANT | CF_CONSONANT,
|
||||||
|
_c2 = CC_CONSONANT2 | CF_CONSONANT,
|
||||||
|
_c3 = CC_CONSONANT3 | CF_CONSONANT,
|
||||||
|
_rb = CC_ROBAT | CF_POS_ABOVE | CF_DOTTED_CIRCLE,
|
||||||
|
_cs = CC_CONSONANT_SHIFTER | CF_DOTTED_CIRCLE | CF_SHIFTER,
|
||||||
|
_dl = CC_DEPENDENT_VOWEL | CF_POS_BEFORE | CF_DOTTED_CIRCLE,
|
||||||
|
_db = CC_DEPENDENT_VOWEL | CF_POS_BELOW | CF_DOTTED_CIRCLE,
|
||||||
|
_da = CC_DEPENDENT_VOWEL | CF_POS_ABOVE | CF_DOTTED_CIRCLE | CF_ABOVE_VOWEL,
|
||||||
|
_dr = CC_DEPENDENT_VOWEL | CF_POS_AFTER | CF_DOTTED_CIRCLE,
|
||||||
|
_co = CC_COENG | CF_COENG | CF_DOTTED_CIRCLE,
|
||||||
|
|
||||||
|
/* split vowel */
|
||||||
|
_va = _da | CF_SPLIT_VOWEL,
|
||||||
|
_vr = _dr | CF_SPLIT_VOWEL
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Character class: a character class value
|
||||||
|
// ORed with character class flags.
|
||||||
|
*/
|
||||||
|
typedef unsigned long KhmerCharClass;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Character class tables
|
||||||
|
// _xx character does not combine into syllable, such as numbers, puntuation marks, non-Khmer signs...
|
||||||
|
// _sa Sign placed above the base
|
||||||
|
// _sp Sign placed after the base
|
||||||
|
// _c1 Consonant of type 1 or independent vowel (independent vowels behave as type 1 consonants)
|
||||||
|
// _c2 Consonant of type 2 (only RO)
|
||||||
|
// _c3 Consonant of type 3
|
||||||
|
// _rb Khmer sign robat u17CC. combining mark for subscript consonants
|
||||||
|
// _cd Consonant-shifter
|
||||||
|
// _dl Dependent vowel placed before the base (left of the base)
|
||||||
|
// _db Dependent vowel placed below the base
|
||||||
|
// _da Dependent vowel placed above the base
|
||||||
|
// _dr Dependent vowel placed behind the base (right of the base)
|
||||||
|
// _co Khmer combining mark COENG u17D2, combines with the consonant or independent vowel following
|
||||||
|
// it to create a subscript consonant or independent vowel
|
||||||
|
// _va Khmer split vowel in which the first part is before the base and the second one above the base
|
||||||
|
// _vr Khmer split vowel in which the first part is before the base and the second one behind (right of) the base
|
||||||
|
*/
|
||||||
|
static const KhmerCharClass khmerCharClasses[] = {
|
||||||
|
_c1, _c1, _c1, _c3, _c1, _c1, _c1, _c1, _c3, _c1, _c1, _c1, _c1, _c3, _c1, _c1, /* 1780 - 178F */
|
||||||
|
_c1, _c1, _c1, _c1, _c3, _c1, _c1, _c1, _c1, _c3, _c2, _c1, _c1, _c1, _c3, _c3, /* 1790 - 179F */
|
||||||
|
_c1, _c3, _c1, _c1, _c1, _c1, _c1, _c1, _c1, _c1, _c1, _c1, _c1, _c1, _c1, _c1, /* 17A0 - 17AF */
|
||||||
|
_c1, _c1, _c1, _c1, _dr, _dr, _dr, _da, _da, _da, _da, _db, _db, _db, _va, _vr, /* 17B0 - 17BF */
|
||||||
|
_vr, _dl, _dl, _dl, _vr, _vr, _sa, _sp, _sp, _cs, _cs, _sa, _rb, _sa, _sa, _sa, /* 17C0 - 17CF */
|
||||||
|
_sa, _sa, _co, _sa, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _sa, _xx, _xx /* 17D0 - 17DF */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* this enum must reflect the range of khmerCharClasses */
|
||||||
|
enum KhmerCharClassesRange {
|
||||||
|
KhmerFirstChar = 0x1780,
|
||||||
|
KhmerLastChar = 0x17df
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Below we define how a character in the input string is either in the khmerCharClasses table
|
||||||
|
// (in which case we get its type back), a ZWJ or ZWNJ (two characters that may appear
|
||||||
|
// within the syllable, but are not in the table) we also get their type back, or an unknown object
|
||||||
|
// in which case we get _xx (CC_RESERVED) back
|
||||||
|
*/
|
||||||
|
static KhmerCharClass getKhmerCharClass(HB_UChar16 uc)
|
||||||
|
{
|
||||||
|
if (uc == C_SIGN_ZWJ) {
|
||||||
|
return CC_ZERO_WIDTH_J_MARK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uc == C_SIGN_ZWNJ) {
|
||||||
|
return CC_ZERO_WIDTH_NJ_MARK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uc < KhmerFirstChar || uc > KhmerLastChar) {
|
||||||
|
return CC_RESERVED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return khmerCharClasses[uc - KhmerFirstChar];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
// The stateTable is used to calculate the end (the length) of a well
|
||||||
|
// formed Khmer Syllable.
|
||||||
|
//
|
||||||
|
// Each horizontal line is ordered exactly the same way as the values in KhmerClassTable
|
||||||
|
// CharClassValues. This coincidence of values allows the follow up of the table.
|
||||||
|
//
|
||||||
|
// Each line corresponds to a state, which does not necessarily need to be a type
|
||||||
|
// of component... for example, state 2 is a base, with is always a first character
|
||||||
|
// in the syllable, but the state could be produced a consonant of any type when
|
||||||
|
// it is the first character that is analysed (in ground state).
|
||||||
|
//
|
||||||
|
// Differentiating 3 types of consonants is necessary in order to
|
||||||
|
// forbid the use of certain combinations, such as having a second
|
||||||
|
// coeng after a coeng RO,
|
||||||
|
// The inexistent possibility of having a type 3 after another type 3 is permitted,
|
||||||
|
// eliminating it would very much complicate the table, and it does not create typing
|
||||||
|
// problems, as the case above.
|
||||||
|
//
|
||||||
|
// The table is quite complex, in order to limit the number of coeng consonants
|
||||||
|
// to 2 (by means of the table).
|
||||||
|
//
|
||||||
|
// There a peculiarity, as far as Unicode is concerned:
|
||||||
|
// - The consonant-shifter is considered in two possible different
|
||||||
|
// locations, the one considered in Unicode 3.0 and the one considered in
|
||||||
|
// Unicode 4.0. (there is a backwards compatibility problem in this standard).
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// xx independent character, such as a number, punctuation sign or non-khmer char
|
||||||
|
//
|
||||||
|
// c1 Khmer consonant of type 1 or an independent vowel
|
||||||
|
// that is, a letter in which the subscript for is only under the
|
||||||
|
// base, not taking any space to the right or to the left
|
||||||
|
//
|
||||||
|
// c2 Khmer consonant of type 2, the coeng form takes space under
|
||||||
|
// and to the left of the base (only RO is of this type)
|
||||||
|
//
|
||||||
|
// c3 Khmer consonant of type 3. Its subscript form takes space under
|
||||||
|
// and to the right of the base.
|
||||||
|
//
|
||||||
|
// cs Khmer consonant shifter
|
||||||
|
//
|
||||||
|
// rb Khmer robat
|
||||||
|
//
|
||||||
|
// co coeng character (u17D2)
|
||||||
|
//
|
||||||
|
// dv dependent vowel (including split vowels, they are treated in the same way).
|
||||||
|
// even if dv is not defined above, the component that is really tested for is
|
||||||
|
// KhmerClassTable::CC_DEPENDENT_VOWEL, which is common to all dependent vowels
|
||||||
|
//
|
||||||
|
// zwj Zero Width joiner
|
||||||
|
//
|
||||||
|
// zwnj Zero width non joiner
|
||||||
|
//
|
||||||
|
// sa above sign
|
||||||
|
//
|
||||||
|
// sp post sign
|
||||||
|
//
|
||||||
|
// there are lines with equal content but for an easier understanding
|
||||||
|
// (and maybe change in the future) we did not join them
|
||||||
|
*/
|
||||||
|
static const signed char khmerStateTable[][CC_COUNT] =
|
||||||
|
{
|
||||||
|
/* xx c1 c2 c3 zwnj cs rb co dv sa sp zwj */
|
||||||
|
{ 1, 2, 2, 2, 1, 1, 1, 6, 1, 1, 1, 2}, /* 0 - ground state */
|
||||||
|
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 1 - exit state (or sign to the right of the syllable) */
|
||||||
|
{-1, -1, -1, -1, 3, 4, 5, 6, 16, 17, 1, -1}, /* 2 - Base consonant */
|
||||||
|
{-1, -1, -1, -1, -1, 4, -1, -1, 16, -1, -1, -1}, /* 3 - First ZWNJ before a register shifter It can only be followed by a shifter or a vowel */
|
||||||
|
{-1, -1, -1, -1, 15, -1, -1, 6, 16, 17, 1, 14}, /* 4 - First register shifter */
|
||||||
|
{-1, -1, -1, -1, -1, -1, -1, -1, 20, -1, 1, -1}, /* 5 - Robat */
|
||||||
|
{-1, 7, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1}, /* 6 - First Coeng */
|
||||||
|
{-1, -1, -1, -1, 12, 13, -1, 10, 16, 17, 1, 14}, /* 7 - First consonant of type 1 after coeng */
|
||||||
|
{-1, -1, -1, -1, 12, 13, -1, -1, 16, 17, 1, 14}, /* 8 - First consonant of type 2 after coeng */
|
||||||
|
{-1, -1, -1, -1, 12, 13, -1, 10, 16, 17, 1, 14}, /* 9 - First consonant or type 3 after ceong */
|
||||||
|
{-1, 11, 11, 11, -1, -1, -1, -1, -1, -1, -1, -1}, /* 10 - Second Coeng (no register shifter before) */
|
||||||
|
{-1, -1, -1, -1, 15, -1, -1, -1, 16, 17, 1, 14}, /* 11 - Second coeng consonant (or ind. vowel) no register shifter before */
|
||||||
|
{-1, -1, -1, -1, -1, 13, -1, -1, 16, -1, -1, -1}, /* 12 - Second ZWNJ before a register shifter */
|
||||||
|
{-1, -1, -1, -1, 15, -1, -1, -1, 16, 17, 1, 14}, /* 13 - Second register shifter */
|
||||||
|
{-1, -1, -1, -1, -1, -1, -1, -1, 16, -1, -1, -1}, /* 14 - ZWJ before vowel */
|
||||||
|
{-1, -1, -1, -1, -1, -1, -1, -1, 16, -1, -1, -1}, /* 15 - ZWNJ before vowel */
|
||||||
|
{-1, -1, -1, -1, -1, -1, -1, -1, -1, 17, 1, 18}, /* 16 - dependent vowel */
|
||||||
|
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 18}, /* 17 - sign above */
|
||||||
|
{-1, -1, -1, -1, -1, -1, -1, 19, -1, -1, -1, -1}, /* 18 - ZWJ after vowel */
|
||||||
|
{-1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19 - Third coeng */
|
||||||
|
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1}, /* 20 - dependent vowel after a Robat */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* #define KHMER_DEBUG */
|
||||||
|
#ifdef KHMER_DEBUG
|
||||||
|
#define KHDEBUG qDebug
|
||||||
|
#else
|
||||||
|
#define KHDEBUG if(0) printf
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Given an input string of characters and a location in which to start looking
|
||||||
|
// calculate, using the state table, which one is the last character of the syllable
|
||||||
|
// that starts in the starting position.
|
||||||
|
*/
|
||||||
|
static int khmer_nextSyllableBoundary(const HB_UChar16 *s, int start, int end, HB_Bool *invalid)
|
||||||
|
{
|
||||||
|
const HB_UChar16 *uc = s + start;
|
||||||
|
int state = 0;
|
||||||
|
int pos = start;
|
||||||
|
*invalid = FALSE;
|
||||||
|
|
||||||
|
while (pos < end) {
|
||||||
|
KhmerCharClass charClass = getKhmerCharClass(*uc);
|
||||||
|
if (pos == start) {
|
||||||
|
*invalid = (charClass > 0) && ! (charClass & CF_CONSONANT);
|
||||||
|
}
|
||||||
|
state = khmerStateTable[state][charClass & CF_CLASS_MASK];
|
||||||
|
|
||||||
|
KHDEBUG("state[%d]=%d class=%8lx (uc=%4x)", pos - start, state,
|
||||||
|
charClass, *uc );
|
||||||
|
|
||||||
|
if (state < 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
++uc;
|
||||||
|
++pos;
|
||||||
|
}
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NO_OPENTYPE
|
||||||
|
static const HB_OpenTypeFeature khmer_features[] = {
|
||||||
|
{ HB_MAKE_TAG( 'p', 'r', 'e', 'f' ), PreFormProperty },
|
||||||
|
{ HB_MAKE_TAG( 'b', 'l', 'w', 'f' ), BelowFormProperty },
|
||||||
|
{ HB_MAKE_TAG( 'a', 'b', 'v', 'f' ), AboveFormProperty },
|
||||||
|
{ HB_MAKE_TAG( 'p', 's', 't', 'f' ), PostFormProperty },
|
||||||
|
{ HB_MAKE_TAG( 'p', 'r', 'e', 's' ), PreSubstProperty },
|
||||||
|
{ HB_MAKE_TAG( 'b', 'l', 'w', 's' ), BelowSubstProperty },
|
||||||
|
{ HB_MAKE_TAG( 'a', 'b', 'v', 's' ), AboveSubstProperty },
|
||||||
|
{ HB_MAKE_TAG( 'p', 's', 't', 's' ), PostSubstProperty },
|
||||||
|
{ HB_MAKE_TAG( 'c', 'l', 'i', 'g' ), CligProperty },
|
||||||
|
{ 0, 0 }
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
static HB_Bool khmer_shape_syllable(HB_Bool openType, HB_ShaperItem *item)
|
||||||
|
{
|
||||||
|
/* KHDEBUG("syllable from %d len %d, str='%s'", item->from, item->length,
|
||||||
|
item->string->mid(item->from, item->length).toUtf8().data()); */
|
||||||
|
|
||||||
|
int len = 0;
|
||||||
|
int syllableEnd = item->item.pos + item->item.length;
|
||||||
|
unsigned short reordered[16];
|
||||||
|
unsigned char properties[16];
|
||||||
|
enum {
|
||||||
|
AboveForm = 0x01,
|
||||||
|
PreForm = 0x02,
|
||||||
|
PostForm = 0x04,
|
||||||
|
BelowForm = 0x08
|
||||||
|
};
|
||||||
|
#ifndef NO_OPENTYPE
|
||||||
|
const int availableGlyphs = item->num_glyphs;
|
||||||
|
#endif
|
||||||
|
int coengRo;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* according to the specs this is the max length one can get
|
||||||
|
### the real value should be smaller */
|
||||||
|
assert(item->item.length < 13);
|
||||||
|
|
||||||
|
memset(properties, 0, 16*sizeof(unsigned char));
|
||||||
|
|
||||||
|
#ifdef KHMER_DEBUG
|
||||||
|
qDebug("original:");
|
||||||
|
for (int i = from; i < syllableEnd; i++) {
|
||||||
|
qDebug(" %d: %4x", i, string[i]);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
// write a pre vowel or the pre part of a split vowel first
|
||||||
|
// and look out for coeng + ro. RO is the only vowel of type 2, and
|
||||||
|
// therefore the only one that requires saving space before the base.
|
||||||
|
*/
|
||||||
|
coengRo = -1; /* There is no Coeng Ro, if found this value will change */
|
||||||
|
for (i = item->item.pos; i < syllableEnd; i += 1) {
|
||||||
|
KhmerCharClass charClass = getKhmerCharClass(item->string[i]);
|
||||||
|
|
||||||
|
/* if a split vowel, write the pre part. In Khmer the pre part
|
||||||
|
is the same for all split vowels, same glyph as pre vowel C_VOWEL_E */
|
||||||
|
if (charClass & CF_SPLIT_VOWEL) {
|
||||||
|
reordered[len] = C_VOWEL_E;
|
||||||
|
properties[len] = PreForm;
|
||||||
|
++len;
|
||||||
|
break; /* there can be only one vowel */
|
||||||
|
}
|
||||||
|
/* if a vowel with pos before write it out */
|
||||||
|
if (charClass & CF_POS_BEFORE) {
|
||||||
|
reordered[len] = item->string[i];
|
||||||
|
properties[len] = PreForm;
|
||||||
|
++len;
|
||||||
|
break; /* there can be only one vowel */
|
||||||
|
}
|
||||||
|
/* look for coeng + ro and remember position
|
||||||
|
works because coeng + ro is always in front of a vowel (if there is a vowel)
|
||||||
|
and because CC_CONSONANT2 is enough to identify it, as it is the only consonant
|
||||||
|
with this flag */
|
||||||
|
if ( (charClass & CF_COENG) && (i + 1 < syllableEnd) &&
|
||||||
|
( (getKhmerCharClass(item->string[i+1]) & CF_CLASS_MASK) == CC_CONSONANT2) ) {
|
||||||
|
coengRo = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* write coeng + ro if found */
|
||||||
|
if (coengRo > -1) {
|
||||||
|
reordered[len] = C_COENG;
|
||||||
|
properties[len] = PreForm;
|
||||||
|
++len;
|
||||||
|
reordered[len] = C_RO;
|
||||||
|
properties[len] = PreForm;
|
||||||
|
++len;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
shall we add a dotted circle?
|
||||||
|
If in the position in which the base should be (first char in the string) there is
|
||||||
|
a character that has the Dotted circle flag (a character that cannot be a base)
|
||||||
|
then write a dotted circle */
|
||||||
|
if (getKhmerCharClass(item->string[item->item.pos]) & CF_DOTTED_CIRCLE) {
|
||||||
|
reordered[len] = C_DOTTED_CIRCLE;
|
||||||
|
++len;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* copy what is left to the output, skipping before vowels and
|
||||||
|
coeng Ro if they are present */
|
||||||
|
for (i = item->item.pos; i < syllableEnd; i += 1) {
|
||||||
|
HB_UChar16 uc = item->string[i];
|
||||||
|
KhmerCharClass charClass = getKhmerCharClass(uc);
|
||||||
|
|
||||||
|
/* skip a before vowel, it was already processed */
|
||||||
|
if (charClass & CF_POS_BEFORE) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* skip coeng + ro, it was already processed */
|
||||||
|
if (i == coengRo) {
|
||||||
|
i += 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (charClass & CF_POS_MASK)
|
||||||
|
{
|
||||||
|
case CF_POS_ABOVE :
|
||||||
|
reordered[len] = uc;
|
||||||
|
properties[len] = AboveForm;
|
||||||
|
++len;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CF_POS_AFTER :
|
||||||
|
reordered[len] = uc;
|
||||||
|
properties[len] = PostForm;
|
||||||
|
++len;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CF_POS_BELOW :
|
||||||
|
reordered[len] = uc;
|
||||||
|
properties[len] = BelowForm;
|
||||||
|
++len;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
/* assign the correct flags to a coeng consonant
|
||||||
|
Consonants of type 3 are taged as Post forms and those type 1 as below forms */
|
||||||
|
if ( (charClass & CF_COENG) && i + 1 < syllableEnd ) {
|
||||||
|
unsigned char property = (getKhmerCharClass(item->string[i+1]) & CF_CLASS_MASK) == CC_CONSONANT3 ?
|
||||||
|
PostForm : BelowForm;
|
||||||
|
reordered[len] = uc;
|
||||||
|
properties[len] = property;
|
||||||
|
++len;
|
||||||
|
i += 1;
|
||||||
|
reordered[len] = item->string[i];
|
||||||
|
properties[len] = property;
|
||||||
|
++len;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if a shifter is followed by an above vowel change the shifter to below form,
|
||||||
|
an above vowel can have two possible positions i + 1 or i + 3
|
||||||
|
(position i+1 corresponds to unicode 3, position i+3 to Unicode 4)
|
||||||
|
and there is an extra rule for C_VOWEL_AA + C_SIGN_NIKAHIT also for two
|
||||||
|
different positions, right after the shifter or after a vowel (Unicode 4) */
|
||||||
|
if ( (charClass & CF_SHIFTER) && (i + 1 < syllableEnd) ) {
|
||||||
|
if (getKhmerCharClass(item->string[i+1]) & CF_ABOVE_VOWEL ) {
|
||||||
|
reordered[len] = uc;
|
||||||
|
properties[len] = BelowForm;
|
||||||
|
++len;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i + 2 < syllableEnd &&
|
||||||
|
(item->string[i+1] == C_VOWEL_AA) &&
|
||||||
|
(item->string[i+2] == C_SIGN_NIKAHIT) )
|
||||||
|
{
|
||||||
|
reordered[len] = uc;
|
||||||
|
properties[len] = BelowForm;
|
||||||
|
++len;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i + 3 < syllableEnd && (getKhmerCharClass(item->string[i+3]) & CF_ABOVE_VOWEL) ) {
|
||||||
|
reordered[len] = uc;
|
||||||
|
properties[len] = BelowForm;
|
||||||
|
++len;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i + 4 < syllableEnd &&
|
||||||
|
(item->string[i+3] == C_VOWEL_AA) &&
|
||||||
|
(item->string[i+4] == C_SIGN_NIKAHIT) )
|
||||||
|
{
|
||||||
|
reordered[len] = uc;
|
||||||
|
properties[len] = BelowForm;
|
||||||
|
++len;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* default - any other characters */
|
||||||
|
reordered[len] = uc;
|
||||||
|
++len;
|
||||||
|
break;
|
||||||
|
} /* switch */
|
||||||
|
} /* for */
|
||||||
|
|
||||||
|
if (!item->font->klass->convertStringToGlyphIndices(item->font,
|
||||||
|
reordered, len,
|
||||||
|
item->glyphs, &item->num_glyphs,
|
||||||
|
item->item.bidiLevel % 2))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
|
||||||
|
KHDEBUG("after shaping: len=%d", len);
|
||||||
|
for (i = 0; i < len; i++) {
|
||||||
|
item->attributes[i].mark = FALSE;
|
||||||
|
item->attributes[i].clusterStart = FALSE;
|
||||||
|
item->attributes[i].justification = 0;
|
||||||
|
item->attributes[i].zeroWidth = FALSE;
|
||||||
|
KHDEBUG(" %d: %4x property=%x", i, reordered[i], properties[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* now we have the syllable in the right order, and can start running it through open type. */
|
||||||
|
|
||||||
|
#ifndef NO_OPENTYPE
|
||||||
|
if (openType) {
|
||||||
|
hb_uint32 where[16];
|
||||||
|
for (i = 0; i < len; ++i) {
|
||||||
|
where[i] = ~(PreSubstProperty
|
||||||
|
| BelowSubstProperty
|
||||||
|
| AboveSubstProperty
|
||||||
|
| PostSubstProperty
|
||||||
|
| CligProperty
|
||||||
|
| PositioningProperties);
|
||||||
|
if (properties[i] == PreForm)
|
||||||
|
where[i] &= ~PreFormProperty;
|
||||||
|
else if (properties[i] == BelowForm)
|
||||||
|
where[i] &= ~BelowFormProperty;
|
||||||
|
else if (properties[i] == AboveForm)
|
||||||
|
where[i] &= ~AboveFormProperty;
|
||||||
|
else if (properties[i] == PostForm)
|
||||||
|
where[i] &= ~PostFormProperty;
|
||||||
|
}
|
||||||
|
|
||||||
|
HB_OpenTypeShape(item, where);
|
||||||
|
if (!HB_OpenTypePosition(item, availableGlyphs, /*doLogClusters*/FALSE))
|
||||||
|
return FALSE;
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
KHDEBUG("Not using openType");
|
||||||
|
HB_HeuristicPosition(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
item->attributes[0].clusterStart = TRUE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
HB_Bool HB_KhmerShape(HB_ShaperItem *item)
|
||||||
|
{
|
||||||
|
HB_Bool openType = FALSE;
|
||||||
|
unsigned short *logClusters = item->log_clusters;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
HB_ShaperItem syllable = *item;
|
||||||
|
int first_glyph = 0;
|
||||||
|
|
||||||
|
int sstart = item->item.pos;
|
||||||
|
int end = sstart + item->item.length;
|
||||||
|
|
||||||
|
assert(item->item.script == HB_Script_Khmer);
|
||||||
|
|
||||||
|
#ifndef NO_OPENTYPE
|
||||||
|
openType = HB_SelectScript(item, khmer_features);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
KHDEBUG("khmer_shape: from %d length %d", item->item.pos, item->item.length);
|
||||||
|
while (sstart < end) {
|
||||||
|
HB_Bool invalid;
|
||||||
|
int send = khmer_nextSyllableBoundary(item->string, sstart, end, &invalid);
|
||||||
|
KHDEBUG("syllable from %d, length %d, invalid=%s", sstart, send-sstart,
|
||||||
|
invalid ? "TRUE" : "FALSE");
|
||||||
|
syllable.item.pos = sstart;
|
||||||
|
syllable.item.length = send-sstart;
|
||||||
|
syllable.glyphs = item->glyphs + first_glyph;
|
||||||
|
syllable.attributes = item->attributes + first_glyph;
|
||||||
|
syllable.offsets = item->offsets + first_glyph;
|
||||||
|
syllable.advances = item->advances + first_glyph;
|
||||||
|
syllable.num_glyphs = item->num_glyphs - first_glyph;
|
||||||
|
if (!khmer_shape_syllable(openType, &syllable)) {
|
||||||
|
KHDEBUG("syllable shaping failed, syllable requests %d glyphs", syllable.num_glyphs);
|
||||||
|
item->num_glyphs += syllable.num_glyphs;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
/* fix logcluster array */
|
||||||
|
KHDEBUG("syllable:");
|
||||||
|
for (i = first_glyph; i < first_glyph + (int)syllable.num_glyphs; ++i)
|
||||||
|
KHDEBUG(" %d -> glyph %x", i, item->glyphs[i]);
|
||||||
|
KHDEBUG(" logclusters:");
|
||||||
|
for (i = sstart; i < send; ++i) {
|
||||||
|
KHDEBUG(" %d -> glyph %d", i, first_glyph);
|
||||||
|
logClusters[i-item->item.pos] = first_glyph;
|
||||||
|
}
|
||||||
|
sstart = send;
|
||||||
|
first_glyph += syllable.num_glyphs;
|
||||||
|
}
|
||||||
|
item->num_glyphs = first_glyph;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void HB_KhmerAttributes(HB_Script script, const HB_UChar16 *text, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes)
|
||||||
|
{
|
||||||
|
int end = from + len;
|
||||||
|
const HB_UChar16 *uc = text + from;
|
||||||
|
hb_uint32 i = 0;
|
||||||
|
HB_UNUSED(script);
|
||||||
|
attributes += from;
|
||||||
|
while ( i < len ) {
|
||||||
|
HB_Bool invalid;
|
||||||
|
hb_uint32 boundary = khmer_nextSyllableBoundary( text, from+i, end, &invalid ) - from;
|
||||||
|
|
||||||
|
attributes[i].charStop = TRUE;
|
||||||
|
|
||||||
|
if ( boundary > len-1 ) boundary = len;
|
||||||
|
i++;
|
||||||
|
while ( i < boundary ) {
|
||||||
|
attributes[i].charStop = FALSE;
|
||||||
|
++uc;
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
assert( i == boundary );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,539 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "harfbuzz-shaper.h"
|
||||||
|
#include "harfbuzz-shaper-private.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
enum MymrCharClassValues
|
||||||
|
{
|
||||||
|
Mymr_CC_RESERVED = 0,
|
||||||
|
Mymr_CC_CONSONANT = 1, /* Consonant of type 1, that has subscript form */
|
||||||
|
Mymr_CC_CONSONANT2 = 2, /* Consonant of type 2, that has no subscript form */
|
||||||
|
Mymr_CC_NGA = 3, /* Consonant NGA */
|
||||||
|
Mymr_CC_YA = 4, /* Consonant YA */
|
||||||
|
Mymr_CC_RA = 5, /* Consonant RA */
|
||||||
|
Mymr_CC_WA = 6, /* Consonant WA */
|
||||||
|
Mymr_CC_HA = 7, /* Consonant HA */
|
||||||
|
Mymr_CC_IND_VOWEL = 8, /* Independent vowel */
|
||||||
|
Mymr_CC_ZERO_WIDTH_NJ_MARK = 9, /* Zero Width non joiner character (0x200C) */
|
||||||
|
Mymr_CC_VIRAMA = 10, /* Subscript consonant combining character */
|
||||||
|
Mymr_CC_PRE_VOWEL = 11, /* Dependent vowel, prebase (Vowel e) */
|
||||||
|
Mymr_CC_BELOW_VOWEL = 12, /* Dependent vowel, prebase (Vowel u, uu) */
|
||||||
|
Mymr_CC_ABOVE_VOWEL = 13, /* Dependent vowel, prebase (Vowel i, ii, ai) */
|
||||||
|
Mymr_CC_POST_VOWEL = 14, /* Dependent vowel, prebase (Vowel aa) */
|
||||||
|
Mymr_CC_SIGN_ABOVE = 15,
|
||||||
|
Mymr_CC_SIGN_BELOW = 16,
|
||||||
|
Mymr_CC_SIGN_AFTER = 17,
|
||||||
|
Mymr_CC_ZERO_WIDTH_J_MARK = 18, /* Zero width joiner character */
|
||||||
|
Mymr_CC_COUNT = 19 /* This is the number of character classes */
|
||||||
|
};
|
||||||
|
|
||||||
|
enum MymrCharClassFlags
|
||||||
|
{
|
||||||
|
Mymr_CF_CLASS_MASK = 0x0000FFFF,
|
||||||
|
|
||||||
|
Mymr_CF_CONSONANT = 0x01000000, /* flag to speed up comparing */
|
||||||
|
Mymr_CF_MEDIAL = 0x02000000, /* flag to speed up comparing */
|
||||||
|
Mymr_CF_IND_VOWEL = 0x04000000, /* flag to speed up comparing */
|
||||||
|
Mymr_CF_DEP_VOWEL = 0x08000000, /* flag to speed up comparing */
|
||||||
|
Mymr_CF_DOTTED_CIRCLE = 0x10000000, /* add a dotted circle if a character with this flag is the first in a syllable */
|
||||||
|
Mymr_CF_VIRAMA = 0x20000000, /* flag to speed up comparing */
|
||||||
|
|
||||||
|
/* position flags */
|
||||||
|
Mymr_CF_POS_BEFORE = 0x00080000,
|
||||||
|
Mymr_CF_POS_BELOW = 0x00040000,
|
||||||
|
Mymr_CF_POS_ABOVE = 0x00020000,
|
||||||
|
Mymr_CF_POS_AFTER = 0x00010000,
|
||||||
|
Mymr_CF_POS_MASK = 0x000f0000,
|
||||||
|
|
||||||
|
Mymr_CF_AFTER_KINZI = 0x00100000
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Characters that get refrered to by name */
|
||||||
|
enum MymrChar
|
||||||
|
{
|
||||||
|
Mymr_C_SIGN_ZWNJ = 0x200C,
|
||||||
|
Mymr_C_SIGN_ZWJ = 0x200D,
|
||||||
|
Mymr_C_DOTTED_CIRCLE = 0x25CC,
|
||||||
|
Mymr_C_RA = 0x101B,
|
||||||
|
Mymr_C_YA = 0x101A,
|
||||||
|
Mymr_C_NGA = 0x1004,
|
||||||
|
Mymr_C_VOWEL_E = 0x1031,
|
||||||
|
Mymr_C_VIRAMA = 0x1039
|
||||||
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
Mymr_xx = Mymr_CC_RESERVED,
|
||||||
|
Mymr_c1 = Mymr_CC_CONSONANT | Mymr_CF_CONSONANT | Mymr_CF_POS_BELOW,
|
||||||
|
Mymr_c2 = Mymr_CC_CONSONANT2 | Mymr_CF_CONSONANT,
|
||||||
|
Mymr_ng = Mymr_CC_NGA | Mymr_CF_CONSONANT | Mymr_CF_POS_ABOVE,
|
||||||
|
Mymr_ya = Mymr_CC_YA | Mymr_CF_CONSONANT | Mymr_CF_MEDIAL | Mymr_CF_POS_AFTER | Mymr_CF_AFTER_KINZI,
|
||||||
|
Mymr_ra = Mymr_CC_RA | Mymr_CF_CONSONANT | Mymr_CF_MEDIAL | Mymr_CF_POS_BEFORE,
|
||||||
|
Mymr_wa = Mymr_CC_WA | Mymr_CF_CONSONANT | Mymr_CF_MEDIAL | Mymr_CF_POS_BELOW,
|
||||||
|
Mymr_ha = Mymr_CC_HA | Mymr_CF_CONSONANT | Mymr_CF_MEDIAL | Mymr_CF_POS_BELOW,
|
||||||
|
Mymr_id = Mymr_CC_IND_VOWEL | Mymr_CF_IND_VOWEL,
|
||||||
|
Mymr_vi = Mymr_CC_VIRAMA | Mymr_CF_VIRAMA | Mymr_CF_POS_ABOVE | Mymr_CF_DOTTED_CIRCLE,
|
||||||
|
Mymr_dl = Mymr_CC_PRE_VOWEL | Mymr_CF_DEP_VOWEL | Mymr_CF_POS_BEFORE | Mymr_CF_DOTTED_CIRCLE | Mymr_CF_AFTER_KINZI,
|
||||||
|
Mymr_db = Mymr_CC_BELOW_VOWEL | Mymr_CF_DEP_VOWEL | Mymr_CF_POS_BELOW | Mymr_CF_DOTTED_CIRCLE | Mymr_CF_AFTER_KINZI,
|
||||||
|
Mymr_da = Mymr_CC_ABOVE_VOWEL | Mymr_CF_DEP_VOWEL | Mymr_CF_POS_ABOVE | Mymr_CF_DOTTED_CIRCLE | Mymr_CF_AFTER_KINZI,
|
||||||
|
Mymr_dr = Mymr_CC_POST_VOWEL | Mymr_CF_DEP_VOWEL | Mymr_CF_POS_AFTER | Mymr_CF_DOTTED_CIRCLE | Mymr_CF_AFTER_KINZI,
|
||||||
|
Mymr_sa = Mymr_CC_SIGN_ABOVE | Mymr_CF_DOTTED_CIRCLE | Mymr_CF_POS_ABOVE | Mymr_CF_AFTER_KINZI,
|
||||||
|
Mymr_sb = Mymr_CC_SIGN_BELOW | Mymr_CF_DOTTED_CIRCLE | Mymr_CF_POS_BELOW | Mymr_CF_AFTER_KINZI,
|
||||||
|
Mymr_sp = Mymr_CC_SIGN_AFTER | Mymr_CF_DOTTED_CIRCLE | Mymr_CF_AFTER_KINZI
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
typedef int MymrCharClass;
|
||||||
|
|
||||||
|
|
||||||
|
static const MymrCharClass mymrCharClasses[] =
|
||||||
|
{
|
||||||
|
Mymr_c1, Mymr_c1, Mymr_c1, Mymr_c1, Mymr_ng, Mymr_c1, Mymr_c1, Mymr_c1,
|
||||||
|
Mymr_c1, Mymr_c1, Mymr_c2, Mymr_c1, Mymr_c1, Mymr_c1, Mymr_c1, Mymr_c1, /* 1000 - 100F */
|
||||||
|
Mymr_c1, Mymr_c1, Mymr_c1, Mymr_c1, Mymr_c1, Mymr_c1, Mymr_c1, Mymr_c1,
|
||||||
|
Mymr_c1, Mymr_c1, Mymr_ya, Mymr_ra, Mymr_c1, Mymr_wa, Mymr_c1, Mymr_ha, /* 1010 - 101F */
|
||||||
|
Mymr_c2, Mymr_c2, Mymr_xx, Mymr_id, Mymr_id, Mymr_id, Mymr_id, Mymr_id,
|
||||||
|
Mymr_xx, Mymr_id, Mymr_id, Mymr_xx, Mymr_dr, Mymr_da, Mymr_da, Mymr_db, /* 1020 - 102F */
|
||||||
|
Mymr_db, Mymr_dl, Mymr_da, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_sa, Mymr_sb,
|
||||||
|
Mymr_sp, Mymr_vi, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, /* 1030 - 103F */
|
||||||
|
Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx,
|
||||||
|
Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, /* 1040 - 104F */
|
||||||
|
Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx,
|
||||||
|
Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, Mymr_xx, /* 1050 - 105F */
|
||||||
|
};
|
||||||
|
|
||||||
|
static MymrCharClass
|
||||||
|
getMyanmarCharClass (HB_UChar16 ch)
|
||||||
|
{
|
||||||
|
if (ch == Mymr_C_SIGN_ZWJ)
|
||||||
|
return Mymr_CC_ZERO_WIDTH_J_MARK;
|
||||||
|
|
||||||
|
if (ch == Mymr_C_SIGN_ZWNJ)
|
||||||
|
return Mymr_CC_ZERO_WIDTH_NJ_MARK;
|
||||||
|
|
||||||
|
if (ch < 0x1000 || ch > 0x105f)
|
||||||
|
return Mymr_CC_RESERVED;
|
||||||
|
|
||||||
|
return mymrCharClasses[ch - 0x1000];
|
||||||
|
}
|
||||||
|
|
||||||
|
static const signed char mymrStateTable[][Mymr_CC_COUNT] =
|
||||||
|
{
|
||||||
|
/* xx c1, c2 ng ya ra wa ha id zwnj vi dl db da dr sa sb sp zwj */
|
||||||
|
{ 1, 4, 4, 2, 4, 4, 4, 4, 24, 1, 27, 17, 18, 19, 20, 21, 1, 1, 4}, /* 0 - ground state */
|
||||||
|
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 1 - exit state (or sp to the right of the syllable) */
|
||||||
|
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 17, 18, 19, 20, 21, -1, -1, 4}, /* 2 - NGA */
|
||||||
|
{-1, 4, 4, 4, 4, 4, 4, 4, -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 3 - Virama after NGA */
|
||||||
|
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, 17, 18, 19, 20, 21, 1, 1, -1}, /* 4 - Base consonant */
|
||||||
|
{-2, 6, -2, -2, 7, 8, 9, 10, -2, 23, -2, -2, -2, -2, -2, -2, -2, -2, -2}, /* 5 - First virama */
|
||||||
|
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 25, 17, 18, 19, 20, 21, -1, -1, -1}, /* 6 - c1 after virama */
|
||||||
|
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, 17, 18, 19, 20, 21, -1, -1, -1}, /* 7 - ya after virama */
|
||||||
|
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, 17, 18, 19, 20, 21, -1, -1, -1}, /* 8 - ra after virama */
|
||||||
|
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, 17, 18, 19, 20, 21, -1, -1, -1}, /* 9 - wa after virama */
|
||||||
|
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 17, 18, 19, 20, 21, -1, -1, -1}, /* 10 - ha after virama */
|
||||||
|
{-1, -1, -1, -1, 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 11 - Virama after NGA+zwj */
|
||||||
|
{-2, -2, -2, -2, -2, -2, 13, 14, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2}, /* 12 - Second virama */
|
||||||
|
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 15, 17, 18, 19, 20, 21, -1, -1, -1}, /* 13 - wa after virama */
|
||||||
|
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 17, 18, 19, 20, 21, -1, -1, -1}, /* 14 - ha after virama */
|
||||||
|
{-2, -2, -2, -2, -2, -2, -2, 16, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2}, /* 15 - Third virama */
|
||||||
|
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 17, 18, 19, 20, 21, -1, -1, -1}, /* 16 - ha after virama */
|
||||||
|
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 21, 1, 1, -1}, /* 17 - dl, Dependent vowel e */
|
||||||
|
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, -1, 21, 1, 1, -1}, /* 18 - db, Dependent vowel u,uu */
|
||||||
|
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1}, /* 19 - da, Dependent vowel i,ii,ai */
|
||||||
|
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, 1, 1, -1}, /* 20 - dr, Dependent vowel aa */
|
||||||
|
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1}, /* 21 - sa, Sign anusvara */
|
||||||
|
{-1, -1, -1, -1, -1, -1, -1, -1, -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 22 - atha */
|
||||||
|
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1}, /* 23 - zwnj for atha */
|
||||||
|
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1}, /* 24 - Independent vowel */
|
||||||
|
{-2, -2, -2, -2, 26, 26, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2}, /* 25 - Virama after subscript consonant */
|
||||||
|
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, 17, 18, 19, 20, 21, -1, 1, -1}, /* 26 - ra/ya after subscript consonant + virama */
|
||||||
|
{-1, 6, -1, -1, 7, 8, 9, 10, -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 - Virama after ground state */
|
||||||
|
/* exit state -2 is for invalid order of medials and combination of invalids
|
||||||
|
with virama where virama should treat as start of next syllable
|
||||||
|
*/
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*#define MYANMAR_DEBUG */
|
||||||
|
#ifdef MYANMAR_DEBUG
|
||||||
|
#define MMDEBUG qDebug
|
||||||
|
#else
|
||||||
|
#define MMDEBUG if(0) printf
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Given an input string of characters and a location in which to start looking
|
||||||
|
// calculate, using the state table, which one is the last character of the syllable
|
||||||
|
// that starts in the starting position.
|
||||||
|
*/
|
||||||
|
static int myanmar_nextSyllableBoundary(const HB_UChar16 *s, int start, int end, HB_Bool *invalid)
|
||||||
|
{
|
||||||
|
const HB_UChar16 *uc = s + start;
|
||||||
|
int state = 0;
|
||||||
|
int pos = start;
|
||||||
|
*invalid = FALSE;
|
||||||
|
|
||||||
|
while (pos < end) {
|
||||||
|
MymrCharClass charClass = getMyanmarCharClass(*uc);
|
||||||
|
state = mymrStateTable[state][charClass & Mymr_CF_CLASS_MASK];
|
||||||
|
if (pos == start)
|
||||||
|
*invalid = (HB_Bool)(charClass & Mymr_CF_DOTTED_CIRCLE);
|
||||||
|
|
||||||
|
MMDEBUG("state[%d]=%d class=%8x (uc=%4x)", pos - start, state, charClass, *uc);
|
||||||
|
|
||||||
|
if (state < 0) {
|
||||||
|
if (state < -1)
|
||||||
|
--pos;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
++uc;
|
||||||
|
++pos;
|
||||||
|
}
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NO_OPENTYPE
|
||||||
|
/* ###### might have to change order of above and below forms and substitutions,
|
||||||
|
but according to Unicode below comes before above */
|
||||||
|
static const HB_OpenTypeFeature myanmar_features[] = {
|
||||||
|
{ HB_MAKE_TAG('p', 'r', 'e', 'f'), PreFormProperty },
|
||||||
|
{ HB_MAKE_TAG('b', 'l', 'w', 'f'), BelowFormProperty },
|
||||||
|
{ HB_MAKE_TAG('a', 'b', 'v', 'f'), AboveFormProperty },
|
||||||
|
{ HB_MAKE_TAG('p', 's', 't', 'f'), PostFormProperty },
|
||||||
|
{ HB_MAKE_TAG('p', 'r', 'e', 's'), PreSubstProperty },
|
||||||
|
{ HB_MAKE_TAG('b', 'l', 'w', 's'), BelowSubstProperty },
|
||||||
|
{ HB_MAKE_TAG('a', 'b', 'v', 's'), AboveSubstProperty },
|
||||||
|
{ HB_MAKE_TAG('p', 's', 't', 's'), PostSubstProperty },
|
||||||
|
{ HB_MAKE_TAG('r', 'l', 'i', 'g'), CligProperty }, /* Myanmar1 uses this instead of the other features */
|
||||||
|
{ 0, 0 }
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Visual order before shaping should be:
|
||||||
|
//
|
||||||
|
// [Vowel Mark E]
|
||||||
|
// [Virama + Medial Ra]
|
||||||
|
// [Base]
|
||||||
|
// [Virama + Consonant]
|
||||||
|
// [Nga + Virama] (Kinzi) ### should probably come before post forms (medial ya)
|
||||||
|
// [Vowels]
|
||||||
|
// [Marks]
|
||||||
|
//
|
||||||
|
// This means that we can keep the logical order apart from having to
|
||||||
|
// move the pre vowel, medial ra and kinzi
|
||||||
|
*/
|
||||||
|
|
||||||
|
static HB_Bool myanmar_shape_syllable(HB_Bool openType, HB_ShaperItem *item, HB_Bool invalid)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
// MMDEBUG("\nsyllable from %d len %d, str='%s'", item->item.pos, item->item.length,
|
||||||
|
// item->string->mid(item->from, item->length).toUtf8().data());
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef NO_OPENTYPE
|
||||||
|
const int availableGlyphs = item->num_glyphs;
|
||||||
|
#endif
|
||||||
|
const HB_UChar16 *uc = item->string + item->item.pos;
|
||||||
|
int vowel_e = -1;
|
||||||
|
int kinzi = -1;
|
||||||
|
int medial_ra = -1;
|
||||||
|
int base = -1;
|
||||||
|
int i;
|
||||||
|
int len = 0;
|
||||||
|
unsigned short reordered[32];
|
||||||
|
unsigned char properties[32];
|
||||||
|
enum {
|
||||||
|
AboveForm = 0x01,
|
||||||
|
PreForm = 0x02,
|
||||||
|
PostForm = 0x04,
|
||||||
|
BelowForm = 0x08
|
||||||
|
};
|
||||||
|
HB_Bool lastWasVirama = FALSE;
|
||||||
|
int basePos = -1;
|
||||||
|
|
||||||
|
memset(properties, 0, 32*sizeof(unsigned char));
|
||||||
|
|
||||||
|
/* according to the table the max length of a syllable should be around 14 chars */
|
||||||
|
assert(item->item.length < 32);
|
||||||
|
|
||||||
|
#ifdef MYANMAR_DEBUG
|
||||||
|
printf("original:");
|
||||||
|
for (i = 0; i < (int)item->item.length; i++) {
|
||||||
|
printf(" %d: %4x", i, uc[i]);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
for (i = 0; i < (int)item->item.length; ++i) {
|
||||||
|
HB_UChar16 chr = uc[i];
|
||||||
|
|
||||||
|
if (chr == Mymr_C_VOWEL_E) {
|
||||||
|
vowel_e = i;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (i == 0
|
||||||
|
&& chr == Mymr_C_NGA
|
||||||
|
&& i + 2 < (int)item->item.length
|
||||||
|
&& uc[i+1] == Mymr_C_VIRAMA) {
|
||||||
|
int mc = getMyanmarCharClass(uc[i+2]);
|
||||||
|
/*MMDEBUG("maybe kinzi: mc=%x", mc);*/
|
||||||
|
if ((mc & Mymr_CF_CONSONANT) == Mymr_CF_CONSONANT) {
|
||||||
|
kinzi = i;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (base >= 0
|
||||||
|
&& chr == Mymr_C_VIRAMA
|
||||||
|
&& i + 1 < (int)item->item.length
|
||||||
|
&& uc[i+1] == Mymr_C_RA) {
|
||||||
|
medial_ra = i;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (base < 0)
|
||||||
|
base = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
MMDEBUG("\n base=%d, vowel_e=%d, kinzi=%d, medial_ra=%d", base, vowel_e, kinzi, medial_ra);
|
||||||
|
/* write vowel_e if found */
|
||||||
|
if (vowel_e >= 0) {
|
||||||
|
reordered[0] = Mymr_C_VOWEL_E;
|
||||||
|
len = 1;
|
||||||
|
}
|
||||||
|
/* write medial_ra */
|
||||||
|
if (medial_ra >= 0) {
|
||||||
|
reordered[len] = Mymr_C_VIRAMA;
|
||||||
|
reordered[len+1] = Mymr_C_RA;
|
||||||
|
properties[len] = PreForm;
|
||||||
|
properties[len+1] = PreForm;
|
||||||
|
len += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* shall we add a dotted circle?
|
||||||
|
If in the position in which the base should be (first char in the string) there is
|
||||||
|
a character that has the Dotted circle flag (a character that cannot be a base)
|
||||||
|
then write a dotted circle */
|
||||||
|
if (invalid) {
|
||||||
|
reordered[len] = C_DOTTED_CIRCLE;
|
||||||
|
++len;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* copy the rest of the syllable to the output, inserting the kinzi
|
||||||
|
at the correct place */
|
||||||
|
for (i = 0; i < (int)item->item.length; ++i) {
|
||||||
|
hb_uint16 chr = uc[i];
|
||||||
|
MymrCharClass cc;
|
||||||
|
if (i == vowel_e)
|
||||||
|
continue;
|
||||||
|
if (i == medial_ra || i == kinzi) {
|
||||||
|
++i;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
cc = getMyanmarCharClass(uc[i]);
|
||||||
|
if (kinzi >= 0 && i > base && (cc & Mymr_CF_AFTER_KINZI)) {
|
||||||
|
reordered[len] = Mymr_C_NGA;
|
||||||
|
reordered[len+1] = Mymr_C_VIRAMA;
|
||||||
|
if (len > 0)
|
||||||
|
properties[len-1] = AboveForm;
|
||||||
|
properties[len] = AboveForm;
|
||||||
|
len += 2;
|
||||||
|
kinzi = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lastWasVirama) {
|
||||||
|
int prop = 0;
|
||||||
|
switch(cc & Mymr_CF_POS_MASK) {
|
||||||
|
case Mymr_CF_POS_BEFORE:
|
||||||
|
prop = PreForm;
|
||||||
|
break;
|
||||||
|
case Mymr_CF_POS_BELOW:
|
||||||
|
prop = BelowForm;
|
||||||
|
break;
|
||||||
|
case Mymr_CF_POS_ABOVE:
|
||||||
|
prop = AboveForm;
|
||||||
|
break;
|
||||||
|
case Mymr_CF_POS_AFTER:
|
||||||
|
prop = PostForm;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
properties[len-1] = prop;
|
||||||
|
properties[len] = prop;
|
||||||
|
if(basePos >= 0 && basePos == len-2)
|
||||||
|
properties[len-2] = prop;
|
||||||
|
}
|
||||||
|
lastWasVirama = (chr == Mymr_C_VIRAMA);
|
||||||
|
if(i == base)
|
||||||
|
basePos = len;
|
||||||
|
|
||||||
|
if ((chr != Mymr_C_SIGN_ZWNJ && chr != Mymr_C_SIGN_ZWJ) || !len) {
|
||||||
|
reordered[len] = chr;
|
||||||
|
++len;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (kinzi >= 0) {
|
||||||
|
reordered[len] = Mymr_C_NGA;
|
||||||
|
reordered[len+1] = Mymr_C_VIRAMA;
|
||||||
|
properties[len] = AboveForm;
|
||||||
|
properties[len+1] = AboveForm;
|
||||||
|
len += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!item->font->klass->convertStringToGlyphIndices(item->font,
|
||||||
|
reordered, len,
|
||||||
|
item->glyphs, &item->num_glyphs,
|
||||||
|
item->item.bidiLevel % 2))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
MMDEBUG("after shaping: len=%d", len);
|
||||||
|
for (i = 0; i < len; i++) {
|
||||||
|
item->attributes[i].mark = FALSE;
|
||||||
|
item->attributes[i].clusterStart = FALSE;
|
||||||
|
item->attributes[i].justification = 0;
|
||||||
|
item->attributes[i].zeroWidth = FALSE;
|
||||||
|
MMDEBUG(" %d: %4x property=%x", i, reordered[i], properties[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* now we have the syllable in the right order, and can start running it through open type. */
|
||||||
|
|
||||||
|
#ifndef NO_OPENTYPE
|
||||||
|
if (openType) {
|
||||||
|
hb_uint32 where[32];
|
||||||
|
|
||||||
|
for (i = 0; i < len; ++i) {
|
||||||
|
where[i] = ~(PreSubstProperty
|
||||||
|
| BelowSubstProperty
|
||||||
|
| AboveSubstProperty
|
||||||
|
| PostSubstProperty
|
||||||
|
| CligProperty
|
||||||
|
| PositioningProperties);
|
||||||
|
if (properties[i] & PreForm)
|
||||||
|
where[i] &= ~PreFormProperty;
|
||||||
|
if (properties[i] & BelowForm)
|
||||||
|
where[i] &= ~BelowFormProperty;
|
||||||
|
if (properties[i] & AboveForm)
|
||||||
|
where[i] &= ~AboveFormProperty;
|
||||||
|
if (properties[i] & PostForm)
|
||||||
|
where[i] &= ~PostFormProperty;
|
||||||
|
}
|
||||||
|
|
||||||
|
HB_OpenTypeShape(item, where);
|
||||||
|
if (!HB_OpenTypePosition(item, availableGlyphs, /*doLogClusters*/FALSE))
|
||||||
|
return FALSE;
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
MMDEBUG("Not using openType");
|
||||||
|
HB_HeuristicPosition(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
item->attributes[0].clusterStart = TRUE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
HB_Bool HB_MyanmarShape(HB_ShaperItem *item)
|
||||||
|
{
|
||||||
|
HB_Bool openType = FALSE;
|
||||||
|
unsigned short *logClusters = item->log_clusters;
|
||||||
|
|
||||||
|
HB_ShaperItem syllable = *item;
|
||||||
|
int first_glyph = 0;
|
||||||
|
|
||||||
|
int sstart = item->item.pos;
|
||||||
|
int end = sstart + item->item.length;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
assert(item->item.script == HB_Script_Myanmar);
|
||||||
|
#ifndef NO_OPENTYPE
|
||||||
|
openType = HB_SelectScript(item, myanmar_features);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
MMDEBUG("myanmar_shape: from %d length %d", item->item.pos, item->item.length);
|
||||||
|
while (sstart < end) {
|
||||||
|
HB_Bool invalid;
|
||||||
|
int send = myanmar_nextSyllableBoundary(item->string, sstart, end, &invalid);
|
||||||
|
MMDEBUG("syllable from %d, length %d, invalid=%s", sstart, send-sstart,
|
||||||
|
invalid ? "TRUE" : "FALSE");
|
||||||
|
syllable.item.pos = sstart;
|
||||||
|
syllable.item.length = send-sstart;
|
||||||
|
syllable.glyphs = item->glyphs + first_glyph;
|
||||||
|
syllable.attributes = item->attributes + first_glyph;
|
||||||
|
syllable.advances = item->advances + first_glyph;
|
||||||
|
syllable.offsets = item->offsets + first_glyph;
|
||||||
|
syllable.num_glyphs = item->num_glyphs - first_glyph;
|
||||||
|
if (!myanmar_shape_syllable(openType, &syllable, invalid)) {
|
||||||
|
MMDEBUG("syllable shaping failed, syllable requests %d glyphs", syllable.num_glyphs);
|
||||||
|
item->num_glyphs += syllable.num_glyphs;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* fix logcluster array */
|
||||||
|
MMDEBUG("syllable:");
|
||||||
|
for (i = first_glyph; i < first_glyph + (int)syllable.num_glyphs; ++i)
|
||||||
|
MMDEBUG(" %d -> glyph %x", i, item->glyphs[i]);
|
||||||
|
MMDEBUG(" logclusters:");
|
||||||
|
for (i = sstart; i < send; ++i) {
|
||||||
|
MMDEBUG(" %d -> glyph %d", i, first_glyph);
|
||||||
|
logClusters[i-item->item.pos] = first_glyph;
|
||||||
|
}
|
||||||
|
sstart = send;
|
||||||
|
first_glyph += syllable.num_glyphs;
|
||||||
|
}
|
||||||
|
item->num_glyphs = first_glyph;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void HB_MyanmarAttributes(HB_Script script, const HB_UChar16 *text, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes)
|
||||||
|
{
|
||||||
|
int end = from + len;
|
||||||
|
const HB_UChar16 *uc = text + from;
|
||||||
|
hb_uint32 i = 0;
|
||||||
|
HB_UNUSED(script);
|
||||||
|
attributes += from;
|
||||||
|
while (i < len) {
|
||||||
|
HB_Bool invalid;
|
||||||
|
hb_uint32 boundary = myanmar_nextSyllableBoundary(text, from+i, end, &invalid) - from;
|
||||||
|
|
||||||
|
attributes[i].charStop = TRUE;
|
||||||
|
if (i)
|
||||||
|
attributes[i-1].lineBreakType = HB_Break;
|
||||||
|
|
||||||
|
if (boundary > len-1)
|
||||||
|
boundary = len;
|
||||||
|
i++;
|
||||||
|
while (i < boundary) {
|
||||||
|
attributes[i].charStop = FALSE;
|
||||||
|
++uc;
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
assert(i == boundary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,102 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
|
||||||
|
* Copyright (C) 2006 Behdad Esfahbod
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HARFBUZZ_OPEN_PRIVATE_H
|
||||||
|
#define HARFBUZZ_OPEN_PRIVATE_H
|
||||||
|
|
||||||
|
#include "harfbuzz-impl.h"
|
||||||
|
#include "harfbuzz-open.h"
|
||||||
|
#include "harfbuzz-gsub-private.h"
|
||||||
|
#include "harfbuzz-gpos-private.h"
|
||||||
|
|
||||||
|
HB_BEGIN_HEADER
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_SubTable_
|
||||||
|
{
|
||||||
|
union
|
||||||
|
{
|
||||||
|
HB_GSUB_SubTable gsub;
|
||||||
|
HB_GPOS_SubTable gpos;
|
||||||
|
} st;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_HB_OPEN_Load_ScriptList( HB_ScriptList* sl,
|
||||||
|
HB_Stream input );
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_HB_OPEN_Load_FeatureList( HB_FeatureList* fl,
|
||||||
|
HB_Stream input );
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_HB_OPEN_Load_LookupList( HB_LookupList* ll,
|
||||||
|
HB_Stream input,
|
||||||
|
HB_Type type );
|
||||||
|
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_HB_OPEN_Load_Coverage( HB_Coverage* c,
|
||||||
|
HB_Stream input );
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_HB_OPEN_Load_ClassDefinition( HB_ClassDefinition* cd,
|
||||||
|
HB_UShort limit,
|
||||||
|
HB_Stream input );
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_HB_OPEN_Load_EmptyOrClassDefinition( HB_ClassDefinition* cd,
|
||||||
|
HB_UShort limit,
|
||||||
|
HB_UInt class_offset,
|
||||||
|
HB_UInt base_offset,
|
||||||
|
HB_Stream input );
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_HB_OPEN_Load_Device( HB_Device** d,
|
||||||
|
HB_Stream input );
|
||||||
|
|
||||||
|
HB_INTERNAL void _HB_OPEN_Free_ScriptList( HB_ScriptList* sl );
|
||||||
|
HB_INTERNAL void _HB_OPEN_Free_FeatureList( HB_FeatureList* fl );
|
||||||
|
HB_INTERNAL void _HB_OPEN_Free_LookupList( HB_LookupList* ll,
|
||||||
|
HB_Type type );
|
||||||
|
|
||||||
|
HB_INTERNAL void _HB_OPEN_Free_Coverage( HB_Coverage* c );
|
||||||
|
HB_INTERNAL void _HB_OPEN_Free_ClassDefinition( HB_ClassDefinition* cd );
|
||||||
|
HB_INTERNAL void _HB_OPEN_Free_Device( HB_Device* d );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_HB_OPEN_Coverage_Index( HB_Coverage* c,
|
||||||
|
HB_UShort glyphID,
|
||||||
|
HB_UShort* index );
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_HB_OPEN_Get_Class( HB_ClassDefinition* cd,
|
||||||
|
HB_UShort glyphID,
|
||||||
|
HB_UShort* klass,
|
||||||
|
HB_UShort* index );
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_HB_OPEN_Get_Device( HB_Device* d,
|
||||||
|
HB_UShort size,
|
||||||
|
HB_Short* value );
|
||||||
|
|
||||||
|
HB_END_HEADER
|
||||||
|
|
||||||
|
#endif /* HARFBUZZ_OPEN_PRIVATE_H */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,288 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
|
||||||
|
* Copyright (C) 2006 Behdad Esfahbod
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HARFBUZZ_OPEN_H
|
||||||
|
#define HARFBUZZ_OPEN_H
|
||||||
|
|
||||||
|
#include "harfbuzz-global.h"
|
||||||
|
|
||||||
|
HB_BEGIN_HEADER
|
||||||
|
|
||||||
|
#ifdef HB_USE_PACKED_STRUCTS
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Use this if a feature applies to all glyphs */
|
||||||
|
#define HB_ALL_GLYPHS 0xFFFF
|
||||||
|
|
||||||
|
#define HB_DEFAULT_LANGUAGE 0xFFFF
|
||||||
|
|
||||||
|
#define HB_MAX_NESTING_LEVEL 100
|
||||||
|
|
||||||
|
|
||||||
|
/* Script list related structures */
|
||||||
|
|
||||||
|
struct HB_LangSys_
|
||||||
|
{
|
||||||
|
HB_UShort* FeatureIndex; /* array of Feature indices */
|
||||||
|
HB_UShort LookupOrderOffset; /* always 0 for TT Open 1.0 */
|
||||||
|
HB_UShort ReqFeatureIndex; /* required FeatureIndex */
|
||||||
|
HB_UShort FeatureCount; /* number of Feature indices */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_LangSys_ HB_LangSys;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_LangSysRecord_
|
||||||
|
{
|
||||||
|
HB_LangSys LangSys; /* LangSys table */
|
||||||
|
HB_UInt LangSysTag; /* LangSysTag identifier */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_LangSysRecord_ HB_LangSysRecord;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_ScriptTable_
|
||||||
|
{
|
||||||
|
HB_LangSysRecord* LangSysRecord; /* array of LangSysRecords */
|
||||||
|
HB_LangSys DefaultLangSys; /* DefaultLangSys table */
|
||||||
|
HB_UShort LangSysCount; /* number of LangSysRecords */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ScriptTable_ HB_ScriptTable;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_ScriptRecord_
|
||||||
|
{
|
||||||
|
HB_UInt ScriptTag; /* ScriptTag identifier */
|
||||||
|
HB_ScriptTable Script; /* Script table */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ScriptRecord_ HB_ScriptRecord;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_ScriptList_
|
||||||
|
{
|
||||||
|
HB_ScriptRecord* ScriptRecord; /* array of ScriptRecords */
|
||||||
|
HB_UShort ScriptCount; /* number of ScriptRecords */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ScriptList_ HB_ScriptList;
|
||||||
|
|
||||||
|
|
||||||
|
/* Feature list related structures */
|
||||||
|
|
||||||
|
struct HB_Feature_
|
||||||
|
{
|
||||||
|
HB_UShort* LookupListIndex; /* array of LookupList indices */
|
||||||
|
HB_UShort FeatureParams; /* always 0 for TT Open 1.0 */
|
||||||
|
HB_UShort LookupListCount; /* number of LookupList indices */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_Feature_ HB_Feature;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_FeatureRecord_
|
||||||
|
{
|
||||||
|
HB_UInt FeatureTag; /* FeatureTag identifier */
|
||||||
|
HB_Feature Feature; /* Feature table */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_FeatureRecord_ HB_FeatureRecord;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_FeatureList_
|
||||||
|
{
|
||||||
|
HB_UShort* ApplyOrder; /* order to apply features */
|
||||||
|
HB_FeatureRecord* FeatureRecord; /* array of FeatureRecords */
|
||||||
|
HB_UShort FeatureCount; /* number of FeatureRecords */
|
||||||
|
HB_UShort ApplyCount; /* number of elements in ApplyOrder */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_FeatureList_ HB_FeatureList;
|
||||||
|
|
||||||
|
|
||||||
|
/* Lookup list related structures */
|
||||||
|
|
||||||
|
typedef struct HB_SubTable_ HB_SubTable;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_Lookup_
|
||||||
|
{
|
||||||
|
HB_SubTable* SubTable; /* array of SubTables */
|
||||||
|
HB_UShort LookupType; /* Lookup type */
|
||||||
|
HB_UShort LookupFlag; /* Lookup qualifiers */
|
||||||
|
HB_UShort SubTableCount; /* number of SubTables */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_Lookup_ HB_Lookup;
|
||||||
|
|
||||||
|
|
||||||
|
/* The `Properties' field is not defined in the OpenType specification but
|
||||||
|
is needed for processing lookups. If properties[n] is > 0, the
|
||||||
|
functions HB_GSUB_Apply_String() resp. HB_GPOS_Apply_String() will
|
||||||
|
process Lookup[n] for glyphs which have the specific bit not set in
|
||||||
|
the `properties' field of the input string object. */
|
||||||
|
|
||||||
|
struct HB_LookupList_
|
||||||
|
{
|
||||||
|
HB_Lookup* Lookup; /* array of Lookup records */
|
||||||
|
HB_UInt* Properties; /* array of flags */
|
||||||
|
HB_UShort LookupCount; /* number of Lookups */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_LookupList_ HB_LookupList;
|
||||||
|
|
||||||
|
|
||||||
|
/* Possible LookupFlag bit masks. `HB_LOOKUP_FLAG_IGNORE_SPECIAL_MARKS' comes from the
|
||||||
|
OpenType 1.2 specification; HB_LOOKUP_FLAG_RIGHT_TO_LEFT has been (re)introduced in
|
||||||
|
OpenType 1.3 -- if set, the last glyph in a cursive attachment
|
||||||
|
sequence has to be positioned on the baseline -- regardless of the
|
||||||
|
writing direction. */
|
||||||
|
|
||||||
|
#define HB_LOOKUP_FLAG_RIGHT_TO_LEFT 0x0001
|
||||||
|
#define HB_LOOKUP_FLAG_IGNORE_BASE_GLYPHS 0x0002
|
||||||
|
#define HB_LOOKUP_FLAG_IGNORE_LIGATURES 0x0004
|
||||||
|
#define HB_LOOKUP_FLAG_IGNORE_MARKS 0x0008
|
||||||
|
#define HB_LOOKUP_FLAG_IGNORE_SPECIAL_MARKS 0xFF00
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_CoverageFormat1_
|
||||||
|
{
|
||||||
|
HB_UShort* GlyphArray; /* array of glyph IDs */
|
||||||
|
HB_UShort GlyphCount; /* number of glyphs in GlyphArray */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_CoverageFormat1_ HB_CoverageFormat1;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_RangeRecord_
|
||||||
|
{
|
||||||
|
HB_UShort Start; /* first glyph ID in the range */
|
||||||
|
HB_UShort End; /* last glyph ID in the range */
|
||||||
|
HB_UShort StartCoverageIndex; /* coverage index of first
|
||||||
|
glyph ID in the range */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_RangeRecord_ HB_RangeRecord;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_CoverageFormat2_
|
||||||
|
{
|
||||||
|
HB_RangeRecord* RangeRecord; /* array of RangeRecords */
|
||||||
|
HB_UShort RangeCount; /* number of RangeRecords */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_CoverageFormat2_ HB_CoverageFormat2;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_Coverage_
|
||||||
|
{
|
||||||
|
HB_Byte CoverageFormat; /* 1 or 2 */
|
||||||
|
|
||||||
|
union
|
||||||
|
{
|
||||||
|
HB_CoverageFormat1 cf1;
|
||||||
|
HB_CoverageFormat2 cf2;
|
||||||
|
} cf;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_Coverage_ HB_Coverage;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_ClassDefFormat1_
|
||||||
|
{
|
||||||
|
HB_UShort* ClassValueArray; /* array of class values */
|
||||||
|
HB_UShort StartGlyph; /* first glyph ID of the
|
||||||
|
ClassValueArray */
|
||||||
|
HB_UShort GlyphCount; /* size of the ClassValueArray */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ClassDefFormat1_ HB_ClassDefFormat1;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_ClassRangeRecord_
|
||||||
|
{
|
||||||
|
HB_UShort Start; /* first glyph ID in the range */
|
||||||
|
HB_UShort End; /* last glyph ID in the range */
|
||||||
|
HB_UShort Class; /* applied to all glyphs in range */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ClassRangeRecord_ HB_ClassRangeRecord;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_ClassDefFormat2_
|
||||||
|
{
|
||||||
|
HB_ClassRangeRecord* ClassRangeRecord;
|
||||||
|
/* array of ClassRangeRecords */
|
||||||
|
HB_UShort ClassRangeCount;
|
||||||
|
/* number of ClassRangeRecords */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ClassDefFormat2_ HB_ClassDefFormat2;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_ClassDefinition_
|
||||||
|
{
|
||||||
|
union
|
||||||
|
{
|
||||||
|
HB_ClassDefFormat1 cd1;
|
||||||
|
HB_ClassDefFormat2 cd2;
|
||||||
|
} cd;
|
||||||
|
|
||||||
|
HB_Byte ClassFormat; /* 1 or 2 */
|
||||||
|
HB_Bool loaded;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_ClassDefinition_ HB_ClassDefinition;
|
||||||
|
|
||||||
|
|
||||||
|
struct HB_Device_
|
||||||
|
{
|
||||||
|
HB_UShort* DeltaValue; /* array of compressed data */
|
||||||
|
HB_UShort StartSize; /* smallest size to correct */
|
||||||
|
HB_UShort EndSize; /* largest size to correct */
|
||||||
|
HB_Byte DeltaFormat; /* DeltaValue array data format:
|
||||||
|
1, 2, or 3 */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct HB_Device_ HB_Device;
|
||||||
|
|
||||||
|
|
||||||
|
enum HB_Type_
|
||||||
|
{
|
||||||
|
HB_Type_GSUB,
|
||||||
|
HB_Type_GPOS
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef enum HB_Type_ HB_Type;
|
||||||
|
|
||||||
|
#ifdef HB_USE_PACKED_STRUCTS
|
||||||
|
#pragma pack(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
HB_END_HEADER
|
||||||
|
|
||||||
|
#endif /* HARFBUZZ_OPEN_H */
|
|
@ -0,0 +1,199 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2006 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*
|
||||||
|
* Red Hat Author(s): Owen Taylor
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/* Base Types */
|
||||||
|
|
||||||
|
typedef hb_uint16 HB_CodePoint; /* UTF-16 codepoint (not character ) */
|
||||||
|
typedef char HB_Boolean;
|
||||||
|
typedef hb_uint32 HB_Fixed; /* 26.6 */
|
||||||
|
typedef hb_uint32 HB_Glyph;
|
||||||
|
typedef hb_uint32 HB_Unichar;
|
||||||
|
|
||||||
|
/* Metrics reported by the font backend for use of the shaper */
|
||||||
|
typedef struct _HB_GlyphMetrics HB_GlyphMetrics;
|
||||||
|
struct _HB_GlyphMetrics
|
||||||
|
{
|
||||||
|
HB_Fixed advance;
|
||||||
|
|
||||||
|
/* Do we need ink/logical extents for the glyph here? */
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* HB_Font: Abstract font interface.
|
||||||
|
* First pass of this might just have FT_Face *getFace();
|
||||||
|
*/
|
||||||
|
typedef struct _HB_Font HB_Font;
|
||||||
|
typedef struct _HB_FontClass HB_FontClass;
|
||||||
|
|
||||||
|
struct HB_FontClass {
|
||||||
|
HB_Glyph (*charToGlyph)(HB_Font *font, HB_Unichar chr);
|
||||||
|
void (*getMetrics)(HB_Font *font, HB_Glyph glyph, HB_GlyphMetrics *metrics);
|
||||||
|
HB_Boolean (*getSFontTable)(HB_Font *font, void **cookie, char **start, int *len);
|
||||||
|
HB_Boolean (*freeSFontTable)(void **cookie);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _HB_Font {
|
||||||
|
HB_FontClass *clazz;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Language tags, of the form en-us; represented as interned, canonicalized
|
||||||
|
* strings. hb_language_from_string("en_US"), hb_language_from_string("en-us")
|
||||||
|
* both return the same (pointer-comparable) HB_Language).
|
||||||
|
*/
|
||||||
|
typedef struct HB_Language_ *HB_Language;
|
||||||
|
|
||||||
|
HB_Language hb_language_from_string(const char *str);
|
||||||
|
const char *hb_language_to_string(HB_Language language);
|
||||||
|
|
||||||
|
/* Special treatment for the edges of runs.
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
HB_RUN_EDGE_LINE_VISUAL_EDGE = 1 << 0,
|
||||||
|
HB_RUN_EDGE_LINE_LOGICAL_EDGE = 1 << 1,
|
||||||
|
HB_RUN_EDGE_LINE_ADD_HYPHEN = 1 << 2 /* ???? */
|
||||||
|
} HB_RunEdge;
|
||||||
|
|
||||||
|
/* Defines optional informaiton in HB_ShapeInput; this allows extension
|
||||||
|
* of HB_ShapeInput while keeping binary compatibility
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
HB_SHAPE_START_TYPE = 1 << 0,
|
||||||
|
HB_SHAPE_END_TYPE = 1 << 1
|
||||||
|
} HB_ShapeFlags;
|
||||||
|
|
||||||
|
/* Attributes types are described by "interned strings"; this is a little
|
||||||
|
* annoying if you want to write a switch statement, but keeps things
|
||||||
|
* simple.
|
||||||
|
*/
|
||||||
|
typedef struct _HB_AttributeType *HB_AttributeType;
|
||||||
|
|
||||||
|
HB_AttributeType hb_attribute_type_from_string(const char *str);
|
||||||
|
const char *hb_attribute_type_to_string(HB_AttributeType attribute_type);
|
||||||
|
|
||||||
|
struct HB_Attribute {
|
||||||
|
HB_AttributeType type;
|
||||||
|
int start;
|
||||||
|
int end;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* You could handle this like HB_Language, but an enum seems a little nicer;
|
||||||
|
* another approach would be to use OpenType script tags.
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
HB_SCRIPT_LATIN
|
||||||
|
/* ... */
|
||||||
|
} HB_ShapeScript;
|
||||||
|
|
||||||
|
/* This is just the subset of direction information needed by the shaper */
|
||||||
|
typedef enum {
|
||||||
|
HB_DIRECTION_LTR,
|
||||||
|
HB_DIRECTION_RTL,
|
||||||
|
HB_DIRECTION_TTB
|
||||||
|
} HB_Direction;
|
||||||
|
|
||||||
|
typedef struct _HB_ShapeInput HB_ShapeInput;
|
||||||
|
struct _HB_ShapeInput {
|
||||||
|
/* Defines what fields the caller has initialized - fields not in
|
||||||
|
* the enum are mandatory.
|
||||||
|
*/
|
||||||
|
HB_ShapeFlags flags;
|
||||||
|
|
||||||
|
HB_CodePoint *text;
|
||||||
|
int length; /* total length of text to shape */
|
||||||
|
int shape_offset; /* start of section to shape */
|
||||||
|
int shape_length; /* number of code points to shape */
|
||||||
|
|
||||||
|
HB_Direction direction;
|
||||||
|
HB_ShapeScript script;
|
||||||
|
HB_Language language;
|
||||||
|
|
||||||
|
HB_AttributeType *attributes;
|
||||||
|
int n_attributes;
|
||||||
|
|
||||||
|
HB_RunEdge start_type;
|
||||||
|
HB_RunEdge end_type;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct HB_GlyphItem {
|
||||||
|
HB_Glyph glyph;
|
||||||
|
|
||||||
|
HB_Fixed x_offset;
|
||||||
|
HB_Fixed y_offset;
|
||||||
|
HB_Fixed advance;
|
||||||
|
|
||||||
|
/* Add kashida information, etc, here */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
HB_RESULT_SUCCESS,
|
||||||
|
HB_RESULT_NO_MEMORY,
|
||||||
|
HB_SHAPE_RESULT_FAILED
|
||||||
|
} HB_Result;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Buffer for output
|
||||||
|
*/
|
||||||
|
typedef struct _HB_GlyphBuffer HB_GlyphBuffer;
|
||||||
|
struct _HB_GlyphBuffer {
|
||||||
|
int glyph_item_size;
|
||||||
|
int total_glyphs;
|
||||||
|
|
||||||
|
int *log_clusters; /* Uniscribe style */
|
||||||
|
int cluster_space;
|
||||||
|
|
||||||
|
int glyph_space;
|
||||||
|
void *glyph_buffer;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Making this self-allocating simplifies writing shapers and
|
||||||
|
* also keeps things easier for caller. item_size passed in
|
||||||
|
* must be at least sizeof(HB_GlyphItem) but can be bigger,
|
||||||
|
* to accomodate application structures that extend HB_GlyphItem.
|
||||||
|
* The allocated items will be zero-initialized.
|
||||||
|
*
|
||||||
|
* (Hack: Harfbuzz could choose to use even a *bigger* item size
|
||||||
|
* and stick internal information before the public item structure.
|
||||||
|
* This hack could possibly be used to unify this with HB_Buffer)
|
||||||
|
*/
|
||||||
|
HB_GlyphBuffer *hb_glyph_buffer_new (size_t item_size);
|
||||||
|
void hb_glyph_buffer_clear (HB_GlyphBuffer *buf);
|
||||||
|
HB_Result hb_glyph_buffer_extend_glyphs (HB_GlyphBuffer *buf, int n_items);
|
||||||
|
HB_Result hb_glyph_buffer_extend_clusters (HB_GlyphBuffer *buf, int n_clusters);
|
||||||
|
void hb_glyph_buffer_free (HB_GlyphBuffer *buf);
|
||||||
|
|
||||||
|
|
||||||
|
/* Accessor for a particular glyph */
|
||||||
|
#define HB_GLYPH_BUFFER_ITEM(buffer, index)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Main shaping function
|
||||||
|
*/
|
||||||
|
HB_Result hb_shape(HB_ShapeInput *input, HB_GlyphBuffer *output);
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "harfbuzz-shaper.cpp"
|
||||||
|
#include "harfbuzz-indic.cpp"
|
||||||
|
extern "C" {
|
||||||
|
#include "harfbuzz-greek.c"
|
||||||
|
#include "harfbuzz-tibetan.c"
|
||||||
|
#include "harfbuzz-khmer.c"
|
||||||
|
#include "harfbuzz-hebrew.c"
|
||||||
|
#include "harfbuzz-arabic.c"
|
||||||
|
#include "harfbuzz-hangul.c"
|
||||||
|
#include "harfbuzz-myanmar.c"
|
||||||
|
#include "harfbuzz-thai.c"
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,171 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HARFBUZZ_SHAPER_PRIVATE_H
|
||||||
|
#define HARFBUZZ_SHAPER_PRIVATE_H
|
||||||
|
|
||||||
|
HB_BEGIN_HEADER
|
||||||
|
|
||||||
|
enum {
|
||||||
|
C_DOTTED_CIRCLE = 0x25CC
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
HB_Combining_BelowLeftAttached = 200,
|
||||||
|
HB_Combining_BelowAttached = 202,
|
||||||
|
HB_Combining_BelowRightAttached = 204,
|
||||||
|
HB_Combining_LeftAttached = 208,
|
||||||
|
HB_Combining_RightAttached = 210,
|
||||||
|
HB_Combining_AboveLeftAttached = 212,
|
||||||
|
HB_Combining_AboveAttached = 214,
|
||||||
|
HB_Combining_AboveRightAttached = 216,
|
||||||
|
|
||||||
|
HB_Combining_BelowLeft = 218,
|
||||||
|
HB_Combining_Below = 220,
|
||||||
|
HB_Combining_BelowRight = 222,
|
||||||
|
HB_Combining_Left = 224,
|
||||||
|
HB_Combining_Right = 226,
|
||||||
|
HB_Combining_AboveLeft = 228,
|
||||||
|
HB_Combining_Above = 230,
|
||||||
|
HB_Combining_AboveRight = 232,
|
||||||
|
|
||||||
|
HB_Combining_DoubleBelow = 233,
|
||||||
|
HB_Combining_DoubleAbove = 234,
|
||||||
|
HB_Combining_IotaSubscript = 240
|
||||||
|
} HB_CombiningClass;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
LocaProperty = 0x1,
|
||||||
|
CcmpProperty = 0x2,
|
||||||
|
InitProperty = 0x4,
|
||||||
|
IsolProperty = 0x8,
|
||||||
|
FinaProperty = 0x10,
|
||||||
|
MediProperty = 0x20,
|
||||||
|
RligProperty = 0x40,
|
||||||
|
CaltProperty = 0x80,
|
||||||
|
LigaProperty = 0x100,
|
||||||
|
DligProperty = 0x200,
|
||||||
|
CswhProperty = 0x400,
|
||||||
|
MsetProperty = 0x800,
|
||||||
|
|
||||||
|
/* used by indic and myanmar shaper */
|
||||||
|
NuktaProperty = 0x8,
|
||||||
|
AkhantProperty = 0x10,
|
||||||
|
RephProperty = 0x20,
|
||||||
|
PreFormProperty = 0x40,
|
||||||
|
BelowFormProperty = 0x80,
|
||||||
|
AboveFormProperty = 0x100,
|
||||||
|
HalfFormProperty = 0x200,
|
||||||
|
PostFormProperty = 0x400,
|
||||||
|
ConjunctFormProperty = 0x800,
|
||||||
|
VattuProperty = 0x1000,
|
||||||
|
PreSubstProperty = 0x2000,
|
||||||
|
BelowSubstProperty = 0x4000,
|
||||||
|
AboveSubstProperty = 0x8000,
|
||||||
|
PostSubstProperty = 0x10000,
|
||||||
|
HalantProperty = 0x20000,
|
||||||
|
CligProperty = 0x40000,
|
||||||
|
IndicCaltProperty = 0x80000
|
||||||
|
|
||||||
|
} HB_OpenTypeProperty;
|
||||||
|
|
||||||
|
/* return true if ok. */
|
||||||
|
typedef HB_Bool (*HB_ShapeFunction)(HB_ShaperItem *shaper_item);
|
||||||
|
typedef void (*HB_AttributeFunction)(HB_Script script, const HB_UChar16 *string, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes);
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
HB_ShapeFunction shape;
|
||||||
|
HB_AttributeFunction charAttributes;
|
||||||
|
} HB_ScriptEngine;
|
||||||
|
|
||||||
|
extern const HB_ScriptEngine hb_scriptEngines[];
|
||||||
|
|
||||||
|
extern HB_Bool HB_BasicShape(HB_ShaperItem *shaper_item);
|
||||||
|
extern HB_Bool HB_GreekShape(HB_ShaperItem *shaper_item);
|
||||||
|
extern HB_Bool HB_TibetanShape(HB_ShaperItem *shaper_item);
|
||||||
|
extern HB_Bool HB_HebrewShape(HB_ShaperItem *shaper_item);
|
||||||
|
extern HB_Bool HB_ArabicShape(HB_ShaperItem *shaper_item);
|
||||||
|
extern HB_Bool HB_HangulShape(HB_ShaperItem *shaper_item);
|
||||||
|
extern HB_Bool HB_MyanmarShape(HB_ShaperItem *shaper_item);
|
||||||
|
extern HB_Bool HB_KhmerShape(HB_ShaperItem *shaper_item);
|
||||||
|
extern HB_Bool HB_IndicShape(HB_ShaperItem *shaper_item);
|
||||||
|
|
||||||
|
extern void HB_TibetanAttributes(HB_Script script, const HB_UChar16 *string, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes);
|
||||||
|
|
||||||
|
extern void HB_MyanmarAttributes(HB_Script script, const HB_UChar16 *string, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes);
|
||||||
|
|
||||||
|
extern void HB_KhmerAttributes(HB_Script script, const HB_UChar16 *string, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes);
|
||||||
|
|
||||||
|
extern void HB_IndicAttributes(HB_Script script, const HB_UChar16 *string, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes);
|
||||||
|
|
||||||
|
extern void HB_ThaiAttributes(HB_Script script, const HB_UChar16 *string, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes);
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
hb_uint32 tag;
|
||||||
|
hb_uint32 property;
|
||||||
|
} HB_OpenTypeFeature;
|
||||||
|
|
||||||
|
#define PositioningProperties 0x80000000
|
||||||
|
|
||||||
|
HB_Bool HB_SelectScript(HB_ShaperItem *item, const HB_OpenTypeFeature *features);
|
||||||
|
|
||||||
|
HB_Bool HB_OpenTypeShape(HB_ShaperItem *item, const hb_uint32 *properties);
|
||||||
|
HB_Bool HB_OpenTypePosition(HB_ShaperItem *item, int availableGlyphs, HB_Bool doLogClusters);
|
||||||
|
|
||||||
|
void HB_HeuristicPosition(HB_ShaperItem *item);
|
||||||
|
void HB_HeuristicSetGlyphAttributes(HB_ShaperItem *item);
|
||||||
|
|
||||||
|
#define HB_IsControlChar(uc) \
|
||||||
|
((uc >= 0x200b && uc <= 0x200f /* ZW Space, ZWNJ, ZWJ, LRM and RLM */) \
|
||||||
|
|| (uc >= 0x2028 && uc <= 0x202f /* LS, PS, LRE, RLE, PDF, LRO, RLO, NNBSP */) \
|
||||||
|
|| (uc >= 0x206a && uc <= 0x206f /* ISS, ASS, IAFS, AFS, NADS, NODS */))
|
||||||
|
|
||||||
|
HB_Bool HB_ConvertStringToGlyphIndices(HB_ShaperItem *shaper_item);
|
||||||
|
|
||||||
|
#define HB_GetGlyphAdvances(shaper_item) \
|
||||||
|
shaper_item->font->klass->getGlyphAdvances(shaper_item->font, \
|
||||||
|
shaper_item->glyphs, shaper_item->num_glyphs, \
|
||||||
|
shaper_item->advances, \
|
||||||
|
shaper_item->face->current_flags);
|
||||||
|
|
||||||
|
#define HB_DECLARE_STACKARRAY(Type, Name) \
|
||||||
|
Type stack##Name[512]; \
|
||||||
|
Type *Name = stack##Name;
|
||||||
|
|
||||||
|
#define HB_INIT_STACKARRAY(Type, Name, Length) \
|
||||||
|
if ((Length) >= 512) \
|
||||||
|
Name = (Type *)malloc((Length) * sizeof(Type));
|
||||||
|
|
||||||
|
#define HB_STACKARRAY(Type, Name, Length) \
|
||||||
|
HB_DECLARE_STACKARRAY(Type, Name) \
|
||||||
|
HB_INIT_STACKARRAY(Type, Name, Length)
|
||||||
|
|
||||||
|
#define HB_FREE_STACKARRAY(Name) \
|
||||||
|
if (stack##Name != Name) \
|
||||||
|
free(Name);
|
||||||
|
|
||||||
|
HB_END_HEADER
|
||||||
|
|
||||||
|
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,294 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HARFBUZZ_SHAPER_H
|
||||||
|
#define HARFBUZZ_SHAPER_H
|
||||||
|
|
||||||
|
#include "harfbuzz-global.h"
|
||||||
|
#include "harfbuzz-gdef.h"
|
||||||
|
#include "harfbuzz-gpos.h"
|
||||||
|
#include "harfbuzz-gsub.h"
|
||||||
|
#include "harfbuzz-external.h"
|
||||||
|
#include "harfbuzz-stream-private.h"
|
||||||
|
|
||||||
|
HB_BEGIN_HEADER
|
||||||
|
|
||||||
|
#ifdef HB_USE_PACKED_STRUCTS
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
using anything else than signed or unsigned for bitfields in C is non standard,
|
||||||
|
but accepted by almost all compilers. And it gives a significant reduction in
|
||||||
|
memory consumption as HB_CharAttributes and HB_GlyphAttributes will not have
|
||||||
|
a 4 byte alignment
|
||||||
|
*/
|
||||||
|
#ifdef __xlC__
|
||||||
|
typedef unsigned hb_bitfield;
|
||||||
|
#else
|
||||||
|
typedef hb_uint8 hb_bitfield;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
HB_Script_Common,
|
||||||
|
HB_Script_Greek,
|
||||||
|
HB_Script_Cyrillic,
|
||||||
|
HB_Script_Armenian,
|
||||||
|
HB_Script_Hebrew,
|
||||||
|
HB_Script_Arabic,
|
||||||
|
HB_Script_Syriac,
|
||||||
|
HB_Script_Thaana,
|
||||||
|
HB_Script_Devanagari,
|
||||||
|
HB_Script_Bengali,
|
||||||
|
HB_Script_Gurmukhi,
|
||||||
|
HB_Script_Gujarati,
|
||||||
|
HB_Script_Oriya,
|
||||||
|
HB_Script_Tamil,
|
||||||
|
HB_Script_Telugu,
|
||||||
|
HB_Script_Kannada,
|
||||||
|
HB_Script_Malayalam,
|
||||||
|
HB_Script_Sinhala,
|
||||||
|
HB_Script_Thai,
|
||||||
|
HB_Script_Lao,
|
||||||
|
HB_Script_Tibetan,
|
||||||
|
HB_Script_Myanmar,
|
||||||
|
HB_Script_Georgian,
|
||||||
|
HB_Script_Hangul,
|
||||||
|
HB_Script_Ogham,
|
||||||
|
HB_Script_Runic,
|
||||||
|
HB_Script_Khmer,
|
||||||
|
HB_Script_Nko,
|
||||||
|
HB_Script_Inherited,
|
||||||
|
HB_ScriptCount = HB_Script_Inherited
|
||||||
|
/*
|
||||||
|
HB_Script_Latin = Common,
|
||||||
|
HB_Script_Ethiopic = Common,
|
||||||
|
HB_Script_Cherokee = Common,
|
||||||
|
HB_Script_CanadianAboriginal = Common,
|
||||||
|
HB_Script_Mongolian = Common,
|
||||||
|
HB_Script_Hiragana = Common,
|
||||||
|
HB_Script_Katakana = Common,
|
||||||
|
HB_Script_Bopomofo = Common,
|
||||||
|
HB_Script_Han = Common,
|
||||||
|
HB_Script_Yi = Common,
|
||||||
|
HB_Script_OldItalic = Common,
|
||||||
|
HB_Script_Gothic = Common,
|
||||||
|
HB_Script_Deseret = Common,
|
||||||
|
HB_Script_Tagalog = Common,
|
||||||
|
HB_Script_Hanunoo = Common,
|
||||||
|
HB_Script_Buhid = Common,
|
||||||
|
HB_Script_Tagbanwa = Common,
|
||||||
|
HB_Script_Limbu = Common,
|
||||||
|
HB_Script_TaiLe = Common,
|
||||||
|
HB_Script_LinearB = Common,
|
||||||
|
HB_Script_Ugaritic = Common,
|
||||||
|
HB_Script_Shavian = Common,
|
||||||
|
HB_Script_Osmanya = Common,
|
||||||
|
HB_Script_Cypriot = Common,
|
||||||
|
HB_Script_Braille = Common,
|
||||||
|
HB_Script_Buginese = Common,
|
||||||
|
HB_Script_Coptic = Common,
|
||||||
|
HB_Script_NewTaiLue = Common,
|
||||||
|
HB_Script_Glagolitic = Common,
|
||||||
|
HB_Script_Tifinagh = Common,
|
||||||
|
HB_Script_SylotiNagri = Common,
|
||||||
|
HB_Script_OldPersian = Common,
|
||||||
|
HB_Script_Kharoshthi = Common,
|
||||||
|
HB_Script_Balinese = Common,
|
||||||
|
HB_Script_Cuneiform = Common,
|
||||||
|
HB_Script_Phoenician = Common,
|
||||||
|
HB_Script_PhagsPa = Common,
|
||||||
|
*/
|
||||||
|
} HB_Script;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
hb_uint32 pos;
|
||||||
|
hb_uint32 length;
|
||||||
|
HB_Script script;
|
||||||
|
hb_uint8 bidiLevel;
|
||||||
|
} HB_ScriptItem;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
HB_NoBreak,
|
||||||
|
HB_SoftHyphen,
|
||||||
|
HB_Break,
|
||||||
|
HB_ForcedBreak
|
||||||
|
} HB_LineBreakType;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
/*HB_LineBreakType*/ hb_bitfield lineBreakType :2;
|
||||||
|
/*HB_Bool*/ hb_bitfield whiteSpace :1; /* A unicode whitespace character, except NBSP, ZWNBSP */
|
||||||
|
/*HB_Bool*/ hb_bitfield charStop :1; /* Valid cursor position (for left/right arrow) */
|
||||||
|
/*HB_Bool*/ hb_bitfield wordBoundary :1;
|
||||||
|
/*HB_Bool*/ hb_bitfield sentenceBoundary :1;
|
||||||
|
hb_bitfield unused :2;
|
||||||
|
} HB_CharAttributes;
|
||||||
|
|
||||||
|
void HB_GetCharAttributes(const HB_UChar16 *string, hb_uint32 stringLength,
|
||||||
|
const HB_ScriptItem *items, hb_uint32 numItems,
|
||||||
|
HB_CharAttributes *attributes);
|
||||||
|
|
||||||
|
/* requires HB_GetCharAttributes to be called before */
|
||||||
|
void HB_GetWordBoundaries(const HB_UChar16 *string, hb_uint32 stringLength,
|
||||||
|
const HB_ScriptItem *items, hb_uint32 numItems,
|
||||||
|
HB_CharAttributes *attributes);
|
||||||
|
|
||||||
|
/* requires HB_GetCharAttributes to be called before */
|
||||||
|
void HB_GetSentenceBoundaries(const HB_UChar16 *string, hb_uint32 stringLength,
|
||||||
|
const HB_ScriptItem *items, hb_uint32 numItems,
|
||||||
|
HB_CharAttributes *attributes);
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
HB_LeftToRight = 0,
|
||||||
|
HB_RightToLeft = 1
|
||||||
|
} HB_StringToGlyphsFlags;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
HB_ShaperFlag_Default = 0,
|
||||||
|
HB_ShaperFlag_NoKerning = 1,
|
||||||
|
HB_ShaperFlag_UseDesignMetrics = 2
|
||||||
|
} HB_ShaperFlag;
|
||||||
|
|
||||||
|
/*
|
||||||
|
highest value means highest priority for justification. Justification is done by first inserting kashidas
|
||||||
|
starting with the highest priority positions, then stretching spaces, afterwards extending inter char
|
||||||
|
spacing, and last spacing between arabic words.
|
||||||
|
NoJustification is for example set for arabic where no Kashida can be inserted or for diacritics.
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
HB_NoJustification= 0, /* Justification can't be applied after this glyph */
|
||||||
|
HB_Arabic_Space = 1, /* This glyph represents a space inside arabic text */
|
||||||
|
HB_Character = 2, /* Inter-character justification point follows this glyph */
|
||||||
|
HB_Space = 4, /* This glyph represents a blank outside an Arabic run */
|
||||||
|
HB_Arabic_Normal = 7, /* Normal Middle-Of-Word glyph that connects to the right (begin) */
|
||||||
|
HB_Arabic_Waw = 8, /* Next character is final form of Waw/Ain/Qaf/Fa */
|
||||||
|
HB_Arabic_BaRa = 9, /* Next two chars are Ba + Ra/Ya/AlefMaksura */
|
||||||
|
HB_Arabic_Alef = 10, /* Next character is final form of Alef/Tah/Lam/Kaf/Gaf */
|
||||||
|
HB_Arabic_HaaDal = 11, /* Next character is final form of Haa/Dal/Taa Marbutah */
|
||||||
|
HB_Arabic_Seen = 12, /* Initial or Medial form Of Seen/Sad */
|
||||||
|
HB_Arabic_Kashida = 13 /* Kashida(U+640) in middle of word */
|
||||||
|
} HB_JustificationClass;
|
||||||
|
|
||||||
|
/* This structure is binary compatible with Uniscribe's SCRIPT_VISATTR. Would be nice to keep
|
||||||
|
* it like that. If this is a problem please tell Trolltech :)
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
hb_bitfield justification :4; /* Justification class */
|
||||||
|
hb_bitfield clusterStart :1; /* First glyph of representation of cluster */
|
||||||
|
hb_bitfield mark :1; /* needs to be positioned around base char */
|
||||||
|
hb_bitfield zeroWidth :1; /* ZWJ, ZWNJ etc, with no width */
|
||||||
|
hb_bitfield dontPrint :1;
|
||||||
|
hb_bitfield combiningClass :8;
|
||||||
|
} HB_GlyphAttributes;
|
||||||
|
|
||||||
|
typedef struct HB_FaceRec_ {
|
||||||
|
HB_Bool isSymbolFont;
|
||||||
|
|
||||||
|
HB_GDEF gdef;
|
||||||
|
HB_GSUB gsub;
|
||||||
|
HB_GPOS gpos;
|
||||||
|
HB_Bool supported_scripts[HB_ScriptCount];
|
||||||
|
HB_Buffer buffer;
|
||||||
|
HB_Script current_script;
|
||||||
|
int current_flags; /* HB_ShaperFlags */
|
||||||
|
HB_Bool has_opentype_kerning;
|
||||||
|
HB_Bool glyphs_substituted;
|
||||||
|
HB_GlyphAttributes *tmpAttributes;
|
||||||
|
unsigned int *tmpLogClusters;
|
||||||
|
int length;
|
||||||
|
int orig_nglyphs;
|
||||||
|
} HB_FaceRec;
|
||||||
|
|
||||||
|
typedef HB_Error (*HB_GetFontTableFunc)(void *font, HB_Tag tag, HB_Byte *buffer, HB_UInt *length);
|
||||||
|
|
||||||
|
HB_Face HB_NewFace(void *font, HB_GetFontTableFunc tableFunc);
|
||||||
|
void HB_FreeFace(HB_Face face);
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
HB_Fixed x, y;
|
||||||
|
HB_Fixed width, height;
|
||||||
|
HB_Fixed xOffset, yOffset;
|
||||||
|
} HB_GlyphMetrics;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
HB_FontAscent
|
||||||
|
} HB_FontMetric;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
HB_Bool (*convertStringToGlyphIndices)(HB_Font font, const HB_UChar16 *string, hb_uint32 length, HB_Glyph *glyphs, hb_uint32 *numGlyphs, HB_Bool rightToLeft);
|
||||||
|
void (*getGlyphAdvances)(HB_Font font, const HB_Glyph *glyphs, hb_uint32 numGlyphs, HB_Fixed *advances, int flags /*HB_ShaperFlag*/);
|
||||||
|
HB_Bool (*canRender)(HB_Font font, const HB_UChar16 *string, hb_uint32 length);
|
||||||
|
/* implementation needs to make sure to load a scaled glyph, so /no/ FT_LOAD_NO_SCALE */
|
||||||
|
HB_Error (*getPointInOutline)(HB_Font font, HB_Glyph glyph, int flags /*HB_ShaperFlag*/, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints);
|
||||||
|
void (*getGlyphMetrics)(HB_Font font, HB_Glyph glyph, HB_GlyphMetrics *metrics);
|
||||||
|
HB_Fixed (*getFontMetric)(HB_Font font, HB_FontMetric metric);
|
||||||
|
} HB_FontClass;
|
||||||
|
|
||||||
|
typedef struct HB_Font_ {
|
||||||
|
const HB_FontClass *klass;
|
||||||
|
|
||||||
|
/* Metrics */
|
||||||
|
HB_UShort x_ppem, y_ppem;
|
||||||
|
HB_16Dot16 x_scale, y_scale;
|
||||||
|
|
||||||
|
void *userData;
|
||||||
|
} HB_FontRec;
|
||||||
|
|
||||||
|
#ifdef HB_USE_PACKED_STRUCTS
|
||||||
|
#pragma pack(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct HB_ShaperItem_ HB_ShaperItem;
|
||||||
|
|
||||||
|
struct HB_ShaperItem_ {
|
||||||
|
const HB_UChar16 *string; /* input: the Unicode UTF16 text to be shaped */
|
||||||
|
hb_uint32 stringLength; /* input: the length of the input in 16-bit words */
|
||||||
|
HB_ScriptItem item; /* input: the current run to be shaped: a run of text all in the same script that is a substring of <string> */
|
||||||
|
HB_Font font; /* input: the font: scale, units and function pointers supplying glyph indices and metrics */
|
||||||
|
HB_Face face; /* input: the shaper state; current script, access to the OpenType tables , etc. */
|
||||||
|
int shaperFlags; /* input (unused) should be set to 0; intended to support flags defined in HB_ShaperFlag */
|
||||||
|
HB_Bool glyphIndicesPresent; /* input: true if the <glyphs> array contains glyph indices ready to be shaped */
|
||||||
|
hb_uint32 initialGlyphCount; /* input: if glyphIndicesPresent is true, the number of glyph indices in the <glyphs> array */
|
||||||
|
|
||||||
|
hb_uint32 num_glyphs; /* input: capacity of output arrays <glyphs>, <attributes>, <advances>, <offsets>, and <log_clusters>; */
|
||||||
|
/* output: required capacity (may be larger than actual capacity) */
|
||||||
|
|
||||||
|
HB_Glyph *glyphs; /* output: <num_glyphs> indices of shaped glyphs */
|
||||||
|
HB_GlyphAttributes *attributes; /* output: <num_glyphs> glyph attributes */
|
||||||
|
HB_Fixed *advances; /* output: <num_glyphs> advances */
|
||||||
|
HB_FixedPoint *offsets; /* output: <num_glyphs> offsets */
|
||||||
|
unsigned short *log_clusters; /* output: for each output glyph, the index in the input of the start of its logical cluster */
|
||||||
|
|
||||||
|
/* internal */
|
||||||
|
HB_Bool kerning_applied; /* output: true if kerning was applied by the shaper */
|
||||||
|
};
|
||||||
|
|
||||||
|
HB_Bool HB_ShapeItem(HB_ShaperItem *item);
|
||||||
|
|
||||||
|
HB_END_HEADER
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,81 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
|
||||||
|
* Copyright (C) 2006 Behdad Esfahbod
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HARFBUZZ_STREAM_PRIVATE_H
|
||||||
|
#define HARFBUZZ_STREAM_PRIVATE_H
|
||||||
|
|
||||||
|
#include "harfbuzz-impl.h"
|
||||||
|
#include "harfbuzz-stream.h"
|
||||||
|
|
||||||
|
HB_BEGIN_HEADER
|
||||||
|
|
||||||
|
HB_INTERNAL void
|
||||||
|
_hb_close_stream( HB_Stream stream );
|
||||||
|
|
||||||
|
HB_INTERNAL HB_Int
|
||||||
|
_hb_stream_pos( HB_Stream stream );
|
||||||
|
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_hb_stream_seek( HB_Stream stream,
|
||||||
|
HB_UInt pos );
|
||||||
|
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_hb_stream_frame_enter( HB_Stream stream,
|
||||||
|
HB_UInt size );
|
||||||
|
|
||||||
|
HB_INTERNAL void
|
||||||
|
_hb_stream_frame_exit( HB_Stream stream );
|
||||||
|
|
||||||
|
/* convenience macros */
|
||||||
|
|
||||||
|
#define SET_ERR(c) ( (error = (c)) != 0 )
|
||||||
|
|
||||||
|
#define GOTO_Table(tag) (0)
|
||||||
|
#define FILE_Pos() _hb_stream_pos( stream )
|
||||||
|
#define FILE_Seek(pos) SET_ERR( _hb_stream_seek( stream, pos ) )
|
||||||
|
#define ACCESS_Frame(size) SET_ERR( _hb_stream_frame_enter( stream, size ) )
|
||||||
|
#define FORGET_Frame() _hb_stream_frame_exit( stream )
|
||||||
|
|
||||||
|
#define GET_Byte() (*stream->cursor++)
|
||||||
|
#define GET_Short() (stream->cursor += 2, (HB_Short)( \
|
||||||
|
(*(((HB_Byte*)stream->cursor)-2) << 8) | \
|
||||||
|
*(((HB_Byte*)stream->cursor)-1) \
|
||||||
|
))
|
||||||
|
#define GET_Long() (stream->cursor += 4, (HB_Int)( \
|
||||||
|
(*(((HB_Byte*)stream->cursor)-4) << 24) | \
|
||||||
|
(*(((HB_Byte*)stream->cursor)-3) << 16) | \
|
||||||
|
(*(((HB_Byte*)stream->cursor)-2) << 8) | \
|
||||||
|
*(((HB_Byte*)stream->cursor)-1) \
|
||||||
|
))
|
||||||
|
|
||||||
|
|
||||||
|
#define GET_Char() ((HB_Char)GET_Byte())
|
||||||
|
#define GET_UShort() ((HB_UShort)GET_Short())
|
||||||
|
#define GET_ULong() ((HB_UInt)GET_Long())
|
||||||
|
#define GET_Tag4() GET_ULong()
|
||||||
|
|
||||||
|
HB_END_HEADER
|
||||||
|
|
||||||
|
#endif /* HARFBUZZ_STREAM_PRIVATE_H */
|
|
@ -0,0 +1,114 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2005 David Turner
|
||||||
|
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
|
||||||
|
* Copyright (C) 2007 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*
|
||||||
|
* Red Hat Author(s): Behdad Esfahbod
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "harfbuzz-impl.h"
|
||||||
|
#include "harfbuzz-stream-private.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
#include <stdio.h>
|
||||||
|
#define LOG(x) _hb_log x
|
||||||
|
|
||||||
|
static void
|
||||||
|
_hb_log( const char* format, ... )
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
|
va_start( ap, format );
|
||||||
|
vfprintf( stderr, format, ap );
|
||||||
|
va_end( ap );
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
#define LOG(x) do {} while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
HB_INTERNAL void
|
||||||
|
_hb_close_stream( HB_Stream stream )
|
||||||
|
{
|
||||||
|
if (!stream)
|
||||||
|
return;
|
||||||
|
free(stream->base);
|
||||||
|
free(stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HB_INTERNAL HB_Int
|
||||||
|
_hb_stream_pos( HB_Stream stream )
|
||||||
|
{
|
||||||
|
LOG(( "_hb_stream_pos() -> %ld\n", stream->pos ));
|
||||||
|
return stream->pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_hb_stream_seek( HB_Stream stream,
|
||||||
|
HB_UInt pos )
|
||||||
|
{
|
||||||
|
HB_Error error = (HB_Error)0;
|
||||||
|
|
||||||
|
stream->pos = pos;
|
||||||
|
if (pos > stream->size)
|
||||||
|
error = ERR(HB_Err_Read_Error);
|
||||||
|
|
||||||
|
LOG(( "_hb_stream_seek(%ld) -> 0x%04X\n", pos, error ));
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HB_INTERNAL HB_Error
|
||||||
|
_hb_stream_frame_enter( HB_Stream stream,
|
||||||
|
HB_UInt count )
|
||||||
|
{
|
||||||
|
HB_Error error = HB_Err_Ok;
|
||||||
|
|
||||||
|
/* check new position, watch for overflow */
|
||||||
|
if (HB_UNLIKELY (stream->pos + count > stream->size ||
|
||||||
|
stream->pos + count < stream->pos))
|
||||||
|
{
|
||||||
|
error = ERR(HB_Err_Read_Error);
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* set cursor */
|
||||||
|
stream->cursor = stream->base + stream->pos;
|
||||||
|
stream->pos += count;
|
||||||
|
|
||||||
|
Exit:
|
||||||
|
LOG(( "_hb_stream_frame_enter(%ld) -> 0x%04X\n", count, error ));
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HB_INTERNAL void
|
||||||
|
_hb_stream_frame_exit( HB_Stream stream )
|
||||||
|
{
|
||||||
|
stream->cursor = NULL;
|
||||||
|
|
||||||
|
LOG(( "_hb_stream_frame_exit()\n" ));
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2005 David Turner
|
||||||
|
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HARFBUZZ_STREAM_H
|
||||||
|
#define HARFBUZZ_STREAM_H
|
||||||
|
|
||||||
|
#include "harfbuzz-global.h"
|
||||||
|
|
||||||
|
HB_BEGIN_HEADER
|
||||||
|
|
||||||
|
#ifdef HB_USE_PACKED_STRUCTS
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct HB_StreamRec_
|
||||||
|
{
|
||||||
|
HB_Byte* base;
|
||||||
|
HB_Byte* cursor;
|
||||||
|
HB_UInt size;
|
||||||
|
HB_UInt pos;
|
||||||
|
} HB_StreamRec;
|
||||||
|
|
||||||
|
#ifdef HB_USE_PACKED_STRUCTS
|
||||||
|
#pragma pack(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
HB_END_HEADER
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,111 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "harfbuzz-shaper.h"
|
||||||
|
#include "harfbuzz-shaper-private.h"
|
||||||
|
#include "harfbuzz-external.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
typedef int (*th_brk_def)(const char*, int[], int);
|
||||||
|
static th_brk_def th_brk = 0;
|
||||||
|
static int libthai_resolved = 0;
|
||||||
|
|
||||||
|
static void resolve_libthai()
|
||||||
|
{
|
||||||
|
if (!th_brk)
|
||||||
|
th_brk = (th_brk_def)HB_Library_Resolve("thai", 0, "th_brk");
|
||||||
|
libthai_resolved = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void to_tis620(const HB_UChar16 *string, hb_uint32 len, const char *cstr)
|
||||||
|
{
|
||||||
|
hb_uint32 i;
|
||||||
|
unsigned char *result = (unsigned char *)cstr;
|
||||||
|
|
||||||
|
for (i = 0; i < len; ++i) {
|
||||||
|
if (string[i] <= 0xa0)
|
||||||
|
result[i] = (unsigned char)string[i];
|
||||||
|
if (string[i] >= 0xe01 && string[i] <= 0xe5b)
|
||||||
|
result[i] = (unsigned char)(string[i] - 0xe00 + 0xa0);
|
||||||
|
else
|
||||||
|
result[i] = '?';
|
||||||
|
}
|
||||||
|
|
||||||
|
result[len] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void thaiWordBreaks(const HB_UChar16 *string, hb_uint32 len, HB_CharAttributes *attributes)
|
||||||
|
{
|
||||||
|
char s[128];
|
||||||
|
char *cstr = s;
|
||||||
|
int brp[128];
|
||||||
|
int *break_positions = brp;
|
||||||
|
hb_uint32 numbreaks;
|
||||||
|
hb_uint32 i;
|
||||||
|
|
||||||
|
if (!libthai_resolved)
|
||||||
|
resolve_libthai();
|
||||||
|
|
||||||
|
if (!th_brk)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (len >= 128)
|
||||||
|
cstr = (char *)malloc(len*sizeof(char) + 1);
|
||||||
|
|
||||||
|
to_tis620(string, len, cstr);
|
||||||
|
|
||||||
|
numbreaks = th_brk(cstr, break_positions, 128);
|
||||||
|
if (numbreaks > 128) {
|
||||||
|
break_positions = (int *)malloc(numbreaks * sizeof(int));
|
||||||
|
numbreaks = th_brk(cstr, break_positions, numbreaks);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < len; ++i) {
|
||||||
|
attributes[i].lineBreakType = HB_NoBreak;
|
||||||
|
attributes[i].wordBoundary = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < numbreaks; ++i) {
|
||||||
|
if (break_positions[i] > 0) {
|
||||||
|
attributes[break_positions[i]-1].lineBreakType = HB_Break;
|
||||||
|
attributes[break_positions[i]-1].wordBoundary = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (break_positions != brp)
|
||||||
|
free(break_positions);
|
||||||
|
|
||||||
|
if (len >= 128)
|
||||||
|
free(cstr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HB_ThaiAttributes(HB_Script script, const HB_UChar16 *text, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes)
|
||||||
|
{
|
||||||
|
assert(script == HB_Script_Thai);
|
||||||
|
attributes += from;
|
||||||
|
thaiWordBreaks(text + from, len, attributes);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,274 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "harfbuzz-shaper.h"
|
||||||
|
#include "harfbuzz-shaper-private.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
tibetan syllables are of the form:
|
||||||
|
head position consonant
|
||||||
|
first sub-joined consonant
|
||||||
|
....intermediate sub-joined consonants (if any)
|
||||||
|
last sub-joined consonant
|
||||||
|
sub-joined vowel (a-chung U+0F71)
|
||||||
|
standard or compound vowel sign (or 'virama' for devanagari transliteration)
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
TibetanOther,
|
||||||
|
TibetanHeadConsonant,
|
||||||
|
TibetanSubjoinedConsonant,
|
||||||
|
TibetanSubjoinedVowel,
|
||||||
|
TibetanVowel
|
||||||
|
} TibetanForm;
|
||||||
|
|
||||||
|
/* this table starts at U+0f40 */
|
||||||
|
static const unsigned char tibetanForm[0x80] = {
|
||||||
|
TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant,
|
||||||
|
TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant,
|
||||||
|
TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant,
|
||||||
|
TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant,
|
||||||
|
|
||||||
|
TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant,
|
||||||
|
TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant,
|
||||||
|
TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant,
|
||||||
|
TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant,
|
||||||
|
|
||||||
|
TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant,
|
||||||
|
TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant,
|
||||||
|
TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant, TibetanHeadConsonant,
|
||||||
|
TibetanOther, TibetanOther, TibetanOther, TibetanOther,
|
||||||
|
|
||||||
|
TibetanOther, TibetanVowel, TibetanVowel, TibetanVowel,
|
||||||
|
TibetanVowel, TibetanVowel, TibetanVowel, TibetanVowel,
|
||||||
|
TibetanVowel, TibetanVowel, TibetanVowel, TibetanVowel,
|
||||||
|
TibetanVowel, TibetanVowel, TibetanVowel, TibetanVowel,
|
||||||
|
|
||||||
|
TibetanVowel, TibetanVowel, TibetanVowel, TibetanVowel,
|
||||||
|
TibetanVowel, TibetanVowel, TibetanVowel, TibetanVowel,
|
||||||
|
TibetanOther, TibetanOther, TibetanOther, TibetanOther,
|
||||||
|
TibetanOther, TibetanOther, TibetanOther, TibetanOther,
|
||||||
|
|
||||||
|
TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant,
|
||||||
|
TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant,
|
||||||
|
TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant,
|
||||||
|
TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant,
|
||||||
|
|
||||||
|
TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant,
|
||||||
|
TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant,
|
||||||
|
TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant,
|
||||||
|
TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant,
|
||||||
|
|
||||||
|
TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant,
|
||||||
|
TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant,
|
||||||
|
TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant, TibetanSubjoinedConsonant,
|
||||||
|
TibetanSubjoinedConsonant, TibetanOther, TibetanOther, TibetanOther
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#define tibetan_form(c) \
|
||||||
|
((c) >= 0x0f40 && (c) < 0x0fc0 ? (TibetanForm)tibetanForm[(c) - 0x0f40] : TibetanOther)
|
||||||
|
|
||||||
|
static const HB_OpenTypeFeature tibetan_features[] = {
|
||||||
|
{ HB_MAKE_TAG('c', 'c', 'm', 'p'), CcmpProperty },
|
||||||
|
{ HB_MAKE_TAG('a', 'b', 'v', 's'), AboveSubstProperty },
|
||||||
|
{ HB_MAKE_TAG('b', 'l', 'w', 's'), BelowSubstProperty },
|
||||||
|
{ HB_MAKE_TAG('c', 'a', 'l', 't'), CaltProperty },
|
||||||
|
{0, 0}
|
||||||
|
};
|
||||||
|
|
||||||
|
static HB_Bool tibetan_shape_syllable(HB_Bool openType, HB_ShaperItem *item, HB_Bool invalid)
|
||||||
|
{
|
||||||
|
hb_uint32 i;
|
||||||
|
const HB_UChar16 *str = item->string + item->item.pos;
|
||||||
|
int len = item->item.length;
|
||||||
|
#ifndef NO_OPENTYPE
|
||||||
|
const int availableGlyphs = item->num_glyphs;
|
||||||
|
#endif
|
||||||
|
HB_Bool haveGlyphs;
|
||||||
|
HB_STACKARRAY(HB_UChar16, reordered, len + 4);
|
||||||
|
|
||||||
|
if (item->num_glyphs < item->item.length + 4) {
|
||||||
|
item->num_glyphs = item->item.length + 4;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (invalid) {
|
||||||
|
*reordered = 0x25cc;
|
||||||
|
memcpy(reordered+1, str, len*sizeof(HB_UChar16));
|
||||||
|
len++;
|
||||||
|
str = reordered;
|
||||||
|
}
|
||||||
|
|
||||||
|
haveGlyphs = item->font->klass->convertStringToGlyphIndices(item->font,
|
||||||
|
str, len,
|
||||||
|
item->glyphs, &item->num_glyphs,
|
||||||
|
item->item.bidiLevel % 2);
|
||||||
|
|
||||||
|
HB_FREE_STACKARRAY(reordered);
|
||||||
|
|
||||||
|
if (!haveGlyphs)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
for (i = 0; i < item->item.length; i++) {
|
||||||
|
item->attributes[i].mark = FALSE;
|
||||||
|
item->attributes[i].clusterStart = FALSE;
|
||||||
|
item->attributes[i].justification = 0;
|
||||||
|
item->attributes[i].zeroWidth = FALSE;
|
||||||
|
/* IDEBUG(" %d: %4x", i, str[i]); */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* now we have the syllable in the right order, and can start running it through open type. */
|
||||||
|
|
||||||
|
#ifndef NO_OPENTYPE
|
||||||
|
if (openType) {
|
||||||
|
HB_OpenTypeShape(item, /*properties*/0);
|
||||||
|
if (!HB_OpenTypePosition(item, availableGlyphs, /*doLogClusters*/FALSE))
|
||||||
|
return FALSE;
|
||||||
|
} else {
|
||||||
|
HB_HeuristicPosition(item);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
item->attributes[0].clusterStart = TRUE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int tibetan_nextSyllableBoundary(const HB_UChar16 *s, int start, int end, HB_Bool *invalid)
|
||||||
|
{
|
||||||
|
const HB_UChar16 *uc = s + start;
|
||||||
|
|
||||||
|
int pos = 0;
|
||||||
|
TibetanForm state = tibetan_form(*uc);
|
||||||
|
|
||||||
|
/* qDebug("state[%d]=%d (uc=%4x)", pos, state, uc[pos]);*/
|
||||||
|
pos++;
|
||||||
|
|
||||||
|
if (state != TibetanHeadConsonant) {
|
||||||
|
if (state != TibetanOther)
|
||||||
|
*invalid = TRUE;
|
||||||
|
goto finish;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (pos < end - start) {
|
||||||
|
TibetanForm newState = tibetan_form(uc[pos]);
|
||||||
|
switch(newState) {
|
||||||
|
case TibetanSubjoinedConsonant:
|
||||||
|
case TibetanSubjoinedVowel:
|
||||||
|
if (state != TibetanHeadConsonant &&
|
||||||
|
state != TibetanSubjoinedConsonant)
|
||||||
|
goto finish;
|
||||||
|
state = newState;
|
||||||
|
break;
|
||||||
|
case TibetanVowel:
|
||||||
|
if (state != TibetanHeadConsonant &&
|
||||||
|
state != TibetanSubjoinedConsonant &&
|
||||||
|
state != TibetanSubjoinedVowel)
|
||||||
|
goto finish;
|
||||||
|
break;
|
||||||
|
case TibetanOther:
|
||||||
|
case TibetanHeadConsonant:
|
||||||
|
goto finish;
|
||||||
|
}
|
||||||
|
pos++;
|
||||||
|
}
|
||||||
|
|
||||||
|
finish:
|
||||||
|
*invalid = FALSE;
|
||||||
|
return start+pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
HB_Bool HB_TibetanShape(HB_ShaperItem *item)
|
||||||
|
{
|
||||||
|
|
||||||
|
HB_Bool openType = FALSE;
|
||||||
|
unsigned short *logClusters = item->log_clusters;
|
||||||
|
|
||||||
|
HB_ShaperItem syllable = *item;
|
||||||
|
int first_glyph = 0;
|
||||||
|
|
||||||
|
int sstart = item->item.pos;
|
||||||
|
int end = sstart + item->item.length;
|
||||||
|
|
||||||
|
assert(item->item.script == HB_Script_Tibetan);
|
||||||
|
|
||||||
|
#ifndef QT_NO_OPENTYPE
|
||||||
|
openType = HB_SelectScript(item, tibetan_features);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
while (sstart < end) {
|
||||||
|
HB_Bool invalid;
|
||||||
|
int i;
|
||||||
|
int send = tibetan_nextSyllableBoundary(item->string, sstart, end, &invalid);
|
||||||
|
/* IDEBUG("syllable from %d, length %d, invalid=%s", sstart, send-sstart,
|
||||||
|
invalid ? "TRUE" : "FALSE"); */
|
||||||
|
syllable.item.pos = sstart;
|
||||||
|
syllable.item.length = send-sstart;
|
||||||
|
syllable.glyphs = item->glyphs + first_glyph;
|
||||||
|
syllable.attributes = item->attributes + first_glyph;
|
||||||
|
syllable.offsets = item->offsets + first_glyph;
|
||||||
|
syllable.advances = item->advances + first_glyph;
|
||||||
|
syllable.num_glyphs = item->num_glyphs - first_glyph;
|
||||||
|
if (!tibetan_shape_syllable(openType, &syllable, invalid)) {
|
||||||
|
item->num_glyphs += syllable.num_glyphs;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
/* fix logcluster array */
|
||||||
|
for (i = sstart; i < send; ++i)
|
||||||
|
logClusters[i-item->item.pos] = first_glyph;
|
||||||
|
sstart = send;
|
||||||
|
first_glyph += syllable.num_glyphs;
|
||||||
|
}
|
||||||
|
item->num_glyphs = first_glyph;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void HB_TibetanAttributes(HB_Script script, const HB_UChar16 *text, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes)
|
||||||
|
{
|
||||||
|
int end = from + len;
|
||||||
|
const HB_UChar16 *uc = text + from;
|
||||||
|
hb_uint32 i = 0;
|
||||||
|
HB_UNUSED(script);
|
||||||
|
attributes += from;
|
||||||
|
while (i < len) {
|
||||||
|
HB_Bool invalid;
|
||||||
|
hb_uint32 boundary = tibetan_nextSyllableBoundary(text, from+i, end, &invalid) - from;
|
||||||
|
|
||||||
|
attributes[i].charStop = TRUE;
|
||||||
|
|
||||||
|
if (boundary > len-1) boundary = len;
|
||||||
|
i++;
|
||||||
|
while (i < boundary) {
|
||||||
|
attributes[i].charStop = FALSE;
|
||||||
|
++uc;
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
assert(i == boundary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2006 Behdad Esfahbod
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define HB_INTERNAL static
|
||||||
|
#include "harfbuzz-buffer.c"
|
||||||
|
#include "harfbuzz-gdef.c"
|
||||||
|
#include "harfbuzz-gsub.c"
|
||||||
|
#include "harfbuzz-gpos.c"
|
||||||
|
#include "harfbuzz-impl.c"
|
||||||
|
#include "harfbuzz-open.c"
|
||||||
|
#include "harfbuzz-stream.c"
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
|
||||||
|
* Copyright (C) 2006 Behdad Esfahbod
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, an OpenType Layout engine library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HARFBUZZ_H
|
||||||
|
#define HARFBUZZ_H
|
||||||
|
|
||||||
|
#include "harfbuzz-external.h"
|
||||||
|
#include "harfbuzz-global.h"
|
||||||
|
#include "harfbuzz-buffer.h"
|
||||||
|
#include "harfbuzz-gdef.h"
|
||||||
|
#include "harfbuzz-gsub.h"
|
||||||
|
#include "harfbuzz-gpos.h"
|
||||||
|
#include "harfbuzz-open.h"
|
||||||
|
#include "harfbuzz-shaper.h"
|
||||||
|
|
||||||
|
#endif /* HARFBUZZ_OPEN_H */
|
Loading…
Reference in New Issue