bugPanda PDF Generation API - Bugs: bug #10249, panda_setfontsize error

 
 

bug #10249: panda_setfontsize error

Submitted by:  None
Submitted on:  Fri 03 Sep 2004 08:30:39 AM UTC  
Votes:  1  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Open

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Fri 09 Mar 2007 05:27:12 AM UTC, comment #6:

Added the patch to the patch list on this website:
https://savannah.nongnu.org/patch/index.php?5792

Anonymous
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.

Anonymous
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 =

Anonymous
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 =

Anonymous
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

Sven St├╝hmeier <elion>
Tue 18 Apr 2006 08:45:31 PM UTC, comment #1:

I have the same problem, is ther a solution available ?
Thanks,
Edgar

Edgar Borger <borger>
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;
}

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 1 encouragement so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follows 1 latest change.

Date Changed By Updated Field Previous Value => Replaced By
Tue 18 Apr 2006 08:43:16 PM UTCborgerCarbon-Copy-=>Added borger

Back to the top


Powered by Savane 3.1-cleanup