xref: /aosp_15_r20/external/pdfium/core/fpdfdoc/cpvt_wordinfo.cpp (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2016 The PDFium Authors
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 
9 #include "core/fxcrt/fx_codepage.h"
10 
CPVT_WordInfo()11 CPVT_WordInfo::CPVT_WordInfo()
12     : Word(0),
13       nCharset(FX_Charset::kANSI),
14       fWordX(0.0f),
15       fWordY(0.0f),
16       fWordTail(0.0f),
17       nFontIndex(-1) {}
18 
CPVT_WordInfo(uint16_t word,FX_Charset charset,int32_t fontIndex)19 CPVT_WordInfo::CPVT_WordInfo(uint16_t word,
20                              FX_Charset charset,
21                              int32_t fontIndex)
22     : Word(word),
23       nCharset(charset),
24       fWordX(0.0f),
25       fWordY(0.0f),
26       fWordTail(0.0f),
27       nFontIndex(fontIndex) {}
28 
CPVT_WordInfo(const CPVT_WordInfo & word)29 CPVT_WordInfo::CPVT_WordInfo(const CPVT_WordInfo& word)
30     : Word(0),
31       nCharset(FX_Charset::kANSI),
32       fWordX(0.0f),
33       fWordY(0.0f),
34       fWordTail(0.0f),
35       nFontIndex(-1) {
36   operator=(word);
37 }
38 
39 CPVT_WordInfo::~CPVT_WordInfo() = default;
40 
operator =(const CPVT_WordInfo & word)41 CPVT_WordInfo& CPVT_WordInfo::operator=(const CPVT_WordInfo& word) {
42   if (this == &word)
43     return *this;
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   return *this;
52 }
53