How to use Special characters Use PurePDF?

Just starting out? Need help? Post your questions and find answers here.
ynkrc
User
User
Posts: 55
Joined: Sat Sep 03, 2011 5:28 am

How to use Special characters Use PurePDF?

Post by ynkrc »

I want to write Some Special characters like "汉字".
my "PurePDF.pb" is here,could you give me some suggestion?

Code: Select all

Procedure ipdf_SetFontData(FontName$,Style$,FontKey$)
  Protected vCharWidth,vDefault,vStyle,vFound,Font,hDC,Mem,Len,j, fontNS$
  
  AddElement(Fonts())
  Fonts()\FontN = ListSize(Fonts())
  Fonts()\FontKey$ = FontKey$
  Fonts()\Style$ = Style$
  vDefault = #False
  
  fontNS$=UCase(FontName$+Style$)         
  Select fontNS$
    Case "COURIER"
      Fonts()\Name$ = #PDF_FONT_COURIER
      vDefault = #True
    Case "COURIERB"
      Fonts()\Name$ = #PDF_FONT_COURIERB
      vDefault = #True
    Case "COURIERI"
      Fonts()\Name$ = #PDF_FONT_COURIERI
      vDefault = #True
    Case "s"
      Fonts()\Name$ = "s"
      Restore s
    Default ; Font is unknown = Font embedding
      CompilerIf #PB_Compiler_OS=#PB_OS_Windows
        vDefault = 3
      CompilerElse
        Fonts()\Name$ = #PDF_FONT_COURIER
        vDefault = #True
.........
DataSection
S:
  IncludeBinary "s.ttf"
.........
and
normeus
Enthusiast
Enthusiast
Posts: 470
Joined: Fri Apr 20, 2012 8:09 pm
Contact:

Re: How to use Special characters Use PurePDF?

Post by normeus »

There is no need to modify "purePDF.pb"

in the examples folder look at "Tutorial22 Font.pb"

Code: Select all

pdf_SetFont("Tahoma","",12)
but instead use a font that has the characters you want, in windows 10 I have:

Code: Select all

pdf_SetFont("Microsoft YaHei","",12)
also take a look at "Tutorial32 Unicode.pb" to see how to use the characters
and look a the last page of the purePDF 2.0 thread for some warnings
http://www.purebasic.fr/english/viewtopic.php?p=463744
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
ynkrc
User
User
Posts: 55
Joined: Sat Sep 03, 2011 5:28 am

Re: How to use Special characters Use PurePDF?

Post by ynkrc »

useless...
Image
normeus wrote:There is no need to modify "purePDF.pb"

in the examples folder look at "Tutorial22 Font.pb"

Code: Select all

pdf_SetFont("Tahoma","",12)
but instead use a font that has the characters you want, in windows 10 I have:

Code: Select all

pdf_SetFont("Microsoft YaHei","",12)
also take a look at "Tutorial32 Unicode.pb" to see how to use the characters
and look a the last page of the purePDF 2.0 thread for some warnings
http://www.purebasic.fr/english/viewtopic.php?p=463744
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: How to use Special characters Use PurePDF?

Post by IdeasVacuum »

Adobe Reader does not support all fonts, embedded in the PDF or not, so you have to use the fonts it does support. For Chinese, Microsoft Sans Serif is supported (micross.ttf)
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
ynkrc
User
User
Posts: 55
Joined: Sat Sep 03, 2011 5:28 am

Re: How to use Special characters Use PurePDF?

Post by ynkrc »

The Problem is solved,Thanks normeus.
We Need to comple Compile into Unicode Exe File.
but I don't Know How to Make the PDF file short? It sames the Font file is include in the PDF file?
Image
IdeasVacuum wrote:Adobe Reader does not support all fonts, embedded in the PDF or not, so you have to use the fonts it does support. For Chinese, Microsoft Sans Serif is supported (micross.ttf)
Post Reply