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 › Saving actual fonts used to PDF
Page Index Toggle Pages: 1
Saving actual fonts used to PDF (Read 1781 times)
Saving actual fonts used to PDF
Jul 28th, 2009, 12:39pm
 
I've got some code that's been modified, and I tried to specify some OpenType fonts to produce the output, but when I do that, it doesn't use those fonts; it only uses one of them.

Even worse, when saving to PDF, it doesn't use any of those fonts and doesn't retain the spacing I see in the on-screen output.

Any ideas for a solution?
Re: Saving actual fonts used to PDF
Reply #1 - Jul 28th, 2009, 2:43pm
 
Excuse me, but I haven't understood at all your problem. Perhaps you remain a bit too generic. Can you show some code illustrating your issue?
Re: Saving actual fonts used to PDF
Reply #2 - Jul 28th, 2009, 2:58pm
 
Okay, but it's mostly in Spanish:

int nro_linea = 2;
int nro_espacio = 0;

PFont font, font1, font2, font3, font4;
String par_actual = "";               // valor actual del escaneo del texto
String[] lines;                       // lineas del texto escaneado
String[] str_ayuda;
int arrastrando = -1;

int pares_totales = 0;
float k_total;


int espacio_abajo;
int espacio_arriba;
int espacio_derecha;
int espacio_izquierda;
String layout_actual = "standard";
String visual_mode = "lineal";
int burbujas_maximas = 49;
int burbujas_graficadas = 0;

Ball[] balls = new Ball[0];
float grav = 1.40;                    // Gravedad
float b = 0.85;                       // Rebote
float f = 0.90;                       // Friccion

color ColorLineasGrales = color(200);
color ColorAcento = color(255, 102, 0);
color ColorAcentoCompanion = color(255, 180, 0);

int lapso_refresh = 1;               // cada cuantos frames se renueva la info del listado
int timer_interno = 0;
boolean resorte_activado = false;
boolean show_info = false;
boolean llenar_burbujas = false;
boolean hay_gravedad = false;
boolean mostrar_ayuda = false;
boolean mostrando_ayuda = false;

//added
boolean record=false;



void setup() {

 size(1024, 725);
 background(255);
 smooth();
 loop();  

 /* font=createFont("Arial-Black",18);
 font1=createFont("ArialMT",25);
 font2=createFont("Arial-BoldMT",18);
 font3=createFont("Arial-BoldMT",14);*/
 font=createFont ("Gotham-Black",20);
 font1-createFont ("Gotham-Medium",18);
 font2=createFont ("Gotham-Bold",18);
 font3=createFont ("Gotham-Bold",14);
 font4=createFont("TimesNewRomanPSMT",18);

With the current fonts referenced, it it should be using Gotham-Black for the on-screen output, unless the frequency of the word changes, at which point it should use a different, smaller font.

But it appears to only use one of the fonts, and that would be Gotham-Medium. And even after doing that, use the command to save the output to a PDF file results in characters that aren't in that font, and don't retain the spacing of the original on-screen results. It appears instead to use Arial for the PDF, which is completely wrong.

I need to fix that problem so I can render correctly on-screen and capture accurate results in the PDF that match the on-screen representation.
Re: Saving actual fonts used to PDF
Reply #3 - Jul 28th, 2009, 4:04pm
 
Something have been lost. I see lot of variable definitions not useful to our problem and not the end of setup, particularly the way you use the font, and how you make PDF.
Have you read the notes on font usage in PDF in the PDF library reference
Re: Saving actual fonts used to PDF
Reply #4 - Jul 28th, 2009, 4:16pm
 
No, I didn't read that, because I'm not really a programmer. I started with some code that somebody sent me and I had some modifications made, keeping the option to Save to PDF.

I didn't list all the code because it is more than 6000 characters and would not fit. I could email it to you if you send me your email address in a private message.
Re: Saving actual fonts used to PDF
Reply #5 - Aug 18th, 2009, 4:10pm
 
You mean nobody who uses Processing knows how to get a program to use the fonts specified and save those same fonts to a PDF file?

Somebody must know, so I'd appreciate some help with this.
Re: Saving actual fonts used to PDF
Reply #6 - Aug 19th, 2009, 1:12am
 
As I wrote, we need relevant code. Perhaps you can use http://pastebin.com to show it.
Also, the names of the fonts look odd, what system do you have Have you tried the snippet given at PFont.list() to see the font names to use
Re: Saving actual fonts used to PDF
Reply #7 - Aug 19th, 2009, 5:51am
 
I replied to your earlier post, offering to send you the complete code if you sent me your email address in a private message. I even sent you a private message after that asking if you wanted me to send that code. I received no response from you to either of those.

I will use pastebin to post the compllete code I have, so you can see what is going on, and what I can do specifically to get the results I want, snce I'm not a programmer.
Re: Saving actual fonts used to PDF
Reply #8 - Aug 19th, 2009, 6:48am
 
I don't like public questions going to the private sphere, as I am not the only one able to solve issues (or having time to work on it).
So we wait to see the code. And the answers to my questions...
Re: Saving actual fonts used to PDF
Reply #9 - Aug 19th, 2009, 7:03am
 
I have posted it to pastebin, under my username, Mulder; it should be readily available. It's mostly in Spanish, so if you can't read that language, don't bother.
Re: Saving actual fonts used to PDF
Reply #10 - Aug 19th, 2009, 7:36am
 
You need to give the URL of the paste.
And please, try the PFont.list snippet in the PDE to answer my question.
Re: Saving actual fonts used to PDF
Reply #11 - Aug 19th, 2009, 7:58am
 
I'm sorry, here's the link: http://pastebin.com/m51208f76
Page Index Toggle Pages: 1