summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp
diff options
context:
space:
mode:
authorJonathan Kew <jfkthame@googlemail.com>2006-12-06 17:29:15 +0000
committerJonathan Kew <jfkthame@googlemail.com>2006-12-06 17:29:15 +0000
commite908059c852606dc94864e34c963f682da27e67b (patch)
tree627f62320c0c51fd1125ae98b2bf3e2c84ca9f1c /Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp
parent62dfc6d9588e7c3aa6a85b06b53479697b272243 (diff)
xetex updates for version 0.996
git-svn-id: svn://tug.org/texlive/trunk@2602 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp')
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp
index 63d9567222f..ebcf270eb47 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp
+++ b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp
@@ -320,7 +320,10 @@ XeTeXFontMgr::findFont(const char* name, char* variant, double ptSize)
// try for more boldness, with the same width and slant
Font* bestMatch = font;
if (font->weight < parent->maxWeight) {
- bestMatch = bestMatchFromFamily(parent, parent->maxWeight, font->width, font->slant);
+ // try to increase weight by 1/2 x (max - min), rounding up
+ bestMatch = bestMatchFromFamily(parent,
+ font->weight + (parent->maxWeight - parent->minWeight) / 2 + 1,
+ font->width, font->slant);
if (parent->minSlant == parent->maxSlant) {
// double-check the italic flag, as we can't trust slant values
Font* newBest = NULL;
@@ -445,12 +448,21 @@ XeTeXFontMgr::getOpSizeRecAndStyleFlags(Font* theFont)
if (font != 0) {
const GlyphPositioningTableHeader* gposTable = (const GlyphPositioningTableHeader*)getFontTablePtr(font, LE_GPOS_TABLE_TAG);
if (gposTable != NULL) {
- FeatureListTable* featureListTable = (FeatureListTable*)((char*)gposTable + SWAP(gposTable->featureListOffset));
+ 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) {
- FeatureTable* feature = (FeatureTable*)((char*)featureListTable + SWAP(featureListTable->featureRecordArray[i].featureTableOffset));
- OpSizeRec* pSizeRec = (OpSizeRec*)((char*)featureListTable + SWAP(feature->featureParamsOffset));
+ 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 */
+ if (offset < (const char*)feature - (const char*)featureListTable)
+ pSizeRec = (const OpSizeRec*)((char*)feature + offset);
+ else
+ pSizeRec = (const OpSizeRec*)((char*)featureListTable + offset);
theFont->opSizeInfo.designSize = SWAP(pSizeRec->designSize);
theFont->opSizeInfo.subFamilyID = SWAP(pSizeRec->subFamilyID);
theFont->opSizeInfo.nameCode = SWAP(pSizeRec->nameCode);