diff options
-rw-r--r-- | BUILD.gn | 4 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_render/cpdf_type3cache.cpp | 171 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_render/cpdf_type3cache.h | 40 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_render/cpdf_type3glyphs.cpp | 46 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_render/cpdf_type3glyphs.h | 35 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_render/fpdf_render.cpp | 1 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_render/fpdf_render_text.cpp | 195 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_render/render_int.h | 40 |
8 files changed, 299 insertions, 233 deletions
@@ -524,6 +524,10 @@ static_library("fpdfapi") { "core/fpdfapi/fpdf_parser/include/cpdf_string.h", "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h", "core/fpdfapi/fpdf_render/cpdf_pagerendercache.h", + "core/fpdfapi/fpdf_render/cpdf_type3cache.cpp", + "core/fpdfapi/fpdf_render/cpdf_type3cache.h", + "core/fpdfapi/fpdf_render/cpdf_type3glyphs.cpp", + "core/fpdfapi/fpdf_render/cpdf_type3glyphs.h", "core/fpdfapi/fpdf_render/fpdf_render.cpp", "core/fpdfapi/fpdf_render/fpdf_render_cache.cpp", "core/fpdfapi/fpdf_render/fpdf_render_image.cpp", diff --git a/core/fpdfapi/fpdf_render/cpdf_type3cache.cpp b/core/fpdfapi/fpdf_render/cpdf_type3cache.cpp new file mode 100644 index 0000000000..a414d3c589 --- /dev/null +++ b/core/fpdfapi/fpdf_render/cpdf_type3cache.cpp @@ -0,0 +1,171 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#include "core/fpdfapi/fpdf_render/cpdf_type3cache.h" + +#include <map> +#include <memory> + +#include "core/fxge/include/fx_dib.h" +#include "core/fxge/include/fx_font.h" +#include "core/fpdfapi/fpdf_font/cpdf_type3char.h" +#include "core/fpdfapi/fpdf_font/cpdf_type3font.h" +#include "core/fpdfapi/fpdf_render/cpdf_type3glyphs.h" + +namespace { + +struct CPDF_UniqueKeyGen { + void Generate(int count, ...); + FX_CHAR m_Key[128]; + int m_KeyLen; +}; + +void CPDF_UniqueKeyGen::Generate(int count, ...) { + va_list argList; + va_start(argList, count); + for (int i = 0; i < count; i++) { + int p = va_arg(argList, int); + (reinterpret_cast<uint32_t*>(m_Key))[i] = p; + } + va_end(argList); + m_KeyLen = count * sizeof(uint32_t); +} + +FX_BOOL IsScanLine1bpp(uint8_t* pBuf, int width) { + int size = width / 8; + for (int i = 0; i < size; i++) { + if (pBuf[i]) + return TRUE; + } + return (width % 8) && (pBuf[width / 8] & (0xff << (8 - width % 8))); +} + +FX_BOOL IsScanLine8bpp(uint8_t* pBuf, int width) { + for (int i = 0; i < width; i++) { + if (pBuf[i] > 0x40) + return TRUE; + } + return FALSE; +} + +int DetectFirstLastScan(const CFX_DIBitmap* pBitmap, FX_BOOL bFirst) { + int height = pBitmap->GetHeight(); + int pitch = pBitmap->GetPitch(); + int width = pBitmap->GetWidth(); + int bpp = pBitmap->GetBPP(); + if (bpp > 8) + width *= bpp / 8; + uint8_t* pBuf = pBitmap->GetBuffer(); + int line = bFirst ? 0 : height - 1; + int line_step = bFirst ? 1 : -1; + int line_end = bFirst ? height : -1; + while (line != line_end) { + if (bpp == 1) { + if (IsScanLine1bpp(pBuf + line * pitch, width)) + return line; + } else { + if (IsScanLine8bpp(pBuf + line * pitch, width)) + return line; + } + line += line_step; + } + return -1; +} + +} // namespace + +CPDF_Type3Cache::CPDF_Type3Cache(CPDF_Type3Font* pFont) : m_pFont(pFont) {} + +CPDF_Type3Cache::~CPDF_Type3Cache() { + for (const auto& pair : m_SizeMap) + delete pair.second; + m_SizeMap.clear(); +} + +CFX_GlyphBitmap* CPDF_Type3Cache::LoadGlyph(uint32_t charcode, + const CFX_Matrix* pMatrix, + FX_FLOAT retinaScaleX, + FX_FLOAT retinaScaleY) { + CPDF_UniqueKeyGen keygen; + keygen.Generate( + 4, FXSYS_round(pMatrix->a * 10000), FXSYS_round(pMatrix->b * 10000), + FXSYS_round(pMatrix->c * 10000), FXSYS_round(pMatrix->d * 10000)); + CFX_ByteString FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen); + CPDF_Type3Glyphs* pSizeCache; + auto it = m_SizeMap.find(FaceGlyphsKey); + if (it == m_SizeMap.end()) { + pSizeCache = new CPDF_Type3Glyphs; + m_SizeMap[FaceGlyphsKey] = pSizeCache; + } else { + pSizeCache = it->second; + } + auto it2 = pSizeCache->m_GlyphMap.find(charcode); + if (it2 != pSizeCache->m_GlyphMap.end()) + return it2->second; + + CFX_GlyphBitmap* pGlyphBitmap = + RenderGlyph(pSizeCache, charcode, pMatrix, retinaScaleX, retinaScaleY); + pSizeCache->m_GlyphMap[charcode] = pGlyphBitmap; + return pGlyphBitmap; +} + +CFX_GlyphBitmap* CPDF_Type3Cache::RenderGlyph(CPDF_Type3Glyphs* pSize, + uint32_t charcode, + const CFX_Matrix* pMatrix, + FX_FLOAT retinaScaleX, + FX_FLOAT retinaScaleY) { + const CPDF_Type3Char* pChar = m_pFont->LoadChar(charcode); + if (!pChar || !pChar->m_pBitmap) + return nullptr; + + CFX_DIBitmap* pBitmap = pChar->m_pBitmap.get(); + CFX_Matrix image_matrix, text_matrix; + image_matrix = pChar->m_ImageMatrix; + text_matrix.Set(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d, 0, 0); + image_matrix.Concat(text_matrix); + std::unique_ptr<CFX_DIBitmap> pResBitmap; + int left = 0; + int top = 0; + if (FXSYS_fabs(image_matrix.b) < FXSYS_fabs(image_matrix.a) / 100 && + FXSYS_fabs(image_matrix.c) < FXSYS_fabs(image_matrix.d) / 100) { + int top_line = DetectFirstLastScan(pBitmap, TRUE); + int bottom_line = DetectFirstLastScan(pBitmap, FALSE); + if (top_line == 0 && bottom_line == pBitmap->GetHeight() - 1) { + FX_FLOAT top_y = image_matrix.d + image_matrix.f; + FX_FLOAT bottom_y = image_matrix.f; + FX_BOOL bFlipped = top_y > bottom_y; + if (bFlipped) { + FX_FLOAT temp = top_y; + top_y = bottom_y; + bottom_y = temp; + } + pSize->AdjustBlue(top_y, bottom_y, top_line, bottom_line); + pResBitmap.reset(pBitmap->StretchTo( + (int)(FXSYS_round(image_matrix.a) * retinaScaleX), + (int)((bFlipped ? top_line - bottom_line : bottom_line - top_line) * + retinaScaleY))); + top = top_line; + if (image_matrix.a < 0) { + image_matrix.Scale(retinaScaleX, retinaScaleY); + left = FXSYS_round(image_matrix.e + image_matrix.a); + } else { + left = FXSYS_round(image_matrix.e); + } + } + } + if (!pResBitmap) { + image_matrix.Scale(retinaScaleX, retinaScaleY); + pResBitmap.reset(pBitmap->TransformTo(&image_matrix, left, top)); + } + if (!pResBitmap) + return nullptr; + + CFX_GlyphBitmap* pGlyph = new CFX_GlyphBitmap; + pGlyph->m_Left = left; + pGlyph->m_Top = -top; + pGlyph->m_Bitmap.TakeOver(pResBitmap.get()); + return pGlyph; +} diff --git a/core/fpdfapi/fpdf_render/cpdf_type3cache.h b/core/fpdfapi/fpdf_render/cpdf_type3cache.h new file mode 100644 index 0000000000..50d7147805 --- /dev/null +++ b/core/fpdfapi/fpdf_render/cpdf_type3cache.h @@ -0,0 +1,40 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FPDFAPI_FPDF_RENDER_CPDF_TYPE3CACHE_H_ +#define CORE_FPDFAPI_FPDF_RENDER_CPDF_TYPE3CACHE_H_ + +#include <map> + +#include "core/fpdfapi/fpdf_font/cpdf_type3font.h" +#include "core/fxcrt/include/fx_coordinates.h" +#include "core/fxcrt/include/fx_string.h" +#include "core/fxcrt/include/fx_system.h" + +class CPDF_Type3Glyphs; + +class CPDF_Type3Cache { + public: + explicit CPDF_Type3Cache(CPDF_Type3Font* pFont); + ~CPDF_Type3Cache(); + + CFX_GlyphBitmap* LoadGlyph(uint32_t charcode, + const CFX_Matrix* pMatrix, + FX_FLOAT retinaScaleX, + FX_FLOAT retinaScaleY); + + private: + CFX_GlyphBitmap* RenderGlyph(CPDF_Type3Glyphs* pSize, + uint32_t charcode, + const CFX_Matrix* pMatrix, + FX_FLOAT retinaScaleX, + FX_FLOAT retinaScaleY); + + CPDF_Type3Font* const m_pFont; + std::map<CFX_ByteString, CPDF_Type3Glyphs*> m_SizeMap; +}; + +#endif // CORE_FPDFAPI_FPDF_RENDER_CPDF_TYPE3CACHE_H_ diff --git a/core/fpdfapi/fpdf_render/cpdf_type3glyphs.cpp b/core/fpdfapi/fpdf_render/cpdf_type3glyphs.cpp new file mode 100644 index 0000000000..f450dffa8c --- /dev/null +++ b/core/fpdfapi/fpdf_render/cpdf_type3glyphs.cpp @@ -0,0 +1,46 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#include "core/fpdfapi/fpdf_render/cpdf_type3glyphs.h" + +#include <map> + +#include "core/fxge/include/fx_font.h" + +CPDF_Type3Glyphs::CPDF_Type3Glyphs() + : m_TopBlueCount(0), m_BottomBlueCount(0) {} + +CPDF_Type3Glyphs::~CPDF_Type3Glyphs() { + for (const auto& pair : m_GlyphMap) + delete pair.second; +} + +static int _AdjustBlue(FX_FLOAT pos, int& count, int blues[]) { + FX_FLOAT min_distance = 1000000.0f; + int closest_pos = -1; + for (int i = 0; i < count; i++) { + FX_FLOAT distance = FXSYS_fabs(pos - static_cast<FX_FLOAT>(blues[i])); + if (distance < 1.0f * 80.0f / 100.0f && distance < min_distance) { + min_distance = distance; + closest_pos = i; + } + } + if (closest_pos >= 0) + return blues[closest_pos]; + int new_pos = FXSYS_round(pos); + if (count == TYPE3_MAX_BLUES) + return new_pos; + blues[count++] = new_pos; + return new_pos; +} + +void CPDF_Type3Glyphs::AdjustBlue(FX_FLOAT top, + FX_FLOAT bottom, + int& top_line, + int& bottom_line) { + top_line = _AdjustBlue(top, m_TopBlueCount, m_TopBlue); + bottom_line = _AdjustBlue(bottom, m_BottomBlueCount, m_BottomBlue); +} diff --git a/core/fpdfapi/fpdf_render/cpdf_type3glyphs.h b/core/fpdfapi/fpdf_render/cpdf_type3glyphs.h new file mode 100644 index 0000000000..d021e99e20 --- /dev/null +++ b/core/fpdfapi/fpdf_render/cpdf_type3glyphs.h @@ -0,0 +1,35 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FPDFAPI_FPDF_RENDER_CPDF_TYPE3GLYPHS_H_ +#define CORE_FPDFAPI_FPDF_RENDER_CPDF_TYPE3GLYPHS_H_ + +#include <map> + +#include "core/fxcrt/include/fx_system.h" + +class CFX_GlyphBitmap; + +#define TYPE3_MAX_BLUES 16 + +class CPDF_Type3Glyphs { + public: + CPDF_Type3Glyphs(); + ~CPDF_Type3Glyphs(); + + void AdjustBlue(FX_FLOAT top, + FX_FLOAT bottom, + int& top_line, + int& bottom_line); + + std::map<uint32_t, CFX_GlyphBitmap*> m_GlyphMap; + int m_TopBlue[TYPE3_MAX_BLUES]; + int m_BottomBlue[TYPE3_MAX_BLUES]; + int m_TopBlueCount; + int m_BottomBlueCount; +}; + +#endif // CORE_FPDFAPI_FPDF_RENDER_CPDF_TYPE3GLYPHS_H_ diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp index 23443b15c5..7df6b9a4b2 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp @@ -25,6 +25,7 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_render/cpdf_pagerendercache.h" +#include "core/fpdfapi/fpdf_render/cpdf_type3cache.h" #include "core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h" #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" #include "core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h" diff --git a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp index e5e28b429c..ed254c17be 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp @@ -20,6 +20,7 @@ #include "core/fpdfapi/fpdf_page/pageint.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_render/cpdf_type3cache.h" #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" #include "core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h" #include "core/fxge/include/cfx_autofontcache.h" @@ -31,200 +32,6 @@ #include "core/fxge/include/cfx_pathdata.h" #include "core/fxge/include/cfx_renderdevice.h" -namespace { - -struct CPDF_UniqueKeyGen { - void Generate(int count, ...); - FX_CHAR m_Key[128]; - int m_KeyLen; -}; - -void CPDF_UniqueKeyGen::Generate(int count, ...) { - va_list argList; - va_start(argList, count); - for (int i = 0; i < count; i++) { - int p = va_arg(argList, int); - ((uint32_t*)m_Key)[i] = p; - } - va_end(argList); - m_KeyLen = count * sizeof(uint32_t); -} - -} // namespace - -CPDF_Type3Cache::CPDF_Type3Cache(CPDF_Type3Font* pFont) : m_pFont(pFont) {} - -CPDF_Type3Cache::~CPDF_Type3Cache() { - for (const auto& pair : m_SizeMap) { - delete pair.second; - } - m_SizeMap.clear(); -} - -CFX_GlyphBitmap* CPDF_Type3Cache::LoadGlyph(uint32_t charcode, - const CFX_Matrix* pMatrix, - FX_FLOAT retinaScaleX, - FX_FLOAT retinaScaleY) { - CPDF_UniqueKeyGen keygen; - keygen.Generate( - 4, FXSYS_round(pMatrix->a * 10000), FXSYS_round(pMatrix->b * 10000), - FXSYS_round(pMatrix->c * 10000), FXSYS_round(pMatrix->d * 10000)); - CFX_ByteString FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen); - CPDF_Type3Glyphs* pSizeCache; - auto it = m_SizeMap.find(FaceGlyphsKey); - if (it == m_SizeMap.end()) { - pSizeCache = new CPDF_Type3Glyphs; - m_SizeMap[FaceGlyphsKey] = pSizeCache; - } else { - pSizeCache = it->second; - } - auto it2 = pSizeCache->m_GlyphMap.find(charcode); - if (it2 != pSizeCache->m_GlyphMap.end()) - return it2->second; - - CFX_GlyphBitmap* pGlyphBitmap = - RenderGlyph(pSizeCache, charcode, pMatrix, retinaScaleX, retinaScaleY); - pSizeCache->m_GlyphMap[charcode] = pGlyphBitmap; - return pGlyphBitmap; -} - -CPDF_Type3Glyphs::CPDF_Type3Glyphs() - : m_TopBlueCount(0), m_BottomBlueCount(0) {} - -CPDF_Type3Glyphs::~CPDF_Type3Glyphs() { - for (const auto& pair : m_GlyphMap) - delete pair.second; -} - -static int _AdjustBlue(FX_FLOAT pos, int& count, int blues[]) { - FX_FLOAT min_distance = 1000000.0f * 1.0f; - int closest_pos = -1; - for (int i = 0; i < count; i++) { - FX_FLOAT distance = (FX_FLOAT)FXSYS_fabs(pos - (FX_FLOAT)blues[i]); - if (distance < 1.0f * 80.0f / 100.0f && distance < min_distance) { - min_distance = distance; - closest_pos = i; - } - } - if (closest_pos >= 0) { - return blues[closest_pos]; - } - int new_pos = FXSYS_round(pos); - if (count == TYPE3_MAX_BLUES) { - return new_pos; - } - blues[count++] = new_pos; - return new_pos; -} -void CPDF_Type3Glyphs::AdjustBlue(FX_FLOAT top, - FX_FLOAT bottom, - int& top_line, - int& bottom_line) { - top_line = _AdjustBlue(top, m_TopBlueCount, m_TopBlue); - bottom_line = _AdjustBlue(bottom, m_BottomBlueCount, m_BottomBlue); -} - -static FX_BOOL _IsScanLine1bpp(uint8_t* pBuf, int width) { - int size = width / 8; - for (int i = 0; i < size; i++) { - if (pBuf[i]) - return TRUE; - } - return (width % 8) && (pBuf[width / 8] & (0xff << (8 - width % 8))); -} - -static FX_BOOL _IsScanLine8bpp(uint8_t* pBuf, int width) { - for (int i = 0; i < width; i++) { - if (pBuf[i] > 0x40) - return TRUE; - } - return FALSE; -} - -static int _DetectFirstLastScan(const CFX_DIBitmap* pBitmap, FX_BOOL bFirst) { - int height = pBitmap->GetHeight(), pitch = pBitmap->GetPitch(), - width = pBitmap->GetWidth(); - int bpp = pBitmap->GetBPP(); - if (bpp > 8) { - width *= bpp / 8; - } - uint8_t* pBuf = pBitmap->GetBuffer(); - int line = bFirst ? 0 : height - 1; - int line_step = bFirst ? 1 : -1; - int line_end = bFirst ? height : -1; - while (line != line_end) { - if (bpp == 1) { - if (_IsScanLine1bpp(pBuf + line * pitch, width)) { - return line; - } - } else { - if (_IsScanLine8bpp(pBuf + line * pitch, width)) { - return line; - } - } - line += line_step; - } - return -1; -} - -CFX_GlyphBitmap* CPDF_Type3Cache::RenderGlyph(CPDF_Type3Glyphs* pSize, - uint32_t charcode, - const CFX_Matrix* pMatrix, - FX_FLOAT retinaScaleX, - FX_FLOAT retinaScaleY) { - const CPDF_Type3Char* pChar = m_pFont->LoadChar(charcode); - if (!pChar || !pChar->m_pBitmap) - return nullptr; - - CFX_DIBitmap* pBitmap = pChar->m_pBitmap.get(); - CFX_Matrix image_matrix, text_matrix; - image_matrix = pChar->m_ImageMatrix; - text_matrix.Set(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d, 0, 0); - image_matrix.Concat(text_matrix); - std::unique_ptr<CFX_DIBitmap> pResBitmap; - int left = 0; - int top = 0; - if (FXSYS_fabs(image_matrix.b) < FXSYS_fabs(image_matrix.a) / 100 && - FXSYS_fabs(image_matrix.c) < FXSYS_fabs(image_matrix.d) / 100) { - int top_line = _DetectFirstLastScan(pBitmap, TRUE); - int bottom_line = _DetectFirstLastScan(pBitmap, FALSE); - if (top_line == 0 && bottom_line == pBitmap->GetHeight() - 1) { - FX_FLOAT top_y = image_matrix.d + image_matrix.f; - FX_FLOAT bottom_y = image_matrix.f; - FX_BOOL bFlipped = top_y > bottom_y; - if (bFlipped) { - FX_FLOAT temp = top_y; - top_y = bottom_y; - bottom_y = temp; - } - pSize->AdjustBlue(top_y, bottom_y, top_line, bottom_line); - pResBitmap.reset(pBitmap->StretchTo( - (int)(FXSYS_round(image_matrix.a) * retinaScaleX), - (int)((bFlipped ? top_line - bottom_line : bottom_line - top_line) * - retinaScaleY))); - top = top_line; - if (image_matrix.a < 0) { - image_matrix.Scale(retinaScaleX, retinaScaleY); - left = FXSYS_round(image_matrix.e + image_matrix.a); - } else { - left = FXSYS_round(image_matrix.e); - } - } - } - if (!pResBitmap) { - image_matrix.Scale(retinaScaleX, retinaScaleY); - pResBitmap.reset(pBitmap->TransformTo(&image_matrix, left, top)); - } - if (!pResBitmap) - return nullptr; - - CFX_GlyphBitmap* pGlyph = new CFX_GlyphBitmap; - pGlyph->m_Left = left; - pGlyph->m_Top = -top; - pGlyph->m_Bitmap.TakeOver(pResBitmap.get()); - return pGlyph; -} - FX_BOOL CPDF_RenderStatus::ProcessText(const CPDF_TextObject* textobj, const CFX_Matrix* pObj2Device, CFX_PathData* pClippingPath) { diff --git a/core/fpdfapi/fpdf_render/render_int.h b/core/fpdfapi/fpdf_render/render_int.h index 66d0a70d52..893784bc8f 100644 --- a/core/fpdfapi/fpdf_render/render_int.h +++ b/core/fpdfapi/fpdf_render/render_int.h @@ -46,50 +46,12 @@ class CPDF_Stream; class CPDF_TilingPattern; class CPDF_TransferFunc; class CPDF_Type3Cache; +class CPDF_Type3Glyphs; class CPDF_Type3Char; class CPDF_Type3Font; -#define TYPE3_MAX_BLUES 16 - FX_BOOL IsAvailableMatrix(const CFX_Matrix& matrix); -class CPDF_Type3Glyphs { - public: - CPDF_Type3Glyphs(); - ~CPDF_Type3Glyphs(); - - void AdjustBlue(FX_FLOAT top, - FX_FLOAT bottom, - int& top_line, - int& bottom_line); - - std::map<uint32_t, CFX_GlyphBitmap*> m_GlyphMap; - int m_TopBlue[TYPE3_MAX_BLUES]; - int m_BottomBlue[TYPE3_MAX_BLUES]; - int m_TopBlueCount; - int m_BottomBlueCount; -}; - -class CPDF_Type3Cache { - public: - explicit CPDF_Type3Cache(CPDF_Type3Font* pFont); - ~CPDF_Type3Cache(); - - CFX_GlyphBitmap* LoadGlyph(uint32_t charcode, - const CFX_Matrix* pMatrix, - FX_FLOAT retinaScaleX = 1.0f, - FX_FLOAT retinaScaleY = 1.0f); - - protected: - CFX_GlyphBitmap* RenderGlyph(CPDF_Type3Glyphs* pSize, - uint32_t charcode, - const CFX_Matrix* pMatrix, - FX_FLOAT retinaScaleX = 1.0f, - FX_FLOAT retinaScaleY = 1.0f); - CPDF_Type3Font* const m_pFont; - std::map<CFX_ByteString, CPDF_Type3Glyphs*> m_SizeMap; -}; - class CPDF_TransferFunc { public: explicit CPDF_TransferFunc(CPDF_Document* pDoc); |