fixed font handling

This commit is contained in:
weckyy702
2020-12-27 16:51:57 +01:00
parent 2a33b6e90d
commit 8f3fb62186
2 changed files with 4 additions and 7 deletions

View File

@@ -12,16 +12,17 @@ font = _bkp_font
def NSD_init(x: float, y: float):
#get input_img
global img, output_img, font
global img, output_img
#img = Image.open(input_dir + file_name + datei_endung)
img = Image.new("RGB", (x, y), "white")
output_img = ImageDraw.Draw(img)
def set_font(font_filepath: str):
if not os.path.exists(font_filepath):
raise FileNotFoundError("")
raise FileNotFoundError("TTF file was not found!")
global font
try:
font = ImageFont.truetype(font_filepath)
font = ImageFont.truetype(font_filepath, 12)
except:
font = _bkp_font
raise
@@ -50,9 +51,6 @@ def draw_generic_instruction(instruction: str, x, y, xsize, ysize) -> Iterable[f
return x, y + ysize
def draw_if_statement(condition: str, x: int, y: int, xsize: int, ysize: int):
"""Draw an if statement into the NSD"""
if not output_img:

View File

@@ -3,7 +3,6 @@ import os
from interpreter.NassiShneidermann import NassiShneidermanDiagram
from draw.Iinstruction import *
def nassi(filepath:str, output_path: str, gui, font_filepath: str=None):
NSD = NassiShneidermanDiagram(gui.debug_mode)
if font_filepath: