fixed font handling
This commit is contained in:
@@ -12,16 +12,17 @@ font = _bkp_font
|
|||||||
|
|
||||||
def NSD_init(x: float, y: float):
|
def NSD_init(x: float, y: float):
|
||||||
#get input_img
|
#get input_img
|
||||||
global img, output_img, font
|
global img, output_img
|
||||||
#img = Image.open(input_dir + file_name + datei_endung)
|
#img = Image.open(input_dir + file_name + datei_endung)
|
||||||
img = Image.new("RGB", (x, y), "white")
|
img = Image.new("RGB", (x, y), "white")
|
||||||
output_img = ImageDraw.Draw(img)
|
output_img = ImageDraw.Draw(img)
|
||||||
|
|
||||||
def set_font(font_filepath: str):
|
def set_font(font_filepath: str):
|
||||||
if not os.path.exists(font_filepath):
|
if not os.path.exists(font_filepath):
|
||||||
raise FileNotFoundError("")
|
raise FileNotFoundError("TTF file was not found!")
|
||||||
|
global font
|
||||||
try:
|
try:
|
||||||
font = ImageFont.truetype(font_filepath)
|
font = ImageFont.truetype(font_filepath, 12)
|
||||||
except:
|
except:
|
||||||
font = _bkp_font
|
font = _bkp_font
|
||||||
raise
|
raise
|
||||||
@@ -50,9 +51,6 @@ def draw_generic_instruction(instruction: str, x, y, xsize, ysize) -> Iterable[f
|
|||||||
|
|
||||||
return x, y + ysize
|
return x, y + ysize
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def draw_if_statement(condition: str, x: int, y: int, xsize: int, ysize: int):
|
def draw_if_statement(condition: str, x: int, y: int, xsize: int, ysize: int):
|
||||||
"""Draw an if statement into the NSD"""
|
"""Draw an if statement into the NSD"""
|
||||||
if not output_img:
|
if not output_img:
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import os
|
|||||||
from interpreter.NassiShneidermann import NassiShneidermanDiagram
|
from interpreter.NassiShneidermann import NassiShneidermanDiagram
|
||||||
from draw.Iinstruction import *
|
from draw.Iinstruction import *
|
||||||
|
|
||||||
|
|
||||||
def nassi(filepath:str, output_path: str, gui, font_filepath: str=None):
|
def nassi(filepath:str, output_path: str, gui, font_filepath: str=None):
|
||||||
NSD = NassiShneidermanDiagram(gui.debug_mode)
|
NSD = NassiShneidermanDiagram(gui.debug_mode)
|
||||||
if font_filepath:
|
if font_filepath:
|
||||||
|
|||||||
Reference in New Issue
Block a user