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

Diff of /emacs/src/xfns.c

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

revision 1.590 by jhd, Thu Jul 31 16:10:53 2003 UTC revision 1.590.2.1 by handa, Mon Sep 8 12:48:16 2003 UTC
# Line 42  Boston, MA 02111-1307, USA.  */ Line 42  Boston, MA 02111-1307, USA.  */
42  #include "keyboard.h"  #include "keyboard.h"
43  #include "blockinput.h"  #include "blockinput.h"
44  #include <epaths.h>  #include <epaths.h>
45    #include "character.h"
46  #include "charset.h"  #include "charset.h"
47  #include "coding.h"  #include "coding.h"
48  #include "fontset.h"  #include "fontset.h"
# Line 1838  x_encode_text (string, coding_system, se Line 1839  x_encode_text (string, coding_system, se
1839       int *text_bytes, *stringp;       int *text_bytes, *stringp;
1840       int selectionp;       int selectionp;
1841  {  {
1842    unsigned char *str = SDATA (string);    int result = string_xstring_p (string);
   int chars = SCHARS (string);  
   int bytes = SBYTES (string);  
   int charset_info;  
   int bufsize;  
   unsigned char *buf;  
1843    struct coding_system coding;    struct coding_system coding;
1844    extern Lisp_Object Qcompound_text_with_extensions;    extern Lisp_Object Qcompound_text_with_extensions;
1845    
1846    charset_info = find_charset_in_text (str, chars, bytes, NULL, Qnil);    if (result == 0)
   if (charset_info == 0)  
1847      {      {
1848        /* No multibyte character in OBJ.  We need not encode it.  */        /* No multibyte character in OBJ.  We need not encode it.  */
1849        *text_bytes = bytes;        *text_bytes = SBYTES (string);
1850        *stringp = 1;        *stringp = 1;
1851        return str;        return SDATA (string);
1852      }      }
1853    
1854    setup_coding_system (coding_system, &coding);    setup_coding_system (coding_system, &coding);
1855    if (selectionp    coding.mode |= (CODING_MODE_SAFE_ENCODING | CODING_MODE_LAST_BLOCK);
       && SYMBOLP (coding.pre_write_conversion)  
       && !NILP (Ffboundp (coding.pre_write_conversion)))  
     {  
       string = run_pre_post_conversion_on_str (string, &coding, 1);  
       str = SDATA (string);  
       chars = SCHARS (string);  
       bytes = SBYTES (string);  
     }  
   coding.src_multibyte = 1;  
   coding.dst_multibyte = 0;  
   coding.mode |= CODING_MODE_LAST_BLOCK;  
   if (coding.type == coding_type_iso2022)  
     coding.flags |= CODING_FLAG_ISO_SAFE;  
1856    /* We suppress producing escape sequences for composition.  */    /* We suppress producing escape sequences for composition.  */
1857    coding.composing = COMPOSITION_DISABLED;    coding.common_flags &= ~CODING_ANNOTATION_MASK;
1858    bufsize = encoding_buffer_size (&coding, bytes);    coding.dst_bytes = SCHARS (string) * 2;
1859    buf = (unsigned char *) xmalloc (bufsize);    coding.destination = (unsigned char *) xmalloc (coding.dst_bytes);
1860    encode_coding (&coding, str, buf, bytes, bufsize);    encode_coding_object (&coding, string, 0, 0,
1861                            SCHARS (string), SBYTES (string), Qnil);
1862    *text_bytes = coding.produced;    *text_bytes = coding.produced;
1863    *stringp = (charset_info == 1    *stringp = (result == 1 || !EQ (coding_system, Qcompound_text));
1864                || (!EQ (coding_system, Qcompound_text)    return coding.destination;
                   && !EQ (coding_system, Qcompound_text_with_extensions)));  
   return buf;  
1865  }  }
1866    
1867    
# Line 3322  This function is an internal primitive-- Line 3303  This function is an internal primitive--
3303    
3304      font = x_get_arg (dpyinfo, parms, Qfont, "font", "Font", RES_TYPE_STRING);      font = x_get_arg (dpyinfo, parms, Qfont, "font", "Font", RES_TYPE_STRING);
3305    
3306      BLOCK_INPUT;      /* If the caller has specified no font, try out fonts which we
3307      /* First, try whatever font the caller has specified.  */         hope have bold and italic variations.  */
3308      if (STRINGP (font))      if (!STRINGP (font))
3309        {        {
3310          tem = Fquery_fontset (font, Qnil);          char *names[]
3311          if (STRINGP (tem))            = { "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1",
3312            font = x_new_fontset (f, SDATA (tem));                "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1",
3313          else                "-*-*-medium-r-normal-*-*-140-*-*-c-*-iso8859-1",
3314            font = x_new_font (f, SDATA (font));                /* This was formerly the first thing tried, but it finds
3315        }                   too many fonts and takes too long.  */
3316                  "-*-*-medium-r-*-*-*-*-*-*-c-*-iso8859-1",
3317                  /* If those didn't work, look for something which will
3318                     at least work.  */
3319                  "-*-fixed-*-*-*-*-*-140-*-*-c-*-iso8859-1",
3320                  NULL };
3321            int i;
3322    
3323      /* Try out a font which we hope has bold and italic variations.  */          BLOCK_INPUT;
3324      if (!STRINGP (font))          for (i = 0; names[i]; i++)
3325        font = x_new_font (f, "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1");            {
3326      if (!STRINGP (font))              Lisp_Object list;
       font = x_new_font (f, "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1");  
     if (! STRINGP (font))  
       font = x_new_font (f, "-*-*-medium-r-normal-*-*-140-*-*-c-*-iso8859-1");  
     if (! STRINGP (font))  
       /* This was formerly the first thing tried, but it finds too many fonts  
          and takes too long.  */  
       font = x_new_font (f, "-*-*-medium-r-*-*-*-*-*-*-c-*-iso8859-1");  
     /* If those didn't work, look for something which will at least work.  */  
     if (! STRINGP (font))  
       font = x_new_font (f, "-*-fixed-*-*-*-*-*-140-*-*-c-*-iso8859-1");  
     UNBLOCK_INPUT;  
     if (! STRINGP (font))  
       font = build_string ("fixed");  
3327    
3328                list = x_list_fonts (f, build_string (names[i]), 0, 1);
3329                if (CONSP (list))
3330                  {
3331                    font = XCAR (list);
3332                    break;
3333                  }
3334              }
3335            UNBLOCK_INPUT;
3336            if (! STRINGP (font))
3337              font = build_string ("fixed");
3338          }
3339      x_default_parameter (f, parms, Qfont, font,      x_default_parameter (f, parms, Qfont, font,
3340                           "font", "Font", RES_TYPE_STRING);                           "font", "Font", RES_TYPE_STRING);
3341    }    }
# Line 9885  x_create_tip_frame (dpyinfo, parms, text Line 9870  x_create_tip_frame (dpyinfo, parms, text
9870        {        {
9871          tem = Fquery_fontset (font, Qnil);          tem = Fquery_fontset (font, Qnil);
9872          if (STRINGP (tem))          if (STRINGP (tem))
9873            font = x_new_fontset (f, SDATA (tem));            font = x_new_fontset (f, tem);
9874          else          else
9875            font = x_new_font (f, SDATA (font));            font = x_new_font (f, SDATA (font));
9876        }        }
# Line 10928  meaning don't clear the cache.  */); Line 10913  meaning don't clear the cache.  */);
10913    find_ccl_program_func = x_find_ccl_program;    find_ccl_program_func = x_find_ccl_program;
10914    query_font_func = x_query_font;    query_font_func = x_query_font;
10915    set_frame_fontset_func = x_set_font;    set_frame_fontset_func = x_set_font;
10916      get_font_repertory_func = x_get_font_repertory;
10917    check_window_system_func = check_x;    check_window_system_func = check_x;
10918    
10919    /* Images.  */    /* Images.  */

Legend:
Removed from v.1.590  
changed lines
  Added in v.1.590.2.1

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