OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 ret = str->read(buffer, count); | 237 ret = str->read(buffer, count); |
238 if (ret != count) { | 238 if (ret != count) { |
239 return 0; | 239 return 0; |
240 } | 240 } |
241 count = ret; | 241 count = ret; |
242 } | 242 } |
243 } | 243 } |
244 return count; | 244 return count; |
245 } | 245 } |
246 | 246 |
247 static void sk_stream_close( FT_Stream stream) {} | 247 static void sk_stream_close(FT_Stream) {} |
248 } | 248 } |
249 | 249 |
250 SkFaceRec::SkFaceRec(SkStream* strm, uint32_t fontID) | 250 SkFaceRec::SkFaceRec(SkStream* strm, uint32_t fontID) |
251 : fNext(NULL), fSkStream(strm), fRefCnt(1), fFontID(fontID) { | 251 : fNext(NULL), fSkStream(strm), fRefCnt(1), fFontID(fontID) { |
252 // SkDEBUGF(("SkFaceRec: opening %s (%p)\n", key.c_str(), strm)); | 252 // SkDEBUGF(("SkFaceRec: opening %s (%p)\n", key.c_str(), strm)); |
253 | 253 |
254 sk_bzero(&fFTStream, sizeof(fFTStream)); | 254 sk_bzero(&fFTStream, sizeof(fFTStream)); |
255 fFTStream.size = fSkStream->getLength(); | 255 fFTStream.size = fSkStream->getLength(); |
256 fFTStream.descriptor.pointer = fSkStream; | 256 fFTStream.descriptor.pointer = fSkStream; |
257 fFTStream.read = sk_stream_read; | 257 fFTStream.read = sk_stream_read; |
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 | 1174 |
1175 FT_Error err = FT_Load_Glyph( fFace, glyph.getGlyphID(fBaseGlyphCount), flag
s); | 1175 FT_Error err = FT_Load_Glyph( fFace, glyph.getGlyphID(fBaseGlyphCount), flag
s); |
1176 | 1176 |
1177 if (err != 0) { | 1177 if (err != 0) { |
1178 SkDEBUGF(("SkScalerContext_FreeType::generatePath: FT_Load_Glyph(glyph:%
d flags:%d) returned 0x%x\n", | 1178 SkDEBUGF(("SkScalerContext_FreeType::generatePath: FT_Load_Glyph(glyph:%
d flags:%d) returned 0x%x\n", |
1179 glyph.getGlyphID(fBaseGlyphCount), flags, err)); | 1179 glyph.getGlyphID(fBaseGlyphCount), flags, err)); |
1180 path->reset(); | 1180 path->reset(); |
1181 return; | 1181 return; |
1182 } | 1182 } |
1183 | 1183 |
1184 generateGlyphPath(fFace, glyph, path); | 1184 generateGlyphPath(fFace, path); |
1185 | 1185 |
1186 // The path's origin from FreeType is always the horizontal layout origin. | 1186 // The path's origin from FreeType is always the horizontal layout origin. |
1187 // Offset the path so that it is relative to the vertical origin if needed. | 1187 // Offset the path so that it is relative to the vertical origin if needed. |
1188 if (fRec.fFlags & SkScalerContext::kVertical_Flag) { | 1188 if (fRec.fFlags & SkScalerContext::kVertical_Flag) { |
1189 FT_Vector vector; | 1189 FT_Vector vector; |
1190 vector.x = fFace->glyph->metrics.vertBearingX - fFace->glyph->metrics.ho
riBearingX; | 1190 vector.x = fFace->glyph->metrics.vertBearingX - fFace->glyph->metrics.ho
riBearingX; |
1191 vector.y = -fFace->glyph->metrics.vertBearingY - fFace->glyph->metrics.h
oriBearingY; | 1191 vector.y = -fFace->glyph->metrics.vertBearingY - fFace->glyph->metrics.h
oriBearingY; |
1192 FT_Vector_Transform(&vector, &fMatrix22); | 1192 FT_Vector_Transform(&vector, &fMatrix22); |
1193 path->offset(SkFDot6ToScalar(vector.x), -SkFDot6ToScalar(vector.y)); | 1193 path->offset(SkFDot6ToScalar(vector.x), -SkFDot6ToScalar(vector.y)); |
1194 } | 1194 } |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1359 *style = (SkTypeface::Style) tempStyle; | 1359 *style = (SkTypeface::Style) tempStyle; |
1360 } | 1360 } |
1361 if (isFixedWidth) { | 1361 if (isFixedWidth) { |
1362 *isFixedWidth = FT_IS_FIXED_WIDTH(face); | 1362 *isFixedWidth = FT_IS_FIXED_WIDTH(face); |
1363 } | 1363 } |
1364 | 1364 |
1365 FT_Done_Face(face); | 1365 FT_Done_Face(face); |
1366 FT_Done_FreeType(library); | 1366 FT_Done_FreeType(library); |
1367 return true; | 1367 return true; |
1368 } | 1368 } |
OLD | NEW |