113 |
FONT-LIST-CACHE records previous values returned by x-list-fonts. */ |
FONT-LIST-CACHE records previous values returned by x-list-fonts. */ |
114 |
Lisp_Object w32_display_name_list; |
Lisp_Object w32_display_name_list; |
115 |
|
|
116 |
|
|
117 |
|
#ifndef GLYPHSET |
118 |
|
/* Pre Windows 2000, this was not available, but define it here so |
119 |
|
that Emacs compiled on such a platform will run on newer versions. */ |
120 |
|
|
121 |
|
typedef struct tagWCRANGE |
122 |
|
{ |
123 |
|
WCHAR wcLow; |
124 |
|
USHORT cGlyphs; |
125 |
|
} WCRANGE; |
126 |
|
|
127 |
|
typedef struct tagGLYPHSET |
128 |
|
{ |
129 |
|
DWORD cbThis; |
130 |
|
DWORD flAccel; |
131 |
|
DWORD cGlyphsSupported; |
132 |
|
DWORD cRanges; |
133 |
|
WCRANGE ranges[1]; |
134 |
|
} GLYPHSET; |
135 |
|
|
136 |
|
#endif |
137 |
|
|
138 |
|
/* Dynamic linking to GetFontUnicodeRanges (not available on 95, 98, ME). */ |
139 |
|
DWORD (PASCAL *pfnGetFontUnicodeRanges) (HDC device, GLYPHSET *ranges); |
140 |
|
|
141 |
/* Frame being updated by update_frame. This is declared in term.c. |
/* Frame being updated by update_frame. This is declared in term.c. |
142 |
This is set by update_begin and looked at by all the |
This is set by update_begin and looked at by all the |
143 |
w32 functions. It is zero while not inside an update. |
w32 functions. It is zero while not inside an update. |
1044 |
XFontStruct *font = font_info->font; |
XFontStruct *font = font_info->font; |
1045 |
|
|
1046 |
internal_two_byte_p = w32_font_is_double_byte (font); |
internal_two_byte_p = w32_font_is_double_byte (font); |
1047 |
|
codepage = font_info->codepage; |
1048 |
|
|
1049 |
|
/* If font can output unicode, use the original unicode character. */ |
1050 |
|
if ( font && !font->bdf && w32_use_unicode_for_codepage (codepage) |
1051 |
|
&& c >= 0x100) |
1052 |
|
{ |
1053 |
|
*char2b = c; |
1054 |
|
unicode_p = 1; |
1055 |
|
internal_two_byte_p = 1; |
1056 |
|
} |
1057 |
|
|
1058 |
/* FONT_INFO may define a scheme by which to encode byte1 and byte2. |
/* FONT_INFO may define a scheme by which to encode byte1 and byte2. |
1059 |
This may be either a program in a special encoder language or a |
This may be either a program in a special encoder language or a |
1060 |
fixed encoding. */ |
fixed encoding. */ |
1061 |
if (font_info->font_encoder) |
else if (font_info->font_encoder) |
1062 |
{ |
{ |
1063 |
/* It's a program. */ |
/* It's a program. */ |
1064 |
struct ccl_program *ccl = font_info->font_encoder; |
struct ccl_program *ccl = font_info->font_encoder; |
1095 |
&& CHARSET_DIMENSION (charset) == 2) |
&& CHARSET_DIMENSION (charset) == 2) |
1096 |
STORE_XCHAR2B (char2b, XCHAR2B_BYTE1 (char2b) | 0x80, XCHAR2B_BYTE2 (char2b)); |
STORE_XCHAR2B (char2b, XCHAR2B_BYTE1 (char2b) | 0x80, XCHAR2B_BYTE2 (char2b)); |
1097 |
|
|
1098 |
if (enc == 1 || enc == 3 |
if (enc == 1 || enc == 3 || (enc == 4 && CHARSET_DIMENSION (charset) == 1)) |
|
|| (enc == 4 && CHARSET_DIMENSION (charset) == 1)) |
|
1099 |
STORE_XCHAR2B (char2b, XCHAR2B_BYTE1 (char2b), XCHAR2B_BYTE2 (char2b) | 0x80); |
STORE_XCHAR2B (char2b, XCHAR2B_BYTE1 (char2b), XCHAR2B_BYTE2 (char2b) | 0x80); |
1100 |
else if (enc == 4) |
else if (enc == 4) |
1101 |
{ |
{ |
1102 |
int code = (int) char2b; |
int code = (int) (*char2b); |
1103 |
|
|
1104 |
JIS_TO_SJIS (code); |
JIS_TO_SJIS (code); |
1105 |
STORE_XCHAR2B (char2b, (code >> 8), (code & 0xFF)); |
STORE_XCHAR2B (char2b, (code >> 8), (code & 0xFF)); |
1106 |
} |
} |
1107 |
} |
} |
|
codepage = font_info->codepage; |
|
|
|
|
|
/* If charset is not ASCII or Latin-1, may need to move it into |
|
|
Unicode space. */ |
|
|
if ( font && !font->bdf && w32_use_unicode_for_codepage (codepage) |
|
|
&& c >= 0x100) |
|
|
{ |
|
|
char temp[3]; |
|
|
temp[0] = XCHAR2B_BYTE1 (char2b); |
|
|
temp[1] = XCHAR2B_BYTE2 (char2b); |
|
|
temp[2] = '\0'; |
|
|
if (codepage != CP_UNICODE) |
|
|
{ |
|
|
if (temp[0]) |
|
|
MultiByteToWideChar (codepage, 0, temp, 2, char2b, 1); |
|
|
else |
|
|
MultiByteToWideChar (codepage, 0, temp+1, 1, char2b, 1); |
|
|
} |
|
|
unicode_p = 1; |
|
|
internal_two_byte_p = 1; |
|
|
} |
|
1108 |
|
|
1109 |
if (two_byte_p) |
if (two_byte_p) |
1110 |
*two_byte_p = internal_two_byte_p; |
*two_byte_p = internal_two_byte_p; |
1133 |
FRAME_PTR f; |
FRAME_PTR f; |
1134 |
struct font_info *font_info; |
struct font_info *font_info; |
1135 |
{ |
{ |
|
#if 0 /* TODO: New function, convert to Windows. */ |
|
1136 |
XFontStruct *font = (XFontStruct *) font_info->font; |
XFontStruct *font = (XFontStruct *) font_info->font; |
1137 |
Lisp_Object table; |
Lisp_Object table; |
1138 |
int min_byte1, max_byte1, min_byte2, max_byte2; |
int min_byte1, max_byte1, min_byte2, max_byte2; |
1139 |
|
|
1140 |
table = Fmake_char_table (Qnil, Qnil); |
table = Fmake_char_table (Qnil, Qnil); |
1141 |
|
|
1142 |
|
if (!font->bdf && pfnGetFontUnicodeRanges) |
1143 |
|
{ |
1144 |
|
GLYPHSET *glyphset; |
1145 |
|
DWORD glyphset_size; |
1146 |
|
HDC display = get_frame_dc (f); |
1147 |
|
HFONT prev_font; |
1148 |
|
int i; |
1149 |
|
|
1150 |
|
prev_font = SelectObject (display, font->hfont); |
1151 |
|
|
1152 |
|
/* First call GetFontUnicodeRanges to find out how big a structure |
1153 |
|
we need. */ |
1154 |
|
glyphset_size = pfnGetFontUnicodeRanges (display, NULL); |
1155 |
|
if (glyphset_size) |
1156 |
|
{ |
1157 |
|
glyphset = (GLYPHSET *) alloca (glyphset_size); |
1158 |
|
glyphset->cbThis = glyphset_size; |
1159 |
|
|
1160 |
|
/* Now call it again to get the ranges. */ |
1161 |
|
glyphset_size = pfnGetFontUnicodeRanges (display, glyphset); |
1162 |
|
|
1163 |
|
if (glyphset_size) |
1164 |
|
{ |
1165 |
|
/* Store the ranges in TABLE. */ |
1166 |
|
for (i = 0; i < glyphset->cRanges; i++) |
1167 |
|
{ |
1168 |
|
int from = glyphset->ranges[i].wcLow; |
1169 |
|
int to = from + glyphset->ranges[i].cGlyphs - 1; |
1170 |
|
char_table_set_range (table, from, to, Qt); |
1171 |
|
} |
1172 |
|
} |
1173 |
|
} |
1174 |
|
|
1175 |
|
SelectObject (display, prev_font); |
1176 |
|
release_frame_dc (f, display); |
1177 |
|
|
1178 |
|
/* If we got the information we wanted above, then return it. */ |
1179 |
|
if (glyphset_size) |
1180 |
|
return table; |
1181 |
|
} |
1182 |
|
|
1183 |
|
#if 0 /* TODO: Convert to work on Windows so BDF and older platforms work. */ |
1184 |
|
/* When GetFontUnicodeRanges is not available or does not work, |
1185 |
|
work it out manually. */ |
1186 |
min_byte1 = font->min_byte1; |
min_byte1 = font->min_byte1; |
1187 |
max_byte1 = font->max_byte1; |
max_byte1 = font->max_byte1; |
1188 |
min_byte2 = font->min_char_or_byte2; |
min_byte2 = font->min_char_or_byte2; |
1255 |
} |
} |
1256 |
} |
} |
1257 |
} |
} |
|
|
|
|
return table; |
|
|
#else |
|
|
return Fmake_char_table (Qnil, Qnil); |
|
1258 |
#endif |
#endif |
1259 |
|
return table; |
1260 |
} |
} |
1261 |
|
|
1262 |
|
|
6591 |
/* Dynamically link to optional system components. */ |
/* Dynamically link to optional system components. */ |
6592 |
{ |
{ |
6593 |
HANDLE user_lib = LoadLibrary ("user32.dll"); |
HANDLE user_lib = LoadLibrary ("user32.dll"); |
6594 |
|
HANDLE gdi_lib = LoadLibrary ("gdi32.dll"); |
6595 |
|
|
6596 |
#define LOAD_PROC(fn) pfn##fn = (void *) GetProcAddress (user_lib, #fn) |
#define LOAD_PROC(lib, fn) pfn##fn = (void *) GetProcAddress (lib, #fn) |
6597 |
|
|
6598 |
/* New proportional scroll bar functions. */ |
/* New proportional scroll bar functions. */ |
6599 |
LOAD_PROC (SetScrollInfo); |
LOAD_PROC (user_lib, SetScrollInfo); |
6600 |
LOAD_PROC (GetScrollInfo); |
LOAD_PROC (user_lib, GetScrollInfo); |
6601 |
|
LOAD_PROC (gdi_lib, GetFontUnicodeRanges); |
6602 |
|
|
6603 |
#undef LOAD_PROC |
#undef LOAD_PROC |
6604 |
|
|
6605 |
FreeLibrary (user_lib); |
FreeLibrary (user_lib); |
6606 |
|
FreeLibrary (gdi_lib); |
6607 |
|
|
6608 |
/* If using proportional scroll bars, ensure handle is at least 5 pixels; |
/* If using proportional scroll bars, ensure handle is at least 5 pixels; |
6609 |
otherwise use the fixed height. */ |
otherwise use the fixed height. */ |