blob: e08b7280dec4467e8b52a0ec4e6cfa73997d8074 [file] [log] [blame]
// 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.
#include <memory>
#include <vector>
#include "core/fpdfapi/page/cpdf_pageobject.h"
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
class CPDF_TextObjectItem {
uint32_t m_CharCode;
CFX_PointF m_Origin;
class CPDF_TextObject : public CPDF_PageObject {
~CPDF_TextObject() override;
// CPDF_PageObject
Type GetType() const override;
void Transform(const CFX_Matrix& matrix) override;
bool IsText() const override;
CPDF_TextObject* AsText() override;
const CPDF_TextObject* AsText() const override;
std::unique_ptr<CPDF_TextObject> Clone() const;
int CountItems() const;
void GetItemInfo(int index, CPDF_TextObjectItem* pInfo) const;
int CountChars() const;
void GetCharInfo(int index, uint32_t* charcode, float* kerning) const;
void GetCharInfo(int index, CPDF_TextObjectItem* pInfo) const;
float GetCharWidth(uint32_t charcode) const;
CFX_PointF GetPos() const { return m_Pos; }
CFX_Matrix GetTextMatrix() const;
CPDF_Font* GetFont() const;
float GetFontSize() const;
void SetText(const CFX_ByteString& text);
void SetPosition(float x, float y);
void RecalcPositionData();
friend class CPDF_RenderStatus;
friend class CPDF_StreamContentParser;
friend class CPDF_TextRenderer;
friend class CPDF_PageContentGenerator;
void SetSegments(const CFX_ByteString* pStrs,
const float* pKerning,
int nSegs);
CFX_PointF CalcPositionData(float horz_scale);
CFX_PointF m_Pos;
std::vector<uint32_t> m_CharCodes;
std::vector<float> m_CharPos;