summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c
diff options
context:
space:
mode:
authorJonathan Kew <jfkthame@googlemail.com>2008-03-27 09:58:47 +0000
committerJonathan Kew <jfkthame@googlemail.com>2008-03-27 09:58:47 +0000
commit194899d8a5ee8f12d82f140c728e1f9dad6c1d04 (patch)
treebb6b4ec379c4b0d0bd6716c2b0e452d160957085 /Build/source/texk/web2c
parent8fa331c4a7ed20194a81c2a9c5a9511ca2ab66dd (diff)
merge xetex updates (r.632) - embolden, OT math fontdimens
git-svn-id: svn://tug.org/texlive/trunk@7185 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c')
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp23
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.h6
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeXOTMath.cpp9
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeXOTMath.h11
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeX_ext.c225
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeX_ext.h4
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeX_mac.c71
-rw-r--r--Build/source/texk/web2c/xetexdir/xetex.ch23
-rw-r--r--Build/source/texk/web2c/xetexdir/xetex.defines1
9 files changed, 197 insertions, 176 deletions
diff --git a/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp b/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp
index 26936bc9d66..dcc407165c2 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp
+++ b/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp
@@ -66,6 +66,7 @@ struct XeTeXLayoutEngine_rec
UInt32 rgbValue;
float extend;
float slant;
+ float embolden;
gr::Segment* grSegment;
XeTeXGrFont* grFont;
XeTeXGrTextSource* grSource;
@@ -527,9 +528,14 @@ float getSlantFactor(XeTeXLayoutEngine engine)
return engine->slant;
}
+float getEmboldenFactor(XeTeXLayoutEngine engine)
+{
+ return engine->embolden;
+}
+
XeTeXLayoutEngine createLayoutEngine(PlatformFontRef fontRef, XeTeXFont font, UInt32 scriptTag, UInt32 languageTag,
UInt32* addFeatures, SInt32* addParams, UInt32* removeFeatures, UInt32 rgbValue,
- float extend, float slant)
+ float extend, float slant, float embolden)
{
LEErrorCode status = LE_NO_ERROR;
XeTeXLayoutEngine result = new XeTeXLayoutEngine_rec;
@@ -542,6 +548,7 @@ XeTeXLayoutEngine createLayoutEngine(PlatformFontRef fontRef, XeTeXFont font, UI
result->rgbValue = rgbValue;
result->extend = extend;
result->slant = slant;
+ result->embolden = embolden;
result->grSegment = NULL;
result->grSource = NULL;
@@ -887,7 +894,7 @@ gr::LayoutEnvironment layoutEnv;
XeTeXLayoutEngine createGraphiteEngine(PlatformFontRef fontRef, XeTeXFont font,
const char* name,
UInt32 rgbValue, int rtl, UInt32 languageTag,
- float extend, float slant,
+ float extend, float slant, float embolden,
int nFeatures, const int* featureIDs, const int* featureValues)
{
// check if the font supports graphite, and return NULL if not
@@ -905,6 +912,7 @@ XeTeXLayoutEngine createGraphiteEngine(PlatformFontRef fontRef, XeTeXFont font,
result->rgbValue = rgbValue;
result->extend = extend;
result->slant = slant;
+ result->embolden = embolden;
result->layoutEngine = NULL;
result->grFont = new XeTeXGrFont(result->font, name);
@@ -1050,6 +1058,17 @@ int usingGraphite(XeTeXLayoutEngine engine)
return engine->grFont != NULL;
}
+#define kMATHTableTag 0x4D415448 /* 'MATH' */
+
+int isOpenTypeMathFont(XeTeXLayoutEngine engine)
+{
+ if (engine->layoutEngine != NULL) {
+ if (engine->font->getFontTable(kMATHTableTag) != NULL)
+ return 1;
+ }
+ return 0;
+}
+
int
findGraphiteFeature(XeTeXLayoutEngine engine, const char* s, const char* e, int* f, int* v)
/* s...e is a "feature=setting" string; look for this in the font */
diff --git a/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.h b/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.h
index 308bd12ecc6..6460945546a 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.h
+++ b/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.h
@@ -95,7 +95,7 @@ UInt32 countGlyphs(XeTeXFont font);
XeTeXLayoutEngine createLayoutEngine(PlatformFontRef fontRef, XeTeXFont font, UInt32 scriptTag, UInt32 languageTag,
UInt32* addFeatures, SInt32* addParams, UInt32* removeFeatures, UInt32 rgbValue,
- float extend, float slant);
+ float extend, float slant, float embolden);
void deleteLayoutEngine(XeTeXLayoutEngine engine);
@@ -104,6 +104,7 @@ PlatformFontRef getFontRef(XeTeXLayoutEngine engine);
float getExtendFactor(XeTeXLayoutEngine engine);
float getSlantFactor(XeTeXLayoutEngine engine);
+float getEmboldenFactor(XeTeXLayoutEngine engine);
SInt32 layoutChars(XeTeXLayoutEngine engine, UInt16* chars, SInt32 offset, SInt32 count, SInt32 max,
char rightToLeft, float x, float y, SInt32* status);
@@ -154,7 +155,7 @@ int getFontCharRange(XeTeXLayoutEngine engine, int reqFirst);
XeTeXLayoutEngine createGraphiteEngine(PlatformFontRef fontRef, XeTeXFont font,
const char* name,
UInt32 rgbValue, int rtl, UInt32 languageTag,
- float extend, float slant,
+ float extend, float slant, float embolden,
int nFeatures, const int* featureIDs, const int* featureValues);
int makeGraphiteSegment(XeTeXLayoutEngine engine, const UniChar* txtPtr, int txtLen);
void getGraphiteGlyphInfo(XeTeXLayoutEngine engine, int index, UInt16* glyphID, float* x, float* y);
@@ -164,6 +165,7 @@ int findNextGraphiteBreak(int iOffset, int iBrkVal);
int usingOpenType(XeTeXLayoutEngine engine);
int usingGraphite(XeTeXLayoutEngine engine);
+int isOpenTypeMathFont(XeTeXLayoutEngine engine);
int findGraphiteFeature(XeTeXLayoutEngine engine, const char* s, const char* e, int* f, int* v);
diff --git a/Build/source/texk/web2c/xetexdir/XeTeXOTMath.cpp b/Build/source/texk/web2c/xetexdir/XeTeXOTMath.cpp
index c690c683c8c..4625fa84362 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeXOTMath.cpp
+++ b/Build/source/texk/web2c/xetexdir/XeTeXOTMath.cpp
@@ -49,7 +49,7 @@ extern "C" {
#include "LESwaps.h"
-int getMathConstant(LEFontInstance* fontInst, mathConstantIndex whichConstant)
+static SInt16 getMathConstant(LEFontInstance* fontInst, mathConstantIndex whichConstant)
{
const char* table = (const char*)fontInst->getFontTable(kMATHTableTag);
if (table == NULL)
@@ -80,7 +80,10 @@ getotmathconstant(int f, int n)
if (fontarea[f] == OTGR_FONT_FLAG) {
XeTeXFontInst* font = (XeTeXFontInst*)getFont((XeTeXLayoutEngine)fontlayoutengine[f]);
- rval = X2Fix(getMathConstant(font, (mathConstantIndex)n) * Fix2X(fontsize[f]) / font->getUnitsPerEM());
+ rval = getMathConstant(font, (mathConstantIndex)n);
+ /* scale according to font size, except the ones that are percentages */
+ if (n > scriptScriptPercentScaleDown && n < radicalDegreeBottomRaisePercent)
+ rval = X2Fix(rval * Fix2X(fontsize[f]) / font->getUnitsPerEM());
}
return rval;
}
@@ -194,7 +197,7 @@ getnativemathexparam(int f, int n)
}
int
-getotmathvariant(int f, int g, int v, int* adv, int horiz)
+getotmathvariant(int f, int g, int v, integer* adv, int horiz)
{
int rval = g;
*adv = -1;
diff --git a/Build/source/texk/web2c/xetexdir/XeTeXOTMath.h b/Build/source/texk/web2c/xetexdir/XeTeXOTMath.h
index 654b2a4ac91..5c530cf9853 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeXOTMath.h
+++ b/Build/source/texk/web2c/xetexdir/XeTeXOTMath.h
@@ -31,6 +31,8 @@ authorization from SIL International.
#ifndef __XETEX_OT_MATH__
#define __XETEX_OT_MATH__
+#include "XeTeX_ext.h"
+
#ifdef XETEX_OT_MATH_IMPLEMENTATION
#include "MathTable.h"
#include "LEFontInstance.h"
@@ -45,7 +47,7 @@ extern "C" {
int getnativemathsyparam(int f, int n);
int getnativemathexparam(int f, int n);
int getotmathconstant(int f, int n);
- int getotmathvariant(int f, int g, int v, int* adv, int horiz);
+ int getotmathvariant(int f, int g, int v, integer* adv, int horiz);
void* getotassemblyptr(int f, int g, int horiz);
int getotmathitalcorr(int f, int g);
int getotmathaccentpos(int f, int g);
@@ -60,11 +62,4 @@ extern "C" {
};
#endif
-#ifdef XETEX_OT_MATH_IMPLEMENTATION
-/* internal functions */
-
-/* get a math font constant, scaled according to the font size */
-int getMathConstant(LEFontInstance* fontInst, mathConstantIndex whichConstant);
-#endif
-
#endif
diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
index 2dfae15fa7f..f12f2edd089 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
+++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
@@ -618,6 +618,73 @@ read_rgb_a(const char** cp)
return rgbValue;
}
+int
+readCommonFeatures(const char* feat, const char* end, float* extend, float* slant, float* embolden, float* letterspace, UInt32* rgbValue)
+ // returns 1 to go to next_option, -1 for bad_option, 0 to continue
+{
+ const char* sep;
+ if (strncmp(feat, "mapping", 7) == 0) {
+ sep = feat + 7;
+ if (*sep != '=')
+ return -1;
+ loadedfontmapping = load_mapping_file(sep + 1, end);
+ return 1;
+ }
+
+ if (strncmp(feat, "extend", 6) == 0) {
+ sep = feat + 6;
+ if (*sep != '=')
+ return -1;
+ ++sep;
+ *extend = read_double(&sep);
+ return 1;
+ }
+
+ if (strncmp(feat, "slant", 5) == 0) {
+ sep = feat + 5;
+ if (*sep != '=')
+ return -1;
+ ++sep;
+ *slant = read_double(&sep);
+ return 1;
+ }
+
+ if (strncmp(feat, "embolden", 8) == 0) {
+ sep = feat + 8;
+ if (*sep != '=')
+ return -1;
+ ++sep;
+ *embolden = read_double(&sep);
+ return 1;
+ }
+
+ if (strncmp(feat, "letterspace", 11) == 0) {
+ sep = feat + 11;
+ if (*sep != '=')
+ return -1;
+ ++sep;
+ *letterspace = read_double(&sep);
+ return 1;
+ }
+
+ if (strncmp(feat, "color", 5) == 0) {
+ const char* s;
+ sep = feat + 5;
+ if (*sep != '=')
+ return -1;
+ ++sep;
+ s = sep;
+ *rgbValue = read_rgb_a(&sep);
+ if ((sep == s+6) || (sep == s+8))
+ loadedfontflags |= FONT_FLAGS_COLORED;
+ else
+ return -1;
+ return 1;
+ }
+
+ return 0;
+}
+
static void*
loadOTfont(PlatformFontRef fontRef, XeTeXFont font, Fixed scaled_size, const char* cp1)
{
@@ -639,8 +706,12 @@ loadOTfont(PlatformFontRef fontRef, XeTeXFont font, Fixed scaled_size, const cha
UInt32 rgbValue = 0x000000FF;
- double extend = 1.0;
- double slant = 0.0;
+ float extend = 1.0;
+ float slant = 0.0;
+ float embolden = 0.0;
+ float letterspace = 0.0;
+
+ int i;
/* scan the feature string (if any) */
if (cp1 != NULL) {
@@ -672,57 +743,11 @@ loadOTfont(PlatformFontRef fontRef, XeTeXFont font, Fixed scaled_size, const cha
goto next_option;
}
- if (strncmp(cp1, "mapping", 7) == 0) {
- cp3 = cp1 + 7;
- if (*cp3 != '=')
- goto bad_option;
- loadedfontmapping = load_mapping_file(cp3 + 1, cp2);
- goto next_option;
- }
-
- if (strncmp(cp1, "extend", 6) == 0) {
- cp3 = cp1 + 6;
- if (*cp3 != '=')
- goto bad_option;
- ++cp3;
- extend = read_double(&cp3);
+ i = readCommonFeatures(cp1, cp2, &extend, &slant, &embolden, &letterspace, &rgbValue);
+ if (i == 1)
goto next_option;
- }
-
- if (strncmp(cp1, "slant", 5) == 0) {
- cp3 = cp1 + 5;
- if (*cp3 != '=')
- goto bad_option;
- ++cp3;
- slant = read_double(&cp3);
- goto next_option;
- }
-
- if (strncmp(cp1, "color", 5) == 0) {
- const char* s;
- cp3 = cp1 + 5;
- if (*cp3 != '=')
- goto bad_option;
- ++cp3;
- s = cp3;
- rgbValue = read_rgb_a(&cp3);
- if ((cp3 == s+6) || (cp3 == s+8))
- loadedfontflags |= FONT_FLAGS_COLORED;
- else
- goto bad_option;
- goto next_option;
- }
-
- if (strncmp(cp1, "letterspace", 11) == 0) {
- double val;
- cp3 = cp1 + 11;
- if (*cp3 != '=')
- goto bad_option;
- ++cp3;
- val = read_double(&cp3);
- loadedfontletterspace = (val / 100.0) * scaled_size;
- goto next_option;
- }
+ else if (i == -1)
+ goto bad_option;
if (*cp1 == '+') {
SInt32 param = 0;
@@ -783,6 +808,12 @@ loadOTfont(PlatformFontRef fontRef, XeTeXFont font, Fixed scaled_size, const cha
}
}
+ if (embolden != 0.0)
+ embolden = embolden * Fix2X(scaled_size) / 100.0;
+
+ if (letterspace != 0.0)
+ loadedfontletterspace = (letterspace / 100.0) * scaled_size;
+
if ((loadedfontflags & FONT_FLAGS_COLORED) == 0)
rgbValue = 0x000000FF;
@@ -791,7 +822,7 @@ loadOTfont(PlatformFontRef fontRef, XeTeXFont font, Fixed scaled_size, const cha
engine = createLayoutEngine(fontRef, font, scriptTag, languageTag,
addFeatures, addParams, removeFeatures, rgbValue,
- extend, slant);
+ extend, slant, embolden);
if (engine == 0) {
// only free these if creation failed, otherwise the engine now owns them
if (addFeatures)
@@ -844,19 +875,23 @@ loadGraphiteFont(PlatformFontRef fontRef, XeTeXFont font, Fixed scaled_size, con
UInt32 rgbValue = 0x000000FF;
UInt32 languageTag = 0;
- double extend = 1.0;
- double slant = 0.0;
+ float extend = 1.0;
+ float slant = 0.0;
+ float embolden = 0.0;
+ float letterspace = 0.0;
int rtl = 0;
int featureIDs[MAX_GRAPHITE_FEATURES];
int featureValues[MAX_GRAPHITE_FEATURES];
int nFeatures = 0;
int id, val;
+
+ int i;
/* create a default engine so we can query the font for Graphite features;
because of font caching, it's cheap to discard this and create the real one later */
engine = createGraphiteEngine(fontRef, font, faceName, rgbValue, rtl, languageTag,
- extend, slant, 0, NULL, NULL);
+ extend, slant, embolden, 0, NULL, NULL);
if (engine == NULL)
return NULL;
@@ -882,57 +917,11 @@ loadGraphiteFont(PlatformFontRef fontRef, XeTeXFont font, Fixed scaled_size, con
goto next_option;
}
- if (strncmp(cp1, "mapping", 7) == 0) {
- cp3 = cp1 + 7;
- if (*cp3 != '=')
- goto bad_option;
- loadedfontmapping = load_mapping_file(cp3 + 1, cp2);
- goto next_option;
- }
-
- if (strncmp(cp1, "extend", 6) == 0) {
- cp3 = cp1 + 6;
- if (*cp3 != '=')
- goto bad_option;
- ++cp3;
- extend = read_double(&cp3);
- goto next_option;
- }
-
- if (strncmp(cp1, "slant", 5) == 0) {
- cp3 = cp1 + 5;
- if (*cp3 != '=')
- goto bad_option;
- ++cp3;
- slant = read_double(&cp3);
- goto next_option;
- }
-
- if (strncmp(cp1, "color", 5) == 0) {
- const char* s;
- cp3 = cp1 + 5;
- if (*cp3 != '=')
- goto bad_option;
- ++cp3;
- s = cp3;
- rgbValue = read_rgb_a(&cp3);
- if ((cp3 == s+6) || (cp3 == s+8))
- loadedfontflags |= FONT_FLAGS_COLORED;
- else
- goto bad_option;
- goto next_option;
- }
-
- if (strncmp(cp1, "letterspace", 11) == 0) {
- double val;
- cp3 = cp1 + 11;
- if (*cp3 != '=')
- goto bad_option;
- ++cp3;
- val = read_double(&cp3);
- loadedfontletterspace = (val / 100.0) * scaled_size;
+ i = readCommonFeatures(cp1, cp2, &extend, &slant, &embolden, &letterspace, &rgbValue);
+ if (i == 1)
goto next_option;
- }
+ else if (i == -1)
+ goto bad_option;
if (readFeatureNumber(cp1, cp2, &id, &val)
|| findGraphiteFeature(engine, cp1, cp2, &id, &val)) {
@@ -983,6 +972,12 @@ loadGraphiteFont(PlatformFontRef fontRef, XeTeXFont font, Fixed scaled_size, con
}
+ if (embolden != 0.0)
+ embolden = embolden * Fix2X(scaled_size) / 100.0;
+
+ if (letterspace != 0.0)
+ loadedfontletterspace = (letterspace / 100.0) * scaled_size;
+
if ((loadedfontflags & FONT_FLAGS_COLORED) == 0)
rgbValue = 0x000000FF;
@@ -991,7 +986,7 @@ loadGraphiteFont(PlatformFontRef fontRef, XeTeXFont font, Fixed scaled_size, con
// deleteLayoutEngine(engine);
engine = createGraphiteEngine(fontRef, font, faceName, rgbValue, rtl, languageTag,
- extend, slant, nFeatures, &featureIDs[0], &featureValues[0]);
+ extend, slant, embolden, nFeatures, &featureIDs[0], &featureValues[0]);
if (engine != NULL)
nativefonttypeflag = OTGR_FONT_FLAG;
@@ -1395,6 +1390,7 @@ grfontgetnamed1(integer what, void* pEngine, integer param)
#define XDV_FLAG_VARIATIONS 0x0800
#define XDV_FLAG_EXTEND 0x1000
#define XDV_FLAG_SLANT 0x2000
+#define XDV_FLAG_EMBOLDEN 0x4000
#ifdef XETEX_MAC
static UInt32
@@ -1498,6 +1494,7 @@ makefontdef(integer f)
PlatformFontRef fontRef = 0;
float extend = 1.0;
float slant = 0.0;
+ float embolden = 0.0;
#ifdef XETEX_MAC
ATSUStyle style = NULL;
@@ -1528,6 +1525,10 @@ makefontdef(integer f)
extend = t.a;
slant = t.b;
+ float tmp = 0.0;
+ if (ATSUGetAttribute(style, kXeTeXEmboldenTag, sizeof(float), &tmp, 0) != kATSUNotSetErr)
+ embolden = tmp;
+
ATSUGetAttribute(style, kATSUSizeTag, sizeof(Fixed), &size, 0);
}
else
@@ -1552,6 +1553,7 @@ makefontdef(integer f)
extend = getExtendFactor(engine);
slant = getSlantFactor(engine);
+ embolden = getEmboldenFactor(engine);
size = X2Fix(getPointSize(engine));
}
@@ -1605,6 +1607,10 @@ makefontdef(integer f)
fontDefLength += 4;
flags |= XDV_FLAG_SLANT;
}
+ if (embolden != 0.0) {
+ fontDefLength += 4;
+ flags |= XDV_FLAG_EMBOLDEN;
+ }
if (fontDefLength > xdvBufSize) {
if (xdvbuffer != NULL)
@@ -1670,6 +1676,11 @@ makefontdef(integer f)
*(UInt32*)(cp) = SWAP32(f);
cp += 4;
}
+ if (flags & XDV_FLAG_EMBOLDEN) {
+ Fixed f = X2Fix(embolden);
+ *(UInt32*)(cp) = SWAP32(f);
+ cp += 4;
+ }
return fontDefLength;
}
diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.h b/Build/source/texk/web2c/xetexdir/XeTeX_ext.h
index 4c7e22fad60..9c2d362dffa 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.h
+++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.h
@@ -64,6 +64,9 @@ typedef struct UFILE* unicodefile;
#define FONT_FLAGS_COLORED 0x01
#define FONT_FLAGS_VERTICAL 0x02
+#define kXeTeXEmboldenTag 0x10000 /* user-defined ATSUAttributeTag to carry 'embolden' value */
+
+
/* some typedefs that XeTeX uses - on Mac OS, we get these from Apple headers,
but otherwise we'll need these substitute definitions */
@@ -225,6 +228,7 @@ extern "C" {
void* load_mapping_file(const char* s, const char* e);
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);
/* 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);
diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_mac.c b/Build/source/texk/web2c/xetexdir/XeTeX_mac.c
index 7cbf43bedc4..e9a728ecb85 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeX_mac.c
+++ b/Build/source/texk/web2c/xetexdir/XeTeX_mac.c
@@ -649,8 +649,11 @@ loadAATfont(ATSFontRef fontRef, long scaled_size, const char* cp1)
ATSUFontID fontID = FMGetFontFromATSFontRef(fontRef);
ATSUStyle style = 0;
OSStatus status = ATSUCreateStyle(&style);
- double extend = 1.0;
- double slant = 0.0;
+ float extend = 1.0;
+ float slant = 0.0;
+ float embolden = 0.0;
+ float letterspace = 0.0;
+ int i;
if (status == noErr) {
UInt32 rgbValue;
@@ -796,46 +799,11 @@ loadAATfont(ATSFontRef fontRef, long scaled_size, const char* cp1)
// didn't find feature or variation, try other options....
- if (strncmp(cp1, "mapping", 7) == 0) {
- cp3 = cp1 + 7;
- if (*cp3 != '=')
- goto bad_option;
- loadedfontmapping = load_mapping_file(cp3 + 1, cp2);
- goto next_option;
- }
-
- if (strncmp(cp1, "extend", 6) == 0) {
- cp3 = cp1 + 6;
- if (*cp3 != '=')
- goto bad_option;
- ++cp3;
- extend = read_double(&cp3);
- goto next_option;
- }
-
- if (strncmp(cp1, "slant", 5) == 0) {
- cp3 = cp1 + 5;
- if (*cp3 != '=')
- goto bad_option;
- ++cp3;
- slant = read_double(&cp3);
- goto next_option;
- }
-
- if (strncmp(cp1, "color", 5) == 0) {
- const char* s;
- cp3 = cp1 + 5;
- if (*cp3 != '=')
- goto bad_option;
- ++cp3;
- s = cp3;
- rgbValue = read_rgb_a(&cp3);
- if ((cp3 == s+6) || (cp3 == s+8))
- loadedfontflags |= FONT_FLAGS_COLORED;
- else
- goto bad_option;
+ i = readCommonFeatures(cp1, cp2, &extend, &slant, &embolden, &letterspace, &rgbValue);
+ if (i == 1)
goto next_option;
- }
+ else if (i == -1)
+ goto bad_option;
if (strncmp(cp1, "tracking", 8) == 0) {
cp3 = cp1 + 8;
@@ -847,16 +815,6 @@ loadAATfont(ATSFontRef fontRef, long scaled_size, const char* cp1)
goto next_option;
}
- if (strncmp(cp1, "letterspace", 11) == 0) {
- cp3 = cp1 + 11;
- if (*cp3 != '=')
- goto bad_option;
- ++cp3;
- double val = read_double(&cp3);
- loadedfontletterspace = (val / 100.0) * scaled_size;
- goto next_option;
- }
-
bad_option:
// not a name=value pair, or not recognized....
// check for plain "vertical" before complaining
@@ -918,6 +876,17 @@ loadAATfont(ATSFontRef fontRef, long scaled_size, const char* cp1)
ATSUSetAttributes(style, 1, tags, sizes, attrs);
}
+ if (embolden != 0.0) {
+ embolden = embolden * Fix2X(scaled_size) / 100.0;
+ tags[0] = kXeTeXEmboldenTag;
+ sizes[0] = sizeof(float);
+ attrs[0] = &embolden;
+ ATSUSetAttributes(style, 1, tags, sizes, attrs);
+ }
+
+ if (letterspace != 0.0)
+ loadedfontletterspace = (letterspace / 100.0) * scaled_size;
+
free((char*)featureTypes);
free((char*)selectorValues);
free((char*)axes);
diff --git a/Build/source/texk/web2c/xetexdir/xetex.ch b/Build/source/texk/web2c/xetexdir/xetex.ch
index 564887f0ddc..ccee9272ac0 100644
--- a/Build/source/texk/web2c/xetexdir/xetex.ch
+++ b/Build/source/texk/web2c/xetexdir/xetex.ch
@@ -8557,8 +8557,10 @@ end;
function load_native_font(u: pointer; nom, aire:str_number; s: scaled): internal_font_number;
label
done;
+const
+ first_math_fontdimen = 10;
var
- k: integer;
+ k, num_font_dimens: integer;
font_engine: void_pointer; {really an ATSUStyle or XeTeXLayoutEngine}
actual_size: scaled; {|s| converted to real size, if it was negative}
p: pointer; {for temporary |native_char| node we'll create}
@@ -8596,7 +8598,12 @@ begin
goto done;
end;
- if (font_ptr = font_max) or (fmem_ptr + 8 > font_mem_size) then begin
+ if (native_font_type_flag = otgr_font_flag) and isOpenTypeMathFont(font_engine) then
+ num_font_dimens := first_math_fontdimen + lastMathConstant
+ else
+ num_font_dimens := 8;
+
+ if (font_ptr = font_max) or (fmem_ptr + num_font_dimens > font_mem_size) then begin
@<Apologize for not loading the font, |goto done|@>;
end;
@@ -8626,7 +8633,8 @@ 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] := num_font_dimens; { we add an extra fontdimen: \#8 -> |cap_height|;
+ then OT math fonts have a bunch more }
font_bc[font_ptr] := 0;
font_ec[font_ptr] := 65535;
font_used[font_ptr] := false;
@@ -8660,6 +8668,15 @@ begin
font_info[fmem_ptr].sc := cap_ht; {|cap_height|}
incr(fmem_ptr);
+ if num_font_dimens = first_math_fontdimen + lastMathConstant then begin
+ font_info[fmem_ptr].int := num_font_dimens; { \fontdimen9 = number of assigned fontdimens }
+ incr(fmem_ptr);
+ for k := 0 to lastMathConstant do begin
+ font_info[fmem_ptr].sc := get_ot_math_constant(font_ptr, k);
+ incr(fmem_ptr);
+ end;
+ end;
+
font_mapping[font_ptr] := loaded_font_mapping;
font_flags[font_ptr] := loaded_font_flags;
diff --git a/Build/source/texk/web2c/xetexdir/xetex.defines b/Build/source/texk/web2c/xetexdir/xetex.defines
index 51ba19c1353..0ead228689f 100644
--- a/Build/source/texk/web2c/xetexdir/xetex.defines
+++ b/Build/source/texk/web2c/xetexdir/xetex.defines
@@ -72,6 +72,7 @@ authorization from SIL International.
@define procedure grprintfontname();
@define function grfontgetnamed();
@define function grfontgetnamed1();
+@define function isOpenTypeMathFont();
@define function strerror();
@define procedure memcpy();