emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/w32term.c [emacs-unicode-2]


From: Jason Rumney
Subject: [Emacs-diffs] Changes to emacs/src/w32term.c [emacs-unicode-2]
Date: Sat, 11 Oct 2003 19:01:56 -0400

Index: emacs/src/w32term.c
diff -c emacs/src/w32term.c:1.193.4.1 emacs/src/w32term.c:1.193.4.2
*** emacs/src/w32term.c:1.193.4.1       Mon Sep  8 08:48:15 2003
--- emacs/src/w32term.c Sat Oct 11 19:01:55 2003
***************
*** 24,48 ****
  #include <stdio.h>
  #include <stdlib.h>
  #include "lisp.h"
- #include "charset.h"
  #include "blockinput.h"
- 
- #include "w32heap.h"
  #include "w32term.h"
- #include "w32bdf.h"
- #include <shellapi.h>
  
  #include "systty.h"
  #include "systime.h"
- #include "atimer.h"
- #include "keymap.h"
  
  #include <ctype.h>
  #include <errno.h>
  #include <setjmp.h>
  #include <sys/stat.h>
  
! #include "keyboard.h"
  #include "frame.h"
  #include "dispextern.h"
  #include "fontset.h"
--- 24,44 ----
  #include <stdio.h>
  #include <stdlib.h>
  #include "lisp.h"
  #include "blockinput.h"
  #include "w32term.h"
  
  #include "systty.h"
  #include "systime.h"
  
  #include <ctype.h>
  #include <errno.h>
  #include <setjmp.h>
  #include <sys/stat.h>
  
! #include "charset.h"
! #include "character.h"
! #include "coding.h"
! #include "ccl.h"
  #include "frame.h"
  #include "dispextern.h"
  #include "fontset.h"
***************
*** 53,61 ****
  #include "disptab.h"
  #include "buffer.h"
  #include "window.h"
  #include "intervals.h"
! #include "composite.h"
! #include "coding.h"
  
  #define abs(x)        ((x) < 0 ? -(x) : (x))
  
--- 49,63 ----
  #include "disptab.h"
  #include "buffer.h"
  #include "window.h"
+ #include "keyboard.h"
  #include "intervals.h"
! #include "process.h"
! #include "atimer.h"
! #include "keymap.h"
! 
! #include "w32heap.h"
! #include "w32bdf.h"
! #include <shellapi.h>
  
  #define abs(x)        ((x) < 0 ? -(x) : (x))
  
***************
*** 748,754 ****
  
  static XCharStruct *w32_per_char_metric P_ ((XFontStruct *,
                                               wchar_t *, int));
! static int w32_encode_char P_ ((int, wchar_t *, struct font_info *, int *));
  
  
  /* Get metrics of character CHAR2B in FONT.  Value is always non-null.
--- 750,757 ----
  
  static XCharStruct *w32_per_char_metric P_ ((XFontStruct *,
                                               wchar_t *, int));
! static int w32_encode_char P_ ((int, wchar_t *, struct font_info *,
!                               struct charset *, int *));
  
  
  /* Get metrics of character CHAR2B in FONT.  Value is always non-null.
***************
*** 895,901 ****
    BOOL retval;
  
    xassert (font && char2b);
!   xassert (font_type != UNKNOWN_FONT);
  
    /* Handle the common cases quickly.  */
    if (!font->bdf && font->per_char == NULL)
--- 898,914 ----
    BOOL retval;
  
    xassert (font && char2b);
! 
!   /* TODO: This function is currently called through the RIF, and in
!      some cases font_type is UNKNOWN_FONT. We currently allow the
!      cached metrics to be used, which seems to work, but in cases
!      where font_type is UNKNOWN_FONT, we probably haven't encoded
!      char2b appropriately. All callers need checking to see what they
!      are passing.  This is most likely to affect variable width fonts
!      outside the Latin-1 range, particularly in languages like Thai
!      that rely on rbearing and lbearing to provide composition. I
!      don't think that is working currently anyway, but we don't seem
!      to have anyone testing such languages on Windows.  */
  
    /* Handle the common cases quickly.  */
    if (!font->bdf && font->per_char == NULL)
***************
*** 904,909 ****
--- 917,924 ----
    else if (!font->bdf && *char2b < 128)
      return &font->per_char[*char2b];
  
+   xassert (font_type != UNKNOWN_FONT);
+ 
    pcm = &font->scratch;
  
    if (font_type == BDF_1D_FONT)
***************
*** 990,1002 ****
     the two-byte form of C.  Encoding is returned in *CHAR2B.  */
  
  static int /* enum w32_char_font_type */
! w32_encode_char (c, char2b, font_info, two_byte_p)
       int c;
       wchar_t *char2b;
       struct font_info *font_info;
       int * two_byte_p;
  {
-   struct charset *charset = CHAR_CHARSET (c);
    int codepage;
    int unicode_p = 0;
    int internal_two_byte_p = 0;
--- 1005,1017 ----
     the two-byte form of C.  Encoding is returned in *CHAR2B.  */
  
  static int /* enum w32_char_font_type */
! w32_encode_char (c, char2b, font_info, charset, two_byte_p)
       int c;
       wchar_t *char2b;
       struct font_info *font_info;
+      struct charset *charset;
       int * two_byte_p;
  {
    int codepage;
    int unicode_p = 0;
    int internal_two_byte_p = 0;
***************
*** 1035,1045 ****
        else
        STORE_XCHAR2B (char2b, ccl->reg[1], ccl->reg[2]);
      }
!   else if (font_info->encoding[charset])
      {
        /* Fixed encoding scheme.  See fontset.h for the meaning of the
         encoding numbers.  */
!       int enc = font_info->encoding[charset];
  
        if ((enc == 1 || enc == 2)
          && CHARSET_DIMENSION (charset) == 2)
--- 1050,1060 ----
        else
        STORE_XCHAR2B (char2b, ccl->reg[1], ccl->reg[2]);
      }
!   else if (font_info->encoding_type)
      {
        /* Fixed encoding scheme.  See fontset.h for the meaning of the
         encoding numbers.  */
!       unsigned char enc = font_info->encoding_type;
  
        if ((enc == 1 || enc == 2)
          && CHARSET_DIMENSION (charset) == 2)
***************
*** 1094,1099 ****
--- 1109,1211 ----
  }
  
  
+ /* Return a char-table whose elements are t if the font FONT_INFO
+    contains a glyph for the corresponding character, and nil if not.
+ 
+    Fixme: For the moment, this function works only for fonts whose
+    glyph encoding is the same as Unicode (e.g. ISO10646-1 fonts).  */
+ 
+ Lisp_Object
+ x_get_font_repertory (f, font_info)
+      FRAME_PTR f;
+      struct font_info *font_info;
+ {
+ #if 0 /* TODO: New function, convert to Windows. */
+   XFontStruct *font = (XFontStruct *) font_info->font;
+   Lisp_Object table;
+   int min_byte1, max_byte1, min_byte2, max_byte2;
+ 
+   table = Fmake_char_table (Qnil, Qnil);
+ 
+   min_byte1 = font->min_byte1;
+   max_byte1 = font->max_byte1;
+   min_byte2 = font->min_char_or_byte2;
+   max_byte2 = font->max_char_or_byte2;
+   if (min_byte1 == 0 && max_byte1 == 0)
+     {
+       if (! font->per_char || font->all_chars_exist == True)
+       char_table_set_range (table, min_byte2, max_byte2, Qt);
+       else
+       {
+         XCharStruct *pcm = font->per_char;
+         int from = -1;
+         int i;
+ 
+         for (i = min_byte2; i <= max_byte2; i++, pcm++)
+           {
+             if (pcm->width == 0 && pcm->rbearing == pcm->lbearing)
+               {
+                 if (from >= 0)
+                   {
+                     char_table_set_range (table, from, i - 1, Qt);
+                     from = -1;
+                   }
+               }
+             else if (from < 0)
+               from = i;
+           }
+         if (from >= 0)
+           char_table_set_range (table, from, i - 1, Qt);
+       }
+     }
+   else
+     {
+       if (! font->per_char || font->all_chars_exist == True)
+       {
+         int i;
+ 
+         for (i = min_byte1; i <= max_byte1; i++)
+           char_table_set_range (table,
+                                 (i << 8) | min_byte2, (i << 8) | max_byte2,
+                                 Qt);
+       }
+       else
+       {
+         XCharStruct *pcm = font->per_char;
+         int i;
+ 
+         for (i = min_byte1; i <= max_byte1; i++)
+           {
+             int from = -1;
+             int j;
+ 
+             for (j = min_byte2; j <= max_byte2; j++, pcm++)
+               {
+                 if (pcm->width == 0 && pcm->rbearing == pcm->lbearing)
+                   {
+                     if (from >= 0)
+                       {
+                         char_table_set_range (table, (i << 8) | from,
+                                               (i << 8) | (j - 1), Qt);
+                         from = -1;
+                       }
+                   }
+                 else if (from < 0)
+                   from = j;
+               }
+             if (from >= 0)
+               char_table_set_range (table, (i << 8) | from,
+                                     (i << 8) | (j - 1), Qt);
+           }
+       }
+     }
+ 
+   return table;
+ #else
+   return Fmake_char_table (Qnil, Qnil);
+ #endif
+ }
+ 
  
  /***********************************************************************
                            Glyph display
***************
*** 3050,3056 ****
  static struct scroll_bar *x_window_to_scroll_bar ();
  static void x_scroll_bar_report_motion ();
  static void x_check_fullscreen P_ ((struct frame *));
- static void x_check_fullscreen_move P_ ((struct frame *));
  static int glyph_rect P_ ((struct frame *f, int, int, RECT *));
  
  
--- 3162,3167 ----
***************
*** 4462,4468 ****
          f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
          if (f)
            {
-             x_check_fullscreen_move(f);
              if (f->want_fullscreen & FULLSCREEN_WAIT)
                f->want_fullscreen &= ~(FULLSCREEN_WAIT|FULLSCREEN_BOTH);
            }
--- 4573,4578 ----
***************
*** 4776,4782 ****
          if (msg.msg.message == msh_mousewheel)
            {
              /* Forward MSH_MOUSEWHEEL as WM_MOUSEWHEEL.  */
!             msg.msg.message == WM_MOUSEWHEEL;
              prepend_msg (&msg);
            }
          break;
--- 4886,4892 ----
          if (msg.msg.message == msh_mousewheel)
            {
              /* Forward MSH_MOUSEWHEEL as WM_MOUSEWHEEL.  */
!             msg.msg.message = WM_MOUSEWHEEL;
              prepend_msg (&msg);
            }
          break;
***************
*** 5234,5239 ****
--- 5344,5354 ----
    if (!fontp)
      return Qnil;
  
+   if (FRAME_FONT (f) == (XFontStruct *) (fontp->font))
+     /* This font is already set in frame F.  There's nothing more to
+        do.  */
+     return build_string (fontp->full_name);
+ 
    FRAME_FONT (f) = (XFontStruct *) (fontp->font);
    FRAME_BASELINE_OFFSET (f) = fontp->baseline_offset;
    FRAME_FONTSET (f) = -1;
***************
*** 5266,5302 ****
    return build_string (fontp->full_name);
  }
  
! /* Give frame F the fontset named FONTSETNAME as its default font, and
!    return the full name of that fontset.  FONTSETNAME may be a wildcard
!    pattern; in that case, we choose some fontset that fits the pattern.
!    The return value shows which fontset we chose.  */
  
  Lisp_Object
  x_new_fontset (f, fontsetname)
       struct frame *f;
!      char *fontsetname;
  {
!   int fontset = fs_query_fontset (build_string (fontsetname), 0);
    Lisp_Object result;
  
!   if (fontset < 0)
!     return Qnil;
! 
!   if (FRAME_FONTSET (f) == fontset)
      /* This fontset is already set in frame F.  There's nothing more
         to do.  */
      return fontset_name (fontset);
  
!   result = x_new_font (f, (SDATA (fontset_ascii (fontset))));
  
    if (!STRINGP (result))
      /* Can't load ASCII font.  */
      return Qnil;
  
    /* Since x_new_font doesn't update any fontset information, do it now.  */
    FRAME_FONTSET(f) = fontset;
  
!   return build_string (fontsetname);
  }
  
  
--- 5381,5429 ----
    return build_string (fontp->full_name);
  }
  
! /* Give frame F the fontset named FONTSETNAME as its default fontset,
!    and return the full name of that fontset.  FONTSETNAME may be a
!    wildcard pattern; in that case, we choose some fontset that fits
!    the pattern.  FONTSETNAME may be a font name for ASCII characters;
!    in that case, we create a fontset from that font name.
! 
!    The return value shows which fontset we chose.
!    If FONTSETNAME specifies the default fontset, return Qt.
!    If an ASCII font in the specified fontset can't be loaded, return
!    Qnil.  */
  
  Lisp_Object
  x_new_fontset (f, fontsetname)
       struct frame *f;
!      Lisp_Object fontsetname;
  {
!   int fontset = fs_query_fontset (fontsetname, 0);
    Lisp_Object result;
  
!   if (fontset > 0 && FRAME_FONTSET(f) == fontset)
      /* This fontset is already set in frame F.  There's nothing more
         to do.  */
      return fontset_name (fontset);
+   else if (fontset == 0)
+     /* The default fontset can't be the default font.   */
+     return Qt;
  
!   if (fontset > 0)
!     result = x_new_font (f, (SDATA (fontset_ascii (fontset))));
!   else
!     result = x_new_font (f, SDATA (fontsetname));
  
    if (!STRINGP (result))
      /* Can't load ASCII font.  */
      return Qnil;
  
+   if (fontset < 0)
+     fontset = new_fontset_from_font_name (result);
+ 
    /* Since x_new_font doesn't update any fontset information, do it now.  */
    FRAME_FONTSET(f) = fontset;
  
!   return fontset_name (fontset);
  }
  
  
***************
*** 5428,5436 ****
        x_fullscreen_adjust (f, &width, &height, &ign, &ign);
  
        /* We do not need to move the window, it shall be taken care of
!          when setting WM manager hints.
!          If the frame is visible already, the position is checked by
!          x_check_fullscreen_move. */
        if (FRAME_COLS (f) != width || FRAME_LINES (f) != height)
          {
            change_frame_size (f, height, width, 0, 1, 0);
--- 5555,5561 ----
        x_fullscreen_adjust (f, &width, &height, &ign, &ign);
  
        /* We do not need to move the window, it shall be taken care of
!          when setting WM manager hints.  */
        if (FRAME_COLS (f) != width || FRAME_LINES (f) != height)
          {
            change_frame_size (f, height, width, 0, 1, 0);
***************
*** 5442,5477 ****
          }
      }
  }
- 
- /* If frame parameters are set after the frame is mapped, we need to move
-    the window.  This is done in xfns.c.
-    Some window managers moves the window to the right position, some
-    moves the outer window manager window to the specified position.
-    Here we check that we are in the right spot.  If not, make a second
-    move, assuming we are dealing with the second kind of window manager. */
- static void
- x_check_fullscreen_move (f)
-      struct frame *f;
- {
-   if (f->want_fullscreen & FULLSCREEN_MOVE_WAIT)
-   {
-     int expect_top = f->top_pos;
-     int expect_left = f->left_pos;
- 
-     if (f->want_fullscreen & FULLSCREEN_HEIGHT)
-       expect_top = 0;
-     if (f->want_fullscreen & FULLSCREEN_WIDTH)
-       expect_left = 0;
- 
-     if (expect_top != f->top_pos
-         || expect_left != f->left_pos)
-       x_set_offset (f, expect_left, expect_top, 1);
- 
-     /* Just do this once */
-     f->want_fullscreen &= ~FULLSCREEN_MOVE_WAIT;
-   }
- }
- 
  
  /* Call this to change the size of frame F's x-window.
     If CHANGE_GRAVITY is 1, we change to top-left-corner window gravity
--- 5567,5572 ----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]