示例#1
0
/* ==================================================================== */
void scDrawLine::SetCaseCharData( caseState cs )
{
	OutputLine();

	fGlyphInfo.fontname 	= scCachedStyle::GetCurrentCache().GetFont();
	fGlyphInfo.emphasis_	= scCachedStyle::GetCurrentCache().GetEmphasis();
	fGlyphInfo.fontRender	= scCachedStyle::GetCurrentCache().GetRender();
	fGlyphInfo.typespec 	= scCachedStyle::GetCurrentCache().GetSpec();
	fGlyphInfo.color		= scCachedStyle::GetCurrentCache().GetColor( );

	if ( cs == lowerCase ) {
		fGlyphInfo.pointsize	= scRoundGS( scCachedStyle::GetCurrentCache().GetGlyphHeight() * kSmallCapCorrection );
		fGlyphInfo.setsize		= scRoundGS( scCachedStyle::GetCurrentCache().GetGlyphWidth() * kSmallCapCorrection );
	}
	else {
		fGlyphInfo.pointsize	= scCachedStyle::GetCurrentCache().GetGlyphHeight();
		fGlyphInfo.setsize		= scCachedStyle::GetCurrentCache().GetGlyphWidth();
	}
		
	fGlyphInfo.oblique		= 0;
	fGlyphInfo.rotation 	= 0;

	fGlyphInfo.flowDir		= fFlowDir;

	if ( fFlowDir.IsVertical() ) {
		fGlyphInfo.fBaseline	= scCachedStyle::GetCurrentCache().GetVertBaseline( );
		fBaseline.Set( scCachedStyle::GetCurrentCache().GetBaseline(), 0 );
	}
	else {
		fGlyphInfo.fBaseline	= scCachedStyle::GetCurrentCache().GetHorzBaseline( );
		fBaseline.Set( 0, -scCachedStyle::GetCurrentCache().GetBaseline() );
	}
}
示例#2
0
GlyphSize scCachedStyle::GetKernValue( UCS2 ch1, UCS2 ch2 )
{
	RLU 			kern;
	
	if ( GetDeviceValues() )
		return FIgetDEVKern( fSpec, ch1, ch2 );
	else {
		kern = FIgetRLUKern( fSpec, ch1, ch2 );

		if ( kern != 0 ) {
			if ( fFlowDir.IsHorizontal() )
				return scRoundGS( fSetConv * kern );
			return scRoundGS( fPtConv * kern );
		}
	}
	return 0;
}
示例#3
0
GlyphSize scCachedStyle::GetEscapement( UCS2 ch )
{
	if ( GetDeviceValues() ) {

		if ( ch >= 256 )
			return FIgetDEVEscapement( fSpec, ch );
		
		if ( fWidths[ch] == kInvalMP ) {
			if ( GetSmallCaps() && CTIsLowerCase( ch ) )
				fWidths[ch] = scRoundMP( FIgetDEVEscapement( fSpec, ::CTToUpper( ch ) ) * kSmallCapCorrection );				
			else
				fWidths[ch] = FIgetDEVEscapement( fSpec, GetCorrectedGlyph( ch ) );
		}
	}
	else {
		REAL		conversion; 

		if ( fFlowDir.IsHorizontal() )
			conversion = fSetConv;
		else
			conversion = fPtConv;

		if ( ch >= 256 ) {
			RLU rluWidth = FIgetRLUEscapement( fSpec, ch );
			if ( rluWidth == scBaseRLUsystem ) {
				if ( fFlowDir.IsHorizontal() ) 
					return GetSetSize();
				else
					return GetPtSize();
			}	
			return scRoundGS( conversion * rluWidth ) + GetOptLSP();
		}

		if ( fWidths[ch] == kInvalMP ) {
				// it has not been previously computed
			switch ( ch ) {
				default:
					{
						RLU rluWidth;
						if ( GetSmallCaps() && CTIsLowerCase( ch ) )
							rluWidth = (RLU)scRoundGS( FIgetRLUEscapement( fSpec, ::CTToUpper( ch ) ) * kSmallCapCorrection );
						else
							rluWidth = FIgetRLUEscapement( fSpec, GetCorrectedGlyph( ch ) );
						
						if ( rluWidth == scBaseRLUsystem ) {
							fWidths[ch] = scRoundMP( conversion * rluWidth );
							if ( fFlowDir.IsHorizontal() )		
								fWidths[ch] = GetSetSize() + GetOptLSP();
							else
								fWidths[ch] = GetPtSize() + GetOptLSP();
						}
						else
							fWidths[ch] = scRoundMP( conversion * rluWidth );
					}
				break;

				case 0:
				case scVertTab:
				case scHardReturn:
					if ( fFlowDir.IsHorizontal() )
						fWidths[ch] = GetSetSize();
					else
						fWidths[ch] = GetPtSize();
					break;

				case scNoBreakSpace:
					fWidths[ch] = GetOptWord();
					break;

					// these really need to be further up stream
				case scNoBreakHyph:
				case scDiscHyphen:
					fWidths[ch] = 0;
					break;
				case scFigureSpace:
					fWidths[ch] = scRoundMP( conversion * FIgetRLUEscapement( fSpec, '0' ) );
					break;
				case scThinSpace:
					fWidths[ch] = scRoundMP( conversion * scBaseRLUsystem / 6 );
					break;
				case scEnSpace:
					fWidths[ch] = scRoundMP( conversion * scBaseRLUsystem / 2 );
					break;
				case scEmSpace:
					fWidths[ch] = scRoundMP( conversion * scBaseRLUsystem );
					break;
			}
		}
		if ( fWidths[ch] == 0 )
			return 0;
	}
	return fWidths[ch] + GetOptLSP();
}