diff options
Diffstat (limited to 'src/macterm.c')
| -rw-r--r-- | src/macterm.c | 241 |
1 files changed, 156 insertions, 85 deletions
diff --git a/src/macterm.c b/src/macterm.c index b7a7fadeab2..8ddd8febd69 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -391,16 +391,37 @@ mac_draw_line (f, gc, x1, y1, x2, y2) | |||
| 391 | { | 391 | { |
| 392 | #if USE_CG_DRAWING | 392 | #if USE_CG_DRAWING |
| 393 | CGContextRef context; | 393 | CGContextRef context; |
| 394 | float gx1 = x1, gy1 = y1, gx2 = x2, gy2 = y2; | ||
| 395 | |||
| 396 | if (y1 != y2) | ||
| 397 | gx1 += 0.5f, gx2 += 0.5f; | ||
| 398 | if (x1 != x2) | ||
| 399 | gy1 += 0.5f, gy2 += 0.5f; | ||
| 394 | 400 | ||
| 395 | context = mac_begin_cg_clip (f, gc); | 401 | context = mac_begin_cg_clip (f, gc); |
| 396 | CG_SET_STROKE_COLOR (context, gc->xgcv.foreground); | 402 | CG_SET_STROKE_COLOR (context, gc->xgcv.foreground); |
| 397 | CGContextBeginPath (context); | 403 | CGContextBeginPath (context); |
| 398 | CGContextMoveToPoint (context, x1 + 0.5f, y1 + 0.5f); | 404 | CGContextMoveToPoint (context, gx1, gy1); |
| 399 | CGContextAddLineToPoint (context, x2 + 0.5f, y2 + 0.5f); | 405 | CGContextAddLineToPoint (context, gx2, gy2); |
| 400 | CGContextClosePath (context); | 406 | CGContextClosePath (context); |
| 401 | CGContextStrokePath (context); | 407 | CGContextStrokePath (context); |
| 402 | mac_end_cg_clip (f); | 408 | mac_end_cg_clip (f); |
| 403 | #else | 409 | #else |
| 410 | if (x1 == x2) | ||
| 411 | { | ||
| 412 | if (y1 > y2) | ||
| 413 | y1--; | ||
| 414 | else if (y2 > y1) | ||
| 415 | y2--; | ||
| 416 | } | ||
| 417 | else if (y1 == y2) | ||
| 418 | { | ||
| 419 | if (x1 > x2) | ||
| 420 | x1--; | ||
| 421 | else | ||
| 422 | x2--; | ||
| 423 | } | ||
| 424 | |||
| 404 | SetPortWindowPort (FRAME_MAC_WINDOW (f)); | 425 | SetPortWindowPort (FRAME_MAC_WINDOW (f)); |
| 405 | 426 | ||
| 406 | RGBForeColor (GC_FORE_COLOR (gc)); | 427 | RGBForeColor (GC_FORE_COLOR (gc)); |
| @@ -422,6 +443,21 @@ mac_draw_line_to_pixmap (display, p, gc, x1, y1, x2, y2) | |||
| 422 | CGrafPtr old_port; | 443 | CGrafPtr old_port; |
| 423 | GDHandle old_gdh; | 444 | GDHandle old_gdh; |
| 424 | 445 | ||
| 446 | if (x1 == x2) | ||
| 447 | { | ||
| 448 | if (y1 > y2) | ||
| 449 | y1--; | ||
| 450 | else if (y2 > y1) | ||
| 451 | y2--; | ||
| 452 | } | ||
| 453 | else if (y1 == y2) | ||
| 454 | { | ||
| 455 | if (x1 > x2) | ||
| 456 | x1--; | ||
| 457 | else | ||
| 458 | x2--; | ||
| 459 | } | ||
| 460 | |||
| 425 | GetGWorld (&old_port, &old_gdh); | 461 | GetGWorld (&old_port, &old_gdh); |
| 426 | SetGWorld (p, NULL); | 462 | SetGWorld (p, NULL); |
| 427 | 463 | ||
| @@ -1627,7 +1663,7 @@ mac_set_clip_rectangles (display, gc, rectangles, n) | |||
| 1627 | DisposeRgn (region); | 1663 | DisposeRgn (region); |
| 1628 | } | 1664 | } |
| 1629 | } | 1665 | } |
| 1630 | #if defined (MAC_OSX) && USE_ATSUI | 1666 | #if defined (MAC_OSX) && (USE_ATSUI || USE_CG_DRAWING) |
| 1631 | for (i = 0; i < n; i++) | 1667 | for (i = 0; i < n; i++) |
| 1632 | { | 1668 | { |
| 1633 | Rect *rect = rectangles + i; | 1669 | Rect *rect = rectangles + i; |
| @@ -2139,6 +2175,29 @@ static int mac_encode_char P_ ((int, XChar2b *, struct font_info *, | |||
| 2139 | struct charset *, int *)); | 2175 | struct charset *, int *)); |
| 2140 | 2176 | ||
| 2141 | 2177 | ||
| 2178 | static void | ||
| 2179 | pcm_init (pcm, count) | ||
| 2180 | XCharStruct *pcm; | ||
| 2181 | int count; | ||
| 2182 | { | ||
| 2183 | bzero (pcm, sizeof (XCharStruct) * count); | ||
| 2184 | while (--count >= 0) | ||
| 2185 | { | ||
| 2186 | pcm->descent = PCM_INVALID; | ||
| 2187 | pcm++; | ||
| 2188 | } | ||
| 2189 | } | ||
| 2190 | |||
| 2191 | static enum pcm_status | ||
| 2192 | pcm_get_status (pcm) | ||
| 2193 | XCharStruct *pcm; | ||
| 2194 | { | ||
| 2195 | int height = pcm->ascent + pcm->descent; | ||
| 2196 | |||
| 2197 | /* Negative height means some special status. */ | ||
| 2198 | return height >= 0 ? PCM_VALID : height; | ||
| 2199 | } | ||
| 2200 | |||
| 2142 | /* Get metrics of character CHAR2B in FONT. Value is null if CHAR2B | 2201 | /* Get metrics of character CHAR2B in FONT. Value is null if CHAR2B |
| 2143 | is not contained in the font. */ | 2202 | is not contained in the font. */ |
| 2144 | 2203 | ||
| @@ -2155,22 +2214,21 @@ x_per_char_metric (font, char2b) | |||
| 2155 | #if USE_ATSUI | 2214 | #if USE_ATSUI |
| 2156 | if (font->mac_style) | 2215 | if (font->mac_style) |
| 2157 | { | 2216 | { |
| 2158 | XCharStructRow **row = font->bounds.rows + char2b->byte1; | 2217 | XCharStruct **row = font->bounds.rows + char2b->byte1; |
| 2159 | 2218 | ||
| 2160 | if (*row == NULL) | 2219 | if (*row == NULL) |
| 2161 | { | 2220 | { |
| 2162 | *row = xmalloc (sizeof (XCharStructRow)); | 2221 | *row = xmalloc (sizeof (XCharStruct) * 0x100); |
| 2163 | bzero (*row, sizeof (XCharStructRow)); | 2222 | pcm_init (*row, 0x100); |
| 2164 | } | 2223 | } |
| 2165 | pcm = (*row)->per_char + char2b->byte2; | 2224 | pcm = *row + char2b->byte2; |
| 2166 | if (!XCHARSTRUCTROW_CHAR_VALID_P (*row, char2b->byte2)) | 2225 | if (pcm_get_status (pcm) != PCM_VALID) |
| 2167 | { | 2226 | { |
| 2168 | BLOCK_INPUT; | 2227 | BLOCK_INPUT; |
| 2169 | mac_query_char_extents (font->mac_style, | 2228 | mac_query_char_extents (font->mac_style, |
| 2170 | (char2b->byte1 << 8) + char2b->byte2, | 2229 | (char2b->byte1 << 8) + char2b->byte2, |
| 2171 | NULL, NULL, pcm, NULL); | 2230 | NULL, NULL, pcm, NULL); |
| 2172 | UNBLOCK_INPUT; | 2231 | UNBLOCK_INPUT; |
| 2173 | XCHARSTRUCTROW_SET_CHAR_VALID (*row, char2b->byte2); | ||
| 2174 | } | 2232 | } |
| 2175 | } | 2233 | } |
| 2176 | else | 2234 | else |
| @@ -2233,7 +2291,11 @@ x_per_char_metric (font, char2b) | |||
| 2233 | #endif | 2291 | #endif |
| 2234 | 2292 | ||
| 2235 | return ((pcm == NULL | 2293 | return ((pcm == NULL |
| 2236 | || (pcm->width == 0 && (pcm->rbearing - pcm->lbearing) == 0)) | 2294 | || (pcm->width == 0 |
| 2295 | #if 0 /* Show hollow boxes for zero-width glyphs such as combining diacritics. */ | ||
| 2296 | && (pcm->rbearing - pcm->lbearing) == 0 | ||
| 2297 | #endif | ||
| 2298 | )) | ||
| 2237 | ? NULL : pcm); | 2299 | ? NULL : pcm); |
| 2238 | } | 2300 | } |
| 2239 | 2301 | ||
| @@ -3120,13 +3182,13 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width, | |||
| 3120 | for (i = 0; i < width; ++i) | 3182 | for (i = 0; i < width; ++i) |
| 3121 | mac_draw_line (f, gc, | 3183 | mac_draw_line (f, gc, |
| 3122 | left_x + i * left_p, top_y + i, | 3184 | left_x + i * left_p, top_y + i, |
| 3123 | right_x - i * right_p, top_y + i); | 3185 | right_x + 1 - i * right_p, top_y + i); |
| 3124 | 3186 | ||
| 3125 | /* Left. */ | 3187 | /* Left. */ |
| 3126 | if (left_p) | 3188 | if (left_p) |
| 3127 | for (i = 0; i < width; ++i) | 3189 | for (i = 0; i < width; ++i) |
| 3128 | mac_draw_line (f, gc, | 3190 | mac_draw_line (f, gc, |
| 3129 | left_x + i, top_y + i, left_x + i, bottom_y - i); | 3191 | left_x + i, top_y + i, left_x + i, bottom_y - i + 1); |
| 3130 | 3192 | ||
| 3131 | mac_reset_clip_rectangles (dpy, gc); | 3193 | mac_reset_clip_rectangles (dpy, gc); |
| 3132 | if (raised_p) | 3194 | if (raised_p) |
| @@ -3140,13 +3202,13 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width, | |||
| 3140 | for (i = 0; i < width; ++i) | 3202 | for (i = 0; i < width; ++i) |
| 3141 | mac_draw_line (f, gc, | 3203 | mac_draw_line (f, gc, |
| 3142 | left_x + i * left_p, bottom_y - i, | 3204 | left_x + i * left_p, bottom_y - i, |
| 3143 | right_x - i * right_p, bottom_y - i); | 3205 | right_x + 1 - i * right_p, bottom_y - i); |
| 3144 | 3206 | ||
| 3145 | /* Right. */ | 3207 | /* Right. */ |
| 3146 | if (right_p) | 3208 | if (right_p) |
| 3147 | for (i = 0; i < width; ++i) | 3209 | for (i = 0; i < width; ++i) |
| 3148 | mac_draw_line (f, gc, | 3210 | mac_draw_line (f, gc, |
| 3149 | right_x - i, top_y + i + 1, right_x - i, bottom_y - i - 1); | 3211 | right_x - i, top_y + i + 1, right_x - i, bottom_y - i); |
| 3150 | 3212 | ||
| 3151 | mac_reset_clip_rectangles (dpy, gc); | 3213 | mac_reset_clip_rectangles (dpy, gc); |
| 3152 | } | 3214 | } |
| @@ -6315,6 +6377,11 @@ x_free_frame_resources (f) | |||
| 6315 | if (FRAME_SIZE_HINTS (f)) | 6377 | if (FRAME_SIZE_HINTS (f)) |
| 6316 | xfree (FRAME_SIZE_HINTS (f)); | 6378 | xfree (FRAME_SIZE_HINTS (f)); |
| 6317 | 6379 | ||
| 6380 | #if TARGET_API_MAC_CARBON | ||
| 6381 | if (FRAME_FILE_NAME (f)) | ||
| 6382 | xfree (FRAME_FILE_NAME (f)); | ||
| 6383 | #endif | ||
| 6384 | |||
| 6318 | xfree (f->output_data.mac); | 6385 | xfree (f->output_data.mac); |
| 6319 | f->output_data.mac = NULL; | 6386 | f->output_data.mac = NULL; |
| 6320 | 6387 | ||
| @@ -7061,6 +7128,25 @@ add_font_name_table_entry (char *font_name) | |||
| 7061 | font_name_table[font_name_count++] = font_name; | 7128 | font_name_table[font_name_count++] = font_name; |
| 7062 | } | 7129 | } |
| 7063 | 7130 | ||
| 7131 | static void | ||
| 7132 | add_mac_font_name (name, size, style, charset) | ||
| 7133 | char *name; | ||
| 7134 | int size; | ||
| 7135 | Style style; | ||
| 7136 | char *charset; | ||
| 7137 | { | ||
| 7138 | if (size > 0) | ||
| 7139 | add_font_name_table_entry (mac_to_x_fontname (name, size, style, charset)); | ||
| 7140 | else | ||
| 7141 | { | ||
| 7142 | add_font_name_table_entry (mac_to_x_fontname (name, 0, style, charset)); | ||
| 7143 | add_font_name_table_entry (mac_to_x_fontname (name, 0, italic, charset)); | ||
| 7144 | add_font_name_table_entry (mac_to_x_fontname (name, 0, bold, charset)); | ||
| 7145 | add_font_name_table_entry (mac_to_x_fontname (name, 0, italic | bold, | ||
| 7146 | charset)); | ||
| 7147 | } | ||
| 7148 | } | ||
| 7149 | |||
| 7064 | /* Sets up the table font_name_table to contain the list of all fonts | 7150 | /* Sets up the table font_name_table to contain the list of all fonts |
| 7065 | in the system the first time the table is used so that the Resource | 7151 | in the system the first time the table is used so that the Resource |
| 7066 | Manager need not be accessed every time this information is | 7152 | Manager need not be accessed every time this information is |
| @@ -7086,16 +7172,21 @@ init_font_name_table () | |||
| 7086 | text_encoding_info_alist))) | 7172 | text_encoding_info_alist))) |
| 7087 | { | 7173 | { |
| 7088 | OSErr err; | 7174 | OSErr err; |
| 7175 | struct Lisp_Hash_Table *h; | ||
| 7176 | unsigned hash_code; | ||
| 7089 | ItemCount nfonts, i; | 7177 | ItemCount nfonts, i; |
| 7090 | ATSUFontID *font_ids = NULL; | 7178 | ATSUFontID *font_ids = NULL; |
| 7091 | Ptr name, prev_name = NULL; | 7179 | Ptr name; |
| 7092 | ByteCount name_len; | 7180 | ByteCount name_len; |
| 7181 | Lisp_Object family; | ||
| 7093 | 7182 | ||
| 7094 | atsu_font_id_hash = | 7183 | atsu_font_id_hash = |
| 7095 | make_hash_table (Qequal, make_number (DEFAULT_HASH_SIZE), | 7184 | make_hash_table (Qequal, make_number (DEFAULT_HASH_SIZE), |
| 7096 | make_float (DEFAULT_REHASH_SIZE), | 7185 | make_float (DEFAULT_REHASH_SIZE), |
| 7097 | make_float (DEFAULT_REHASH_THRESHOLD), | 7186 | make_float (DEFAULT_REHASH_THRESHOLD), |
| 7098 | Qnil, Qnil, Qnil);; | 7187 | Qnil, Qnil, Qnil);; |
| 7188 | h = XHASH_TABLE (atsu_font_id_hash); | ||
| 7189 | |||
| 7099 | err = ATSUFontCount (&nfonts); | 7190 | err = ATSUFontCount (&nfonts); |
| 7100 | if (err == noErr) | 7191 | if (err == noErr) |
| 7101 | { | 7192 | { |
| @@ -7117,32 +7208,19 @@ init_font_name_table () | |||
| 7117 | kFontNoLanguage, name_len, name, | 7208 | kFontNoLanguage, name_len, name, |
| 7118 | NULL, NULL); | 7209 | NULL, NULL); |
| 7119 | if (err == noErr) | 7210 | if (err == noErr) |
| 7120 | decode_mac_font_name (name, name_len + 1, Qnil); | ||
| 7121 | if (err == noErr | ||
| 7122 | && *name != '.' | ||
| 7123 | && (prev_name == NULL | ||
| 7124 | || strcmp (name, prev_name) != 0)) | ||
| 7125 | { | 7211 | { |
| 7126 | static char *cs = "iso10646-1"; | 7212 | decode_mac_font_name (name, name_len + 1, Qnil); |
| 7127 | 7213 | family = make_unibyte_string (name, name_len); | |
| 7128 | add_font_name_table_entry (mac_to_x_fontname (name, 0, | 7214 | if (*name != '.' |
| 7129 | normal, cs)); | 7215 | && hash_lookup (h, family, &hash_code) < 0) |
| 7130 | add_font_name_table_entry (mac_to_x_fontname (name, 0, | 7216 | { |
| 7131 | italic, cs)); | 7217 | add_mac_font_name (name, 0, normal, "iso10646-1"); |
| 7132 | add_font_name_table_entry (mac_to_x_fontname (name, 0, | 7218 | hash_put (h, family, long_to_cons (font_ids[i]), |
| 7133 | bold, cs)); | 7219 | hash_code); |
| 7134 | add_font_name_table_entry (mac_to_x_fontname (name, 0, | 7220 | } |
| 7135 | italic | bold, cs)); | ||
| 7136 | Fputhash (make_unibyte_string (name, name_len), | ||
| 7137 | long_to_cons (font_ids[i]), atsu_font_id_hash); | ||
| 7138 | xfree (prev_name); | ||
| 7139 | prev_name = name; | ||
| 7140 | } | 7221 | } |
| 7141 | else | 7222 | xfree (name); |
| 7142 | xfree (name); | ||
| 7143 | } | 7223 | } |
| 7144 | if (prev_name) | ||
| 7145 | xfree (prev_name); | ||
| 7146 | if (font_ids) | 7224 | if (font_ids) |
| 7147 | xfree (font_ids); | 7225 | xfree (font_ids); |
| 7148 | } | 7226 | } |
| @@ -7170,16 +7248,16 @@ init_font_name_table () | |||
| 7170 | FMFontSize size; | 7248 | FMFontSize size; |
| 7171 | TextEncoding encoding; | 7249 | TextEncoding encoding; |
| 7172 | TextEncodingBase sc; | 7250 | TextEncodingBase sc; |
| 7173 | Lisp_Object text_encoding_info; | 7251 | Lisp_Object text_encoding_info, family; |
| 7174 | 7252 | ||
| 7175 | if (FMGetFontFamilyName (ff, name) != noErr) | 7253 | if (FMGetFontFamilyName (ff, name) != noErr) |
| 7176 | break; | 7254 | continue; |
| 7177 | p2cstr (name); | 7255 | p2cstr (name); |
| 7178 | if (*name == '.') | 7256 | if (*name == '.') |
| 7179 | continue; | 7257 | continue; |
| 7180 | 7258 | ||
| 7181 | if (FMGetFontFamilyTextEncoding (ff, &encoding) != noErr) | 7259 | if (FMGetFontFamilyTextEncoding (ff, &encoding) != noErr) |
| 7182 | break; | 7260 | continue; |
| 7183 | sc = GetTextEncodingBase (encoding); | 7261 | sc = GetTextEncodingBase (encoding); |
| 7184 | text_encoding_info = assq_no_quit (make_number (sc), | 7262 | text_encoding_info = assq_no_quit (make_number (sc), |
| 7185 | text_encoding_info_alist); | 7263 | text_encoding_info_alist); |
| @@ -7188,13 +7266,15 @@ init_font_name_table () | |||
| 7188 | text_encoding_info_alist); | 7266 | text_encoding_info_alist); |
| 7189 | decode_mac_font_name (name, sizeof (name), | 7267 | decode_mac_font_name (name, sizeof (name), |
| 7190 | XCAR (XCDR (text_encoding_info))); | 7268 | XCAR (XCDR (text_encoding_info))); |
| 7191 | fm_font_family_alist = Fcons (Fcons (build_string (name), | 7269 | family = build_string (name); |
| 7192 | make_number (ff)), | 7270 | if (!NILP (Fassoc (family, fm_font_family_alist))) |
| 7271 | continue; | ||
| 7272 | fm_font_family_alist = Fcons (Fcons (family, make_number (ff)), | ||
| 7193 | fm_font_family_alist); | 7273 | fm_font_family_alist); |
| 7194 | 7274 | ||
| 7195 | /* Point the instance iterator at the current font family. */ | 7275 | /* Point the instance iterator at the current font family. */ |
| 7196 | if (FMResetFontFamilyInstanceIterator (ff, &ffii) != noErr) | 7276 | if (FMResetFontFamilyInstanceIterator (ff, &ffii) != noErr) |
| 7197 | break; | 7277 | continue; |
| 7198 | 7278 | ||
| 7199 | while (FMGetNextFontFamilyInstance (&ffii, &font, &style, &size) | 7279 | while (FMGetNextFontFamilyInstance (&ffii, &font, &style, &size) |
| 7200 | == noErr) | 7280 | == noErr) |
| @@ -7203,27 +7283,7 @@ init_font_name_table () | |||
| 7203 | 7283 | ||
| 7204 | if (size > 0 || style == normal) | 7284 | if (size > 0 || style == normal) |
| 7205 | for (; !NILP (rest); rest = XCDR (rest)) | 7285 | for (; !NILP (rest); rest = XCDR (rest)) |
| 7206 | { | 7286 | add_mac_font_name (name, size, style, SDATA (XCAR (rest))); |
| 7207 | char *cs = SDATA (XCAR (rest)); | ||
| 7208 | |||
| 7209 | if (size == 0) | ||
| 7210 | { | ||
| 7211 | add_font_name_table_entry (mac_to_x_fontname (name, size, | ||
| 7212 | style, cs)); | ||
| 7213 | add_font_name_table_entry (mac_to_x_fontname (name, size, | ||
| 7214 | italic, cs)); | ||
| 7215 | add_font_name_table_entry (mac_to_x_fontname (name, size, | ||
| 7216 | bold, cs)); | ||
| 7217 | add_font_name_table_entry (mac_to_x_fontname (name, size, | ||
| 7218 | italic | bold, | ||
| 7219 | cs)); | ||
| 7220 | } | ||
| 7221 | else | ||
| 7222 | { | ||
| 7223 | add_font_name_table_entry (mac_to_x_fontname (name, size, | ||
| 7224 | style, cs)); | ||
| 7225 | } | ||
| 7226 | } | ||
| 7227 | } | 7287 | } |
| 7228 | } | 7288 | } |
| 7229 | 7289 | ||
| @@ -7243,7 +7303,7 @@ init_font_name_table () | |||
| 7243 | Str255 name; | 7303 | Str255 name; |
| 7244 | struct FontAssoc *fat; | 7304 | struct FontAssoc *fat; |
| 7245 | struct AsscEntry *assc_entry; | 7305 | struct AsscEntry *assc_entry; |
| 7246 | Lisp_Object text_encoding_info_alist, text_encoding_info; | 7306 | Lisp_Object text_encoding_info_alist, text_encoding_info, family; |
| 7247 | struct gcpro gcpro1; | 7307 | struct gcpro gcpro1; |
| 7248 | 7308 | ||
| 7249 | GetPort (&port); /* save the current font number used */ | 7309 | GetPort (&port); /* save the current font number used */ |
| @@ -7262,7 +7322,7 @@ init_font_name_table () | |||
| 7262 | GetResInfo (font_handle, &id, &type, name); | 7322 | GetResInfo (font_handle, &id, &type, name); |
| 7263 | GetFNum (name, &fontnum); | 7323 | GetFNum (name, &fontnum); |
| 7264 | p2cstr (name); | 7324 | p2cstr (name); |
| 7265 | if (fontnum == 0) | 7325 | if (fontnum == 0 || *name == '.') |
| 7266 | continue; | 7326 | continue; |
| 7267 | 7327 | ||
| 7268 | TextFont (fontnum); | 7328 | TextFont (fontnum); |
| @@ -7274,8 +7334,10 @@ init_font_name_table () | |||
| 7274 | text_encoding_info_alist); | 7334 | text_encoding_info_alist); |
| 7275 | decode_mac_font_name (name, sizeof (name), | 7335 | decode_mac_font_name (name, sizeof (name), |
| 7276 | XCAR (XCDR (text_encoding_info))); | 7336 | XCAR (XCDR (text_encoding_info))); |
| 7277 | fm_font_family_alist = Fcons (Fcons (build_string (name), | 7337 | family = build_string (name); |
| 7278 | make_number (fontnum)), | 7338 | if (!NILP (Fassoc (family, fm_font_family_alist))) |
| 7339 | continue; | ||
| 7340 | fm_font_family_alist = Fcons (Fcons (family, make_number (fontnum)), | ||
| 7279 | fm_font_family_alist); | 7341 | fm_font_family_alist); |
| 7280 | do | 7342 | do |
| 7281 | { | 7343 | { |
| @@ -7296,14 +7358,9 @@ init_font_name_table () | |||
| 7296 | Lisp_Object rest = XCDR (XCDR (text_encoding_info)); | 7358 | Lisp_Object rest = XCDR (XCDR (text_encoding_info)); |
| 7297 | 7359 | ||
| 7298 | for (; !NILP (rest); rest = XCDR (rest)) | 7360 | for (; !NILP (rest); rest = XCDR (rest)) |
| 7299 | { | 7361 | add_mac_font_name (name, assc_entry->fontSize, |
| 7300 | char *cs = SDATA (XCAR (rest)); | 7362 | assc_entry->fontStyle, |
| 7301 | 7363 | SDATA (XCAR (rest))); | |
| 7302 | add_font_name_table_entry (mac_to_x_fontname (name, | ||
| 7303 | assc_entry->fontSize, | ||
| 7304 | assc_entry->fontStyle, | ||
| 7305 | cs)); | ||
| 7306 | } | ||
| 7307 | } | 7364 | } |
| 7308 | } | 7365 | } |
| 7309 | 7366 | ||
| @@ -7771,10 +7828,10 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 7771 | font->min_char_or_byte2 = 0; | 7828 | font->min_char_or_byte2 = 0; |
| 7772 | font->max_char_or_byte2 = 0xff; | 7829 | font->max_char_or_byte2 = 0xff; |
| 7773 | 7830 | ||
| 7774 | font->bounds.rows = xmalloc (sizeof (XCharStructRow *) * 0x100); | 7831 | font->bounds.rows = xmalloc (sizeof (XCharStruct *) * 0x100); |
| 7775 | bzero (font->bounds.rows, sizeof (XCharStructRow *) * 0x100); | 7832 | bzero (font->bounds.rows, sizeof (XCharStruct *) * 0x100); |
| 7776 | font->bounds.rows[0] = xmalloc (sizeof (XCharStructRow)); | 7833 | font->bounds.rows[0] = xmalloc (sizeof (XCharStruct) * 0x100); |
| 7777 | bzero (font->bounds.rows[0], sizeof (XCharStructRow)); | 7834 | pcm_init (font->bounds.rows[0], 0x100); |
| 7778 | 7835 | ||
| 7779 | #if USE_CG_TEXT_DRAWING | 7836 | #if USE_CG_TEXT_DRAWING |
| 7780 | { | 7837 | { |
| @@ -7800,7 +7857,7 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 7800 | bzero (font->cg_glyphs, sizeof (CGGlyph) * 0x100); | 7857 | bzero (font->cg_glyphs, sizeof (CGGlyph) * 0x100); |
| 7801 | } | 7858 | } |
| 7802 | #endif | 7859 | #endif |
| 7803 | space_bounds = font->bounds.rows[0]->per_char + 0x20; | 7860 | space_bounds = font->bounds.rows[0] + 0x20; |
| 7804 | err = mac_query_char_extents (font->mac_style, 0x20, | 7861 | err = mac_query_char_extents (font->mac_style, 0x20, |
| 7805 | &font->ascent, &font->descent, | 7862 | &font->ascent, &font->descent, |
| 7806 | space_bounds, | 7863 | space_bounds, |
| @@ -7816,9 +7873,8 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 7816 | mac_unload_font (&one_mac_display_info, font); | 7873 | mac_unload_font (&one_mac_display_info, font); |
| 7817 | return NULL; | 7874 | return NULL; |
| 7818 | } | 7875 | } |
| 7819 | XCHARSTRUCTROW_SET_CHAR_VALID (font->bounds.rows[0], 0x20); | ||
| 7820 | 7876 | ||
| 7821 | pcm = font->bounds.rows[0]->per_char; | 7877 | pcm = font->bounds.rows[0]; |
| 7822 | for (c = 0x21; c <= 0xff; c++) | 7878 | for (c = 0x21; c <= 0xff; c++) |
| 7823 | { | 7879 | { |
| 7824 | if (c == 0xad) | 7880 | if (c == 0xad) |
| @@ -7838,7 +7894,6 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 7838 | NULL | 7894 | NULL |
| 7839 | #endif | 7895 | #endif |
| 7840 | ); | 7896 | ); |
| 7841 | XCHARSTRUCTROW_SET_CHAR_VALID (font->bounds.rows[0], c); | ||
| 7842 | 7897 | ||
| 7843 | #if USE_CG_TEXT_DRAWING | 7898 | #if USE_CG_TEXT_DRAWING |
| 7844 | if (font->cg_glyphs && font->cg_glyphs[c] == 0) | 7899 | if (font->cg_glyphs && font->cg_glyphs[c] == 0) |
| @@ -10024,8 +10079,20 @@ XTread_socket (sd, expected, hold_quit) | |||
| 10024 | } | 10079 | } |
| 10025 | break; | 10080 | break; |
| 10026 | 10081 | ||
| 10082 | #if TARGET_API_MAC_CARBON | ||
| 10083 | case inProxyIcon: | ||
| 10084 | if (TrackWindowProxyDrag (window_ptr, er.where) | ||
| 10085 | != errUserWantsToDragWindow) | ||
| 10086 | break; | ||
| 10087 | /* fall through */ | ||
| 10088 | #endif | ||
| 10027 | case inDrag: | 10089 | case inDrag: |
| 10028 | #if TARGET_API_MAC_CARBON | 10090 | #if TARGET_API_MAC_CARBON |
| 10091 | if (IsWindowPathSelectClick (window_ptr, &er)) | ||
| 10092 | { | ||
| 10093 | WindowPathSelect (window_ptr, NULL, NULL); | ||
| 10094 | break; | ||
| 10095 | } | ||
| 10029 | DragWindow (window_ptr, er.where, NULL); | 10096 | DragWindow (window_ptr, er.where, NULL); |
| 10030 | #else /* not TARGET_API_MAC_CARBON */ | 10097 | #else /* not TARGET_API_MAC_CARBON */ |
| 10031 | DragWindow (window_ptr, er.where, &qd.screenBits.bounds); | 10098 | DragWindow (window_ptr, er.where, &qd.screenBits.bounds); |
| @@ -11076,7 +11143,11 @@ button will be mouse-3. */); | |||
| 11076 | doc: /* *If non-nil, allow anti-aliasing. | 11143 | doc: /* *If non-nil, allow anti-aliasing. |
| 11077 | The text will be rendered using Core Graphics text rendering which | 11144 | The text will be rendered using Core Graphics text rendering which |
| 11078 | may anti-alias the text. */); | 11145 | may anti-alias the text. */); |
| 11146 | #if USE_CG_DRAWING | ||
| 11147 | mac_use_core_graphics = 1; | ||
| 11148 | #else | ||
| 11079 | mac_use_core_graphics = 0; | 11149 | mac_use_core_graphics = 0; |
| 11150 | #endif | ||
| 11080 | 11151 | ||
| 11081 | /* Register an entry for `mac-roman' so that it can be used when | 11152 | /* Register an entry for `mac-roman' so that it can be used when |
| 11082 | creating the terminal frame on Mac OS 9 before loading | 11153 | creating the terminal frame on Mac OS 9 before loading |