OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
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 <ctype.h> | 8 #include <ctype.h> |
9 | 9 |
10 #include "SkData.h" | 10 #include "SkData.h" |
(...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 | 1336 |
1337 auto widthArray = sk_make_sp<SkPDFArray>(); | 1337 auto widthArray = sk_make_sp<SkPDFArray>(); |
1338 | 1338 |
1339 SkIRect bbox = SkIRect::MakeEmpty(); | 1339 SkIRect bbox = SkIRect::MakeEmpty(); |
1340 for (int gID = firstGlyphID(); gID <= lastGlyphID(); gID++) { | 1340 for (int gID = firstGlyphID(); gID <= lastGlyphID(); gID++) { |
1341 SkString characterName; | 1341 SkString characterName; |
1342 characterName.printf("gid%d", gID); | 1342 characterName.printf("gid%d", gID); |
1343 encDiffs->appendName(characterName.c_str()); | 1343 encDiffs->appendName(characterName.c_str()); |
1344 | 1344 |
1345 const SkGlyph& glyph = cache->getGlyphIDMetrics(gID); | 1345 const SkGlyph& glyph = cache->getGlyphIDMetrics(gID); |
1346 widthArray->appendScalar(SkFixedToScalar(glyph.fAdvanceX)); | 1346 widthArray->appendScalar(SkFloatToScalar(glyph.fAdvanceX)); |
1347 SkIRect glyphBBox = SkIRect::MakeXYWH(glyph.fLeft, glyph.fTop, | 1347 SkIRect glyphBBox = SkIRect::MakeXYWH(glyph.fLeft, glyph.fTop, |
1348 glyph.fWidth, glyph.fHeight); | 1348 glyph.fWidth, glyph.fHeight); |
1349 bbox.join(glyphBBox); | 1349 bbox.join(glyphBBox); |
1350 | 1350 |
1351 SkDynamicMemoryWStream content; | 1351 SkDynamicMemoryWStream content; |
1352 setGlyphWidthAndBoundingBox(SkFixedToScalar(glyph.fAdvanceX), glyphBBox, | 1352 setGlyphWidthAndBoundingBox(SkFloatToScalar(glyph.fAdvanceX), glyphBBox, |
1353 &content); | 1353 &content); |
1354 const SkPath* path = cache->findPath(glyph); | 1354 const SkPath* path = cache->findPath(glyph); |
1355 if (path) { | 1355 if (path) { |
1356 SkPDFUtils::EmitPath(*path, paint.getStyle(), &content); | 1356 SkPDFUtils::EmitPath(*path, paint.getStyle(), &content); |
1357 SkPDFUtils::PaintPath(paint.getStyle(), path->getFillType(), | 1357 SkPDFUtils::PaintPath(paint.getStyle(), path->getFillType(), |
1358 &content); | 1358 &content); |
1359 } | 1359 } |
1360 SkAutoTDelete<SkMemoryStream> glyphStream(new SkMemoryStream()); | 1360 SkAutoTDelete<SkMemoryStream> glyphStream(new SkMemoryStream()); |
1361 glyphStream->setData(content.copyToData())->unref(); | 1361 glyphStream->setData(content.copyToData())->unref(); |
1362 | 1362 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1418 } | 1418 } |
1419 return *canon->fCanEmbedTypeface.set(id, canEmbed); | 1419 return *canon->fCanEmbedTypeface.set(id, canEmbed); |
1420 } | 1420 } |
1421 | 1421 |
1422 void SkPDFFont::drop() { | 1422 void SkPDFFont::drop() { |
1423 fTypeface = nullptr; | 1423 fTypeface = nullptr; |
1424 fFontInfo = nullptr; | 1424 fFontInfo = nullptr; |
1425 fDescriptor = nullptr; | 1425 fDescriptor = nullptr; |
1426 this->SkPDFDict::drop(); | 1426 this->SkPDFDict::drop(); |
1427 } | 1427 } |
OLD | NEW |