/[emacs]/emacs/src/w32fns.c
ViewVC logotype

Diff of /emacs/src/w32fns.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.219 by jasonr, Sun Jul 6 21:58:12 2003 UTC revision 1.219.2.1 by jasonr, Sat Oct 11 22:35:25 2003 UTC
# Line 29  Boston, MA 02111-1307, USA.  */ Line 29  Boston, MA 02111-1307, USA.  */
29  #include <errno.h>  #include <errno.h>
30    
31  #include "lisp.h"  #include "lisp.h"
 #include "charset.h"  
 #include "dispextern.h"  
32  #include "w32term.h"  #include "w32term.h"
 #include "keyboard.h"  
33  #include "frame.h"  #include "frame.h"
34  #include "window.h"  #include "window.h"
35  #include "buffer.h"  #include "buffer.h"
 #include "fontset.h"  
36  #include "intervals.h"  #include "intervals.h"
37    #include "dispextern.h"
38    #include "keyboard.h"
39  #include "blockinput.h"  #include "blockinput.h"
40  #include "epaths.h"  #include "epaths.h"
41  #include "w32heap.h"  #include "character.h"
42  #include "termhooks.h"  #include "charset.h"
43  #include "coding.h"  #include "coding.h"
44  #include "ccl.h"  #include "ccl.h"
45    #include "fontset.h"
46  #include "systime.h"  #include "systime.h"
47    #include "termhooks.h"
48    #include "w32heap.h"
49    
50  #include "bitmaps/gray.xbm"  #include "bitmaps/gray.xbm"
51    
# Line 4399  This function is an internal primitive-- Line 4400  This function is an internal primitive--
4400        {        {
4401          tem = Fquery_fontset (font, Qnil);          tem = Fquery_fontset (font, Qnil);
4402          if (STRINGP (tem))          if (STRINGP (tem))
4403            font = x_new_fontset (f, SDATA (tem));            font = x_new_fontset (f, tem);
4404          else          else
4405            font = x_new_font (f, SDATA (font));            font = x_new_font (f, SDATA (font));
4406        }        }
# Line 4784  w32_load_system_font (f,fontname,size) Line 4785  w32_load_system_font (f,fontname,size)
4785    
4786      /* Now fill in the slots of *FONTP.  */      /* Now fill in the slots of *FONTP.  */
4787      BLOCK_INPUT;      BLOCK_INPUT;
4788        bzero (fontp, sizeof (*fontp));
4789      fontp->font = font;      fontp->font = font;
4790      fontp->font_idx = i;      fontp->font_idx = i;
4791      fontp->name = (char *) xmalloc (strlen (fontname) + 1);      fontp->name = (char *) xmalloc (strlen (fontname) + 1);
4792      bcopy (fontname, fontp->name, strlen (fontname) + 1);      bcopy (fontname, fontp->name, strlen (fontname) + 1);
4793    
4794        fontp->charset = charset_unicode;
4795      charset = xlfd_charset_of_font (fontname);      charset = xlfd_charset_of_font (fontname);
4796    
4797    /* Cache the W32 codepage for a font.  This makes w32_encode_char    /* Cache the W32 codepage for a font.  This makes w32_encode_char
# Line 4815  w32_load_system_font (f,fontname,size) Line 4818  w32_load_system_font (f,fontname,size)
4818         (0:0x20..0x7F, 1:0xA0..0xFF,         (0:0x20..0x7F, 1:0xA0..0xFF,
4819         (0:0x2020..0x7F7F, 1:0xA0A0..0xFFFF, 3:0x20A0..0x7FFF,         (0:0x2020..0x7F7F, 1:0xA0A0..0xFFFF, 3:0x20A0..0x7FFF,
4820         2:0xA020..0xFF7F).  For the moment, we don't know which charset         2:0xA020..0xFF7F).  For the moment, we don't know which charset
4821         uses this font.  So, we set information in fontp->encoding[1]         uses this font.  So, we set information in fontp->encoding_type
4822         which is never used by any charset.  If mapping can't be         which is never used by any charset.  If mapping can't be
4823         decided, set FONT_ENCODING_NOT_DECIDED.  */         decided, set FONT_ENCODING_NOT_DECIDED.  */
4824    
# Line 4823  w32_load_system_font (f,fontname,size) Line 4826  w32_load_system_font (f,fontname,size)
4826         type FONT_ENCODING_NOT_DECIDED.  */         type FONT_ENCODING_NOT_DECIDED.  */
4827      encoding = strrchr (fontp->name, '-');      encoding = strrchr (fontp->name, '-');
4828      if (encoding && strnicmp (encoding+1, "sjis", 4) == 0)      if (encoding && strnicmp (encoding+1, "sjis", 4) == 0)
4829        fontp->encoding[1] = 4;        fontp->encoding_type = 4;
4830      else      else
4831        fontp->encoding[1] = FONT_ENCODING_NOT_DECIDED;        fontp->encoding_type = FONT_ENCODING_NOT_DECIDED;
4832    
4833      /* The following three values are set to 0 under W32, which is      /* The following three values are set to 0 under W32, which is
4834         what they get set to if XGetFontProperty fails under X.  */         what they get set to if XGetFontProperty fails under X.  */
# Line 5403  w32_to_x_font (lplogfont, lpxstr, len, s Line 5406  w32_to_x_font (lplogfont, lpxstr, len, s
5406    char *fontname_dash;    char *fontname_dash;
5407    int display_resy = (int) one_w32_display_info.resy;    int display_resy = (int) one_w32_display_info.resy;
5408    int display_resx = (int) one_w32_display_info.resx;    int display_resx = (int) one_w32_display_info.resx;
   int bufsz;  
5409    struct coding_system coding;    struct coding_system coding;
5410    
5411    if (!lpxstr) abort ();    if (!lpxstr) abort ();
# Line 5425  w32_to_x_font (lplogfont, lpxstr, len, s Line 5427  w32_to_x_font (lplogfont, lpxstr, len, s
5427    coding.mode |= CODING_MODE_LAST_BLOCK;    coding.mode |= CODING_MODE_LAST_BLOCK;
5428    /* We explicitely disable composition handling because selection    /* We explicitely disable composition handling because selection
5429       data should not contain any composition sequence.  */       data should not contain any composition sequence.  */
5430    coding.composing = COMPOSITION_DISABLED;    coding.common_flags &= ~CODING_ANNOTATION_MASK;
5431    bufsz = decoding_buffer_size (&coding, LF_FACESIZE);  
5432      coding.dst_bytes = LF_FACESIZE * 2;
5433      coding.destination = (unsigned char *) xmalloc (coding.dst_bytes + 1);
5434      decode_coding_c_string (&coding, lplogfont->lfFaceName,
5435                              strlen(lplogfont->lfFaceName), Qnil);
5436      fontname = coding.destination;
5437    
   fontname = alloca(sizeof(*fontname) * bufsz);  
   decode_coding (&coding, lplogfont->lfFaceName, fontname,  
                  strlen(lplogfont->lfFaceName), bufsz - 1);  
5438    *(fontname + coding.produced) = '\0';    *(fontname + coding.produced) = '\0';
5439    
5440    /* Replace dashes with underscores so the dashes are not    /* Replace dashes with underscores so the dashes are not
# Line 5549  x_to_w32_font (lpxstr, lplogfont) Line 5553  x_to_w32_font (lpxstr, lplogfont)
5553    
5554        if (fields > 0 && name[0] != '*')        if (fields > 0 && name[0] != '*')
5555          {          {
           int bufsize;  
           unsigned char *buf;  
   
5556            setup_coding_system            setup_coding_system
5557              (Fcheck_coding_system (Vlocale_coding_system), &coding);              (Fcheck_coding_system (Vlocale_coding_system), &coding);
5558            coding.src_multibyte = 1;            coding.src_multibyte = 1;
5559            coding.dst_multibyte = 1;            coding.dst_multibyte = 1;
5560            bufsize = encoding_buffer_size (&coding, strlen (name));            coding.dst_bytes = strlen (name) * 2;
5561            buf = (unsigned char *) alloca (bufsize);            coding.destination = (unsigned char *) xmalloc (coding.dst_bytes);
5562            coding.mode |= CODING_MODE_LAST_BLOCK;            coding.mode |= CODING_MODE_LAST_BLOCK;
5563            encode_coding (&coding, name, buf, strlen (name), bufsize);            encode_coding_object (&coding, build_string (name), 0, 0,
5564                                    strlen (name), coding.dst_bytes, Qnil);
5565            if (coding.produced >= LF_FACESIZE)            if (coding.produced >= LF_FACESIZE)
5566              coding.produced = LF_FACESIZE - 1;              coding.produced = LF_FACESIZE - 1;
5567            buf[coding.produced] = 0;  
5568            strcpy (lplogfont->lfFaceName, buf);            coding.destination[coding.produced] = '\0';
5569    
5570              strcpy (lplogfont->lfFaceName, coding.destination);
5571              xfree (coding.destination);
5572          }          }
5573        else        else
5574          {          {
# Line 12848  x_create_tip_frame (dpyinfo, parms, text Line 12853  x_create_tip_frame (dpyinfo, parms, text
12853        {        {
12854          tem = Fquery_fontset (font, Qnil);          tem = Fquery_fontset (font, Qnil);
12855          if (STRINGP (tem))          if (STRINGP (tem))
12856            font = x_new_fontset (f, SDATA (tem));            font = x_new_fontset (f, tem);
12857          else          else
12858            font = x_new_font (f, SDATA (font));            font = x_new_font (f, SDATA (font));
12859        }        }
# Line 14390  versions of Windows) characters.  */); Line 14395  versions of Windows) characters.  */);
14395    find_ccl_program_func = w32_find_ccl_program;    find_ccl_program_func = w32_find_ccl_program;
14396    query_font_func = w32_query_font;    query_font_func = w32_query_font;
14397    set_frame_fontset_func = x_set_font;    set_frame_fontset_func = x_set_font;
14398      get_font_repertory_func = x_get_font_repertory;
14399    check_window_system_func = check_w32;    check_window_system_func = check_w32;
14400    
14401    /* Images.  */    /* Images.  */

Legend:
Removed from v.1.219  
changed lines
  Added in v.1.219.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26