EStatusCode Type1ToType2Converter::WriteConvertedFontProgram(const string& inGlyphName, Type1Input* inType1Input, IByteWriter* inByteWriter) { EStatusCode status; do { CharStringType1Interpreter interpreter; mHelper = inType1Input; mHintReplacementEncountered = false; mHintAdditionEncountered = false; mFirstPathConstructionEncountered = false; mInFlexCollectionMode = false; mCurrentHints.clear(); mFlexParameters.clear(); Type1CharString* charString = inType1Input->GetGlyphCharString(inGlyphName); if(!charString) { TRACE_LOG1("Type1ToType2Converter::WriteConvertedFontProgram, Exception, cannot find glyph name %s",inGlyphName.c_str()); status = PDFHummus::eFailure; break; } status = interpreter.Intepret(*charString,this); if(status != PDFHummus::eSuccess) { TRACE_LOG("Type1ToType2Converter::WriteConvertedFontProgram, Exception, failed to interpret glyph"); break; } // convert stem commands - put them at the beginning, and use hint masks if required ConvertStems(); // convert operators to the type 2 short writing, dropping 0's, and set the first moveto // to offset by sidebearing ConvertPathConsturction(); // need to place width of character at the first stack clearing operator AddInitialWidthParameter(); status = WriteProgramToStream(inByteWriter); if(status != PDFHummus::eSuccess) { TRACE_LOG("Type1ToType2Converter::WriteConvertedFontProgram, Exception, can't write program to target stream"); break; } }while(false); mVStems.clear(); mHStems.clear(); mConversionProgram.clear(); return status; }
EStatusCode Type1Input::CalculateDependenciesForCharIndex(const std::string& inCharStringName, CharString1Dependencies& ioDependenciesInfo) { CharStringType1Interpreter interpreter; StringToType1CharStringMap::iterator it = mCharStrings.find(inCharStringName); if(it == mCharStrings.end()) { TRACE_LOG("Type1Input::CalculateDependenciesForCharIndex, Exception, cannot find glyph from name"); return PDFHummus::eFailure; } mCurrentDependencies = &ioDependenciesInfo; EStatusCode status = interpreter.Intepret(it->second,this); mCurrentDependencies = NULL; return status; }
EStatusCode Type1Input::CalculateDependenciesForCharIndex( Byte inCharStringIndex, CharString1Dependencies& ioDependenciesInfo) { CharStringType1Interpreter interpreter; Type1CharString* charString = GetGlyphCharString(inCharStringIndex); if(!charString) { TRACE_LOG("Type1Input::CalculateDependenciesForCharIndex, Exception, cannot find glyph index"); return PDFHummus::eFailure; } mCurrentDependencies = &ioDependenciesInfo; EStatusCode status = interpreter.Intepret(*charString,this); mCurrentDependencies = NULL; return status; }