Lines 104-109
Link Here
|
104 |
#include "freetype/internal/sfnt.h" |
104 |
#include "freetype/internal/sfnt.h" |
105 |
#include "freetype/internal/ftstream.h" |
105 |
#include "freetype/internal/ftstream.h" |
106 |
|
106 |
|
|
|
107 |
// Freetype versions < 2.1 used different stream macro names |
108 |
#ifndef FT_NEXT_USHORT |
109 |
#define FT_NEXT_USHORT NEXT_UShort |
110 |
#define FT_NEXT_SHORT NEXT_Short |
111 |
#define FT_NEXT_LONG NEXT_Long |
112 |
#endif |
113 |
|
107 |
#include <svapp.hxx> |
114 |
#include <svapp.hxx> |
108 |
#include <settings.hxx> |
115 |
#include <settings.hxx> |
109 |
#include <tools/lang.hxx> |
116 |
#include <tools/lang.hxx> |
Lines 1200-1228
ULONG FreetypeServerFont::GetKernPairs(
Link Here
|
1200 |
ImplKernPairData aKernPair; |
1207 |
ImplKernPairData aKernPair; |
1201 |
|
1208 |
|
1202 |
const FT_Byte* pBuffer = pKern; |
1209 |
const FT_Byte* pBuffer = pKern; |
1203 |
USHORT nVersion = NEXT_UShort( pBuffer ); |
1210 |
USHORT nVersion = FT_NEXT_USHORT( pBuffer ); |
1204 |
USHORT nTableCnt = NEXT_UShort( pBuffer ); |
1211 |
USHORT nTableCnt = FT_NEXT_USHORT( pBuffer ); |
1205 |
if( nVersion != 0 ) // ignore Apple's versions for now |
1212 |
if( nVersion != 0 ) // ignore Apple's versions for now |
1206 |
nTableCnt = 0; |
1213 |
nTableCnt = 0; |
1207 |
for( USHORT nTableIdx = 0; nTableIdx < nTableCnt; ++nTableIdx ) |
1214 |
for( USHORT nTableIdx = 0; nTableIdx < nTableCnt; ++nTableIdx ) |
1208 |
{ |
1215 |
{ |
1209 |
USHORT nSubVersion = NEXT_UShort( pBuffer ); |
1216 |
USHORT nSubVersion = FT_NEXT_USHORT( pBuffer ); |
1210 |
USHORT nSubLength = NEXT_UShort( pBuffer ); |
1217 |
USHORT nSubLength = FT_NEXT_USHORT( pBuffer ); |
1211 |
USHORT nSubCoverage = NEXT_UShort( pBuffer ); |
1218 |
USHORT nSubCoverage = FT_NEXT_USHORT( pBuffer ); |
1212 |
if( (nSubCoverage&0x03) != 0x01 ) // no interest in minimum info here |
1219 |
if( (nSubCoverage&0x03) != 0x01 ) // no interest in minimum info here |
1213 |
continue; |
1220 |
continue; |
1214 |
switch( nSubCoverage >> 8 ) |
1221 |
switch( nSubCoverage >> 8 ) |
1215 |
{ |
1222 |
{ |
1216 |
case 0: // version 0, kerning format 0 |
1223 |
case 0: // version 0, kerning format 0 |
1217 |
{ |
1224 |
{ |
1218 |
USHORT nPairs = NEXT_UShort( pBuffer ); |
1225 |
USHORT nPairs = FT_NEXT_USHORT( pBuffer ); |
1219 |
pBuffer += 6; // skip search hints |
1226 |
pBuffer += 6; // skip search hints |
1220 |
aKernGlyphVector.reserve( aKernGlyphVector.size() + nPairs ); |
1227 |
aKernGlyphVector.reserve( aKernGlyphVector.size() + nPairs ); |
1221 |
for( int i = 0; i < nPairs; ++i ) |
1228 |
for( int i = 0; i < nPairs; ++i ) |
1222 |
{ |
1229 |
{ |
1223 |
aKernPair.mnChar1 = NEXT_UShort( pBuffer ); |
1230 |
aKernPair.mnChar1 = FT_NEXT_USHORT( pBuffer ); |
1224 |
aKernPair.mnChar2 = NEXT_UShort( pBuffer ); |
1231 |
aKernPair.mnChar2 = FT_NEXT_USHORT( pBuffer ); |
1225 |
/*long nUnscaledKern=*/ NEXT_Short( pBuffer ); |
1232 |
/*long nUnscaledKern=*/ FT_NEXT_SHORT( pBuffer ); |
1226 |
aKernGlyphVector.push_back( aKernPair ); |
1233 |
aKernGlyphVector.push_back( aKernPair ); |
1227 |
} |
1234 |
} |
1228 |
} |
1235 |
} |
Lines 1231-1248
ULONG FreetypeServerFont::GetKernPairs(
Link Here
|
1231 |
case 2: // version 0, kerning format 2 |
1238 |
case 2: // version 0, kerning format 2 |
1232 |
{ |
1239 |
{ |
1233 |
const FT_Byte* pSubTable = pBuffer; |
1240 |
const FT_Byte* pSubTable = pBuffer; |
1234 |
/*USHORT nRowWidth =*/ NEXT_UShort( pBuffer ); |
1241 |
/*USHORT nRowWidth =*/ FT_NEXT_USHORT( pBuffer ); |
1235 |
USHORT nOfsLeft = NEXT_UShort( pBuffer ); |
1242 |
USHORT nOfsLeft = FT_NEXT_USHORT( pBuffer ); |
1236 |
USHORT nOfsRight = NEXT_UShort( pBuffer ); |
1243 |
USHORT nOfsRight = FT_NEXT_USHORT( pBuffer ); |
1237 |
USHORT nOfsArray = NEXT_UShort( pBuffer ); |
1244 |
USHORT nOfsArray = FT_NEXT_USHORT( pBuffer ); |
1238 |
|
1245 |
|
1239 |
const FT_Byte* pTmp = pSubTable + nOfsLeft; |
1246 |
const FT_Byte* pTmp = pSubTable + nOfsLeft; |
1240 |
USHORT nFirstLeft = NEXT_UShort( pTmp ); |
1247 |
USHORT nFirstLeft = FT_NEXT_USHORT( pTmp ); |
1241 |
USHORT nLastLeft = NEXT_UShort( pTmp ) + nFirstLeft - 1; |
1248 |
USHORT nLastLeft = FT_NEXT_USHORT( pTmp ) + nFirstLeft - 1; |
1242 |
|
1249 |
|
1243 |
pTmp = pSubTable + nOfsRight; |
1250 |
pTmp = pSubTable + nOfsRight; |
1244 |
USHORT nFirstRight = NEXT_UShort( pTmp ); |
1251 |
USHORT nFirstRight = FT_NEXT_USHORT( pTmp ); |
1245 |
USHORT nLastRight = NEXT_UShort( pTmp ) + nFirstRight - 1; |
1252 |
USHORT nLastRight = FT_NEXT_USHORT( pTmp ) + nFirstRight - 1; |
1246 |
|
1253 |
|
1247 |
ULONG nPairs = (ULONG)(nLastLeft - nFirstLeft + 1) * (nLastRight - nFirstRight + 1); |
1254 |
ULONG nPairs = (ULONG)(nLastLeft - nFirstLeft + 1) * (nLastRight - nFirstRight + 1); |
1248 |
aKernGlyphVector.reserve( aKernGlyphVector.size() + nPairs ); |
1255 |
aKernGlyphVector.reserve( aKernGlyphVector.size() + nPairs ); |
Lines 1253-1259
ULONG FreetypeServerFont::GetKernPairs(
Link Here
|
1253 |
aKernPair.mnChar1 = nLeft; |
1260 |
aKernPair.mnChar1 = nLeft; |
1254 |
for( int nRight = 0; nRight < nLastRight; ++nRight ) |
1261 |
for( int nRight = 0; nRight < nLastRight; ++nRight ) |
1255 |
{ |
1262 |
{ |
1256 |
if( NEXT_Short( pTmp ) != 0 ) |
1263 |
if( FT_NEXT_SHORT( pTmp ) != 0 ) |
1257 |
{ |
1264 |
{ |
1258 |
aKernPair.mnChar2 = nRight; |
1265 |
aKernPair.mnChar2 = nRight; |
1259 |
aKernGlyphVector.push_back( aKernPair ); |
1266 |
aKernGlyphVector.push_back( aKernPair ); |
Lines 1531-1540
bool FreetypeServerFont::ApplyGSUB( cons
Link Here
|
1531 |
|
1538 |
|
1532 |
// parse GSUB header |
1539 |
// parse GSUB header |
1533 |
const FT_Byte* pGsubHeader = pGsubBase; |
1540 |
const FT_Byte* pGsubHeader = pGsubBase; |
1534 |
const ULONG nVersion = NEXT_Long( pGsubHeader ); |
1541 |
const ULONG nVersion = FT_NEXT_LONG( pGsubHeader ); |
1535 |
const USHORT nOfsScriptList = NEXT_UShort( pGsubHeader ); |
1542 |
const USHORT nOfsScriptList = FT_NEXT_USHORT( pGsubHeader ); |
1536 |
const USHORT nOfsFeatureTable = NEXT_UShort( pGsubHeader ); |
1543 |
const USHORT nOfsFeatureTable = FT_NEXT_USHORT( pGsubHeader ); |
1537 |
const USHORT nOfsLookupList = NEXT_UShort( pGsubHeader ); |
1544 |
const USHORT nOfsLookupList = FT_NEXT_USHORT( pGsubHeader ); |
1538 |
|
1545 |
|
1539 |
typedef std::vector<USHORT> UshortList; |
1546 |
typedef std::vector<USHORT> UshortList; |
1540 |
UshortList aFeatureIndexList; |
1547 |
UshortList aFeatureIndexList; |
Lines 1542-1563
bool FreetypeServerFont::ApplyGSUB( cons
Link Here
|
1542 |
|
1549 |
|
1543 |
// parse Script Table |
1550 |
// parse Script Table |
1544 |
const FT_Byte* pScriptHeader = pGsubBase + nOfsScriptList; |
1551 |
const FT_Byte* pScriptHeader = pGsubBase + nOfsScriptList; |
1545 |
const USHORT nCntScript = NEXT_UShort( pScriptHeader ); |
1552 |
const USHORT nCntScript = FT_NEXT_USHORT( pScriptHeader ); |
1546 |
for( USHORT nScriptIndex = 0; nScriptIndex < nCntScript; ++nScriptIndex ) |
1553 |
for( USHORT nScriptIndex = 0; nScriptIndex < nCntScript; ++nScriptIndex ) |
1547 |
{ |
1554 |
{ |
1548 |
const ULONG nTag = NEXT_Long( pScriptHeader ); // e.g. hani/arab/kana/hang |
1555 |
const ULONG nTag = FT_NEXT_LONG( pScriptHeader ); // e.g. hani/arab/kana/hang |
1549 |
const USHORT nOfsScriptTable= NEXT_UShort( pScriptHeader ); |
1556 |
const USHORT nOfsScriptTable= FT_NEXT_USHORT( pScriptHeader ); |
1550 |
if( (nTag != nRequestedScript) && (nRequestedScript != 0) ) |
1557 |
if( (nTag != nRequestedScript) && (nRequestedScript != 0) ) |
1551 |
continue; |
1558 |
continue; |
1552 |
|
1559 |
|
1553 |
const FT_Byte* pScriptTable = pGsubBase + nOfsScriptList + nOfsScriptTable; |
1560 |
const FT_Byte* pScriptTable = pGsubBase + nOfsScriptList + nOfsScriptTable; |
1554 |
const USHORT nDefaultLangsysOfs = NEXT_UShort( pScriptTable ); |
1561 |
const USHORT nDefaultLangsysOfs = FT_NEXT_USHORT( pScriptTable ); |
1555 |
const USHORT nCntLangSystem = NEXT_UShort( pScriptTable ); |
1562 |
const USHORT nCntLangSystem = FT_NEXT_USHORT( pScriptTable ); |
1556 |
USHORT nLangsysOffset = 0; |
1563 |
USHORT nLangsysOffset = 0; |
1557 |
for( USHORT nLangsysIndex = 0; nLangsysIndex < nCntLangSystem; ++nLangsysIndex ) |
1564 |
for( USHORT nLangsysIndex = 0; nLangsysIndex < nCntLangSystem; ++nLangsysIndex ) |
1558 |
{ |
1565 |
{ |
1559 |
const ULONG nTag = NEXT_Long( pScriptTable ); // e.g. KOR/ZHS/ZHT/JAN |
1566 |
const ULONG nTag = FT_NEXT_LONG( pScriptTable ); // e.g. KOR/ZHS/ZHT/JAN |
1560 |
const USHORT nOffset= NEXT_UShort( pScriptTable ); |
1567 |
const USHORT nOffset= FT_NEXT_USHORT( pScriptTable ); |
1561 |
if( (nTag != nRequestedLangsys) && (nRequestedLangsys != 0) ) |
1568 |
if( (nTag != nRequestedLangsys) && (nRequestedLangsys != 0) ) |
1562 |
continue; |
1569 |
continue; |
1563 |
nLangsysOffset = nOffset; |
1570 |
nLangsysOffset = nOffset; |
Lines 1567-1579
bool FreetypeServerFont::ApplyGSUB( cons
Link Here
|
1567 |
if( (nDefaultLangsysOfs != 0) && (nDefaultLangsysOfs != nLangsysOffset) ) |
1574 |
if( (nDefaultLangsysOfs != 0) && (nDefaultLangsysOfs != nLangsysOffset) ) |
1568 |
{ |
1575 |
{ |
1569 |
const FT_Byte* pLangSys = pGsubBase + nOfsScriptList + nOfsScriptTable + nDefaultLangsysOfs; |
1576 |
const FT_Byte* pLangSys = pGsubBase + nOfsScriptList + nOfsScriptTable + nDefaultLangsysOfs; |
1570 |
const USHORT nLookupOrder = NEXT_UShort( pLangSys ); |
1577 |
const USHORT nLookupOrder = FT_NEXT_USHORT( pLangSys ); |
1571 |
const USHORT nReqFeatureIdx = NEXT_UShort( pLangSys ); |
1578 |
const USHORT nReqFeatureIdx = FT_NEXT_USHORT( pLangSys ); |
1572 |
const USHORT nCntFeature = NEXT_UShort( pLangSys ); |
1579 |
const USHORT nCntFeature = FT_NEXT_USHORT( pLangSys ); |
1573 |
aFeatureIndexList.push_back( nReqFeatureIdx ); |
1580 |
aFeatureIndexList.push_back( nReqFeatureIdx ); |
1574 |
for( USHORT i = 0; i < nCntFeature; ++i ) |
1581 |
for( USHORT i = 0; i < nCntFeature; ++i ) |
1575 |
{ |
1582 |
{ |
1576 |
const USHORT nFeatureIndex = NEXT_UShort( pLangSys ); |
1583 |
const USHORT nFeatureIndex = FT_NEXT_USHORT( pLangSys ); |
1577 |
aFeatureIndexList.push_back( nFeatureIndex ); |
1584 |
aFeatureIndexList.push_back( nFeatureIndex ); |
1578 |
} |
1585 |
} |
1579 |
} |
1586 |
} |
Lines 1581-1593
bool FreetypeServerFont::ApplyGSUB( cons
Link Here
|
1581 |
if( nLangsysOffset != 0 ) |
1588 |
if( nLangsysOffset != 0 ) |
1582 |
{ |
1589 |
{ |
1583 |
const FT_Byte* pLangSys = pGsubBase + nOfsScriptList + nOfsScriptTable + nLangsysOffset; |
1590 |
const FT_Byte* pLangSys = pGsubBase + nOfsScriptList + nOfsScriptTable + nLangsysOffset; |
1584 |
const USHORT nLookupOrder = NEXT_UShort( pLangSys ); |
1591 |
const USHORT nLookupOrder = FT_NEXT_USHORT( pLangSys ); |
1585 |
const USHORT nReqFeatureIdx = NEXT_UShort( pLangSys ); |
1592 |
const USHORT nReqFeatureIdx = FT_NEXT_USHORT( pLangSys ); |
1586 |
const USHORT nCntFeature = NEXT_UShort( pLangSys ); |
1593 |
const USHORT nCntFeature = FT_NEXT_USHORT( pLangSys ); |
1587 |
aFeatureIndexList.push_back( nReqFeatureIdx ); |
1594 |
aFeatureIndexList.push_back( nReqFeatureIdx ); |
1588 |
for( USHORT i = 0; i < nCntFeature; ++i ) |
1595 |
for( USHORT i = 0; i < nCntFeature; ++i ) |
1589 |
{ |
1596 |
{ |
1590 |
const USHORT nFeatureIndex = NEXT_UShort( pLangSys ); |
1597 |
const USHORT nFeatureIndex = FT_NEXT_USHORT( pLangSys ); |
1591 |
aFeatureIndexList.push_back( nFeatureIndex ); |
1598 |
aFeatureIndexList.push_back( nFeatureIndex ); |
1592 |
} |
1599 |
} |
1593 |
} |
1600 |
} |
Lines 1601-1611
bool FreetypeServerFont::ApplyGSUB( cons
Link Here
|
1601 |
|
1608 |
|
1602 |
// parse Feature Table |
1609 |
// parse Feature Table |
1603 |
const FT_Byte* pFeatureHeader = pGsubBase + nOfsFeatureTable; |
1610 |
const FT_Byte* pFeatureHeader = pGsubBase + nOfsFeatureTable; |
1604 |
const USHORT nCntFeature = NEXT_UShort( pFeatureHeader ); |
1611 |
const USHORT nCntFeature = FT_NEXT_USHORT( pFeatureHeader ); |
1605 |
for( USHORT nFeatureIndex = 0; nFeatureIndex < nCntFeature; ++nFeatureIndex ) |
1612 |
for( USHORT nFeatureIndex = 0; nFeatureIndex < nCntFeature; ++nFeatureIndex ) |
1606 |
{ |
1613 |
{ |
1607 |
const ULONG nTag = NEXT_Long( pFeatureHeader ); // e.g. locl/vert/trad/smpl/liga/fina/... |
1614 |
const ULONG nTag = FT_NEXT_LONG( pFeatureHeader ); // e.g. locl/vert/trad/smpl/liga/fina/... |
1608 |
const USHORT nOffset= NEXT_UShort( pFeatureHeader ); |
1615 |
const USHORT nOffset= FT_NEXT_USHORT( pFeatureHeader ); |
1609 |
|
1616 |
|
1610 |
// feature (required && (requested || available))? |
1617 |
// feature (required && (requested || available))? |
1611 |
if( (aFeatureIndexList[0] != nFeatureIndex) |
1618 |
if( (aFeatureIndexList[0] != nFeatureIndex) |
Lines 1614-1623
bool FreetypeServerFont::ApplyGSUB( cons
Link Here
|
1614 |
continue; |
1621 |
continue; |
1615 |
|
1622 |
|
1616 |
const FT_Byte* pFeatureTable = pGsubBase + nOfsFeatureTable + nOffset; |
1623 |
const FT_Byte* pFeatureTable = pGsubBase + nOfsFeatureTable + nOffset; |
1617 |
const USHORT nCntLookups = NEXT_UShort( pFeatureTable ); |
1624 |
const USHORT nCntLookups = FT_NEXT_USHORT( pFeatureTable ); |
1618 |
for( USHORT i = 0; i < nCntLookups; ++i ) |
1625 |
for( USHORT i = 0; i < nCntLookups; ++i ) |
1619 |
{ |
1626 |
{ |
1620 |
const USHORT nLookupIndex = NEXT_UShort( pFeatureTable ); |
1627 |
const USHORT nLookupIndex = FT_NEXT_USHORT( pFeatureTable ); |
1621 |
aLookupIndexList.push_back( nLookupIndex ); |
1628 |
aLookupIndexList.push_back( nLookupIndex ); |
1622 |
} |
1629 |
} |
1623 |
if( nCntLookups == 0 ) //### hack needed by Mincho/Gothic/Mingliu/Simsun/... |
1630 |
if( nCntLookups == 0 ) //### hack needed by Mincho/Gothic/Mingliu/Simsun/... |
Lines 1626-1635
bool FreetypeServerFont::ApplyGSUB( cons
Link Here
|
1626 |
|
1633 |
|
1627 |
// parse Lookup List |
1634 |
// parse Lookup List |
1628 |
const FT_Byte* pLookupHeader = pGsubBase + nOfsLookupList; |
1635 |
const FT_Byte* pLookupHeader = pGsubBase + nOfsLookupList; |
1629 |
const USHORT nCntLookupTable = NEXT_UShort( pLookupHeader ); |
1636 |
const USHORT nCntLookupTable = FT_NEXT_USHORT( pLookupHeader ); |
1630 |
for( USHORT nLookupIdx = 0; nLookupIdx < nCntLookupTable; ++nLookupIdx ) |
1637 |
for( USHORT nLookupIdx = 0; nLookupIdx < nCntLookupTable; ++nLookupIdx ) |
1631 |
{ |
1638 |
{ |
1632 |
const USHORT nOffset = NEXT_UShort( pLookupHeader ); |
1639 |
const USHORT nOffset = FT_NEXT_USHORT( pLookupHeader ); |
1633 |
if( std::count( aLookupIndexList.begin(), aLookupIndexList.end(), nLookupIdx ) ) |
1640 |
if( std::count( aLookupIndexList.begin(), aLookupIndexList.end(), nLookupIdx ) ) |
1634 |
aLookupOffsetList.push_back( nOffset ); |
1641 |
aLookupOffsetList.push_back( nOffset ); |
1635 |
} |
1642 |
} |
Lines 1639-1647
bool FreetypeServerFont::ApplyGSUB( cons
Link Here
|
1639 |
{ |
1646 |
{ |
1640 |
const USHORT nOfsLookupTable = *it; |
1647 |
const USHORT nOfsLookupTable = *it; |
1641 |
const FT_Byte* pLookupTable = pGsubBase + nOfsLookupList + nOfsLookupTable; |
1648 |
const FT_Byte* pLookupTable = pGsubBase + nOfsLookupList + nOfsLookupTable; |
1642 |
const USHORT eLookupType = NEXT_UShort( pLookupTable ); |
1649 |
const USHORT eLookupType = FT_NEXT_USHORT( pLookupTable ); |
1643 |
const USHORT eLookupFlag = NEXT_UShort( pLookupTable ); |
1650 |
const USHORT eLookupFlag = FT_NEXT_USHORT( pLookupTable ); |
1644 |
const USHORT nCntLookupSubtable = NEXT_UShort( pLookupTable ); |
1651 |
const USHORT nCntLookupSubtable = FT_NEXT_USHORT( pLookupTable ); |
1645 |
|
1652 |
|
1646 |
// TODO: switch( eLookupType ) |
1653 |
// TODO: switch( eLookupType ) |
1647 |
if( eLookupType != 1 ) // TODO: once we go beyond SingleSubst |
1654 |
if( eLookupType != 1 ) // TODO: once we go beyond SingleSubst |
Lines 1649-1676
bool FreetypeServerFont::ApplyGSUB( cons
Link Here
|
1649 |
|
1656 |
|
1650 |
for( USHORT nSubTableIdx = 0; nSubTableIdx < nCntLookupSubtable; ++nSubTableIdx ) |
1657 |
for( USHORT nSubTableIdx = 0; nSubTableIdx < nCntLookupSubtable; ++nSubTableIdx ) |
1651 |
{ |
1658 |
{ |
1652 |
const USHORT nOfsSubLookupTable = NEXT_UShort( pLookupTable ); |
1659 |
const USHORT nOfsSubLookupTable = FT_NEXT_USHORT( pLookupTable ); |
1653 |
const FT_Byte* pSubLookup = pGsubBase + nOfsLookupList + nOfsLookupTable + nOfsSubLookupTable; |
1660 |
const FT_Byte* pSubLookup = pGsubBase + nOfsLookupList + nOfsLookupTable + nOfsSubLookupTable; |
1654 |
|
1661 |
|
1655 |
|
1662 |
|
1656 |
const USHORT nFmtSubstitution = NEXT_UShort( pSubLookup ); |
1663 |
const USHORT nFmtSubstitution = FT_NEXT_USHORT( pSubLookup ); |
1657 |
const USHORT nOfsCoverage = NEXT_UShort( pSubLookup ); |
1664 |
const USHORT nOfsCoverage = FT_NEXT_USHORT( pSubLookup ); |
1658 |
|
1665 |
|
1659 |
typedef std::pair<USHORT,USHORT> GlyphSubst; |
1666 |
typedef std::pair<USHORT,USHORT> GlyphSubst; |
1660 |
typedef std::vector<GlyphSubst> SubstVector; |
1667 |
typedef std::vector<GlyphSubst> SubstVector; |
1661 |
SubstVector aSubstVector; |
1668 |
SubstVector aSubstVector; |
1662 |
|
1669 |
|
1663 |
const FT_Byte* pCoverage = pGsubBase + nOfsLookupList + nOfsLookupTable + nOfsSubLookupTable + nOfsCoverage; |
1670 |
const FT_Byte* pCoverage = pGsubBase + nOfsLookupList + nOfsLookupTable + nOfsSubLookupTable + nOfsCoverage; |
1664 |
const USHORT nFmtCoverage = NEXT_UShort( pCoverage ); |
1671 |
const USHORT nFmtCoverage = FT_NEXT_USHORT( pCoverage ); |
1665 |
switch( nFmtCoverage ) |
1672 |
switch( nFmtCoverage ) |
1666 |
{ |
1673 |
{ |
1667 |
case 1: // Coverage Format 1 |
1674 |
case 1: // Coverage Format 1 |
1668 |
{ |
1675 |
{ |
1669 |
const USHORT nCntGlyph = NEXT_UShort( pCoverage ); |
1676 |
const USHORT nCntGlyph = FT_NEXT_USHORT( pCoverage ); |
1670 |
aSubstVector.reserve( nCntGlyph ); |
1677 |
aSubstVector.reserve( nCntGlyph ); |
1671 |
for( USHORT i = 0; i < nCntGlyph; ++i ) |
1678 |
for( USHORT i = 0; i < nCntGlyph; ++i ) |
1672 |
{ |
1679 |
{ |
1673 |
const USHORT nGlyphId = NEXT_UShort( pCoverage ); |
1680 |
const USHORT nGlyphId = FT_NEXT_USHORT( pCoverage ); |
1674 |
aSubstVector.push_back( GlyphSubst( nGlyphId, 0 ) ); |
1681 |
aSubstVector.push_back( GlyphSubst( nGlyphId, 0 ) ); |
1675 |
} |
1682 |
} |
1676 |
} |
1683 |
} |
Lines 1678-1689
bool FreetypeServerFont::ApplyGSUB( cons
Link Here
|
1678 |
|
1685 |
|
1679 |
case 2: // Coverage Format 2 |
1686 |
case 2: // Coverage Format 2 |
1680 |
{ |
1687 |
{ |
1681 |
const USHORT nCntRange = NEXT_UShort( pCoverage ); |
1688 |
const USHORT nCntRange = FT_NEXT_USHORT( pCoverage ); |
1682 |
for( int i = nCntRange; --i >= 0; ) |
1689 |
for( int i = nCntRange; --i >= 0; ) |
1683 |
{ |
1690 |
{ |
1684 |
const USHORT nGlyph0 = NEXT_UShort( pCoverage ); |
1691 |
const USHORT nGlyph0 = FT_NEXT_USHORT( pCoverage ); |
1685 |
const USHORT nGlyph1 = NEXT_UShort( pCoverage ); |
1692 |
const USHORT nGlyph1 = FT_NEXT_USHORT( pCoverage ); |
1686 |
const USHORT nCovIdx = NEXT_UShort( pCoverage ); |
1693 |
const USHORT nCovIdx = FT_NEXT_USHORT( pCoverage ); |
1687 |
for( USHORT j = nGlyph0; j <= nGlyph1; ++j ) |
1694 |
for( USHORT j = nGlyph0; j <= nGlyph1; ++j ) |
1688 |
aSubstVector.push_back( GlyphSubst( j + nCovIdx, 0 ) ); |
1695 |
aSubstVector.push_back( GlyphSubst( j + nCovIdx, 0 ) ); |
1689 |
} |
1696 |
} |
Lines 1697-1703
bool FreetypeServerFont::ApplyGSUB( cons
Link Here
|
1697 |
{ |
1704 |
{ |
1698 |
case 1: // Single Substitution Format 1 |
1705 |
case 1: // Single Substitution Format 1 |
1699 |
{ |
1706 |
{ |
1700 |
const USHORT nDeltaGlyphId = NEXT_UShort( pSubLookup ); |
1707 |
const USHORT nDeltaGlyphId = FT_NEXT_USHORT( pSubLookup ); |
1701 |
for(; it != aSubstVector.end(); ++it ) |
1708 |
for(; it != aSubstVector.end(); ++it ) |
1702 |
(*it).second = (*it).first + nDeltaGlyphId; |
1709 |
(*it).second = (*it).first + nDeltaGlyphId; |
1703 |
} |
1710 |
} |
Lines 1705-1714
bool FreetypeServerFont::ApplyGSUB( cons
Link Here
|
1705 |
|
1712 |
|
1706 |
case 2: // Single Substitution Format 2 |
1713 |
case 2: // Single Substitution Format 2 |
1707 |
{ |
1714 |
{ |
1708 |
const USHORT nCntGlyph = NEXT_UShort( pSubLookup ); |
1715 |
const USHORT nCntGlyph = FT_NEXT_USHORT( pSubLookup ); |
1709 |
for( int i = nCntGlyph; (it != aSubstVector.end()) && (--i>=0); ++it ) |
1716 |
for( int i = nCntGlyph; (it != aSubstVector.end()) && (--i>=0); ++it ) |
1710 |
{ |
1717 |
{ |
1711 |
const USHORT nGlyphId = NEXT_UShort( pSubLookup ); |
1718 |
const USHORT nGlyphId = FT_NEXT_USHORT( pSubLookup ); |
1712 |
(*it).second = nGlyphId; |
1719 |
(*it).second = nGlyphId; |
1713 |
} |
1720 |
} |
1714 |
} |
1721 |
} |