Make font antialiasing configurable

This commit is contained in:
Chris Jones 2010-07-13 13:50:33 +01:00
parent 2d09f93773
commit bab0cc27d5
4 changed files with 40 additions and 9 deletions

View File

@ -154,6 +154,7 @@ DEFAULTS = {
'profiles': {
'default': {
'allow_bold' : True,
'antialias' : True,
'audible_bell' : False,
'visible_bell' : False,
'urgent_bell' : False,

View File

@ -884,6 +884,19 @@
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="antialias_checkbutton">
<property name="label" translatable="yes">Anti-alias text</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_antialias_checkbutton_toggled"/>
</object>
<packing>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="show_titlebar">
<property name="label" translatable="yes">Show titlebar</property>
@ -896,7 +909,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
<property name="position">4</property>
</packing>
</child>
<child>
@ -909,7 +922,7 @@
<signal name="toggled" handler="on_copy_on_selection_toggled"/>
</object>
<packing>
<property name="position">4</property>
<property name="position">5</property>
</packing>
</child>
<child>
@ -945,7 +958,7 @@
</object>
<packing>
<property name="expand">False</property>
<property name="position">5</property>
<property name="position">6</property>
</packing>
</child>
<child>
@ -1079,7 +1092,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">6</property>
<property name="position">7</property>
</packing>
</child>
<child>
@ -1180,7 +1193,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">7</property>
<property name="position">8</property>
</packing>
</child>
</object>

View File

@ -311,6 +311,9 @@ class PrefsEditor:
# Allow bold text
widget = guiget('allow_bold_checkbutton')
widget.set_active(self.config['allow_bold'])
# Anti-alias
widget = guiget('antialias_checkbutton')
widget.set_active(self.config['antialias'])
# Icon terminal bell
widget = guiget('icon_bell_checkbutton')
widget.set_active(self.config['icon_bell'])
@ -545,6 +548,11 @@ class PrefsEditor:
self.config['allow_bold'] = widget.get_active()
self.config.save()
def on_antialias_checkbutton_toggled(self, widget):
"""Anti-alias setting changed"""
self.config['antialias'] = widget.get_active()
self.config.save()
def on_show_titlebar_toggled(self, widget):
"""Show titlebar setting changed"""
self.config['show_titlebar'] = widget.get_active()

View File

@ -585,7 +585,7 @@ for %s (%s)' % (name, urlplugin.__class__.__name__))
font = self.config.get_system_font()
else:
font = self.config['font']
self.vte.set_font(pango.FontDescription(font))
self.set_font(pango.FontDescription(font))
except:
pass
self.vte.set_allow_bold(self.config['allow_bold'])
@ -1071,7 +1071,7 @@ for %s (%s)' % (name, urlplugin.__class__.__name__))
return
new_font.set_size(new_size)
dbg('setting new font: %s' % new_font)
self.vte.set_font(new_font)
self.set_font(new_font)
def is_zoomed(self):
"""Determine if we are a zoomed terminal"""
@ -1270,7 +1270,7 @@ for %s (%s)' % (name, urlplugin.__class__.__name__))
fontsize += pango.SCALE
pangodesc.set_size(fontsize)
self.vte.set_font(pangodesc)
self.set_font(pangodesc)
self.custom_font_size = fontsize
def zoom_orig(self):
@ -1280,9 +1280,18 @@ for %s (%s)' % (name, urlplugin.__class__.__name__))
else:
font = self.config['font']
dbg("Terminal::zoom_orig: restoring font to: %s" % font)
self.vte.set_font(pango.FontDescription(font))
self.set_font(pango.FontDescription(font))
self.custom_font_size = None
def set_font(self, fontdesc):
"""Set the font we want in VTE"""
antialias = self.config['antialias']
if antialias:
antialias = vte.ANTI_ALIAS_FORCE_ENABLE
else:
antialias = vte.ANTI_ALIAS_FORCE_DISABLE
self.vte.set_font_full(fontdesc, antialias)
def get_cursor_position(self):
"""Return the co-ordinates of our cursor"""
# FIXME: THIS METHOD IS DEPRECATED AND UNUSED