зеркало из https://github.com/mozilla/pjs.git
Bug 191919 Problem rendering Opentype fonts r+sr=rbs, a=shaver patch by VYV03354@nifty.ne.jp
This commit is contained in:
Родитель
b08c86597f
Коммит
3d294c71d5
|
@ -552,6 +552,8 @@ nsFontMetricsWin::FillLogFont(LOGFONT* logFont, PRInt32 aWeight,
|
|||
#endif
|
||||
}
|
||||
|
||||
#undef CFF
|
||||
#define CFF (('C') | ('F' << 8) | ('F' << 16) | (' ' << 24))
|
||||
#undef CMAP
|
||||
#define CMAP (('c') | ('m' << 8) | ('a' << 16) | ('p' << 24))
|
||||
#undef HEAD
|
||||
|
@ -721,13 +723,21 @@ GetIndexToLocFormat(HDC aDC)
|
|||
}
|
||||
|
||||
static nsresult
|
||||
GetSpaces(HDC aDC, PRUint32* aMaxGlyph, nsAutoFontDataBuffer& aIsSpace)
|
||||
GetSpaces(HDC aDC, PRBool* aIsCFFOutline, PRUint32* aMaxGlyph,
|
||||
nsAutoFontDataBuffer& aIsSpace)
|
||||
{
|
||||
// OpenType fonts with CFF outline do not have the 'loca' table
|
||||
DWORD len = GetFontData(aDC, CFF, 0, nsnull, 0);
|
||||
if ((len != GDI_ERROR) && len) {
|
||||
*aIsCFFOutline = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
*aIsCFFOutline = PR_FALSE;
|
||||
int isLong = GetIndexToLocFormat(aDC);
|
||||
if (isLong < 0) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
DWORD len = GetFontData(aDC, LOCA, 0, nsnull, 0);
|
||||
len = GetFontData(aDC, LOCA, 0, nsnull, 0);
|
||||
if ((len == GDI_ERROR) || (!len)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -1513,7 +1523,8 @@ ReadCMAPTableFormat12(PRUint8* aBuf, PRInt32 len, PRUint32 **aExtMap)
|
|||
|
||||
|
||||
static void
|
||||
ReadCMAPTableFormat4(PRUint8* aBuf, PRInt32 aLength, PRUint32* aMap, PRUint8* aIsSpace, PRUint32 aMaxGlyph)
|
||||
ReadCMAPTableFormat4(PRUint8* aBuf, PRInt32 aLength, PRUint32* aMap,
|
||||
PRBool aIsCFFOutline, PRUint8* aIsSpace, PRUint32 aMaxGlyph)
|
||||
{
|
||||
PRUint8* p = aBuf;
|
||||
PRUint8* end = aBuf + aLength;
|
||||
|
@ -1544,7 +1555,10 @@ ReadCMAPTableFormat4(PRUint8* aBuf, PRInt32 aLength, PRUint32* aMap, PRUint8* aI
|
|||
if ((PRUint8*) g < end) {
|
||||
if (*g) {
|
||||
PRUint16 glyph = idDelta[i] + *g;
|
||||
if (glyph < aMaxGlyph) {
|
||||
if (aIsCFFOutline) {
|
||||
ADD_GLYPH(aMap, c);
|
||||
}
|
||||
else if (glyph < aMaxGlyph) {
|
||||
if (aIsSpace[glyph]) {
|
||||
if (SHOULD_BE_SPACE_CHAR(c)) {
|
||||
ADD_GLYPH(aMap, c);
|
||||
|
@ -1571,7 +1585,10 @@ ReadCMAPTableFormat4(PRUint8* aBuf, PRInt32 aLength, PRUint32* aMap, PRUint8* aI
|
|||
PRUint16 endC = endCode[i];
|
||||
for (PRUint32 c = startCode[i]; c <= endC; ++c) {
|
||||
PRUint16 glyph = idDelta[i] + c;
|
||||
if (glyph < aMaxGlyph) {
|
||||
if (aIsCFFOutline) {
|
||||
ADD_GLYPH(aMap, c);
|
||||
}
|
||||
else if (glyph < aMaxGlyph) {
|
||||
if (aIsSpace[glyph]) {
|
||||
if (SHOULD_BE_SPACE_CHAR(c)) {
|
||||
ADD_GLYPH(aMap, c);
|
||||
|
@ -1677,8 +1694,10 @@ nsFontMetricsWin::GetFontCCMAP(HDC aDC, const char* aShortName,
|
|||
else if (eTTFormat4SegmentMappingToDeltaValues == keepFormat) {
|
||||
PRUint32 maxGlyph;
|
||||
nsAutoFontDataBuffer isSpace;
|
||||
if (NS_SUCCEEDED(GetSpaces(aDC, &maxGlyph, isSpace))) {
|
||||
ReadCMAPTableFormat4(buf+keepOffset, len-keepOffset, map, isSpace.get(), maxGlyph);
|
||||
PRBool isCFFOutline;
|
||||
if (NS_SUCCEEDED(GetSpaces(aDC, &isCFFOutline, &maxGlyph, isSpace))) {
|
||||
ReadCMAPTableFormat4(buf+keepOffset, len-keepOffset, map, isCFFOutline,
|
||||
isSpace.get(), maxGlyph);
|
||||
ccmap = MapToCCMap(map);
|
||||
aCharset = DEFAULT_CHARSET;
|
||||
aFontType = eFontType_Unicode;
|
||||
|
|
Загрузка…
Ссылка в новой задаче