only call FT_Get_Advance if we really want linear metrics
git-svn-id: http://skia.googlecode.com/svn/trunk@2721 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
bc4b654af8
commit
bdc9988bf2
@ -150,6 +150,7 @@ private:
|
|||||||
SkFixed fScaleX, fScaleY;
|
SkFixed fScaleX, fScaleY;
|
||||||
FT_Matrix fMatrix22;
|
FT_Matrix fMatrix22;
|
||||||
uint32_t fLoadGlyphFlags;
|
uint32_t fLoadGlyphFlags;
|
||||||
|
bool fDoLinearMetrics;
|
||||||
|
|
||||||
FT_Error setupSize();
|
FT_Error setupSize();
|
||||||
void emboldenOutline(FT_Outline* outline);
|
void emboldenOutline(FT_Outline* outline);
|
||||||
@ -720,20 +721,24 @@ SkScalerContext_FreeType::SkScalerContext_FreeType(const SkDescriptor* desc)
|
|||||||
// compute the flags we send to Load_Glyph
|
// compute the flags we send to Load_Glyph
|
||||||
{
|
{
|
||||||
FT_Int32 loadFlags = FT_LOAD_DEFAULT;
|
FT_Int32 loadFlags = FT_LOAD_DEFAULT;
|
||||||
|
bool linearMetrics = false;
|
||||||
|
|
||||||
if (SkMask::kBW_Format == fRec.fMaskFormat) {
|
if (SkMask::kBW_Format == fRec.fMaskFormat) {
|
||||||
// See http://code.google.com/p/chromium/issues/detail?id=43252#c24
|
// See http://code.google.com/p/chromium/issues/detail?id=43252#c24
|
||||||
loadFlags = FT_LOAD_TARGET_MONO;
|
loadFlags = FT_LOAD_TARGET_MONO;
|
||||||
if (fRec.getHinting() == SkPaint::kNo_Hinting) {
|
if (fRec.getHinting() == SkPaint::kNo_Hinting) {
|
||||||
loadFlags = FT_LOAD_NO_HINTING;
|
loadFlags = FT_LOAD_NO_HINTING;
|
||||||
|
linearMetrics = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (fRec.getHinting()) {
|
switch (fRec.getHinting()) {
|
||||||
case SkPaint::kNo_Hinting:
|
case SkPaint::kNo_Hinting:
|
||||||
loadFlags = FT_LOAD_NO_HINTING;
|
loadFlags = FT_LOAD_NO_HINTING;
|
||||||
|
linearMetrics = true;
|
||||||
break;
|
break;
|
||||||
case SkPaint::kSlight_Hinting:
|
case SkPaint::kSlight_Hinting:
|
||||||
loadFlags = FT_LOAD_TARGET_LIGHT; // This implies FORCE_AUTOHINT
|
loadFlags = FT_LOAD_TARGET_LIGHT; // This implies FORCE_AUTOHINT
|
||||||
|
linearMetrics = true;
|
||||||
break;
|
break;
|
||||||
case SkPaint::kNormal_Hinting:
|
case SkPaint::kNormal_Hinting:
|
||||||
if (fRec.fFlags & SkScalerContext::kAutohinting_Flag)
|
if (fRec.fFlags & SkScalerContext::kAutohinting_Flag)
|
||||||
@ -771,6 +776,7 @@ SkScalerContext_FreeType::SkScalerContext_FreeType(const SkDescriptor* desc)
|
|||||||
loadFlags |= FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH;
|
loadFlags |= FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH;
|
||||||
|
|
||||||
fLoadGlyphFlags = loadFlags;
|
fLoadGlyphFlags = loadFlags;
|
||||||
|
fDoLinearMetrics = linearMetrics;
|
||||||
}
|
}
|
||||||
|
|
||||||
// now create the FT_Size
|
// now create the FT_Size
|
||||||
@ -898,7 +904,7 @@ void SkScalerContext_FreeType::generateAdvance(SkGlyph* glyph) {
|
|||||||
/* unhinted and light hinted text have linearly scaled advances
|
/* unhinted and light hinted text have linearly scaled advances
|
||||||
* which are very cheap to compute with some font formats...
|
* which are very cheap to compute with some font formats...
|
||||||
*/
|
*/
|
||||||
{
|
if (fDoLinearMetrics) {
|
||||||
SkAutoMutexAcquire ac(gFTMutex);
|
SkAutoMutexAcquire ac(gFTMutex);
|
||||||
|
|
||||||
if (this->setupSize()) {
|
if (this->setupSize()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user