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/web2c/xetexdir/XeTeX_ext.c | |
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/web2c/xetexdir/XeTeX_ext.c')
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeX_ext.c | 70 |
1 files changed, 62 insertions, 8 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; } |