-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for TrueType and OpenType fonts #11
Comments
Hello Brian , did you have time to look at this feature ? did you have any news ? |
I have added the required support for OpenType/FreeType, TrueType and PIL Font files using PIL. When using TrueType etc anti-aliasing is turned off using lineType=LINE_8 or LINE_4. lineType=LINE_AA is the default. The font I tried with anti-aliasing turned off looked horrid but that's probably just a characteristic of the (free) font I selected. |
ok brian amazing ! i will test it soon ! thank you |
brian can you add some new examples for the new supported Fonts (PIL , ttf , otf ) to help me to know how i can manipulate them ? Regards , valentin |
Is your browser broken LOL? Try http://www.1001fonts.com/ and http://fonts.webtoolhub.com/?prefix=pil then you can choose whatever you like (Check licensing if intending to use for commercial purposes). Just pass the filename to LEDAnimator.Font.py. PIL fonts have two files .pil and .pbm - just use the .pil filename (The PBM is a portable bitmap for the font the PIL is the font information). |
ok thank you i know how to DL .ttf or .otf Fonts but i was speaking about how to integrate them in your library xD
Ok i understand but when i try with your attached fonts (ComicJensFreePro-Regular.ttf) in my Font object --> Can you help me please ? Regards , Valentin |
The error message last line says IOError: cannot open resource - which is computer speak for 'I can't find the font' (in this case) Since the fonts are in a folder called Fonts and your main.py is invoked from the folder LEDAnimator you need to add '../Fonts' to your font file path. ttf=Font("../fonts/ComicJensFreePro-Regular.ttf",fontSize) works for me. I get the same error as you if I leave off the ../Fonts/ from the start |
ok no exception now but i have absolutely no difference between ComicJensFreePro and FONT_HERSHEY_SIMPLEX |
ok my Bad , i haven't change the fontFace in Text object ... |
Just what I figured. LOL. |
ok i close the issue thank you brian , you're the best 👍 |
OpenCV appears to only use Hershey fonts.
Using PIL it is possible to read and render TrueType and OpenType fonts but requires converting the numpy array to a PIL image and back again.
The text was updated successfully, but these errors were encountered: