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/fpdfdoc/cpvt_wordinfo.h" 8#include "third_party/base/ptr_util.h" 9 10CPVT_WordInfo::CPVT_WordInfo() 11 : Word(0), 12 nCharset(FXFONT_ANSI_CHARSET), 13 fWordX(0.0f), 14 fWordY(0.0f), 15 fWordTail(0.0f), 16 nFontIndex(-1) {} 17 18CPVT_WordInfo::CPVT_WordInfo(uint16_t word, 19 int32_t charset, 20 int32_t fontIndex, 21 CPVT_WordProps* pProps) 22 : Word(word), 23 nCharset(charset), 24 fWordX(0.0f), 25 fWordY(0.0f), 26 fWordTail(0.0f), 27 nFontIndex(fontIndex) {} 28 29CPVT_WordInfo::CPVT_WordInfo(const CPVT_WordInfo& word) 30 : Word(0), 31 nCharset(FXFONT_ANSI_CHARSET), 32 fWordX(0.0f), 33 fWordY(0.0f), 34 fWordTail(0.0f), 35 nFontIndex(-1) { 36 operator=(word); 37} 38 39CPVT_WordInfo::~CPVT_WordInfo() {} 40 41void CPVT_WordInfo::operator=(const CPVT_WordInfo& word) { 42 if (this == &word) 43 return; 44 45 Word = word.Word; 46 nCharset = word.nCharset; 47 nFontIndex = word.nFontIndex; 48 fWordX = word.fWordX; 49 fWordY = word.fWordY; 50 fWordTail = word.fWordTail; 51 if (word.pWordProps) 52 pWordProps = pdfium::MakeUnique<CPVT_WordProps>(*word.pWordProps); 53 else 54 pWordProps.reset(); 55} 56