FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   drawing strings
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: drawing strings  (Read 880 times)
Martin

122417302122417302martingomez_listsmg1ph WWW Email
drawing strings
« on: Oct 23rd, 2002, 2:32pm »

hi. would it be possible to draw a string on the proce55ing canvas? i'm just guessing here but is this forthcoming with the text() method? : ) cheers!
 
REAS


WWW
Re: drawing strings
« Reply #1 on: Oct 23rd, 2002, 5:38pm »

You will find a number of fonts to choose from in the Proce55ing download.
 
IMPORTANT
To use a font you must put it into the "data" file for the sketch in the sketchbook. For example if your program is called "FontTest" you must copy a font such as "Bodoni.vlw.gz" into the "data" directory for "FontTest" in the "sketchbook" directory.
Also, you must include "hint(SMOOTH_IMAGES);" to smooth the fonts.
 
 
Here is an example:
 
// FontTest by REAS
 
BFont fontA;
float a = 0;
 
void setup()  
{
  size(200, 200);
  background(0);
  fontA = loadFont("Bodoni.vlw.gz");
  setFont(fontA);
  hint(SMOOTH_IMAGES);
}
 
void loop()  
{
  a += 0.1;
  scale(4.0);
  String happy = "FontTest";
  text(happy, a, 20);
}
 
mKoser

WWW Email
Re: drawing strings
« Reply #2 on: Nov 5th, 2002, 9:06pm »

I've tried the font-text-example posted, but it didn't work. The error i get is something like this:
 
text(): first set a font before drawing text
 
............
 
when answering Martin's question are you then talking about a future feature, are is it actually possible to draw text in the current release? (alpha_44)
 
- mikkel
 

mikkel crone koser | www.beyondthree.com | http://processing.beyondthree.com
REAS


WWW
Re: drawing strings
« Reply #3 on: Nov 5th, 2002, 11:05pm »

it is possible to draw text in alpha_44 version of Proce55ing. just make sure you include "hint(SMOOTH_IMAGES);" in the program to improve the visual quality of the letters.
 
let's try and track down your error. did you cut and paste the program directly and did you move the file "Bodoni.vlw.gz" into the "data" directory of your sketch. also, which operating system are you using?
 
Martin

122417302122417302martingomez_listsmg1ph WWW Email
Re: drawing strings
« Reply #4 on: Nov 6th, 2002, 3:37am »

just a quick note: i'm using alpha_43 and it works. i have created two examples (typehappy series) which can be found in the example section of discourse.
 
mKoser

WWW Email
Re: drawing strings
« Reply #5 on: Nov 6th, 2002, 1:53pm »

ahhh... my mistake, i hadn't understood the fact that i had to find the "Bodoni.vlw.gz" file in the font-folder (WITHIN the proce55ing folder) ... what i had done was to copy the windows-font "ARIAL.TTF" into the folder.
 
Now that my misunderstanding has been cleared up, I can happily announce that I have a smooth-scrolling font example decorating my screen
 

mikkel crone koser | www.beyondthree.com | http://processing.beyondthree.com
REAS


WWW
Re: drawing strings
« Reply #6 on: Nov 6th, 2002, 6:21pm »

great. i'm glad it's working for you now. are you going to post your example?
 
i'll remember to clarify which "fonts" directory in the final documentation.
 
Pages: 1 

« Previous topic | Next topic »