Page 2 of 2
Re: TTF to bitmap conversion needed!
Posted: Thu May 20, 2010 7:07 pm
by mol
Alex Gustow wrote:Marek, do you must type so many symbols in "Polish version" of simple "Thanks..."?
Seriously, I remember that I saw something like this... I'll try to find (but I'm not sure that successfully).
As I understand, you want to have something like:
Code: Select all
local oMyBMP
...
oMyBMP := String_2_BMP( "Marek Olszewski", "Times New Roman", 12 )
...
and after that use bit array in "oMyBMP" as (for example) captcha... or save this array to temporary (or constant) BMP-file... That's right?
P.S. I googled right now on "create captcha Foxpro" - and try to look here: "
A Captcha Image Generator for Foxpro"... Maybe it helps?
P.P.S. (
10 minutes later) While I thought, googleed and wrote my post -
Claudio give us his sample. I'm too late again...
Claudio, I tested it right now too - it's cool and useful thing!
Thanks!
Polish language is very verbose
Many thanks Claudio, I'll try your sample tomorrow morning when I'll find a few minutes...
Last time I'm very busy with my work, my second work, my third work...
And with programming my new application for billing (with HMG of course
).
Re: TTF to bitmap conversion needed!
Posted: Thu May 20, 2010 9:41 pm
by srvet_claudio
Alex Gustow wrote:P.P.S. (10 minutes later) While I thought, googleed and wrote my post - Claudio give us his sample. I'm too late again... Claudio, I tested it right now too - it's cool and useful thing! Thanks!
Thanks Alex.
Best Regards,
Claudio Soto.
Re: TTF to bitmap conversion needed!
Posted: Thu May 20, 2010 9:46 pm
by srvet_claudio
mol wrote:Many thanks Claudio, I'll try your sample tomorrow morning when I'll find a few minutes...
You are welcome.
Best regards,
Claudio Soto.
Re: TTF to bitmap conversion needed!
Posted: Fri May 21, 2010 12:17 pm
by mol
Great work!
It's really it what I'm searching for!
Many thanks for sharing!
Marek
Re: TTF to bitmap conversion needed!
Posted: Fri May 21, 2010 6:59 pm
by srvet_claudio
mol wrote:Great work!
It's really it what I'm searching for!
Many thanks for sharing!
Marek
Hi Marek.
I'm glad that the program is useful to you.
Best Regards,
Claudio Soto.
Re: TTF to bitmap conversion needed!
Posted: Fri May 21, 2010 8:17 pm
by Rathinagiri
I think it could be used by many. Thanks for sharing Claudio.
Re: TTF to bitmap conversion needed!
Posted: Fri May 21, 2010 9:00 pm
by srvet_claudio
rathinagiri wrote:I think it could be used by many. Thanks for sharing Claudio.
Thanks Rathi.
You're very kind.
Best regards,
Claudio.
Re: TTF to bitmap conversion needed!
Posted: Mon May 24, 2010 6:12 am
by mol
I'm backing to this topic because I need to get list of fonts installed in system.
I know about function GetFont, but, I need to build my own font selection dialog.
Can anybody help me?
Best regards, Marek
Re: TTF to bitmap conversion needed!
Posted: Mon May 24, 2010 1:16 pm
by gfilatov
mol wrote:I'm backing to this topic because I need to get list of fonts installed in system.
I know about function GetFont, but, I need to build my own font selection dialog.
Can anybody help me?
Hi Marek,
Please try the following working sample:
Code: Select all
/*
* HMG - Harbour Win32 GUI library Demo
*
*/
#include "hmg.ch"
Procedure Main()
DEFINE WINDOW Form_Main ;
AT 0,0 ;
WIDTH 640 HEIGHT 480 ;
TITLE 'Main Window' ;
MAIN ;
BACKCOLOR BLUE
DEFINE LABEL Label_1
ROW 205
COL Form_Main.Width - 294
VALUE 'Fonts:'
WIDTH 48
HEIGHT 16
BACKCOLOR BLUE
END LABEL
DEFINE COMBOBOX Combo_1
ROW 200
COL Form_Main.Width - 244
ITEMS GetFonts()
WIDTH 200
VALUE 1
TOOLTIP 'Fonts'
END COMBOBOX
define button Btn_2
row 290
col Form_Main.Width - 234
caption "Cancel"
action Form_Main.Release()
end button
END WINDOW
CENTER WINDOW Form_Main
ACTIVATE WINDOW Form_Main
return
Function GetFonts()
Local aTmp, aFonts := {}, nHandle := GetDC(NIL)
aTmp := GetFontNames( nHandle )
ReleaseDC( NIL, nHandle )
aeval( aTmp, {|e| IF(aScan(aFonts, e) == 0 .and. !"@" $ e, aAdd(aFonts, e), )} )
return aSort(aFonts)
#pragma BEGINDUMP
#define HB_OS_WIN_USED
#define _WIN32_WINNT 0x0400
#include <windows.h>
#include "hbapi.h"
#include "hbapiitm.h"
static far int nFontIndex = 0;
static far BOOL bGetName = FALSE;
HB_FUNC ( GETDC )
{
hb_retnl( (ULONG) GetDC( (HWND) hb_parnl(1) ) ) ;
}
HB_FUNC ( RELEASEDC )
{
hb_retl( ReleaseDC( (HWND) hb_parnl(1), (HDC) hb_parnl(2) ) ) ;
}
// EnumFonts call back routine
static int CALLBACK EnumFontsCallBack( LOGFONT FAR *lpLogFont,
TEXTMETRIC FAR *lpTextMetric, int nFontType , LPARAM lParam )
{
++nFontIndex;
if ( bGetName )
hb_storvc( lpLogFont->lfFaceName, -1, nFontIndex );
return 1;
}
// GetFontNames: Count and return an unsorted array of font names
HB_FUNC ( GETFONTNAMES )
{
FONTENUMPROC lpEnumFontsCallBack = ( FONTENUMPROC )
MakeProcInstance( ( FARPROC ) EnumFontsCallBack, GetModuleHandle( NULL ) );
// Get the number of fonts
nFontIndex = 0;
bGetName = FALSE;
EnumFonts( ( HDC ) hb_parnl( 1 ), NULL, lpEnumFontsCallBack, 0 );
// Get the font names
hb_reta( nFontIndex );
nFontIndex = 0;
bGetName = TRUE;
EnumFonts( ( HDC ) hb_parnl( 1 ), NULL, lpEnumFontsCallBack, 0 );
}
#pragma ENDDUMP
Hope that helps
Re: TTF to bitmap conversion needed!
Posted: Mon May 24, 2010 7:19 pm
by mol
THX Grigori, I'll try tomorrow!
Regards, Marek