Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>So, first, my method of creating the italic font was deeply flawed. Instead of simply applying a rotation to the text, I needed to apply a skew transform. I ended up finding a good skew transform to apply at <a href="http://trac.webkit.org/browser/trunk/WebCore/platform/graphics/mac/FontMac.mm" rel="nofollow noreferrer">WebKit's Font code</a>. It contained the skew transform:</p> <pre><code>CGAffineTransformMake(1, 0, -tanf(SYNTHETIC_OBLIQUE_ANGLE * acosf(0) / 90), 1, 0, 0) </code></pre> <p>It does look good. The cocoa code to set this up is:</p> <pre><code>const CGFloat kRotationForItalicText = -14.0; NSAffineTransform *fontTransform = [NSAffineTransform transform]; [fontTransform scaleBy:[NSFont systemFontSizeForControlSize:NSMiniControlSize]]; NSAffineTransformStruct italicTransformData; italicTransformData.m11 = 1; italicTransformData.m12 = 0; italicTransformData.m21 = -tanf( kRotationForItalicText * acosf(0) / 90 ); italicTransformData.m22 = 1; italicTransformData.tX = 0; italicTransformData.tY = 0; NSAffineTransform *italicTransform = [NSAffineTransform transform]; [italicTransform setTransformStruct:italicTransformData]; </code></pre> <p>However, I was told by another person that the "Lucida Sans" font is virtually identical to Lucida Grande and does have a real italic variant.</p> <p>So, basically, I am using a different font, but one that should meet with full approval. However, if for some reason the Lucida Sans font cannot be found, I will default back to systemFontOfSize and apply the above transform to it if necessary.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload