diff --git a/DemoPrograms/Demo_Fonts_Using_pyglet.py b/DemoPrograms/Demo_Fonts_Using_pyglet.py new file mode 100644 index 00000000..d43db734 --- /dev/null +++ b/DemoPrograms/Demo_Fonts_Using_pyglet.py @@ -0,0 +1,38 @@ +import pyglet +import PySimpleGUI as sg + +""" + Demo - Using pyglet to get custom fonts into PySimpleGUI + + Original code by @jason990420 + + Copyright 2022 PySimpleGUI + + Font information: + Copyright (c) 2020, Walter E Stewart, + with Reserved Font Name Open Flame. + https://www.1001freefonts.com/open-flame.font + This Font Software is licensed under the SIL Open Font License, Version 1.1. + This license is copied below, and is also available with a FAQ at: + http://scripts.sil.org/OFL +""" + +pyglet.font.add_file(r".\OpenFlame.ttf") + +font1 = ("Open Flame", 40) # Note - use the font "face name" not the filename when specifying the font +font2 = ("Courier New", 40) +font3 = ("Helvetica", 40) +text_string = "ABCDEFG abcdefg 1234567890" + +layout = [ [sg.Text(text_string, font=font1)], + [sg.Text(text_string, font=font2)], + [sg.Text(text_string, font=font3)] ] + +window = sg.Window('Adding Fonts', layout) + +while True: + event, values = window.read() + if event == sg.WINDOW_CLOSED: + break + +window.close() diff --git a/DemoPrograms/OpenFlame.ttf b/DemoPrograms/OpenFlame.ttf new file mode 100644 index 00000000..304e0b90 Binary files /dev/null and b/DemoPrograms/OpenFlame.ttf differ