summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordas <das>2008-08-19 00:17:48 (GMT)
committerdas <das>2008-08-19 00:17:48 (GMT)
commit94e26e1903a1a69a24065df84ba800cb8bcf42bb (patch)
tree681ee11cafa17ae30af6529c46b1c4d06a091bc6
parentc816c742535d4520f6ac3b49f6348b46cc6a4ca8 (diff)
downloadtk-94e26e1903a1a69a24065df84ba800cb8bcf42bb.zip
tk-94e26e1903a1a69a24065df84ba800cb8bcf42bb.tar.gz
tk-94e26e1903a1a69a24065df84ba800cb8bcf42bb.tar.bz2
* macosx/tkMacOSXFont.c (SetFontFeatures): Disable antialiasing of
fixed-width fonts with size <= 10.
-rw-r--r--ChangeLog6
-rw-r--r--macosx/tkMacOSXFont.c22
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 <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXFont.c (SetFontFeatures): Disable antialiasing of
+ fixed-width fonts with
+ size <= 10.
+
2008-08-14 Daniel Steffen <das@users.sourceforge.net>
*** 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);
+ }
}
}