summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_font
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/fpdf_font')
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_cidfont.cpp6
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_simplefont.cpp17
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_type3font.cpp10
3 files changed, 12 insertions, 21 deletions
diff --git a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp
index 3329f5c577..034f6f6ece 100644
--- a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp
@@ -817,8 +817,7 @@ void CPDF_CIDFont::LoadMetricsArray(CPDF_Array* pArray,
int iCurElement = 0;
int first_code = 0;
int last_code = 0;
- uint32_t count = pArray->GetCount();
- for (uint32_t i = 0; i < count; i++) {
+ for (size_t i = 0; i < pArray->GetCount(); i++) {
CPDF_Object* pObj = pArray->GetDirectObjectAt(i);
if (!pObj)
continue;
@@ -827,8 +826,7 @@ void CPDF_CIDFont::LoadMetricsArray(CPDF_Array* pArray,
if (width_status != 1)
return;
- uint32_t count = pArray->GetCount();
- for (uint32_t j = 0; j < count; j += nElements) {
+ for (size_t j = 0; j < pArray->GetCount(); j += nElements) {
result.Add(first_code);
result.Add(first_code);
for (int k = 0; k < nElements; k++) {
diff --git a/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp b/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp
index 0b4199aac0..b367184e2e 100644
--- a/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp
@@ -111,7 +111,6 @@ FX_BOOL CPDF_SimpleFont::LoadCommon() {
LoadFontDescriptor(pFontDesc);
}
CPDF_Array* pWidthArray = m_pFontDict->GetArrayBy("Widths");
- int width_start = 0, width_end = -1;
m_bUseFontWidth = TRUE;
if (pWidthArray) {
m_bUseFontWidth = FALSE;
@@ -121,19 +120,15 @@ FX_BOOL CPDF_SimpleFont::LoadCommon() {
m_CharWidth[i] = MissingWidth;
}
}
- width_start = m_pFontDict->GetIntegerBy("FirstChar", 0);
- width_end = m_pFontDict->GetIntegerBy("LastChar", 0);
- if (width_start >= 0 && width_start <= 255) {
- if (width_end <= 0 ||
- width_end >= width_start + (int)pWidthArray->GetCount()) {
+ size_t width_start = m_pFontDict->GetIntegerBy("FirstChar", 0);
+ size_t width_end = m_pFontDict->GetIntegerBy("LastChar", 0);
+ if (width_start <= 255) {
+ if (width_end == 0 || width_end >= width_start + pWidthArray->GetCount())
width_end = width_start + pWidthArray->GetCount() - 1;
- }
- if (width_end > 255) {
+ if (width_end > 255)
width_end = 255;
- }
- for (int i = width_start; i <= width_end; i++) {
+ for (size_t i = width_start; i <= width_end; i++)
m_CharWidth[i] = pWidthArray->GetIntegerAt(i - width_start);
- }
}
}
if (m_pFontFile) {
diff --git a/core/fpdfapi/fpdf_font/cpdf_type3font.cpp b/core/fpdfapi/fpdf_font/cpdf_type3font.cpp
index 9f37d4adee..92f5102cdb 100644
--- a/core/fpdfapi/fpdf_font/cpdf_type3font.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_type3font.cpp
@@ -57,14 +57,12 @@ FX_BOOL CPDF_Type3Font::Load() {
int StartChar = m_pFontDict->GetIntegerBy("FirstChar");
CPDF_Array* pWidthArray = m_pFontDict->GetArrayBy("Widths");
if (pWidthArray && (StartChar >= 0 && StartChar < 256)) {
- uint32_t count = pWidthArray->GetCount();
- if (count > 256) {
+ size_t count = pWidthArray->GetCount();
+ if (count > 256)
count = 256;
- }
- if (StartChar + count > 256) {
+ if (StartChar + count > 256)
count = 256 - StartChar;
- }
- for (uint32_t i = 0; i < count; i++) {
+ for (size_t i = 0; i < count; i++) {
m_CharWidthL[StartChar + i] =
FXSYS_round(pWidthArray->GetNumberAt(i) * xscale * 1000);
}