From c1b1c914b10781715bb6a2e7fc061e6e506fb92f Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Mon, 18 Feb 2019 10:10:56 +0000 Subject: Add fonts for pillow * wqflask/wqflask/marker_regression/display_mapping_results.py: replace piddle method with PIL.ImageFont * wqflask/wqflask/static/fonts: Add fonts in path --- .../marker_regression/display_mapping_results.py | 15 +++++++++------ wqflask/wqflask/static/fonts/README | 1 + wqflask/wqflask/static/fonts/arial.ttf | Bin 0 -> 151232 bytes wqflask/wqflask/static/fonts/fnt_bs.ttf | Bin 0 -> 20988 bytes wqflask/wqflask/static/fonts/trebucbd.ttf | Bin 0 -> 123828 bytes wqflask/wqflask/static/fonts/verdana.ttf | Bin 0 -> 139640 bytes 6 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 wqflask/wqflask/static/fonts/README create mode 100644 wqflask/wqflask/static/fonts/arial.ttf create mode 100644 wqflask/wqflask/static/fonts/fnt_bs.ttf create mode 100644 wqflask/wqflask/static/fonts/trebucbd.ttf create mode 100644 wqflask/wqflask/static/fonts/verdana.ttf diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py index 9b406b72..6f50601d 100644 --- a/wqflask/wqflask/marker_regression/display_mapping_results.py +++ b/wqflask/wqflask/marker_regression/display_mapping_results.py @@ -72,10 +72,13 @@ MEDIUMPURPLE = ImageColor.getrgb("mediumpurple") # ---- END: Define common colours ---- # # ---- FONT FILES ---- # -VERDANA_FILE = "fonts/ttf/verdana.ttf" -TREBUC_FILE = "fonts/ttf/trebucbd.ttf" -FNT_BS_FILE = "fonts/ttf/fnt_bs.ttf" -ARIAL_FILE = "fonts/ttf/arial.ttf" +VERDANA_FILE = "./wqflask/static/fonts/verdana.ttf" +TREBUC_FILE = "./wqflask/static/fonts/trebucbd.ttf" +FNT_BS_FILE = "./wqflask/static/fonts/fnt_bs.ttf" +ARIAL_FILE = "./wqflask/static/fonts/arial.ttf" + +assert(os.path.isfile(VERDANA_FILE)) + # ---- END: FONT FILES ---- # ######################################### @@ -2008,8 +2011,8 @@ class DisplayMappingResults(object): js_data['max_score'] = LRS_LOD_Max self.js_data = json.dumps(js_data) - LRSScaleFont=pid.Font(ttf="verdana", size=16*zoom, bold=0) - LRSLODFont=pid.Font(ttf="verdana", size=18*zoom*1.5, bold=0) + LRSScaleFont=ImageFont.truetype(font=VERDANA_FILE, size=16*zoom) + LRSLODFont=ImageFont.truetype(font=VERDANA_FILE, size=int(18*zoom*1.5)) yZero = yTopOffset + plotHeight LRSHeightThresh = drawAreaHeight diff --git a/wqflask/wqflask/static/fonts/README b/wqflask/wqflask/static/fonts/README new file mode 100644 index 00000000..75a3e444 --- /dev/null +++ b/wqflask/wqflask/static/fonts/README @@ -0,0 +1 @@ +These fonts are used by pillow for 'interval mapping' diff --git a/wqflask/wqflask/static/fonts/arial.ttf b/wqflask/wqflask/static/fonts/arial.ttf new file mode 100644 index 00000000..bf0d4a95 Binary files /dev/null and b/wqflask/wqflask/static/fonts/arial.ttf differ diff --git a/wqflask/wqflask/static/fonts/fnt_bs.ttf b/wqflask/wqflask/static/fonts/fnt_bs.ttf new file mode 100644 index 00000000..712c38cf Binary files /dev/null and b/wqflask/wqflask/static/fonts/fnt_bs.ttf differ diff --git a/wqflask/wqflask/static/fonts/trebucbd.ttf b/wqflask/wqflask/static/fonts/trebucbd.ttf new file mode 100644 index 00000000..1ab1ae0a Binary files /dev/null and b/wqflask/wqflask/static/fonts/trebucbd.ttf differ diff --git a/wqflask/wqflask/static/fonts/verdana.ttf b/wqflask/wqflask/static/fonts/verdana.ttf new file mode 100644 index 00000000..754a9b7b Binary files /dev/null and b/wqflask/wqflask/static/fonts/verdana.ttf differ -- cgit v1.2.3