Page 1 of 1

How to use Special characters Use PurePDF?

Posted: Sat Jan 23, 2016 4:55 am
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

Re: How to use Special characters Use PurePDF?

Posted: Sat Jan 23, 2016 7:16 am
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

Re: How to use Special characters Use PurePDF?

Posted: Sat Jan 23, 2016 1:28 pm
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

Re: How to use Special characters Use PurePDF?

Posted: Sat Jan 23, 2016 1:51 pm
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)

Re: How to use Special characters Use PurePDF?

Posted: Sat Jan 23, 2016 2:12 pm
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)