diff options
author | Jonathan Kew <jfkthame@googlemail.com> | 2008-05-08 13:28:50 +0000 |
---|---|---|
committer | Jonathan Kew <jfkthame@googlemail.com> | 2008-05-08 13:28:50 +0000 |
commit | 151f5e5cae3fca2c5d0e491407c0fe3a30a9b51e (patch) | |
tree | f6e77ab0cdbd9bc43d3c47f8854b24b19016eac5 /Build/source/texk | |
parent | 9a180498bb6fa5da4c6a89525815ea5939cf0842 (diff) |
update xetex to 0.998.2-dev, svn r.670
git-svn-id: svn://tug.org/texlive/trunk@7938 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeX_ext.c | 70 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeX_ext.h | 6 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/xetex.ch | 98 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/xetex.defines | 3 |
4 files changed, 166 insertions, 11 deletions
diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c index 0e90547c385..6ee4089f796 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c +++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c @@ -594,8 +594,14 @@ printchars(const unsigned short* str, int len) printchar(*(str++)); } +#ifdef WORDS_BIGENDIAN +#define UTF16_NATIVE kForm_UTF16BE +#else +#define UTF16_NATIVE kForm_UTF16LE +#endif + void* -load_mapping_file(const char* s, const char* e) +load_mapping_file(const char* s, const char* e, char byteMapping) { char* mapPath; TECkit_Converter cnv = 0; @@ -618,13 +624,15 @@ load_mapping_file(const char* s, const char* e) mapping = xmalloc(mappingSize); fread(mapping, 1, mappingSize, mapFile); fclose(mapFile); - status = TECkit_CreateConverter(mapping, mappingSize, + if (byteMapping != 0) + status = TECkit_CreateConverter(mapping, mappingSize, + false, + UTF16_NATIVE, kForm_Bytes, + &cnv); + else + status = TECkit_CreateConverter(mapping, mappingSize, true, -#ifdef WORDS_BIGENDIAN - kForm_UTF16BE, kForm_UTF16BE, -#else - kForm_UTF16LE, kForm_UTF16LE, -#endif + UTF16_NATIVE, UTF16_NATIVE, &cnv); free(mapping); } @@ -637,6 +645,52 @@ load_mapping_file(const char* s, const char* e) return cnv; } +char *saved_mapping_name = NULL; +void +checkfortfmfontmapping() +{ + char* cp = strstr((char*)nameoffile + 1, ":mapping="); + if (saved_mapping_name != NULL) { + free(saved_mapping_name); + saved_mapping_name = NULL; + } + if (cp != NULL) { + *cp = 0; + cp += 9; + while (*cp && *cp <= ' ') + ++cp; + if (*cp) + saved_mapping_name = xstrdup(cp); + } +} + +void* +loadtfmfontmapping() +{ + void* rval = NULL; + if (saved_mapping_name != NULL) { + rval = load_mapping_file(saved_mapping_name, + saved_mapping_name + strlen(saved_mapping_name), 1); + free(saved_mapping_name); + saved_mapping_name = NULL; + } + return rval; +} + +int +applytfmfontmapping(void* cnv, int c) +{ + UniChar in = c; + Byte out[2]; + UInt32 inUsed, outUsed; + TECkit_Status status = TECkit_ConvertBuffer((TECkit_Converter)cnv, + (const Byte*)&in, sizeof(in), &inUsed, out, sizeof(out), &outUsed, 1); + if (outUsed < 1) + return 0; + else + return out[0]; +} + double read_double(const char** s) { @@ -765,7 +819,7 @@ readCommonFeatures(const char* feat, const char* end, float* extend, float* slan sep = feat + 7; if (*sep != '=') return -1; - loadedfontmapping = load_mapping_file(sep + 1, end); + loadedfontmapping = load_mapping_file(sep + 1, end, 0); return 1; } diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.h b/Build/source/texk/web2c/xetexdir/XeTeX_ext.h index 3fd3a25a81d..3f07ce07bc4 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.h +++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.h @@ -225,7 +225,7 @@ extern "C" { 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* load_mapping_file(const char* s, const char* e, char byteMapping); void* findnativefont(unsigned char* name, integer scaled_size); void releasefontengine(void* engine, int type_flag); int readCommonFeatures(const char* feat, const char* end, float* extend, float* slant, float* embolden, float* letterspace, UInt32* rgbValue); @@ -281,6 +281,10 @@ extern "C" { void terminatefontmanager(); int maketexstring(const char* s); + void checkfortfmfontmapping(); + void* loadtfmfontmapping(); + int applytfmfontmapping(void* mapping, int c); + #ifndef XETEX_MAC typedef void* ATSUStyle; /* dummy declaration just so the stubs can compile */ #endif diff --git a/Build/source/texk/web2c/xetexdir/xetex.ch b/Build/source/texk/web2c/xetexdir/xetex.ch index 934c7123832..da084242e35 100644 --- a/Build/source/texk/web2c/xetexdir/xetex.ch +++ b/Build/source/texk/web2c/xetexdir/xetex.ch @@ -64,8 +64,8 @@ authorization from SIL International. @d eTeX_version_string=='-2.2' {current \eTeX\ version} @d XeTeX_version=0 -@d XeTeX_revision==".998.1" -@d XeTeX_version_string=='-0.998.1' {current \XeTeX\ version} +@d XeTeX_revision==".998" +@d XeTeX_version_string=='-0.998.2-dev' {current \XeTeX\ version} @z @x @@ -3418,11 +3418,20 @@ file_opened:=false; if not b_open_in(tfm_file) then abort; file_opened:=true @y +check_for_tfm_font_mapping; if b_open_in(tfm_file) then begin file_opened:=true @z @x +fmem_ptr:=fmem_ptr+lf; font_ptr:=f; g:=f; goto done +@y +fmem_ptr:=fmem_ptr+lf; font_ptr:=f; g:=f; +font_mapping[f]:=load_tfm_font_mapping; +goto done +@z + +@x @ When \TeX\ wants to typeset a character that doesn't exist, the character node is not created; thus the output routine can assume that characters exist when it sees them. The following procedure @@ -3553,6 +3562,13 @@ procedure dvi_font_def(@!f:internal_font_number); @z @x +var k:pool_pointer; {index into |str_pool|} +@y +var k:pool_pointer; {index into |str_pool|} +l:integer; {length of name without mapping option} +@z + +@x begin if f<=256+font_base then @y begin if is_native_font(f) then dvi_native_font_def(f) else @@ -3560,10 +3576,24 @@ begin if f<=256+font_base then @z @x +dvi_out(length(font_name[f])); @<Output the font name whose internal number is |f|@>; @y +if font_mapping[f]<>nil then begin + l:=0; + k:=str_start_macro(font_name[f]); + while (l=0) and (k<str_start_macro(font_name[f]+1)) do begin + if so(str_pool[k]) = ":" then l:=k-str_start_macro(font_name[f]); + incr(k); + end; + dvi_out(l); + for k:=str_start_macro(font_name[f]) to str_start_macro(font_name[f])+l-1 do + dvi_out(so(str_pool[k])); +end else begin +dvi_out(length(font_name[f])); @<Output the font name whose internal number is |f|@>; end; +end; @z @x @@ -3734,6 +3764,13 @@ while (q <> null) and (not is_char_node(q)) and (type(q) = disc_node) do @z @x + repeat f:=font(p); c:=character(p); +@y + repeat f:=font(p); c:=character(p); + if (p<>lig_trick) and (font_mapping[f]<>nil) then c:=apply_tfm_font_mapping(font_mapping[f],c); +@z + +@x @p procedure vlist_out; {output a |vlist_node| box} @y @p procedure vlist_out; {output a |vlist_node| box} @@ -3922,6 +3959,12 @@ label reswitch, common_ending, exit, restart; @z @x +p:=lig_trick; goto reswitch; +@y +p:=lig_trick; ligature_present:=true; goto reswitch; +@z + +@x @d vpack(#)==vpackage(#,max_dimen) {special case of unconstrained depth} @y @d vpack(#)==vpackage(#,max_dimen) {special case of unconstrained depth} @@ -4871,6 +4914,13 @@ label done,done1,done2,done3,done4,done5,done6,continue, restart; @z @x + ligature_node: begin f:=font(lig_char(v));@/ +@y + ligature_node: begin f:=font(lig_char(v));@/ + ligature_present:=true; +@z + +@x othercases confusion("disc1") @y whatsit_node: @@ -4884,6 +4934,13 @@ label done,done1,done2,done3,done4,done5,done6,continue, restart; @z @x + ligature_node: begin f:=font(lig_char(s)); +@y + ligature_node: begin f:=font(lig_char(s)); + ligature_present:=true; +@z + +@x othercases confusion("disc2") @y whatsit_node: @@ -4903,6 +4960,20 @@ label done,done1,done2,done3,done4,done5,done6,continue, restart; @z @x +ligature_node: begin f:=font(lig_char(cur_p)); +@y +ligature_node: begin f:=font(lig_char(cur_p)); + ligature_present:=true; +@z + +@x + ligature_node: begin f:=font(lig_char(s)); +@y + ligature_node: begin f:=font(lig_char(s)); + ligature_present:=true; +@z + +@x othercases confusion("disc3") @y whatsit_node: @@ -4916,6 +4987,13 @@ label done,done1,done2,done3,done4,done5,done6,continue, restart; @z @x + ligature_node: begin f:=font(lig_char(s)); +@y + ligature_node: begin f:=font(lig_char(s)); + ligature_present:=true; +@z + +@x othercases confusion("disc4") @y whatsit_node: @@ -8417,6 +8495,22 @@ end; @z @x +begin result:=c; {return |c| unless it does not exist in the font} +@y +begin if (not ligature_present) and (font_mapping[f]<>nil) then + c:=apply_tfm_font_mapping(font_mapping[f],c); +result:=c; {return |c| unless it does not exist in the font} +@z + +@x +begin if not mltex_enabled_p then +@y +begin if (not ligature_present) and (font_mapping[f]<>nil) then + c:=apply_tfm_font_mapping(font_mapping[f],c); +if not mltex_enabled_p then +@z + +@x effective_char_info:=null_character; exit:end; @y diff --git a/Build/source/texk/web2c/xetexdir/xetex.defines b/Build/source/texk/web2c/xetexdir/xetex.defines index d1ccb6530e9..be239481b07 100644 --- a/Build/source/texk/web2c/xetexdir/xetex.defines +++ b/Build/source/texk/web2c/xetexdir/xetex.defines @@ -64,6 +64,9 @@ authorization from SIL International. @define function initpool(); @define type gzFile; @define function weof(); +@define procedure checkfortfmfontmapping; +@define function loadtfmfontmapping; +@define function applytfmfontmapping(); @define procedure initGraphiteBreaking(); @define function findNextGraphiteBreak(); |