From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 25 10:04:35 2011 Received: (at submit) by debbugs.gnu.org; 25 Jan 2011 15:04:35 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PhkRc-0003xK-HI for submit@debbugs.gnu.org; Tue, 25 Jan 2011 10:04:34 -0500 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Phgjl-0005pv-8A for submit@debbugs.gnu.org; Tue, 25 Jan 2011 06:07:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PhgrX-0007Xo-LJ for submit@debbugs.gnu.org; Tue, 25 Jan 2011 06:15:05 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:53463) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PhgrX-0007Xk-Fx for submit@debbugs.gnu.org; Tue, 25 Jan 2011 06:15:03 -0500 Received: from [140.186.70.92] (port=46530 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PhgrV-0005um-CF for bug-gnu-emacs@gnu.org; Tue, 25 Jan 2011 06:15:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PhgrS-0007Vb-SP for bug-gnu-emacs@gnu.org; Tue, 25 Jan 2011 06:15:01 -0500 Received: from edison.ccupm.upm.es ([138.100.198.71]:59741 helo=smtp.upm.es) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PhgrS-0007LU-C6 for bug-gnu-emacs@gnu.org; Tue, 25 Jan 2011 06:14:58 -0500 Received: from localhost (imdea-software.fi.upm.es [138.100.13.220]) (authenticated bits=0) by smtp.upm.es (8.14.3/8.14.3/edison-001) with ESMTP id p0PBE3FD027344 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Tue, 25 Jan 2011 12:14:07 +0100 Date: Tue, 25 Jan 2011 12:14:01 +0100 (CET) Message-Id: <20110125.121401.462117088.idragan@clip.dia.fi.upm.es> To: bug-gnu-emacs@gnu.org Subject: 23.2; Mac OS X Dual Spacing Fonts Fix (Patch supplied) From: Dragan Ivanovic X-Mailer: Mew version 6.3 on Emacs 23.2 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Spam-Score: -5.9 (-----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Tue, 25 Jan 2011 10:04:30 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.9 (-----) 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@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 C-a C-y C-a C-e C-a C-SPC C-w C-x C-s C-c C-t p R - 2 0 1 1 - C-_ S C C . 2 - 2 0 1 0 1 SPC C-a C-c C-t p C-x C-s C-c a t t c N r N 4 r 4 0 0 r C-x 5 2 C-x C-f C-f ~ / i n s t / a c t i C-x k C-x k M-x e s h e l l C-x k M-x s h e l l p w d a n SPC t SPC d e m o - s s . s t a r t M-x r e p o r b 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) From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 01 02:41:47 2011 Received: (at 7913) by debbugs.gnu.org; 1 Feb 2011 07:41:48 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PkArz-0003Ze-ML for submit@debbugs.gnu.org; Tue, 01 Feb 2011 02:41:47 -0500 Received: from smtprelay-h22.telenor.se ([195.54.99.197]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PkArw-0003ZP-15 for 7913@debbugs.gnu.org; Tue, 01 Feb 2011 02:41:45 -0500 Received: from ipb4.telenor.se (ipb4.telenor.se [195.54.127.167]) by smtprelay-h22.telenor.se (Postfix) with ESMTP id 847AFC36B for <7913@debbugs.gnu.org>; Tue, 1 Feb 2011 08:50:05 +0100 (CET) X-SENDER-IP: [85.225.45.100] X-LISTENER: [smtp.bredband.net] X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao81AG5KR01V4S1kPGdsb2JhbACIYJwiDAEBAQE1L7sqhVEEj2M X-IronPort-AV: E=Sophos;i="4.60,409,1291590000"; d="scan'208";a="1710796674" Received: from c-642de155.25-1-64736c10.cust.bredbandsbolaget.se (HELO coolsville.localdomain) ([85.225.45.100]) by ipb4.telenor.se with ESMTP; 01 Feb 2011 08:50:05 +0100 Received: from [172.20.199.2] (gaffa [172.20.199.2]) by coolsville.localdomain (Postfix) with ESMTP id 1D38E7FA05A; Tue, 1 Feb 2011 08:50:04 +0100 (CET) Message-ID: <4D47BB23.8020007@swipnet.se> Date: Tue, 01 Feb 2011 08:49:55 +0100 From: =?ISO-8859-1?Q?Jan_Dj=E4rv?= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 MIME-Version: 1.0 To: Dragan Ivanovic Subject: Re: bug#7913: 23.2; Mac OS X Dual Spacing Fonts Fix (Patch supplied) References: <20110125.121401.462117088.idragan@clip.dia.fi.upm.es> In-Reply-To: <20110125.121401.462117088.idragan@clip.dia.fi.upm.es> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 7913 Cc: 7913@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.3 (--) > > 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. From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 01 05:04:59 2011 Received: (at 7913) by debbugs.gnu.org; 1 Feb 2011 10:05:00 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PkD6Z-0000bF-Gn for submit@debbugs.gnu.org; Tue, 01 Feb 2011 05:04:59 -0500 Received: from edison.ccupm.upm.es ([138.100.198.71] helo=smtp.upm.es) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PkD6X-0000ar-CA for 7913@debbugs.gnu.org; Tue, 01 Feb 2011 05:04:58 -0500 Received: from localhost (imdea-software.fi.upm.es [138.100.13.220]) (authenticated bits=0) by smtp.upm.es (8.14.3/8.14.3/edison-001) with ESMTP id p11ACwmV001785 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 1 Feb 2011 11:13:18 +0100 Date: Tue, 01 Feb 2011 11:12:58 +0100 (CET) Message-Id: <20110201.111258.347153172.idragan@clip.dia.fi.upm.es> To: jan.h.d@swipnet.se Subject: Re: bug#7913: 23.2; Mac OS X Dual Spacing Fonts Fix (Patch supplied) From: Dragan Ivanovic In-Reply-To: <4D47BB23.8020007@swipnet.se> References: <20110125.121401.462117088.idragan@clip.dia.fi.upm.es> <4D47BB23.8020007@swipnet.se> X-Mailer: Mew version 6.3 on Emacs 23.2 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -6.3 (------) X-Debbugs-Envelope-To: 7913 Cc: 7913@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.4 (------) Hi, From: Jan Dj=E4rv Subject: Re: bug#7913: 23.2; Mac OS X Dual Spacing Fonts Fix (Patch sup= plied) 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 spac= e > 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 From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 02 14:09:06 2011 Received: (at 7913) by debbugs.gnu.org; 2 Feb 2011 19:09:06 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Pki4f-0005OO-LL for submit@debbugs.gnu.org; Wed, 02 Feb 2011 14:09:06 -0500 Received: from smtprelay-b12.telenor.se ([62.127.194.21]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Pki4d-0005Nu-LK for 7913@debbugs.gnu.org; Wed, 02 Feb 2011 14:09:04 -0500 Received: from ipb1.telenor.se (ipb1.telenor.se [195.54.127.164]) by smtprelay-b12.telenor.se (Postfix) with ESMTP id 7C8C2EA131 for <7913@debbugs.gnu.org>; Wed, 2 Feb 2011 20:17:29 +0100 (CET) X-SENDER-IP: [85.225.45.100] X-LISTENER: [smtp.bredband.net] X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmQ4AHs8SU1V4S1kPGdsb2JhbACIYJw7DAEBAQE1L7t/hVMEjws X-IronPort-AV: E=Sophos;i="4.60,415,1291590000"; d="scan'208";a="171215201" Received: from c-642de155.25-1-64736c10.cust.bredbandsbolaget.se (HELO coolsville.localdomain) ([85.225.45.100]) by ipb1.telenor.se with ESMTP; 02 Feb 2011 20:17:29 +0100 Received: from [172.20.199.13] (zeplin [172.20.199.13]) by coolsville.localdomain (Postfix) with ESMTPSA id 4A6747FA05A; Wed, 2 Feb 2011 20:17:28 +0100 (CET) Message-ID: <4D49ADC8.8080704@swipnet.se> Date: Wed, 02 Feb 2011 20:17:28 +0100 From: =?ISO-8859-1?Q?Jan_Dj=E4rv?= User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; sv-SE; rv:1.9.2.14) Gecko/20110123 Thunderbird/3.1.8 MIME-Version: 1.0 To: Dragan Ivanovic Subject: Re: bug#7913: 23.2; Mac OS X Dual Spacing Fonts Fix (Patch supplied) References: <20110125.121401.462117088.idragan@clip.dia.fi.upm.es> <4D47BB23.8020007@swipnet.se> <20110201.111258.347153172.idragan@clip.dia.fi.upm.es> In-Reply-To: <20110201.111258.347153172.idragan@clip.dia.fi.upm.es> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 7913 Cc: 7913@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.3 (--) 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. From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 16 01:56:32 2012 Received: (at control) by debbugs.gnu.org; 16 Aug 2012 05:56:32 +0000 Received: from localhost ([127.0.0.1]:60182 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T1t4K-0000yb-3G for submit@debbugs.gnu.org; Thu, 16 Aug 2012 01:56:32 -0400 Received: from mail-pz0-f44.google.com ([209.85.210.44]:52748) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T1t47-0000yG-Ic for control@debbugs.gnu.org; Thu, 16 Aug 2012 01:56:31 -0400 Received: by dakr19 with SMTP id r19so411826dak.3 for ; Wed, 15 Aug 2012 22:47:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:mime-version:content-type; bh=RPZikFsJi8LbZ046vJvrTAQ3heiM3NZEAXAvYa/v764=; b=NL4flUPsiZhsxZC08lu6SNBl/2lIj4SG9PkqXnpGeL/9Xtig1zRj2DLIkAs6J7hcaW sNXP9vrFqVQ1NctgDGNb8KXgrQbA4/GlAiPsbS4q53np0Ck0zWgNNgvNW5ciEb8jxZDR D85F1gX21oYjkgE1/jP/Zzz9xhPGByrOtmirmJNN4Q7IQGFRlUVqyn6as/fam2y6UIUm Ujup9EX0+VsGyAnt7mRr+Fo5QF3eSrN1mjruTBccmFMifsa8AOU5/TwLQ4hdKE3/v7tZ /gy57z4rr3S0/6NLn4is7CwwCMEmd0jRY9KeBvy++qtaCvK+H1+lh/IZczrOJ/AwUF3J igWA== Received: by 10.68.237.74 with SMTP id va10mr1008655pbc.46.1345096051196; Wed, 15 Aug 2012 22:47:31 -0700 (PDT) Received: from ulysses ([155.69.19.170]) by mx.google.com with ESMTPS id pv8sm1947939pbb.25.2012.08.15.22.47.28 (version=SSLv3 cipher=OTHER); Wed, 15 Aug 2012 22:47:30 -0700 (PDT) From: Chong Yidong To: control@debbugs.gnu.org Subject: merge 7913 2806 Date: Thu, 16 Aug 2012 13:47:25 +0800 Message-ID: <878vdfs80i.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) merge 7913 2806 thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 16 02:53:23 2012 Received: (at 7913) by debbugs.gnu.org; 16 Aug 2012 06:53:23 +0000 Received: from localhost ([127.0.0.1]:60288 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T1txI-00039H-EW for submit@debbugs.gnu.org; Thu, 16 Aug 2012 02:53:22 -0400 Received: from mail-pb0-f44.google.com ([209.85.160.44]:60133) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T1txE-000398-IQ for 7913@debbugs.gnu.org; Thu, 16 Aug 2012 02:53:18 -0400 Received: by pbbrr4 with SMTP id rr4so1301281pbb.3 for <7913@debbugs.gnu.org>; Wed, 15 Aug 2012 23:44:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=j7Q3c6YPn5tceE8wUILSHyvNatxA18QTgD0VV30c0pA=; b=a4OA0YQ9yF8EWg++Cwka71I3rWfMRSnJiflw2UY7zDFnUQFNbpiNhhqEPc3jA4YP84 SrwWNvp/h3Ev3hm9dzAQK+xBrT0F6LPrDVRdPAGh30vHoXYL51xIjSdoElc1amqsAvOI RweFNEf9iaUS7A/JlAUxRv3CJ9i3/KvMcbSEOnwrh6f/qJlqJnRNMutopuzJ3c7xy+zI RzFiXeJ3X674Z3EOrtVrXq9TlTDmvd9tD77bctSwcvBEN56viSFooxL/gyHNLOe2ZUaO 0LsbWs94pS6vazWk/C7z3jybAkliOa7+n87ldpdr+wkHq1MjaLfCerNr1Tf7Xftd/BTI 85eA== Received: by 10.68.227.169 with SMTP id sb9mr1218973pbc.104.1345099467763; Wed, 15 Aug 2012 23:44:27 -0700 (PDT) Received: from ulysses ([155.69.19.170]) by mx.google.com with ESMTPS id nr8sm2045023pbc.43.2012.08.15.23.44.24 (version=SSLv3 cipher=OTHER); Wed, 15 Aug 2012 23:44:26 -0700 (PDT) From: Chong Yidong To: Dragan Ivanovic Subject: Re: bug#7913: 23.2; Mac OS X Dual Spacing Fonts Fix (Patch supplied) References: <20110125.121401.462117088.idragan@clip.dia.fi.upm.es> <4D47BB23.8020007@swipnet.se> <20110201.111258.347153172.idragan@clip.dia.fi.upm.es> Date: Thu, 16 Aug 2012 14:44:21 +0800 In-Reply-To: <20110201.111258.347153172.idragan@clip.dia.fi.upm.es> (Dragan Ivanovic's message of "Tue, 01 Feb 2011 11:12:58 +0100 (CET)") Message-ID: <87a9xvfi9m.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 7913 Cc: 7913@debbugs.gnu.org, jan.h.d@swipnet.se X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Dragan Ivanovic 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? From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 16 00:57:43 2012 Received: (at control) by debbugs.gnu.org; 16 Sep 2012 04:57:43 +0000 Received: from localhost ([127.0.0.1]:36231 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TD6vP-0007Xz-AN for submit@debbugs.gnu.org; Sun, 16 Sep 2012 00:57:43 -0400 Received: from mail-oa0-f44.google.com ([209.85.219.44]:56283) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TD6vM-0007Xr-WE for control@debbugs.gnu.org; Sun, 16 Sep 2012 00:57:41 -0400 Received: by oagk14 with SMTP id k14so3796900oag.3 for ; Sat, 15 Sep 2012 21:56:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:mime-version:content-type; bh=X5FEXTejQh8VDQdJXN9X3vi6mtfNrrC2OgGwOFNWehQ=; b=ilP/zT+SPCO0oVpfB2DqslheSbmoyUjtODXRwTpLZWFuZZ0R/YqzCJqR344mHEVy9x EsQynGTiogp7ha5zDTEXNQEjj8k9kT7yp7a5fO+rxOnXVTC1m6sFqUlZPIIJL03DouRz 8W4mNVbUYvjmuSgKwAiYth31oInWe5mUWyFqvDKkjwF2EbV8oLOLspSiwMlYrt1PK18u L1vG9EJ262m+pmm74pY5zlQYNfQigGmgIyMk0fgFGnIxoeGtn6FoWUVyvJ5du0ME86g1 VgcCwjPIGIeb95lLLqTAZvR5y4uol6olrAqy8HC0aOAITOGP1o6Bczh2CJwpv3Y/4Nol URbA== Received: by 10.60.5.234 with SMTP id v10mr8513327oev.59.1347771393995; Sat, 15 Sep 2012 21:56:33 -0700 (PDT) Received: from ulysses (cm162.gamma80.maxonline.com.sg. [202.156.80.162]) by mx.google.com with ESMTPS id q3sm5592049oef.0.2012.09.15.21.56.31 (version=SSLv3 cipher=OTHER); Sat, 15 Sep 2012 21:56:33 -0700 (PDT) From: Chong Yidong To: control@debbugs.gnu.org Subject: close 7913 Date: Sun, 16 Sep 2012 12:56:27 +0800 Message-ID: <871ui21s78.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) close 7913 thanks From unknown Fri Jun 20 07:17:40 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 14 Oct 2012 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator