aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf/SkPDFFont.cpp
Commit message (Collapse)AuthorAge
* Work around signed-unsigned comparison warning.Gravatar Ben Wagner2018-06-15
| | | | | | | Change-Id: I35d2c3430dbf071dcbbb73e408115d9204e5908b Reviewed-on: https://skia-review.googlesource.com/135327 Commit-Queue: Ben Wagner <bungeman@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
* Reland "Remove SK_MaxSizeT, SK_M{in|ax}U{16|32}, #defines."Gravatar Ben Wagner2018-06-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit ab17347df32807cabd9f2a518d22c3bd420e482f. Reason for revert: Chromium should now be ok. Original change's description: > Revert "Remove SK_MaxSizeT, SK_M{in|ax}U{16|32}, #defines." > > This reverts commit e1bc7de7c07686b28b00b850e44e0722189f3592. > > Reason for revert: chrome used it > > Original change's description: > > Remove SK_MaxSizeT, SK_M{in|ax}U{16|32}, #defines. > > > > sed 's/SK_MaxSizeT/SIZE_MAX/g' > > sed 's/SK_MaxU32/UINT32_MAX/g' > > sed 's/SK_MaxU16/UINT16_MAX/g' > > > > SK_MinU32 and SK_MinU16 were unused > > > > Change-Id: I6b6c824df47b05bde7e73b13a58e851a5f63fe0e > > Reviewed-on: https://skia-review.googlesource.com/134607 > > Commit-Queue: Hal Canary <halcanary@google.com> > > Reviewed-by: Ben Wagner <bungeman@google.com> > > TBR=halcanary@google.com,bungeman@google.com,reed@google.com > > Change-Id: I1e2c440dcf9f59bf87c1fea113248cd5136f7519 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://skia-review.googlesource.com/134921 > Reviewed-by: Hal Canary <halcanary@google.com> > Commit-Queue: Hal Canary <halcanary@google.com> CQ_INCLUDE_TRYBOTS=luci.chromium.try:linux-ozone-rel TBR=halcanary@google.com,bungeman@google.com,reed@google.com Change-Id: I7709f9715bea0463b85b5b0a89712ac1020fcddb Reviewed-on: https://skia-review.googlesource.com/135180 Commit-Queue: Ben Wagner <bungeman@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
* Revert "Remove SK_MaxSizeT, SK_M{in|ax}U{16|32}, #defines."Gravatar Hal Canary2018-06-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit e1bc7de7c07686b28b00b850e44e0722189f3592. Reason for revert: chrome used it Original change's description: > Remove SK_MaxSizeT, SK_M{in|ax}U{16|32}, #defines. > > sed 's/SK_MaxSizeT/SIZE_MAX/g' > sed 's/SK_MaxU32/UINT32_MAX/g' > sed 's/SK_MaxU16/UINT16_MAX/g' > > SK_MinU32 and SK_MinU16 were unused > > Change-Id: I6b6c824df47b05bde7e73b13a58e851a5f63fe0e > Reviewed-on: https://skia-review.googlesource.com/134607 > Commit-Queue: Hal Canary <halcanary@google.com> > Reviewed-by: Ben Wagner <bungeman@google.com> TBR=halcanary@google.com,bungeman@google.com,reed@google.com Change-Id: I1e2c440dcf9f59bf87c1fea113248cd5136f7519 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/134921 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* Revert "Revert "SkTypes: extract SkTo""Gravatar Hal Canary2018-06-14
| | | | | | | | | | | | | | | | This reverts commit fdcfb8b7c23fbf18f872d2c31d27978235033876. > Original change's description: > > SkTypes: extract SkTo > > > > Change-Id: I8de790d5013db2105ad885fa2683303d7c250b09 > > Reviewed-on: https://skia-review.googlesource.com/133620 > > Reviewed-by: Mike Klein <mtklein@google.com> Change-Id: Ida74fbc5c21248a724a5edbf9fae18a33bcb23aa Reviewed-on: https://skia-review.googlesource.com/134506 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* Remove SK_MaxSizeT, SK_M{in|ax}U{16|32}, #defines.Gravatar Hal Canary2018-06-14
| | | | | | | | | | | | | sed 's/SK_MaxSizeT/SIZE_MAX/g' sed 's/SK_MaxU32/UINT32_MAX/g' sed 's/SK_MaxU16/UINT16_MAX/g' SK_MinU32 and SK_MinU16 were unused Change-Id: I6b6c824df47b05bde7e73b13a58e851a5f63fe0e Reviewed-on: https://skia-review.googlesource.com/134607 Commit-Queue: Hal Canary <halcanary@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
* Revert "SkTypes: extract SkTo"Gravatar Hal Canary2018-06-13
| | | | | | | | | | | | | | | | | | | | | | | This reverts commit 2a2f67592602b18527bc3fd449132d420cd5b62e. Reason for revert: this appears to be what is holding up the Chrome roll. Original change's description: > SkTypes: extract SkTo > > Change-Id: I8de790d5013db2105ad885fa2683303d7c250b09 > Reviewed-on: https://skia-review.googlesource.com/133620 > Reviewed-by: Mike Klein <mtklein@google.com> TBR=mtklein@google.com,halcanary@google.com No-Presubmit: true No-Tree-Checks: true No-Try: true Change-Id: Iafd738aedfb679a23c061a51afe4b98a8d4cdfae Reviewed-on: https://skia-review.googlesource.com/134504 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* SkTypes: more into SkMacrosGravatar Hal Canary2018-06-12
| | | | | | | | Change-Id: I4c9a2d81a1bc4ccebc78eea56c0de116b98d415e Reviewed-on: https://skia-review.googlesource.com/134330 Commit-Queue: Hal Canary <halcanary@google.com> Auto-Submit: Hal Canary <halcanary@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
* SkTypes: extract SkToGravatar Hal Canary2018-06-12
| | | | | | Change-Id: I8de790d5013db2105ad885fa2683303d7c250b09 Reviewed-on: https://skia-review.googlesource.com/133620 Reviewed-by: Mike Klein <mtklein@google.com>
* Revert "Revert "SkAdvancedTypefaceMetrics: factor out GlyphToUnicode""Gravatar Hal Canary2018-05-09
| | | | | | | | | This reverts commit 97c1108607584b6050a6880d6ce22846e4913a92. Change-Id: Ic3c6addc64ced39766bbee3e10b4d88faf61ba2f Reviewed-on: https://skia-review.googlesource.com/127021 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* Revert "SkAdvancedTypefaceMetrics: factor out GlyphToUnicode"Gravatar Greg Daniel2018-05-09
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 1c2bcd8b14e029a70e88b1e81acd29553cab0d1c. Reason for revert: breaking chrome roll Original change's description: > SkAdvancedTypefaceMetrics: factor out GlyphToUnicode > > Change-Id: Iedce8c1ea2c405d5ab64ccac353970d5cd2b9d63 > Reviewed-on: https://skia-review.googlesource.com/126507 > Commit-Queue: Hal Canary <halcanary@google.com> > Reviewed-by: Ben Wagner <bungeman@google.com> TBR=halcanary@google.com,bungeman@google.com,reed@google.com Change-Id: Ib1ff8484ffd09cdb88d461ac00745aa32c191124 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/127000 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
* SkAdvancedTypefaceMetrics: factor out GlyphToUnicodeGravatar Hal Canary2018-05-09
| | | | | | | Change-Id: Iedce8c1ea2c405d5ab64ccac353970d5cd2b9d63 Reviewed-on: https://skia-review.googlesource.com/126507 Commit-Queue: Hal Canary <halcanary@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
* SkAdvancedTypefaceMetrics: simplify moreGravatar Hal Canary2018-05-07
| | | | | | | Change-Id: I80c28c50aa96c28181d2fef13daad4a80ec91a12 Reviewed-on: https://skia-review.googlesource.com/120160 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* SkBitSet: make movable.Gravatar Hal Canary2018-04-23
| | | | | | | | Change-Id: Iaf05d652b5bb8d99db3d51d1d9009e1de27ed7a3 Reviewed-on: https://skia-review.googlesource.com/123025 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Ben Wagner <bungeman@google.com> Auto-Submit: Hal Canary <halcanary@google.com>
* SkPDF: Don't forget to upcast before shift.Gravatar Hal Canary2018-04-23
| | | | | | | | Change-Id: I3643749a7634e0b37f6e366e22190f09ac37f863 Reviewed-on: https://skia-review.googlesource.com/123044 Auto-Submit: Hal Canary <halcanary@google.com> Commit-Queue: Ben Wagner <bungeman@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
* Untangle strike cache and glyph cacheGravatar Herb Derby2018-04-19
| | | | | | | | | | | | The strike cache and the glpyh cache have been friends for a long time. Untangle this twisted relationship. BUG=skia:7515 Change-Id: Ie77393f6923e9886ec90ff7a60a1200e78319937 Reviewed-on: https://skia-review.googlesource.com/122084 Commit-Queue: Herb Derby <herb@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
* Move strike cache Find*() to strike cacheGravatar Herb Derby2018-04-18
| | | | | | | | | BUG=skia:7515 Change-Id: Ic1580d4752d51a62df5427a28f843bc7b3181797 Reviewed-on: https://skia-review.googlesource.com/122020 Commit-Queue: Herb Derby <herb@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
* SkPDF: implement xheight for type3 fontsGravatar Hal Canary2018-04-05
| | | | | | | Change-Id: Ib8e5424e31003798ea141e958a74aa8110ee52c7 Reviewed-on: https://skia-review.googlesource.com/117860 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* SkAdvancedTypefaceMetrics: distinguish between font namesGravatar Hal Canary2018-03-29
| | | | | | | Change-Id: I7d094c7327fae7a6da42b118858c59ab524ee6ae Reviewed-on: https://skia-review.googlesource.com/117157 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* SkPDF: type3: more descriptor valuesGravatar Hal Canary2018-03-29
| | | | | | | | | Also: add fXHeight to SkAdvancedTypefaceMetrics.h Change-Id: I28314cf93ca9808216ee34c202a0fa9fc2ffe301 Reviewed-on: https://skia-review.googlesource.com/117155 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* Remove the last uses of auto glyph cache.Gravatar Herb Derby2018-03-22
| | | | | | | Change-Id: I15fdc5bbe29aaa969fe6ec57010919b52249fd7f Reviewed-on: https://skia-review.googlesource.com/115886 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Herb Derby <herb@google.com>
* GOOGLE3 -> SK_BUILD_FOR_GOOGLE3Gravatar Mike Klein2017-12-19
| | | | | | | | | | | | | This is more consistent with our other SK_BUILD_FOR_... macros, and less likely to collide with other preprocessor logic. (Luckily, this was defined in public.bzl, so we can do this all in one CL in the Skia repo.) Change-Id: I5f232888288c9c53fad445545d983d0fb0b4add8 Reviewed-on: https://skia-review.googlesource.com/86940 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Klein <mtklein@chromium.org>
* SkTypeface: fix non-determinism on AdvacedMetricsGravatar Hal Canary2017-07-06
| | | | | | | | | Calculate fStemV and fCapHeight using SkPaint in SkPDFFont if needed. Change-Id: Iaf762e6c44178fac659dfe9fa312d0caed9138ae Reviewed-on: https://skia-review.googlesource.com/21535 Commit-Queue: Hal Canary <halcanary@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
* Revert "Revert "SkTypeface::getAdvancedMetrics(): cleanup""Gravatar Hal Canary2017-05-05
| | | | | | | | | | | | | | | | | | | This reverts commit 59ad782b2b05b07aa6eb961aa4d62e934093cbd1. - SkAdvancedTypefaceMetrics is a struct not a class - SkTypeface::PerGlyphInfo is gone - s/getAdvancedTypefaceMetrics/getAdvancedMetrics/g - s/onGetAdvancedTypefaceMetrics/onGetAdvancedMetrics/g - [on]getAdvancedMetrics now return unique_ptr rather than bare ptr. - [on]getAdvancedMetrics no longer has parameters. (Only caller always used same arguments.) - SkAdvancedTypefaceMetrics uses C++11 in-class member initializers. - SkAdvancedTypefaceMetrics no longer inherits from SkRefCnt Change-Id: I91b56e60f7d9de7d46c426c6bd34ce124e0cf00e Reviewed-on: https://skia-review.googlesource.com/15360 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* Revert "SkTypeface::getAdvancedMetrics(): cleanup"Gravatar Hal Canary2017-05-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit cef018896e5cad8eb46a536b60cdf79ebe2b0191. Reason for revert: broke chromium roll (windows). Original change's description: > SkTypeface::getAdvancedMetrics(): cleanup > > - SkAdvancedTypefaceMetrics is a struct not a class > - SkTypeface::PerGlyphInfo is gone > - s/getAdvancedTypefaceMetrics/getAdvancedMetrics/g > - s/onGetAdvancedTypefaceMetrics/onGetAdvancedMetrics/g > - [on]getAdvancedMetrics now return unique_ptr rather than bare ptr. > - [on]getAdvancedMetrics no longer has parameters. (Only caller always > used same arguments.) > - SkAdvancedTypefaceMetrics uses C++11 in-class member initializers. > - SkAdvancedTypefaceMetrics no longer inherits from SkRefCnt > > Change-Id: I37571ebcc383ba9eb21bc20c60c734e3ca317582 > Reviewed-on: https://skia-review.googlesource.com/15311 > Reviewed-by: Ben Wagner <bungeman@google.com> > Commit-Queue: Hal Canary <halcanary@google.com> > TBR=halcanary@google.com,bungeman@google.com,reed@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I84c7d53df566aaf83427e3368edaa02b7b5a9cb8 Reviewed-on: https://skia-review.googlesource.com/15319 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* SkTypeface::getAdvancedMetrics(): cleanupGravatar Hal Canary2017-05-04
| | | | | | | | | | | | | | | | | - SkAdvancedTypefaceMetrics is a struct not a class - SkTypeface::PerGlyphInfo is gone - s/getAdvancedTypefaceMetrics/getAdvancedMetrics/g - s/onGetAdvancedTypefaceMetrics/onGetAdvancedMetrics/g - [on]getAdvancedMetrics now return unique_ptr rather than bare ptr. - [on]getAdvancedMetrics no longer has parameters. (Only caller always used same arguments.) - SkAdvancedTypefaceMetrics uses C++11 in-class member initializers. - SkAdvancedTypefaceMetrics no longer inherits from SkRefCnt Change-Id: I37571ebcc383ba9eb21bc20c60c734e3ca317582 Reviewed-on: https://skia-review.googlesource.com/15311 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* src/pdf: code cleanupGravatar Hal Canary2017-05-04
| | | | | | | | | | | | | * SkPDFCanon: remove unnecessary abstraction * Make use of SkTHashMap<K, sk_sp<T>>. * Remove unncessary struct constructors. * More factory fns return sk_sp<T> * SkPDFUtility::GetCachedT<T> factored out. Change-Id: I4055a131b43fe2588fd042b769cd09fff8a3466c Reviewed-on: https://skia-review.googlesource.com/13655 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* Mark overridden destructors with 'override' and remove 'virtual'Gravatar Brian Salomon2017-03-22
| | | | | | | | | This silences a new warning in clang 5.0 Change-Id: Ieb5b75a6ffed60107c3fd16075d2ecfd515b55e8 Reviewed-on: https://skia-review.googlesource.com/10006 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
* SkPDF: Always get advances at unitsPerEm.Gravatar Hal Canary2017-03-08
| | | | | | | | | | | | | * Work around BUG=chromium:696356 * SkTestScalerContext needs a return a em-size. * SkPDFFont::MakeVectorCache which always produces a glyph cache at emsize. Replaces vector_cache(). * Stop looking at fLastGlyphID and fEmSize in TypefaceMetrics. Change-Id: I28d93b8f62d461a60fa046e9aaf7fa6d116a7ee5 Reviewed-on: https://skia-review.googlesource.com/9324 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* SkPDF/font subsetting: Use new version of SfntlyWrapper::SubsetFontGravatar Hal Canary2017-02-16
| | | | | | | Change-Id: Ib4bddcedb09b50556e8e1f02926c443870f46a09 Reviewed-on: https://skia-review.googlesource.com/8544 Commit-Queue: Hal Canary <halcanary@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
* SkScalarMul is deprecatedGravatar Mike Reed2017-02-14
| | | | | | | | | BUG=skia: Change-Id: I88ecfe9d4c72506f6b1a0e0dfadd2a5c171a6cb6 Reviewed-on: https://skia-review.googlesource.com/8353 Commit-Queue: Ben Wagner <bungeman@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
* SkPDF: de-duplicate text-as-pathsGravatar Hal Canary2016-09-30
| | | | | | | | | | | TBR= GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2851 Change-Id: I0accbca13945587cd5ef903cbd4127f1f6a3fb13 Reviewed-on: https://skia-review.googlesource.com/2851 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* SkPDF: do not assert when openStream return nullptrGravatar halcanary2016-09-22
| | | | | | | BUG=163892 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2332813002 Review-Url: https://codereview.chromium.org/2332813002
* SkPDF: SkBitSet gets reset() to make drop() better.Gravatar halcanary2016-09-19
| | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2354583002 Review-Url: https://codereview.chromium.org/2354583002
* SkPDF: refactor & code cleanup ahead of https://crrev.com/2322403002Gravatar halcanary2016-09-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | SkPDFDevice::GraphicStateEntry: remove unnecessary fFont and fTextSize. SkPDFDevice::updateFont(): replace with update_font() and inlined code. De-duplicate this block of code. SkPDFResourceDict::GetResourceTypePrefix function made public: removes need for temporary SkString returned by SkPDFResourceDict::getResourceName() GlyphPositioner: delay writing intial matrix until first glyph. Assert that widechars is a constant. SkPDFFont::FontType(): make public so that PDFDevice can know about multibyte status. SkPDFFont::countStretch() removed, and the stretch loop flattened. *no changes in PDF output* BUG=skia:5434 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2327953002 Review-Url: https://codereview.chromium.org/2327953002
* SkPDF: hand SfntlyWrapper::SubsetFont() ttcIndex, not fontName.Gravatar halcanary2016-09-08
| | | | | | | | Also, minor code refactoring. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2258233002 Committed: https://skia.googlesource.com/skia/+/fce190647285423bf36c44bca09db78a6af30f9f Review-Url: https://codereview.chromium.org/2258233002
* SkPDF: revert changes to CMapName/Registry/Ordering in 3d01c62Gravatar halcanary2016-09-01
| | | | | | | | BUG=skia:5606 TBR=bungeman@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2305803002 Review-Url: https://codereview.chromium.org/2305803002
* SkPDF: Fix Type3 ToUnicode table.Gravatar halcanary2016-08-31
| | | | | | | | | | | | | | | | | | | | This seems to fix text extraction on Adobe Reader - Registry/Ordering is now set to Skia/SkiaOrdering. - Type3 fonts now get a FontDescriptor (force symbolic font). - CMapName is now Skia-Identity-SkiaOrdering - CMap behaves correctly for single-byte fonts. Also: - SkTestTypeface returns tounicode map for testing. - Unit test updated All PDFs render the same BUG=skia:5606 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2292303004 Review-Url: https://codereview.chromium.org/2292303004
* Revert of SkPDF: hand SfntlyWrapper::SubsetFont() ttcIndex, not fontName. ↵Gravatar halcanary2016-08-30
| | | | | | | | | | | | | | | | | | | | | | | (patchset #3 id:40001 of https://codereview.chromium.org/2258233002/ ) Reason for revert: forgot to roll sfntly in android! Original issue's description: > SkPDF: hand SfntlyWrapper::SubsetFont() ttcIndex, not fontName. > > Also, minor code refactoring. > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2258233002 > > Committed: https://skia.googlesource.com/skia/+/fce190647285423bf36c44bca09db78a6af30f9f TBR=bungeman@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review-Url: https://codereview.chromium.org/2296683004
* SkPDF: SK_SFNTLY_SUBSETTER is goneGravatar halcanary2016-08-30
| | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2296823002 Review-Url: https://codereview.chromium.org/2296823002
* SkPDF: hand SfntlyWrapper::SubsetFont() ttcIndex, not fontName.Gravatar halcanary2016-08-30
| | | | | | | Also, minor code refactoring. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2258233002 Review-Url: https://codereview.chromium.org/2258233002
* SkPDF: Remove some unused glyphs from fallback fontsGravatar halcanary2016-08-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes the /Widths and the /Differences arrays smaller. Example diff in output PDF (lines are wrapped for easy viewing): <</Type /Font /Subtype /Type3 /FontMatrix [.00100000005 0 0 -.00100000005 0 0] /FirstChar 0 -/LastChar 255 +/LastChar 118 /FontBBox [23 228 669 -694] /CIDToGIDMap /Identity /ToUnicode 8 0 R -/Widths [280 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -525 0 0 0 525 0 0 0 0 525 525 525 525 0 0 0 0 0 0 525 0 0 0 0 0 0 0 0 -0 0 0 0 0 525 0 525 0 0 0 525 0 0 0 0 0 0 0 0 0 0 0 525 0 0 0 0 0 0 -525 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 525 0 0 0 0 0 0 0 525 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] +/Widths [280 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +525 0 0 0 525 0 0 0 0 525 525 525 525 0 0 0 0 0 0 525 0 0 0 0 0 0 0 0 +0 0 0 0 0 525 0 525 0 0 0 525 0 0 0 0 0 0 0 0 0 0 0 525 0 0 0 0 0 0 +525 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 525 0 0 0 0 0 0 0 +525] /Encoding <</Type /Encoding -/Differences [0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 -/g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g1D -/g0 /g0 /g0 /g21 /g0 /g0 /g0 /g0 /g26 /g27 /g28 /g29 /g0 /g0 /g0 /g0 -/g0 /g0 /g30 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g3E -/g0 /g40 /g0 /g0 /g0 /g44 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 -/g50 /g0 /g0 /g0 /g0 /g0 /g0 /g57 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 -/g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g6E /g0 /g0 /g0 -/g0 /g0 /g0 /g0 /g76 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 -/g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 -/g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 -/g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 -/g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 -/g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 -/g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 -/g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 -/g0 /g0 /g0 /g0 /g0 /g0]>> +/Differences [0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 +/g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g1D +/g0 /g0 /g0 /g21 /g0 /g0 /g0 /g0 /g26 /g27 /g28 /g29 /g0 /g0 /g0 /g0 +/g0 /g0 /g30 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g3E +/g0 /g40 /g0 /g0 /g0 /g44 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 +/g50 /g0 /g0 /g0 /g0 /g0 /g0 /g57 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 +/g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g6E /g0 /g0 /g0 +/g0 /g0 /g0 /g0 /g76]>> /CharProcs <</g0 9 0 R /g1D 10 0 R /g21 11 0 R ....... BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2287393002 Review-Url: https://codereview.chromium.org/2287393002
* SkPDF: Glyph validation changeGravatar halcanary2016-08-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of mapping invaid glyphIDs to zero or maxGlyphID, don't draw them at all. Validate glyphs when glyph is written, not ahead of time. Don't allocate array to copy user-provided glyphs. Easy early exit from SkPDFDevice::internalDrawText() GlyphPositioner::flush() called ~GlyphPositioner() SkScopeExit class now exists. Assume SkTypeface* pointers are now never null in more places. precalculate alignmentFactor to clean up code. SkPDFDevice::updateFont must be called with validated glyphID. Skip bad glyphs to make this true. SkPDFDevice::updateFont always succeeds. SkPDFFont::GetFontResource always succeeds (preconditions are asserted). If GetMetrics fails, don't call GetFontResource. SkPDFFont::glyphsToPDFFontEncodingCount() becomes SkPDFFont::countStretch() and is inlined. SkPDFFont::glyphsToPDFFontEncoding now works one Glyph at a time and is inlined. SkPDFFont::noteGlyphUsage() operates one glyph at a time. Add SkScopeExit.h; also a unit test for it. SkPostConfig: Fix SK_UNUSED for Win32. No public API changes. TBR=reed@google.com BUG=625995 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2278703002 Review-Url: https://codereview.chromium.org/2278703002
* SkPDF: Stop `#include PREPROCESSOR_DEFINE` patternGravatar halcanary2016-08-25
| | | | | | | | | | | | | | | | | | No more: #include SK_SFNTLY_SUBSETTER #include ZLIB_INCLUDE Also, rename SK_SFNTLY_SUBSETTER to SK_PDF_USE_SFNTLY to follow my pattern of prefixing SkPDF-specific defines with 'SK_PDF_'. The ZLIB_INCLUDE define is no longer is used by anyone. TODO: rename Sfntly to something pronounceable. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2273343002 Review-Url: https://codereview.chromium.org/2273343002
* SkPDF: set SK_SFNTLY_SUBSETTER uniformlyGravatar halcanary2016-08-24
| | | | | | | | | | | | | | When Skia is built into the Android framework, SK_SFNTLY_SUBSETTER="sample/chromium/font_subsetter.h". This #includes the same value for GOOGLE3. Once Chrome is also using this value, we can do away with the `#ifdef GOOGLE3` line. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2272103002 Review-Url: https://codereview.chromium.org/2272103002
* GN: more optional components: jpeg, pdf, png, xmlGravatar mtklein2016-08-24
| | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2267343004 Review-Url: https://codereview.chromium.org/2267343004
* SkPDF: in-place font subsettingGravatar halcanary2016-08-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Motivation: gross code simplification, also no bitset lookups at draw time. SkPDFFont owns its glyph useage bitset. SkPDFSubstituteMap goes away. SkPDFObject interface is simplified. SkPDFDocument tracks font usage (as hash set), not glyph usage. SkPDFFont gets a simpler constructor. SkPDFFont has first and last glyph set in constructor, not adjusted later. SkPDFFont implementations are simplified. SkPDFGlyphSet is replaced with simple SkBitSet. SkPDFFont sizes its SkBitSets based on glyph count. SkPDFGlyphSetMap goes away. SkBitSet is now non-copyable. SkBitSet now how utility methods to match old SkPDFGlyphSet. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2253283004 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Win-MSVC-GCE-CPU-AVX2-x86_64-Release-GDI-Trybot,Test-Win-MSVC-GCE-CPU-AVX2-x86_64-Debug-GDI-Trybot Review-Url: https://codereview.chromium.org/2253283004
* SkPDF: cache metrics once.Gravatar halcanary2016-08-18
| | | | | | | | | | | | | | | | | | | | | | | | | | Motivation: drawText can look up unicode mapping at draw time to see if ActualText should be used after crrev.com/2084533004 lands. For each SkTypeface, only call getAdvancedTypefaceMetrics() once per document. Cache the result in the SkPDFCanon, indexed by SkFontID. Also cache PDF FontDescriptors in the canon, also indexed by SkFontID (Type1 fonts only). Simplify PDF font lookup, map SkFontID+SkGlyphID into a uint64_t. Map that uint64_t to SkPDFFonts. Remove SkPDFCanon::findFont(), SkPDFCanon::addFont(), SkPDFFont::IsMatch(), and enum SkPDFFont::Match. SkPDFFont no longer holds on to ref of SkAdvancedTypefaceMetrics. Instead, SkPDFFont::GetFontResource() and SkPDFFont::getFontSubset() get metrics from canon. SkPDFFont multybite bool is now a function of type. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2253993002 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Win-MSVC-GCE-CPU-AVX2-x86_64-Release-GDI-Trybot,Test-Win-MSVC-GCE-CPU-AVX2-x86_64-Debug-GDI-Trybot Review-Url: https://codereview.chromium.org/2253993002
* Revert of SkPDF: cache metrics once. (patchset #4 id:60001 of ↵Gravatar robertphillips2016-08-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://codereview.chromium.org/2253993002/ ) Reason for revert: because Original issue's description: > SkPDF: cache metrics once. > > Motivation: drawText can look up unicode mapping at draw time to see > if ActualText should be used after crrev.com/2084533004 lands. > > For each SkTypeface, only call getAdvancedTypefaceMetrics() once per > document. Cache the result in the SkPDFCanon, indexed by SkFontID. > Also cache PDF FontDescriptors in the canon, also indexed by SkFontID > (Type1 fonts only). > > Simplify PDF font lookup, map SkFontID+SkGlyphID into a uint64_t. Map > that uint64_t to SkPDFFonts. Remove SkPDFCanon::findFont(), > SkPDFCanon::addFont(), SkPDFFont::IsMatch(), and enum SkPDFFont::Match. > > SkPDFFont no longer holds on to ref of SkAdvancedTypefaceMetrics. > Instead, SkPDFFont::GetFontResource() and SkPDFFont::getFontSubset() > get metrics from canon. > > SkPDFFont multybite bool is now a function of type. > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2253993002 > > Committed: https://skia.googlesource.com/skia/+/0a61270f4ba85d10659fb63a86817b435ec04c94 TBR=bungeman@google.com,halcanary@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review-Url: https://codereview.chromium.org/2251813006
* SkPDF: cache metrics once.Gravatar halcanary2016-08-17
| | | | | | | | | | | | | | | | | | | | | | | Motivation: drawText can look up unicode mapping at draw time to see if ActualText should be used after crrev.com/2084533004 lands. For each SkTypeface, only call getAdvancedTypefaceMetrics() once per document. Cache the result in the SkPDFCanon, indexed by SkFontID. Also cache PDF FontDescriptors in the canon, also indexed by SkFontID (Type1 fonts only). Simplify PDF font lookup, map SkFontID+SkGlyphID into a uint64_t. Map that uint64_t to SkPDFFonts. Remove SkPDFCanon::findFont(), SkPDFCanon::addFont(), SkPDFFont::IsMatch(), and enum SkPDFFont::Match. SkPDFFont no longer holds on to ref of SkAdvancedTypefaceMetrics. Instead, SkPDFFont::GetFontResource() and SkPDFFont::getFontSubset() get metrics from canon. SkPDFFont multybite bool is now a function of type. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2253993002 Review-Url: https://codereview.chromium.org/2253993002
* SkPDF: pull out SkPDFMakeCIDGlyphWidthsArray.cppGravatar halcanary2016-08-17
| | | | | | | Extract from inside SkPDFFont.cpp GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2251803002 Review-Url: https://codereview.chromium.org/2251803002