From: <sm...@us...> - 2009-08-24 13:55:09
|
Revision: 10319 http://plplot.svn.sourceforge.net/plplot/?rev=10319&view=rev Author: smekal Date: 2009-08-24 13:54:56 +0000 (Mon, 24 Aug 2009) Log Message: ----------- HPDF_SHARED should only be defined for the Win32 build (by defining HPDF_DLL) - fixed this in pdf.cmake. Workaround to define stricmp() and strnicmp() for non Windows builds. Should maybe only defined for gcc compilers (also on Windows), needs to be checked. Fixed some warnings about wrong signedness of parameter - this must also be investigated soon. Font is now scaled correctly for sub- and superscript. Modified Paths: -------------- trunk/cmake/modules/pdf.cmake trunk/drivers/pdf.c Modified: trunk/cmake/modules/pdf.cmake =================================================================== --- trunk/cmake/modules/pdf.cmake 2009-08-24 02:38:41 UTC (rev 10318) +++ trunk/cmake/modules/pdf.cmake 2009-08-24 13:54:56 UTC (rev 10319) @@ -33,14 +33,7 @@ message(STATUS "Looking for haru pdf header and library - found") if(WIN32) set(pdf_COMPILE_FLAGS "-I${hpdf_INCLUDE_DIRS} -DHPDF_DLL") - elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") - # -DHPDF_SHARED really screws up a Linux build of the pdf device driver. - # I noticed the Linux build of libharu had no HPDF_ macros defined so - # don't set any here, and that seems to work. - set(pdf_COMPILE_FLAGS "-I${hpdf_INCLUDE_DIRS}") else(WIN32) - # Guess no HPDF_ macros should be defined for platforms other than - # Windows or Linux. set(pdf_COMPILE_FLAGS "-I${hpdf_INCLUDE_DIRS}") endif(WIN32) set(pdf_LINK_FLAGS "${hpdf_LIBRARIES}") Modified: trunk/drivers/pdf.c =================================================================== --- trunk/drivers/pdf.c 2009-08-24 02:38:41 UTC (rev 10318) +++ trunk/drivers/pdf.c 2009-08-24 13:54:56 UTC (rev 10319) @@ -48,6 +48,12 @@ #include "plunicode-type1.h" #include "plfci-type1.h" +/* Workaround for caseless string comparison */ +#ifndef WIN32 + #define stricmp strcasecmp + #define strnicmp strncasecmp +#endif + /* constants */ /* We define a virtual page and scale it down to the @@ -498,12 +504,12 @@ /*********************************************************************** - * PSDrawTextToCanvas( pdfdev* dev, char* type1_string, short drawText ) + * PSDrawTextToCanvas( pdfdev* dev, unsigned char* type1_string, short drawText ) * * This function determines the extend of the string and does * the actual drawing to the page if drawText is true. ***********************************************************************/ -void PSDrawTextToCanvas( pdfdev* dev, char* type1_string, short drawText ) +void PSDrawTextToCanvas( pdfdev* dev, unsigned char* type1_string, short drawText ) { HPDF_REAL th; @@ -513,13 +519,13 @@ HPDF_Page_SetTextRenderingMode( dev->page, HPDF_FILL ); HPDF_Page_SetRGBFill( dev->page, dev->textRed, dev->textGreen, dev->textBlue ); HPDF_Page_MoveTextPos( dev->page, dev->textWidth, dev->yOffset ); - HPDF_Page_ShowText( dev->page, type1_string ); + HPDF_Page_ShowText( dev->page, (char*)type1_string ); // TODO: this conversion must be wrong HPDF_Page_EndText( dev->page ); } /* determine text width and height */ - dev->textWidth += HPDF_Page_TextWidth( dev->page, type1_string ); - th = (HPDF_REAL)(HPDF_Font_GetCapHeight( dev->m_font )*dev->fontSize/1000.0); + dev->textWidth += HPDF_Page_TextWidth( dev->page, (char*)type1_string ); // TODO: this conversion must be wrong + th = (HPDF_REAL)(HPDF_Font_GetCapHeight( dev->m_font )*dev->fontSize*dev->fontScale/1000.0); dev->textHeight = dev->textHeight>(th+dev->yOffset) ? dev->textHeight : (th+dev->yOffset); /* clear string */ @@ -541,7 +547,7 @@ if( !(dev->m_font = HPDF_GetFont(dev->pdf, font, NULL)) ) plexit( "ERROR: Couldn't open font\n" ); - HPDF_Page_SetFontAndSize( dev->page, dev->m_font, dev->fontSize ); + HPDF_Page_SetFontAndSize( dev->page, dev->m_font, dev->fontSize*dev->fontScale ); if( !strcmp(font, "Symbol") ) { dev->nlookup = number_of_entries_in_unicode_to_symbol_table; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |