diff options
author | Jonathan Kew <jfkthame@googlemail.com> | 2007-07-27 16:32:31 +0000 |
---|---|---|
committer | Jonathan Kew <jfkthame@googlemail.com> | 2007-07-27 16:32:31 +0000 |
commit | bdba3f35302c893676527d9fac8956d439a86884 (patch) | |
tree | 95ec62055f1c53d0f06ac5d770b2c024a0bbc4a9 /Build | |
parent | dc1f6f81442c5d3a149e1635c44a9cc95b33c8b2 (diff) |
merged xetex-related fixes from branch2007 (r4517)
git-svn-id: svn://tug.org/texlive/trunk@4666 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/web2c/texmfmem.h | 39 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeX_ext.c | 100 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeX_ext.h | 63 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeX_mac.c | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/jpegimage.c | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/xetex-new.ch | 98 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/xetex.defines | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/xetex.h | 3 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/xetex.mk | 10 | ||||
-rw-r--r-- | Build/source/texk/xdvipdfmx/src/tt_cmap.c | 9 |
10 files changed, 167 insertions, 161 deletions
diff --git a/Build/source/texk/web2c/texmfmem.h b/Build/source/texk/web2c/texmfmem.h index 78bf73fb787..13697685121 100644 --- a/Build/source/texk/web2c/texmfmem.h +++ b/Build/source/texk/web2c/texmfmem.h @@ -112,25 +112,13 @@ typedef union #else twohalves hhfield; #endif -#ifdef WORDS_BIGENDIAN #ifdef XeTeX - struct - { - integer CINT; - integer CINT1; - } x; -#else - integer cint; + voidpointer ptr; #endif +#ifdef WORDS_BIGENDIAN + integer cint; fourquarters qqqq; #else /* not WORDS_BIGENDIAN */ -#ifdef XeTeX - struct - { - integer CINT1; - integer CINT; - } x; -#else struct { #if defined (TeX) && !defined (SMALLTeX) || defined (MF) && !defined (SMALLMF) || defined (MP) && !defined (SMALLMP) @@ -138,7 +126,6 @@ typedef union #endif /* big {TeX,MF,MP} */ integer CINT; } u; -#endif struct { @@ -159,28 +146,13 @@ typedef union typedef union { #ifdef WORDS_BIGENDIAN -#ifdef XeTeX - struct - { - integer CINT; - } x; -#else integer cint; -#endif fourquarters qqqq; #else /* not WORDS_BIGENDIAN */ -#ifdef XeTeX - struct - { - halfword junk; - integer CINT; - } x; -#else struct { integer CINT; } u; -#endif struct { @@ -199,14 +171,9 @@ typedef union #define rh v.RH #define lhfield v.LH -#ifdef XeTeX -#define cint x.CINT -#define cint1 x.CINT1 -#else #ifndef WORDS_BIGENDIAN #define cint u.CINT #endif -#endif /* XeTeX */ #ifndef WORDS_BIGENDIAN #define qqqq v.QQQQ diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c index 122605694b0..a4b467bb10c 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c +++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c @@ -236,9 +236,9 @@ void initversionstring(char **versions) } -extern char* gettexstring(int strNumber); +extern char* gettexstring(integer strNumber); void -setinputfileencoding(UFILE* f, int mode, int encodingData) +setinputfileencoding(UFILE* f, integer mode, integer encodingData) { if ((f->encodingMode == ICUMAPPING) && (f->conversionData != NULL)) ucnv_close((UConverter*)(f->conversionData)); @@ -288,9 +288,9 @@ input_line_icu(UFILE* f) static char* byteBuffer = NULL; UInt32 bytesRead = 0; - int i; + int i; UConverter* cnv; - long outLen; + int outLen; UErrorCode errorCode = 0; if (byteBuffer == NULL) @@ -355,10 +355,9 @@ static UBreakIterator* brkIter = NULL; static int brkLocaleStrNum = 0; void -linebreakstart(int localeStrNum, const UniChar* text, int textLength) +linebreakstart(integer localeStrNum, const UniChar* text, integer textLength) { UErrorCode status = 0; - int i; if ((localeStrNum != brkLocaleStrNum) && (brkIter != NULL)) { ubrk_close(brkIter); @@ -392,8 +391,8 @@ linebreaknext() return ubrk_next((UBreakIterator*)brkIter); } -long -getencodingmodeandinfo(long* info) +int +getencodingmodeandinfo(integer* info) { /* \XeTeXinputencoding "enc-name" * -> name is packed in |nameoffile| as a C string, starting at [1] @@ -811,7 +810,7 @@ splitFontName(char* name, char** var, char** feat, char** end) } void* -findnativefont(unsigned char* uname, long scaled_size) +findnativefont(unsigned char* uname, integer scaled_size) /* scaled_size here is in TeX points */ { void* rval = 0; @@ -950,7 +949,6 @@ void otgetfontmetrics(void* pEngine, scaled* ascent, scaled* descent, scaled* xheight, scaled* capheight, scaled* slant) { XeTeXLayoutEngine engine = (XeTeXLayoutEngine)pEngine; - long rval = 0; float a, d; int glyphID; @@ -977,8 +975,8 @@ otgetfontmetrics(void* pEngine, scaled* ascent, scaled* descent, scaled* xheight *capheight = *ascent; /* arbitrary figure if there's no 'X' in the font */ } -long -otfontget(int what, void* pEngine) +integer +otfontget(integer what, void* pEngine) { XeTeXLayoutEngine engine = (XeTeXLayoutEngine)pEngine; XeTeXFont fontInst = getFont(engine); @@ -995,8 +993,8 @@ otfontget(int what, void* pEngine) } -long -otfontget1(int what, void* pEngine, long param) +integer +otfontget1(integer what, void* pEngine, integer param) { XeTeXLayoutEngine engine = (XeTeXLayoutEngine)pEngine; XeTeXFont fontInst = getFont(engine); @@ -1013,8 +1011,8 @@ otfontget1(int what, void* pEngine, long param) } -long -otfontget2(int what, void* pEngine, long param1, long param2) +integer +otfontget2(integer what, void* pEngine, integer param1, integer param2) { XeTeXLayoutEngine engine = (XeTeXLayoutEngine)pEngine; XeTeXFont fontInst = getFont(engine); @@ -1032,8 +1030,8 @@ otfontget2(int what, void* pEngine, long param1, long param2) } -long -otfontget3(int what, void* pEngine, long param1, long param2, long param3) +integer +otfontget3(integer what, void* pEngine, integer param1, integer param2, integer param3) { XeTeXLayoutEngine engine = (XeTeXLayoutEngine)pEngine; XeTeXFont fontInst = getFont(engine); @@ -1091,7 +1089,7 @@ makeXDVGlyphArrayData(void* pNode) xdvbuffer = (char*)xmalloc(xdvBufSize); } - glyph_info = (void*)native_glyph_info_ptr(p); + glyph_info = native_glyph_info_ptr(p); locations = (FixedPoint*)glyph_info; glyphIDs = (UInt16*)(locations + glyphCount); @@ -1138,8 +1136,8 @@ makeXDVGlyphArrayData(void* pNode) return ((char*)cp - xdvbuffer); } -long -makefontdef(long f) +int +makefontdef(integer f) { UInt16 flags = 0; UInt32 variationCount = 0; @@ -1349,7 +1347,7 @@ snap_zone(scaled* value, scaled snap_value, scaled fuzz) } void -getnativecharheightdepth(int font, int ch, scaled* height, scaled* depth) +getnativecharheightdepth(integer font, integer ch, scaled* height, scaled* depth) { #define QUAD(f) fontinfo[6+parambase[f]].cint #define X_HEIGHT(f) fontinfo[5+parambase[f]].cint @@ -1389,7 +1387,7 @@ getnativecharheightdepth(int font, int ch, scaled* height, scaled* depth) } scaled -getnativecharht(int f, int c) +getnativecharht(integer f, integer c) { scaled h, d; getnativecharheightdepth(f, c, &h, &d); @@ -1397,7 +1395,7 @@ getnativecharht(int f, int c) } scaled -getnativechardp(int f, int c) +getnativechardp(integer f, integer c) { scaled h, d; getnativecharheightdepth(f, c, &h, &d); @@ -1405,7 +1403,7 @@ getnativechardp(int f, int c) } void -getnativecharsidebearings(int font, int ch, scaled* lsb, scaled* rsb) +getnativecharsidebearings(integer font, integer ch, scaled* lsb, scaled* rsb) { float l, r; @@ -1432,7 +1430,7 @@ getnativecharsidebearings(int font, int ch, scaled* lsb, scaled* rsb) } scaled -getnativecharic(int f, int c) +getnativecharic(integer f, integer c) { scaled lsb, rsb; getnativecharsidebearings(f, c, &lsb, &rsb); @@ -1443,7 +1441,7 @@ getnativecharic(int f, int c) } scaled -getnativecharwd(int f, int c) +getnativecharwd(integer f, integer c) { scaled wd = 0; #ifdef XETEX_MAC @@ -1515,7 +1513,7 @@ measure_native_node(void* pNode, int use_glyph_metrics) void* glyph_info = 0; static float* positions = 0; static UInt32* glyphs = 0; - static long maxGlyphs = 0; + static int maxGlyphs = 0; FixedPoint* locations; UInt16* glyphIDs; @@ -1591,7 +1589,7 @@ measure_native_node(void* pNode, int use_glyph_metrics) node_width(node) = X2Fix(wid); native_glyph_count(node) = realGlyphCount; - native_glyph_info_ptr(node) = (long)glyph_info; + native_glyph_info_ptr(node) = glyph_info; } else { int i; @@ -1632,7 +1630,7 @@ measure_native_node(void* pNode, int use_glyph_metrics) } native_glyph_count(node) = realGlyphCount; - native_glyph_info_ptr(node) = (long)glyph_info; + native_glyph_info_ptr(node) = glyph_info; } ubidi_close(pBiDi); @@ -1787,8 +1785,8 @@ measure_native_glyph(void* pNode, int use_glyph_metrics) } } -int -mapchartoglyph(int font, unsigned int ch) +integer +mapchartoglyph(integer font, integer ch) { if (ch > 0x10ffff || ((ch >= 0xd800) && (ch <= 0xdfff))) return 0; @@ -1805,8 +1803,8 @@ mapchartoglyph(int font, unsigned int ch) } } -int -mapglyphtoindex(int font) +integer +mapglyphtoindex(integer font) /* glyph name is at nameoffile+1 */ { #ifdef XETEX_MAC @@ -1822,8 +1820,8 @@ mapglyphtoindex(int font) } } -int -getfontcharrange(int font, int first) +integer +getfontcharrange(integer font, int first) { #ifdef XETEX_MAC if (fontarea[font] == AAT_FONT_FLAG) @@ -1928,10 +1926,10 @@ atsugetfontmetrics(ATSUStyle style, Fixed* ascent, Fixed* descent, Fixed* xheigh #endif } -long +int atsufontget(int what, ATSUStyle style) { - long rval = -1; + int rval = -1; #ifdef XETEX_MAC ATSUFontID fontID; @@ -1966,10 +1964,10 @@ atsufontget(int what, ATSUStyle style) return rval; } -long +int atsufontget1(int what, ATSUStyle style, int param) { - long rval = -1; + int rval = -1; #ifdef XETEX_MAC ATSUFontID fontID; @@ -2026,10 +2024,10 @@ atsufontget1(int what, ATSUStyle style, int param) return rval; } -long +int atsufontget2(int what, ATSUStyle style, int param1, int param2) { - long rval = -1; + int rval = -1; #ifdef XETEX_MAC ATSUFontID fontID; @@ -2063,10 +2061,10 @@ atsufontget2(int what, ATSUStyle style, int param1, int param2) return rval; } -long +int atsufontgetnamed(int what, ATSUStyle style) { - long rval = -1; + int rval = -1; #ifdef XETEX_MAC ATSUFontID fontID; @@ -2090,10 +2088,10 @@ atsufontgetnamed(int what, ATSUStyle style) return rval; } -long +int atsufontgetnamed1(int what, ATSUStyle style, int param) { - long rval = -1; + int rval = -1; #ifdef XETEX_MAC ATSUFontID fontID; @@ -2220,7 +2218,7 @@ atsuprintfontname(int what, ATSUStyle style, int param1, int param2) } void -printglyphname(int font, int gid) +printglyphname(integer font, integer gid) { char* s; int len = 0; @@ -2243,8 +2241,8 @@ printglyphname(int font, int gid) printchar(*s++); } -boolean -u_open_in(unicodefile* f, int filefmt, const_string fopen_mode, int mode, int encodingData) +int +u_open_in(unicodefile* f, integer filefmt, const_string fopen_mode, integer mode, integer encodingData) { boolean rval; *f = malloc(sizeof(UFILE)); @@ -2287,7 +2285,7 @@ u_open_in(unicodefile* f, int filefmt, const_string fopen_mode, int mode, int en return rval; } -boolean +int open_dvi_output(FILE** fptr) { if (nopdfoutput) { @@ -2391,7 +2389,7 @@ get_uni_c(UFILE* f) return rval; } -boolean +int input_line(UFILE* f) { int i; diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.h b/Build/source/texk/web2c/xetexdir/XeTeX_ext.h index 45d71cca8d1..74d1851b69a 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.h +++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.h @@ -141,10 +141,10 @@ typedef struct { #define node_width(node) node[width_offset].cint #define node_depth(node) node[depth_offset].cint #define node_height(node) node[height_offset].cint -#define native_length(node) node[native_info_offset].hh.v.RH -#define native_font(node) node[native_info_offset].hh.b1 -#define native_glyph_count(node) node[native_glyph_info_offset].hh.v.LH -#define native_glyph_info_ptr(node) node[native_glyph_info_offset].hh.v.RH +#define native_length(node) node[native_info_offset].qqqq.b2 +#define native_font(node) node[native_info_offset].qqqq.b1 +#define native_glyph_count(node) node[native_info_offset].qqqq.b3 +#define native_glyph_info_ptr(node) node[native_glyph_info_offset].ptr #define native_glyph_info_size 10 /* info for each glyph is location (FixedPoint) + glyph ID (UInt16) */ #define native_glyph(p) native_length(p) /* glyph ID field in a glyph_node */ @@ -206,6 +206,8 @@ extern const UInt32 kSurrogateLowEnd; extern const UInt32 byteMask; extern const UInt32 byteMark; +#include <stdio.h> /* for FILE */ + #include "trans.h" #ifdef __cplusplus @@ -213,51 +215,62 @@ extern "C" { #endif void initversionstring(char **versions); - void setinputfileencoding(unicodefile f, int mode, int encodingData); + void setinputfileencoding(unicodefile f, integer mode, integer encodingData); void uclose(unicodefile f); int input_line_icu(unicodefile f); - void linebreakstart(int localeStrNum, const UniChar* text, int textLength); + void linebreakstart(integer localeStrNum, const UniChar* text, integer textLength); int linebreaknext(); - long getencodingmodeandinfo(long* info); + int getencodingmodeandinfo(integer* info); void printutf8str(const unsigned char* str, int len); void printchars(const unsigned short* str, int len); void* load_mapping_file(const char* s, const char* e); - void* findnativefont(unsigned char* name, long scaled_size); + void* findnativefont(unsigned char* name, integer scaled_size); void releasefontengine(void* engine, int type_flag); - /* 'integer' params here are really TeX 'scaled' values, but that typedef isn't available every place this is included */ + /* the metrics params here are really TeX 'scaled' values, but that typedef isn't available every place this is included */ void otgetfontmetrics(void* engine, integer* ascent, integer* descent, integer* xheight, integer* capheight, integer* slant); - void getnativecharheightdepth(int font, int ch, integer* height, integer* depth); - void getnativecharsidebearings(int font, int ch, integer* lsb, integer* rsb); + void getnativecharheightdepth(integer font, integer ch, integer* height, integer* depth); + void getnativecharsidebearings(integer font, integer ch, integer* lsb, integer* rsb); /* single-purpose metrics accessors */ - integer getnativecharwd(int font, int ch); - integer getnativecharht(int font, int ch); - integer getnativechardp(int font, int ch); - integer getnativecharic(int font, int ch); - - long otfontget(int what, void* engine); - long otfontget1(int what, void* engine, long param); - long otfontget2(int what, void* engine, long param1, long param2); - long otfontget3(int what, void* engine, long param1, long param2, long param3); + integer getnativecharwd(integer font, integer ch); + integer getnativecharht(integer font, integer ch); + integer getnativechardp(integer font, integer ch); + integer getnativecharic(integer font, integer ch); + + long otfontget(integer what, void* engine); + long otfontget1(integer what, void* engine, integer param); + long otfontget2(integer what, void* engine, integer param1, integer param2); + long otfontget3(integer what, void* engine, integer param1, integer param2, integer param3); int makeXDVGlyphArrayData(void* p); - long makefontdef(long f); + int makefontdef(integer f); int applymapping(void* cnv, const UniChar* txtPtr, int txtLen); void store_justified_native_glyphs(void* node); void measure_native_node(void* node, int use_glyph_metrics); Fixed get_native_ital_corr(void* node); Fixed get_native_glyph_ital_corr(void* node); void measure_native_glyph(void* node, int use_glyph_metrics); - int mapchartoglyph(int font, unsigned int ch); - int mapglyphtoindex(int font); - + integer mapchartoglyph(integer font, integer ch); + integer mapglyphtoindex(integer font); + integer getfontcharrange(integer font, int first); + void printglyphname(integer font, integer gid); + + double read_double(const char** s); + unsigned int read_rgb_a(const char** cp); + const char* getGlyphNamePtr(const char* buffer, int tableSize, UInt16 gid, int* len); int find_pic_file(char** path, realrect* bounds, int pdfBoxType, int page); + int u_open_in(unicodefile* f, integer filefmt, const char* fopen_mode, integer mode, integer encodingData); + int open_dvi_output(FILE** fptr); + void dviclose(FILE* fptr); + int get_uni_c(UFILE* f); + int input_line(UFILE* f); + void makeutf16name(); #ifdef XETEX_MAC /* functions in XeTeX_mac.c */ - void* loadAATfont(ATSFontRef fontRef, long scaled_size, const char* cp1); + void* loadAATfont(ATSFontRef fontRef, integer scaled_size, const char* cp1); void DoAtsuiLayout(void* node, int justify); void GetGlyphBBox_AAT(ATSUStyle style, UInt16 gid, GlyphBBox* bbox); float GetGlyphWidth_AAT(ATSUStyle style, UInt16 gid); diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_mac.c b/Build/source/texk/web2c/xetexdir/XeTeX_mac.c index 6aba6083f41..4c64a65feb4 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeX_mac.c +++ b/Build/source/texk/web2c/xetexdir/XeTeX_mac.c @@ -162,7 +162,7 @@ DoAtsuiLayout(void* p, int justify) lsDelta -= lsUnit; native_glyph_count(node) = realGlyphCount; - native_glyph_info_ptr(node) = (long)glyph_info; + native_glyph_info_ptr(node) = glyph_info; if (!justify) node_width(node) = FixedPStoTeXPoints(layoutRec[count-1].realPos) + lsDelta; diff --git a/Build/source/texk/web2c/xetexdir/jpegimage.c b/Build/source/texk/web2c/xetexdir/jpegimage.c index 165a675f6f6..a70c4241c35 100644 --- a/Build/source/texk/web2c/xetexdir/jpegimage.c +++ b/Build/source/texk/web2c/xetexdir/jpegimage.c @@ -81,6 +81,8 @@ #include <memory.h> +#include "kpathsea/lib.h" /* for xmalloc/xrealloc prototypes */ + #define JPEG_DEBUG_STR "JPEG" #define JPEG_DEBUG 3 diff --git a/Build/source/texk/web2c/xetexdir/xetex-new.ch b/Build/source/texk/web2c/xetexdir/xetex-new.ch index 006ff12d1f2..9293ecd23ad 100644 --- a/Build/source/texk/web2c/xetexdir/xetex-new.ch +++ b/Build/source/texk/web2c/xetexdir/xetex-new.ch @@ -56,7 +56,7 @@ @d XeTeX_version=0 @d XeTeX_revision==".996" -@d XeTeX_version_string=='-0.996' {current \XeTeX\ version} +@d XeTeX_version_string=='-0.996-patch1' {current \XeTeX\ version} @z @x @@ -706,29 +706,28 @@ if max_quarterword-min_quarterword<@"FFFF then bad:=19; To support ``native'' fonts, we build |native_word_nodes|, which are variable size whatsits. These have the same |width|, |depth|, and |height| fields as a |box_node|, at offsets 1-3, -and then a word containing a size field for the node, a font number, and a length. -Then there is a field containing two halfwords, a glyph count and a C pointer to a glyph info array; -these are set by |set_native_metrics|. Copying and freeing of these nodes needs to take account of this! +and then a word containing a size field for the node, a font number, a length, and a glyph count. +Then there is a field containing a C pointer to a glyph info array; +this and the glyph count are set by |set_native_metrics|. +Copying and freeing of these nodes needs to take account of this! This is followed by |length| bytes, for the actual characters of the string. (Yes, we count in bytes, even though what we store there is UTF-16.) So |native_node_size|, which does not include any space for the actual text, is 6.} -@d deleted_native_node=41 {native words that have been superseded by their successors} - @d native_node_size=6 {size of a native_word node (plus the actual chars) -- see also xetex.h} -@d native_size(#)==mem[#+4].hh.b0 -@d native_font(#)==mem[#+4].hh.b1 -@d native_length(#)==mem[#+4].hh.rh -@d native_glyph_count(#)==mem[#+5].hh.lh -@d native_glyph_info_ptr(#)==mem[#+5].hh.rh +@d native_size(#)==mem[#+4].qqqq.b0 +@d native_font(#)==mem[#+4].qqqq.b1 +@d native_length(#)==mem[#+4].qqqq.b2 +@d native_glyph_count(#)==mem[#+4].qqqq.b3 +@d native_glyph_info_ptr(#)==mem[#+5].ptr @d native_glyph_info_size=10 { number of bytes of info per glyph: 16-bit glyph ID, 32-bit x and y coords } @d free_native_glyph_info(#) == begin - if native_glyph_info_ptr(#) <> 0 then begin - libc_free(cast_to_ptr(native_glyph_info_ptr(#))); - native_glyph_info_ptr(#) := 0; + if native_glyph_info_ptr(#) <> null_ptr then begin + libc_free(native_glyph_info_ptr(#)); + native_glyph_info_ptr(#) := null_ptr; native_glyph_count(#) := 0; end end @@ -736,10 +735,10 @@ So |native_node_size|, which does not include any space for the actual text, is @p procedure copy_native_glyph_info(src:pointer; dest:pointer); var glyph_count:integer; begin - if native_glyph_info_ptr(src) <> 0 then begin + if native_glyph_info_ptr(src) <> null_ptr then begin glyph_count := native_glyph_count(src); - native_glyph_info_ptr(dest) := cast_to_integer(xmalloc_array(char, glyph_count * native_glyph_info_size)); - memcpy(cast_to_ptr(native_glyph_info_ptr(dest)), cast_to_ptr(native_glyph_info_ptr(src)), glyph_count * native_glyph_info_size); + native_glyph_info_ptr(dest) := xmalloc_array(char, glyph_count * native_glyph_info_size); + memcpy(native_glyph_info_ptr(dest), native_glyph_info_ptr(src), glyph_count * native_glyph_info_size); native_glyph_count(dest) := glyph_count; end end; @@ -2936,8 +2935,7 @@ done: end @ @<Advance |q| past ignorable nodes@>= -while (q <> null) and (not is_char_node(q)) - and ( (type(q) = disc_node) or ((type(q) = whatsit_node) and (subtype(q) = deleted_native_node)) ) do +while (q <> null) and (not is_char_node(q)) and (type(q) = disc_node) do q := link(q) @ We ought to give special care to the efficiency of one part of |hlist_out|, @@ -3293,7 +3291,6 @@ label done,done1,done2,done3,done4,done5,done6,continue, restart; or (subtype(v)=pic_node) or (subtype(v)=pdf_node) then break_width[1]:=break_width[1]-width(v) - else if subtype(v)=deleted_native_node then do_nothing else confusion("disc1a"); othercases confusion("disc1") @z @@ -3307,7 +3304,6 @@ label done,done1,done2,done3,done4,done5,done6,continue, restart; or (subtype(s)=pic_node) or (subtype(s)=pdf_node) then break_width[1]:=break_width[1]+width(s) - else if subtype(s)=deleted_native_node then do_nothing else confusion("disc2a"); othercases confusion("disc2") @z @@ -3327,7 +3323,6 @@ label done,done1,done2,done3,done4,done5,done6,continue, restart; or (subtype(s)=pic_node) or (subtype(s)=pdf_node) then disc_width:=disc_width+width(s) - else if subtype(s)=deleted_native_node then do_nothing else confusion("disc3a"); othercases confusion("disc3") @z @@ -3341,7 +3336,6 @@ label done,done1,done2,done3,done4,done5,done6,continue, restart; or (subtype(s)=pic_node) or (subtype(s)=pdf_node) then act_width:=act_width+width(s) - else if subtype(s)=deleted_native_node then do_nothing else confusion("disc4a"); othercases confusion("disc4") @z @@ -3784,7 +3778,7 @@ hmode+char_num: begin scan_usv_num; cur_chr:=cur_val; goto main_loop;@+end; @!main_p:pointer; {temporary register for list manipulation} @y @!main_p:pointer; {temporary register for list manipulation} -@!main_pp:pointer; {another temporary register for list manipulation} +@!main_pp,@!main_ppp:pointer; {more temporary registers for list manipulation} @!main_h:pointer; {temp for hyphen offset in native-font text} @!is_hyph:boolean; {whether the last char seen is the font's hyphenchar} @z @@ -3859,11 +3853,22 @@ collect_native: if mode=hmode then begin + main_ppp := head; + if main_ppp<>main_pp then + while (link(main_ppp)<>main_pp) do + main_ppp:=link(main_ppp); { find node preceding tail } + temp_ptr := str_start_macro(str_ptr); repeat if main_h = 0 then main_h := main_k; - if (not is_char_node(main_pp)) and (type(main_pp)=whatsit_node) and (subtype(main_pp)=native_word_node) and (native_font(main_pp)=main_f) then begin + if (not is_char_node(main_pp)) + and (type(main_pp)=whatsit_node) + and (subtype(main_pp)=native_word_node) + and (native_font(main_pp)=main_f) + and (main_ppp<>main_pp) + and type(main_ppp)<>disc_node + then begin { make a new temp string that contains the concatenated text of |tail| + the current word/fragment } main_k := main_h + native_length(main_pp); @@ -3888,9 +3893,13 @@ collect_native: do incr(main_h); { look for next hyphen or end of text } if (main_h < main_k) then incr(main_h); - { flag the previous node as no longer valid } - free_native_glyph_info(main_pp); - subtype(main_pp) := deleted_native_node; + { remove the preceding node from the list } + link(main_ppp) := link(main_pp); + link(main_pp) := null; + flush_node_list(main_pp); + main_pp := tail; + while (link(main_ppp)<>main_pp) do + main_ppp:=link(main_ppp); end else begin @@ -3929,9 +3938,14 @@ collect_native: set_native_char(tail, main_p + native_length(main_pp), str_pool[str_start_macro(str_ptr) + main_p]); set_native_metrics(tail, XeTeX_use_glyph_metrics); - { flag the previous node as no longer valid } - free_native_glyph_info(main_pp); - subtype(main_pp) := deleted_native_node; + { remove the preceding node from the list } + main_p := head; + if main_p<>main_pp then + while link(main_p)<>main_pp do + main_p := link(main_p); + link(main_p) := link(main_pp); + link(main_pp) := null; + flush_node_list(main_pp); end else begin { package the current string into a |native_word| whatsit } link(main_pp) := new_native_word_node(main_f, main_k); @@ -3997,7 +4011,6 @@ begin if tail<>head then @y if type(p)<>kern_node then if type(p)<>ligature_node then if (type(p)<>whatsit_node) or ((subtype(p)<>native_word_node) - and (subtype(p)<>deleted_native_node) and (subtype(p)<>glyph_node)) then begin print_err("Improper discretionary list"); @z @@ -4802,8 +4815,10 @@ native_word_node:begin print_char(" "); print_native_word(p); end; +@{ deleted_native_node: print("[DELETED]"); +@} glyph_node:begin print_esc(font_id_text(native_font(p))); print(" glyph#"); @@ -4837,12 +4852,9 @@ native_word_node: begin words:=native_size(p); r:=get_node(words); while words > 0 do begin decr(words); mem[r+words]:=mem[p+words]; end; - native_glyph_info_ptr(r):=0; native_glyph_count(r):=0; + native_glyph_info_ptr(r):=null_ptr; native_glyph_count(r):=0; copy_native_glyph_info(p, r); end; -deleted_native_node: begin words:=native_size(p); - r:=get_node(words); - end; glyph_node: begin r:=get_node(glyph_node_size); words:=glyph_node_size; end; @@ -4858,7 +4870,6 @@ othercases confusion("ext2") othercases confusion("ext3") @y native_word_node: begin free_native_glyph_info(p); free_node(p,native_size(p)); end; -deleted_native_node: free_node(p,native_size(p)); glyph_node: free_node(p,glyph_node_size); pic_node,pdf_node: free_node(p,total_pic_node_size(p)); pdf_save_pos_node: @@ -5106,7 +5117,7 @@ begin dvi_two(native_glyph(p)); cur_h := cur_h + width(p); end else begin - if native_glyph_info_ptr(p) <> 0 then begin + if native_glyph_info_ptr(p) <> null_ptr then begin len := make_xdv_glyph_array_data(p); for k := 0 to len-1 do dvi_out(xdv_buffer_byte(k)); @@ -5231,7 +5242,7 @@ end; @x language_node:do_nothing; @y -language_node,deleted_native_node:do_nothing; +language_node:do_nothing; @z @x @@ -6012,6 +6023,11 @@ whatsit_node: goto next_p; @ Here we compute the effective width of a glue node as in |hlist_out|. + +@<Cases of |reverse|...@>= +glue_node: begin round_glue; + @<Handle a glue node for mixed...@>; + end; @z @x @@ -6106,7 +6122,7 @@ begin native_length(q) := n; native_glyph_count(q) := 0; - native_glyph_info_ptr(q) := 0; + native_glyph_info_ptr(q) := null_ptr; new_native_word_node := q; end; @@ -6163,7 +6179,7 @@ begin native_size(p) := native_node_size + 1; native_glyph_count(p) := 0; - native_glyph_info_ptr(p) := 0; + native_glyph_info_ptr(p) := null_ptr; native_font(p) := f; if c > @"FFFF then begin diff --git a/Build/source/texk/web2c/xetexdir/xetex.defines b/Build/source/texk/web2c/xetexdir/xetex.defines index 222ed2717a0..218d8228c97 100644 --- a/Build/source/texk/web2c/xetexdir/xetex.defines +++ b/Build/source/texk/web2c/xetexdir/xetex.defines @@ -32,6 +32,8 @@ authorization from SIL International. { xetex.defines: additions for xetex } +@define @field ptr; +@define const nullptr; @define type voidpointer; @define function getnativechar(); @define procedure setnativechar(); diff --git a/Build/source/texk/web2c/xetexdir/xetex.h b/Build/source/texk/web2c/xetexdir/xetex.h index 951ac4d7632..60ac046a0b8 100644 --- a/Build/source/texk/web2c/xetexdir/xetex.h +++ b/Build/source/texk/web2c/xetexdir/xetex.h @@ -63,8 +63,7 @@ void* getotassemblyptr(int f, int g); /* function in XeTeXOTMath.cpp */ #define dviopenout(f) open_dvi_output(&(f)) -#define casttoptr(x) (void*)(x) -#define casttointeger(x) (long)(x) +#define nullptr (NULL) #define glyphinfobyte(p,k) ((unsigned char*)p)[k] #define casttoushort(x) (unsigned short)(x) diff --git a/Build/source/texk/web2c/xetexdir/xetex.mk b/Build/source/texk/web2c/xetexdir/xetex.mk index 8e0ee43964f..0c54f08a093 100644 --- a/Build/source/texk/web2c/xetexdir/xetex.mk +++ b/Build/source/texk/web2c/xetexdir/xetex.mk @@ -275,7 +275,7 @@ xefmts: $(all_xefmts) xefmtdir = $(web2cdir)/xetex $(xefmtdir):: - $(SHELL) $(top_srcdir)/../mkinstalldirs $(xefmtdir) + $(SHELL) $(top_srcdir)/../mkinstalldirs ${DESTDIR}$(xefmtdir) xetex.fmt: xetex $(dumpenv) $(MAKE) progname=xetex files="xetex.ini unicode-letters.tex plain.tex cmr10.tfm" prereq-check @@ -294,7 +294,7 @@ install-xetex-dumps: install-xetex-fmts install-programs: @XETEX@ install-xetex-programs install-xetex-programs: xetex $(bindir) - for p in xetex; do $(INSTALL_LIBTOOL_PROG) $$p $(bindir); done + for p in xetex; do $(INSTALL_LIBTOOL_PROG) $$p ${DESTDIR}$(bindir); done install-links: @XETEX@ install-xetex-links install-xetex-links: install-xetex-programs @@ -304,13 +304,13 @@ install-xetex-links: install-xetex-programs install-fmts: @XETEX@ install-xetex-fmts install-xetex-fmts: xefmts $(xefmtdir) xefmts="$(all_xefmts)"; \ - for f in $$xefmts; do $(INSTALL_DATA) $$f $(xefmtdir)/$$f; done + for f in $$xefmts; do $(INSTALL_DATA) $$f ${DESTDIR}$(xefmtdir)/$$f; done xefmts="$(xefmts)"; \ for f in $$xefmts; do base=`basename $$f .fmt`; \ - (cd $(bindir) && (rm -f $$base; $(LN) xetex $$base)); done + (cd ${DESTDIR}$(bindir) && (rm -f $$base; $(LN) xetex $$base)); done install-data:: @XETEX@ install-xetex-data install-xetex-pool: xetex.pool $(texpooldir) - $(INSTALL_DATA) xetex.pool $(texpooldir)/xetex.pool + $(INSTALL_DATA) xetex.pool ${DESTDIR}$(texpooldir)/xetex.pool # end of xetex.mk diff --git a/Build/source/texk/xdvipdfmx/src/tt_cmap.c b/Build/source/texk/xdvipdfmx/src/tt_cmap.c index 1681dad8230..ea8fb0e304e 100644 --- a/Build/source/texk/xdvipdfmx/src/tt_cmap.c +++ b/Build/source/texk/xdvipdfmx/src/tt_cmap.c @@ -303,6 +303,9 @@ lookup_cmap4 (struct cmap4 *map, USHORT cc) if (cc >= map->startCount[i]) { if (map->idRangeOffset[i] == 0) { gid = (cc + map->idDelta[i]) & 0xffff; + } else if (cc == 0xffff && map->idRangeOffset[i] == 0xffff) { + /* this is for protection against some old broken fonts... */ + gid = 0; } else { j = map->idRangeOffset[i] - (segCount - i) * 2; j = (cc - map->startCount[i]) + (j / 2); @@ -630,6 +633,9 @@ load_cmap4 (struct cmap4 *map, ch = c0 + j; if (map->idRangeOffset[i] == 0) { gid = (ch + map->idDelta[i]) & 0xffff; + } else if (c0 == 0xffff && c1 == 0xffff && map->idRangeOffset[i] == 0xffff) { + /* this is for protection against some old broken fonts... */ + gid = 0; } else { gid = (map->glyphIndexArray[j+d] + map->idDelta[i]) & 0xffff; @@ -952,6 +958,9 @@ create_ToUnicode_cmap4 (struct cmap4 *map, ch = c0 + j; if (map->idRangeOffset[i] == 0) { gid = (ch + map->idDelta[i]) & 0xffff; + } else if (c0 == 0xffff && c1 == 0xffff && map->idRangeOffset[i] == 0xffff) { + /* this is for protection against some old broken fonts... */ + gid = 0; } else { gid = (map->glyphIndexArray[j+d] + map->idDelta[i]) & 0xffff; |