mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Re-merge backouts for 442803, 442806, and 442812
This commit is contained in:
commit
5685b2696a
@ -168,51 +168,85 @@ ATSUFontID gfxAtsuiFont::GetATSUFontID()
|
|||||||
return GetFontEntry()->GetFontID();
|
return GetFontEntry()->GetFontID();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
SetLigatureFeatures(ATSUStyle aStyle, PRBool aEnableLigatures)
|
||||||
|
{
|
||||||
|
static const ATSUFontFeatureType types[] = {
|
||||||
|
kLigaturesType,
|
||||||
|
kLigaturesType,
|
||||||
|
kLigaturesType,
|
||||||
|
kLigaturesType,
|
||||||
|
kLigaturesType,
|
||||||
|
kLigaturesType,
|
||||||
|
kLigaturesType,
|
||||||
|
kLigaturesType
|
||||||
|
};
|
||||||
|
static const ATSUFontFeatureType disablingSelectors[NS_ARRAY_LENGTH(types)] = {
|
||||||
|
kCommonLigaturesOffSelector,
|
||||||
|
kRareLigaturesOffSelector,
|
||||||
|
kLogosOffSelector,
|
||||||
|
kRebusPicturesOffSelector,
|
||||||
|
kDiphthongLigaturesOffSelector,
|
||||||
|
kSquaredLigaturesOffSelector,
|
||||||
|
kAbbrevSquaredLigaturesOffSelector,
|
||||||
|
kSymbolLigaturesOffSelector
|
||||||
|
};
|
||||||
|
static const ATSUFontFeatureType enablingSelectors[NS_ARRAY_LENGTH(types)] = {
|
||||||
|
kCommonLigaturesOnSelector,
|
||||||
|
kRareLigaturesOffSelector,
|
||||||
|
kLogosOffSelector,
|
||||||
|
kRebusPicturesOffSelector,
|
||||||
|
kDiphthongLigaturesOffSelector,
|
||||||
|
kSquaredLigaturesOffSelector,
|
||||||
|
kAbbrevSquaredLigaturesOffSelector,
|
||||||
|
kSymbolLigaturesOffSelector
|
||||||
|
};
|
||||||
|
ATSUSetFontFeatures(aStyle, NS_ARRAY_LENGTH(types), types,
|
||||||
|
aEnableLigatures ? enablingSelectors : disablingSelectors);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gfxAtsuiFont::InitMetrics(ATSUFontID aFontID, ATSFontRef aFontRef)
|
gfxAtsuiFont::InitMetrics(ATSUFontID aFontID, ATSFontRef aFontRef)
|
||||||
{
|
{
|
||||||
/* Create the ATSUStyle */
|
/* Create the ATSUStyle */
|
||||||
|
|
||||||
ATSUAttributeTag styleTags[] = {
|
|
||||||
kATSUFontTag,
|
|
||||||
kATSUSizeTag,
|
|
||||||
kATSUFontMatrixTag
|
|
||||||
};
|
|
||||||
|
|
||||||
ByteCount styleArgSizes[] = {
|
|
||||||
sizeof(ATSUFontID),
|
|
||||||
sizeof(Fixed),
|
|
||||||
sizeof(CGAffineTransform),
|
|
||||||
sizeof(Fract)
|
|
||||||
};
|
|
||||||
|
|
||||||
gfxFloat size =
|
gfxFloat size =
|
||||||
PR_MAX(((mAdjustedSize != 0.0f) ? mAdjustedSize : GetStyle()->size), 1.0f);
|
PR_MAX(((mAdjustedSize != 0.0f) ? mAdjustedSize : GetStyle()->size), 1.0f);
|
||||||
|
|
||||||
//fprintf (stderr, "string: '%s', size: %f\n", NS_ConvertUTF16toUTF8(aString).get(), size);
|
//fprintf (stderr, "string: '%s', size: %f\n", NS_ConvertUTF16toUTF8(aString).get(), size);
|
||||||
|
|
||||||
// fSize is in points (72dpi)
|
|
||||||
Fixed fSize = FloatToFixed(size);
|
|
||||||
ATSUFontID fid = aFontID;
|
|
||||||
|
|
||||||
// make the font render right-side up
|
|
||||||
CGAffineTransform transform = CGAffineTransformMakeScale(1, -1);
|
|
||||||
|
|
||||||
ATSUAttributeValuePtr styleArgs[] = {
|
|
||||||
&fid,
|
|
||||||
&fSize,
|
|
||||||
&transform,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (mATSUStyle)
|
if (mATSUStyle)
|
||||||
ATSUDisposeStyle(mATSUStyle);
|
ATSUDisposeStyle(mATSUStyle);
|
||||||
|
|
||||||
|
ATSUFontID fid = aFontID;
|
||||||
|
// fSize is in points (72dpi)
|
||||||
|
Fixed fSize = FloatToFixed(size);
|
||||||
|
// make the font render right-side up
|
||||||
|
CGAffineTransform transform = CGAffineTransformMakeScale(1, -1);
|
||||||
|
|
||||||
|
static const ATSUAttributeTag styleTags[] = {
|
||||||
|
kATSUFontTag,
|
||||||
|
kATSUSizeTag,
|
||||||
|
kATSUFontMatrixTag
|
||||||
|
};
|
||||||
|
const ATSUAttributeValuePtr styleArgs[NS_ARRAY_LENGTH(styleTags)] = {
|
||||||
|
&fid,
|
||||||
|
&fSize,
|
||||||
|
&transform
|
||||||
|
};
|
||||||
|
static const ByteCount styleArgSizes[NS_ARRAY_LENGTH(styleTags)] = {
|
||||||
|
sizeof(ATSUFontID),
|
||||||
|
sizeof(Fixed),
|
||||||
|
sizeof(CGAffineTransform)
|
||||||
|
};
|
||||||
|
|
||||||
ATSUCreateStyle(&mATSUStyle);
|
ATSUCreateStyle(&mATSUStyle);
|
||||||
ATSUSetAttributes(mATSUStyle,
|
ATSUSetAttributes(mATSUStyle,
|
||||||
sizeof(styleTags)/sizeof(ATSUAttributeTag),
|
NS_ARRAY_LENGTH(styleTags),
|
||||||
styleTags,
|
styleTags,
|
||||||
styleArgSizes,
|
styleArgSizes,
|
||||||
styleArgs);
|
styleArgs);
|
||||||
|
SetLigatureFeatures(mATSUStyle, PR_TRUE);
|
||||||
|
|
||||||
/* Now pull out the metrics */
|
/* Now pull out the metrics */
|
||||||
|
|
||||||
@ -1263,32 +1297,6 @@ GetFontPrefLangFor(PRUint8 aUnicodeRange)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
DisableOptionalLigaturesInStyle(ATSUStyle aStyle)
|
|
||||||
{
|
|
||||||
static ATSUFontFeatureType selectors[] = {
|
|
||||||
kCommonLigaturesOffSelector,
|
|
||||||
kRareLigaturesOffSelector,
|
|
||||||
kLogosOffSelector,
|
|
||||||
kRebusPicturesOffSelector,
|
|
||||||
kDiphthongLigaturesOffSelector,
|
|
||||||
kSquaredLigaturesOffSelector,
|
|
||||||
kAbbrevSquaredLigaturesOffSelector,
|
|
||||||
kSymbolLigaturesOffSelector
|
|
||||||
};
|
|
||||||
static ATSUFontFeatureType types[NS_ARRAY_LENGTH(selectors)] = {
|
|
||||||
kLigaturesType,
|
|
||||||
kLigaturesType,
|
|
||||||
kLigaturesType,
|
|
||||||
kLigaturesType,
|
|
||||||
kLigaturesType,
|
|
||||||
kLigaturesType,
|
|
||||||
kLigaturesType,
|
|
||||||
kLigaturesType
|
|
||||||
};
|
|
||||||
ATSUSetFontFeatures(aStyle, NS_ARRAY_LENGTH(selectors), types, selectors);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 361695 - ATSUI only does glyph mirroring when the font contains a 'prop' table
|
// 361695 - ATSUI only does glyph mirroring when the font contains a 'prop' table
|
||||||
// with glyph mirroring info, the character mirroring has to be done manually in the
|
// with glyph mirroring info, the character mirroring has to be done manually in the
|
||||||
// fallback case. Only used for RTL text runs. The autoptr for the mirrored copy
|
// fallback case. Only used for RTL text runs. The autoptr for the mirrored copy
|
||||||
@ -1381,7 +1389,7 @@ gfxAtsuiFontGroup::InitTextRun(gfxTextRun *aRun,
|
|||||||
status = ATSUCreateAndCopyStyle(mainStyle, &mainStyle);
|
status = ATSUCreateAndCopyStyle(mainStyle, &mainStyle);
|
||||||
if (status == noErr) {
|
if (status == noErr) {
|
||||||
stylesToDispose.AppendElement(mainStyle);
|
stylesToDispose.AppendElement(mainStyle);
|
||||||
DisableOptionalLigaturesInStyle(mainStyle);
|
SetLigatureFeatures(mainStyle, PR_FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user