PurePDF Version 2.0

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Re: PurePDF Version 2.0

Post by DoubleDutch »

Yep - I'd misread the code - sorry.

Overloading - With TailBite when i did XConsole I had this bit of code:

Code: Select all

ProcedureDLL XOpenConsole()
  Flags=#PB_Window_TitleBar|#PB_Window_SystemMenu|#PB_Window_BorderLess|#PB_Window_SizeGadget|#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget
  CX=80
  CY=25
  FontH=24
  Intensity=128
  result=XGlobalOpenConsole(50,50,640,480,"ConsoleX")
  XGlobalConsoleColor(#MyWhite,#MyBlack)
  XGlobalClearConsole()
  ProcedureReturn result
EndProcedure

ProcedureDLL XOpenConsole2(sizex,sizey)
  Flags=#PB_Window_TitleBar|#PB_Window_SystemMenu|#PB_Window_BorderLess|#PB_Window_SizeGadget|#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget
  CX=sizex
  CY=sizey
  FontH=24
  Intensity=128
  result=XGlobalOpenConsole(50,50,640,480,"ConsoleX")
  XGlobalConsoleColor(#MyWhite,#MyBlack)
  XGlobalClearConsole()
  ProcedureReturn result
EndProcedure

ProcedureDLL XOpenConsole3(sizex,sizey,sized,fontname$,fontsize,title$)
  Itensity=128
  result=XFullOpenConsole(sizex,sizey,sized,fontname$,fontsize,title$)
  XGlobalConsoleColor(#MyWhite,#MyBlack)
  XGlobalClearConsole()
  ProcedureReturn result
EndProcedure
  
ProcedureDLL XOpenConsole4(sizex,sizey,x,y,w,h,title$)
  Flags=#PB_Window_TitleBar|#PB_Window_SystemMenu|#PB_Window_BorderLess|#PB_Window_SizeGadget|#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget
  CX=sizex
  CY=sizey
  FontH=24
  Intensity=128
  result=XGlobalOpenConsole(x,y,w,h,title$)
  XGlobalConsoleColor(#MyWhite,#MyBlack)
  XGlobalClearConsole()
  ProcedureReturn result
EndProcedure

ProcedureDLL XOpenConsole5(sizex,sizey,x,y,w,h,title$,Flgs)
  Flags=Flgs
  CX=sizex
  CY=sizey
  FontH=24
  Intensity=128
  result=XGlobalOpenConsole(x,y,w,h,title$)
  XGlobalConsoleColor(#MyWhite,#MyBlack)
  XGlobalClearConsole()
  ProcedureReturn result
EndProcedure
Look at console 3 and 4 parameters - they are different types - yet it worked! With the correct one being selected. It is like overloading on other systems.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Re: PurePDF Version 2.0

Post by ABBKlaus »

i finally made it work :lol:

Here´s a testversion of PurePDF that supports basic unicode capability´s :

http://www.purebasicpower.de/downloads/PurePDF.pb
http://www.purebasicpower.de/downloads/PurePDF_res.pb

And the example :

http://www.purebasicpower.de/downloads/ ... 20World.pb

Hint1 : You need to enable unicode mode in compilersettings ;-)
Hint2 : You must remove any versions of the PurePDF library before testing this one
Hint3 : Its now possible to use the PurePDF sources as includefile, just set #PurePDF_Include=1 and use IncludeFile "PurePDF.pb" to include it. The same technique is used in "Tutorial32 Unicode.pb"

BR Klaus
Last edited by ABBKlaus on Sun Oct 09, 2011 10:33 am, edited 1 time in total.
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: PurePDF Version 2.0

Post by c4s »

ABBKlaus wrote:Hint3 : Its now possible to use the PurePDF sources as includefile, just set #PurePDF_Include=1 to something and it will be included
Does it mean I don't have to use it as a Userlib any longer? If so, thanks! :D
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Re: PurePDF Version 2.0

Post by DoubleDutch »

ABBKlaus: Thanks for this, it's very useful. :D
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Re: PurePDF Version 2.0

Post by DoubleDutch »

Possible bug, see screenshot:

http://xn--o-10a3f.com/images/purepdf.jpg

or

http://ɯoɔ.com/images/purepdf.jpg

The screen has the error line and the details from the debug window.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Re: PurePDF Version 2.0

Post by ABBKlaus »

c4s wrote:Does it mean I don't have to use it as a Userlib any longer? If so, thanks! :D
Exactly !
DoubleDutch wrote:ABBKlaus: Thanks for this, it's very useful. :D
Thanks
DoubleDutch wrote:Possible bug, see screenshot:
Thanks for testing ! (It was due to the conversion from unsigned to long, i always forget to append &$FFFF)
its Fixed now, please redownload the sources

- fixed escaping of characters BS / TAB / LF / FF / CR / Backslash '\' / '(' / ')'
- fixed pdf_GetStringWidth() for unicode characters

BR Klaus
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Re: PurePDF Version 2.0

Post by DoubleDutch »

Thanks for fixing it so quickly. :)
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Re: PurePDF Version 2.0

Post by DoubleDutch »

Seems to work ok now.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Re: PurePDF Version 2.0

Post by ABBKlaus »

DoubleDutch wrote:Thanks for fixing it so quickly. :)
You are welcome.

Just uploaded another version that should fix pdf_Cell / pdf_MultiCell

- added ipf_EscapeU / ipf_Escape is now obsolete
- fixed pdf_Cell
- fixed pdf_MultiCell

ToDo :

- add the /Ascent /Descent /CapHeight /ItalicAngle /StemV /MissingWidth paramters in ipf_PutFonts (they are fixed for now)
- replace the ipf_Get_CharWidth api with the new font functions ipf_TTF_*

BR Klaus
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Re: PurePDF Version 2.0

Post by ABBKlaus »

update : PurePDF V2.21 with full unicode support

- fixed memory leak in ipf_LocalDecimal()
- updated ipf_Endian() procedures (Thanks to Rescator/skywalk/wilbert)
- updated ipf_GetStringWidth() is much faster now
- removed ipf_Get_CharWidth()
- added /Ascent /Descent /CapHeight /ItalicAngle /StemV /MissingWidth to unicode fonts
- fixed bug in ipf_EscapeU() when printing unicode strings like $010D where $0D has to be escaped
- removed the unicode parameter from pdf_SetFont() its now handled automatically when in unicode mode
- added unicode support to ipf_PutInfo()

http://www.purebasicpower.de/?download= ... B45X86.zip
http://www.purebasicpower.de/?download= ... B46X86.zip

BR Klaus
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: PurePDF Version 2.0

Post by srod »

Hi Klaus,

I didn't realise that you'd added support for Unicode fonts - awesome!

How complete is the support for Unicode? I mean, are we limited to PDF 'standard fonts', or can we embed any old font?
I may look like a mule, but I'm not a complete ass.
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Re: PurePDF Version 2.0

Post by ABBKlaus »

Hi Steven,

you can embed any Truetype font that has a cmap enty with format 4 encoding.

http://developer.apple.com/fonts/TTRefM ... 6cmap.html

[edit]You can check your fonts with this tool[/edit]

http://www.purebasicpower.de/downloads/ ... Checker.pb
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: PurePDF Version 2.0

Post by srod »

I take it the entire font gets embedded into our resulting pdf files rather than subsets of the font?

Great job Klaus.
I may look like a mule, but I'm not a complete ass.
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Re: PurePDF Version 2.0

Post by ABBKlaus »

srod wrote:I take it the entire font gets embedded into our resulting pdf files rather than subsets of the font?
Jep, it is based on the PHP-script DoubleDutch mentioned above. The font gets embedded plus a so called cidtogidmap (131072 Bytes) that maps unicode chars to glyphs.
This way you can encode all unicode characters.
I would advice you to use compression as show in Tutorial32 Unicode.pb
srod wrote:Great job Klaus.
You are welcome

BR Klaus
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Re: PurePDF Version 2.0

Post by ABBKlaus »

Post Reply