Fonts in emacs look different than in gedit or gnome-terminal

Bug #931849 reported by Peter Hurley
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
emacs23 (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

The same scalable font looks different in emacs than in gedit or gnome-terminal.

Attached are screenshots of 1) gedit with the Monospace 8 font and 2) emacs with the same font. Although each glyph rendering is nearly identical (you can zoom in with gimp), the emacs character spacing is wider (more space between glyphs).

When gedit renders text, the font size is scaled to the font library's dpi (the scaling is done by the pango library). Xft is typically set to 96 dpi resulting in a 1.3333 scale factor; so a font size of 8 becomes 10.666667.

Although a similiar scaling approach is employed by emacs, because the emacs font driver interface (which emacs uses to abstract the platform for rendering text) defines an *integer* pixelsize parameter, the same font size of 8 becomes 11 (emacs rounds the font size up). This accounts for the slightly exaggerated glyph spacing.

Tags: patch
Revision history for this message
Peter Hurley (phurley) wrote :
Revision history for this message
Peter Hurley (phurley) wrote :
Revision history for this message
Peter Hurley (phurley) wrote :

Attached is a workaround patch that does the dpi scaling in the emacs Xft font driver. This works by scaling the pixelsize by the frame's y-axis dpi. Thus it's necessary to explicitly set the font's pixelsize in either the .Xresources file or via the command line option --fn (see http://www.gnu.org/software/emacs/manual/html_node/emacs/Fonts.html for font setting methods and parameters).

AFAIK, the pixelsize cannot be set using the .emacs font setting method.

NB: Because of the different emacs binary names in ubuntu, if using the .Xresources font setting method, the resource should be wildcarded. Eg.,
    emacs*font: Monospace:pixelsize=8

Revision history for this message
Peter Hurley (phurley) wrote :
Revision history for this message
Peter Hurley (phurley) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "0001-Add-dpi-font-scaling-to-Xft-driver.patch" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in emacs23 (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.