main/vcl/source/fontsubset/cff.cxx
// get a cstring from a StringID
get a cstring from a StringID
get a cstring from a StringID
const char* CffSubsetterContext::getString( int nStringID)
{
	const static int nStdStrings = sizeof(pStringIds)/sizeof(*pStringIds);
	if( (nStringID >= 0) && (nStringID < nStdStrings))
		return pStringIds[ nStringID];
	const U8* pReadPtr = mpReadPtr;
	const U8* pReadEnd = mpReadEnd;
	nStringID -= nStdStrings;
	int nLen = seekIndexData( mnStringIdxBase, nStringID);
	static char aNameBuf[ 2560];
	if( nLen < 0) {
		sprintf( aNameBuf, "name[%d].notfound!", nStringID);
	} else {
		const int nMaxLen = sizeof(aNameBuf) - 1;
		if( nLen >= nMaxLen)
			nLen = nMaxLen;
		for( int i = 0; i < nLen; ++i)
			aNameBuf[i] = *(mpReadPtr++);
		aNameBuf[ nLen] = '\0';
	}
	mpReadPtr = pReadPtr;
	mpReadEnd = pReadEnd;
	return aNameBuf;
}
const char * CffSubsetterContext :: getString ( int nStringID ) { const static int nStdStrings = sizeof ( pStringIds ) / sizeof ( * pStringIds ) ; if ( ( nStringID >= 0 ) && ( nStringID < nStdStrings ) ) return pStringIds [ nStringID ] ; const U8 * pReadPtr = mpReadPtr ; const U8 * pReadEnd = mpReadEnd ; nStringID -= nStdStrings ; int nLen = seekIndexData ( mnStringIdxBase , nStringID ) ; static char aNameBuf [ 2560 ] ; if ( nLen < 0 ) { sprintf ( aNameBuf , " " , nStringID ) ; } else { const int nMaxLen = sizeof ( aNameBuf ) - 1 ; if ( nLen >= nMaxLen ) nLen = nMaxLen ; for ( int i = 0 ; i < nLen ; ++ i ) aNameBuf [ i ] = * ( mpReadPtr ++ ) ; aNameBuf [ nLen ] = ' \0 ' ; } mpReadPtr = pReadPtr ; mpReadEnd = pReadEnd ; return aNameBuf ; }
get a cstring from a StringID
get a cstring from a StringID
// get a standard string if possible // else get the string from the StringIndex table // assert( nLen >= 0); // TODO: just return the undecorated name // TODO: get rid of static char buffer