summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c
diff options
context:
space:
mode:
authorJonathan Kew <jfkthame@googlemail.com>2008-06-03 15:24:50 +0000
committerJonathan Kew <jfkthame@googlemail.com>2008-06-03 15:24:50 +0000
commit0837c936f183c287dc3feefbcd852b9b285acf47 (patch)
treed24502eb8f8a1b876a6f43b8efad7fef8dd365e4 /Build/source/texk/web2c
parent4bc90058ad7b1cf552cf77fcb48eaad0cbea32a5 (diff)
patch to support --without-graphite for building xetex with older compilers
git-svn-id: svn://tug.org/texlive/trunk@8521 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c')
-rwxr-xr-xBuild/source/texk/web2c/configure18
-rw-r--r--Build/source/texk/web2c/configure.in8
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp38
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeX_ext.c28
-rw-r--r--Build/source/texk/web2c/xetexdir/xetex.mk25
5 files changed, 99 insertions, 18 deletions
diff --git a/Build/source/texk/web2c/configure b/Build/source/texk/web2c/configure
index 3844d907ef7..ab2e1bbd774 100755
--- a/Build/source/texk/web2c/configure
+++ b/Build/source/texk/web2c/configure
@@ -754,6 +754,7 @@ FONTCONFIGLDFLAGS
LDFONTCONFIG
XETEX_MACOSX
XETEX_GENERIC
+XETEX_GRAPHITE
ETEX
XMKMF
X_CFLAGS
@@ -825,6 +826,7 @@ with_freetype2_libdir
with_freetype2_include
with_icu_libdir
with_icu_include
+with_graphite
with_fontconfig
with_x
'
@@ -1528,6 +1530,7 @@ Optional Packages:
Specify directory where the ICU library resides.
--with-icu-include=DIR
Specify the ICU header files location.
+ --without-graphite build xetex without graphite support
--with-fontconfig=DIR Specify dir prefix where fontconfig is installed
(e.g., /usr/X11R6).
--with-fontconfig=DIR use fontconfig include/library files from DIR
@@ -7227,6 +7230,13 @@ fi
# we don't currently support use of an installed graphite lib
+
+# Check whether --with-graphite was given.
+if test "${with_graphite+set}" = set; then
+ withval=$with_graphite;
+fi
+
+
if test "$needs_graphite" = no; then
GRAPHITECPPFLAGS=
LDGRAPHITE=
@@ -9100,8 +9110,16 @@ fontconfig is installed.
fi
+
+ if test "x$with_graphite" = xno; then
+ XETEX_GRAPHITE='#! '
+ else
+ XETEX_GRAPHITE=
+ fi
+
fi
+
# For e-TeX, three choices: no, yes, and tex. In the latter case, we
# have to comment out the normal TeX build (TEX), as well as enable the
# e-TeX build (ETEX) and the replacement of TeX with e-TeX in compatibilty
diff --git a/Build/source/texk/web2c/configure.in b/Build/source/texk/web2c/configure.in
index 0899b6c4c83..3bb0281d335 100644
--- a/Build/source/texk/web2c/configure.in
+++ b/Build/source/texk/web2c/configure.in
@@ -352,8 +352,16 @@ fontconfig is installed.
fi
AC_SUBST(XETEX_MACOSX)
AC_SUBST(XETEX_GENERIC)
+
+ if test "x$with_graphite" = xno; then
+ XETEX_GRAPHITE='#! '
+ else
+ XETEX_GRAPHITE=
+ fi
+ AC_SUBST(XETEX_GRAPHITE)
fi
+
# For e-TeX, three choices: no, yes, and tex. In the latter case, we
# have to comment out the normal TeX build (TEX), as well as enable the
# e-TeX build (ETEX) and the replacement of TeX with e-TeX in compatibilty
diff --git a/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp b/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp
index 23b78af8b4d..7da56637cb4 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp
+++ b/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp
@@ -41,7 +41,9 @@ authorization from SIL International.
#include "XeTeXswap.h"
+#ifdef XETEX_GRAPHITE
#include "XeTeXGrLayout.h"
+#endif
#include "Features.h"
#include "ScriptAndLanguage.h"
@@ -67,9 +69,11 @@ struct XeTeXLayoutEngine_rec
float extend;
float slant;
float embolden;
+#ifdef XETEX_GRAPHITE
gr::Segment* grSegment;
XeTeXGrFont* grFont;
XeTeXGrTextSource* grSource;
+#endif
};
/*******************************************************************/
@@ -331,6 +335,7 @@ UInt32 getIndFeature(XeTeXFont font, UInt32 script, UInt32 language, UInt32 inde
return 0;
}
+#ifdef XETEX_GRAPHITE
UInt32 countGraphiteFeatures(XeTeXLayoutEngine engine)
{
std::pair<gr::FeatureIterator, gr::FeatureIterator> fi = engine->grFont->getFeatures();
@@ -429,10 +434,13 @@ void getGraphiteFeatureSettingLabel(XeTeXLayoutEngine engine, UInt32 feature, UI
}
}
}
+#endif /* XETEX_GRAPHITE */
long findGraphiteFeatureNamed(XeTeXLayoutEngine engine, const char* name, int namelength)
{
long rval = -1;
+
+#ifdef XETEX_GRAPHITE
UErrorCode status = (UErrorCode)0;
std::pair<gr::FeatureIterator,gr::FeatureIterator> features = engine->grFont->getFeatures();
@@ -457,6 +465,7 @@ long findGraphiteFeatureNamed(XeTeXLayoutEngine engine, const char* name, int na
}
++features.first;
}
+#endif
return rval;
}
@@ -464,6 +473,8 @@ long findGraphiteFeatureNamed(XeTeXLayoutEngine engine, const char* name, int na
long findGraphiteFeatureSettingNamed(XeTeXLayoutEngine engine, UInt32 feature, const char* name, int namelength)
{
long rval = -1;
+
+#ifdef XETEX_GRAPHITE
UErrorCode status = (UErrorCode)0;
std::pair<gr::FeatureIterator,gr::FeatureIterator> features = engine->grFont->getFeatures();
@@ -495,9 +506,9 @@ long findGraphiteFeatureSettingNamed(XeTeXLayoutEngine engine, UInt32 feature, c
break;
}
}
+#endif
return rval;
-
}
float getGlyphWidth(XeTeXFont font, UInt32 gid)
@@ -550,9 +561,11 @@ XeTeXLayoutEngine createLayoutEngine(PlatformFontRef fontRef, XeTeXFont font, UI
result->slant = slant;
result->embolden = embolden;
+#ifdef XETEX_GRAPHITE
result->grSegment = NULL;
result->grSource = NULL;
result->grFont = NULL;
+#endif
result->layoutEngine = XeTeXOTLayoutEngine::LayoutEngineFactory((XeTeXFontInst*)font, scriptTag, languageTag,
(LETag*)addFeatures, (le_int32*)addParams, (LETag*)removeFeatures, status);
@@ -568,9 +581,11 @@ void deleteLayoutEngine(XeTeXLayoutEngine engine)
{
delete engine->layoutEngine;
delete engine->font;
+#ifdef XETEX_GRAPHITE
delete engine->grSegment;
delete engine->grSource;
delete engine->grFont;
+#endif
}
SInt32 layoutChars(XeTeXLayoutEngine engine, UInt16 chars[], SInt32 offset, SInt32 count, SInt32 max,
@@ -887,6 +902,8 @@ GetFontCharRange_AAT(ATSUStyle style, int reqFirst)
}
#endif
+#ifdef XETEX_GRAPHITE
+
/* Graphite interface */
gr::LayoutEnvironment layoutEnv;
@@ -994,9 +1011,12 @@ static XeTeXGrTextSource* lbSource = NULL;
static gr::Segment* lbSegment = NULL;
static XeTeXLayoutEngine lbEngine = NULL;
+#endif /* XETEX_GRAPHITE */
+
void
initGraphiteBreaking(XeTeXLayoutEngine engine, const UniChar* txtPtr, int txtLen)
{
+#ifdef XETEX_GRAPHITE
if (lbSource == NULL)
lbSource = new XeTeXGrTextSource(0);
@@ -1023,11 +1043,13 @@ initGraphiteBreaking(XeTeXLayoutEngine engine, const UniChar* txtPtr, int txtLen
catch (...) {
fprintf(stderr, "*** initGraphiteBreaking: segment creation failed\n");
}
+#endif
}
int
findNextGraphiteBreak(int iOffset, int iBrkVal)
{
+#ifdef XETEX_GRAPHITE
if (lbSegment == NULL)
return -1;
if (iOffset < lbSource->getLength()) {
@@ -1044,18 +1066,22 @@ findNextGraphiteBreak(int iOffset, int iBrkVal)
return lbSource->getLength();
}
else
+#endif
return -1;
}
-
-int usingOpenType(XeTeXLayoutEngine engine)
+int usingGraphite(XeTeXLayoutEngine engine)
{
- return engine->layoutEngine != NULL;
+#ifdef XETEX_GRAPHITE
+ return engine->grFont != NULL;
+#else
+ return 0;
+#endif
}
-int usingGraphite(XeTeXLayoutEngine engine)
+int usingOpenType(XeTeXLayoutEngine engine)
{
- return engine->grFont != NULL;
+ return engine->layoutEngine != NULL;
}
#define kMATHTableTag 0x4D415448 /* 'MATH' */
diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
index 3257ea1f7c0..7efebad0506 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
+++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
@@ -1058,6 +1058,8 @@ readFeatureNumber(const char* s, const char* e, int* f, int* v)
return 1;
}
+#ifdef XETEX_GRAPHITE
+
#define MAX_GRAPHITE_FEATURES 64
static void*
@@ -1189,6 +1191,8 @@ loadGraphiteFont(PlatformFontRef fontRef, XeTeXFont font, Fixed scaled_size, con
return engine;
}
+#endif /* XETEX_GRAPHITE */
+
static void
splitFontName(char* name, char** var, char** feat, char** end, int* index)
{
@@ -1300,11 +1304,13 @@ findnativefont(unsigned char* uname, integer scaled_size)
font = createFontFromFile(path, index, scaled_size);
if (font != NULL) {
loadedfontdesignsize = X2Fix(getDesignSize(font));
+#if XETEX_GRAPHITE
if (varString && strncmp(varString, "/GR", 3) == 0) {
rval = loadGraphiteFont(0, font, scaled_size, featString, nameString);
if (rval == NULL)
graphitewarning();
}
+#endif
if (rval == NULL) /* graphite wasn't requested, or failed to initialize */
rval = loadOTfont(0, font, scaled_size, featString);
if (rval == NULL)
@@ -1355,11 +1361,13 @@ findnativefont(unsigned char* uname, integer scaled_size)
font = createFont(fontRef, scaled_size);
if (font != 0) {
+#ifdef XETEX_GRAPHITE
if (getReqEngine() == 'G') {
rval = loadGraphiteFont(fontRef, font, scaled_size, featString, nameString);
if (rval == NULL)
graphitewarning();
}
+#endif
if (rval == NULL) {
#ifdef XETEX_MAC
if (getReqEngine() == 'I' || getReqEngine() == 'G' ||
@@ -1457,10 +1465,12 @@ otfontget(integer what, void* pEngine)
return countGlyphs(fontInst);
break;
+#ifdef XETEX_GRAPHITE
case XeTeX_count_features: /* ie Graphite features */
return countGraphiteFeatures(engine);
break;
-
+#endif
+
case XeTeX_OT_count_scripts:
return countScripts(fontInst);
break;
@@ -1483,6 +1493,7 @@ otfontget1(integer what, void* pEngine, integer param)
return getIndScript(fontInst, param);
break;
+#ifdef XETEX_GRAPHITE
/* for graphite fonts...*/
case XeTeX_feature_code:
return getGraphiteFeatureCode(engine, param);
@@ -1493,6 +1504,7 @@ otfontget1(integer what, void* pEngine, integer param)
case XeTeX_count_selectors:
return countGraphiteFeatureSettings(engine, param);
break;
+#endif
}
return 0;
}
@@ -1512,6 +1524,7 @@ otfontget2(integer what, void* pEngine, integer param1, integer param2)
return countFeatures(fontInst, param1, param2);
break;
+#ifdef XETEX_GRAPHITE
/* for graphite fonts */
case XeTeX_selector_code:
return getGraphiteFeatureSettingCode(engine, param1, param2);
@@ -1519,6 +1532,7 @@ otfontget2(integer what, void* pEngine, integer param1, integer param2)
case XeTeX_is_default_selector:
return getGraphiteFeatureDefaultSetting(engine, param1) == param2;
break;
+#endif
}
return 0;
@@ -1542,6 +1556,7 @@ otfontget3(integer what, void* pEngine, integer param1, integer param2, integer
void
grprintfontname(integer what, void* pEngine, integer param1, integer param2)
{
+#ifdef XETEX_GRAPHITE
unsigned short name[128]; /* graphite API specifies size 128 */
int n = 0;
XeTeXLayoutEngine engine = (XeTeXLayoutEngine)pEngine;
@@ -1556,18 +1571,21 @@ grprintfontname(integer what, void* pEngine, integer param1, integer param2)
while (name[n] != 0 && n < 128)
++n;
printchars(&name[0], n);
+#endif
}
integer
grfontgetnamed(integer what, void* pEngine)
{
long rval = -1;
+#ifdef XETEX_GRAPHITE
XeTeXLayoutEngine engine = (XeTeXLayoutEngine)pEngine;
switch (what) {
case XeTeX_find_feature_by_name:
rval = findGraphiteFeatureNamed(engine, (const char*)nameoffile + 1, namelength);
break;
}
+#endif
return rval;
}
@@ -1575,12 +1593,14 @@ integer
grfontgetnamed1(integer what, void* pEngine, integer param)
{
long rval = -1;
+#ifdef XETEX_GRAPHITE
XeTeXLayoutEngine engine = (XeTeXLayoutEngine)pEngine;
switch (what) {
case XeTeX_find_selector_by_name:
rval = findGraphiteFeatureSettingNamed(engine, param, (const char*)nameoffile + 1, namelength);
break;
}
+#endif
return rval;
}
@@ -2237,6 +2257,7 @@ measure_native_node(void* pNode, int use_glyph_metrics)
else {
/* using Graphite */
void* glyph_info = NULL;
+#ifdef XETEX_GRAPHITE
realGlyphCount = makeGraphiteSegment(engine, (UniChar*)txtPtr, txtLen);
if (realGlyphCount > 0) {
@@ -2253,7 +2274,10 @@ measure_native_node(void* pNode, int use_glyph_metrics)
}
node_width(node) = X2Fix(graphiteSegmentWidth(engine));
-
+#else
+ node_width(node) = 0;
+#endif
+
native_glyph_count(node) = realGlyphCount;
native_glyph_info_ptr(node) = glyph_info;
}
diff --git a/Build/source/texk/web2c/xetexdir/xetex.mk b/Build/source/texk/web2c/xetexdir/xetex.mk
index 53ddc9cefea..722ff594b58 100644
--- a/Build/source/texk/web2c/xetexdir/xetex.mk
+++ b/Build/source/texk/web2c/xetexdir/xetex.mk
@@ -37,6 +37,18 @@ xetex = @XETEX@ xetex
@XETEX_GENERIC@ EXTRADEPS = @LIBXPDFDEP@ @LIBPNGDEP@
+### is Graphite support included?
+
+@XETEX_GRAPHITE@ xetex_graphite_layout_o = XeTeXGrLayout.o
+@XETEX_GRAPHITE@ XETEX_GRAPHITE = -DXETEX_GRAPHITE
+
+@XETEX_GRAPHITE@ GRAPHITEDIR = ../../libs/graphite-engine
+@XETEX_GRAPHITE@ GRAPHITESRCDIR = $(srcdir)/$(GRAPHITEDIR)
+
+@XETEX_GRAPHITE@ GRAPHITEFLAGS = @GRAPHITECPPFLAGS@
+@XETEX_GRAPHITE@ LDGRAPHITE = @LDGRAPHITE@
+@XETEX_GRAPHITE@ GRAPHITEDEP = @GRAPHITEDEP@
+
### end of platform-specific setup
LDLIBXPDF=@LDLIBXPDF@
@@ -85,13 +97,6 @@ ZLIBSRCDIR = $(srcdir)/$(ZLIBDIR)
FONTCONFIGCPPFLAGS = @FONTCONFIGCPPFLAGS@
FONTCONFIGLDFLAGS = @FONTCONFIGLDFLAGS@
-GRAPHITEDIR = ../../libs/graphite-engine
-GRAPHITESRCDIR = $(srcdir)/$(GRAPHITEDIR)
-
-GRAPHITEFLAGS = @GRAPHITECPPFLAGS@
-LDGRAPHITE = @LDGRAPHITE@
-GRAPHITEDEP = @GRAPHITEDEP@
-
xetexlibs = $(LDICU) $(LDTECKIT) $(LDFREETYPE2) $(LDGRAPHITE) $(LDZLIB)
# Font-related headers
@@ -174,11 +179,11 @@ xetex_ot_layout_o = \
XeTeXLayoutInterface.o XeTeXOTLayoutEngine.o \
XeTeXFontInst.o cmaps.o FontTableCache.o \
XeTeXOTMath.o \
- XeTeXGrLayout.o \
+ $(xetex_graphite_layout_o) \
$(xetex_platform_layout_o)
XeTeXLayoutInterface.o: $(srcdir)/xetexdir/XeTeXLayoutInterface.cpp $(XeTeXFontHdrs)
- $(CXX) $(ICUCFLAGS) $(FTFLAGS) $(GRAPHITEFLAGS) $(FONTCONFIGCPPFLAGS) $(ALL_CXXFLAGS) $(XETEX_DEFINES) -c $< -o $@
+ $(CXX) $(ICUCFLAGS) $(FTFLAGS) $(GRAPHITEFLAGS) $(FONTCONFIGCPPFLAGS) $(ALL_CXXFLAGS) $(XETEX_DEFINES) $(XETEX_GRAPHITE) -c $< -o $@
XeTeXOTLayoutEngine.o: $(srcdir)/xetexdir/XeTeXOTLayoutEngine.cpp $(XeTeXFontHdrs)
$(CXX) $(ICUCFLAGS) $(FTFLAGS) $(FONTCONFIGCPPFLAGS) $(ALL_CXXFLAGS) $(XETEX_DEFINES) -c $< -o $@
@@ -211,7 +216,7 @@ XeTeXGrLayout.o: $(srcdir)/xetexdir/XeTeXGrLayout.cpp $(srcdir)/xetexdir/XeTeXGr
# special rules for files that need the TECkit headers as well
XeTeX_ext.o: $(srcdir)/xetexdir/XeTeX_ext.c xetexd.h
- $(compile) $(ICUCFLAGS) $(FTFLAGS) $(TECKITFLAGS) $(LIBPNGCPPFLAGS) $(LIBXPDFCPPFLAGS) $(ZLIBCPPFLAGS) $(ALL_CFLAGS) $(XETEX_DEFINES) -c $< -o $@
+ $(compile) $(ICUCFLAGS) $(FTFLAGS) $(TECKITFLAGS) $(LIBPNGCPPFLAGS) $(LIBXPDFCPPFLAGS) $(ZLIBCPPFLAGS) $(ALL_CFLAGS) $(XETEX_DEFINES) $(XETEX_GRAPHITE) -c $< -o $@
XeTeX_mac.o: $(srcdir)/xetexdir/XeTeX_mac.c xetexd.h
$(compile) $(ICUCFLAGS) $(TECKITFLAGS) $(ALL_CFLAGS) $(XETEX_DEFINES) -c $< -o $@