OLD | NEW |
---|---|
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "core/fpdfdoc/include/cpdf_variabletext.h" | 7 #include "core/fpdfdoc/include/cpdf_variabletext.h" |
8 | 8 |
9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" | 9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" |
10 #include "core/fpdfdoc/cpvt_wordinfo.h" | 10 #include "core/fpdfdoc/cpvt_wordinfo.h" |
(...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1105 } | 1105 } |
1106 return rcRet; | 1106 return rcRet; |
1107 } | 1107 } |
1108 | 1108 |
1109 int32_t CPDF_VariableText::GetCharWidth(int32_t nFontIndex, | 1109 int32_t CPDF_VariableText::GetCharWidth(int32_t nFontIndex, |
1110 uint16_t Word, | 1110 uint16_t Word, |
1111 uint16_t SubWord, | 1111 uint16_t SubWord, |
1112 int32_t nWordStyle) { | 1112 int32_t nWordStyle) { |
1113 if (!m_pVTProvider) | 1113 if (!m_pVTProvider) |
1114 return 0; | 1114 return 0; |
1115 if (SubWord > 0) | 1115 uint16_t word = SubWord ? SubWord : Word; |
Wei Li
2016/05/12 21:11:59
SubWord > 0 ? SubWord : Word
Lei Zhang
2016/05/12 22:11:31
|SubWord| is unsigned, so it doesn't matter?
| |
1116 return m_pVTProvider->GetCharWidth(nFontIndex, SubWord, nWordStyle); | 1116 return m_pVTProvider->GetCharWidth(nFontIndex, word, nWordStyle); |
1117 return m_pVTProvider->GetCharWidth(nFontIndex, Word, nWordStyle); | |
1118 } | 1117 } |
1119 | 1118 |
1120 int32_t CPDF_VariableText::GetTypeAscent(int32_t nFontIndex) { | 1119 int32_t CPDF_VariableText::GetTypeAscent(int32_t nFontIndex) { |
1121 return m_pVTProvider ? m_pVTProvider->GetTypeAscent(nFontIndex) : 0; | 1120 return m_pVTProvider ? m_pVTProvider->GetTypeAscent(nFontIndex) : 0; |
1122 } | 1121 } |
1123 | 1122 |
1124 int32_t CPDF_VariableText::GetTypeDescent(int32_t nFontIndex) { | 1123 int32_t CPDF_VariableText::GetTypeDescent(int32_t nFontIndex) { |
1125 return m_pVTProvider ? m_pVTProvider->GetTypeDescent(nFontIndex) : 0; | 1124 return m_pVTProvider ? m_pVTProvider->GetTypeDescent(nFontIndex) : 0; |
1126 } | 1125 } |
1127 | 1126 |
(...skipping 15 matching lines...) Expand all Loading... | |
1143 | 1142 |
1144 CPDF_VariableText::Iterator* CPDF_VariableText::GetIterator() { | 1143 CPDF_VariableText::Iterator* CPDF_VariableText::GetIterator() { |
1145 if (!m_pVTIterator) | 1144 if (!m_pVTIterator) |
1146 m_pVTIterator.reset(new CPDF_VariableText::Iterator(this)); | 1145 m_pVTIterator.reset(new CPDF_VariableText::Iterator(this)); |
1147 return m_pVTIterator.get(); | 1146 return m_pVTIterator.get(); |
1148 } | 1147 } |
1149 | 1148 |
1150 void CPDF_VariableText::SetProvider(CPDF_VariableText::Provider* pProvider) { | 1149 void CPDF_VariableText::SetProvider(CPDF_VariableText::Provider* pProvider) { |
1151 m_pVTProvider = pProvider; | 1150 m_pVTProvider = pProvider; |
1152 } | 1151 } |
OLD | NEW |