merlinvn / controlp5

Automatically exported from code.google.com/p/controlp5
0 stars 0 forks source link

ControlFont(PFont) doesn't work with .vlw-initialized PFonts without a corresponding system font #46

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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/process
ing/core/PFont.html

Original issue reported on code.google.com by a...@rechargecar.com on 3 May 2012 at 4:37

GoogleCodeExporter commented 8 years ago
will 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.

Original comment by soj...@gmail.com on 3 May 2012 at 8:05

GoogleCodeExporter commented 8 years ago
Sounds 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!

Original comment by cromulen...@gmail.com on 3 May 2012 at 3:11

GoogleCodeExporter commented 8 years ago
fixed, needs verification.

Original comment by soj...@gmail.com on 18 May 2012 at 5:08