aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Rumney2003-10-11 22:35:25 +0000
committerJason Rumney2003-10-11 22:35:25 +0000
commit10b4bc332e02b5aec49dd0cac84eb61642924568 (patch)
treef3fdf9055725896117cd774a9928e386881ff4b9 /src
parentfc0b0cffeb154aaa51cd3831dc6a6b050d0d3c1d (diff)
downloademacs-10b4bc332e02b5aec49dd0cac84eb61642924568.tar.gz
emacs-10b4bc332e02b5aec49dd0cac84eb61642924568.zip
(Fx_create_frame, x_create_tip_frame): Use new version of x_new_fontset.
(w32_load_system_font): Initialize charset as unicode. font_info.encoding becomes encoding_type. (w32_to_x_font): Use decode_coding_c_string in place of decode_coding. (x_to_w32_font): Use encode_coding_object in place of encode_coding. (syms_of_w32fns): Set get_font_repertory_func.
Diffstat (limited to 'src')
-rw-r--r--src/w32fns.c56
1 files changed, 31 insertions, 25 deletions
diff --git a/src/w32fns.c b/src/w32fns.c
index e5ec00e8651..bf271cfa449 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -29,22 +29,23 @@ Boston, MA 02111-1307, USA. */
29#include <errno.h> 29#include <errno.h>
30 30
31#include "lisp.h" 31#include "lisp.h"
32#include "charset.h"
33#include "dispextern.h"
34#include "w32term.h" 32#include "w32term.h"
35#include "keyboard.h"
36#include "frame.h" 33#include "frame.h"
37#include "window.h" 34#include "window.h"
38#include "buffer.h" 35#include "buffer.h"
39#include "fontset.h"
40#include "intervals.h" 36#include "intervals.h"
37#include "dispextern.h"
38#include "keyboard.h"
41#include "blockinput.h" 39#include "blockinput.h"
42#include "epaths.h" 40#include "epaths.h"
43#include "w32heap.h" 41#include "character.h"
44#include "termhooks.h" 42#include "charset.h"
45#include "coding.h" 43#include "coding.h"
46#include "ccl.h" 44#include "ccl.h"
45#include "fontset.h"
47#include "systime.h" 46#include "systime.h"
47#include "termhooks.h"
48#include "w32heap.h"
48 49
49#include "bitmaps/gray.xbm" 50#include "bitmaps/gray.xbm"
50 51
@@ -4399,7 +4400,7 @@ This function is an internal primitive--use `make-frame' instead. */)
4399 { 4400 {
4400 tem = Fquery_fontset (font, Qnil); 4401 tem = Fquery_fontset (font, Qnil);
4401 if (STRINGP (tem)) 4402 if (STRINGP (tem))
4402 font = x_new_fontset (f, SDATA (tem)); 4403 font = x_new_fontset (f, tem);
4403 else 4404 else
4404 font = x_new_font (f, SDATA (font)); 4405 font = x_new_font (f, SDATA (font));
4405 } 4406 }
@@ -4784,11 +4785,13 @@ w32_load_system_font (f,fontname,size)
4784 4785
4785 /* Now fill in the slots of *FONTP. */ 4786 /* Now fill in the slots of *FONTP. */
4786 BLOCK_INPUT; 4787 BLOCK_INPUT;
4788 bzero (fontp, sizeof (*fontp));
4787 fontp->font = font; 4789 fontp->font = font;
4788 fontp->font_idx = i; 4790 fontp->font_idx = i;
4789 fontp->name = (char *) xmalloc (strlen (fontname) + 1); 4791 fontp->name = (char *) xmalloc (strlen (fontname) + 1);
4790 bcopy (fontname, fontp->name, strlen (fontname) + 1); 4792 bcopy (fontname, fontp->name, strlen (fontname) + 1);
4791 4793
4794 fontp->charset = charset_unicode;
4792 charset = xlfd_charset_of_font (fontname); 4795 charset = xlfd_charset_of_font (fontname);
4793 4796
4794 /* Cache the W32 codepage for a font. This makes w32_encode_char 4797 /* Cache the W32 codepage for a font. This makes w32_encode_char
@@ -4815,7 +4818,7 @@ w32_load_system_font (f,fontname,size)
4815 (0:0x20..0x7F, 1:0xA0..0xFF, 4818 (0:0x20..0x7F, 1:0xA0..0xFF,
4816 (0:0x2020..0x7F7F, 1:0xA0A0..0xFFFF, 3:0x20A0..0x7FFF, 4819 (0:0x2020..0x7F7F, 1:0xA0A0..0xFFFF, 3:0x20A0..0x7FFF,
4817 2:0xA020..0xFF7F). For the moment, we don't know which charset 4820 2:0xA020..0xFF7F). For the moment, we don't know which charset
4818 uses this font. So, we set information in fontp->encoding[1] 4821 uses this font. So, we set information in fontp->encoding_type
4819 which is never used by any charset. If mapping can't be 4822 which is never used by any charset. If mapping can't be
4820 decided, set FONT_ENCODING_NOT_DECIDED. */ 4823 decided, set FONT_ENCODING_NOT_DECIDED. */
4821 4824
@@ -4823,9 +4826,9 @@ w32_load_system_font (f,fontname,size)
4823 type FONT_ENCODING_NOT_DECIDED. */ 4826 type FONT_ENCODING_NOT_DECIDED. */
4824 encoding = strrchr (fontp->name, '-'); 4827 encoding = strrchr (fontp->name, '-');
4825 if (encoding && strnicmp (encoding+1, "sjis", 4) == 0) 4828 if (encoding && strnicmp (encoding+1, "sjis", 4) == 0)
4826 fontp->encoding[1] = 4; 4829 fontp->encoding_type = 4;
4827 else 4830 else
4828 fontp->encoding[1] = FONT_ENCODING_NOT_DECIDED; 4831 fontp->encoding_type = FONT_ENCODING_NOT_DECIDED;
4829 4832
4830 /* The following three values are set to 0 under W32, which is 4833 /* The following three values are set to 0 under W32, which is
4831 what they get set to if XGetFontProperty fails under X. */ 4834 what they get set to if XGetFontProperty fails under X. */
@@ -5403,7 +5406,6 @@ w32_to_x_font (lplogfont, lpxstr, len, specific_charset)
5403 char *fontname_dash; 5406 char *fontname_dash;
5404 int display_resy = (int) one_w32_display_info.resy; 5407 int display_resy = (int) one_w32_display_info.resy;
5405 int display_resx = (int) one_w32_display_info.resx; 5408 int display_resx = (int) one_w32_display_info.resx;
5406 int bufsz;
5407 struct coding_system coding; 5409 struct coding_system coding;
5408 5410
5409 if (!lpxstr) abort (); 5411 if (!lpxstr) abort ();
@@ -5425,12 +5427,14 @@ w32_to_x_font (lplogfont, lpxstr, len, specific_charset)
5425 coding.mode |= CODING_MODE_LAST_BLOCK; 5427 coding.mode |= CODING_MODE_LAST_BLOCK;
5426 /* We explicitely disable composition handling because selection 5428 /* We explicitely disable composition handling because selection
5427 data should not contain any composition sequence. */ 5429 data should not contain any composition sequence. */
5428 coding.composing = COMPOSITION_DISABLED; 5430 coding.common_flags &= ~CODING_ANNOTATION_MASK;
5429 bufsz = decoding_buffer_size (&coding, LF_FACESIZE); 5431
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;
5430 5437
5431 fontname = alloca(sizeof(*fontname) * bufsz);
5432 decode_coding (&coding, lplogfont->lfFaceName, fontname,
5433 strlen(lplogfont->lfFaceName), bufsz - 1);
5434 *(fontname + coding.produced) = '\0'; 5438 *(fontname + coding.produced) = '\0';
5435 5439
5436 /* Replace dashes with underscores so the dashes are not 5440 /* Replace dashes with underscores so the dashes are not
@@ -5549,21 +5553,22 @@ x_to_w32_font (lpxstr, lplogfont)
5549 5553
5550 if (fields > 0 && name[0] != '*') 5554 if (fields > 0 && name[0] != '*')
5551 { 5555 {
5552 int bufsize;
5553 unsigned char *buf;
5554
5555 setup_coding_system 5556 setup_coding_system
5556 (Fcheck_coding_system (Vlocale_coding_system), &coding); 5557 (Fcheck_coding_system (Vlocale_coding_system), &coding);
5557 coding.src_multibyte = 1; 5558 coding.src_multibyte = 1;
5558 coding.dst_multibyte = 1; 5559 coding.dst_multibyte = 1;
5559 bufsize = encoding_buffer_size (&coding, strlen (name)); 5560 coding.dst_bytes = strlen (name) * 2;
5560 buf = (unsigned char *) alloca (bufsize); 5561 coding.destination = (unsigned char *) xmalloc (coding.dst_bytes);
5561 coding.mode |= CODING_MODE_LAST_BLOCK; 5562 coding.mode |= CODING_MODE_LAST_BLOCK;
5562 encode_coding (&coding, name, buf, strlen (name), bufsize); 5563 encode_coding_object (&coding, build_string (name), 0, 0,
5564 strlen (name), coding.dst_bytes, Qnil);
5563 if (coding.produced >= LF_FACESIZE) 5565 if (coding.produced >= LF_FACESIZE)
5564 coding.produced = LF_FACESIZE - 1; 5566 coding.produced = LF_FACESIZE - 1;
5565 buf[coding.produced] = 0; 5567
5566 strcpy (lplogfont->lfFaceName, buf); 5568 coding.destination[coding.produced] = '\0';
5569
5570 strcpy (lplogfont->lfFaceName, coding.destination);
5571 xfree (coding.destination);
5567 } 5572 }
5568 else 5573 else
5569 { 5574 {
@@ -12848,7 +12853,7 @@ x_create_tip_frame (dpyinfo, parms, text)
12848 { 12853 {
12849 tem = Fquery_fontset (font, Qnil); 12854 tem = Fquery_fontset (font, Qnil);
12850 if (STRINGP (tem)) 12855 if (STRINGP (tem))
12851 font = x_new_fontset (f, SDATA (tem)); 12856 font = x_new_fontset (f, tem);
12852 else 12857 else
12853 font = x_new_font (f, SDATA (font)); 12858 font = x_new_font (f, SDATA (font));
12854 } 12859 }
@@ -14390,6 +14395,7 @@ versions of Windows) characters. */);
14390 find_ccl_program_func = w32_find_ccl_program; 14395 find_ccl_program_func = w32_find_ccl_program;
14391 query_font_func = w32_query_font; 14396 query_font_func = w32_query_font;
14392 set_frame_fontset_func = x_set_font; 14397 set_frame_fontset_func = x_set_font;
14398 get_font_repertory_func = x_get_font_repertory;
14393 check_window_system_func = check_w32; 14399 check_window_system_func = check_w32;
14394 14400
14395 /* Images. */ 14401 /* Images. */