本文整理汇总了C++中UIntVector::front方法的典型用法代码示例。如果您正苦于以下问题:C++ UIntVector::front方法的具体用法?C++ UIntVector::front怎么用?C++ UIntVector::front使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIntVector
的用法示例。
在下文中一共展示了UIntVector::front方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateCFFSubset
EStatusCode CFFEmbeddedFontWriter::CreateCFFSubset(
FreeTypeFaceWrapper& inFontInfo,
const UIntVector& inSubsetGlyphIDs,
UShortVector* inCIDMapping,
const std::string& inSubsetFontName,
bool& outNotEmbedded,
MyStringBuf& outFontProgram)
{
EStatusCode status;
do
{
status = mOpenTypeFile.OpenFile(inFontInfo.GetFontFilePath());
if(status != PDFHummus::eSuccess)
{
TRACE_LOG1("CFFEmbeddedFontWriter::CreateCFFSubset, cannot open type font file at %s",inFontInfo.GetFontFilePath().c_str());
break;
}
status = mOpenTypeInput.ReadOpenTypeFile(mOpenTypeFile.GetInputStream(),(unsigned short)inFontInfo.GetFontIndex());
if(status != PDFHummus::eSuccess)
{
TRACE_LOG("CFFEmbeddedFontWriter::CreateCFFSubset, failed to read true type file");
break;
}
if(mOpenTypeInput.GetOpenTypeFontType() != EOpenTypeCFF)
{
TRACE_LOG("CFFEmbeddedFontWriter::CreateCFFSubset, font file is not CFF, so there is an exceptions here. expecting CFFs only");
break;
}
// see if font may be embedded
if(mOpenTypeInput.mOS2Exists && !FSType(mOpenTypeInput.mOS2.fsType).CanEmbed())
{
outNotEmbedded = true;
return PDFHummus::eSuccess;
}
else
outNotEmbedded = false;
UIntVector subsetGlyphIDs = inSubsetGlyphIDs;
if(subsetGlyphIDs.front() != 0) // make sure 0 glyph is in
subsetGlyphIDs.insert(subsetGlyphIDs.begin(),0);
status = AddDependentGlyphs(subsetGlyphIDs);
if(status != PDFHummus::eSuccess)
{
TRACE_LOG("CFFEmbeddedFontWriter::CreateCFFSubset, failed to add dependent glyphs");
break;
}
mIsCID = mOpenTypeInput.mCFF.mTopDictIndex[0].mTopDict.find(scROS) !=
mOpenTypeInput.mCFF.mTopDictIndex[0].mTopDict.end();
mFontFileStream.Assign(&outFontProgram);
mPrimitivesWriter.SetStream(&mFontFileStream);
status = WriteCFFHeader();
if(status != PDFHummus::eSuccess)
{
TRACE_LOG("CFFEmbeddedFontWriter::CreateCFFSubset, failed to write CFF header");
break;
}
status = WriteName(inSubsetFontName);
if(status != PDFHummus::eSuccess)
{
TRACE_LOG("CFFEmbeddedFontWriter::CreateCFFSubset, failed to write CFF Name");
break;
}
status = WriteTopIndex();
if(status != PDFHummus::eSuccess)
{
TRACE_LOG("CFFEmbeddedFontWriter::CreateCFFSubset, failed to write Top Index");
break;
}
status = WriteStringIndex();
if(status != PDFHummus::eSuccess)
{
TRACE_LOG("CFFEmbeddedFontWriter::CreateCFFSubset, failed to write String Index");
break;
}
status = WriteGlobalSubrsIndex();
if(status != PDFHummus::eSuccess)
{
TRACE_LOG("CFFEmbeddedFontWriter::CreateCFFSubset, failed to write global subrs index");
break;
}
status = WriteEncodings(inSubsetGlyphIDs);
if(status != PDFHummus::eSuccess)
{
TRACE_LOG("CFFEmbeddedFontWriter::CreateCFFSubset, failed to write encodings");
break;
}
//.........这里部分代码省略.........
示例2: AddDependentGlyphs
EStatusCode Type1ToCFFEmbeddedFontWriter::CreateCFFSubset(
FreeTypeFaceWrapper& inFontInfo,
const UIntVector& inSubsetGlyphIDs,
const std::string& inSubsetFontName,
bool& outNotEmbedded,
MyStringBuf& outFontProgram)
{
EStatusCode status;
do
{
UIntVector subsetGlyphIDs = inSubsetGlyphIDs;
StringVector subsetGlyphNames;
if(subsetGlyphIDs.front() != 0) // make sure 0 glyph is in
subsetGlyphIDs.insert(subsetGlyphIDs.begin(),0);
status = mType1File.OpenFile(inFontInfo.GetFontFilePath());
if(status != PDFHummus::eSuccess)
{
TRACE_LOG1("Type1ToCFFEmbeddedFontWriter::CreateCFFSubset, cannot open Type 1 font file at %s",inFontInfo.GetFontFilePath().c_str());
break;
}
status = mType1Input.ReadType1File(mType1File.GetInputStream());
if(status != PDFHummus::eSuccess)
{
TRACE_LOG("Type1ToCFFEmbeddedFontWriter::CreateCFFSubset, failed to read Type 1 file");
break;
}
// see if font may be embedded
if(mType1Input.mFontDictionary.FSTypeValid || mType1Input.mFontInfoDictionary.FSTypeValid)
{
if(!FSType(
mType1Input.mFontInfoDictionary.FSTypeValid ?
mType1Input.mFontInfoDictionary.fsType :
mType1Input.mFontDictionary.fsType).CanEmbed())
{
outNotEmbedded = true;
return PDFHummus::eSuccess;
}
else
outNotEmbedded = false;
}
else
outNotEmbedded = false;
// Found big gap between FreeType indexing and the way it's in the Type 1. obvioulsy due to encoding differences.
// So i'm replacing the indexes of free type, with names...should be safer (also cleans up invalid glyph ids, in case
// direct glyphs placement put them here)
TranslateFromFreeTypeToType1(inFontInfo,subsetGlyphIDs,subsetGlyphNames);
status = AddDependentGlyphs(subsetGlyphNames);
if(status != PDFHummus::eSuccess)
{
TRACE_LOG("Type1ToCFFEmbeddedFontWriter::CreateCFFSubset, failed to add dependent glyphs");
break;
}
mFontFileStream.Assign(&outFontProgram);
mPrimitivesWriter.SetStream(&mFontFileStream);
status = WriteCFFHeader();
if(status != PDFHummus::eSuccess)
{
TRACE_LOG("Type1ToCFFEmbeddedFontWriter::CreateCFFSubset, failed to write CFF header");
break;
}
status = WriteName(inSubsetFontName);
if(status != PDFHummus::eSuccess)
{
TRACE_LOG("Type1ToCFFEmbeddedFontWriter::CreateCFFSubset, failed to write CFF Name");
break;
}
status = WriteTopIndex();
if(status != PDFHummus::eSuccess)
{
TRACE_LOG("Type1ToCFFEmbeddedFontWriter::CreateCFFSubset, failed to write Top Index");
break;
}
// prepraring charset happens here, so that any added strings to the string index will happen...before
// the index is written
PrepareCharSetArray(subsetGlyphNames);
status = WriteStringIndex();
if(status != PDFHummus::eSuccess)
{
TRACE_LOG("Type1ToCFFEmbeddedFontWriter::CreateCFFSubset, failed to write String Index");
break;
}
status = WriteGlobalSubrsIndex();
if(status != PDFHummus::eSuccess)
{
TRACE_LOG("Type1ToCFFEmbeddedFontWriter::CreateCFFSubset, failed to write global subrs index");
//.........这里部分代码省略.........