>>>>> On Fri, 11 Nov 2005 15:50:14 +0000, David Reitter <[EMAIL PROTECTED]> 
>>>>> said:

> In the Carbon port (current CVS), fontset-info or frame-char-width
> report wrong pixel widths for fonts.  In the example below, two
> fontsets are created. The I set the frame font (to load the font)
> and compare reported character width with (frame-char-width).

>  From my understanding of the documentation, the two should be the
> same - but they differ.

They are not necessarily the same: the former is the maximum width,
and the latter is the average width.

The reason why they are not the same even in a fixed-width font is
that the maximum metrics are confused by characters missing in the
font.  One way to avoid this is to define maximum/minimum metrics as
those among ASCII characters.  This is what ATSUI support code is
doing.

                                     YAMAMOTO Mitsuharu
                                [EMAIL PROTECTED]

Index: src/macterm.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/macterm.c,v
retrieving revision 1.142
diff -c -r1.142 macterm.c
*** src/macterm.c       11 Nov 2005 16:33:44 -0000      1.142
--- src/macterm.c       12 Nov 2005 05:31:57 -0000
***************
*** 7572,7577 ****
--- 7572,7584 ----
          SetRect (&max_bounds, 0, 0, 0, 0);
          for (c = 0x20; c <= 0xff; c++)
            {
+             if (c == 0x7f)
+               {
+                 STORE_XCHARSTRUCT (font->min_bounds, min_width, min_bounds);
+                 STORE_XCHARSTRUCT (font->max_bounds, max_width, max_bounds);
+                 continue;
+               }
+ 
              ch = c;
              char_width = CharWidth (ch);
              QDTextBounds (1, &ch, &char_bounds);
***************
*** 7594,7601 ****
                  UnionRect (&max_bounds, &char_bounds, &max_bounds);
                }
            }
-         STORE_XCHARSTRUCT (font->min_bounds, min_width, min_bounds);
-         STORE_XCHARSTRUCT (font->max_bounds, max_width, max_bounds);
          if (min_width == max_width
              && max_bounds.left >= 0 && max_bounds.right <= max_width)
            {
--- 7601,7606 ----


_______________________________________________
Emacs-pretest-bug mailing list
Emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug

Reply via email to