OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkAdvancedTypefaceMetrics.h" | 8 #include "SkAdvancedTypefaceMetrics.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1191 glyph->fRsbDelta = SkToS8(fFace->glyph->rsb_delta); | 1191 glyph->fRsbDelta = SkToS8(fFace->glyph->rsb_delta); |
1192 glyph->fLsbDelta = SkToS8(fFace->glyph->lsb_delta); | 1192 glyph->fLsbDelta = SkToS8(fFace->glyph->lsb_delta); |
1193 } | 1193 } |
1194 } | 1194 } |
1195 } | 1195 } |
1196 | 1196 |
1197 // If the font isn't scalable, scale the metrics from the non-scalable strik
e. | 1197 // If the font isn't scalable, scale the metrics from the non-scalable strik
e. |
1198 // This means do not try to scale embedded bitmaps; only scale bitmaps in bi
tmap only fonts. | 1198 // This means do not try to scale embedded bitmaps; only scale bitmaps in bi
tmap only fonts. |
1199 if (!FT_IS_SCALABLE(fFace) && fScaleY && fFace->size->metrics.y_ppem) { | 1199 if (!FT_IS_SCALABLE(fFace) && fScaleY && fFace->size->metrics.y_ppem) { |
1200 // NOTE: both dimensions are scaled by y_ppem. this is WAI. | 1200 // NOTE: both dimensions are scaled by y_ppem. this is WAI. |
1201 scaleGlyphMetrics(*glyph, SkScalarDiv(SkFixedToScalar(fScaleY), | 1201 scaleGlyphMetrics(*glyph, SkFixedToScalar(fScaleY) / fFace->size->metric
s.y_ppem); |
1202 SkIntToScalar(fFace->size->metrics
.y_ppem))); | |
1203 } | 1202 } |
1204 | 1203 |
1205 #ifdef ENABLE_GLYPH_SPEW | 1204 #ifdef ENABLE_GLYPH_SPEW |
1206 SkDEBUGF(("FT_Set_Char_Size(this:%p sx:%x sy:%x ", this, fScaleX, fScaleY)); | 1205 SkDEBUGF(("FT_Set_Char_Size(this:%p sx:%x sy:%x ", this, fScaleX, fScaleY)); |
1207 SkDEBUGF(("Metrics(glyph:%d flags:0x%x) w:%d\n", glyph->getGlyphID(), fLoadG
lyphFlags, glyph->fWidth)); | 1206 SkDEBUGF(("Metrics(glyph:%d flags:0x%x) w:%d\n", glyph->getGlyphID(), fLoadG
lyphFlags, glyph->fWidth)); |
1208 #endif | 1207 #endif |
1209 } | 1208 } |
1210 | 1209 |
1211 static void clear_glyph_image(const SkGlyph& glyph) { | 1210 static void clear_glyph_image(const SkGlyph& glyph) { |
1212 sk_bzero(glyph.fImage, glyph.rowBytes() * glyph.fHeight); | 1211 sk_bzero(glyph.fImage, glyph.rowBytes() * glyph.fHeight); |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1722 if (style) { | 1721 if (style) { |
1723 *style = SkFontStyle(weight, width, slant); | 1722 *style = SkFontStyle(weight, width, slant); |
1724 } | 1723 } |
1725 if (isFixedPitch) { | 1724 if (isFixedPitch) { |
1726 *isFixedPitch = FT_IS_FIXED_WIDTH(face); | 1725 *isFixedPitch = FT_IS_FIXED_WIDTH(face); |
1727 } | 1726 } |
1728 | 1727 |
1729 FT_Done_Face(face); | 1728 FT_Done_Face(face); |
1730 return true; | 1729 return true; |
1731 } | 1730 } |
OLD | NEW |