main/vcl/source/fontsubset/cff.cxx
/** Read DICT operator at mpReadPtr.
 *
 * Sets the attributes of CffSubsetterContext::mpCffLocal
 */
Read DICT operator at mpReadPtr.
Read DICT operator at mpReadPtr .
void CffSubsetterContext::readDictOp( void)
{
	ValType nVal = 0;
	int nInt = 0;
	const U8 c = *mpReadPtr;
	if( c <= 21 ) { 
		int nOpId = *(mpReadPtr++);
		const char* pCmdName;
		if( nOpId != 12)
			pCmdName = pDictOps[ nOpId];
		else { 
			const U8 nExtId = *(mpReadPtr++);
			pCmdName = pDictEscs[ nExtId];
			nOpId = 900 + nExtId;
		}
		switch( *pCmdName) {
		default: fprintf( stderr, "unsupported DictOp.type=\'%c\'\n", *pCmdName); break;
		case 'b':	
			nInt = popInt();
			switch( nOpId) {
			case 915: mpCffLocal->mbForceBold = nInt; break;    
			default: break; 
			}
			break;
		case 'n':	
			nVal = popVal();
			nInt = static_cast<int>(nVal);
			switch( nOpId) {
			case  10: mpCffLocal->maStemStdHW = nVal; break; 	
			case  11: mpCffLocal->maStemStdVW = nVal; break; 	
			case  15: mnCharsetBase = nInt; break;				
			case  16: mnEncodingBase = nInt; break;				
			case  17: mnCharStrBase = nInt; break;				
			case  19: mpCffLocal->mnLocalSubrOffs = nInt; break;
			case  20: setDefaultWidth( nVal ); break;			
			case  21: setNominalWidth( nVal ); break;			
			case 909: mpCffLocal->mfBlueScale = nVal; break; 	
			case 910: mpCffLocal->mfBlueShift = nVal; break; 	
			case 911: mpCffLocal->mfBlueFuzz = nVal; break; 	
			case 912: mpCffLocal->mfExpFactor = nVal; break;	
			case 917: mpCffLocal->mnLangGroup = nInt; break;	
			case 936: mnFontDictBase = nInt; break;				
			case 937: mnFDSelectBase = nInt; break;				
			default: break; 
			}
			break;
		case 'a': {	
			switch( nOpId) {
			case   5: maFontBBox.clear(); break;     
			case 907: maFontMatrix.clear(); break; 
			default: break; 
			}
			for( int i = 0; i < size(); ++i ) {
				nVal = getVal(i);
				switch( nOpId) {
				case   5: maFontBBox.push_back( nVal); break;     
				case 907: maFontMatrix.push_back( nVal); break; 
				default: break; 
				}
			}
			clear();
			} break;
		case 'd': {	
			nVal = 0;
			for( int i = 0; i < size(); ++i ) {
				nVal += getVal(i);
				switch( nOpId) {
				case   6: mpCffLocal->maBlueValues.push_back( nVal); break;		
				case   7: mpCffLocal->maOtherBlues.push_back( nVal); break;		
				case   8: mpCffLocal->maFamilyBlues.push_back( nVal); break;	
				case   9: mpCffLocal->maFamilyOtherBlues.push_back( nVal); break;
				case 912: mpCffLocal->maStemSnapH.push_back( nVal); break;		
				case 913: mpCffLocal->maStemSnapV.push_back( nVal); break;		
				default: break; 
				}
			}
			clear();
			} break;
		case 's':	
			nInt = popInt();
			switch( nOpId ) {
			case   2: mnFullNameSID = nInt; break;		
			case   3: mnFamilyNameSID = nInt; break;	
			case 938: mnFontNameSID = nInt; break;		
			default: break; 
			}
			break;
		case 'P': 	
			mpCffLocal->mnPrivDictBase = popInt();
			mpCffLocal->mnPrivDictSize = popInt();
			break;
		case 'r': {	
			int nSid1 = popInt();
			int nSid2 = popInt();
			(void)nSid1; 
			(void)nSid2; 
			nVal = popVal();
			mbCIDFont = true;
			} break;
		case 't':	
			nInt = popInt();
			setCharStringType( nInt );
			break;
		}
		return; 
	} else if( (c >= 32) || (c == 28) ) {
		read2push();
	} else if( c == 29 ) { 
		++mpReadPtr;			
		int nS32 = mpReadPtr[0] << 24;
		nS32 += mpReadPtr[1] << 16;
		nS32 += mpReadPtr[2] << 8;
		nS32 += mpReadPtr[3] << 0;
		if( (sizeof(nS32) != 4) && (nS32 & (1<<31)))
			nS32 |= (~0U) << 31;	
		mpReadPtr += 4;
		nVal = static_cast<ValType>(nS32);
		push( nVal );
	} else if( c == 30) { 
		++mpReadPtr; 
		const RealType fReal = readRealVal();
		nVal = fReal;
		push( nVal);
	}
}
void CffSubsetterContext :: readDictOp ( void ) { ValType nVal = 0 ; int nInt = 0 ; const U8 c = * mpReadPtr ; if ( c <= 21 ) { int nOpId = * ( mpReadPtr ++ ) ; const char * pCmdName ; if ( nOpId != 12 ) pCmdName = pDictOps [ nOpId ] ; else { const U8 nExtId = * ( mpReadPtr ++ ) ; pCmdName = pDictEscs [ nExtId ] ; nOpId = 900 + nExtId ; } switch ( * pCmdName ) { default : fprintf ( stderr , " \' \' \n " , * pCmdName ) ; break ; case ' ' : nInt = popInt ( ) ; switch ( nOpId ) { case 915 : mpCffLocal -> mbForceBold = nInt ; break ; default : break ; } break ; case ' ' : nVal = popVal ( ) ; nInt = static_cast < int > ( nVal ) ; switch ( nOpId ) { case 10 : mpCffLocal -> maStemStdHW = nVal ; break ; case 11 : mpCffLocal -> maStemStdVW = nVal ; break ; case 15 : mnCharsetBase = nInt ; break ; case 16 : mnEncodingBase = nInt ; break ; case 17 : mnCharStrBase = nInt ; break ; case 19 : mpCffLocal -> mnLocalSubrOffs = nInt ; break ; case 20 : setDefaultWidth ( nVal ) ; break ; case 21 : setNominalWidth ( nVal ) ; break ; case 909 : mpCffLocal -> mfBlueScale = nVal ; break ; case 910 : mpCffLocal -> mfBlueShift = nVal ; break ; case 911 : mpCffLocal -> mfBlueFuzz = nVal ; break ; case 912 : mpCffLocal -> mfExpFactor = nVal ; break ; case 917 : mpCffLocal -> mnLangGroup = nInt ; break ; case 936 : mnFontDictBase = nInt ; break ; case 937 : mnFDSelectBase = nInt ; break ; default : break ; } break ; case ' ' : { switch ( nOpId ) { case 5 : maFontBBox . clear ( ) ; break ; case 907 : maFontMatrix . clear ( ) ; break ; default : break ; } for ( int i = 0 ; i < size ( ) ; ++ i ) { nVal = getVal ( i ) ; switch ( nOpId ) { case 5 : maFontBBox . push_back ( nVal ) ; break ; case 907 : maFontMatrix . push_back ( nVal ) ; break ; default : break ; } } clear ( ) ; } break ; case ' ' : { nVal = 0 ; for ( int i = 0 ; i < size ( ) ; ++ i ) { nVal += getVal ( i ) ; switch ( nOpId ) { case 6 : mpCffLocal -> maBlueValues . push_back ( nVal ) ; break ; case 7 : mpCffLocal -> maOtherBlues . push_back ( nVal ) ; break ; case 8 : mpCffLocal -> maFamilyBlues . push_back ( nVal ) ; break ; case 9 : mpCffLocal -> maFamilyOtherBlues . push_back ( nVal ) ; break ; case 912 : mpCffLocal -> maStemSnapH . push_back ( nVal ) ; break ; case 913 : mpCffLocal -> maStemSnapV . push_back ( nVal ) ; break ; default : break ; } } clear ( ) ; } break ; case ' ' : nInt = popInt ( ) ; switch ( nOpId ) { case 2 : mnFullNameSID = nInt ; break ; case 3 : mnFamilyNameSID = nInt ; break ; case 938 : mnFontNameSID = nInt ; break ; default : break ; } break ; case ' ' : mpCffLocal -> mnPrivDictBase = popInt ( ) ; mpCffLocal -> mnPrivDictSize = popInt ( ) ; break ; case ' ' : { int nSid1 = popInt ( ) ; int nSid2 = popInt ( ) ; ( void ) nSid1 ; ( void ) nSid2 ; nVal = popVal ( ) ; mbCIDFont = true ; } break ; case ' ' : nInt = popInt ( ) ; setCharStringType ( nInt ) ; break ; } return ; } else if ( ( c >= 32 ) || ( c == 28 ) ) { read2push ( ) ; } else if ( c == 29 ) { ++ mpReadPtr ; int nS32 = mpReadPtr [ 0 ] << 24 ; nS32 += mpReadPtr [ 1 ] << 16 ; nS32 += mpReadPtr [ 2 ] << 8 ; nS32 += mpReadPtr [ 3 ] << 0 ; if ( ( sizeof ( nS32 ) != 4 ) && ( nS32 & ( 1 << 31 ) ) ) nS32 |= ( ~ 0U ) << 31 ; mpReadPtr += 4 ; nVal = static_cast < ValType > ( nS32 ) ; push ( nVal ) ; } else if ( c == 30 ) { ++ mpReadPtr ; const RealType fReal = readRealVal ( ) ; nVal = fReal ; push ( nVal ) ; } }
Read DICT operator at mpReadPtr.
Read DICT operator at mpReadPtr .
// we are looking at an operator // escape: the operator is indicated in the following byte //TODO: if( nStackIdx > 0) // The first byte of pCmdName indicates the type of operand // bool // "ForceBold" // TODO: handle more boolean dictops? // dict-op number // "StdHW" // "StdVW" // "charset" // "nEncoding" // "nCharStrings" // "nSubrs" // "defaultWidthX" // "nominalWidthX" // "BlueScale" // "BlueShift" // "BlueFuzz" // "ExpansionFactor" // "LanguageGroup" // "nFDArray" // "nFDSelect" // TODO: handle more numeric dictops? // array // "FontBBox" // "FontMatrix" // TODO: reset other arrays? // "FontBBox" // "FontMatrix" // TODO: handle more array dictops? // delta array // "BlueValues" // "OtherBlues" // "FamilyBlues" // "FamilyOtherBlues" // "StemSnapH" // "StemSnapV" // TODO: handle more delta-array dictops? // stringid (SID) // "FullName" // "FamilyName" // "FontName" // TODO: handle more string dictops? // private dict // ROS operands // TODO: use // TODO: use // CharstringType //		--mpReadPtr; // we are looking at a 32-bit operand // skip 29 // assuming 2s complement // we are looking at a real number operand // skip 30 // push value onto stack