emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/src/xterm.c


From: Kenichi Handa
Subject: [Emacs-diffs] Changes to emacs/src/xterm.c
Date: Thu, 30 Dec 2004 08:02:24 -0500

Index: emacs/src/xterm.c
diff -c emacs/src/xterm.c:1.853 emacs/src/xterm.c:1.854
*** emacs/src/xterm.c:1.853     Wed Dec 15 21:34:14 2004
--- emacs/src/xterm.c   Thu Dec 30 12:26:31 2004
***************
*** 7838,7844 ****
    FRAME_BASELINE_OFFSET (f) = fontp->baseline_offset;
    FRAME_FONTSET (f) = -1;
  
!   FRAME_COLUMN_WIDTH (f) = FONT_WIDTH (FRAME_FONT (f));
    FRAME_LINE_HEIGHT (f) = FONT_HEIGHT (FRAME_FONT (f));
  
    compute_fringe_widths (f, 1);
--- 7838,7845 ----
    FRAME_BASELINE_OFFSET (f) = fontp->baseline_offset;
    FRAME_FONTSET (f) = -1;
  
!   FRAME_COLUMN_WIDTH (f) = fontp->average_width;
!   FRAME_SPACE_WIDTH (f) = fontp->space_width;
    FRAME_LINE_HEIGHT (f) = FONT_HEIGHT (FRAME_FONT (f));
  
    compute_fringe_widths (f, 1);
***************
*** 9782,9787 ****
--- 9783,9825 ----
      fontp->name = (char *) xmalloc (strlen (fontname) + 1);
      bcopy (fontname, fontp->name, strlen (fontname) + 1);
  
+     if (font->min_bounds.width == font->max_bounds.width)
+       {
+       /* Fixed width font.  */
+       fontp->average_width = fontp->space_width = font->min_bounds.width;
+       }
+     else
+       {
+       XChar2b char2b;
+       XCharStruct *pcm;
+ 
+       char2b.byte1 = 0x00, char2b.byte2 = 0x20;
+       pcm = x_per_char_metric (font, &char2b, 0);
+       if (pcm)
+         fontp->space_width = pcm->width;
+       else
+         fontp->space_width = FONT_WIDTH (font);
+ 
+       fontp->average_width
+         = (XGetFontProperty (font, dpyinfo->Xatom_AVERAGE_WIDTH, &value)
+            ? (long) value / 10 : 0);
+       if (fontp->average_width < 0)
+         fontp->average_width = - fontp->average_width;
+       if (fontp->average_width == 0)
+         {
+           if (pcm)
+             {
+               int width = pcm->width;
+               for (char2b.byte2 = 33; char2b.byte2 <= 126; char2b.byte2++)
+                 if ((pcm = x_per_char_metric (font, &char2b, 0)) != NULL)
+                   width += pcm->width;
+               fontp->average_width = width / 95;
+             }
+           else
+             fontp->average_width = FONT_WIDTH (font);
+         }
+       }
+ 
      /* Try to get the full name of FONT.  Put it in FULL_NAME.  */
      full_name = 0;
      if (XGetFontProperty (font, XA_FONT, &value))
***************
*** 10409,10414 ****
--- 10447,10454 ----
    /* For properties of font.  */
    dpyinfo->Xatom_PIXEL_SIZE
      = XInternAtom (dpyinfo->display, "PIXEL_SIZE", False);
+   dpyinfo->Xatom_AVERAGE_WIDTH
+     = XInternAtom (dpyinfo->display, "AVERAGE_WIDTH", False);
    dpyinfo->Xatom_MULE_BASELINE_OFFSET
      = XInternAtom (dpyinfo->display, "_MULE_BASELINE_OFFSET", False);
    dpyinfo->Xatom_MULE_RELATIVE_COMPOSE




reply via email to

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