Mercurial > emacs
comparison src/w32fns.c @ 95894:76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
* w32font.c (logfont_to_fcname): New function.
(Fx_select_font): New font dialog function compatible with
GTK/fontconfig version.
* font.c (font_style_symbolic_from_value): New function.
(font_style_symbolic): Use it.
* font.h (font_style_symbolic_from_value): Declare new function.
| author | Jason Rumney <jasonr@gnu.org> |
|---|---|
| date | Fri, 13 Jun 2008 14:29:47 +0000 |
| parents | 4390d64d3328 |
| children | efbaf6995245 |
comparison
equal
deleted
inserted
replaced
| 95893:680b6bde042b | 95894:76261fd18708 |
|---|---|
| 8193 | 8193 |
| 8194 /*********************************************************************** | 8194 /*********************************************************************** |
| 8195 w32 specialized functions | 8195 w32 specialized functions |
| 8196 ***********************************************************************/ | 8196 ***********************************************************************/ |
| 8197 | 8197 |
| 8198 DEFUN ("w32-select-font", Fw32_select_font, Sw32_select_font, 0, 2, 0, | |
| 8199 doc: /* Select a font for the named FRAME using the W32 font dialog. | |
| 8200 Return an X-style font string corresponding to the selection. | |
| 8201 | |
| 8202 If FRAME is omitted or nil, it defaults to the selected frame. | |
| 8203 If INCLUDE-PROPORTIONAL is non-nil, include proportional fonts | |
| 8204 in the font selection dialog. */) | |
| 8205 (frame, include_proportional) | |
| 8206 Lisp_Object frame, include_proportional; | |
| 8207 { | |
| 8208 FRAME_PTR f = check_x_frame (frame); | |
| 8209 CHOOSEFONT cf; | |
| 8210 LOGFONT lf; | |
| 8211 TEXTMETRIC tm; | |
| 8212 HDC hdc; | |
| 8213 HANDLE oldobj; | |
| 8214 char buf[100]; | |
| 8215 | |
| 8216 bzero (&cf, sizeof (cf)); | |
| 8217 bzero (&lf, sizeof (lf)); | |
| 8218 | |
| 8219 cf.lStructSize = sizeof (cf); | |
| 8220 cf.hwndOwner = FRAME_W32_WINDOW (f); | |
| 8221 cf.Flags = CF_FORCEFONTEXIST | CF_SCREENFONTS | CF_NOVERTFONTS; | |
| 8222 | |
| 8223 /* Unless include_proportional is non-nil, limit the selection to | |
| 8224 monospaced fonts. */ | |
| 8225 if (NILP (include_proportional)) | |
| 8226 cf.Flags |= CF_FIXEDPITCHONLY; | |
| 8227 | |
| 8228 cf.lpLogFont = &lf; | |
| 8229 | |
| 8230 /* Initialize as much of the font details as we can from the current | |
| 8231 default font. */ | |
| 8232 hdc = GetDC (FRAME_W32_WINDOW (f)); | |
| 8233 oldobj = SelectObject (hdc, FONT_COMPAT (FRAME_FONT (f))->hfont); | |
| 8234 GetTextFace (hdc, LF_FACESIZE, lf.lfFaceName); | |
| 8235 if (GetTextMetrics (hdc, &tm)) | |
| 8236 { | |
| 8237 lf.lfHeight = tm.tmInternalLeading - tm.tmHeight; | |
| 8238 lf.lfWeight = tm.tmWeight; | |
| 8239 lf.lfItalic = tm.tmItalic; | |
| 8240 lf.lfUnderline = tm.tmUnderlined; | |
| 8241 lf.lfStrikeOut = tm.tmStruckOut; | |
| 8242 lf.lfCharSet = tm.tmCharSet; | |
| 8243 cf.Flags |= CF_INITTOLOGFONTSTRUCT; | |
| 8244 } | |
| 8245 SelectObject (hdc, oldobj); | |
| 8246 ReleaseDC (FRAME_W32_WINDOW (f), hdc); | |
| 8247 | |
| 8248 if (!ChooseFont (&cf) || !w32_to_x_font (&lf, buf, 100, NULL)) | |
| 8249 return Qnil; | |
| 8250 | |
| 8251 return build_string (buf); | |
| 8252 } | |
| 8253 | |
| 8254 DEFUN ("w32-send-sys-command", Fw32_send_sys_command, | 8198 DEFUN ("w32-send-sys-command", Fw32_send_sys_command, |
| 8255 Sw32_send_sys_command, 1, 2, 0, | 8199 Sw32_send_sys_command, 1, 2, 0, |
| 8256 doc: /* Send frame a Windows WM_SYSCOMMAND message of type COMMAND. | 8200 doc: /* Send frame a Windows WM_SYSCOMMAND message of type COMMAND. |
| 8257 Some useful values for COMMAND are #xf030 to maximize frame (#xf020 | 8201 Some useful values for COMMAND are #xf030 to maximize frame (#xf020 |
| 8258 to minimize), #xf120 to restore frame to original size, and #xf100 | 8202 to minimize), #xf120 to restore frame to original size, and #xf100 |
| 9306 defsubr (&Sx_synchronize); | 9250 defsubr (&Sx_synchronize); |
| 9307 defsubr (&Sx_focus_frame); | 9251 defsubr (&Sx_focus_frame); |
| 9308 | 9252 |
| 9309 /* W32 specific functions */ | 9253 /* W32 specific functions */ |
| 9310 | 9254 |
| 9311 defsubr (&Sw32_select_font); | |
| 9312 defsubr (&Sw32_define_rgb_color); | 9255 defsubr (&Sw32_define_rgb_color); |
| 9313 defsubr (&Sw32_default_color_map); | 9256 defsubr (&Sw32_default_color_map); |
| 9314 defsubr (&Sw32_load_color_file); | 9257 defsubr (&Sw32_load_color_file); |
| 9315 defsubr (&Sw32_send_sys_command); | 9258 defsubr (&Sw32_send_sys_command); |
| 9316 defsubr (&Sw32_shell_execute); | 9259 defsubr (&Sw32_shell_execute); |
