Change type of SkScalerContext_FreeType::fScaleX/Y. All uses want FT_F26Dot6.
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1711053004 Review URL: https://codereview.chromium.org/1711053004
This commit is contained in:
parent
3eb4895ea1
commit
4534562f76
@ -200,7 +200,7 @@ private:
|
|||||||
FT_Face fFace; // reference to shared face in gFaceRecHead
|
FT_Face fFace; // reference to shared face in gFaceRecHead
|
||||||
FT_Size fFTSize; // our own copy
|
FT_Size fFTSize; // our own copy
|
||||||
FT_Int fStrikeIndex;
|
FT_Int fStrikeIndex;
|
||||||
SkFixed fScaleX, fScaleY;
|
FT_F26Dot6 fScaleX, fScaleY;
|
||||||
FT_Matrix fMatrix22;
|
FT_Matrix fMatrix22;
|
||||||
uint32_t fLoadGlyphFlags;
|
uint32_t fLoadGlyphFlags;
|
||||||
bool fDoLinearMetrics;
|
bool fDoLinearMetrics;
|
||||||
@ -740,14 +740,14 @@ bool SkTypeface_FreeType::onGetKerningPairAdjustments(const uint16_t glyphs[],
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static FT_Int chooseBitmapStrike(FT_Face face, SkFixed scaleY) {
|
static FT_Int chooseBitmapStrike(FT_Face face, FT_F26Dot6 scaleY) {
|
||||||
// early out if face is bad
|
// early out if face is bad
|
||||||
if (face == nullptr) {
|
if (face == nullptr) {
|
||||||
SkDEBUGF(("chooseBitmapStrike aborted due to nullptr face\n"));
|
SkDEBUGF(("chooseBitmapStrike aborted due to nullptr face\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// determine target ppem
|
// determine target ppem
|
||||||
FT_Pos targetPPEM = SkFixedToFDot6(scaleY);
|
FT_Pos targetPPEM = scaleY;
|
||||||
// find a bitmap strike equal to or just larger than the requested size
|
// find a bitmap strike equal to or just larger than the requested size
|
||||||
FT_Int chosenStrikeIndex = -1;
|
FT_Int chosenStrikeIndex = -1;
|
||||||
FT_Pos chosenPPEM = 0;
|
FT_Pos chosenPPEM = 0;
|
||||||
@ -805,8 +805,8 @@ SkScalerContext_FreeType::SkScalerContext_FreeType(SkTypeface* typeface, const S
|
|||||||
fMatrix22Scalar.setSkewX(-fMatrix22Scalar.getSkewX());
|
fMatrix22Scalar.setSkewX(-fMatrix22Scalar.getSkewX());
|
||||||
fMatrix22Scalar.setSkewY(-fMatrix22Scalar.getSkewY());
|
fMatrix22Scalar.setSkewY(-fMatrix22Scalar.getSkewY());
|
||||||
|
|
||||||
fScaleX = SkScalarToFixed(fScale.fX);
|
fScaleX = SkScalarToFDot6(fScale.fX);
|
||||||
fScaleY = SkScalarToFixed(fScale.fY);
|
fScaleY = SkScalarToFDot6(fScale.fY);
|
||||||
fMatrix22.xx = SkScalarToFixed(fMatrix22Scalar.getScaleX());
|
fMatrix22.xx = SkScalarToFixed(fMatrix22Scalar.getScaleX());
|
||||||
fMatrix22.xy = SkScalarToFixed(fMatrix22Scalar.getSkewX());
|
fMatrix22.xy = SkScalarToFixed(fMatrix22Scalar.getSkewX());
|
||||||
fMatrix22.yx = SkScalarToFixed(fMatrix22Scalar.getSkewY());
|
fMatrix22.yx = SkScalarToFixed(fMatrix22Scalar.getSkewY());
|
||||||
@ -898,7 +898,7 @@ SkScalerContext_FreeType::SkScalerContext_FreeType(SkTypeface* typeface, const S
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (FT_IS_SCALABLE(fFace)) {
|
if (FT_IS_SCALABLE(fFace)) {
|
||||||
err = FT_Set_Char_Size(fFace, SkFixedToFDot6(fScaleX), SkFixedToFDot6(fScaleY), 72, 72);
|
err = FT_Set_Char_Size(fFace, fScaleX, fScaleY, 72, 72);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
SkDEBUGF(("FT_Set_CharSize(%08x, 0x%x, 0x%x) returned 0x%x\n",
|
SkDEBUGF(("FT_Set_CharSize(%08x, 0x%x, 0x%x) returned 0x%x\n",
|
||||||
fFace, fScaleX, fScaleY, err));
|
fFace, fScaleX, fScaleY, err));
|
||||||
@ -910,7 +910,7 @@ SkScalerContext_FreeType::SkScalerContext_FreeType(SkTypeface* typeface, const S
|
|||||||
fStrikeIndex = chooseBitmapStrike(fFace, fScaleY);
|
fStrikeIndex = chooseBitmapStrike(fFace, fScaleY);
|
||||||
if (fStrikeIndex == -1) {
|
if (fStrikeIndex == -1) {
|
||||||
SkDEBUGF(("no glyphs for font \"%s\" size %f?\n",
|
SkDEBUGF(("no glyphs for font \"%s\" size %f?\n",
|
||||||
fFace->family_name, SkFixedToScalar(fScaleY)));
|
fFace->family_name, SkFDot6ToScalar(fScaleY)));
|
||||||
} else {
|
} else {
|
||||||
// FreeType does no provide linear metrics for bitmap fonts.
|
// FreeType does no provide linear metrics for bitmap fonts.
|
||||||
linearMetrics = false;
|
linearMetrics = false;
|
||||||
@ -925,7 +925,7 @@ SkScalerContext_FreeType::SkScalerContext_FreeType(SkTypeface* typeface, const S
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SkDEBUGF(("unknown kind of font \"%s\" size %f?\n",
|
SkDEBUGF(("unknown kind of font \"%s\" size %f?\n",
|
||||||
fFace->family_name, SkFixedToScalar(fScaleY)));
|
fFace->family_name, SkFDot6ToScalar(fScaleY)));
|
||||||
}
|
}
|
||||||
|
|
||||||
fDoLinearMetrics = linearMetrics;
|
fDoLinearMetrics = linearMetrics;
|
||||||
@ -1187,9 +1187,9 @@ void SkScalerContext_FreeType::generateMetrics(SkGlyph* glyph) {
|
|||||||
|
|
||||||
// If the font isn't scalable, scale the metrics from the non-scalable strike.
|
// If the font isn't scalable, scale the metrics from the non-scalable strike.
|
||||||
// This means do not try to scale embedded bitmaps; only scale bitmaps in bitmap only fonts.
|
// This means do not try to scale embedded bitmaps; only scale bitmaps in bitmap only fonts.
|
||||||
if (!FT_IS_SCALABLE(fFace) && fScaleY && fFace->size->metrics.y_ppem) {
|
if (!FT_IS_SCALABLE(fFace) && !SkScalarNearlyZero(fScale.fY) && fFace->size->metrics.y_ppem) {
|
||||||
// NOTE: both dimensions are scaled by y_ppem. this is WAI.
|
// NOTE: both dimensions are scaled by y_ppem. this is WAI.
|
||||||
scaleGlyphMetrics(*glyph, SkFixedToScalar(fScaleY) / fFace->size->metrics.y_ppem);
|
scaleGlyphMetrics(*glyph, fScale.fY / fFace->size->metrics.y_ppem);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_GLYPH_SPEW
|
#ifdef ENABLE_GLYPH_SPEW
|
||||||
|
Loading…
Reference in New Issue
Block a user