HPDFPRINT with Font cannot be loaded

Moderator: Rathinagiri

Post Reply
User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia

HPDFPRINT with Font cannot be loaded

Post by hmgchang »

Dear Masters & Friends,
i try to load the ttf font :
[img]d:\test\tscparan_TTF.JPG[/img]

but i get this :
[img]fontcannotbeloaded.JPG[/img]

What am i doing wrong ?
Pls help !

Thks n rgds
Chang :)
Attachments
tscparan_TTF.JPG
tscparan_TTF.JPG (115.02 KiB) Viewed 9814 times
Just Hmg It !
User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia

Re: HPDFPRINT with Font cannot be loaded

Post by hmgchang »

this is what i get : error !
Attachments
fontcannotbeloaded.JPG
fontcannotbeloaded.JPG (12.47 KiB) Viewed 9813 times
fontcannotbeloaded.JPG
fontcannotbeloaded.JPG (12.47 KiB) Viewed 9813 times
Just Hmg It !
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

HPDFPRINT with Font cannot be loaded

Post by Pablo César »

It is something quite difficult to guess what is happen without your code ! :mrgreen:

Probably your font file isn't in current folder. Try to put the FULL path.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia

Re: HPDFPRINT with Font cannot be loaded

Post by hmgchang »

ok Sir, pls find my ssw,

Code: Select all

#include <hmg.ch>
#include "hfcl.ch"

Function Main
  MEMVAR _HMG_SYSDATA
  
        Load Window Main
        Main.Center
        Main.Activate

Return NIL


FUNCTION ssw_HPdfPrint( cTtf)
  LOCAL aLine, aFont
  LOCAL cString, cFontname, cPdfname, cStartupFolder
  LOCAL nI
  LOCAL lSuccess
  
  HB_DEFAULT( @cTtf, '')
  
  cString := MEMOREAD( "List.TXT")
  aLine := HB_ATOKENS( cString, CRLF)
  
  lSuccess := .F.
  IF EMPTY( cTtf)
    aFont := GetFont()
    cFontname := aFont[ 1]
  ELSE
    // cFontname := "MS LineDraw.TTF"  
    // cFontname := "tahoma.TTF"
    // cFontname := "times.TTF"
    cFontname:= "cour.TTF"
  ENDIF
  
  cPdfName := "ssw_" + STRTRAN( cFontname, ".TTF", "_TTF") + ".pdf"
  SELECT HPDFDOC cPdfname TO lSuccess papersize HPDF_PAPER_A4
  SET HPDFDOC COMPRESS ALL
  SET HPDFDOC PAGEMODE TO OUTLINE
  SET HPDFINFO AUTHOR      TO 'S. Rathinagiri'
  SET HPDFINFO CREATOR     TO 'S. Rathinagiri'
  SET HPDFINFO TITLE       TO 'ssw HPDF Print'
  SET HPDFINFO SUBJECT     TO 'Test HPdfPrint for Load Font'
  SET HPDFINFO KEYWORDS    TO 'HMG, HPDF, Documentation, LibHaru, Harbour, MiniGUI'
  SET HPDFINFO DATECREATED TO date() TIME time()
  IF lSuccess
    START HPDFDOC
      START HPDFPAGE
        FOR nI := 1 TO LEN( aLine)
          @ 10 + nI  * 5, 10 HPDFPRINT aLine[ nI] FONT cFontname
        NEXT
      END HPDFPAGE
    END HPDFDOC   
    MsgInfo( "Pdf Printed !")
  ELSE
    MsgInfo( "Error Printing Pdf !")  
  ENDIF
  
  RETURN NIL
Attachments
error.JPG
error.JPG (27.59 KiB) Viewed 9738 times
Just Hmg It !
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: HPDFPRINT with Font cannot be loaded

Post by andyglezl »

Hola hmgchang

Pudiera ser esta la razon ?
viewtopic.php?f=5&t=3422&p=31430#p31430
-------------------------------------------------------------------------------
Hello hmgchang

Could this be the reason ?
viewtopic.php?f=5&t=3422&p=31430#p31430
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia

Re: HPDFPRINT with Font cannot be loaded

Post by hmgchang »

Hi Andy,
I actually tried to load the Courier font ( Cour.TTF).
I dont know if i hv done something wrong, pls advise

thks n rgds
Chang
Just Hmg It !
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: HPDFPRINT with Font cannot be loaded

Post by Rathinagiri »

There is a fix in the next version of HMG. I am sure it will solve this problem.

For the time being, try to give the full path of the font file.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

HPDFPRINT with Font cannot be loaded

Post by Pablo César »

Rathinagiri wrote:For the time being, try to give the full path of the font file.
Yeah, as I have already told him...

Only in the new version is going to find the ttf file. Is necessary to know where the file is. If is not in current folder, will not find. And I think even been in current, will need the fullpath of ttf file.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
EduardoLuis
Posts: 682
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina

Re: HPDFPRINT with Font cannot be loaded

Post by EduardoLuis »

Hi Chang:

I use this procedure to load ttf fonts, and all works fine.-


1) First define at the begining of the function pdf_create include these variables

function pdf_create
local lSuccess := .f.
local cLB := chr( 10 )
local cTTFFName, cFontName, qPDF

2) Before each line HPDFPRINT where you want an special font put:

qPDF := _HMG_SYSDATA[ 150, 1 ]
cTTFFName := "C:\VEGANO\KUNSTLER.ttf"
cFontName := HPDF_LoadTTFontFromFile( qPDF, cTTFFName, .F. )
@ 235, 200 HPDFPRINT "This is right aligned text" FONT cFontName SIZE 30 RIGHT


Notes:
cTTFFName stores folder where is the font file.-
cFontName stores the full name of the font

For simplicity i keep the fonts i use on the principal folder of my develope.-

I hope this will let you solve your problem.-
With regards.
Eduardo
Post Reply