|
Author |
Topic: metaFont.width on apostrophe crash (Read 938 times) |
|
jedierikb
|
metaFont.width on apostrophe crash
« on: Feb 22nd, 2004, 7:41pm » |
|
if you load in a String with characters such as "’" (otherwise known apostrophe), then call metaFont.width on this string, you crash. in 67, p5 would not crash. but it also wouldn't display these chracters either. here is a list of possibly dangerous characters: http://users.adelphia.net/~al444/CharRefs3.html
|
« Last Edit: Feb 22nd, 2004, 7:43pm by jedierikb » |
|
|
|
|
fry
|
Re: metaFont.width on apostrophe crash
« Reply #1 on: Feb 23rd, 2004, 2:10am » |
|
what's the exact code you're using to make it crash? i need to see what font (there are multiple versions of meta) & what specific character is causing trouble. fonts changed between 67 and 68 to allow for non-ascii characters like apostrophes and umlauted vowels, but it prolly hasn't been thoroughly debugged.
|
|
|
|
jedierikb
|
Re: metaFont.width on apostrophe crash
« Reply #2 on: Feb 24th, 2004, 2:22am » |
|
void setup() { size( 400, 400 ); //load in friendly neighborhood font, set a size for that puppy BFont metaFont = loadFont("Meta.vlw.gz"); textFont( metaFont, 30 ); //ok, let's load in this nice text to display with that nice font try { String theresApostrophe = URLDecoder.decode( "There%E2%80%99s", "UTF-8"); System.out.println("theresApostrophe: " + theresApostrophe ); float metaFontWidth = metaFont.width(theresApostrophe); System.out.println("metaFontWidth: " + metaFontWidth ); color( 30, 30, 30 ); text( theresApostrophe, 30, 30 ); } catch (Exception ex ) { ex.printStackTrace(); } } java.lang.ArrayIndexOutOfBoundsException: 282 at BFont.width(BFont.java:477) at BFont.width(BFont.java:495) at test.setup(test.java:19) at BApplet.init(BApplet.java:185) at sun.applet.AppletPanel.run(AppletPanel.java:353) at java.lang.Thread.run(Thread.java:534)
|
|
|
|
fry
|
Re: metaFont.width on apostrophe crash
« Reply #3 on: Feb 24th, 2004, 6:21pm » |
|
d'oh.. set up the font lookup table wrong, so older fonts will have trouble. if you re-create the font using the "create font", you won't have any trouble. but it's been fixed for future releases.
|
« Last Edit: Feb 24th, 2004, 6:29pm by fry » |
|
|
|
|
fry
|
Re: metaFont.width on apostrophe crash
« Reply #4 on: Mar 28th, 2004, 8:48pm » |
|
fixed in bug release rev 69.
|
|
|
|
|