From 8899e854a9fbe9bd153ceb639caab38ac6c150cb Mon Sep 17 00:00:00 2001 From: das Date: Tue, 19 Aug 2008 00:17:43 +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 935fd7a..f0ded8d 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-18 Ania Pawelczyk * tests/canvWind.test: Update to tcltest2 diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c index c225e8f..1d4b357 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.38 2008/06/19 00:10:24 das Exp $ + * RCS: @(#) $Id: tkMacOSXFont.c,v 1.39 2008/08/19 00:17:44 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-width 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