diff options
| author | Jason Rumney | 2002-01-20 14:57:54 +0000 |
|---|---|---|
| committer | Jason Rumney | 2002-01-20 14:57:54 +0000 |
| commit | d84b082dd4d272fc6f41c7b84ee0393fc20dbe7e (patch) | |
| tree | a794e79072cba7876bd39b6e8cc99ae4b8d3807f | |
| parent | 73dc743ce981ff5e92d13b99262addeeef5ec2b5 (diff) | |
| download | emacs-d84b082dd4d272fc6f41c7b84ee0393fc20dbe7e.tar.gz emacs-d84b082dd4d272fc6f41c7b84ee0393fc20dbe7e.zip | |
(w32_load_system_font, w32_to_x_charset): Use strnicmp
in place of stricmp.
(w32_list_synthesized_fonts): Removed.
(w32_to_all_x_charsets, enum_font_maybe_add_to_list): New functions.
(struct enumfont_t): New element; list.
(enum_font_cb2): List all style and charset variations of a font.
(Fw32_select_font): New optional argument; include_proportional.
Exclude vertical fonts. Exclude proportional fonts unless
include_proportional is non-nil.
(w32_enable_synthesized_fonts): Change to a boolean.
(Fw32_send_sys_command): Doc fix.
| -rw-r--r-- | src/w32fns.c | 317 |
1 files changed, 230 insertions, 87 deletions
diff --git a/src/w32fns.c b/src/w32fns.c index 45e35267e25..e2a0f96331d 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -129,7 +129,7 @@ Lisp_Object Vw32_scroll_lock_modifier; | |||
| 129 | 129 | ||
| 130 | /* Switch to control whether we inhibit requests for synthesized bold | 130 | /* Switch to control whether we inhibit requests for synthesized bold |
| 131 | and italic versions of fonts. */ | 131 | and italic versions of fonts. */ |
| 132 | Lisp_Object Vw32_enable_synthesized_fonts; | 132 | int w32_enable_synthesized_fonts; |
| 133 | 133 | ||
| 134 | /* Enable palette management. */ | 134 | /* Enable palette management. */ |
| 135 | Lisp_Object Vw32_enable_palette; | 135 | Lisp_Object Vw32_enable_palette; |
| @@ -5913,7 +5913,7 @@ w32_load_system_font (f,fontname,size) | |||
| 5913 | /* SJIS fonts need to be set to type 4, all others seem to work as | 5913 | /* SJIS fonts need to be set to type 4, all others seem to work as |
| 5914 | type FONT_ENCODING_NOT_DECIDED. */ | 5914 | type FONT_ENCODING_NOT_DECIDED. */ |
| 5915 | encoding = strrchr (fontp->name, '-'); | 5915 | encoding = strrchr (fontp->name, '-'); |
| 5916 | if (encoding && stricmp (encoding+1, "sjis") == 0) | 5916 | if (encoding && strnicmp (encoding+1, "sjis", 4) == 0) |
| 5917 | fontp->encoding[1] = 4; | 5917 | fontp->encoding[1] = 4; |
| 5918 | else | 5918 | else |
| 5919 | fontp->encoding[1] = FONT_ENCODING_NOT_DECIDED; | 5919 | fontp->encoding[1] = FONT_ENCODING_NOT_DECIDED; |
| @@ -6082,7 +6082,7 @@ x_to_w32_charset (lpcs) | |||
| 6082 | 6082 | ||
| 6083 | w32_charset = Fcar (Fcdr (this_entry)); | 6083 | w32_charset = Fcar (Fcdr (this_entry)); |
| 6084 | 6084 | ||
| 6085 | // Translate Lisp symbol to number. | 6085 | /* Translate Lisp symbol to number. */ |
| 6086 | if (w32_charset == Qw32_charset_ansi) | 6086 | if (w32_charset == Qw32_charset_ansi) |
| 6087 | return ANSI_CHARSET; | 6087 | return ANSI_CHARSET; |
| 6088 | if (w32_charset == Qw32_charset_symbol) | 6088 | if (w32_charset == Qw32_charset_symbol) |
| @@ -6258,13 +6258,13 @@ w32_to_x_charset (fncharset) | |||
| 6258 | best_match = x_charset; | 6258 | best_match = x_charset; |
| 6259 | /* If this is an ISO codepage, and the best so far isn't, | 6259 | /* If this is an ISO codepage, and the best so far isn't, |
| 6260 | then this is better. */ | 6260 | then this is better. */ |
| 6261 | else if (stricmp (best_match, "iso") != 0 | 6261 | else if (strnicmp (best_match, "iso", 3) != 0 |
| 6262 | && stricmp (x_charset, "iso") == 0) | 6262 | && strnicmp (x_charset, "iso", 3) == 0) |
| 6263 | best_match = x_charset; | 6263 | best_match = x_charset; |
| 6264 | /* If both are ISO8859 codepages, choose the one with the | 6264 | /* If both are ISO8859 codepages, choose the one with the |
| 6265 | lowest number in the encoding field. */ | 6265 | lowest number in the encoding field. */ |
| 6266 | else if (stricmp (best_match, "iso8859-") == 0 | 6266 | else if (strnicmp (best_match, "iso8859-", 8) == 0 |
| 6267 | && stricmp (x_charset, "iso8859-") == 0) | 6267 | && strnicmp (x_charset, "iso8859-", 8) == 0) |
| 6268 | { | 6268 | { |
| 6269 | int best_enc = atoi (best_match + 8); | 6269 | int best_enc = atoi (best_match + 8); |
| 6270 | int this_enc = atoi (x_charset + 8); | 6270 | int this_enc = atoi (x_charset + 8); |
| @@ -6288,6 +6288,142 @@ w32_to_x_charset (fncharset) | |||
| 6288 | } | 6288 | } |
| 6289 | 6289 | ||
| 6290 | 6290 | ||
| 6291 | /* Return all the X charsets that map to a font. */ | ||
| 6292 | static Lisp_Object | ||
| 6293 | w32_to_all_x_charsets (fncharset) | ||
| 6294 | int fncharset; | ||
| 6295 | { | ||
| 6296 | static char buf[32]; | ||
| 6297 | Lisp_Object charset_type; | ||
| 6298 | Lisp_Object retval = Qnil; | ||
| 6299 | |||
| 6300 | switch (fncharset) | ||
| 6301 | { | ||
| 6302 | case ANSI_CHARSET: | ||
| 6303 | /* Handle startup case of w32-charset-info-alist not | ||
| 6304 | being set up yet. */ | ||
| 6305 | if (NILP(Vw32_charset_info_alist)) | ||
| 6306 | return "iso8859-1"; | ||
| 6307 | charset_type = Qw32_charset_ansi; | ||
| 6308 | break; | ||
| 6309 | case DEFAULT_CHARSET: | ||
| 6310 | charset_type = Qw32_charset_default; | ||
| 6311 | break; | ||
| 6312 | case SYMBOL_CHARSET: | ||
| 6313 | charset_type = Qw32_charset_symbol; | ||
| 6314 | break; | ||
| 6315 | case SHIFTJIS_CHARSET: | ||
| 6316 | charset_type = Qw32_charset_shiftjis; | ||
| 6317 | break; | ||
| 6318 | case HANGEUL_CHARSET: | ||
| 6319 | charset_type = Qw32_charset_hangeul; | ||
| 6320 | break; | ||
| 6321 | case GB2312_CHARSET: | ||
| 6322 | charset_type = Qw32_charset_gb2312; | ||
| 6323 | break; | ||
| 6324 | case CHINESEBIG5_CHARSET: | ||
| 6325 | charset_type = Qw32_charset_chinesebig5; | ||
| 6326 | break; | ||
| 6327 | case OEM_CHARSET: | ||
| 6328 | charset_type = Qw32_charset_oem; | ||
| 6329 | break; | ||
| 6330 | |||
| 6331 | /* More recent versions of Windows (95 and NT4.0) define more | ||
| 6332 | character sets. */ | ||
| 6333 | #ifdef EASTEUROPE_CHARSET | ||
| 6334 | case EASTEUROPE_CHARSET: | ||
| 6335 | charset_type = Qw32_charset_easteurope; | ||
| 6336 | break; | ||
| 6337 | case TURKISH_CHARSET: | ||
| 6338 | charset_type = Qw32_charset_turkish; | ||
| 6339 | break; | ||
| 6340 | case BALTIC_CHARSET: | ||
| 6341 | charset_type = Qw32_charset_baltic; | ||
| 6342 | break; | ||
| 6343 | case RUSSIAN_CHARSET: | ||
| 6344 | charset_type = Qw32_charset_russian; | ||
| 6345 | break; | ||
| 6346 | case ARABIC_CHARSET: | ||
| 6347 | charset_type = Qw32_charset_arabic; | ||
| 6348 | break; | ||
| 6349 | case GREEK_CHARSET: | ||
| 6350 | charset_type = Qw32_charset_greek; | ||
| 6351 | break; | ||
| 6352 | case HEBREW_CHARSET: | ||
| 6353 | charset_type = Qw32_charset_hebrew; | ||
| 6354 | break; | ||
| 6355 | case VIETNAMESE_CHARSET: | ||
| 6356 | charset_type = Qw32_charset_vietnamese; | ||
| 6357 | break; | ||
| 6358 | case THAI_CHARSET: | ||
| 6359 | charset_type = Qw32_charset_thai; | ||
| 6360 | break; | ||
| 6361 | case MAC_CHARSET: | ||
| 6362 | charset_type = Qw32_charset_mac; | ||
| 6363 | break; | ||
| 6364 | case JOHAB_CHARSET: | ||
| 6365 | charset_type = Qw32_charset_johab; | ||
| 6366 | break; | ||
| 6367 | #endif | ||
| 6368 | |||
| 6369 | #ifdef UNICODE_CHARSET | ||
| 6370 | case UNICODE_CHARSET: | ||
| 6371 | charset_type = Qw32_charset_unicode; | ||
| 6372 | break; | ||
| 6373 | #endif | ||
| 6374 | default: | ||
| 6375 | /* Encode numerical value of unknown charset. */ | ||
| 6376 | sprintf (buf, "*-#%u", fncharset); | ||
| 6377 | return Fcons (build_string (buf), Qnil); | ||
| 6378 | } | ||
| 6379 | |||
| 6380 | { | ||
| 6381 | Lisp_Object rest; | ||
| 6382 | /* Look through w32-charset-info-alist for the character set. | ||
| 6383 | Only return charsets for codepages which are installed. | ||
| 6384 | |||
| 6385 | Format of each entry in Vw32_charset_info_alist is | ||
| 6386 | (CHARSET_NAME . (WINDOWS_CHARSET . CODEPAGE)). | ||
| 6387 | */ | ||
| 6388 | for (rest = Vw32_charset_info_alist; CONSP (rest); rest = XCDR (rest)) | ||
| 6389 | { | ||
| 6390 | Lisp_Object x_charset; | ||
| 6391 | Lisp_Object w32_charset; | ||
| 6392 | Lisp_Object codepage; | ||
| 6393 | |||
| 6394 | Lisp_Object this_entry = XCAR (rest); | ||
| 6395 | |||
| 6396 | /* Skip invalid entries in alist. */ | ||
| 6397 | if (!CONSP (this_entry) || !STRINGP (XCAR (this_entry)) | ||
| 6398 | || !CONSP (XCDR (this_entry)) | ||
| 6399 | || !SYMBOLP (XCAR (XCDR (this_entry)))) | ||
| 6400 | continue; | ||
| 6401 | |||
| 6402 | x_charset = XCAR (this_entry); | ||
| 6403 | w32_charset = XCAR (XCDR (this_entry)); | ||
| 6404 | codepage = XCDR (XCDR (this_entry)); | ||
| 6405 | |||
| 6406 | /* Look for Same charset and a valid codepage (or non-int | ||
| 6407 | which means ignore). */ | ||
| 6408 | if (w32_charset == charset_type | ||
| 6409 | && (!INTEGERP (codepage) || codepage == CP_DEFAULT | ||
| 6410 | || IsValidCodePage (XINT (codepage)))) | ||
| 6411 | { | ||
| 6412 | retval = Fcons (x_charset, retval); | ||
| 6413 | } | ||
| 6414 | } | ||
| 6415 | |||
| 6416 | /* If no match, encode the numeric value. */ | ||
| 6417 | if (NILP (retval)) | ||
| 6418 | { | ||
| 6419 | sprintf (buf, "*-#%u", fncharset); | ||
| 6420 | return Fcons (build_string (buf), Qnil); | ||
| 6421 | } | ||
| 6422 | |||
| 6423 | return retval; | ||
| 6424 | } | ||
| 6425 | } | ||
| 6426 | |||
| 6291 | /* Get the Windows codepage corresponding to the specified font. The | 6427 | /* Get the Windows codepage corresponding to the specified font. The |
| 6292 | charset info in the font name is used to look up | 6428 | charset info in the font name is used to look up |
| 6293 | w32-charset-to-codepage-alist. */ | 6429 | w32-charset-to-codepage-alist. */ |
| @@ -6802,9 +6938,15 @@ typedef struct enumfont_t | |||
| 6802 | LOGFONT logfont; | 6938 | LOGFONT logfont; |
| 6803 | XFontStruct *size_ref; | 6939 | XFontStruct *size_ref; |
| 6804 | Lisp_Object *pattern; | 6940 | Lisp_Object *pattern; |
| 6941 | Lisp_Object list; | ||
| 6805 | Lisp_Object *tail; | 6942 | Lisp_Object *tail; |
| 6806 | } enumfont_t; | 6943 | } enumfont_t; |
| 6807 | 6944 | ||
| 6945 | |||
| 6946 | static void | ||
| 6947 | enum_font_maybe_add_to_list (enumfont_t *, LOGFONT *, char *, Lisp_Object); | ||
| 6948 | |||
| 6949 | |||
| 6808 | static int CALLBACK | 6950 | static int CALLBACK |
| 6809 | enum_font_cb2 (lplf, lptm, FontType, lpef) | 6951 | enum_font_cb2 (lplf, lptm, FontType, lpef) |
| 6810 | ENUMLOGFONT * lplf; | 6952 | ENUMLOGFONT * lplf; |
| @@ -6832,6 +6974,7 @@ enum_font_cb2 (lplf, lptm, FontType, lpef) | |||
| 6832 | { | 6974 | { |
| 6833 | char buf[100]; | 6975 | char buf[100]; |
| 6834 | Lisp_Object width = Qnil; | 6976 | Lisp_Object width = Qnil; |
| 6977 | Lisp_Object charset_list = Qnil; | ||
| 6835 | char *charset = NULL; | 6978 | char *charset = NULL; |
| 6836 | 6979 | ||
| 6837 | /* Truetype fonts do not report their true metrics until loaded */ | 6980 | /* Truetype fonts do not report their true metrics until loaded */ |
| @@ -6866,28 +7009,83 @@ enum_font_cb2 (lplf, lptm, FontType, lpef) | |||
| 6866 | { | 7009 | { |
| 6867 | charset = xlfd_charset_of_font (XSTRING(*(lpef->pattern))->data); | 7010 | charset = xlfd_charset_of_font (XSTRING(*(lpef->pattern))->data); |
| 6868 | 7011 | ||
| 6869 | /* Ensure that charset is valid for this font. */ | 7012 | /* Ensure that charset is valid for this font. |
| 7013 | Continue if invalid in case charset contains a wildcard. */ | ||
| 6870 | if (charset | 7014 | if (charset |
| 6871 | && (x_to_w32_charset (charset) != lplf->elfLogFont.lfCharSet)) | 7015 | && (x_to_w32_charset (charset) != lplf->elfLogFont.lfCharSet)) |
| 6872 | charset = NULL; | 7016 | charset = NULL; |
| 6873 | } | 7017 | } |
| 6874 | 7018 | ||
| 6875 | /* TODO: List all relevant charsets if charset not specified. */ | 7019 | if (charset) |
| 6876 | if (!w32_to_x_font (&(lplf->elfLogFont), buf, 100, charset)) | 7020 | charset_list = Fcons (build_string (charset), Qnil); |
| 6877 | return 1; | 7021 | else |
| 7022 | charset_list = w32_to_all_x_charsets (lplf->elfLogFont.lfCharSet); | ||
| 6878 | 7023 | ||
| 6879 | if (NILP (*(lpef->pattern)) | 7024 | /* Loop through the charsets. */ |
| 6880 | || w32_font_match (buf, XSTRING (*(lpef->pattern))->data)) | 7025 | for ( ; CONSP (charset_list); charset_list = Fcdr (charset_list)) |
| 6881 | { | 7026 | { |
| 6882 | *lpef->tail = Fcons (Fcons (build_string (buf), width), Qnil); | 7027 | Lisp_Object this_charset = Fcar (charset_list); |
| 6883 | lpef->tail = &(XCDR (*lpef->tail)); | 7028 | charset = XSTRING (this_charset)->data; |
| 6884 | lpef->numFonts++; | 7029 | |
| 7030 | /* List bold and italic variations if w32-enable-synthesized-fonts | ||
| 7031 | is non-nil and this is a plain font. */ | ||
| 7032 | if (w32_enable_synthesized_fonts | ||
| 7033 | && lplf->elfLogFont.lfWeight == FW_NORMAL | ||
| 7034 | && lplf->elfLogFont.lfItalic == FALSE) | ||
| 7035 | { | ||
| 7036 | enum_font_maybe_add_to_list (lpef, &(lplf->elfLogFont), | ||
| 7037 | charset, width); | ||
| 7038 | /* bold. */ | ||
| 7039 | lplf->elfLogFont.lfWeight = FW_BOLD; | ||
| 7040 | enum_font_maybe_add_to_list (lpef, &(lplf->elfLogFont), | ||
| 7041 | charset, width); | ||
| 7042 | /* bold italic. */ | ||
| 7043 | lplf->elfLogFont.lfItalic = TRUE; | ||
| 7044 | enum_font_maybe_add_to_list (lpef, &(lplf->elfLogFont), | ||
| 7045 | charset, width); | ||
| 7046 | /* italic. */ | ||
| 7047 | lplf->elfLogFont.lfWeight = FW_NORMAL; | ||
| 7048 | enum_font_maybe_add_to_list (lpef, &(lplf->elfLogFont), | ||
| 7049 | charset, width); | ||
| 7050 | } | ||
| 7051 | else | ||
| 7052 | enum_font_maybe_add_to_list (lpef, &(lplf->elfLogFont), | ||
| 7053 | charset, width); | ||
| 6885 | } | 7054 | } |
| 6886 | } | 7055 | } |
| 6887 | 7056 | ||
| 6888 | return 1; | 7057 | return 1; |
| 6889 | } | 7058 | } |
| 6890 | 7059 | ||
| 7060 | static void | ||
| 7061 | enum_font_maybe_add_to_list (lpef, logfont, match_charset, width) | ||
| 7062 | enumfont_t * lpef; | ||
| 7063 | LOGFONT * logfont; | ||
| 7064 | char * match_charset; | ||
| 7065 | Lisp_Object width; | ||
| 7066 | { | ||
| 7067 | char buf[100]; | ||
| 7068 | |||
| 7069 | if (!w32_to_x_font (logfont, buf, 100, match_charset)) | ||
| 7070 | return; | ||
| 7071 | |||
| 7072 | if (NILP (*(lpef->pattern)) | ||
| 7073 | || w32_font_match (buf, XSTRING (*(lpef->pattern))->data)) | ||
| 7074 | { | ||
| 7075 | /* Check if we already listed this font. This may happen if | ||
| 7076 | w32_enable_synthesized_fonts is non-nil, and there are real | ||
| 7077 | bold and italic versions of the font. */ | ||
| 7078 | Lisp_Object font_name = build_string (buf); | ||
| 7079 | if (NILP (Fmember (font_name, lpef->list))) | ||
| 7080 | { | ||
| 7081 | *lpef->tail = Fcons (Fcons (build_string (buf), width), Qnil); | ||
| 7082 | lpef->tail = &(XCDR (*lpef->tail)); | ||
| 7083 | lpef->numFonts++; | ||
| 7084 | } | ||
| 7085 | } | ||
| 7086 | } | ||
| 7087 | |||
| 7088 | |||
| 6891 | static int CALLBACK | 7089 | static int CALLBACK |
| 6892 | enum_font_cb1 (lplf, lptm, FontType, lpef) | 7090 | enum_font_cb1 (lplf, lptm, FontType, lpef) |
| 6893 | ENUMLOGFONT * lplf; | 7091 | ENUMLOGFONT * lplf; |
| @@ -6970,9 +7168,6 @@ static Lisp_Object w32_list_bdf_fonts (Lisp_Object pattern, int max_names) | |||
| 6970 | return newlist; | 7168 | return newlist; |
| 6971 | } | 7169 | } |
| 6972 | 7170 | ||
| 6973 | static Lisp_Object w32_list_synthesized_fonts (FRAME_PTR f, | ||
| 6974 | Lisp_Object pattern, | ||
| 6975 | int size, int max_names); | ||
| 6976 | 7171 | ||
| 6977 | /* Return a list of names of available fonts matching PATTERN on frame | 7172 | /* Return a list of names of available fonts matching PATTERN on frame |
| 6978 | F. If SIZE is not 0, it is the size (maximum bound width) of fonts | 7173 | F. If SIZE is not 0, it is the size (maximum bound width) of fonts |
| @@ -7031,6 +7226,7 @@ w32_list_fonts (f, pattern, size, maxnames) | |||
| 7031 | /* At first, put PATTERN in the cache. */ | 7226 | /* At first, put PATTERN in the cache. */ |
| 7032 | list = Qnil; | 7227 | list = Qnil; |
| 7033 | ef.pattern = &tpat; | 7228 | ef.pattern = &tpat; |
| 7229 | ef.list = list; | ||
| 7034 | ef.tail = &list; | 7230 | ef.tail = &list; |
| 7035 | ef.numFonts = 0; | 7231 | ef.numFonts = 0; |
| 7036 | 7232 | ||
| @@ -7175,68 +7371,9 @@ w32_list_fonts (f, pattern, size, maxnames) | |||
| 7175 | newlist = Fnconc(2, combined); | 7371 | newlist = Fnconc(2, combined); |
| 7176 | } | 7372 | } |
| 7177 | 7373 | ||
| 7178 | /* If we can't find a font that matches, check if Windows would be | ||
| 7179 | able to synthesize it from a different style. */ | ||
| 7180 | if (NILP (newlist) && !NILP (Vw32_enable_synthesized_fonts)) | ||
| 7181 | newlist = w32_list_synthesized_fonts (f, pattern, size, maxnames); | ||
| 7182 | |||
| 7183 | return newlist; | 7374 | return newlist; |
| 7184 | } | 7375 | } |
| 7185 | 7376 | ||
| 7186 | static Lisp_Object | ||
| 7187 | w32_list_synthesized_fonts (f, pattern, size, max_names) | ||
| 7188 | FRAME_PTR f; | ||
| 7189 | Lisp_Object pattern; | ||
| 7190 | int size; | ||
| 7191 | int max_names; | ||
| 7192 | { | ||
| 7193 | int fields; | ||
| 7194 | char *full_pattn, *new_pattn, foundary[50], family[50], *pattn_part2; | ||
| 7195 | char style[20], slant; | ||
| 7196 | Lisp_Object matches, tem, synthed_matches = Qnil; | ||
| 7197 | |||
| 7198 | full_pattn = XSTRING (pattern)->data; | ||
| 7199 | |||
| 7200 | pattn_part2 = alloca (XSTRING (pattern)->size + 1); | ||
| 7201 | /* Allow some space for wildcard expansion. */ | ||
| 7202 | new_pattn = alloca (XSTRING (pattern)->size + 100); | ||
| 7203 | |||
| 7204 | fields = sscanf (full_pattn, "-%49[^-]-%49[^-]-%19[^-]-%c-%s", | ||
| 7205 | foundary, family, style, &slant, pattn_part2); | ||
| 7206 | if (fields == EOF || fields < 5) | ||
| 7207 | return Qnil; | ||
| 7208 | |||
| 7209 | /* If the style and slant are wildcards already there is no point | ||
| 7210 | checking again (and we don't want to keep recursing). */ | ||
| 7211 | if (*style == '*' && slant == '*') | ||
| 7212 | return Qnil; | ||
| 7213 | |||
| 7214 | sprintf (new_pattn, "-%s-%s-*-*-%s", foundary, family, pattn_part2); | ||
| 7215 | |||
| 7216 | matches = w32_list_fonts (f, build_string (new_pattn), size, max_names); | ||
| 7217 | |||
| 7218 | for ( ; CONSP (matches); matches = XCDR (matches)) | ||
| 7219 | { | ||
| 7220 | tem = XCAR (matches); | ||
| 7221 | if (!STRINGP (tem)) | ||
| 7222 | continue; | ||
| 7223 | |||
| 7224 | full_pattn = XSTRING (tem)->data; | ||
| 7225 | fields = sscanf (full_pattn, "-%49[^-]-%49[^-]-%*[^-]-%*c-%s", | ||
| 7226 | foundary, family, pattn_part2); | ||
| 7227 | if (fields == EOF || fields < 3) | ||
| 7228 | continue; | ||
| 7229 | |||
| 7230 | sprintf (new_pattn, "-%s-%s-%s-%c-%s", foundary, family, style, | ||
| 7231 | slant, pattn_part2); | ||
| 7232 | |||
| 7233 | synthed_matches = Fcons (build_string (new_pattn), | ||
| 7234 | synthed_matches); | ||
| 7235 | } | ||
| 7236 | |||
| 7237 | return synthed_matches; | ||
| 7238 | } | ||
| 7239 | |||
| 7240 | 7377 | ||
| 7241 | /* Return a pointer to struct font_info of font FONT_IDX of frame F. */ | 7378 | /* Return a pointer to struct font_info of font FONT_IDX of frame F. */ |
| 7242 | struct font_info * | 7379 | struct font_info * |
| @@ -13843,11 +13980,11 @@ specified. Ensure that file exists if MUSTMATCH is non-nil. */) | |||
| 13843 | w32 specialized functions | 13980 | w32 specialized functions |
| 13844 | ***********************************************************************/ | 13981 | ***********************************************************************/ |
| 13845 | 13982 | ||
| 13846 | DEFUN ("w32-select-font", Fw32_select_font, Sw32_select_font, 0, 1, 0, | 13983 | DEFUN ("w32-select-font", Fw32_select_font, Sw32_select_font, 0, 2, 0, |
| 13847 | doc: /* Select a font using the W32 font dialog. | 13984 | doc: /* Select a font using the W32 font dialog. |
| 13848 | Returns an X font string corresponding to the selection. */) | 13985 | Returns an X font string corresponding to the selection. */) |
| 13849 | (frame) | 13986 | (frame, include_proportional) |
| 13850 | Lisp_Object frame; | 13987 | Lisp_Object frame, include_proportional; |
| 13851 | { | 13988 | { |
| 13852 | FRAME_PTR f = check_x_frame (frame); | 13989 | FRAME_PTR f = check_x_frame (frame); |
| 13853 | CHOOSEFONT cf; | 13990 | CHOOSEFONT cf; |
| @@ -13862,7 +13999,13 @@ Returns an X font string corresponding to the selection. */) | |||
| 13862 | 13999 | ||
| 13863 | cf.lStructSize = sizeof (cf); | 14000 | cf.lStructSize = sizeof (cf); |
| 13864 | cf.hwndOwner = FRAME_W32_WINDOW (f); | 14001 | cf.hwndOwner = FRAME_W32_WINDOW (f); |
| 13865 | cf.Flags = CF_FORCEFONTEXIST | CF_SCREENFONTS; | 14002 | cf.Flags = CF_FORCEFONTEXIST | CF_SCREENFONTS | CF_NOVERTFONTS; |
| 14003 | |||
| 14004 | /* Unless include_proportional is non-nil, limit the selection to | ||
| 14005 | monospaced fonts. */ | ||
| 14006 | if (NILP (include_proportional)) | ||
| 14007 | cf.Flags |= CF_FIXEDPITCHONLY; | ||
| 14008 | |||
| 13866 | cf.lpLogFont = &lf; | 14009 | cf.lpLogFont = &lf; |
| 13867 | 14010 | ||
| 13868 | /* Initialize as much of the font details as we can from the current | 14011 | /* Initialize as much of the font details as we can from the current |
| @@ -13892,9 +14035,9 @@ Returns an X font string corresponding to the selection. */) | |||
| 13892 | DEFUN ("w32-send-sys-command", Fw32_send_sys_command, | 14035 | DEFUN ("w32-send-sys-command", Fw32_send_sys_command, |
| 13893 | Sw32_send_sys_command, 1, 2, 0, | 14036 | Sw32_send_sys_command, 1, 2, 0, |
| 13894 | doc: /* Send frame a Windows WM_SYSCOMMAND message of type COMMAND. | 14037 | doc: /* Send frame a Windows WM_SYSCOMMAND message of type COMMAND. |
| 13895 | Some useful values for command are 0xf030 to maximise frame (0xf020 | 14038 | Some useful values for command are #xf030 to maximise frame (#xf020 |
| 13896 | to minimize), 0xf120 to restore frame to original size, and 0xf100 | 14039 | to minimize), #xf120 to restore frame to original size, and #xf100 |
| 13897 | to activate the menubar for keyboard access. 0xf140 activates the | 14040 | to activate the menubar for keyboard access. #xf140 activates the |
| 13898 | screen saver if defined. | 14041 | screen saver if defined. |
| 13899 | 14042 | ||
| 13900 | If optional parameter FRAME is not specified, use selected frame. */) | 14043 | If optional parameter FRAME is not specified, use selected frame. */) |
| @@ -14497,9 +14640,9 @@ respective modifier, or nil to appear as the key `apps'. | |||
| 14497 | Any other value will cause the key to be ignored. */); | 14640 | Any other value will cause the key to be ignored. */); |
| 14498 | Vw32_apps_modifier = Qnil; | 14641 | Vw32_apps_modifier = Qnil; |
| 14499 | 14642 | ||
| 14500 | DEFVAR_LISP ("w32-enable-synthesized-fonts", &Vw32_enable_synthesized_fonts, | 14643 | DEFVAR_BOOL ("w32-enable-synthesized-fonts", &w32_enable_synthesized_fonts, |
| 14501 | doc: /* Non-nil enables selection of artificially italicized and bold fonts. */); | 14644 | doc: /* Non-nil enables selection of artificially italicized and bold fonts. */); |
| 14502 | Vw32_enable_synthesized_fonts = Qnil; | 14645 | w32_enable_synthesized_fonts = 0; |
| 14503 | 14646 | ||
| 14504 | DEFVAR_LISP ("w32-enable-palette", &Vw32_enable_palette, | 14647 | DEFVAR_LISP ("w32-enable-palette", &Vw32_enable_palette, |
| 14505 | doc: /* Non-nil enables Windows palette management to map colors exactly. */); | 14648 | doc: /* Non-nil enables Windows palette management to map colors exactly. */); |