dabo Commit
Revision 6577
Date: 2011-04-26 15:55:29 -0700 (Tue, 26 Apr 2011)
Author: Paul
Trac: http://trac.dabodev.com/changeset/6577

Changed:
U   trunk/dabo/lib/reportWriter.py

Log:
Add the system truetype font paths to reportWriter, which will result in 
auto-registration of specific fonts upon first use.

This works under my Ubuntu Linux, and should work for Mac, too. Will not
work for Windows until I figure out where fonts are stored on that 
platform and how to get that path in a generic manner.


Diff:
Modified: trunk/dabo/lib/reportWriter.py
===================================================================
--- trunk/dabo/lib/reportWriter.py      2011-04-26 18:40:02 UTC (rev 6576)
+++ trunk/dabo/lib/reportWriter.py      2011-04-26 22:55:29 UTC (rev 6577)
@@ -83,6 +83,19 @@
                TTFSearchPath.append(path)
 
 
+# Add the truetype font paths for the running system:
+if sys.platform[:3] == "lin":
+       fontPaths = [os.path.join("/usr/share/fonts/truetype", d) for d in 
os.listdir("/usr/share/fonts/truetype")]
+elif sys.platform[:3] == "dar":
+       fontPaths = ["/Network/Library/Fonts", "/Library/Fonts",        
"System/Library/Fonts", "~/Library/Fonts"]
+elif sys.platform[:3] == "win":
+       fontPaths = []
+
+for fontPath in fontPaths:
+       if os.path.exists(fontPath) and os.path.isdir(fontPath):
+               addReportTTFontFilePath(fontPath)
+
+# Add the truetype font path in dabo.settings:
 if dabo.reportTTFontFilePath:
        addReportTTFontFilePath(dabo.reportTTFontFilePath)
 



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to