Ejemplo n.º 1
0
/*
 * Internal support routine, keep this guy FAST!!!!!!!		<3>
 */
fixed fnt_GetCVTScale(register fnt_LocalGraphicStateType* gs)
{
	register fnt_GlobalGraphicStateType *globalGS = gs->globalGS;

	if ( gs->proj.y )
	{	if ( gs->proj.x )
			if (gs->projectionVectorIsNormal)	/* thanks to the great Rob Johnson */
				return Magnitude(ShortFracMul(globalGS->cvtStretch.x, gs->proj.x),
								ShortFracMul(globalGS->cvtStretch.y, gs->proj.y));
			else
			{	fixed foo = ShortFracMul(globalGS->cvtStretch.y, gs->proj.x);
				fixed bar = ShortFracMul(globalGS->cvtStretch.x, gs->proj.y);
	
				return MultiplyDivide(globalGS->cvtStretch.x, globalGS->cvtStretch.y, Magnitude(foo, bar));
			}
		else	/* pvy == +1 or -1 */
			return globalGS->cvtStretch.y;
	}
	else	/* pvx == +1 or -1 */
		return globalGS->cvtStretch.x;
}
Ejemplo n.º 2
0
void TTScalerTTHintTran(
 	 const scalerTransform *theTransform,	/* Specify a Input Transformation? */
	 perFont *aPerFont,						/* Specify the context  */
 	 perTransformation  *theTrans 			/* point to transform block. */
 	) 	 
{
	perVariation * aPerVari=&aPerFont->theVary	;			/* Specify the context as a variation */
	fsg_SplineKey		key;			/* Scaler internal execution state */
   	perTransformation   *localPerTransform;
      
  	InitTheKeyByVary(&key, aPerVari);
  	FillBytes((char*)theTrans + theTrans->twilightZone.offset, TheFont(&key)->twilightZoneSize, 0);
	/* MTE: Setup some flags and control variables */
	/*	make a guess as to what they should be.. */
 	theTrans->executeInstructions	= true; 
 			/* MTE: always true? BitTestToBoolean(theTransform->flags & applyHintsTransform); */
	theTrans->returnDeviceMetrics= false; 
			/* MTE: always false??BitTestToBoolean(theTransform->flags & deviceMetricsTransform); */
	theTrans->preProgramRan 	= false;
	theTrans->cvtHasBeenScaled 	= false;
	theTrans->verticalOrientation = false; 
		/*  MTE: What should this be?BitTestToBoolean(theTransform->flags & verticalTransform); */
	theTrans->methodToBeUsedIfPossible = outlineWillBeUsed;
	theTrans->methodToBeUsedOtherwise = outlineWillBeUsed;

	/*
	 *	Set baseMap to the concatenation of pointSize € resolution € userMatrix
	*/
	theTrans->pointSize = theTransform->pointSize;
	theTrans->pixelDiameter	= Magnitude(theTransform->spotSize.x, theTransform->spotSize.y);
		
    ResetMapping(&theTrans->stretchTransform);
    theTrans->stretchTransform.map[0][0] = 
        MultiplyDivide(theTransform->pointSize, theTransform->resolution.x, FIXEDPOINTSPERINCH);
    theTrans->stretchTransform.map[1][1] = 
        MultiplyDivide(theTransform->pointSize, theTransform->resolution.y, FIXEDPOINTSPERINCH);
    if (TheFont(&key)->fontFlags & USE_INTEGER_SCALING) {
        theTrans->stretchTransform.map[0][0] = RoundedFixed(theTrans->stretchTransform.map[0][0]);
        theTrans->stretchTransform.map[1][1] = RoundedFixed(theTrans->stretchTransform.map[1][1]);
    }

    MapMapping(&theTrans->stretchTransform,( const gxMapping *) theTransform->fontMatrixPtr );
    theTrans->globalGS.localParBlock.scanControl = DEFAULT_DROPOUT_MODE;

	if (theTrans->executeInstructions)
	{	
		boolean b1,b2,b2a;
		int theMinVal,minFix;

        /* We assume that transform here has only positive stretch
           (no rotation, skew or flips allowed at this point).

           Note that hinting code does NOT apply this transform to outline.
           It assumes that outline is already scaled and uses transform for reference. */

 	 	theMinVal = TheFont(&key)->minimumPixPerEm; 
 	 	if (theMinVal> kMinimumPPEMWhereHintsStillWork) 
		    theMinVal=kMinimumPPEMWhereHintsStillWork ;  
		minFix=ff(theMinVal)-(0x8000L); /* adjust for fixed point rounding. */
		if (			/* MTE: no perspective, ever ! MxFlags(&theTrans->transState.baseMap) == 	perspectiveState || */
            (theTrans->stretchTransform.map[0][0] < minFix )
					||
            (theTrans->stretchTransform.map[1][1] < minFix)
           )
        {
            /* turnOffHinting: */
				theTrans->globalGS.localParBlock.scanControl = 0x101ff;					/* hard-code dropout control ON */
				theTrans->returnDeviceMetrics = theTrans->executeInstructions = false;	/* Do nothing. */
                /* Note: hinting will be reenabled as soon as we update 
                   t->ttd and call TTScalerTTHintTran() */
 				goto exit;
			}
			
		 	theTrans->globalGS.instrDefCount 	= TheFont(&key)->IDefCount;
			theTrans->globalGS.pointSize		= FixedRound(theTrans->pointSize);
#ifdef use_engine_characteristics_in_hints
				theTrans->globalGS.engine[kGreyEngineDistance]	= 0;
				theTrans->globalGS.engine[kBlackEngineDistance]	= FixedToF26Dot6( (FIXEDSQRT2 - theTrans->pixelDiameter) );
				theTrans->globalGS.engine[kWhiteEngineDistance]	= -theTrans->globalGS.engine[kBlackEngineDistance];
				theTrans->globalGS.engine[kIllegalEngineDistance]	= 0;
#endif
			theTrans->globalGS.variationCoordCount			= TheFont(&key)->axisCount;
			theTrans->globalGS.hasVariationCoord			= TheVari(&key)->hasStyleCoord;
			
            {
                register fixed scaleX = theTrans->stretchTransform.map[0][0];
                register fixed scaleY = theTrans->stretchTransform.map[1][1];
				theTrans->globalGS.cvtScale =/*  MTE: Maximum(scaleX, scaleY); */
						scaleX>scaleY ? scaleX :scaleY;
			}
			SetGlobalGSDefaults(&theTrans->globalGS);  	 
 	}
   exit:;
  }