Page 1 of 3

Program for Research 1681 graphic fonts

Posted: Mon Jul 14, 2014 8:16 pm
by Eugene Lutsenko
Does anyone have a program for easy viewing of all possible (available) graphic fonts? Yet their 1681 and it is difficult to view them all recasting primitive program like this, which I did:

Code: Select all

  ****** Исследование графических шрифтов

  ****** Инициализация графического шрифта

  aFonts := XbpFont():new():list()                       // Все доступные шрифты
* oFont  := XbpFont():new():create("48.Helvetica")       // Конкретный шрифт с указанием размера
* oFont := aFonts[1]                                     // Конкретный шрифт по номеру из списка (всего доступно 1681 графических шрифтов)
* GraSetFont(oPS , oFont)                                // установить шрифт

  oFont := aFonts[1] 
  GraSetFont(oPS , oFont)       // установить шрифт

  aAttrF := ARRAY( GRA_AS_COUNT ) 
  aAttrF [ GRA_AS_COLOR      ] := GRA_CLR_BLACK 
  aAttrF [ GRA_AS_BOX        ] := { 2*R0, R0 }           // Размер поля вывода
  aAttrF [ GRA_AS_HORIZALIGN ] := GRA_HALIGN_CENTER      // Выравнивание символов по горизонтали по центру относительно точки начала вывода
  aAttrF [ GRA_AS_VERTALIGN  ] := GRA_VALIGN_HALF        // Выравнивание символов по вертикали по средней линии относительно точки начала вывода
  GraSetAttrString( oPS, aAttrF ) 
  GraStringAt( oPS, { 200, 10 }, "Всего шрифтов:"+ALLTRIM(STR(LEN(aFonts),15)) )

  FOR j=1 TO LEN(aFonts)                  // Цикл по шрифтам

      oFont := aFonts[j] 
      GraSetFont(oPS , oFont)       // установить шрифт

      aAttrF := ARRAY( GRA_AS_COUNT ) 
      aAttrF [ GRA_AS_COLOR      ] := GRA_CLR_BLACK 
      aAttrF [ GRA_AS_BOX        ] := { 2*R0, R0 }             // Размер поля вывода
      aAttrF [ GRA_AS_HORIZALIGN ] := GRA_HALIGN_CENTER      // Выравнивание символов по горизонтали по центру относительно точки начала вывода
      aAttrF [ GRA_AS_VERTALIGN  ] := GRA_VALIGN_HALF        // Выравнивание символов по вертикали по средней линии относительно точки начала вывода
      GraSetAttrString( oPS, aAttrF )                        // Установить символьные атрибуты

      GraStringAt( oPS, { 200, 20+j*20 }, "Шрифт №"+ALLTRIM(STR(j,15))+IF(oFont:vector,"-векторный","") )

  NEXT
  *** Конец исследования шрифтов
[/size]

Re: Program for Research 1681 graphic fonts

Posted: Tue Jul 15, 2014 4:53 am
by Eugene Lutsenko
How to improve the program so that you can specify a range of numbers in the font dialog or to herself recorded once all image files with all fonts

Code: Select all

*************************************
PROCEDURE AppSys
// Рабочий стол остается окном приложения
RETURN
*************************************
PROCEDURE Main()
   
   LOCAL GetList := {}, oStatic
   LOCAL oPS, oDevice

   DC_IconDefault(1000)

   SET COLLATION TO SYSTEM   // Руссификация

   PRIVATE aAttr                             // Массив атрибутов отображаемых линий
   PRIVATE nEvent, mp1, mp2, oXbp            // Переменные анализа событий

   N_Graf  = 224                             // Кол-во графиков

   @0, 0 DCSAY "Gra Fonts" FONT ("22.HelveticalBold") SIZE 0

   PUBLIC X_MaxW := 1280, Y_MaxW := 850               // Размер графического окна в пикселях

   @ 2,1 DCSTATIC TYPE XBPSTATIC_TYPE_RECESSEDBOX SIZE X_MaxW, Y_MaxW PIXEL;       // Размер окна для отображения графика
         OBJECT oStatic;
         EVAL {|| _PresSpace(oStatic, N_Graf ) }

   DCREAD GUI ;
      TITLE "Типовое решение по отображению семейства графиков";     // Надпись на окне графика
      FIT ;
      BUTTONS DCGUI_BUTTON_EXIT

RETURN
*************************************************
STATIC FUNCTION _PresSpace( oStatic, N_Graf )

   LOCAL oPS, oDevice


   oPS := XbpPresSpace():new()         // Create a PS
   oDevice := oStatic:winDevice()      // Get the device context
   oPS:create( oDevice )               // Link device context to PS
   oPS:SetViewPort( { 0, 0, X_MaxW, Y_MaxW } )
   oStatic:paint := {|mp1,mp2,obj| mp1 := LC_MultiLine( oPS, N_Graf ) }

RETURN NIL


*******************************************************
STATIC FUNCTION LC_MultiLine(oPS, N_Graf )

  ****** Исследование графических шрифтов

  ****** Инициализация графического шрифта

  aFonts := XbpFont():new():list()                       // Все доступные шрифты
* oFont  := XbpFont():new():create("48.Helvetica")       // Конкретный шрифт с указанием размера
* oFont := aFonts[1]                                     // Конкретный шрифт по номеру из списка (всего доступно 1681 графических шрифтов)
* GraSetFont(oPS , oFont)                                // установить шрифт

  oFont := aFonts[1] 
  GraSetFont(oPS , oFont)       // установить шрифт

  aAttrF := ARRAY( GRA_AS_COUNT ) 
  aAttrF [ GRA_AS_COLOR      ] := GRA_CLR_BLACK 
* aAttrF [ GRA_AS_BOX        ] := { 300, 50 }            // Размер поля вывода
  aAttrF [ GRA_AS_HORIZALIGN ] := GRA_HALIGN_CENTER      // Выравнивание символов по горизонтали по центру относительно точки начала вывода
  aAttrF [ GRA_AS_VERTALIGN  ] := GRA_VALIGN_HALF        // Выравнивание символов по вертикали по средней линии относительно точки начала вывода
  GraSetAttrString( oPS, aAttrF ) 
  GraStringAt( oPS, { 200, 10 }, "Всего шрифтов:"+ALLTRIM(STR(LEN(aFonts),15)) )

  S = 1

  FOR j=30 TO LEN(aFonts)                  // Цикл по шрифтам

      oFont := aFonts[j] 
      GraSetFont(oPS , oFont)       // установить шрифт

      aAttrF := ARRAY( GRA_AS_COUNT ) 
      aAttrF [ GRA_AS_COLOR      ] := GRA_CLR_BLACK 
*     aAttrF [ GRA_AS_BOX        ] := { 300, 50 }            // Размер поля вывода
      aAttrF [ GRA_AS_HORIZALIGN ] := GRA_HALIGN_LEFT        // Выравнивание символов по горизонтали по центру относительно точки начала вывода
      aAttrF [ GRA_AS_VERTALIGN  ] := GRA_VALIGN_HALF        // Выравнивание символов по вертикали по средней линии относительно точки начала вывода
      GraSetAttrString( oPS, aAttrF )                        // Установить символьные атрибуты

      GraStringAt( oPS, { 100, 20+(S-1)*20 }, "Шрифт №"+ALLTRIM(STR(j,15))+IF(oFont:vector,"-векторный","") )
      S++

  NEXT
  *** Конец исследования шрифтов

RETURN NIL

[/size]

Re: Program for Research 1681 graphic fonts

Posted: Tue Jul 15, 2014 11:16 am
by Eugene Lutsenko
While that's what happened. This suits me

Image

Re: Program for Research 1681 graphic fonts

Posted: Wed Jul 16, 2014 10:32 am
by rdonnay
I suggest DC_PopFont().

It will pop up a dialog window that shows all installed fonts.

Re: Program for Research 1681 graphic fonts

Posted: Wed Jul 16, 2014 12:30 pm
by Eugene Lutsenko
Thank you, Roger!
Maybe I do not understand something.
I saw it in xdemo.exe, but it's not something I think. I'm talking about the fonts that can be set with these commands:

Code: Select all

  aFonts := XbpFont():new():list()                       // Все доступные шрифты
* oFont  := XbpFont():new():create("48.Helvetica")       // Конкретный шрифт с указанием размера
* oFont := aFonts[1]                                     // Конкретный шрифт по номеру из списка (всего доступно 1681 графических шрифтов)
* GraSetFont(oPS , oFont)                                // установить шрифт

  oFont := aFonts[1] 
  GraSetFont(oPS , oFont)       // установить шрифт
and use when drawing graphic objects, and not in the ordinary screen forms.

Re: Program for Research 1681 graphic fonts

Posted: Wed Jul 16, 2014 1:09 pm
by Auge_Ohr
look into c:\exp19\Source\Dclipx\_dcfont.prg

DC_PopFont() is using XbpFontDialog() which use Windows Common Dialog Class "ChooseFont" function
http://msdn.microsoft.com/en-us/library ... 85%29.aspx

Re: Program for Research 1681 graphic fonts

Posted: Thu Jul 17, 2014 11:25 am
by Eugene Lutsenko
Greetings to all!
Can anyone tell me how to write (save) to an image file previously generated and displayed on the screen graphic object type of the above (not the screen). Knowing this, I try to generate and record all the graphics with all available graphic fonts (which in 1681). However, I decided not to use the library Vector Graphics ActiveX (although I good at it to use it), because on many computers for various reasons it is not installed.

Re: Program for Research 1681 graphic fonts

Posted: Thu Jul 17, 2014 4:09 pm
by Auge_Ohr
Eugene Lutsenko wrote:Can anyone tell me how to write (save) to an image file previously generated and displayed on the screen graphic object type of the above (not the screen).
have a look into C:\exp19\Source\Dclipx\_dcfunct.prg

Code: Select all

DC_Scrn2ImageFile(oXbp, cFileName, nFormat )
can save XbPart, e.g. Dialog Windows, as Image

Re: Program for Research 1681 graphic fonts

Posted: Thu Jul 17, 2014 8:27 pm
by Eugene Lutsenko
Thank you very much! But in my version of Express++ in a help description of this function is not.

I have this function is not documented. Could not give a working example of its use. Compilation is ok, but the performance gives an error that the function can not be applied to the object.

DC_Scrn2ClipBoard()
DC_PrintClipBoard(.t.)

With that also does not work.

Code: Select all

FUNCTION DC_Scrn2ImageFile( oXbp, cFileName, nFormat )

LOCAL oSourcePS, oBitmap, oClipBoard, aPos

oSourcePS := oXbp:lockPS()
IF oXbp:isDerivedFrom('XbpDialog')
  aPos := { -4, -4 }
ELSE
  aPos := { 0, 0 }
ENDIF
oBitmap := GraSaveScreen( oSourcePS, aPos, oXbp:currentSize() )

RETURN oBitMap:saveFile( cFileName, nFormat )
Function GraSaveScreen() also not documented.

**************************************

------------------------------------------------------------------------------
FEHLERPROTOKOLL von "D:\ALASKA\AIDOS-X\GraFonts.exe" Datum: 18.07.2014 10:12:23

Xbase++ Version : Xbase++ (R) Version 1.90.355
Betriebssystem : Windows 7 06.01 Build 07601 Service Pack 1
------------------------------------------------------------------------------
oError:args :
-> VALTYPE: O CLASS: XbpPresSpace
oError:canDefault : N
oError:canRetry : N
oError:canSubstitute: Y
oError:cargo : NIL
oError:description : Object has no method with this name
oError:filename :
oError:genCode : 23
oError:operation : lockPS
oError:osCode : 0
oError:severity : 2
oError:subCode : 2220
oError:subSystem : BASE
oError:thread : 1
oError:tries : 0
------------------------------------------------------------------------------
CALLSTACK:
------------------------------------------------------------------------------
Aufgerufen von DC_SCRN2IMAGEFILE(168)
Aufgerufen von LC_MULTILINE(150)
Aufgerufen von (B)_PRESSPACE(99)
Aufgerufen von DC_GETLIST:EVENTLOOP(4596)
Aufgerufen von DC_GETLIST:READGUI(3800)
Aufgerufen von DC_READGUI(111)
Aufgerufen von MAIN(87)
******************************************************

Code: Select all

*************************************
PROCEDURE AppSys
// Рабочий стол остается окном приложения
RETURN
*************************************
PROCEDURE Main()
   
   LOCAL GetList := {}, oStatic
   LOCAL oPS, oDevice

   DC_IconDefault(1000)

   SET COLLATION TO SYSTEM   // Руссификация

   PRIVATE aAttr                             // Массив атрибутов отображаемых линий
   PRIVATE nEvent, mp1, mp2, oXbp            // Переменные анализа событий

*  DC_PopFont()                              // от Роджера

   @0, 0 DCSAY "Gra Fonts" FONT ("22.HelveticalBold") SIZE 0

   PUBLIC X_MaxW := 1280, Y_MaxW := 850               // Размер графического окна в пикселях




   @ 2,1 DCSTATIC TYPE XBPSTATIC_TYPE_RECESSEDBOX SIZE X_MaxW, Y_MaxW PIXEL;       // Размер окна для отображения графика
         OBJECT oStatic;
         EVAL {|| _PresSpace(oStatic ) }

   DCREAD GUI ;
      TITLE "Типовое решение по отображению семейства графиков";     // Надпись на окне графика
      FIT ;
      BUTTONS DCGUI_BUTTON_EXIT

RETURN
*************************************************
STATIC FUNCTION _PresSpace( oStatic )

   LOCAL oPS, oDevice

   oPS := XbpPresSpace():new()         // Create a PS
   oDevice := oStatic:winDevice()      // Get the device context
   oPS:create( oDevice )               // Link device context to PS
   oPS:SetViewPort( { 0, 0, X_MaxW, Y_MaxW } )
   oStatic:paint := {|mp1,mp2,obj| mp1 := LC_MultiLine( oPS ) }

RETURN NIL


*******************************************************
STATIC FUNCTION LC_MultiLine( oPS )

LOCAL GetList[0], GetOptions, oSourcePS, oBitmap, oDlg, aPos

  ****** Исследование графических шрифтов

  ****** Инициализация графического шрифта

  aFonts := XbpFont():new():list()                       // Все доступные шрифты
* oFont  := XbpFont():new():create("48.Helvetica")       // Конкретный шрифт с указанием размера
* oFont := aFonts[1]                                     // Конкретный шрифт по номеру из списка (всего доступно 1681 графических шрифтов)
* GraSetFont(oPS , oFont)                                // установить шрифт

  oFont := aFonts[1] 
  GraSetFont(oPS , oFont)       // установить шрифт

  aAttrF := ARRAY( GRA_AS_COUNT ) 
  aAttrF [ GRA_AS_COLOR      ] := GRA_CLR_BLACK 
* aAttrF [ GRA_AS_BOX        ] := { 300, 50 }            // Размер поля вывода
  aAttrF [ GRA_AS_HORIZALIGN ] := GRA_HALIGN_CENTER      // Выравнивание символов по горизонтали по центру относительно точки начала вывода
  aAttrF [ GRA_AS_VERTALIGN  ] := GRA_VALIGN_HALF        // Выравнивание символов по вертикали по средней линии относительно точки начала вывода
  GraSetAttrString( oPS, aAttrF ) 
  GraStringAt( oPS, { 200, 10 }, "Всего шрифтов:"+ALLTRIM(STR(LEN(aFonts),15)) )

  S = 1

* FOR j=1 TO LEN(aFonts)            // Цикл по шрифтам
  FOR j=1 TO 40            // Цикл по шрифтам

      oFont := aFonts[j] 
      GraSetFont(oPS , oFont)       // установить шрифт

      aAttrF := ARRAY( GRA_AS_COUNT ) 
      aAttrF [ GRA_AS_COLOR      ] := GRA_CLR_BLACK 
*     aAttrF [ GRA_AS_BOX        ] := { 300, 50 }            // Размер поля вывода
      aAttrF [ GRA_AS_HORIZALIGN ] := GRA_HALIGN_LEFT        // Выравнивание символов по горизонтали по центру относительно точки начала вывода
      aAttrF [ GRA_AS_VERTALIGN  ] := GRA_VALIGN_HALF        // Выравнивание символов по вертикали по средней линии относительно точки начала вывода
      GraSetAttrString( oPS, aAttrF )                        // Установить символьные атрибуты

      GraStringAt( oPS, { 100, 20+(S-1)*20 }, "Шрифт №"+ALLTRIM(STR(j,15))+IF(oFont:vector,"-векторный","") )
      S++

      **** Записать графический файл

      cFileName = "GraFont"+ALLTRIM(STR(j))
      DC_Scrn2ImageFile(oPS, cFileName, "bmp"  )
*     GraSaveScreen(oPS, cFileName )

*     DC_Scrn2ClipBoard()
      DC_PrintClipBoard(.t.)

  NEXT



  *** Конец исследования шрифтов

RETURN NIL

FUNCTION DC_Scrn2ImageFile( oXbp, cFileName, nFormat )

LOCAL oSourcePS, oBitmap, oClipBoard, aPos

oSourcePS := oXbp:lockPS()
IF oXbp:isDerivedFrom('XbpDialog')
  aPos := { -4, -4 }
ELSE
  aPos := { 0, 0 }
ENDIF
oBitmap := GraSaveScreen( oSourcePS, aPos, oXbp:currentSize() )

RETURN oBitMap:saveFile( cFileName, nFormat )
[/size]

Re: Program for Research 1681 graphic fonts

Posted: Fri Jul 18, 2014 11:13 am
by Auge_Ohr
Eugene Lutsenko wrote:Thank you very much! But in my version of Express++ in a help description of this function is not.
as i say : read Source Code ;)
Eugene Lutsenko wrote:Function GraSaveScreen() also not documented.
C:\exp19\Source\Dclipx\_dcxbutt.prg or see Xbase++ Help File XbpBitmap() Sample 2