本文整理汇总了C++中PdfArray::back方法的典型用法代码示例。如果您正苦于以下问题:C++ PdfArray::back方法的具体用法?C++ PdfArray::back怎么用?C++ PdfArray::back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PdfArray
的用法示例。
在下文中一共展示了PdfArray::back方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateWidth
void PdfFontCID::CreateWidth( PdfObject* pFontDict ) const
{
const int cAbsoluteMax = 0xffff;
int nFirstChar = m_pEncoding->GetFirstChar();
int nLastChar = m_pEncoding->GetLastChar();
int i;
// Allocate an initialize an array, large enough to
// hold a width value for every possible glyph index
double* pdWidth = static_cast<double*>(malloc( sizeof(double) * cAbsoluteMax ) );
if( !pdWidth )
{
PODOFO_RAISE_ERROR( ePdfError_OutOfMemory );
}
for( i=0;i<cAbsoluteMax;i++ )
pdWidth[i] = 0.0;
// Load the width of all requested glyph indeces
int nMin = 0xffff;
int nMax = 0;
long lGlyph = 0;
for( i=nFirstChar;i<=nLastChar;i++ )
{
lGlyph = m_pMetrics->GetGlyphId( i );
if( lGlyph )
{
nMin = PDF_MIN( static_cast<long>(nMin), lGlyph );
nMax = PDF_MAX( static_cast<long>(nMax), lGlyph );
nMax = PDF_MIN( nMax, cAbsoluteMax );
if( lGlyph < cAbsoluteMax )
pdWidth[lGlyph] = m_pMetrics->GetGlyphWidth( lGlyph );
}
}
if (nMax >= nMin) {
// Now compact the array
std::ostringstream oss;
PdfArray array;
array.reserve( nMax - nMin + 1 );
i = nMin;
double dCurWidth = pdWidth[i];
pdf_int64 lCurIndex = i++;
pdf_int64 lCurLength = 1L;
for( ;i<=nMax;i++ )
{
if( static_cast<int>(pdWidth[i] - dCurWidth) == 0 )
++lCurLength;
else
{
if( lCurLength > 1 )
{
array.push_back( lCurIndex );
pdf_int64 temp = lCurIndex + lCurLength - 1;
array.push_back( temp );
array.push_back( dCurWidth );
}
else
{
if( array.size() && array.back().IsArray() )
{
array.back().GetArray().push_back( dCurWidth );
}
else
{
PdfArray tmp;
tmp.push_back( dCurWidth );
array.push_back( lCurIndex );
array.push_back( tmp );
}
}
lCurIndex = i;
lCurLength = 1L;
dCurWidth = pdWidth[i];
}
}
if (array.size() == 0)
{
array.push_back( lCurIndex = nMin );
array.push_back( lCurIndex = nMax );
array.push_back( dCurWidth );
}
pFontDict->GetDictionary().AddKey( PdfName("W"), array );
}
free( pdWidth );
}