From 94e26e1903a1a69a24065df84ba800cb8bcf42bb Mon Sep 17 00:00:00 2001 From: das Date: Tue, 19 Aug 2008 00:17:48 +0000 Subject: * macosx/tkMacOSXFont.c (SetFontFeatures): Disable antialiasing of fixed-width fonts with size <= 10. --- ChangeLog | 6 ++++++ macosx/tkMacOSXFont.c | 22 +++++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4682740..89561ed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-08-19 Daniel Steffen + + * macosx/tkMacOSXFont.c (SetFontFeatures): Disable antialiasing of + fixed-width fonts with + size <= 10. + 2008-08-14 Daniel Steffen *** 8.5.4 TAGGED FOR RELEASE *** diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c index 66d92f2..5be4f8d 100644 --- a/macosx/tkMacOSXFont.c +++ b/macosx/tkMacOSXFont.c @@ -35,7 +35,7 @@ * that such fonts can not be used for controls, because controls * definitely require a family id (this assertion needs testing). * - * RCS: @(#) $Id: tkMacOSXFont.c,v 1.37.2.1 2008/06/19 00:10:54 das Exp $ + * RCS: @(#) $Id: tkMacOSXFont.c,v 1.37.2.2 2008/08/19 00:17:48 das Exp $ */ #include "tkMacOSXPrivate.h" @@ -220,7 +220,8 @@ static void InitATSUObjects(FMFontFamily familyId, short qdsize, short qdStyle, ATSUFontID *fontIdPtr, ATSUTextLayout *layoutPtr, ATSUStyle *stylePtr); static void InitATSUStyle(ATSUFontID fontId, short ptSize, short qdStyle, ATSUStyle style); -static void SetFontFeatures(ATSUFontID fontId, int fixed, ATSUStyle style); +static void SetFontFeatures(ATSUFontID fontId, int fixed, short size, + ATSUStyle style); static void AdjustFontHeight(MacFont *fontPtr); static void InitATSULayout(const TkMacOSXDrawingContext *drawingContextPtr, ATSUTextLayout layout, int fixed); @@ -1493,7 +1494,8 @@ InitFont( Tk_MeasureChars((Tk_Font)fontPtr, "W", 1, -1, 0, &wWidth); fmPtr->fixed = periodWidth == wWidth; - SetFontFeatures(fontPtr->atsuFontId, fmPtr->fixed, fontPtr->atsuStyle); + SetFontFeatures(fontPtr->atsuFontId, fmPtr->fixed, size, + fontPtr->atsuStyle); AdjustFontHeight(fontPtr); } @@ -1646,6 +1648,7 @@ static void SetFontFeatures( ATSUFontID fontId, /* The font id to use. */ int fixed, /* Is this a fixed font? */ + short size, /* Size of the font */ ATSUStyle style) /* The style handle to configure. */ { /* @@ -1664,6 +1667,19 @@ SetFontFeatures( ChkErr(ATSUSetFontFeatures, style, sizeof(fixed_featureTypes) / sizeof(fixed_featureTypes[0]), fixed_featureTypes, fixed_featureSelectors); + if (size <= 10) { + /* + * Disable antialiasing of fixed fonts with sizes <= 10 + */ + + const ATSStyleRenderingOptions options = kATSStyleNoAntiAliasing; + const ATSUAttributeTag styleTag = kATSUStyleRenderingOptionsTag; + const ByteCount styleSize = sizeof(ATSStyleRenderingOptions); + const ConstATSUAttributeValuePtr styleValue = &options; + + ChkErr(ATSUSetAttributes, style, 1, &styleTag, &styleSize, + (ATSUAttributeValuePtr*) &styleValue); + } } } -- cgit v0.12