Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is text shown larger under xvfb?

Tags:

python

fonts

xvfb

I'm trying to test a GUI application using Xvfb. The problem I'm having is that the application is sensitive to how large its text is, which is apparently different when using Xvfb. The default font and screen resolution are the same in both cases.

To be concrete, I have the following Python/PyGtk code, running on Ubuntu 12.04:

## fontsize_gtk.py

import gtk

e = gtk.Entry()
l = e.create_pango_layout("S")
print l.get_context().get_font_description().to_string()
print l.get_pixel_size()

So I run it using my real display and a virtual display of the same size:

$ python fontsize_gtk.py 
Sans 10
(8, 17)
$ Xvfb -ac -screen 0 1366x768x24 :2 > /dev/null 2>&1
$ env DISPLAY=:2 python fontsize_gtk.py
Sans 10
(9, 17)

Any ideas for why it's bigger, or how to go about debugging it?

like image 788
Geoff Bache Avatar asked Nov 13 '22 01:11

Geoff Bache


1 Answers

The font resolution (in DPI) is different.

like image 169
Ignacio Vazquez-Abrams Avatar answered Dec 06 '22 21:12

Ignacio Vazquez-Abrams