Unreviewed changes
2 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: core/fpdfapi/page/cpdf_textobject.cpp
Insertions: 11, Deletions: 11.
@@ -47,7 +47,7 @@
Item info;
info.char_code_ = char_codes_[index];
- info.origin_ = CFX_PointF(index > 0 ? char_positions_[index - 1] : 0, 0);
+ info.origin_ = CFX_PointF(char_positions_[index], 0);
RetainPtr<CPDF_Font> font = GetFont();
const CPDF_CIDFont* cid_font = font->AsCIDFont();
@@ -82,7 +82,8 @@
RetainPtr<CPDF_Font> font = GetFont();
bool is_in_latin_word = false;
int word_count = 0;
- for (size_t i = 0, sz = CountChars(); i < sz; ++i) {
+ const size_t char_count = CountChars();
+ for (size_t i = 0; i < char_count; ++i) {
uint32_t char_code = GetCharCode(i);
WideString unicode_str = font->UnicodeFromCharCode(char_code);
@@ -110,7 +111,8 @@
WideString result_str;
int word_count = 0;
bool is_in_latin_word = false;
- for (size_t i = 0, sz = CountChars(); i < sz; ++i) {
+ const size_t char_count = CountChars();
+ for (size_t i = 0; i < char_count; ++i) {
uint32_t char_code = GetCharCode(i);
WideString unicode_str = font->UnicodeFromCharCode(char_code);
@@ -188,14 +190,14 @@
char_kernings_.clear();
char_positions_.clear();
RetainPtr<CPDF_Font> font = GetFont();
- size_t nChars = 0;
+ size_t char_count = 0;
for (const auto& str : strings) {
- nChars += font->CountChar(str.AsStringView());
+ char_count += font->CountChar(str.AsStringView());
}
- CHECK(nChars);
- char_codes_.resize(nChars);
- char_kernings_.resize(nChars);
- char_positions_.resize(nChars - 1);
+ CHECK(char_count);
+ char_codes_.resize(char_count);
+ char_kernings_.resize(char_count);
+ char_positions_.resize(char_count);
size_t index = 0;
for (size_t i = 0; i < segments_count; ++i) {
ByteStringView segment = strings[i].AsStringView();
@@ -267,9 +269,7 @@
for (size_t i = 0; i < char_codes_.size(); ++i) {
const uint32_t char_code = char_codes_[i];
- if (i > 0) {
- char_positions_[i - 1] = current_position;
- }
+ char_positions_[i] = current_position;
FX_RECT char_rect = font->GetCharBBox(char_code);
float char_width;
```
Change information
Commit message:
Rename CPDF_TextObject variables
- Stop using Hungarian notation.
- Consistently write foobar as foo_bar. e.g. font_size
- Use fewer abbreviations.
Change-Id: Idd36881b98106b97fc9bb2450e19b829906abc99
Files:
- M core/fpdfapi/page/cpdf_textobject.cpp
- M core/fpdfapi/page/cpdf_textobject.h
Change size: M
Delta: 2 files changed, 99 insertions(+), 93 deletions(-)
Branch: refs/heads/main
Submit Requirements:
Code-Review: +1 by Andy Phan