- if ( castsShadow ) {
- // Create the shadow style to use for drawing the string
- shadow.version = 0;
- shadow.elevation = shadowElevation;
- shadow.azimuth = shadowAzimuth;
- shadow.ambient = shadowAmbient;
- shadow.height = shadowHeight;
- shadow.radius = shadowRadius;
- shadow.saturation = shadowSaturation;
- style = CGStyleCreateShadow(&shadow);
+ if (castsShadow) {
+ CGFloat height = ((2.0*tan((M_PI/360.0)*(shadowAzimuth-180.0)))*shadowHeight)/(1.0+pow(tan((M_PI/360.0)*(shadowAzimuth-180.0)),2.0));
+ CGFloat width = sqrt(pow(shadowHeight, 2.0)-pow(height, 2.0));
+
+ shadow = [[NSShadow alloc] init];
+ [shadow setShadowColor:[[NSColor blackColor] colorWithAlphaComponent:(1.0 - shadowAmbient)]];
+ [shadow setShadowOffset:NSMakeSize(width, height)];
+ [shadow setShadowBlurRadius:shadowRadius];