LoginSignup
0
0

More than 5 years have passed since last update.

swiftでlibharuをつかい、リソースにあるttfフォントをpdfに埋め込むとき

Posted at
 var fontname:String="MS-Gothic"
 if let path:NSString=NSBundle.mainBundle().pathForResource("hogeFont", ofType:"ttf"){
     let cchr:UnsafePointer<CChar>=path.cStringUsingEncoding(NSUTF8StringEncoding)
     if let name=String.fromCString( HPDF_LoadTTFontFromFile(_pdf, cchr, HPDF_TRUE) ){
         fontname=name
     }else{
         println("埋め込みフォント名が不明")
     }
 }else{
     println("埋め込みフォントが見つからない")
 }
 let fontJp = HPDF_GetFont(_pdf, fontname, "90ms-RKSJ-H")//sjis
 HPDF_Page_SetFontAndSize(_currentPage, fontJp, a_fontSize)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0