HMG.3.3.0 Patch 2 (32 and 64-bits)

HMG Unicode versions 3.1.x related

Moderator: Rathinagiri

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

HMG.3.3.0 Patch 2 (32 and 64-bits)

Post by Pablo César »

Gracias Claudio por tus correcciones. :P

EduardoLuis wrote:En el demo HPDF (carpeta HFCL , HMG_HPDF), si indicas el FONT y SIZE para un texto delimitado a un rectángulo, da error.-
Esto ya sucedía en las anteriores versiones (3.15, 3.20). Utilicé una fuente TTF denominada Kunstler.TTF.-
Hola Eduardo, disculpame pero yo no te entendi. Podrias disponibilizar algun código ejemplo sobre este problema y seria interesante que anexaras esta fuente Kunstler.TTF tambien.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
danielmaximiliano
Posts: 2607
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: HMG.3.3.0 Patch 2 (32 and 64-bits)

Post by danielmaximiliano »

Gracias Claudio por el tiempo que te tomas en HMG y todas esas nuevas carácteristicas ..
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
EduardoLuis
Posts: 682
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina

Re: HMG.3.3.0 Patch 2 (32 and 64-bits)

Post by EduardoLuis »

Hola Pablo:

En cuanto al código solo puse la línea a modo de ejemplo de la sintaxis.- No postee el prg completo ya que está en la carpeta HMG 3.30\SAMPLES\HFCL\HMG_HPDF\DEMO.- Para ubicarte mejor es la línea 486.- En la instrucción original no hay colocados los parámetros FONT y SIZE que estan previstos en la sintaxis.- Si le agregas - como indica la sintaxis - los parametros FONT y SIZE da error.- Para evitar confusión aclaré que la fuente funciona correctamente en todas las restantes sintaxis de HMG_HPDF.-
Yo utilizo para todas las salidas de impresión HPDF, ya que permite generar informes de alta calidad y podés incorporarle gráficos tambien de alta calidad.- Es una herramienta fantástica.-
Adjunto la fuente utilizada.-
Espero haberte orientado un poco mas.-
Te mando un abrazo. Eduardo
Attachments
font.zip
(44.1 KiB) Downloaded 422 times
User avatar
Amarante
Posts: 182
Joined: Fri Apr 27, 2012 9:44 pm
DBs Used: DBF, MySQL, MariaDB, SQLite, PostgreSQL
Location: Araruama-RJ, Brazil

Re: HMG.3.3.0 Patch 2 (32 and 64-bits)

Post by Amarante »

Eduardo,
The font file is in the same directory as the application or you are recommending the absolute address it?
See the description of the use of HPDFPRINT:
This command is used to render a single line of text data in the specified font, size, color and
alignment at the specified row and column. The text rendered is left aligned unless otherwise
specified. Only following Base14 fonts are built-in. Courier, Courier-Bold, Courier-Oblique,
Courier-BoldOblique, Helvetica, Helvetica-Bold, Helvetica-Oblique, Helvetica-BoldOblique,
Times-Roman, Times-Bold, Times-Italic, Times-BoldItalic, Symbol, ZapfDingbats. The text will be
rendered in the current character encoding.
Helvetica is the default font if no fontname is specified. Default fontsize is 12.
True Type Fonts can also be used if the absolute address of the True Type Font file is mentioned.
Otherwise the TTF shall be required at the runtime in the same directory as of the executable file.

I understand that you need to target where the file Font, need not be installed on windows. Forgive me if I'm wrong.
Hope this helps.
EduardoLuis
Posts: 682
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina

Re: HMG.3.3.0 Patch 2 (32 and 64-bits)

Post by EduardoLuis »

Hi Amarante:

Since last upgrade (3.30) you don't need to specify the absolute adress of the font.-
As i said my last post, there is no trouble on all other HPDF sintaxis, only when you try to put a text on a rectangle.-
I try to define the font by different ways as on last HPDF versions (3.046, 3.15, 3.20), defining absolute adress, and the result is the same, gives error.-
All fonts residents on Windows Font folder are taken for HPDF as if they where on an absolute adress.-
I think the problem is on HPDF definitions, but my knowledge is not enough to reach a solution.-
If you see on HMG 3.30\SAMPLES\HFCL\HMG_HPDF\demo, you can mention any font and it will be taken without indicate absolute adress.-
By the way, you don't need to be forgiven.- I am learning, so i have more chances than you to make a mistake, so who must please forgive, is me.-
Thanks for your suggestions.-
With regards. Eduardo
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

HMG.3.3.0 Patch 2 (32 and 64-bits)

Post by Pablo César »

EduardoLuis wrote:Te reporto un bug que encontré en HPDF.-

En el demo HPDF (carpeta HFCL , HMG_HPDF), si indicas el FONT y SIZE para un texto delimitado a un rectángulo, da error...

Code: Select all

            @ 230, 150 HPDFPRINT "This is a small paragraph to be printed inside a rectangular area justified." ; 
                       to 250, 200 ;
                       FONT "Kunstler" SIZE 20 ;
                       CENTER

No postee el prg completo ya que está en la carpeta HMG 3.30\SAMPLES\HFCL\HMG_HPDF\DEMO.- Para ubicarte mejor es la línea 486
 
Eduardo, todavia sigo no entendiendo lo que te pasa. Solo sé que te está dando error pero tu no detallas, no exibes el error que mencionas y queda muy dificil entenderte. Disculpame.
Hablas del ejemplo HMG 3.30\SAMPLES\HFCL\HMG_HPDF\DEMO y yo no tengo esta carpeta. :( No sé si yo lo tengo mal o si te confundiste), pero imagino que sea el ejemplo C:\hmg.3.3.0\SAMPLES\HPDF\HMG_HPDF\demo.Prg

Grabé tu archivo KUNSTLER.TTF dentro de la carpeta ejemplo (in the current folder), modifiqué el ejemplo como mencionás arriba, compilé y no me dá error ninguno.
Screen2.PNG
Screen2.PNG (102.8 KiB) Viewed 9217 times
Anexé el prg y ejecutable para que pruebes alli.
Attachments
HMG HPDF.rar
DEMO
(1.36 MiB) Downloaded 421 times
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: HMG.3.3.0 Patch 2 (32 and 64-bits)

Post by EduardoLuis »

Hola Pablo:

Antes que nada te pido disculpas por contestarte recien hoy, pero en casa no tengo servicio de Internet.-
Te adjunto un zip con el PRG y el EXE, para que lo puedas testear.-
El font KUNSTLER yo lo tengo instalado en el Fonts de Windows.- De todos modos, y HMG_PDF lo reconoce directamente.- Si está instalado en la carpeta tambien; te lo comento porque no importa donde esté, lo reconoce de todos modos.-
Yo lo incluí en las líneas 448 y 454 del PRG.-
Si lo incluyes en la línea 486 verás el error que me dá.-
Antes de que modifiques la línea 486 y compiles el PRG, mira el PDF.-
Luego modifica la linea 486 con FONT "Kunstler" SIZE 20 CENTER y verás los errores que me arroja.-
Te pido disculpas por no haber sido mas explicito en mi anterior post.-
Te mando un abrazo. Eduardo
Attachments
HMG_PDF_4.ZIP
(718.16 KiB) Downloaded 450 times
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

HMG.3.3.0 Patch 2 (32 and 64-bits)

Post by Pablo César »

EduardoLuis wrote:Antes que nada te pido disculpas por contestarte recien hoy, pero en casa no tengo servicio de Internet
No hay problemas Eduardo. Entendi.
EduardoLuis wrote:Te adjunto un zip con el PRG y el EXE, para que lo puedas testear
Fundamental, gracias.
EduardoLuis wrote:El font KUNSTLER yo lo tengo instalado en el Fonts de Windows.- De todos modos, y HMG_PDF lo reconoce directamente.- Si está instalado en la carpeta tambien; te lo comento porque no importa donde esté, lo reconoce de todos modos
Ummm no es bien asi Eduardo. Cuando yo implementé en el h_HMG_HPDF.Prg (source del HMG_HPDF) fué esa la intención que buscara el font que el usuário haya definido. Pero te explico, por qué no te estaba entendiendo. Primero, la falta de tus archivos PRG y del font que cuando lo envistaste facilitó el entendimiento. Y segundo es que vos lo tenés "instalado" en tu Windows, yo y otra personas: no. Entonces las rutinas que adicioné para reconocimiento de fonts no lo hace como te funciona a vos alli. La rutina de reconocimiento, cuando no encuentra el font definido por el usuário entonces asume Helvetica. Y era eso que me pasaba, no mostraba error alguno. Pero si adicionas la palabra LOG al final de la linea 21, donde dice SELECT HPDFDOC ... el sistema irá crear un archivo llamado UsedFonts.htm. Ai me di cuenta que para mi no me estaba asumiendo este font (mismo el archivo estar en la carpeta corriente). Otra cosa, vos no pusiste la extension del archivo. Y fué alli que descubrí los errores de que hablabas (apesar de no haber descripto los errores). Debe ser porque vos los tenias "instalado" el font y yo aqui no.

Entonces de facto, constacté que existe algun problema cuando ela impresion se trata de MULTILINE. Yo lo voy a ver luego que pueda y retornaré con la solucion.

Un abrazo,
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: HMG.3.3.0 Patch 2 (32 and 64-bits)

Post by EduardoLuis »

Hola Pablo:

Muy esclarecedoras tus explicaciones, ahora me queda mas claro el tema del funcionamiento de los fonts.-
Gracias a tu implementación sustutuí el viejo método de definir cada TTF:

qPDF := _HMG_SYSDATA[ 150, 1 ]
cTTFFName := "C:\hmg.3.0.45\hfcl\Samples\HMGHPDFDoc\impact.ttf"
cFontName := HPDF_LoadTTFontFromFile( qPDF, cTTFFName, .F. )
@ 230, 10 HPDFPRINT "This is right aligned text" ;
FONT cFontName SIZE 30
RIGHT'
Cuando vi los errores en parrafos multiline, intenté folver al viejo con igual fracaso.-
Nuevamente te pido disculpes mi torpeza en las explicaciones de mis anteriores post.
Si bien no es esencial resolver esta cuestión - dado que para ese tipo de parrafos multilinea podemos obviar TTF y trabajar directamente con Helvetica - , por la importancia que tiene HMG_PDF, vale la pena el tiempo de investigación.-
En ocasiones leo que muchos miembros del foro aun utilizar REPORT, cuando HMG_PDF es muy superior por las infinitas posibilidades que ofrece.- Yo en todas mis aplicaciones los procesos que derivan en impresión, todos sin excepción van a HMG_PDF.- Reconozco si que es algo mas trabajoso, pero el resultado final lo amerita.-
Nuevamente te doy las gracias por tus buenos consejos.-
Un abrazo. Eduardo.
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

HMG.3.3.0 Patch 2 (32 and 64-bits)

Post by Pablo César »

Hola Eduardo,

Encontré el bug. Substituye la funcion _HMG_HPDF_MULTILINE_PRINT
que está en C:\hmg.3.3.0\SOURCE\h_HMG_HPDF.Prg por esta:

Code: Select all

Function _HMG_HPDF_MULTILINE_PRINT ( nRow, nCol, nToRow, nToCol, cFontName, nFontSize, nRColor, nGColor, nBColor, cText, lBold, lItalic, lUnderline, lStrikeout, lColor, lFont, lSize, cAlign )
Local nWidth := _HMG_SYSDATA[ 150 ][ 4 ]
Local nHeight := _HMG_SYSDATA[ 150 ][ 5 ]
Local nTextWidth := 0
Local nxPos := _HMG_HPDF_MM2Pixel( nCol )
Local nyPos := nHeight - _HMG_HPDF_MM2Pixel( nRow )
Local nToxPos := nxPos + _HMG_HPDF_MM2Pixel( nToCol - nCol )
Local nToyPos := nyPos - _HMG_HPDF_MM2Pixel( nToRow - nRow )
Local oFont := Nil
Local cFont := ''
Local cTtfFnt // Pablo June, 2014

default cFontName := ''
default nFontSize := 12
default nRColor := 0
default nGColor := 0
default nBColor := 0
default lBold := .f.
default lItalic := .f.
default lUnderline := .f.
default lStrikeout := .f.
default lColor := .f.
default lFont := .f.
default lSize := .f.
default cAlign := ''

cTtfFnt := cFontName // Pablo June, 2014

If _HMG_SYSDATA[ 150 ][ 1 ] == Nil // PDF object not found!
   _HMG_HPDF_Error( 3 )
   Return Nil
endif
If _HMG_SYSDATA[ 150 ][ 7 ] == Nil // PDF Page object not found!
   _HMG_HPDF_Error( 5 )
   Return Nil
endif

// set color
If lColor
   HPDF_Page_SetRGBFill( _HMG_SYSDATA[ 150 ][ 7 ], nRColor/255, nGColor/255, nBColor/255 )
else
   HPDF_Page_SetRGBFill( _HMG_SYSDATA[ 150 ][ 7 ], 0.0, 0.0, 0.0 )
endIf   

// set font
If HMG_LEN( alltrim( cFontName ) ) == 0
   cFontName := _HMG_HPDF_SetFont( cFontName, lBold, lItalic )
   oFont := HPDF_GetFont( _HMG_SYSDATA[ 150 ][ 1 ], cFontName, _HMG_SYSDATA[ 150 ][ 10 ] )
else
   // cFontName := alltrim( cFontName )
   cFontName := AllTrim(_HMG_HPDF_SetFont( cFontName, lBold, lItalic ))
   If HMG_UPPER( HB_USUBSTR( cFontName, HMG_LEN( cFontName ) - 3 ) ) == '.TTF' //Pablo. June 2014
      cFont := HPDF_LOADTTFONTFROMFILE( _HMG_SYSDATA[ 150 ][ 1 ], cFontName, .t. )
      If HMG_LEN( alltrim( cFont ) ) == 0
         _HMG_HPDF_Error( 6 , cFontName )
         Return Nil
      endif
      oFont := HPDF_GetFont( _HMG_SYSDATA[ 150 ][ 1 ], cFont, _HMG_SYSDATA[ 150 ][ 10 ] )
   else
      If HMG_UPPER( alltrim( cFontName ) ) == "SYMBOL" .or. HMG_UPPER( alltrim( cFontName ) ) == "ZAPFDINGBATS"
         oFont := HPDF_GetFont( _HMG_SYSDATA[ 150 ][ 1 ], cFontName, Nil )
      else   
         oFont := HPDF_GetFont( _HMG_SYSDATA[ 150 ][ 1 ], cFontName, _HMG_SYSDATA[ 150 ][ 10 ] )
      endIf   
   endif
endIf   
If oFont == Nil
   _HMG_HPDF_Error( 6 , cFontName )
   Return Nil
else
   HPDF_Page_SetFontAndSize( _HMG_SYSDATA[ 150 ][ 7 ], oFont, nFontSize )
   HPDF_Page_BeginText( _HMG_SYSDATA[ 150 ][ 7 ] )
   do case
      case HMG_UPPER( cAlign ) == 'CENTER'
         HPDF_Page_TextRect( _HMG_SYSDATA[ 150 ][ 7 ], nxPos, nyPos, nToxPos, nToyPos, cText, HPDF_TALIGN_CENTER, Nil )
      case HMG_UPPER( cAlign ) == 'RIGHT'
         HPDF_Page_TextRect( _HMG_SYSDATA[ 150 ][ 7 ], nxPos, nyPos, nToxPos, nToyPos, cText, HPDF_TALIGN_RIGHT, Nil )
      case HMG_UPPER( cAlign ) == 'JUSTIFY'
         HPDF_Page_TextRect( _HMG_SYSDATA[ 150 ][ 7 ], nxPos, nyPos, nToxPos, nToyPos, cText, HPDF_TALIGN_JUSTIFY, Nil )
      otherwise         
         HPDF_Page_TextRect( _HMG_SYSDATA[ 150 ][ 7 ], nxPos, nyPos, nToxPos, nToyPos, cText, HPDF_TALIGN_LEFT, Nil )
   endcase         
   HPDF_Page_EndText( _HMG_SYSDATA[ 150 ][ 7 ] )
   
   If lDoLog // Pablo June, 2014
	  HTML_TABLE_LINE(nFHandle,{{StrZero(nRow,4,0)+" ("+StrZero(nyPos,7,2)+")","#FFFFFF",.t.},;
	                            {StrZero(nCol,4,0)+" ("+StrZero(nxPos,7,2)+")","#FFFFFF",.t.},;
							    {StrZero(_HMG_SYSDATA[ 150 ][ 13 ],3,0),"#FFFFFF",.t.},;
							    {PadR(If(Empty(cTtfFnt),"<Default>",cTtfFnt),If(HMG_Len(cTtfFnt)>30,HMG_Len(cTtfFnt),30)),"#FFFFFF",.f.},;
							    {StrZero(nFontSize,2,0),"#FFFFFF",.t.},;
							    {If(lBold,"BOLD" ,Space(4))+If(lItalic," ITALIC",Space(7)),"#FFFFFF",.f.},;
							    {cFontName,If(If(Empty(cTtfFnt),HMG_Len(cFontName),HMG_Len(cTtfFnt))==HMG_Len(cFontName),"#FFFFFF","#FFFF66"),.f.}})
   Endif
endif
Return Nil
Ejecuta el BuildLib.bat y listo !
Asi quedó:
Screen4.PNG
Screen4.PNG (82.33 KiB) Viewed 9145 times
Gracias Eduardo por tu reporte del error. Solo asi podemos construir un buena biblioteca de HMG.

Por favor Claudio, podrias incluir este arreglo en tu próximo PATCH ?
Si es posible, poderian arreglar este conflito por favor ? Yo ya dí una opinion y una posible solucion, pero Rathi todavia no respondió adecuadamente a este tema y ya se pasaron 2 PATCHs... y todavia nada... :roll:

Image

Please Claudio, can you include this fix on your next PATCH ?
If possible, arrange the fix for this conflict please ? I already gave a review and a possible solution, but still not received adequately answered from Rathi this issue and already took 2 PATCHs... and still nothing... :roll:
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Post Reply