Page 9 of 10

Re: HMG_HPDF - Export to PDF made easy...

Posted: Tue Mar 13, 2018 1:52 pm
by esgici
bpd2000 wrote: Tue Mar 13, 2018 12:30 pm WOW!
Thank you Edward...
+1

Re: HMG_HPDF - Export to PDF made easy...

Posted: Tue Mar 13, 2018 2:21 pm
by bpd2000
Rathinagiri wrote: Tue Mar 13, 2018 1:50 pm Wonderful!

EDward, Can you make it work for unicode encoding also? Especially Indian languages?
+1

Re: HMG_HPDF - Export to PDF made easy...

Posted: Wed Mar 14, 2018 2:24 pm
by edk
Rathinagiri wrote: Tue Mar 13, 2018 1:50 pm EDward, Can you make it work for unicode encoding also? Especially Indian languages?
Hi, Rathi.

I made a PDF natively encoded in UTF-8 (without generating Unicode text as a png file).
sample-1.png
sample-1.png (144.27 KiB) Viewed 4687 times
Is the example shown at the top of the PDF page in the Indian alphabet?

Would this solution meet your expectations?
In the utf-8 editor, characters from this font look different than in the resulting PDF. I pasted the characters with the Windows Character Map. :roll:
The other fonts appear in the editor in the same way as in PDF.
DemoUTF.7z
(109.29 KiB) Downloaded 251 times
What I noticed, the built-in PDF fonts (Courier, Helvetica, Times-Roman) can not be used for Unicode encoding. Use TTF fonts.


Circular text printing requires changes for Unicode encoding support.
sample-2.png
sample-2.png (170.99 KiB) Viewed 4687 times
Replace the HPDF_CircleText function with the one in the attachment.
demo.7z
(2.09 KiB) Downloaded 295 times
Regards, Edward.

Re: HMG_HPDF - Export to PDF made easy...

Posted: Thu Mar 15, 2018 3:16 am
by bpd2000
Fantastic
Then you Edward, Today I am out of station, will check the next day

Re: HMG_HPDF - Export to PDF made easy...

Posted: Thu Mar 15, 2018 4:01 am
by esgici
Hi friends

Does anyone know who is author of Harbur (not HMG) HaruPDF wrapper ?

I remember he was PritPal Bedi, but sadly I can't found in Harbour docs :(

Or more useful, if possible any doc (at least ReadMe) about Harbur HPDF

TIA

Re: HMG_HPDF - Export to PDF made easy...

Posted: Thu Mar 15, 2018 8:32 am
by gfilatov
esgici wrote: Thu Mar 15, 2018 4:01 am Hi friends

Does anyone know who is author of Harbur (not HMG) HaruPDF wrapper ?

I remember he was PritPal Bedi, but sadly I can't found in Harbour docs :(

Or more useful, if possible any doc (at least ReadMe) about Harbur HPDF

TIA
Hi Esgici,
/*----------------------------------------------------------------------*
* *
* HaruLib (x)Harbour Wrappers *
* . *
* http://www.libharu.org/ *
* http://sourceforge.net/projects/libharu/ *
* *
* Pritpal Bedi <pritpal@hotmail.com> *
* *
*----------------------------------------------------------------------*/
You can found the following description in the Harbour changelog also:
2008-05-18 09:21 UTC+0100 Viktor Szakats (harbour syenar.net)
* contrib/hbhpdf/harupdf.c
! Fixed all MSVC warnings. Now builds cleanly.

2008-05-18 08:52 UTC+0100 Viktor Szakats (harbour syenar.net)
+ contrib/hbhpdf/Makefile
+ contrib/hbhpdf/make_b32.bat
+ contrib/hbhpdf/make_vc.bat
+ contrib/hbhpdf/make_gcc.sh
+ contrib/hbhpdf/common.mak
+ contrib/hbhpdf/tests/bld_b32.bat
+ contrib/hbhpdf/tests/bld_vc.bat
+ Added build/make files.
; Please test GNU make files.

* contrib/make_b32_all.bat
* contrib/make_gcc_all.sh
* contrib/make_vc_all.bat
+ Added hbhpdf to 'all' make files.
(not yet to GNU make files though)

- contrib/hbhpdf/tests/<data files>
+ contrib/hbhpdf/tests/files/<data files>
* Data files needed for test app moved
to a subdir.

* contrib/hbhpdf/tests/harupdf.prg
! Absolute paths changed to relative ones
(for both input and output ones).
! NumToHex() -> hb_NumToHex()
+ hbct added to lib list because test program
uses SIN()/COS()/TAN() from it.

- contrib/hbhpdf/tests/harupdf.ch
+ contrib/hbhpdf/harupdf.ch
* Moved to main dir.

- contrib/hbhpdf/hpdf.h
- Removed original libharu header. This
will be picked up from the package dir,
along with the rest of the .h files.

* contrib/hbhpdf/harupdf.ch
+ Added self-guard.

* contrib/hbhpdf/harupdf.c
! Fixed a few BCC warnings. It now builds cleanly.
; NOTE: There are a lot MSVC casting warnings and errors left.

; Many thanks for this contrib to Pritpal Bedi.

2008-05-17 18:45 UTC+0800 Pritpal Bedi (pritpal@vouchcac.com)
+ harbour/contrib/hbhpdf
+ harbour/contrib/hbhpdf/harupdf.c
+ harbour/contrib/hbhpdf/hpdf.h
Initial upload of wrappers for HaruPDF Library (http://sourceforge.net/projects/libharu/).
+ harbour/contrib/hbhpdf/tests
+ harbour/contrib/hbhpdf/tests/harupdf.prg
+ harbour/contrib/hbhpdf/tests/harupdf.ch
Test program.

Re: HMG_HPDF - Export to PDF made easy...

Posted: Thu Mar 15, 2018 8:53 am
by esgici
gfilatov wrote: Thu Mar 15, 2018 8:32 am ...
You can found the following description in the Harbour changelog also
...
Thank you very much Grigory :arrow:

Viva Harbour, viva HMG :D

Re: HMG_HPDF - Export to PDF made easy...

Posted: Thu Mar 15, 2018 10:06 am
by bpd2000
edk wrote: Wed Mar 14, 2018 2:24 pm Would this solution meet your expectations?
Regards, Edward.
Tested and nearly 100% success, big thanks for your hard work for natively encoded pdf in UTF-8
Some of the characters do not shows properly is a second thing and not mistake of yours

Re: HMG_HPDF - Export to PDF made easy...

Posted: Wed Dec 12, 2018 11:12 am
by edk
mol wrote: Sun Mar 04, 2018 7:29 am There is Windows function EnumFontFamiliesEx which enumerates installed fonts with its options.
But, I can't find if there is a font filename for font name.
HMG sources contains call to older version of the function EnumFontFamilies (this one is for compatibility wit 16-bit versions).
c_controlmisc.c file contains definition of EnumFonts.
EnumFontFamilies returns LogFont structure:

Code: Select all

typedef struct tagLOGFONT {
  LONG  lfHeight;
  LONG  lfWidth;
  LONG  lfEscapement;
  LONG  lfOrientation;
  LONG  lfWeight;
  BYTE  lfItalic;
  BYTE  lfUnderline;
  BYTE  lfStrikeOut;
  BYTE  lfCharSet;
  BYTE  lfOutPrecision;
  BYTE  lfClipPrecision;
  BYTE  lfQuality;
  BYTE  lfPitchAndFamily;
  TCHAR lfFaceName[LF_FACESIZE];
} LOGFONT, *PLOGFONT;
It is desciped on https://msdn.microsoft.com/pl-pl/librar ... s.85).aspx page

Some fonts have only English names, some of them can have English and native (Polish, Chinese ) names too.

I think Claudio Soto should know sth. about it. (His name is places as comment in sources :) )
Hi Marek.
Recently, I had a similar need for the user to choose their own fonts to create a PDF file.
As you know, the HaruPDF library uses native Helvetica, Courier and Times-Roman fonts. You can also use fonts from .ttf files but you can not use the fonts enumerated in the system.
My solution is to examine the available font .ttf files in the system folder, the current folder and the user specified for HaruPDF support and create an array with a .ttf file list.
Based on the received array with a .ttf file list, I created a dialog to select the font.
At the end I made a function where after entering the fontface name, attributes: bold and/or italics, the appropriate .ttf file is found.

This is not a perfect solution and therefore I do not integrate it with h_HMG_HPDF.Prg, but maybe it will be a bit helpful.

I used undocumented GDI32 function GetFontResourceInfo to retrieve the font names from a .ttf file.
It does not work correctly with every .ttf file. My knowledge of C (and English) is so-so, that's why I could do something incorrectly 😒.
Maybe someone knows better solution how to retrieve a Fontname from TTF. :idea:
demo99.7z
(262.67 KiB) Downloaded 213 times
Best regards, Edward.

Re: HMG_HPDF - Export to PDF made easy...

Posted: Wed Dec 12, 2018 3:27 pm
by edk
Minor bug fix in the dialog: error occurred when user enter the name of the font not included in the font list. :oops:
Bez tytułu.png
Bez tytułu.png (12.09 KiB) Viewed 3699 times
demo.7z
(5.75 KiB) Downloaded 254 times