summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/xetexdir
diff options
context:
space:
mode:
authorJonathan Kew <jfkthame@googlemail.com>2008-02-15 13:15:05 +0000
committerJonathan Kew <jfkthame@googlemail.com>2008-02-15 13:15:05 +0000
commit8ffd652f16549581f95dc60a3f383774a6df2e5d (patch)
treef9c1b0c48ec300c602ec2c89de8d2797b4046f4c /Build/source/texk/web2c/xetexdir
parente814a390ac12149e9d6a37d07cb403373de34ccb (diff)
sync with xetex repos. rev 572
git-svn-id: svn://tug.org/texlive/trunk@6636 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/xetexdir')
-rw-r--r--Build/source/texk/web2c/xetexdir/FontTableCache.cpp47
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp144
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeXFontMgr.h8
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp10
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.h19
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeX_ext.c100
-rw-r--r--Build/source/texk/web2c/xetexdir/xetex.ch287
-rw-r--r--Build/source/texk/web2c/xetexdir/xetex.mk6
8 files changed, 388 insertions, 233 deletions
diff --git a/Build/source/texk/web2c/xetexdir/FontTableCache.cpp b/Build/source/texk/web2c/xetexdir/FontTableCache.cpp
index 1e2a6c4237b..66636607c52 100644
--- a/Build/source/texk/web2c/xetexdir/FontTableCache.cpp
+++ b/Build/source/texk/web2c/xetexdir/FontTableCache.cpp
@@ -66,12 +66,6 @@ FontTableCache::initialize()
fTableCacheSize = 0;
return;
}
-
- for (int i = 0; i < fTableCacheSize; i += 1) {
- fTableCache[i].tag = 0;
- fTableCache[i].table = NULL;
- fTableCache[i].size = 0;
- }
}
FontTableCache::~FontTableCache()
@@ -83,10 +77,6 @@ void FontTableCache::dispose()
{
for (int i = fTableCacheCurr - 1; i >= 0; i -= 1) {
LE_DELETE_ARRAY(fTableCache[i].table);
-
- fTableCache[i].tag = 0;
- fTableCache[i].table = NULL;
- fTableCache[i].size = 0;
}
fTableCacheCurr = 0;
@@ -94,13 +84,20 @@ void FontTableCache::dispose()
const void *FontTableCache::find(LETag tableTag, le_uint32 *tableSize) const
{
- for (int i = 0; i < fTableCacheCurr; i += 1) {
- if (fTableCache[i].tag == tableTag) {
+ int lo = 0, hi = fTableCacheCurr;
+ while (lo < hi) {
+ int i = (lo + hi) >> 1;
+ const FontTableCacheEntry *e = fTableCache + i;
+ if (e->tag < tableTag)
+ lo = i + 1;
+ else if (e->tag > tableTag)
+ hi = i;
+ else {
if (tableSize != NULL)
- *tableSize = fTableCache[i].size;
- return fTableCache[i].table;
- }
- }
+ *tableSize = e->size;
+ return e->table;
+ }
+ }
le_uint32 length;
const void *table = readFontTable(tableTag, length);
@@ -119,18 +116,18 @@ void FontTableCache::add(LETag tableTag, const void *table, le_uint32 length)
fTableCache = (FontTableCacheEntry *) LE_GROW_ARRAY(fTableCache, newSize);
- for (le_int32 i = fTableCacheSize; i < newSize; i += 1) {
- fTableCache[i].tag = 0;
- fTableCache[i].table = NULL;
- fTableCache[i].size = 0;
- }
-
fTableCacheSize = newSize;
}
- fTableCache[fTableCacheCurr].tag = tableTag;
- fTableCache[fTableCacheCurr].table = table;
- fTableCache[fTableCacheCurr].size = length;
+ int i;
+ for (i = fTableCacheCurr; i > 0; --i) {
+ if (fTableCache[i-1].tag < tableTag)
+ break;
+ fTableCache[i] = fTableCache[i-1];
+ }
+ fTableCache[i].tag = tableTag;
+ fTableCache[i].table = table;
+ fTableCache[i].size = length;
fTableCacheCurr += 1;
}
diff --git a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp
index 15c6a600c79..8695c83567e 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp
+++ b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp
@@ -34,7 +34,6 @@ authorization from SIL International.
#include "XeTeXFontMgr_FC.h"
#endif
-#include "XeTeXLayoutInterface.h"
#include "XeTeXswap.h"
#include "Features.h"
@@ -44,6 +43,8 @@ authorization from SIL International.
#include <math.h>
+extern Fixed loadedfontdesignsize;
+
XeTeXFontMgr* XeTeXFontMgr::sFontManager = NULL;
char XeTeXFontMgr::sReqEngine = 0;
@@ -83,17 +84,22 @@ XeTeXFontMgr::Terminate()
PlatformFontRef
XeTeXFontMgr::findFont(const char* name, char* variant, double ptSize)
- // ptSize is in TeX points
+ // ptSize is in TeX points, or negative for 'scaled' factor
// "variant" string will be shortened (in-place) by removal of /B and /I if present
{
std::string nameStr(name);
Font* font = NULL;
+ int dsize = 100;
+ loadedfontdesignsize = 655360L;
+
for (int pass = 0; pass < 2; ++pass) {
// try full name as given
std::map<std::string,Font*>::iterator i = nameToFont.find(nameStr);
if (i != nameToFont.end()) {
font = i->second;
+ if (font->opSizeInfo.designSize != 0)
+ dsize = font->opSizeInfo.designSize;
break;
}
@@ -107,6 +113,8 @@ XeTeXFontMgr::findFont(const char* name, char* variant, double ptSize)
i = f->second->styles->find(style);
if (i != f->second->styles->end()) {
font = i->second;
+ if (font->opSizeInfo.designSize != 0)
+ dsize = font->opSizeInfo.designSize;
break;
}
}
@@ -116,6 +124,8 @@ XeTeXFontMgr::findFont(const char* name, char* variant, double ptSize)
i = psNameToFont.find(nameStr);
if (i != psNameToFont.end()) {
font = i->second;
+ if (font->opSizeInfo.designSize != 0)
+ dsize = font->opSizeInfo.designSize;
break;
}
@@ -179,7 +189,7 @@ XeTeXFontMgr::findFont(const char* name, char* variant, double ptSize)
Family* parent = font->parent;
// if there are variant requests, try to apply them
- // and delete B or I codes from the string
+ // and delete B, I, and S=... codes from the string, just retain /engine option
sReqEngine = 0;
bool reqBold = false;
bool reqItal = false;
@@ -248,9 +258,6 @@ XeTeXFontMgr::findFont(const char* name, char* variant, double ptSize)
++cp;
}
}
- if (varString.length() > 0 && *(varString.end() - 1) != '/')
- varString.append("/");
- varString.append(start, cp);
goto skip_to_slash;
}
@@ -359,8 +366,10 @@ XeTeXFontMgr::findFont(const char* name, char* variant, double ptSize)
}
// if there's optical size info, try to apply it
- if (font != NULL && font->opSizeInfo.subFamilyID != 0 && ptSize != 0.0) {
- ptSize = ptSize * 720 / 72.27; // convert TeX points to PS decipoints for comparison with the opSize values
+ if (ptSize < 0.0)
+ ptSize = dsize / 10.0;
+ if (font != NULL && font->opSizeInfo.subFamilyID != 0 && ptSize > 0.0) {
+ ptSize = ptSize * 10.0; // convert to decipoints for comparison with the opSize values
double bestMismatch = my_fmax(font->opSizeInfo.minSize - ptSize, ptSize - font->opSizeInfo.maxSize);
if (bestMismatch > 0.0) {
Font* bestMatch = font;
@@ -378,6 +387,9 @@ XeTeXFontMgr::findFont(const char* name, char* variant, double ptSize)
font = bestMatch;
}
}
+
+ if (font != NULL && font->opSizeInfo.designSize != 0)
+ loadedfontdesignsize = (font->opSizeInfo.designSize << 16L) / 10;
return font->fontRef;
}
@@ -450,58 +462,82 @@ XeTeXFontMgr::bestMatchFromFamily(const Family* fam, int wt, int wd, int slant)
return bestMatch;
}
+const XeTeXFontMgr::OpSizeRec*
+XeTeXFontMgr::getOpSizePtr(XeTeXFont font)
+{
+ const GlyphPositioningTableHeader* gposTable = (const GlyphPositioningTableHeader*)getFontTablePtr(font, LE_GPOS_TABLE_TAG);
+ if (gposTable != NULL) {
+ const FeatureListTable* featureListTable = (const FeatureListTable*)((const char*)gposTable + SWAP(gposTable->featureListOffset));
+ for (int i = 0; i < SWAP(featureListTable->featureCount); ++i) {
+ UInt32 tag = SWAPT(featureListTable->featureRecordArray[i].featureTag);
+ if (tag == LE_SIZE_FEATURE_TAG) {
+ const FeatureTable* feature = (const FeatureTable*)((const char*)featureListTable
+ + SWAP(featureListTable->featureRecordArray[i].featureTableOffset));
+ UInt16 offset = SWAP(feature->featureParamsOffset);
+ const OpSizeRec* pSizeRec;
+ /* if featureParamsOffset < (offset of feature from featureListTable),
+ then we have a correct size table;
+ otherwise we (presumably) have a "broken" one from the old FDK */
+ for (int i = 0; i < 2; ++i) {
+ if (i == 0)
+ pSizeRec = (const OpSizeRec*)((char*)feature + offset);
+ else
+ pSizeRec = (const OpSizeRec*)((char*)featureListTable + offset);
+ if (SWAP(pSizeRec->designSize) == 0)
+ continue; // incorrect 'size' feature format
+ if (SWAP(pSizeRec->subFamilyID) == 0
+ && SWAP(pSizeRec->nameCode) == 0
+ && SWAP(pSizeRec->minSize) == 0
+ && SWAP(pSizeRec->maxSize) == 0)
+ return pSizeRec; // feature is valid, but no 'size' range
+ if (SWAP(pSizeRec->designSize) < SWAP(pSizeRec->minSize)) // check values are valid
+ continue; // else try different interpretation
+ if (SWAP(pSizeRec->designSize) > SWAP(pSizeRec->maxSize))
+ continue;
+ if (SWAP(pSizeRec->maxSize) < SWAP(pSizeRec->minSize))
+ continue;
+ if (SWAP(pSizeRec->nameCode) < 256)
+ continue;
+ if (SWAP(pSizeRec->nameCode) > 32767)
+ continue;
+ return pSizeRec;
+ }
+ }
+ }
+ }
+
+ return NULL;
+}
+
+double
+XeTeXFontMgr::getDesignSize(XeTeXFont font)
+{
+ const OpSizeRec* pSizeRec = getOpSizePtr(font);
+ if (pSizeRec != NULL)
+ return SWAP(pSizeRec->designSize) / 10.0;
+ else
+ return 10.0;
+}
+
void
XeTeXFontMgr::getOpSizeRecAndStyleFlags(Font* theFont)
{
XeTeXFont font = createFont(theFont->fontRef, 655360);
if (font != 0) {
- const GlyphPositioningTableHeader* gposTable = (const GlyphPositioningTableHeader*)getFontTablePtr(font, LE_GPOS_TABLE_TAG);
- if (gposTable != NULL) {
- const FeatureListTable* featureListTable = (const FeatureListTable*)((const char*)gposTable + SWAP(gposTable->featureListOffset));
- for (int i = 0; i < SWAP(featureListTable->featureCount); ++i) {
- UInt32 tag = SWAPT(featureListTable->featureRecordArray[i].featureTag);
- if (tag == LE_SIZE_FEATURE_TAG) {
- const FeatureTable* feature = (const FeatureTable*)((const char*)featureListTable
- + SWAP(featureListTable->featureRecordArray[i].featureTableOffset));
- UInt16 offset = SWAP(feature->featureParamsOffset);
- const OpSizeRec* pSizeRec;
- /* if featureParamsOffset < (offset of feature from featureListTable),
- then we have a correct size table;
- otherwise we (presumably) have a "broken" one from the old FDK */
- for (int i = 0; i < 2; ++i) {
- if (i == 0)
- pSizeRec = (const OpSizeRec*)((char*)feature + offset);
- else
- pSizeRec = (const OpSizeRec*)((char*)featureListTable + offset);
- if (SWAP(pSizeRec->designSize) == 0)
- continue; // incorrect 'size' feature format
- if (SWAP(pSizeRec->subFamilyID) == 0
- && SWAP(pSizeRec->nameCode) == 0
- && SWAP(pSizeRec->minSize) == 0
- && SWAP(pSizeRec->maxSize) == 0)
- break; // feature is valid, but no 'size' range
- if (SWAP(pSizeRec->designSize) < SWAP(pSizeRec->minSize))
- continue;
- if (SWAP(pSizeRec->designSize) > SWAP(pSizeRec->maxSize))
- continue;
- if (SWAP(pSizeRec->maxSize) <= SWAP(pSizeRec->minSize))
- continue;
- if (SWAP(pSizeRec->nameCode) < 256)
- continue;
- if (SWAP(pSizeRec->nameCode) > 32767)
- continue;
- // looks like we've found a usable feature!
- theFont->opSizeInfo.designSize = SWAP(pSizeRec->designSize);
- theFont->opSizeInfo.subFamilyID = SWAP(pSizeRec->subFamilyID);
- theFont->opSizeInfo.nameCode = SWAP(pSizeRec->nameCode);
- theFont->opSizeInfo.minSize = SWAP(pSizeRec->minSize);
- theFont->opSizeInfo.maxSize = SWAP(pSizeRec->maxSize);
- break;
- }
- break;
- }
- }
+ const OpSizeRec* pSizeRec = getOpSizePtr(font);
+ if (pSizeRec != NULL) {
+ theFont->opSizeInfo.designSize = SWAP(pSizeRec->designSize);
+ if (SWAP(pSizeRec->subFamilyID) == 0
+ && SWAP(pSizeRec->nameCode) == 0
+ && SWAP(pSizeRec->minSize) == 0
+ && SWAP(pSizeRec->maxSize) == 0)
+ goto done_size; // feature is valid, but no 'size' range
+ theFont->opSizeInfo.subFamilyID = SWAP(pSizeRec->subFamilyID);
+ theFont->opSizeInfo.nameCode = SWAP(pSizeRec->nameCode);
+ theFont->opSizeInfo.minSize = SWAP(pSizeRec->minSize);
+ theFont->opSizeInfo.maxSize = SWAP(pSizeRec->maxSize);
}
+ done_size:
const OS2TableHeader* os2Table = (const OS2TableHeader*)getFontTablePtr(font, LE_OS_2_TABLE_TAG);
if (os2Table != NULL) {
diff --git a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.h b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.h
index b82194afb07..44e2bcade75 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.h
+++ b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.h
@@ -43,6 +43,8 @@ typedef ATSFontRef PlatformFontRef;
typedef FcPattern* PlatformFontRef;
#endif
+#include "XeTeXLayoutInterface.h"
+
#ifdef __cplusplus /* allow inclusion in plain C files just to get the typedefs above */
#include <string>
@@ -83,6 +85,7 @@ public:
const char** famName, const char** styName) const;
// return Postscript, family, and style names, for use in .xdv
+ double getDesignSize(XeTeXFont font);
char getReqEngine() const;
// return the requested rendering technology for the most recent findFont
@@ -118,7 +121,8 @@ protected:
, parent(NULL)
, fontRef(ref), weight(0), width(0), slant(0)
, isReg(false), isBold(false), isItalic(false)
- { opSizeInfo.subFamilyID = 0; }
+ { opSizeInfo.subFamilyID = 0;
+ opSizeInfo.designSize = 100; } /* default to 10bp */
~Font()
{ delete fullName; delete psName; }
@@ -181,6 +185,8 @@ protected:
void prependToList(std::list<std::string>* list, const char* str);
void addToMaps(PlatformFontRef platformFont, const NameCollection* names);
+ const OpSizeRec* getOpSizePtr(XeTeXFont font);
+
virtual void getOpSizeRecAndStyleFlags(Font* theFont);
virtual void searchForHostPlatformFonts(const std::string& name) = 0;
diff --git a/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp b/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp
index f093950bd9a..c3dd0d2b695 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp
+++ b/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp
@@ -155,6 +155,11 @@ const char* getFullName(PlatformFontRef fontRef)
return XeTeXFontMgr::GetFontManager()->getFullName(fontRef);
}
+double getDesignSize(XeTeXFont font)
+{
+ return XeTeXFontMgr::GetFontManager()->getDesignSize(font);
+}
+
const char* getFontFilename(XeTeXLayoutEngine engine)
{
return engine->font->getFilename();
@@ -1019,8 +1024,9 @@ findNextGraphiteBreak(int iOffset, int iBrkVal)
return -1;
if (iOffset < lbSource->getLength()) {
while (++iOffset < lbSource->getLength()) {
- const gr::GlyphSetIterator& gsi = lbSegment->charToGlyphs(iOffset).first;
- if (gsi == lbSegment->charToGlyphs(iOffset).second)
+ const std::pair<gr::GlyphSetIterator,gr::GlyphSetIterator> gsiPair = lbSegment->charToGlyphs(iOffset);
+ const gr::GlyphSetIterator& gsi = gsiPair.first;
+ if (gsi == gsiPair.second)
continue;
if (gsi->breakweight() < gr::klbNoBreak && gsi->breakweight() >= -(gr::LineBrk)iBrkVal)
return iOffset;
diff --git a/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.h b/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.h
index 482625588b2..308bd12ecc6 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.h
+++ b/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.h
@@ -28,10 +28,22 @@ use or other dealings in this Software without prior written
authorization from SIL International.
\****************************************************************************/
+#ifndef XETEX_LAYOUT_INTERFACE_H
+#define XETEX_LAYOUT_INTERFACE_H 1
+
#ifdef XETEX_MAC
#include <Carbon/Carbon.h>
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef struct XeTeXFont_rec* XeTeXFont;
+typedef struct XeTeXLayoutEngine_rec* XeTeXLayoutEngine;
+#ifdef __cplusplus
+};
+#endif
+
#include "XeTeX_ext.h"
#include "XeTeXFontMgr.h"
@@ -39,9 +51,6 @@ authorization from SIL International.
extern "C" {
#endif
-typedef struct XeTeXFont_rec* XeTeXFont;
-typedef struct XeTeXLayoutEngine_rec* XeTeXLayoutEngine;
-
extern char gPrefEngine;
int getCachedGlyphBBox(UInt16 fontID, UInt16 glyphID, GlyphBBox* bbox);
@@ -67,6 +76,7 @@ const char* getFullName(PlatformFontRef fontRef);
const char* getFontFilename(XeTeXLayoutEngine engine);
void getNames(PlatformFontRef fontRef, const char** psName, const char** famName, const char** styName);
+double getDesignSize(XeTeXFont font);
void deleteFont(XeTeXFont font);
@@ -170,3 +180,6 @@ long findGraphiteFeatureSettingNamed(XeTeXLayoutEngine engine, UInt32 feature, c
#ifdef __cplusplus
};
#endif
+
+#endif /* XETEX_LAYOUT_INTERFACE_H */
+
diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
index 979e211fa9e..7a2954e5e99 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
+++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
@@ -1062,7 +1062,7 @@ splitFontName(char* name, char** var, char** feat, char** end, int* index)
void*
findnativefont(unsigned char* uname, integer scaled_size)
- /* scaled_size here is in TeX points */
+ /* scaled_size here is in TeX points, or is a negative integer for 'scaled' */
{
void* rval = NULL;
char* nameString;
@@ -1105,8 +1105,20 @@ findnativefont(unsigned char* uname, integer scaled_size)
if (path == NULL)
path = kpse_find_file(nameString + 1, kpse_type1_format, 0);
if (path != NULL) {
+ if (scaled_size < 0) {
+ font = createFontFromFile(path, index, 655360L);
+ if (font != NULL) {
+ Fixed dsize = X2Fix(getDesignSize(font));
+ if (scaled_size == -1000)
+ scaled_size = dsize;
+ else
+ scaled_size = zxnoverd(dsize, -scaled_size, 1000);
+ deleteFont(font);
+ }
+ }
font = createFontFromFile(path, index, scaled_size);
if (font != NULL) {
+ loadedfontdesignsize = X2Fix(getDesignSize(font));
if (varString && strncmp(varString, "/GR", 3) == 0) {
rval = loadGraphiteFont(0, font, scaled_size, featString, nameString);
if (rval == NULL)
@@ -1134,6 +1146,18 @@ findnativefont(unsigned char* uname, integer scaled_size)
nameoffile = xmalloc(namelength + 4); /* +2 would be correct: initial space, final NUL */
nameoffile[0] = ' ';
strcpy((char*)nameoffile + 1, fullName);
+
+ if (scaled_size < 0) {
+ font = createFont(fontRef, scaled_size);
+ if (font != NULL) {
+ Fixed dsize = X2Fix(getDesignSize(font));
+ if (scaled_size == -1000)
+ scaled_size = dsize;
+ else
+ scaled_size = zxnoverd(dsize, -scaled_size, 1000);
+ deleteFont(font);
+ }
+ }
#ifdef XETEX_MAC
/* decide whether to use AAT or OpenType rendering with this font */
@@ -2692,10 +2716,22 @@ open_dvi_output(FILE** fptr)
if (*p++ == '\"')
++len;
len += strlen(outputdriver);
- len += 8; /* space for -o flag, quotes, NUL */
+ if (output_directory)
+ len += strlen(output_directory);
+ len += 10; /* space for -o flag, quotes, NUL */
+ for (p = (const char*)nameoffile+1; *p; p++)
+ if (*p == '\"')
+ ++len; /* allow extra space to escape quotes in filename */
cmd = xmalloc(len);
strcpy(cmd, outputdriver);
strcat(cmd, " -o \"");
+ if (output_directory) {
+ len = strlen(output_directory);
+ if (IS_DIR_SEP(output_directory[len-1]))
+ output_directory[len-1] = '\0';
+ strcat(cmd, output_directory);
+ strcat(cmd, "/");
+ }
q = cmd + strlen(cmd);
for (p = (const char*)nameoffile+1; *p; p++) {
if (*p == '\"')
@@ -2709,6 +2745,14 @@ open_dvi_output(FILE** fptr)
free(cmd);
cmd = cmd2;
}
+ if (output_directory) {
+ char *fullname = concat3(output_directory, "/", nameoffile+1);
+ free(nameoffile);
+ namelength = strlen(fullname);
+ nameoffile = (char*)xmalloc(namelength+2);
+ strcpy(nameoffile+1, fullname);
+ free(fullname);
+ }
*fptr = popen(cmd, "w");
free(cmd);
return (*fptr != 0);
@@ -2757,38 +2801,42 @@ get_uni_c(UFILE* f)
case UTF16BE:
rval = getc(f->f);
- rval <<= 8;
- rval += getc(f->f);
- if (rval >= 0xd800 && rval <= 0xdbff) {
- int lo = getc(f->f);
- lo <<= 8;
- lo += getc(f->f);
- if (lo >= 0xdc00 && lo <= 0xdfff)
- rval = 0x10000 + (rval - 0xd800) * 0x400 + (lo - 0xdc00);
- else {
- rval = 0xfffd;
- f->savedChar = lo;
+ if (rval != EOF) {
+ rval <<= 8;
+ rval += getc(f->f);
+ if (rval >= 0xd800 && rval <= 0xdbff) {
+ int lo = getc(f->f);
+ lo <<= 8;
+ lo += getc(f->f);
+ if (lo >= 0xdc00 && lo <= 0xdfff)
+ rval = 0x10000 + (rval - 0xd800) * 0x400 + (lo - 0xdc00);
+ else {
+ rval = 0xfffd;
+ f->savedChar = lo;
+ }
}
+ else if (rval >= 0xdc00 && rval <= 0xdfff)
+ rval = 0xfffd;
}
- else if (rval >= 0xdc00 && rval <= 0xdfff)
- rval = 0xfffd;
break;
case UTF16LE:
rval = getc(f->f);
- rval += (getc(f->f) << 8);
- if (rval >= 0xd800 && rval <= 0xdbff) {
- int lo = getc(f->f);
- lo += (getc(f->f) << 8);
- if (lo >= 0xdc00 && lo <= 0xdfff)
- rval = 0x10000 + (rval - 0xd800) * 0x400 + (lo - 0xdc00);
- else {
- rval = 0xfffd;
- f->savedChar = lo;
+ if (rval != EOF) {
+ rval += (getc(f->f) << 8);
+ if (rval >= 0xd800 && rval <= 0xdbff) {
+ int lo = getc(f->f);
+ lo += (getc(f->f) << 8);
+ if (lo >= 0xdc00 && lo <= 0xdfff)
+ rval = 0x10000 + (rval - 0xd800) * 0x400 + (lo - 0xdc00);
+ else {
+ rval = 0xfffd;
+ f->savedChar = lo;
+ }
}
+ else if (rval >= 0xdc00 && rval <= 0xdfff)
+ rval = 0xfffd;
}
- else if (rval >= 0xdc00 && rval <= 0xdfff)
- rval = 0xfffd;
break;
case RAW:
diff --git a/Build/source/texk/web2c/xetexdir/xetex.ch b/Build/source/texk/web2c/xetexdir/xetex.ch
index 607babd5987..a1e05bbe05e 100644
--- a/Build/source/texk/web2c/xetexdir/xetex.ch
+++ b/Build/source/texk/web2c/xetexdir/xetex.ch
@@ -1,4 +1,28 @@
@x
+\def\section{\mathhexbox278}
+@y
+\def\section{\mathhexbox278}
+\def\XeTeX{Xe\TeX}
+@z
+
+@x
+\def\title{\eTeX}
+@y
+\def\title{\XeTeX}
+@z
+
+@x
+\let\maybe=\iffalse % print only changed modules
+@y
+@z
+
+@x
+\let\maybe=\iffalse
+@y
+\let\maybe=\iftrue
+@z
+
+@x
@* \[1] Introduction.
@y
@* \[1] Introduction.
@@ -60,7 +84,7 @@
@d XeTeX_input_mode_raw = 4
@d XeTeX_input_mode_icu_mapping = 5
@#
-@d XeTeX_default_input_encoding_code = 6 {str_number of encoding name if mode = ICU}
+@d XeTeX_default_input_encoding_code = 6 {|str_number| of encoding name if mode = ICU}
@#
@d eTeX_states=7 {number of \eTeX\ state variables in |eqtb|}
@z
@@ -937,8 +961,8 @@ if max_quarterword-min_quarterword<@"FFFF then bad:=19;
@y
@d whatsit_node=8 {|type| of special extension nodes}
-{ added stuff here for native_word and picture nodes }
-@d native_word_node=40 {|subtype| in whatsits that hold native_font words
+{ added stuff here for |native_word| and picture nodes }
+@d native_word_node=40 {|subtype| in whatsits that hold |native_font| words
(0-3 are used for open, write, close, special; 4 is language; pdfTeX uses up through 30-something)
To support ``native'' fonts, we build |native_word_nodes|, which are variable size whatsits.
@@ -951,7 +975,7 @@ This is followed by |2*length| bytes, for the actual characters of the string (i
So |native_node_size|, which does not include any space for the actual text, is 6.}
-@d native_node_size=6 {size of a native_word node (plus the actual chars) -- see also xetex.h}
+@d native_node_size=6 {size of a |native_word| node (plus the actual chars) -- see also xetex.h}
@d native_size(#)==mem[#+4].qqqq.b0
@d native_font(#)==mem[#+4].qqqq.b1
@d native_length(#)==mem[#+4].qqqq.b2
@@ -1004,7 +1028,7 @@ always be zero, as it happens.)
So |pic_node_size|, which does not include any space for the picture file pathname, is 7.
-pdf_nodes are just like pic_nodes, but generate a different xdv file code.}
+|pdf_nodes| are just like |pic_nodes|, but generate a different xdv file code.}
@d pic_node_size=8 { must sync with xetex.h }
@d pic_path_length(#)==mem[#+4].hh.b0
@@ -1291,7 +1315,7 @@ primitive("XeTeXlinebreakskip",assign_glue,glue_base+XeTeX_linebreak_skip_code);
@d char_sub_code_base=math_code_base+256 {table of character substitutions}
@d int_base=char_sub_code_base+256 {beginning of region 5}
@y
-@d toks_base=etex_toks {table of number_regs token list registers}
+@d toks_base=etex_toks {table of |number_regs| token list registers}
@#
@d etex_pen_base=toks_base+number_regs {start of table of \eTeX's penalties}
@d inter_line_penalties_loc=etex_pen_base {additional penalties between lines}
@@ -1300,15 +1324,15 @@ primitive("XeTeXlinebreakskip",assign_glue,glue_base+XeTeX_linebreak_skip_code);
@d display_widow_penalties_loc=etex_pen_base+3 {ditto, just before a display}
@d etex_pens=etex_pen_base+4 {end of table of \eTeX's penalties}
@#
-@d box_base=etex_pens {table of number_regs box registers}
+@d box_base=etex_pens {table of |number_regs| box registers}
@d cur_font_loc=box_base+number_regs {internal font number outside math mode}
@d math_font_base=cur_font_loc+1
@d cat_code_base=math_font_base+number_math_fonts
- {table of number_chars command codes (the ``catcodes'')}
-@d lc_code_base=cat_code_base+number_usvs {table of number_chars lowercase mappings}
-@d uc_code_base=lc_code_base+number_usvs {table of number_chars uppercase mappings}
-@d sf_code_base=uc_code_base+number_usvs {table of number_chars spacefactor mappings}
-@d math_code_base=sf_code_base+number_usvs {table of number_chars math mode mappings}
+ {table of |number_chars| command codes (the ``catcodes'')}
+@d lc_code_base=cat_code_base+number_usvs {table of |number_chars| lowercase mappings}
+@d uc_code_base=lc_code_base+number_usvs {table of |number_chars| uppercase mappings}
+@d sf_code_base=uc_code_base+number_usvs {table of |number_chars| spacefactor mappings}
+@d math_code_base=sf_code_base+number_usvs {table of |number_chars| math mode mappings}
@d char_sub_code_base=math_code_base+number_usvs {table of character substitutions}
@d int_base=char_sub_code_base+number_usvs {beginning of region 5}
@z
@@ -1407,8 +1431,8 @@ else begin print_esc("scriptscriptfont");
@d del_code_base=count_base+256 {256 delimiter code mappings}
@d dimen_base=del_code_base+256 {beginning of region 6}
@y
-@d count_base=int_base+int_pars {number_regs user \.{\\count} registers}
-@d del_code_base=count_base+number_regs {number_chars delimiter code mappings}
+@d count_base=int_base+int_pars {|number_regs| user \.{\\count} registers}
+@d del_code_base=count_base+number_regs {|number_chars| delimiter code mappings}
@d dimen_base=del_code_base+number_chars {beginning of region 6}
@z
@@ -1433,7 +1457,7 @@ else begin print_esc("scriptscriptfont");
error_context_lines_code:print_esc("errorcontextlines");
@y
error_context_lines_code:print_esc("errorcontextlines");
-{XeTeX_linebreak_locale_code:print_esc("XeTeXlinebreaklocale");}
+{XeTeX\_linebreak\_locale\_code:print\_esc("XeTeXlinebreaklocale");}
XeTeX_linebreak_penalty_code:print_esc("XeTeXlinebreakpenalty");
@z
@@ -1776,21 +1800,21 @@ thus, a token fits comfortably in a halfword.
@d end_match_token=@'7000 {$2^8\cdot|end_match|$}
@d protected_token=@'7001 {$2^8\cdot|end_match|+1$}
@y
-@d cs_token_flag= @"1FFFFFF {@"FFFFF amount added to the |eqtb| location in a
+@d cs_token_flag= @"1FFFFFF {was @@"FFFFF: amount added to the |eqtb| location in a
token that stands for a control sequence; is a multiple of~65536, less~1}
-@d max_char_val= @"200000 {@"10000 to separate char and command code}
-@d left_brace_token= @"200000 {@"10000 $2^16\cdot|left_brace|$}
-@d left_brace_limit= @"400000 {@"20000 $2^16\cdot(|left_brace|+1)$}
-@d right_brace_token= @"400000 {@"20000 $2^16\cdot|right_brace|$}
-@d right_brace_limit= @"600000 {@"30000 $2^16\cdot(|right_brace|+1)$}
-@d math_shift_token= @"600000 {@"30000 $2^16\cdot|math_shift|$}
-@d tab_token= @"800000 {@"40000 $2^16\cdot|tab_mark|$}
-@d out_param_token= @"A00000 {@"50000 $2^16\cdot|out_param|$}
-@d space_token= @"1400020 {@"A0020 $2^16\cdot|spacer|+|" "|$}
-@d letter_token= @"1600000 {@"B0000 $2^16\cdot|letter|$}
-@d other_token= @"1800000 {@"C0000 $2^16\cdot|other_char|$}
-@d match_token= @"1A00000 {@"D0000 $2^16\cdot|match|$}
-@d end_match_token= @"1C00000 {@"E0000 $2^16\cdot|end_match|$}
+@d max_char_val= @"200000 {@@"10000 to separate char and command code}
+@d left_brace_token= @"200000 {@@"10000 $2^16\cdot|left_brace|$}
+@d left_brace_limit= @"400000 {@@"20000 $2^16\cdot(|left_brace|+1)$}
+@d right_brace_token= @"400000 {@@"20000 $2^16\cdot|right_brace|$}
+@d right_brace_limit= @"600000 {@@"30000 $2^16\cdot(|right_brace|+1)$}
+@d math_shift_token= @"600000 {@@"30000 $2^16\cdot|math_shift|$}
+@d tab_token= @"800000 {@@"40000 $2^16\cdot|tab_mark|$}
+@d out_param_token= @"A00000 {@@"50000 $2^16\cdot|out_param|$}
+@d space_token= @"1400020 {@@"A0020 $2^16\cdot|spacer|+|" "|$}
+@d letter_token= @"1600000 {@@"B0000 $2^16\cdot|letter|$}
+@d other_token= @"1800000 {@@"C0000 $2^16\cdot|other_char|$}
+@d match_token= @"1A00000 {@@"D0000 $2^16\cdot|match|$}
+@d end_match_token= @"1C00000 {@@"E0000 $2^16\cdot|end_match|$}
@d protected_token=end_match_token+1 {$2^8\cdot|end_match|+1$}
@z
@@ -1898,7 +1922,7 @@ var n:integer; {temp variable}
@d mark_text=15 {|token_type| code for \.{\\topmark}, etc.}
@d inter_char_text=16 {text from \\XeTeXinterchartoks}
@#
-@d eTeX_text_offset=output_routine_loc-output_text-1 {1 more to make space for the inter_char_text}
+@d eTeX_text_offset=output_routine_loc-output_text-1 {1 more to make space for the |inter_char_text|}
@z
@x
@@ -2010,7 +2034,7 @@ primitive("par",par_end,too_big_char); {cf. |scan_file_name|}
@y
@!c:UnicodeScalar; {constituent of a possible expanded code}
@!d:small_number; {number of excess characters in an expanded code}
-@!sup_count:small_number; {number of identical sup_mark characters}
+@!sup_count:small_number; {number of identical |sup_mark| characters}
@z
@x
@@ -2069,12 +2093,12 @@ end
@<If this |sup_mark| starts an expanded character...@>=
begin if cur_chr=buffer[loc] then if loc<limit then
begin sup_count:=2;
- {we have ^^ and another char; check how many ^s we have altogether, up to a max of 6}
+ {we have |^^| and another char; check how many |^|s we have altogether, up to a max of 6}
while (sup_count<6) and (loc+2*sup_count-2<=limit) and (cur_chr=buffer[loc+sup_count-1]) do
incr(sup_count);
- {check whether we have enough hex chars for the number of ^s}
+ {check whether we have enough hex chars for the number of |^|s}
for d:=1 to sup_count do
- if not is_hex(buffer[loc+sup_count-2+d]) then {found a non-hex char, so do single ^^X style}
+ if not is_hex(buffer[loc+sup_count-2+d]) then {found a non-hex char, so do single |^^X| style}
begin c:=buffer[loc+1];
if c<@'200 then
begin loc:=loc+2;
@@ -2166,12 +2190,12 @@ end
@<If an expanded...@>=
begin if (cat=sup_mark) and (buffer[k]=cur_chr) and (k<limit) then
begin sup_count:=2;
- {we have ^^ and another char; check how many ^s we have altogether, up to a max of 6}
+ {we have |^^| and another char; check how many |^|s we have altogether, up to a max of 6}
while (sup_count<6) and (k+2*sup_count-2<=limit) and (buffer[k+sup_count-1]=cur_chr) do
incr(sup_count);
- {check whether we have enough hex chars for the number of ^s}
+ {check whether we have enough hex chars for the number of |^|s}
for d:=1 to sup_count do
- if not is_hex(buffer[k+sup_count-2+d]) then {found a non-hex char, so do single ^^X style}
+ if not is_hex(buffer[k+sup_count-2+d]) then {found a non-hex char, so do single |^^X| style}
begin c:=buffer[k+1];
if c<@'200 then
begin if c<@'100 then buffer[k-1]:=c+@'100 @+else buffer[k-1]:=c-@'100;
@@ -3074,27 +3098,34 @@ for j:=1 to n do append_to_name(TEX_format_default[j]);
@x
@p function make_name_string:str_number;
var k:1..file_name_size; {index into |name_of_file|}
+save_area_delimiter, save_ext_delimiter: pool_pointer;
+save_name_in_progress, save_stop_at_space: boolean;
begin if (pool_ptr+name_length>pool_size)or(str_ptr=max_strings)or
(cur_length>0) then
make_name_string:="?"
else begin for k:=1 to name_length do append_char(xord[name_of_file[k]]);
make_name_string:=make_string;
- end;
{At this point we also set |cur_name|, |cur_ext|, and |cur_area| to
match the contents of |name_of_file|.}
- k:=1;
+ save_area_delimiter:=area_delimiter; save_ext_delimiter:=ext_delimiter;
+ save_name_in_progress:=name_in_progress; save_stop_at_space:=stop_at_space;
name_in_progress:=true;
begin_name;
stop_at_space:=false;
+ k:=1;
while (k<=name_length)and(more_name(name_of_file[k])) do
incr(k);
- stop_at_space:=true;
+ stop_at_space:=save_stop_at_space;
end_name;
- name_in_progress:=false;
+ name_in_progress:=save_name_in_progress;
+ area_delimiter:=save_area_delimiter; ext_delimiter:=save_ext_delimiter;
+ end;
end;
@y
@p function make_name_string:str_number;
-var k:1..file_name_size; {index into |name_of_file|}
+var k:0..file_name_size; {index into |name_of_file|}
+save_area_delimiter, save_ext_delimiter: pool_pointer;
+save_name_in_progress, save_stop_at_space: boolean;
begin if (pool_ptr+name_length>pool_size)or(str_ptr=max_strings)or
(cur_length>0) then
make_name_string:="?"
@@ -3102,6 +3133,20 @@ else begin
make_utf16_name;
for k:=0 to name_length16-1 do append_char(name_of_file16[k]);
make_name_string:=make_string;
+ {At this point we also set |cur_name|, |cur_ext|, and |cur_area| to
+ match the contents of |name_of_file|.}
+ save_area_delimiter:=area_delimiter; save_ext_delimiter:=ext_delimiter;
+ save_name_in_progress:=name_in_progress; save_stop_at_space:=stop_at_space;
+ name_in_progress:=true;
+ begin_name;
+ stop_at_space:=false;
+ k:=0;
+ while (k<name_length16)and(more_name(name_of_file16[k])) do
+ incr(k);
+ stop_at_space:=save_stop_at_space;
+ end_name;
+ name_in_progress:=save_name_in_progress;
+ area_delimiter:=save_area_delimiter; ext_delimiter:=save_ext_delimiter;
end;
end;
function u_make_name_string(var f:unicode_file):str_number;
@@ -3218,7 +3263,7 @@ if translate_filename then begin
@d is_gr_font(#)==((font_area[#]=otgr_font_flag) and (usingGraphite(font_layout_engine[#])))
@d is_otgr_font(#)==(font_area[#]=otgr_font_flag)
@d is_native_font(#)==(is_atsu_font(#) or is_otgr_font(#))
- {native fonts have font_area = 65534 or 65535,
+ {native fonts have |font_area| = 65534 or 65535,
which would be a string containing an invalid Unicode character}
@d non_char==qi(too_big_char) {a |halfword| code that can't match a real character}
@@ -3244,14 +3289,15 @@ if translate_filename then begin
{|font_bchar| if it doesn't exist in the font, otherwise |non_char|}
@#
@!font_layout_engine: ^void_pointer; { either an ATSUStyle or a XeTeXLayoutEngine }
-@!font_mapping: ^void_pointer; { TECkit_Converter or 0 }
+@!font_mapping: ^void_pointer; { |TECkit_Converter| or 0 }
@!font_flags: ^char; { flags:
- 0x01: font_colored
- 0x02: font_vertical }
+ 0x01: |font_colored|
+ 0x02: |font_vertical| }
@!font_letter_space: ^scaled; { letterspacing to be applied to the font }
-@!loaded_font_mapping: void_pointer; { used by load_native_font to return mapping, if any }
-@!loaded_font_flags: char; { used by load_native_font to return flags }
+@!loaded_font_mapping: void_pointer; { used by |load_native_font| to return mapping, if any }
+@!loaded_font_flags: char; { used by |load_native_font| to return flags }
@!loaded_font_letter_space: scaled;
+@!loaded_font_design_size: scaled;
@!mapped_text: ^UTF16_code; { scratch buffer used while applying font mappings }
@!xdv_buffer: ^char; { scratch buffer used in generating XDV output }
@z
@@ -3389,19 +3435,19 @@ ec:=effective_char(false,f,qi(c));
\yskip\hang|define_native_font| 252 k[4] s[4] flags[2]
lenps[1] lenfam[1] lensty[1] ps[lenps] fam[lenfam] sty[lensty]
- if (flags & COLORED):
+ if (flags AND COLORED):
rgba[4]
- if (flags & VARIATIONS):
+ if (flags AND VARIATIONS):
numvars[2]
axes[4nv]
values[4nv]
- if (flags & MATRIX):
+ if (flags AND MATRIX):
ta[4] tb[4] tc[4] td[4] tx[4] ty[4]
\yskip\hang|pic_file| 251 flags[1] t[4][6] p[2] len[2] path[l]
flags = 0 for raster image, 1 for PDF
t is transform matrix
- p is page # from the graphic file (0-based)
+ p is page \# from the graphic file (0-based)
len is length of pathname
path is pathname of graphic file
@@ -3580,7 +3626,7 @@ check_next:
end;
goto end_node_run;
end;
- {@<Advance |q| past ignorable nodes@>;}
+ {@@<Advance |q| past ignorable nodes@@>;}
if (q <> null) and is_native_word_node(q) and (native_font(q) = native_font(r)) then begin
p := q; {record new tail of run in |p|}
q := link(q);
@@ -3731,17 +3777,15 @@ if tracing_output>0 then
dvi_four(last_bop); last_bop:=page_loc;
@y
dvi_four(last_bop); last_bop:=page_loc;
-{ generate a pagesize \special at start of page }
+{ generate a pagesize special at start of page }
old_setting:=selector; selector:=new_string;
print("pdf:pagesize ");
if (pdf_page_width > 0) and (pdf_page_height > 0) then begin
print("width"); print(" ");
- if mag=1000 then print_scaled(pdf_page_width)
- else print_scaled(xn_over_d(pdf_page_width,mag,1000));
+ print_scaled(pdf_page_width);
print("pt"); print(" ");
print("height"); print(" ");
- if mag=1000 then print_scaled(pdf_page_height)
- else print_scaled(xn_over_d(pdf_page_height,mag,1000));
+ print_scaled(pdf_page_height);
print("pt");
end else
print("default");
@@ -3936,10 +3980,10 @@ print_ASCII(qo(character(p)) + (fam(p) div @"100) * @"10000);
@d axis_height==mathsy(22) {height of fraction lines above the baseline}
@d total_mathsy_params=22
@y
-NB: the access functions here must all put the font # into /f/ for mathsy().
+NB: the access functions here must all put the font \# into /f/ for mathsy().
The accessors are defined with
-define_mathsy_accessor(NAME)(fontdimen-number)(NAME)
+|define_mathsy_accessor(NAME)(fontdimen-number)(NAME)|
because I can't see how to only give the name once, with WEB's limited
macro capabilities. This seems a bit ugly, but it works.
@@ -4441,7 +4485,7 @@ begin fetch(accent_chr(q));
x:=null;
if is_native_font(cur_f) then
begin c:=cur_c; f:=cur_f;
- s:=0; {@<Compute the amount of skew@>;}
+ s:=0; {@@<Compute the amount of skew@@>;}
x:=clean_box(nucleus(q),cramped_style(cur_style)); w:=width(x); h:=height(x);
end
else if char_exists(cur_i) then
@@ -4459,7 +4503,7 @@ if x<>null then begin
@y
y:=char_box(f,c);
if is_native_font(f) then begin
- {turn the native_word node into a native_glyph one}
+ {turn the |native_word| node into a |native_glyph| one}
p:=get_node(glyph_node_size);
type(p):=whatsit_node; subtype(p):=glyph_node;
native_font(p):=f; native_glyph(p):=get_native_glyph(list_ptr(y), 0);
@@ -4499,7 +4543,7 @@ if x<>null then begin
end;
until (w2<0) or (w2>=wa);
{
- if (w2<0) then begin
+ |if (w2<0) then begin
ot_assembly_ptr:=get_ot_assembly_ptr(f, c, 1);
if ot_assembly_ptr<>nil then begin
free_node(p,glyph_node_size);
@@ -4507,7 +4551,7 @@ if x<>null then begin
list_ptr(y):=p;
goto found;
end;
- end else
+ end else|
}
set_native_glyph_metrics(p, 1);
{found:}
@@ -4900,8 +4944,7 @@ restart:
for l := 0 to native_length(ha)-1 do begin
c := get_native_char(ha, l);
set_lc_code(c);
- if (hc[0] = 0) {or (hc[0] > max_hyph_char) -- no, there can be letters > max_hyph_char in the word}
- then begin
+ if (hc[0] = 0) then begin
if (hn > 0) then begin
{ we've got some letters, and now found a non-letter, so break off the tail of the |native_word|
and link it after this node, and goto done3 }
@@ -5316,8 +5359,8 @@ if ((head=tail) and (mode>0)) then begin
end;
adjust_space_factor;@/
@y
-@d check_for_inter_char_toks(#)=={check for a spacing token list, goto # if found,
- or big_switch in case of the initial letter of a run}
+@d check_for_inter_char_toks(#)=={check for a spacing token list, goto |#| if found,
+ or |big_switch| in case of the initial letter of a run}
cur_ptr:=null;
space_class:=sf_code(cur_chr) div @"10000;
@@ -5326,10 +5369,8 @@ adjust_space_factor;@/
if (state<>token_list) or (token_type<>backed_up_char) then begin
find_sa_element(inter_char_val, 255*@"100 + space_class, false);
if cur_ptr<>null then begin
- if cur_cs=0 then begin
- if cur_cmd=char_num then cur_cmd:=char_given;
- cur_tok:=(cur_cmd*max_char_val)+cur_chr;
- end else cur_tok:=cs_token_flag+cur_cs; {can't happen?}
+ if cur_cmd<>letter then cur_cmd:=other_char;
+ cur_tok:=(cur_cmd*max_char_val)+cur_chr;
back_input; token_type:=backed_up_char;
begin_token_list(sa_ptr(cur_ptr), inter_char_text);
goto big_switch;
@@ -5338,10 +5379,8 @@ adjust_space_factor;@/
end else begin
find_sa_element(inter_char_val, prev_class*@"100 + space_class, false);
if cur_ptr<>null then begin
- if cur_cs=0 then begin
- if cur_cmd=char_num then cur_cmd:=char_given;
- cur_tok:=(cur_cmd*max_char_val)+cur_chr;
- end else cur_tok:=cs_token_flag+cur_cs; {can't happen?}
+ if cur_cmd<>letter then cur_cmd:=other_char;
+ cur_tok:=(cur_cmd*max_char_val)+cur_chr;
back_input; token_type:=backed_up_char;
begin_token_list(sa_ptr(cur_ptr), inter_char_text);
prev_class:=255;
@@ -5357,7 +5396,7 @@ adjust_space_factor;@/
find_sa_element(inter_char_val, space_class*@"100 + 255, false); {boundary}
if cur_ptr<>null then begin
if cur_cs=0 then begin
- if cur_cmd=char_num then cur_cmd:=char_given;
+ if cur_cmd=char_num then cur_cmd:=other_char;
cur_tok:=(cur_cmd*max_char_val)+cur_chr;
end else cur_tok:=cs_token_flag+cur_cs;
back_input;
@@ -5481,7 +5520,7 @@ collected:
do_locale_linebreaks(save_native_len, main_k);
native_len := save_native_len; { discard the temp string }
- main_k := native_len - main_h - temp_ptr; { and set main_k to remaining length of new word }
+ main_k := native_len - main_h - temp_ptr; { and set |main_k| to remaining length of new word }
temp_ptr := main_h; { pointer to remaining fragment }
main_h := 0;
@@ -5733,11 +5772,11 @@ math_char_num: begin scan_fifteen_bit_int; c:=cur_val;
end;
@y
math_char_num:
- if cur_chr = 2 then begin { \XeTeXmathchar }
+ if cur_chr = 2 then begin { XeTeXmathchar }
scan_math_class_int; c := set_class_field(cur_val);
scan_math_fam_int; c := c + set_family_field(cur_val);
scan_usv_num; c := c + cur_val;
- end else if cur_chr = 1 then begin { \XeTeXmathcharnum }
+ end else if cur_chr = 1 then begin { XeTeXmathcharnum }
scan_xetex_math_char_int; c := cur_val;
end else begin scan_fifteen_bit_int;
c := set_class_field(cur_val div @"1000) +
@@ -5757,11 +5796,11 @@ math_given: begin
end;
XeTeX_math_given: c:=cur_chr;
delim_num: begin
- if cur_chr=1 then begin {\XeTeXdelimiter <cls> <fam> <usv>}
+ if cur_chr=1 then begin {XeTeXdelimiter <cls> <fam> <usv>}
scan_math_class_int; c := set_class_field(cur_val);
scan_math_fam_int; c := c + set_family_field(cur_val);
scan_usv_num; c := c + cur_val;
- end else begin {\delimiter <27-bit delcode>}
+ end else begin {delimiter <27-bit delcode>}
scan_delimiter_int;
c := cur_val div @'10000; {get the 'small' delimiter field}
c := set_class_field(c div @"1000) +
@@ -5785,12 +5824,12 @@ plane_and_fam_field(p) := plane_and_fam_field(p) + (math_char_field(c) div @"100
mmode+math_char_num: begin scan_fifteen_bit_int; set_math_char(cur_val);
end;
@y
-mmode+math_char_num: if cur_chr = 2 then begin { \XeTeXmathchar }
+mmode+math_char_num: if cur_chr = 2 then begin { XeTeXmathchar }
scan_math_class_int; t := set_class_field(cur_val);
scan_math_fam_int; t := t + set_family_field(cur_val);
scan_usv_num; t := t + cur_val;
set_math_char(t);
- end else if cur_chr = 1 then begin { \XeTeXmathcharnum }
+ end else if cur_chr = 1 then begin { XeTeXmathcharnum }
scan_xetex_math_char_int; set_math_char(cur_val);
end else begin scan_fifteen_bit_int;
set_math_char(set_class_field(cur_val div @"1000) +
@@ -5811,7 +5850,7 @@ mmode+math_given: begin
end;
mmode+XeTeX_math_given: set_math_char(cur_chr);
mmode+delim_num: begin
- if cur_chr=1 then begin {\XeTeXdelimiter}
+ if cur_chr=1 then begin {XeTeXdelimiter}
scan_math_class_int; t := set_class_field(cur_val);
scan_math_fam_int; t := t + set_family_field(cur_val);
scan_usv_num; t := t + cur_val;
@@ -5863,11 +5902,11 @@ begin if r then scan_twenty_seven_bit_int
procedure scan_delimiter(@!p:pointer;@!r:boolean);
begin
if r then begin
- if cur_chr=1 then begin {\XeTeXradical}
+ if cur_chr=1 then begin {XeTeXradical}
cur_val1 := @"40000000; {extended delcode flag}
scan_math_fam_int; cur_val1 := cur_val1 + cur_val * @"200000;
scan_usv_num; cur_val := cur_val1 + cur_val;
- end else {\radical}
+ end else {radical}
scan_delimiter_int;
end
@z
@@ -5880,12 +5919,12 @@ begin
letter,other_char: begin
cur_val:=del_code(cur_chr);
end;
- delim_num: if cur_chr=1 then begin {\XeTeXdelimiter}
+ delim_num: if cur_chr=1 then begin {XeTeXdelimiter}
cur_val1 := @"40000000; {extended delcode flag}
scan_math_class_int; {discarded}
scan_math_fam_int; cur_val1 := cur_val1 + cur_val * @"200000;
scan_usv_num; cur_val := cur_val1 + cur_val;
- end else scan_delimiter_int; {normal \delimiter}
+ end else scan_delimiter_int; {normal delimiter}
othercases begin cur_val:=-1; end;
@z
@@ -6302,15 +6341,15 @@ XeTeX_def_code: begin
p:=cur_chr; scan_usv_num;
p:=p+cur_val;
scan_optional_equals;
- scan_int; {scan_xetex_del_code_int; !!FIXME!!}
+ scan_int; {|scan_xetex_del_code_int|; !!FIXME!!}
word_define(p,hi(cur_val));
end else begin
{
bit usage in delcode values:
-original layout: @"00cffCFF small/LARGE family & char
-extended: @"40000000 FLAG
- + ff << 21 (mult by @"200000) FAMILY
- + 1ccccc (21 bits) USV
+original layout: @@"00cffCFF small/LARGE family \& char
+extended: @@"40000000 FLAG
+ + ff << 21 (mult by @@"200000) FAMILY
+ + 1ccccc (21 bits) USV
}
p:=cur_chr-1; scan_usv_num;
p:=p+cur_val;
@@ -6596,7 +6635,7 @@ if not w_eof(fmt_file) then goto bad_fmt
setup_bound_var (15000)('max_strings')(max_strings);
@y
setup_bound_var (15000)('max_strings')(max_strings);
- max_strings:=max_strings+too_big_char; {the max_strings value doesn't include the 64K synthetic strings}
+ max_strings:=max_strings+too_big_char; {the |max_strings| value doesn't include the 64K synthetic strings}
@z
@x
@@ -6914,10 +6953,10 @@ begin
end
end;
- { now pp points to the non-native_word node that ended the chain, or null }
+ { now pp points to the non-|native_word| node that ended the chain, or null }
- { we can just check type(p)=whatsit_node below, as we know that the chain
- contains only discretionaries and native_word nodes, no other whatsits or char_nodes }
+ { we can just check type(p)=|whatsit_node| below, as we know that the chain
+ contains only discretionaries and |native_word| nodes, no other whatsits or |char_nodes| }
if (pp <> link(p)) then begin
{ found a chain of at least two pieces starting at p }
@@ -6953,7 +6992,7 @@ begin
set_native_metrics(p, XeTeX_use_glyph_metrics); { and measure it (i.e., re-do the OT layout) }
end;
- { now incorporate the native_word node measurements into the box we're packing }
+ { now incorporate the |native_word| node measurements into the box we're packing }
if height(p) > h then
h := height(p);
if depth(p) > d then
@@ -7388,7 +7427,7 @@ var
pdf_box_type: integer;
result: integer;
begin
- { scan the filename and pack into name_of_file }
+ { scan the filename and pack into |name_of_file| }
scan_file_name;
pack_cur_name;
@@ -7620,7 +7659,7 @@ end
@d XeTeX_pdf_page_count_code = XeTeX_int+29
-{ NB: must update eTeX_dim when items are added here! }
+{ NB: must update |eTeX_dim| when items are added here! }
@z
@x
@@ -8170,7 +8209,7 @@ glue_node: begin round_glue;
@<Handle a glue node for mixed...@>;
end;
@y
-@ Need to measure native_word and picture nodes when reversing!
+@ Need to measure |native_word| and picture nodes when reversing!
@<Cases of |reverse|...@>=
whatsit_node:
if (subtype(p)=native_word_node)
@@ -8294,7 +8333,7 @@ exit:end;
effective_char_info:=null_character;
exit:end;
-{ the following procedure has been moved so that new_native_character can call it }
+{ the following procedure has been moved so that |new_native_character| can call it }
procedure char_warning(@!f:internal_font_number;@!c:integer);
var old_setting: integer; {saved value of |tracing_online|}
@@ -8305,7 +8344,7 @@ begin if tracing_lost_chars>0 then
print_nl("Missing character: There is no ");
@.Missing character@>
if c < @"10000 then print_ASCII(c)
- else begin { non-Plane 0 Unicodes can't be sent through print_ASCII }
+ else begin { non-Plane 0 Unicodes can't be sent through |print_ASCII| }
print("character number ");
print_hex(c);
end;
@@ -8320,7 +8359,7 @@ end;
function new_native_word_node(@!f:internal_font_number;@!n:integer):pointer;
{ note that this function creates the node, but does not actually set its metrics;
- call set_native_metrics(node) if that is required! }
+ call |set_native_metrics(node)| if that is required! }
var
l: integer;
q: pointer;
@@ -8480,19 +8519,27 @@ var
f: internal_font_number;
full_name: str_number;
begin
- { on entry here, the full name is packed into name_of_file in UTF8 form }
+ { on entry here, the full name is packed into |name_of_file| in UTF8 form }
load_native_font := null_font;
- if (s < 0) then actual_size := -s * unity div 100 else actual_size := s;
- font_engine := find_native_font(name_of_file + 1, actual_size);
+ font_engine := find_native_font(name_of_file + 1, s);
if font_engine = 0 then goto done;
+
+ if s>=0 then
+ actual_size := s
+ else begin
+ if (s <> -1000) then
+ actual_size := xn_over_d(loaded_font_design_size,-s,1000)
+ else
+ actual_size := loaded_font_design_size;
+ end;
{ look again to see if the font is already loaded, now that we know its canonical name }
str_room(name_length);
for k := 1 to name_length do
append_char(name_of_file[k]);
- full_name := make_string; { not slow_make_string because we'll flush it if the font was already loaded }
+ full_name := make_string; { not |slow_make_string| because we'll flush it if the font was already loaded }
for f:=font_base+1 to font_ptr do
if (font_area[f] = native_font_type_flag) and str_eq_str(font_name[f], full_name) and (font_size[f] = actual_size) then begin
@@ -8508,7 +8555,7 @@ begin
{ we've found a valid installed font, and have room }
incr(font_ptr);
- font_area[font_ptr] := native_font_type_flag; { set by find_native_font to either aat_font_flag or ot_font_flag }
+ font_area[font_ptr] := native_font_type_flag; { set by |find_native_font| to either |aat_font_flag| or |ot_font_flag| }
{ store the canonical name }
font_name[font_ptr] := full_name;
@@ -8518,7 +8565,7 @@ begin
font_check[font_ptr].b2 := 0;
font_check[font_ptr].b3 := 0;
font_glue[font_ptr] := null;
- font_dsize[font_ptr] := 10 * unity;
+ font_dsize[font_ptr] := loaded_font_design_size;
font_size[font_ptr] := actual_size;
if (native_font_type_flag = aat_font_flag) then begin
@@ -8532,7 +8579,7 @@ begin
height_base[font_ptr] := ascent;
depth_base[font_ptr] := -descent;
- font_params[font_ptr] := 8; { we add an extra \fontdimen: #8 -> cap_height }
+ font_params[font_ptr] := 8; { we add an extra fontdimen: \#8 -> |cap_height| }
font_bc[font_ptr] := 0;
font_ec[font_ptr] := 65535;
font_used[font_ptr] := false;
@@ -8549,21 +8596,21 @@ begin
s := width(p) + loaded_font_letter_space;
free_node(p, native_size(p));
- font_info[fmem_ptr].sc := font_slant; {slant}
+ font_info[fmem_ptr].sc := font_slant; {|slant|}
incr(fmem_ptr);
- font_info[fmem_ptr].sc := s; {space = width of space character}
+ font_info[fmem_ptr].sc := s; {|space| = width of space character}
incr(fmem_ptr);
- font_info[fmem_ptr].sc := s div 2; {space_stretch = 1/2 * space}
+ font_info[fmem_ptr].sc := s div 2; {|space_stretch| = 1/2 * space}
incr(fmem_ptr);
- font_info[fmem_ptr].sc := s div 3; {space_shrink = 1/3 * space}
+ font_info[fmem_ptr].sc := s div 3; {|space_shrink| = 1/3 * space}
incr(fmem_ptr);
- font_info[fmem_ptr].sc := x_ht; {x_height}
+ font_info[fmem_ptr].sc := x_ht; {|x_height|}
incr(fmem_ptr);
- font_info[fmem_ptr].sc := font_size[font_ptr]; {quad = font size}
+ font_info[fmem_ptr].sc := font_size[font_ptr]; {|quad| = font size}
incr(fmem_ptr);
- font_info[fmem_ptr].sc := s div 3; {extra_space = 1/3 * space}
+ font_info[fmem_ptr].sc := s div 3; {|extra_space| = 1/3 * space}
incr(fmem_ptr);
- font_info[fmem_ptr].sc := cap_ht; {cap_height}
+ font_info[fmem_ptr].sc := cap_ht; {|cap_height|}
incr(fmem_ptr);
font_mapping[font_ptr] := loaded_font_mapping;
diff --git a/Build/source/texk/web2c/xetexdir/xetex.mk b/Build/source/texk/web2c/xetexdir/xetex.mk
index a8bbdc158fb..493895e0bae 100644
--- a/Build/source/texk/web2c/xetexdir/xetex.mk
+++ b/Build/source/texk/web2c/xetexdir/xetex.mk
@@ -205,7 +205,8 @@ XeTeXFontInst_FT2.o: $(srcdir)/xetexdir/XeTeXFontInst_FT2.cpp $(XeTeXFontHdrs)
XeTeXOTMath.o: $(srcdir)/xetexdir/XeTeXOTMath.cpp $(XeTeXFontHdrs)
$(CXX) $(ICUCFLAGS) $(FTFLAGS) $(FONTCONFIGCPPFLAGS) $(ALL_CXXFLAGS) $(XETEX_DEFINES) -c $< -o $@
-XeTeXGrLayout.o: $(srcdir)/xetexdir/XeTeXGrLayout.cpp $(srcdir)/xetexdir/XeTeXGrLayout.h $(XeTeXFontHdrs)
+XeTeXGrLayout.o: $(srcdir)/xetexdir/XeTeXGrLayout.cpp $(srcdir)/xetexdir/XeTeXGrLayout.h \
+ $(XeTeXFontHdrs) $(GRAPHITESRCDIR)/include/graphite/Font.h
$(CXX) $(ICUCFLAGS) $(FTFLAGS) $(GRAPHITEFLAGS) $(ALL_CXXFLAGS) $(XETEX_DEFINES) -c $< -o $@
# special rules for files that need the TECkit headers as well
@@ -218,7 +219,8 @@ trans.o: $(srcdir)/xetexdir/trans.c
$(compile) $(ALL_CFLAGS) $(XETEX_DEFINES) -c $< -o $@
# Making xetex.
-xetex: $(xetex_o) $(xetex_add_o) $(xetex_images_o) $(xetex_ot_layout_o) $(EXTRADEPS)
+xetex: $(xetex_o) $(xetex_add_o) $(xetex_images_o) $(xetex_ot_layout_o) \
+ $(GRAPHITEDEP) $(TECKITDEP) $(FREETYPE2DEP) $(ICUDEP) $(EXTRADEPS)
@CXXHACKLINK@ $(xetex_o) $(xetex_add_o) $(xetex_images_o) $(xetex_ot_layout_o) \
$(FONTCONFIGLDFLAGS) $(socketlibs) $(xetexlibs) $(EXTRALIBS) \
@CXXHACKLDLIBS@ @CXXLDEXTRA@ @PTHREAD_CFLAGS@ @PTHREAD_LIBS@