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 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 | 1326 |
1327 const void* memoryBase = stream->getMemoryBase(); | 1327 const void* memoryBase = stream->getMemoryBase(); |
1328 FT_StreamRec streamRec; | 1328 FT_StreamRec streamRec; |
1329 | 1329 |
1330 if (NULL != memoryBase) { | 1330 if (NULL != memoryBase) { |
1331 args.flags = FT_OPEN_MEMORY; | 1331 args.flags = FT_OPEN_MEMORY; |
1332 args.memory_base = (const FT_Byte*)memoryBase; | 1332 args.memory_base = (const FT_Byte*)memoryBase; |
1333 args.memory_size = stream->getLength(); | 1333 args.memory_size = stream->getLength(); |
1334 } else { | 1334 } else { |
1335 memset(&streamRec, 0, sizeof(streamRec)); | 1335 memset(&streamRec, 0, sizeof(streamRec)); |
1336 streamRec.size = stream->read(NULL, 0); | 1336 streamRec.size = stream->getLength(); |
1337 streamRec.descriptor.pointer = stream; | 1337 streamRec.descriptor.pointer = stream; |
1338 streamRec.read = sk_stream_read; | 1338 streamRec.read = sk_stream_read; |
1339 streamRec.close = sk_stream_close; | 1339 streamRec.close = sk_stream_close; |
1340 | 1340 |
1341 args.flags = FT_OPEN_STREAM; | 1341 args.flags = FT_OPEN_STREAM; |
1342 args.stream = &streamRec; | 1342 args.stream = &streamRec; |
1343 } | 1343 } |
1344 | 1344 |
1345 FT_Face face; | 1345 FT_Face face; |
1346 if (FT_Open_Face(library, &args, 0, &face)) { | 1346 if (FT_Open_Face(library, &args, 0, &face)) { |
(...skipping 16 matching lines...) Expand all Loading... |
1363 *style = (SkTypeface::Style) tempStyle; | 1363 *style = (SkTypeface::Style) tempStyle; |
1364 } | 1364 } |
1365 if (isFixedWidth) { | 1365 if (isFixedWidth) { |
1366 *isFixedWidth = FT_IS_FIXED_WIDTH(face); | 1366 *isFixedWidth = FT_IS_FIXED_WIDTH(face); |
1367 } | 1367 } |
1368 | 1368 |
1369 FT_Done_Face(face); | 1369 FT_Done_Face(face); |
1370 FT_Done_FreeType(library); | 1370 FT_Done_FreeType(library); |
1371 return true; | 1371 return true; |
1372 } | 1372 } |
OLD | NEW |