summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXFont.c
diff options
context:
space:
mode:
authordas <das>2008-08-19 00:17:43 (GMT)
committerdas <das>2008-08-19 00:17:43 (GMT)
commit8899e854a9fbe9bd153ceb639caab38ac6c150cb (patch)
tree4a090c0cbabbbd0d9dbe7b33583115d642941008 /macosx/tkMacOSXFont.c
parent5e49f06c06d017b4a62fce8682ed7d31bff95632 (diff)
downloadtk-8899e854a9fbe9bd153ceb639caab38ac6c150cb.zip
tk-8899e854a9fbe9bd153ceb639caab38ac6c150cb.tar.gz
tk-8899e854a9fbe9bd153ceb639caab38ac6c150cb.tar.bz2
* macosx/tkMacOSXFont.c (SetFontFeatures): Disable antialiasing of
fixed-width fonts with size <= 10.
Diffstat (limited to 'macosx/tkMacOSXFont.c')
-rw-r--r--macosx/tkMacOSXFont.c22
1 files changed, 19 insertions, 3 deletions
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);
+ }
}
}