We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Cross-platform Text Quality
Page Index Toggle Pages: 1
Cross-platform Text Quality (Read 725 times)
Cross-platform Text Quality
Dec 21st, 2009, 6:47pm
 
Hi.

I have been playing text in different ways in Processing for a little while, but there's still one thing that puzzles me. I have a project, an applet, I am working on that requires displaying and animated fairly small text (11pt).

No surprise, when using the createFont(...) function to create a font from a ttf file, the result is significantly better in OSX than XP.

What puzzles me is that if, for example, I use the Processing IDE Create Font feature in OSX to create a VLW file at size 11. What is actually stored in the file? Because the Create Font feature allows to tick the 'smooth' box, it would think that VLW contains antialiased bitmaps. If so, shouldn't they look the same if I use the same VLW in OSX and in XP?

I would really appreciate if someone can enlighten me on the rendering process that makes a VLW font look different on OSX and XP.
Re: Cross-platform Text Quality
Reply #1 - Dec 22nd, 2009, 2:09am
 
To make VLW fonts, Processing actually draw the characters, so do a bitmap rendering, and collect all those bitmaps with some additional information in a file. When rendering the font, it just copies the bitmaps at the right place. So the quality should be the same as with image() calls.

Out of curiosity (I don't have a Mac at hand), what is the difference in quality between the platforms?
Re: Cross-platform Text Quality
Reply #2 - Dec 22nd, 2009, 10:05am
 
Thanks for the reply. With that and sleeping over the problem, I figure where my problem was.

As you said, text(...) using a VLW font will create the same output on PC and MAC. But text(...) using a PFont created with the createFont(...) function will be different because of the way PC and MAC handle hinting differently.

The problem I had is that I was calling the PFont.findFont() and/or PFont.setFont(...) to link the native font with the VLW. I was assuming that it would simply attach the font without changing the bitmaps, but instead, it regenerates the PFont on the fly. Because Windows doesn't have the same magic to render small fonts, the fonts was replaced by smudgy glyphs.

cheers
Re: Cross-platform Text Quality
Reply #3 - Dec 24th, 2009, 5:21pm
 
I just went through this issue myself.  Here is the deal.  createFont will use the Native font of the system, instead of the bitmap if it can.  This is why your font looks cleaner (and will perform better), it's using a native font, that perhaps Windows doesn't have.  So chose a font that both OS systems have, or copy the TTF file into your Data folder.  

loadFont using a .vlw will not look for the native font by default (something I wish would be changed).  You have to add this to your code to get loadFont to check for the native font.  

hint(ENABLE_NATIVE_FONTS);
Page Index Toggle Pages: 1