Skip to content

Commit 698dd8f

Browse files
Vasily Galkinkaiw
authored andcommitted
Use native fonts on win32 instead of FontConfig (bgo#785313)
The version 1.34 selected as pangocairo_requirement is the first version with PangoCairo.FontMap.set_default behaviour identical to the version Pango 1.40 which was used for testing. It maybe works with previous versions too, but they are ancient. Code assumes that version requirement is satisfied if import of both Gtk and PangoCairo succeeds since Gtk 3.14 depends on Pango 1.36
1 parent 78a12d6 commit 698dd8f

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

bin/meld

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ def check_requirements():
173173
gtk_requirement = (3, 14)
174174
glib_requirement = (2, 36, 0)
175175
gtksourceview_requirement = (3, 14, 0)
176+
pangocairo_requirement = (1, 34)
176177

177178
def missing_reqs(mod, ver, exception=None):
178179
if isinstance(exception, ImportError):
@@ -209,6 +210,13 @@ def check_requirements():
209210
except (ImportError, AssertionError) as e:
210211
missing_reqs("GtkSourceView", gtksourceview_requirement, e)
211212

213+
try:
214+
gi.require_version("PangoCairo", "1.0")
215+
from gi.repository import PangoCairo
216+
# Only check that imports ok; the version is fine since Gtk loaded fine
217+
except (ImportError, ValueError) as e:
218+
missing_reqs("PangoCairo", pangocairo_requirement, e)
219+
212220

213221
def setup_resources():
214222
from gi.repository import GLib
@@ -347,5 +355,10 @@ if __name__ == '__main__':
347355
from gi.repository import GLib
348356
GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT,
349357
lambda *args: meld.meldapp.app.quit(), None)
358+
if sys.platform == 'win32':
359+
# FontConfig on win32 at least with version <= 2.12.6 can cause several
360+
# minutes 'hang' during first startup. So use native fonts backend.
361+
from gi.repository import PangoCairo
362+
PangoCairo.FontMap.set_default(PangoCairo.Win32FontMap())
350363
status = meld.meldapp.app.run(sys.argv)
351364
sys.exit(status)

0 commit comments

Comments
 (0)