Reported by: Dragan Ivanovic <idragan <at> clip.dia.fi.upm.es>
Date: Tue, 25 Jan 2011 15:05:03 UTC
Severity: normal
Tags: patch
Merged with 2806
Found in version 23.2
Done: Chong Yidong <cyd <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 7913 in the body.
You can then email your comments to 7913 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:bug#7913
; Package emacs
.
(Tue, 25 Jan 2011 15:05:03 GMT) Full text and rfc822 format available.Dragan Ivanovic <idragan <at> clip.dia.fi.upm.es>
:bug-gnu-emacs <at> gnu.org
.
(Tue, 25 Jan 2011 15:05:03 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Dragan Ivanovic <idragan <at> clip.dia.fi.upm.es> To: bug-gnu-emacs <at> gnu.org Subject: 23.2; Mac OS X Dual Spacing Fonts Fix (Patch supplied) Date: Tue, 25 Jan 2011 12:14:01 +0100 (CET)
This bug report will be sent to the Free Software Foundation, not to your local site managers! Please write in English if possible, because the Emacs maintainers usually do not have translators to read other languages for them. Your bug report will be posted to the bug-gnu-emacs <at> gnu.org mailing list, and to the gnu.emacs.bug news group. Please describe exactly what actions triggered the bug and the precise symptoms of the bug. If you can, give a recipe starting from `emacs -Q': % ------------------------------------------------------------------ Emacs (v23.2 distro in my case) has a known problem with determining pixel width of frames when using dual-space (Japanese) fonts. It arises because the maximum pixel width of characters in those fonts is way bigger than (usually double the size of) the printable ASCII characters. Therefore, windows open twice as wide, and the intelligent line wrapping (as in man or Mew, my favorite email reader) gets the metrics wrong and forces the text to be wrapped to about one third of the frame width. Patches for X-Windows versions are known, and can be found on Ubuntu mailing lists. The same problem appears on NextSTEP, i.e., Mac OS X/Cocoa version. Below is the patch that solves the problem: % .................................................................. --- nsfont-old.m 2011-01-18 13:36:39.000000000 +0100 +++ nsfont.m 2011-01-18 13:36:17.000000000 +0100 @@ -885,9 +885,29 @@ nsfont_open (FRAME_PTR f, Lisp_Object fo font->ascent = lrint([sfont ascender]); font->descent = -lrint(floor([sfont descender])); font->min_width = ns_char_width(sfont, '|'); - font->space_width = lrint (ns_char_width (sfont, ' ')); - font->average_width = lrint (font_info->width); - font->max_width = lrint (font_info->max_bounds.width); + if([nsfont isFixedPitch]) { + /* This is a "dirty" fix to avoid problem with some (mostly + Japanese) fonts that use dual spacing. Unlike in the patches + to "ftfont.c" and "xftfont.c", in Cocoa we cannot rely on a + flag (FC_DUAL) to tell us if a fixed width font uses dual + spacing or not. + + To avoid some problems with spaces (e.g. inside the vebatim + LaTeX environment when using AUCTeX), we measure the width of + a "regular" character, e.g. M (the size of em-space). */ + font->space_width = lrint (ns_char_width (sfont, 'M')); + /* We assume it is the average width. */ + font->average_width = font->space_width; + /* We also assume it is the maximal width. This may possibly + cause some side effects, but I am not aware of any right + now. */ + font->max_width = font->space_width; + } else { + /* This is the normal v23.2 code */ + font->space_width = lrint (ns_char_width (sfont, ' ')); + font->average_width = lrint (font_info->width); + font->max_width = lrint (font_info->max_bounds.width); + } font->height = lrint (font_info->height); font->underline_position = lrint (font_info->underpos); font->underline_thickness = lrint (font_info->underwidth); % .................................................................. Best regards, Dragan Ivanovic % ------------------------------------------------------------------ If Emacs crashed, and you have the Emacs process in the gdb debugger, please include the output from the following gdb commands: `bt full' and `xbacktrace'. For information about debugging Emacs, please read the file /Applications/Emacs.app/Contents/Resources/etc/DEBUG. In GNU Emacs 23.2.1 (i386-apple-darwin10.6.0, NS apple-appkit-1038.35) of 2011-01-18 on dhcp-191.imdea Windowing system distributor `Apple', version 10.3.1038 configured using `configure '--with-ns'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: C value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: nil value of $XMODIFIERS: nil locale-coding-system: nil default enable-multibyte-characters: t Major mode: Shell Minor modes in effect: shell-dirtrack-mode: t diff-auto-refine-mode: t show-paren-mode: t global-hl-line-mode: t tooltip-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Recent input: o <up> C-a C-y <up> <M-right> <up> C-a <M-right> C-e C-a <tab> <down> <down> <tab> <down> <tab> <up> <tab> <right> <tab> <tab> <tab> <tab> <down> <down> <down> <up> C-SPC <down> <down> C-w <up> <up> <return> C-x C-s <up> <up> <up> <up> <up> C-c C-t p <up> <up> <up> <up> <up> <up> <up> <up> <up> <down> <C-right> <C-left> <down> <down> <down> <down> <down> <down> <down> <down> <C-right> <C-right> <C-right> <backspace> <backspace> <backspace> <backspace> <backspace> <backspace> R - 2 0 1 1 <up> <up> <up> <up> <up> <up> <up> <up> <up> <down> <C-left> <left> <left> <right> <right> <backspace> - <left> <left> <left> <left> <left> <S-left> C-_ <left> S C C . <backspace> 2 <backspace> - 2 0 1 0 <backspace> 1 SPC C-a <right> <right> <right> C-c C-t p C-x C-s C-c a t <up> <up> <up> <up> <up> <up> <help-echo> <down-mouse-1> <mouse-1> t c N r N <up> <up> <up> <up> <up> <up> <down> <down> <down> <down> <down> <down> 4 r 4 0 0 r <help-echo> C-x 5 2 <help-echo> C-x C-f C-f ~ / i n s t / a c t i <tab> <return> <down> <down> <down> <down> <return> <down> <down> <down> <down> <down> <return> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> C-x k <return> <up> <up> <up> <up> <return> C-x k <return> <down> <down> <down> <down> <down> M-x e s h e l l <return> C-x k <return> M-x s h e l l <return> p w d <return> a n SPC <backspace> t SPC d e m o - s <backspace> <backspace> s <backspace> . s t a r t <return> <help-echo> M-x r e p o r <tab> b <tab> <return> Recent messages: Loading em-basic...done Loading em-cmpl...done Loading em-dirs...done Loading em-glob...done Loading em-hist...done Loading em-ls...done Loading em-prompt...done Loading em-script...done Loading em-term...done Loading em-unix...done Load-path shadows: ~/elisp/emacs-w3m/octet hides ~/elisp/octet ~/elisp/emacs-w3m/mime-w3m hides ~/elisp/mime-w3m ~/elisp/emacs-w3m/mew-w3m hides ~/elisp/mew-w3m ~/elisp/remember/remember hides /Applications/Emacs.app/Contents/Resources/lisp/textmodes/remember ~/elisp/org-mode/lisp/org hides /Applications/Emacs.app/Contents/Resources/lisp/org/org ~/elisp/org-mode/lisp/org-xoxo hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-xoxo ~/elisp/org-mode/lisp/org-wl hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-wl ~/elisp/org-mode/lisp/org-w3m hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-w3m ~/elisp/org-mode/lisp/org-vm hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-vm ~/elisp/org-mode/lisp/org-timer hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-timer ~/elisp/org-mode/lisp/org-table hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-table ~/elisp/org-mode/lisp/org-src hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-src ~/elisp/org-mode/lisp/org-rmail hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-rmail ~/elisp/org-mode/lisp/org-remember hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-remember ~/elisp/org-mode/lisp/org-publish hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-publish ~/elisp/org-mode/lisp/org-protocol hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-protocol ~/elisp/org-mode/lisp/org-plot hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-plot ~/elisp/org-mode/lisp/org-mouse hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-mouse ~/elisp/org-mode/lisp/org-mobile hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-mobile ~/elisp/org-mode/lisp/org-mhe hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-mhe ~/elisp/org-mode/lisp/org-mew hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-mew ~/elisp/org-mode/lisp/org-macs hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-macs ~/elisp/org-mode/lisp/org-mac-message hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-mac-message ~/elisp/org-mode/lisp/org-list hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-list ~/elisp/org-mode/lisp/org-latex hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-latex ~/elisp/org-mode/lisp/org-jsinfo hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-jsinfo ~/elisp/org-mode/lisp/org-irc hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-irc ~/elisp/org-mode/lisp/org-install hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-install ~/elisp/org-mode/lisp/org-inlinetask hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-inlinetask ~/elisp/org-mode/lisp/org-info hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-info ~/elisp/org-mode/lisp/org-indent hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-indent ~/elisp/org-mode/lisp/org-id hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-id ~/elisp/org-mode/lisp/org-icalendar hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-icalendar ~/elisp/org-mode/lisp/org-html hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-html ~/elisp/org-mode/lisp/org-habit hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-habit ~/elisp/org-mode/lisp/org-gnus hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-gnus ~/elisp/org-mode/lisp/org-freemind hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-freemind ~/elisp/org-mode/lisp/org-footnote hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-footnote ~/elisp/org-mode/lisp/org-feed hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-feed ~/elisp/org-mode/lisp/org-faces hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-faces ~/elisp/org-mode/lisp/org-exp hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-exp ~/elisp/org-mode/lisp/org-exp-blocks hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-exp-blocks ~/elisp/org-mode/lisp/org-docbook hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-docbook ~/elisp/org-mode/lisp/org-datetree hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-datetree ~/elisp/org-mode/lisp/org-crypt hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-crypt ~/elisp/org-mode/lisp/org-compat hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-compat ~/elisp/org-mode/lisp/org-colview hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-colview ~/elisp/org-mode/lisp/org-clock hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-clock ~/elisp/org-mode/lisp/org-bibtex hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-bibtex ~/elisp/org-mode/lisp/org-bbdb hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-bbdb ~/elisp/org-mode/lisp/org-attach hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-attach ~/elisp/org-mode/lisp/org-ascii hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-ascii ~/elisp/org-mode/lisp/org-archive hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-archive ~/elisp/org-mode/lisp/org-agenda hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-agenda ~/elisp/xsd-regexp hides /Applications/Emacs.app/Contents/Resources/lisp/nxml/xsd-regexp ~/elisp/xmltok hides /Applications/Emacs.app/Contents/Resources/lisp/nxml/xmltok ~/elisp/rng-xsd hides /Applications/Emacs.app/Contents/Resources/lisp/nxml/rng-xsd ~/elisp/rng-valid hides /Applications/Emacs.app/Contents/Resources/lisp/nxml/rng-valid ~/elisp/rng-util hides /Applications/Emacs.app/Contents/Resources/lisp/nxml/rng-util ~/elisp/rng-uri hides /Applications/Emacs.app/Contents/Resources/lisp/nxml/rng-uri ~/elisp/rng-pttrn hides /Applications/Emacs.app/Contents/Resources/lisp/nxml/rng-pttrn ~/elisp/rng-parse hides /Applications/Emacs.app/Contents/Resources/lisp/nxml/rng-parse ~/elisp/rng-nxml hides /Applications/Emacs.app/Contents/Resources/lisp/nxml/rng-nxml ~/elisp/rng-match hides /Applications/Emacs.app/Contents/Resources/lisp/nxml/rng-match ~/elisp/rng-maint hides /Applications/Emacs.app/Contents/Resources/lisp/nxml/rng-maint ~/elisp/rng-loc hides /Applications/Emacs.app/Contents/Resources/lisp/nxml/rng-loc ~/elisp/rng-dt hides /Applications/Emacs.app/Contents/Resources/lisp/nxml/rng-dt ~/elisp/rng-cmpct hides /Applications/Emacs.app/Contents/Resources/lisp/nxml/rng-cmpct Features: (shadow emacsbug em-unix em-term term disp-table em-script em-prompt em-ls em-hist em-pred em-glob em-dirs em-cmpl em-basic esh-opt em-banner em-alias esh-var esh-io esh-cmd esh-ext esh-proc esh-arg eldoc esh-groups eshell esh-module esh-mode esh-util conf-mode newcomment help-mode bookmark mule-util cal-move view cal-china lunar solar cal-dst cal-bahai cal-islam cal-hebrew holidays hol-loaddefs diary-lib diary-loaddefs cal-iso org-wl org-w3m org-vm org-rmail org-mhe org-mew org-irc org-jsinfo org-infojs org-html org-exp ob-exp org-exp-blocks org-info org-gnus org-docview org-bibtex org-bbdb org-agenda ehelp electric dired-aux mew-varsx mew-w3m w3m doc-view jka-compr image-mode timezone w3m-hist w3m-fb w3m-ems w3m-ccl ccl w3m-favicon w3m-image w3m-proc w3m-util mew-auth mew-config mew-imap2 mew-imap mew-nntp2 mew-nntp mew-pop mew-smtp mew-ssl mew-ssh mew-net mew-highlight mew-sort mew-fib mew-ext mew-refile mew-demo mew-attach mew-draft mew-message mew-thread mew-virtual mew-summary4 mew-summary3 mew-summary2 mew-summary mew-search mew-pick mew-passwd mew-scan mew-syntax mew-bq mew-smime mew-pgp mew-header mew-exec mew-mark mew-mime mew-edit mew-decode mew-encode mew-cache mew-minibuf mew-complete mew-addrbook mew-local mew-darwin mew-vars3 mew-vars2 mew-vars mew-env mew-mule3 mew-mule mew-gemacs mew-key mew-func mew-blvs mew-const mew coffee-mode windmove framemove ensime ensime-undo ensime-refactor ensime-builder ensime-debug ensime-inf ensime-sbt ensime-auto-complete ensime-config auto-complete popup hideshow fortress-mode ansi-color scala-mode-auto pure-mode org-remember org-datetree org-clock org ob-emacs-lisp ob-keys ob-comint ob-tangle ob-ref ob-lob ob-table ob org-footnote org-src org-list org-faces org-compat org-entities org-macs noutline outline org-install ahg grep ewoc maxima maxima-font-lock teyjus magit parse-time tex-site tramp-imap tramp-gw tramp-fish tramp-smb tramp-cache tramp-ftp tramp-cmds tramp auth-source gnus-util netrc time-date password-cache format-spec tramp-compat trampver ess-toolbar ess-mous mouseme compile thingatpt browse-url ess-menu speedbar sb-image ezimage dframe assoc ess-swv ess-noweb noweb-font-lock-mode essl-bugs essd-omg essl-omg essd-els essd-sas essl-sas essa-sas executable shell essd-arc essd-vst essd-xls essl-lsp essd-sta essl-sta cc-vars cc-defs make-regexp essd-sp6 essd-sp5 essd-sp3 essd-r essd-r-args essl-s ess-inf ess-utils ess-mode noweb-mode ess ess-cust ess-emcs ess-site proof-site proof-autoloads pg-vars comint remember-planner remember planner-multi crm planner cal-menu calendar cal-loaddefs sort muse-html muse-xml-common muse-colors pcomplete cus-edit muse-publish muse-project muse-protocols info muse-regexps muse muse-nested-tags muse-mode server ido psvn byte-opt bytecomp byte-compile advice help-fns advice-preload derived edmacro kmacro wid-edit cl cl-19 log-edit ring pcvs-util add-log diff-mode easy-mmode pp elp ediff-merg ediff-diff ediff-wind ediff-mult ediff-help ediff-init ediff-util dired regexp-opt paren hl-line cus-start cus-load tooltip ediff-hook vc-hooks lisp-float-type mwheel ns-win easymenu tool-bar dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mldrag mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev loaddefs button minibuffer faces cus-face files text-properties overlay md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process ns multi-tty emacs)
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:bug#7913
; Package emacs,ns
.
(Tue, 01 Feb 2011 07:42:01 GMT) Full text and rfc822 format available.Message #8 received at 7913 <at> debbugs.gnu.org (full text, mbox):
From: Jan Djärv <jan.h.d <at> swipnet.se> To: Dragan Ivanovic <idragan <at> clip.dia.fi.upm.es> Cc: 7913 <at> debbugs.gnu.org Subject: Re: bug#7913: 23.2; Mac OS X Dual Spacing Fonts Fix (Patch supplied) Date: Tue, 01 Feb 2011 08:49:55 +0100
> > Emacs (v23.2 distro in my case) has a known problem with determining > pixel width of frames when using dual-space (Japanese) fonts. It > arises because the maximum pixel width of characters in those fonts is > way bigger than (usually double the size of) the printable ASCII > characters. Therefore, windows open twice as wide, and the > intelligent line wrapping (as in man or Mew, my favorite email reader) > gets the metrics wrong and forces the text to be wrapped to about one > third of the frame width. > > Patches for X-Windows versions are known, and can be found on Ubuntu > mailing lists. The same problem appears on NextSTEP, i.e., Mac OS > X/Cocoa version. Below is the patch that solves the problem: > > % .................................................................. > > --- nsfont-old.m 2011-01-18 13:36:39.000000000 +0100 > +++ nsfont.m 2011-01-18 13:36:17.000000000 +0100 > @@ -885,9 +885,29 @@ nsfont_open (FRAME_PTR f, Lisp_Object fo > font->ascent = lrint([sfont ascender]); > font->descent = -lrint(floor([sfont descender])); > font->min_width = ns_char_width(sfont, '|'); > - font->space_width = lrint (ns_char_width (sfont, ' ')); > - font->average_width = lrint (font_info->width); > - font->max_width = lrint (font_info->max_bounds.width); > + if([nsfont isFixedPitch]) { > + /* This is a "dirty" fix to avoid problem with some (mostly > + Japanese) fonts that use dual spacing. Unlike in the patches > + to "ftfont.c" and "xftfont.c", in Cocoa we cannot rely on a > + flag (FC_DUAL) to tell us if a fixed width font uses dual > + spacing or not. > + > + To avoid some problems with spaces (e.g. inside the vebatim > + LaTeX environment when using AUCTeX), we measure the width of > + a "regular" character, e.g. M (the size of em-space). */ > + font->space_width = lrint (ns_char_width (sfont, 'M')); > + /* We assume it is the average width. */ > + font->average_width = font->space_width; > + /* We also assume it is the maximal width. This may possibly > + cause some side effects, but I am not aware of any right > + now. */ > + font->max_width = font->space_width; > + } else { > + /* This is the normal v23.2 code */ > + font->space_width = lrint (ns_char_width (sfont, ' ')); > + font->average_width = lrint (font_info->width); > + font->max_width = lrint (font_info->max_bounds.width); > + } > font->height = lrint (font_info->height); > font->underline_position = lrint (font_info->underpos); > font->underline_thickness = lrint (font_info->underwidth); Basically what you do is replace average width with the width of 'M'? If it is a fixed pitch font, max_width, average_width and space_width should all be the same so I don't understand why you substituted space for 'M'. I'm guessing it is the setting of max_width that fixes the problem? Does this make your frames half as big as they where before? Do you have a font I can use to see the problem? Jan D. Jan D.
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:bug#7913
; Package emacs,ns
.
(Tue, 01 Feb 2011 10:05:01 GMT) Full text and rfc822 format available.Message #11 received at 7913 <at> debbugs.gnu.org (full text, mbox):
From: Dragan Ivanovic <idragan <at> clip.dia.fi.upm.es> To: jan.h.d <at> swipnet.se Cc: 7913 <at> debbugs.gnu.org Subject: Re: bug#7913: 23.2; Mac OS X Dual Spacing Fonts Fix (Patch supplied) Date: Tue, 01 Feb 2011 11:12:58 +0100 (CET)
Hi, From: Jan Djärv <jan.h.d <at> swipnet.se> Subject: Re: bug#7913: 23.2; Mac OS X Dual Spacing Fonts Fix (Patch supplied) Date: Tue, 01 Feb 2011 08:49:55 +0100 > Basically what you do is replace average width with the width of 'M'? > If it is a fixed pitch font, max_width, average_width and space_width > should all be the same so I don't understand why you substituted space > for 'M'. I'm guessing it is the setting of max_width that fixes the > problem? > Does this make your frames half as big as they where before? It turns out that some very good monospace fonts (mostly Japanese-made), such as those in the M+ family: http://mplus-fonts.sourceforge.jp/ contain glyphs of two sizes: the "normal" size for ASCII characters, and double width for ideograms (Japanese characters). So the fonts are declared as monospaced, and they are, but within these two separate realms. While font attributes on X systems include FC_DUAL to indicate that situation, on Macs the FixedPitch property does not differentiate. Therefore, max_width is not the same as average_width and space_width. Now, there are two problems I have experienced there on Max/Cocoa, and tried to address in the patch I sent: 1) Frames open twice as wide when using e.g. "M+ 1m" font. This is addressed by using the width of a printable character instead of the maximum width from the font metrics. (Btw., I don't know how this affects Japanese users.) It is not just the annoyance of having to resize fonts, of course, but also that all automatic text wrapping works wrongly. Font metrics is obviously not reliable in this case. Admittedly, choice of a character in the range 32-126 should not be significant here, but: 2) In my experience, some otherwise monospaced fonts, such as Courier, tend to have wrong width for space in Emacs (it is much thinner than other characters). I used to run into this all the time while using LaTeX (AUCTeX) in Emacs, which, by default, uses Courier for the verbatim environment, where I usually put listings. It is extremely annoying to have the space of the "|" width there and see your listings garbled for no obvious reason. I don't know what's causing this. Once I replaced ' ' with 'M' in calculation of the space size, this problem has vanished. It could be another letter, but 'm' (em-space, the widest letter), 'x' (ex-space, medium width letter) and 'n' (en-space, a thin letter) are normally used as the characteristic character widths in typography, so I chose 'M'. By the way, Emacs patches for 1) can be found on Ubuntu forums, of course for the X-based systems. Cheers, -- Dragan
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:bug#7913
; Package emacs,ns
.
(Wed, 02 Feb 2011 19:10:03 GMT) Full text and rfc822 format available.Message #14 received at 7913 <at> debbugs.gnu.org (full text, mbox):
From: Jan Djärv <jan.h.d <at> swipnet.se> To: Dragan Ivanovic <idragan <at> clip.dia.fi.upm.es> Cc: 7913 <at> debbugs.gnu.org Subject: Re: bug#7913: 23.2; Mac OS X Dual Spacing Fonts Fix (Patch supplied) Date: Wed, 02 Feb 2011 20:17:28 +0100
Dragan Ivanovic skrev 2011-02-01 11.12: > > 1) Frames open twice as wide when using e.g. "M+ 1m" font. This is > addressed by using the width of a printable character instead of > the maximum width from the font metrics. (Btw., I don't know how > this affects Japanese users.) It is this part that must be solved. I guess these fonts are intended for Japanese users. Jan D.
Chong Yidong <cyd <at> gnu.org>
to control <at> debbugs.gnu.org
.
(Thu, 16 Aug 2012 05:57:02 GMT) Full text and rfc822 format available.bug-gnu-emacs <at> gnu.org
:bug#7913
; Package emacs,ns
.
(Thu, 16 Aug 2012 06:54:01 GMT) Full text and rfc822 format available.Message #19 received at 7913 <at> debbugs.gnu.org (full text, mbox):
From: Chong Yidong <cyd <at> gnu.org> To: Dragan Ivanovic <idragan <at> clip.dia.fi.upm.es> Cc: 7913 <at> debbugs.gnu.org, jan.h.d <at> swipnet.se Subject: Re: bug#7913: 23.2; Mac OS X Dual Spacing Fonts Fix (Patch supplied) Date: Thu, 16 Aug 2012 14:44:21 +0800
Dragan Ivanovic <idragan <at> clip.dia.fi.upm.es> writes: > 1) Frames open twice as wide when using e.g. "M+ 1m" font. This is > addressed by using the width of a printable character instead of > the maximum width from the font metrics. (Btw., I don't know how > this affects Japanese users.) It is not just the annoyance of > having to resize fonts, of course, but also that all automatic text > wrapping works wrongly. Font metrics is obviously not reliable in > this case. Admittedly, choice of a character in the range 32-126 > should not be significant here, but: I committed a change to trunk so that the average character width for a font is now calculated by an average over printable ASCII characters (similar to how we do it for Xft). Could you try that and see if it makes any difference?
Chong Yidong <cyd <at> gnu.org>
to control <at> debbugs.gnu.org
.
(Sun, 16 Sep 2012 04:58:01 GMT) Full text and rfc822 format available.Debbugs Internal Request <help-debbugs <at> gnu.org>
to internal_control <at> debbugs.gnu.org
.
(Sun, 14 Oct 2012 11:24:03 GMT) Full text and rfc822 format available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.