OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 |
| 7 #include "core/fpdfapi/fpdf_page/include/cpdf_textstatedata.h" |
| 8 |
| 9 #include "core/fpdfapi/fpdf_page/pageint.h" |
| 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
| 11 #include "core/include/fpdfapi/fpdf_resource.h" |
| 12 |
| 13 CPDF_TextStateData::CPDF_TextStateData() |
| 14 : m_pFont(nullptr), |
| 15 m_pDocument(nullptr), |
| 16 m_FontSize(1.0f), |
| 17 m_CharSpace(0), |
| 18 m_WordSpace(0), |
| 19 m_TextMode(0) { |
| 20 m_Matrix[0] = m_Matrix[3] = 1.0f; |
| 21 m_Matrix[1] = m_Matrix[2] = 0; |
| 22 m_CTM[0] = m_CTM[3] = 1.0f; |
| 23 m_CTM[1] = m_CTM[2] = 0; |
| 24 } |
| 25 |
| 26 CPDF_TextStateData::CPDF_TextStateData(const CPDF_TextStateData& src) { |
| 27 if (this == &src) |
| 28 return; |
| 29 |
| 30 FXSYS_memcpy(this, &src, sizeof(CPDF_TextStateData)); |
| 31 if (m_pDocument && m_pFont) { |
| 32 m_pFont = |
| 33 m_pDocument->GetPageData()->GetFont(m_pFont->GetFontDict(), FALSE); |
| 34 } |
| 35 } |
| 36 |
| 37 CPDF_TextStateData::~CPDF_TextStateData() { |
| 38 if (m_pDocument && m_pFont) { |
| 39 CPDF_DocPageData* pPageData = m_pDocument->GetPageData(); |
| 40 if (pPageData && !pPageData->IsForceClear()) |
| 41 pPageData->ReleaseFont(m_pFont->GetFontDict()); |
| 42 } |
| 43 } |
OLD | NEW |