aboutsummaryrefslogtreecommitdiffstats
path: root/src/macgui.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/macgui.h')
-rw-r--r--src/macgui.h38
1 files changed, 23 insertions, 15 deletions
diff --git a/src/macgui.h b/src/macgui.h
index 7eb6c9942ab..579ae2b7663 100644
--- a/src/macgui.h
+++ b/src/macgui.h
@@ -79,14 +79,26 @@ typedef unsigned long Time;
79#include <Gestalt.h> 79#include <Gestalt.h>
80#endif /* not HAVE_CARBON */ 80#endif /* not HAVE_CARBON */
81 81
82/* Whether to use ATSUI (Apple Type Services for Unicode Imaging) for
83 text drawing. */
84#ifndef USE_ATSUI
85#ifdef MAC_OSX
86#define USE_ATSUI 1
87#endif
88#endif
89
90/* Whether to use low-level Quartz 2D (aka Core Graphics) text drawing
91 in preference to ATSUI for ASCII and Latin-1 characters. */
82#ifndef USE_CG_TEXT_DRAWING 92#ifndef USE_CG_TEXT_DRAWING
83#if USE_ATSUI && MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 93#if USE_ATSUI && MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
84#define USE_CG_TEXT_DRAWING 1 94#define USE_CG_TEXT_DRAWING 1
85#endif 95#endif
86#endif 96#endif
87 97
98/* Whether to use Quartz 2D routines for drawing operations other than
99 texts. */
88#ifndef USE_CG_DRAWING 100#ifndef USE_CG_DRAWING
89#if USE_ATSUI && defined (MAC_OSX) 101#if USE_ATSUI && MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
90#define USE_CG_DRAWING 1 102#define USE_CG_DRAWING 1
91#endif 103#endif
92#endif 104#endif
@@ -105,6 +117,8 @@ typedef GWorldPtr Pixmap;
105 117
106 118
107/* Emulate XCharStruct. */ 119/* Emulate XCharStruct. */
120/* If the sum of ascent and descent is negative, that means some
121 special status specified by enum pcm_status. */
108typedef struct _XCharStruct 122typedef struct _XCharStruct
109{ 123{
110 short lbearing; /* origin to left edge of raster */ 124 short lbearing; /* origin to left edge of raster */
@@ -117,6 +131,12 @@ typedef struct _XCharStruct
117#endif 131#endif
118} XCharStruct; 132} XCharStruct;
119 133
134enum pcm_status
135 {
136 PCM_VALID = 0, /* pcm data is valid */
137 PCM_INVALID = -1, /* pcm data is invalid */
138 };
139
120#define STORE_XCHARSTRUCT(xcs, w, bds) \ 140#define STORE_XCHARSTRUCT(xcs, w, bds) \
121 ((xcs).width = (w), \ 141 ((xcs).width = (w), \
122 (xcs).lbearing = (bds).left, \ 142 (xcs).lbearing = (bds).left, \
@@ -124,18 +144,6 @@ typedef struct _XCharStruct
124 (xcs).ascent = -(bds).top, \ 144 (xcs).ascent = -(bds).top, \
125 (xcs).descent = (bds).bottom) 145 (xcs).descent = (bds).bottom)
126 146
127typedef struct
128{
129 char valid_bits[0x100 / 8];
130 XCharStruct per_char[0x100];
131} XCharStructRow;
132
133#define XCHARSTRUCTROW_CHAR_VALID_P(row, byte2) \
134 ((row)->valid_bits[(byte2) / 8] & (1 << (byte2) % 8))
135
136#define XCHARSTRUCTROW_SET_CHAR_VALID(row, byte2) \
137 ((row)->valid_bits[(byte2) / 8] |= (1 << (byte2) % 8))
138
139struct MacFontStruct { 147struct MacFontStruct {
140 char *full_name; 148 char *full_name;
141 149
@@ -175,7 +183,7 @@ struct MacFontStruct {
175 XCharStruct max_bounds; /* maximum bounds over all existing char */ 183 XCharStruct max_bounds; /* maximum bounds over all existing char */
176 union { 184 union {
177 XCharStruct *per_char; /* first_char to last_char information */ 185 XCharStruct *per_char; /* first_char to last_char information */
178 XCharStructRow **rows; /* first row to last row information */ 186 XCharStruct **rows; /* first row to last row information */
179 } bounds; 187 } bounds;
180 int ascent; /* logical extent above baseline for spacing */ 188 int ascent; /* logical extent above baseline for spacing */
181 int descent; /* logical decent below baseline for spacing */ 189 int descent; /* logical decent below baseline for spacing */
@@ -229,7 +237,7 @@ typedef struct _XGC
229 /* QuickDraw clipping region. Ignored if n_clip_rects == 0. */ 237 /* QuickDraw clipping region. Ignored if n_clip_rects == 0. */
230 RgnHandle clip_region; 238 RgnHandle clip_region;
231 239
232#if defined (MAC_OSX) && USE_ATSUI 240#if defined (MAC_OSX) && (USE_ATSUI || USE_CG_DRAWING)
233 /* Clipping rectangles used in Quartz 2D drawing. The y-coordinate 241 /* Clipping rectangles used in Quartz 2D drawing. The y-coordinate
234 is in QuickDraw's. */ 242 is in QuickDraw's. */
235 CGRect clip_rects[MAX_CLIP_RECTS]; 243 CGRect clip_rects[MAX_CLIP_RECTS];