Files
harbour-core/harbour/tests/gtxfnt.prg
Przemyslaw Czerpak 272a818a79 2009-02-20 04:15 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbgtinfo.ch
    + added HB_GTI_FONTSEL

  * harbour/source/rtl/gtxwc/gtxwc.c
    + added support for HB_GTI_FONTSEL
    + added support for HB_GTI_PALETTE

  + harbour/tests/gtxfnt.prg
    + added small demonstration/test code for HB_GTI_FONTSEL
      and XWindow GTs

  * harbour/source/rtl/hbproces.c
    * replaced execv() with execvp() in *nix builds
2009-02-20 03:11:51 +00:00

56 lines
1.3 KiB
Plaintext

/*
* $Id$
*/
/*
* Harbour Project source code:
* demonstration/test code for changing font in X-Window GTs
*
* Copyright 2009 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
* www - http://www.harbour-project.org
*
*/
#include "hbgtinfo.ch"
REQUEST HB_GT_XWC_DEFAULT
proc main()
local cChars, i, j, n
cChars := ""
for i := 0 to 7
cChars += ";"
for j := 0 to 31
n := i * 32 + j
cChars += iif( n == asc( ";" ), ",", ;
iif( n == 10, " ", chr( n ) ) )
next
next
n := 2
? hb_gtVersion( 0 ), hb_gtVersion( 1 )
while n == 2
? hb_gtInfo( HB_GTI_FONTSEL )
hb_gtInfo( HB_GTI_FONTSEL, xFontSel() )
n := alert( "What do you think about this font;;" + ;
hb_gtInfo( HB_GTI_FONTSEL ) + ";" + cChars, ;
{ "FINE", "CHANGE" } )
enddo
? "current font:"
? hb_gtInfo( HB_GTI_FONTSEL )
outstd( hb_gtInfo( HB_GTI_FONTSEL ) )
wait
return
function xfontsel()
local hProcess, hStdOut, cFontSel, n
hProcess := hb_processOpen( "xfontsel -print",, @hStdOut )
if hProcess != -1
cFontSel := space( 256 )
n := fread( hStdOut, @cFontSel, len( cFontSel ) )
cFontSel := left( cFontSel, n )
hb_processClose( hProcess )
fclose( hStdOut )
endif
return cFontSel