Closed shawnsihyunlee closed 9 months ago
Thanks @shawnsihyunlee! This looks reasonable. What happens if you try to use a font that doesn't exist on your computer? Is there an error or does it fallback to some other font? If there's an error, is the error easy to understand?
It seems to just fall back to Arial or some default font! No errors that lead to a crash or anything.
Terrific! I'll merge this and let you know when a new version is live on pypi.
The new version that includes your change (1.1.27) is live on PyPI now, so it can be installed via pip: https://pypi.org/project/cmu-graphics/#history
The zip file linked from our website is also updated. https://academy.cs.cmu.edu/desktop
Thanks again for your contribution!
(I just double checked and this worked for me once I upgraded the library.)
from cmu_graphics import *
def onMousePress(x, y):
Label('Hello, world!', x, y, font='Academy Engraved LET', size=64)
cmu_graphics.run()
This change allows users to use fonts other than Arial and Courier New. This is achieved by changing getFont() in shape_logic.py to actually use the baseFontName argument, whereas currently it forces users to use Arial if baseFontName is not one of several predefined fonts. This decision was likely made for avoiding compatibility issues, but the change allows students larger freedom in designing their offline projects.