Fri 09 Feb 2007 05:29:54 AM UTC, comment #5:
@@ -284,6 +285,7 @@
textobj->currentSetFont =
(char ) panda_xmalloc (sizeof (char)
(strlen (output->currentFont) + 1));
+ textobj->currentFontSize = output->currentFontSize;
// Store the name so we know what is happening
strcpy (textobj->currentSetFont, output->currentFont);
--- panda-0.5.4/panda/objects.h 2004-04-13 10:46:26.000000000 +1000
+++ panda-0.5.4-orig/panda/objects.h 2007-02-09 15:28:52.000000000 +1000
@@ -38,6 +38,7 @@
int insidegraphicsblock;
unsigned long byteOffset;
char *currentSetFont;
+ int currentFontSize;
char layoutstream, binarystream;
char layoutstreamFilename, binarystreamFilename;
-------------------------
Possibly dodgy but it works.
|
Fri 09 Feb 2007 05:05:03 AM UTC, comment #4:
(That was the reverse patch :/)
--- panda-0.5.4-orig/text.c 2007-02-09 15:12:39.000000000 +1000
+++ panda-0.5.4/text.c 2004-04-13 10:46:24.000000000 +1000
// currently set, then the font has changed and we will need to define the
// font here
if ((textobj->currentSetFont == NULL) ||
- (strcmp (output->currentFont, textobj->currentSetFont) != 0))
+ (strcmp (output->currentFont, textobj->currentSetFont) != 0) ||
+ textobj->currentFontSize != output->currentFontSize)
{
// Set the font that we want to use
textobj->layoutstream =
|
Fri 09 Feb 2007 04:58:47 AM UTC, comment #3:
Here is a patch for this problem - basically a font definition in the PDF will only be used if the font is changed or its the first font for the page:
--- panda-0.5.4-orig/text.c 2007-02-09 15:12:39.000000000 +1000
+++ panda-0.5.4/text.c 2004-04-13 10:46:24.000000000 +1000
@@ -265,8 +265,7 @@
// currently set, then the font has changed and we will need to define the
// font here
if ((textobj->currentSetFont == NULL) ||
- (strcmp (output->currentFont, textobj->currentSetFont) != 0) ||
- textobj->currentFontSize != output->currentFontSize)
+ (strcmp (output->currentFont, textobj->currentSetFont) != 0))
{
// Set the font that we want to use
textobj->layoutstream =
|
Mon 26 Jun 2006 12:27:05 PM UTC, comment #2:
I used only a workaround:
change fondsize to target,
change font to a different one,
print one invisible string,
change back font,
print strings you want (visible of course)
(visibility through fontmode ...)
good luck
Sven
|
Fri 03 Sep 2004 08:30:39 AM UTC, original submission:
Only first (initial) call to the function works. After that the font size stays the same all the time.
Example:
#include <stdio.h>
#include "panda/functions.h"
#include "panda/constants.h"
int main()
{
panda_pdf *pPDF;
panda_page *pPage;
char *pFontCourier;
panda_init();
if ((pPDF = panda_open ("test.pdf", "w")) == NULL)
panda_error (panda_true, "could not open test.pdf");
pPage = panda_newpage (pPDF, panda_pagesize_a4);
pFontCourier = panda_createfont (pPDF, "Courier", 1, "WinAnsiEncoding");
panda_setfont (pPDF, pFontCourier);
panda_setfontsize(pPDF, 6);
panda_textboxrotalign (pPDF, pPage, 200, 70, 220, 125, 0, 1, 1, "Test line 1");
panda_setfontsize(pPDF, 14);
panda_textboxrotalign (pPDF, pPage, 300, 70, 320, 250, 0, 1, 1, "Test line 2");
panda_close (pPDF);
return 0;
}
|