
controlp5 - issue #46
ControlFont(PFont) doesn't work with .vlw-initialized PFonts without a corresponding system font
What steps will reproduce the problem? 1. Use Processing's Tools->Create Font... option to make a .vlw file from a font installed on the system 2. Uninstall that font from the computer or switch to a computer that doesn't have that font (e.g. us a Mac to create a .vlw from Helvetica, then use that .vlw on a Windows computer without Helvetica). 3. In a sketch on the system without the font installed, create a PFont with that .vlw file 3. Create a new ControlFont using the PFont as a parameter.
What is the expected output? The ControlFont initializes successfully and is usable.
What do you see instead? NullPointerException
What version of the product are you using? On what operating system? Processing 2.0a5 ControlP5 0.7.2 Reproduced on both Windows 7 and OS X Lion
Please provide any additional information below. ControlFont.java uses the PFont.getFont() method, which relies on the native version of the font being available.
The methods being called on the returned java.awt.Font object (pretty much just getSize() from what I can tell), have analogs in the PFont class (PFont::getsize()). http://processing.googlecode.com/svn/trunk/processing/build/javadoc/core/processing/core/PFont.html
Comment #1
Posted on May 3, 2012 by Happy Rhinowill be fixed, the call to Pfont.getFont().getSize(); inside controlP5.ControlFont.java will be removed, the size must be specifically set using the ControlFont(PFont theFont, int theFontSize); or ControlFont(PFont theFont, int theFontSize, int theLineHeight). constructor. When using constructor ControlFont(PFont theFont) and the java.awt.Font cant be found, size will default to 10.
Comment #2
Posted on May 3, 2012 by Helpful GiraffeSounds like a good solution. I'm glad there weren't some other dependencies on the java.awt.Font that I had missed while looking through the code. Thanks for the response!
Comment #3
Posted on May 18, 2012 by Happy Rhinofixed, needs verification.
Status: Fixed
Labels:
Type-Defect
Priority-Medium