summaryrefslogtreecommitdiff
path: root/core/src/fpdfdoc/doc_vt.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-06-09 13:24:12 -0700
committerTom Sepez <tsepez@chromium.org>2015-06-09 13:24:12 -0700
commitbfa9a824a20f37c2dd7111012b46c929cf2ed8a0 (patch)
tree4cfbe682869d89900f33751c37f6a84865beeb0a /core/src/fpdfdoc/doc_vt.cpp
parentb116136da234afcad018bb44a3ccb64b9ad2a554 (diff)
downloadpdfium-bfa9a824a20f37c2dd7111012b46c929cf2ed8a0.tar.xz
Merge to XFA: Use stdint.h types throughout PDFium.
Near-automatic merge, plus re-running scripts to update additional usage. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1172793002
Diffstat (limited to 'core/src/fpdfdoc/doc_vt.cpp')
-rw-r--r--core/src/fpdfdoc/doc_vt.cpp169
1 files changed, 83 insertions, 86 deletions
diff --git a/core/src/fpdfdoc/doc_vt.cpp b/core/src/fpdfdoc/doc_vt.cpp
index fd3f5bafd1..7ed5b4ad3c 100644
--- a/core/src/fpdfdoc/doc_vt.cpp
+++ b/core/src/fpdfdoc/doc_vt.cpp
@@ -7,7 +7,7 @@
#include "../../include/fpdfdoc/fpdf_doc.h"
#include "../../include/fpdfdoc/fpdf_vt.h"
#include "pdf_vt.h"
-const FX_BYTE gFontSizeSteps[] = { 4, 6, 8, 9, 10, 12, 14, 18, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80, 90, 100, 110, 120, 130, 144};
+const uint8_t gFontSizeSteps[] = { 4, 6, 8, 9, 10, 12, 14, 18, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80, 90, 100, 110, 120, 130, 144};
#define PVT_RETURN_LENGTH 1
#define PVT_DEFAULT_FONTSIZE 18.0f
#define PVTWORD_SCRIPT_NORMAL 0
@@ -62,14 +62,14 @@ void CSection::ResetLineArray()
}
void CSection::ResetWordArray()
{
- for (FX_INT32 i = 0, sz = m_WordArray.GetSize(); i < sz; i++) {
+ for (int32_t i = 0, sz = m_WordArray.GetSize(); i < sz; i++) {
delete m_WordArray.GetAt(i);
}
m_WordArray.RemoveAll();
}
void CSection::ResetLinePlace()
{
- for (FX_INT32 i = 0, sz = m_LineArray.GetSize(); i < sz; i++) {
+ for (int32_t i = 0, sz = m_LineArray.GetSize(); i < sz; i++) {
if (CLine * pLine = m_LineArray.GetAt(i)) {
pLine->LinePlace = CPVT_WordPlace(SecPlace.nSecIndex, i, -1);
}
@@ -78,7 +78,7 @@ void CSection::ResetLinePlace()
CPVT_WordPlace CSection::AddWord(const CPVT_WordPlace & place, const CPVT_WordInfo & wordinfo)
{
if (CPVT_WordInfo * pWord = FX_NEW CPVT_WordInfo(wordinfo)) {
- FX_INT32 nWordIndex = FPDF_MAX(FPDF_MIN(place.nWordIndex, this->m_WordArray.GetSize()), 0);
+ int32_t nWordIndex = FPDF_MAX(FPDF_MIN(place.nWordIndex, this->m_WordArray.GetSize()), 0);
if (nWordIndex == m_WordArray.GetSize()) {
m_WordArray.Add(pWord);
} else {
@@ -162,9 +162,9 @@ CPVT_WordPlace CSection::GetNextWordPlace(const CPVT_WordPlace & place) const
}
void CSection::UpdateWordPlace(CPVT_WordPlace & place) const
{
- FX_INT32 nLeft = 0;
- FX_INT32 nRight = m_LineArray.GetSize() - 1;
- FX_INT32 nMid = (nLeft + nRight) / 2;
+ int32_t nLeft = 0;
+ int32_t nRight = m_LineArray.GetSize() - 1;
+ int32_t nMid = (nLeft + nRight) / 2;
while (nLeft <= nRight) {
if (CLine * pLine = m_LineArray.GetAt(nMid)) {
if (place.nWordIndex < pLine->m_LineInfo.nBeginWordIndex) {
@@ -188,9 +188,9 @@ CPVT_WordPlace CSection::SearchWordPlace(const CPDF_Point & point) const
CPVT_WordPlace place = GetBeginWordPlace();
FX_BOOL bUp = TRUE;
FX_BOOL bDown = TRUE;
- FX_INT32 nLeft = 0;
- FX_INT32 nRight = m_LineArray.GetSize() - 1;
- FX_INT32 nMid = m_LineArray.GetSize() / 2;
+ int32_t nLeft = 0;
+ int32_t nRight = m_LineArray.GetSize() - 1;
+ int32_t nMid = m_LineArray.GetSize() / 2;
FX_FLOAT fTop = 0;
FX_FLOAT fBottom = 0;
while (nLeft <= nRight) {
@@ -243,9 +243,9 @@ CPVT_WordPlace CSection::SearchWordPlace(FX_FLOAT fx, const CPVT_WordRange & ran
if (!m_pVT) {
return wordplace;
}
- FX_INT32 nLeft = range.BeginPos.nWordIndex;
- FX_INT32 nRight = range.EndPos.nWordIndex + 1;
- FX_INT32 nMid = (nLeft + nRight) / 2;
+ int32_t nLeft = range.BeginPos.nWordIndex;
+ int32_t nRight = range.EndPos.nWordIndex + 1;
+ int32_t nMid = (nLeft + nRight) / 2;
while (nLeft < nRight) {
if (nMid == nLeft) {
break;
@@ -275,23 +275,23 @@ CPVT_WordPlace CSection::SearchWordPlace(FX_FLOAT fx, const CPVT_WordRange & ran
}
return wordplace;
}
-void CSection::ClearLeftWords(FX_INT32 nWordIndex)
+void CSection::ClearLeftWords(int32_t nWordIndex)
{
- for (FX_INT32 i = nWordIndex; i >= 0; i--) {
+ for (int32_t i = nWordIndex; i >= 0; i--) {
delete m_WordArray.GetAt(i);
m_WordArray.RemoveAt(i);
}
}
-void CSection::ClearRightWords(FX_INT32 nWordIndex)
+void CSection::ClearRightWords(int32_t nWordIndex)
{
- for (FX_INT32 i = m_WordArray.GetSize() - 1; i > nWordIndex; i--) {
+ for (int32_t i = m_WordArray.GetSize() - 1; i > nWordIndex; i--) {
delete m_WordArray.GetAt(i);
m_WordArray.RemoveAt(i);
}
}
-void CSection::ClearMidWords(FX_INT32 nBeginIndex, FX_INT32 nEndIndex)
+void CSection::ClearMidWords(int32_t nBeginIndex, int32_t nEndIndex)
{
- for (FX_INT32 i = nEndIndex; i > nBeginIndex; i--) {
+ for (int32_t i = nEndIndex; i > nBeginIndex; i--) {
delete m_WordArray.GetAt(i);
m_WordArray.RemoveAt(i);
}
@@ -332,7 +332,7 @@ CPVT_FloatRect CTypeset::CharArray()
m_rcRet.Default();
FX_FLOAT x = 0.0f, y = 0.0f;
FX_FLOAT fNextWidth;
- FX_INT32 nStart = 0;
+ int32_t nStart = 0;
FX_FLOAT fNodeWidth = m_pVT->GetPlateWidth() / (m_pVT->m_nCharArray <= 0 ? 1 : m_pVT->m_nCharArray);
if (CLine * pLine = m_pSection->m_LineArray.GetAt(0)) {
x = 0.0f;
@@ -352,7 +352,7 @@ CPVT_FloatRect CTypeset::CharArray()
pLine->m_LineInfo.fLineX = fNodeWidth * nStart - fNodeWidth * PVT_HALF;
break;
}
- for (FX_INT32 w = 0, sz = m_pSection->m_WordArray.GetSize(); w < sz; w++) {
+ for (int32_t w = 0, sz = m_pSection->m_WordArray.GetSize(); w < sz; w++) {
if (w >= m_pVT->m_nCharArray) {
break;
}
@@ -591,23 +591,23 @@ void CTypeset::SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize)
{
ASSERT(m_pVT != NULL);
ASSERT(m_pSection != NULL);
- FX_INT32 nLineHead = 0;
- FX_INT32 nLineTail = 0;
+ int32_t nLineHead = 0;
+ int32_t nLineTail = 0;
FX_FLOAT fMaxX = 0.0f, fMaxY = 0.0f;
FX_FLOAT fLineWidth = 0.0f, fBackupLineWidth = 0.0f;
FX_FLOAT fLineAscent = 0.0f, fBackupLineAscent = 0.0f;
FX_FLOAT fLineDescent = 0.0f, fBackupLineDescent = 0.0f;
- FX_INT32 nWordStartPos = 0;
+ int32_t nWordStartPos = 0;
FX_BOOL bFullWord = FALSE;
- FX_INT32 nLineFullWordIndex = 0;
- FX_INT32 nCharIndex = 0;
+ int32_t nLineFullWordIndex = 0;
+ int32_t nCharIndex = 0;
CPVT_LineInfo line;
FX_FLOAT fWordWidth = 0;
FX_FLOAT fTypesetWidth = FPDF_MAX(m_pVT->GetPlateWidth() - m_pVT->GetLineIndent(m_pSection->m_SecInfo), 0.0f);
- FX_INT32 nTotalWords = m_pSection->m_WordArray.GetSize();
+ int32_t nTotalWords = m_pSection->m_WordArray.GetSize();
FX_BOOL bOpened = FALSE;
if (nTotalWords > 0) {
- FX_INT32 i = 0;
+ int32_t i = 0;
while (i < nTotalWords) {
CPVT_WordInfo * pWord = m_pSection->m_WordArray.GetAt(i);
CPVT_WordInfo* pOldWord = pWord;
@@ -753,10 +753,10 @@ void CTypeset::OutputLines()
fMaxX = fMinX + m_rcRet.Width();
fMinY = 0.0f;
fMaxY = m_rcRet.Height();
- FX_INT32 nTotalLines = m_pSection->m_LineArray.GetSize();
+ int32_t nTotalLines = m_pSection->m_LineArray.GetSize();
if (nTotalLines > 0) {
m_pSection->m_SecInfo.nTotalLine = nTotalLines;
- for (FX_INT32 l = 0; l < nTotalLines; l++) {
+ for (int32_t l = 0; l < nTotalLines; l++) {
if (CLine * pLine = m_pSection->m_LineArray.GetAt(l)) {
switch (m_pVT->GetAlignment(m_pSection->m_SecInfo)) {
default:
@@ -775,7 +775,7 @@ void CTypeset::OutputLines()
fPosY += pLine->m_LineInfo.fLineAscent;
pLine->m_LineInfo.fLineX = fPosX - fMinX;
pLine->m_LineInfo.fLineY = fPosY - fMinY;
- for (FX_INT32 w = pLine->m_LineInfo.nBeginWordIndex; w <= pLine->m_LineInfo.nEndWordIndex; w++) {
+ for (int32_t w = pLine->m_LineInfo.nBeginWordIndex; w <= pLine->m_LineInfo.nEndWordIndex; w++) {
if (CPVT_WordInfo * pWord = m_pSection->m_WordArray.GetAt(w)) {
pWord->fWordX = fPosX - fMinX;
if (pWord->pWordProps) {
@@ -855,10 +855,10 @@ void CPDF_VariableText::ResetAll()
m_bInitial = FALSE;
ResetSectionArray();
}
-CPVT_WordPlace CPDF_VariableText::InsertWord(const CPVT_WordPlace & place, FX_WORD word, FX_INT32 charset,
+CPVT_WordPlace CPDF_VariableText::InsertWord(const CPVT_WordPlace & place, FX_WORD word, int32_t charset,
const CPVT_WordProps * pWordProps)
{
- FX_INT32 nTotlaWords = this->GetTotalWords();
+ int32_t nTotlaWords = this->GetTotalWords();
if (m_nLimitChar > 0 && nTotlaWords >= m_nLimitChar) {
return place;
}
@@ -874,7 +874,7 @@ CPVT_WordPlace CPDF_VariableText::InsertWord(const CPVT_WordPlace & place, FX_WO
return AddWord(newplace, CPVT_WordInfo(word, charset, -1, pNewProps));
}
} else {
- FX_INT32 nFontIndex = GetSubWord() > 0 ? GetDefaultFontIndex() : GetWordFontIndex(word, charset, GetDefaultFontIndex());
+ int32_t nFontIndex = GetSubWord() > 0 ? GetDefaultFontIndex() : GetWordFontIndex(word, charset, GetDefaultFontIndex());
return AddWord(newplace, CPVT_WordInfo(word, charset, nFontIndex, NULL));
}
return place;
@@ -882,7 +882,7 @@ CPVT_WordPlace CPDF_VariableText::InsertWord(const CPVT_WordPlace & place, FX_WO
CPVT_WordPlace CPDF_VariableText::InsertSection(const CPVT_WordPlace & place, const CPVT_SecProps * pSecProps,
const CPVT_WordProps * pWordProps)
{
- FX_INT32 nTotlaWords = this->GetTotalWords();
+ int32_t nTotlaWords = this->GetTotalWords();
if (m_nLimitChar > 0 && nTotlaWords >= m_nLimitChar) {
return place;
}
@@ -909,7 +909,7 @@ CPVT_WordPlace CPDF_VariableText::InsertSection(const CPVT_WordPlace & place, co
AddSection(NewPlace, secinfo);
newplace = NewPlace;
if (CSection * pNewSection = m_SectionArray.GetAt(NewPlace.nSecIndex)) {
- for (FX_INT32 w = wordplace.nWordIndex + 1, sz = pSection->m_WordArray.GetSize(); w < sz; w++) {
+ for (int32_t w = wordplace.nWordIndex + 1, sz = pSection->m_WordArray.GetSize(); w < sz; w++) {
if (CPVT_WordInfo * pWord = pSection->m_WordArray.GetAt(w)) {
NewPlace.nWordIndex++;
pNewSection->AddWord(NewPlace, *pWord);
@@ -920,12 +920,12 @@ CPVT_WordPlace CPDF_VariableText::InsertSection(const CPVT_WordPlace & place, co
}
return newplace;
}
-CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace & place, FX_LPCWSTR text, FX_INT32 charset,
+CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace & place, FX_LPCWSTR text, int32_t charset,
const CPVT_SecProps * pSecProps, const CPVT_WordProps * pProps)
{
CFX_WideString swText = text;
CPVT_WordPlace wp = place;
- for (FX_INT32 i = 0, sz = swText.GetLength(); i < sz; i++) {
+ for (int32_t i = 0, sz = swText.GetLength(); i < sz; i++) {
CPVT_WordPlace oldwp = wp;
FX_WORD word = swText.GetAt(i);
switch (word) {
@@ -980,7 +980,7 @@ CPVT_WordPlace CPDF_VariableText::BackSpaceWord(const CPVT_WordPlace & place)
{
return ClearLeftWord(AjustLineHeader(place, TRUE));
}
-void CPDF_VariableText::SetText(FX_LPCWSTR text, FX_INT32 charset, const CPVT_SecProps * pSecProps,
+void CPDF_VariableText::SetText(FX_LPCWSTR text, int32_t charset, const CPVT_SecProps * pSecProps,
const CPVT_WordProps * pWordProps)
{
DeleteWords(CPVT_WordRange(GetBeginWordPlace(), GetEndWordPlace()));
@@ -998,8 +998,8 @@ void CPDF_VariableText::SetText(FX_LPCWSTR text, FX_INT32 charset, const CPVT_Se
if (CSection * pSection = m_SectionArray.GetAt(0)) {
pSection->m_SecInfo = secinfo;
}
- FX_INT32 nCharCount = 0;
- for (FX_INT32 i = 0, sz = swText.GetLength(); i < sz; i++) {
+ int32_t nCharCount = 0;
+ for (int32_t i = 0, sz = swText.GetLength(); i < sz; i++) {
if (m_nLimitChar > 0 && nCharCount >= m_nLimitChar) {
break;
}
@@ -1052,13 +1052,13 @@ void CPDF_VariableText::UpdateWordPlace(CPVT_WordPlace & place) const
pSection->UpdateWordPlace(place);
}
}
-FX_INT32 CPDF_VariableText::WordPlaceToWordIndex(const CPVT_WordPlace & place) const
+int32_t CPDF_VariableText::WordPlaceToWordIndex(const CPVT_WordPlace & place) const
{
CPVT_WordPlace newplace = place;
UpdateWordPlace(newplace);
- FX_INT32 nIndex = 0;
- FX_INT32 i = 0;
- FX_INT32 sz = 0;
+ int32_t nIndex = 0;
+ int32_t i = 0;
+ int32_t sz = 0;
for (i = 0, sz = m_SectionArray.GetSize(); i < sz && i < newplace.nSecIndex; i++) {
if (CSection * pSection = m_SectionArray.GetAt(i)) {
nIndex += pSection->m_WordArray.GetSize();
@@ -1072,12 +1072,12 @@ FX_INT32 CPDF_VariableText::WordPlaceToWordIndex(const CPVT_WordPlace & place) c
}
return nIndex;
}
-CPVT_WordPlace CPDF_VariableText::WordIndexToWordPlace(FX_INT32 index) const
+CPVT_WordPlace CPDF_VariableText::WordIndexToWordPlace(int32_t index) const
{
CPVT_WordPlace place = GetBeginWordPlace();
- FX_INT32 nOldIndex = 0 , nIndex = 0;
+ int32_t nOldIndex = 0 , nIndex = 0;
FX_BOOL bFind = FALSE;
- for (FX_INT32 i = 0, sz = m_SectionArray.GetSize(); i < sz; i++) {
+ for (int32_t i = 0, sz = m_SectionArray.GetSize(); i < sz; i++) {
if (CSection * pSection = m_SectionArray.GetAt(i)) {
nIndex += pSection->m_WordArray.GetSize();
if (nIndex == index) {
@@ -1159,9 +1159,9 @@ CPVT_WordPlace CPDF_VariableText::SearchWordPlace(const CPDF_Point & point) cons
{
CPDF_Point pt = OutToIn(point);
CPVT_WordPlace place = GetBeginWordPlace();
- FX_INT32 nLeft = 0;
- FX_INT32 nRight = m_SectionArray.GetSize() - 1;
- FX_INT32 nMid = m_SectionArray.GetSize() / 2;
+ int32_t nLeft = 0;
+ int32_t nRight = m_SectionArray.GetSize() - 1;
+ int32_t nMid = m_SectionArray.GetSize() / 2;
FX_BOOL bUp = TRUE;
FX_BOOL bDown = TRUE;
while (nLeft <= nRight) {
@@ -1258,10 +1258,10 @@ CPVT_WordPlace CPDF_VariableText::GetSectionEndPlace(const CPVT_WordPlace & plac
}
return place;
}
-FX_INT32 CPDF_VariableText::GetTotalWords() const
+int32_t CPDF_VariableText::GetTotalWords() const
{
- FX_INT32 nTotal = 0;
- for (FX_INT32 i = 0, sz = m_SectionArray.GetSize(); i < sz; i++)
+ int32_t nTotal = 0;
+ for (int32_t i = 0, sz = m_SectionArray.GetSize(); i < sz; i++)
if (CSection * pSection = m_SectionArray.GetAt(i)) {
nTotal += (pSection->m_WordArray.GetSize() + PVT_RETURN_LENGTH);
}
@@ -1269,7 +1269,7 @@ FX_INT32 CPDF_VariableText::GetTotalWords() const
}
void CPDF_VariableText::ResetSectionArray()
{
- for (FX_INT32 s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) {
+ for (int32_t s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) {
delete m_SectionArray.GetAt(s);
}
m_SectionArray.RemoveAll();
@@ -1279,11 +1279,8 @@ CPVT_WordPlace CPDF_VariableText::AddSection(const CPVT_WordPlace & place, const
if (IsValid() && !m_bMultiLine) {
return place;
}
- FX_INT32 nSecIndex = FPDF_MAX(FPDF_MIN(place.nSecIndex, m_SectionArray.GetSize()), 0);
- CSection * pSection = FX_NEW CSection(this);
- if (!pSection) {
- return place;
- }
+ int32_t nSecIndex = FPDF_MAX(FPDF_MIN(place.nSecIndex, m_SectionArray.GetSize()), 0);
+ CSection* pSection = new CSection(this);
pSection->m_SecInfo = secinfo;
pSection->SecPlace.nSecIndex = nSecIndex;
if (nSecIndex == m_SectionArray.GetSize()) {
@@ -1361,13 +1358,13 @@ FX_FLOAT CPDF_VariableText::GetWordFontSize(const CPVT_WordInfo & WordInfo, FX_B
{
return m_bRichText && WordInfo.pWordProps ? (WordInfo.pWordProps->nScriptType == PVTWORD_SCRIPT_NORMAL || bFactFontSize ? WordInfo.pWordProps->fFontSize : WordInfo.pWordProps->fFontSize * PVT_HALF) : GetFontSize();
}
-FX_INT32 CPDF_VariableText::GetWordFontIndex(const CPVT_WordInfo & WordInfo)
+int32_t CPDF_VariableText::GetWordFontIndex(const CPVT_WordInfo & WordInfo)
{
return m_bRichText && WordInfo.pWordProps ? WordInfo.pWordProps->nFontIndex : WordInfo.nFontIndex;
}
-FX_FLOAT CPDF_VariableText::GetWordWidth(FX_INT32 nFontIndex, FX_WORD Word, FX_WORD SubWord,
- FX_FLOAT fCharSpace, FX_INT32 nHorzScale,
- FX_FLOAT fFontSize, FX_FLOAT fWordTail, FX_INT32 nWordStyle)
+FX_FLOAT CPDF_VariableText::GetWordWidth(int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord,
+ FX_FLOAT fCharSpace, int32_t nHorzScale,
+ FX_FLOAT fFontSize, FX_FLOAT fWordTail, int32_t nWordStyle)
{
return (GetCharWidth(nFontIndex, Word, SubWord, nWordStyle) * fFontSize * PVT_FONTSCALE + fCharSpace) * nHorzScale * PVT_PERCENT + fWordTail;
}
@@ -1387,11 +1384,11 @@ FX_FLOAT CPDF_VariableText::GetLineDescent(const CPVT_SectionInfo & SecInfo)
return m_bRichText && SecInfo.pWordProps ? GetFontDescent(SecInfo.pWordProps->nFontIndex, SecInfo.pWordProps->fFontSize) :
GetFontDescent(GetDefaultFontIndex(), GetFontSize());
}
-FX_FLOAT CPDF_VariableText::GetFontAscent(FX_INT32 nFontIndex, FX_FLOAT fFontSize)
+FX_FLOAT CPDF_VariableText::GetFontAscent(int32_t nFontIndex, FX_FLOAT fFontSize)
{
return (FX_FLOAT)GetTypeAscent(nFontIndex) * fFontSize * PVT_FONTSCALE;
}
-FX_FLOAT CPDF_VariableText::GetFontDescent(FX_INT32 nFontIndex, FX_FLOAT fFontSize)
+FX_FLOAT CPDF_VariableText::GetFontDescent(int32_t nFontIndex, FX_FLOAT fFontSize)
{
return (FX_FLOAT)GetTypeDescent(nFontIndex) * fFontSize * PVT_FONTSCALE;
}
@@ -1419,7 +1416,7 @@ FX_FLOAT CPDF_VariableText::GetLineIndent(const CPVT_SectionInfo & SecInfo)
{
return m_bRichText && SecInfo.pSecProps ? SecInfo.pSecProps->fLineIndent : 0.0f;
}
-FX_INT32 CPDF_VariableText::GetAlignment(const CPVT_SectionInfo& SecInfo)
+int32_t CPDF_VariableText::GetAlignment(const CPVT_SectionInfo& SecInfo)
{
return m_bRichText && SecInfo.pSecProps ? SecInfo.pSecProps->nAlignment : this->m_nAlignment;
}
@@ -1427,7 +1424,7 @@ FX_FLOAT CPDF_VariableText::GetCharSpace(const CPVT_WordInfo & WordInfo)
{
return m_bRichText && WordInfo.pWordProps ? WordInfo.pWordProps->fCharSpace : m_fCharSpace;
}
-FX_INT32 CPDF_VariableText::GetHorzScale(const CPVT_WordInfo & WordInfo)
+int32_t CPDF_VariableText::GetHorzScale(const CPVT_WordInfo & WordInfo)
{
return m_bRichText && WordInfo.pWordProps ? WordInfo.pWordProps->nHorzScale : m_nHorzScale;
}
@@ -1435,7 +1432,7 @@ void CPDF_VariableText::ClearSectionRightWords(const CPVT_WordPlace & place)
{
CPVT_WordPlace wordplace = AjustLineHeader(place, TRUE);
if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) {
- for (FX_INT32 w = pSection->m_WordArray.GetSize() - 1; w > wordplace.nWordIndex; w--) {
+ for (int32_t w = pSection->m_WordArray.GetSize() - 1; w > wordplace.nWordIndex; w--) {
delete pSection->m_WordArray.GetAt(w);
pSection->m_WordArray.RemoveAt(w);
}
@@ -1469,7 +1466,7 @@ FX_BOOL CPDF_VariableText::ClearEmptySection(const CPVT_WordPlace & place)
void CPDF_VariableText::ClearEmptySections(const CPVT_WordRange & PlaceRange)
{
CPVT_WordPlace wordplace;
- for (FX_INT32 s = PlaceRange.EndPos.nSecIndex; s > PlaceRange.BeginPos.nSecIndex; s--) {
+ for (int32_t s = PlaceRange.EndPos.nSecIndex; s > PlaceRange.BeginPos.nSecIndex; s--) {
wordplace.nSecIndex = s;
ClearEmptySection(wordplace);
}
@@ -1479,7 +1476,7 @@ void CPDF_VariableText::LinkLatterSection(const CPVT_WordPlace & place)
CPVT_WordPlace oldplace = AjustLineHeader(place, TRUE);
if (CSection * pNextSection = m_SectionArray.GetAt(place.nSecIndex + 1)) {
if (CSection * pSection = m_SectionArray.GetAt(oldplace.nSecIndex)) {
- for (FX_INT32 w = 0, sz = pNextSection->m_WordArray.GetSize(); w < sz; w++) {
+ for (int32_t w = 0, sz = pNextSection->m_WordArray.GetSize(); w < sz; w++) {
if (CPVT_WordInfo * pWord = pNextSection->m_WordArray.GetAt(w)) {
oldplace.nWordIndex ++;
pSection->AddWord(oldplace, *pWord);
@@ -1495,7 +1492,7 @@ void CPDF_VariableText::ClearWords(const CPVT_WordRange & PlaceRange)
CPVT_WordRange NewRange;
NewRange.BeginPos = AjustLineHeader(PlaceRange.BeginPos, TRUE);
NewRange.EndPos = AjustLineHeader(PlaceRange.EndPos, TRUE);
- for (FX_INT32 s = NewRange.EndPos.nSecIndex; s >= NewRange.BeginPos.nSecIndex; s--) {
+ for (int32_t s = NewRange.EndPos.nSecIndex; s >= NewRange.BeginPos.nSecIndex; s--) {
if (CSection * pSection = m_SectionArray.GetAt(s)) {
pSection->ClearWords(NewRange);
}
@@ -1558,7 +1555,7 @@ CPVT_FloatRect CPDF_VariableText::Rearrange(const CPVT_WordRange & PlaceRange)
}
FX_FLOAT CPDF_VariableText::GetAutoFontSize()
{
- FX_INT32 nTotal = sizeof(gFontSizeSteps) / sizeof(FX_BYTE);
+ int32_t nTotal = sizeof(gFontSizeSteps) / sizeof(uint8_t);
if (IsMultiLine()) {
nTotal /= 4;
}
@@ -1568,9 +1565,9 @@ FX_FLOAT CPDF_VariableText::GetAutoFontSize()
if (GetPlateWidth() <= 0) {
return 0;
}
- FX_INT32 nLeft = 0;
- FX_INT32 nRight = nTotal - 1;
- FX_INT32 nMid = nTotal / 2;
+ int32_t nLeft = 0;
+ int32_t nRight = nTotal - 1;
+ int32_t nMid = nTotal / 2;
while (nLeft <= nRight) {
if (IsBigger(gFontSizeSteps[nMid])) {
nRight = nMid - 1;
@@ -1588,7 +1585,7 @@ FX_BOOL CPDF_VariableText::IsBigger(FX_FLOAT fFontSize)
{
FX_BOOL bBigger = FALSE;
CPVT_Size szTotal;
- for (FX_INT32 s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) {
+ for (int32_t s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) {
if (CSection * pSection = m_SectionArray.GetAt(s)) {
CPVT_Size size = pSection->GetSectionSize(fFontSize);
szTotal.x = FPDF_MAX(size.x, szTotal.x);
@@ -1608,10 +1605,10 @@ CPVT_FloatRect CPDF_VariableText::RearrangeSections(const CPVT_WordRange & Place
CPVT_WordPlace place;
FX_FLOAT fPosY = 0;
FX_FLOAT fOldHeight;
- FX_INT32 nSSecIndex = PlaceRange.BeginPos.nSecIndex;
- FX_INT32 nESecIndex = PlaceRange.EndPos.nSecIndex;
+ int32_t nSSecIndex = PlaceRange.BeginPos.nSecIndex;
+ int32_t nESecIndex = PlaceRange.EndPos.nSecIndex;
CPVT_FloatRect rcRet;
- for (FX_INT32 s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) {
+ for (int32_t s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) {
place.nSecIndex = s;
if (CSection * pSection = m_SectionArray.GetAt(s)) {
pSection->SecPlace = place;
@@ -1642,7 +1639,7 @@ CPVT_FloatRect CPDF_VariableText::RearrangeSections(const CPVT_WordRange & Place
}
return rcRet;
}
-FX_INT32 CPDF_VariableText::GetCharWidth(FX_INT32 nFontIndex, FX_WORD Word, FX_WORD SubWord, FX_INT32 nWordStyle)
+int32_t CPDF_VariableText::GetCharWidth(int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord, int32_t nWordStyle)
{
if (m_pVTProvider) {
if (SubWord > 0) {
@@ -1653,19 +1650,19 @@ FX_INT32 CPDF_VariableText::GetCharWidth(FX_INT32 nFontIndex, FX_WORD Word, FX_W
}
return 0;
}
-FX_INT32 CPDF_VariableText::GetTypeAscent(FX_INT32 nFontIndex)
+int32_t CPDF_VariableText::GetTypeAscent(int32_t nFontIndex)
{
return m_pVTProvider ? m_pVTProvider->GetTypeAscent(nFontIndex) : 0;
}
-FX_INT32 CPDF_VariableText::GetTypeDescent(FX_INT32 nFontIndex)
+int32_t CPDF_VariableText::GetTypeDescent(int32_t nFontIndex)
{
return m_pVTProvider ? m_pVTProvider->GetTypeDescent(nFontIndex) : 0;
}
-FX_INT32 CPDF_VariableText::GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex)
+int32_t CPDF_VariableText::GetWordFontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex)
{
return m_pVTProvider ? m_pVTProvider->GetWordFontIndex(word, charset, nFontIndex) : -1;
}
-FX_INT32 CPDF_VariableText::GetDefaultFontIndex()
+int32_t CPDF_VariableText::GetDefaultFontIndex()
{
return m_pVTProvider ? m_pVTProvider->GetDefaultFontIndex() : -1;
}
@@ -1694,7 +1691,7 @@ CPDF_VariableText_Iterator::CPDF_VariableText_Iterator(CPDF_VariableText * pVT):
CPDF_VariableText_Iterator::~CPDF_VariableText_Iterator()
{
}
-void CPDF_VariableText_Iterator::SetAt(FX_INT32 nWordIndex)
+void CPDF_VariableText_Iterator::SetAt(int32_t nWordIndex)
{
ASSERT(m_pVT != NULL);
m_CurPos = m_pVT->WordIndexToWordPlace(nWordIndex);