Program for Research 1681 graphic fonts

This forum is for eXpress++ general support.
Message
Author
User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Program for Research 1681 graphic fonts

#11 Post by Eugene Lutsenko »

Can anyone tell me what is my mistake. Do not get even the most primitive version written in the form of a graphic BMP-file

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
LOCAL oSourcePS, oBitmap, oClipBoard, 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
  D = 40

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

      FOR j=i TO D

          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

      **** Записать графический файл
      oSourcePS := oPS:lockPS()
      IF oPS:isDerivedFrom('XbpDialog')
         aPos := { -4, -4 }
      ELSE
         aPos := { 0, 0 }
      ENDIF

      oBitmap := GraSaveScreen( oSourcePS, aPos, oPS:currentSize() )
      cFileName = "Fonts"+ALLTRIM(STR(j))+".bmp"
      oBitMap:saveFile( cFileName, XBPBMP_FORMAT_WIN3X )  
  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]

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Program for Research 1681 graphic fonts

#12 Post by rdonnay »

I just got back from vacation.
I will look at your sample and determine why it is erroring.
The eXpress train is coming - and it has more cars.

User avatar
Auge_Ohr
Posts: 1428
Joined: Wed Feb 24, 2010 3:44 pm

Re: Program for Research 1681 graphic fonts

#13 Post by Auge_Ohr »

Eugene Lutsenko wrote:Can anyone tell me what is my mistake. Do not get even the most primitive version written in the form of a graphic BMP-file
i think you have to oPS:unlockPS() before GraSaveScreen()
greetings by OHR
Jimmy

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Program for Research 1681 graphic fonts

#14 Post by Eugene Lutsenko »

rdonnay wrote:I just got back from vacation.
I will look at your sample and determine why it is erroring.
I hope you successfully rested. I'll wait

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Program for Research 1681 graphic fonts

#15 Post by Eugene Lutsenko »

Auge_Ohr wrote:
Eugene Lutsenko wrote:Can anyone tell me what is my mistake. Do not get even the most primitive version written in the form of a graphic BMP-file
i think you have to oPS:unlockPS() before GraSaveScreen()
Tried. Unfortunately did not work, although the error occurs on this team. Writes that the method is not applicable to an object with the same name.

User avatar
Auge_Ohr
Posts: 1428
Joined: Wed Feb 24, 2010 3:44 pm

Re: Program for Research 1681 graphic fonts

#16 Post by Auge_Ohr »

Eugene Lutsenko wrote:Tried. Unfortunately did not work, although the error occurs on this team. Writes that the method is not applicable to an object with the same name.
so try it without

Code: Select all

oSourcePS := oPS:lockPS()
and use

Code: Select all

oBitmap := GraSaveScreen( oPS, aPos, oPS:currentSize() )
greetings by OHR
Jimmy

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Program for Research 1681 graphic fonts

#17 Post by rdonnay »

The below code works for me.

Code: Select all

#INCLUDE "dcdialog.CH"

*************************************
PROCEDURE AppSys
// ??????? ???? ???????? ????? ??????????
RETURN
*************************************
PROCEDURE Main()

   LOCAL GetList := {}, oStatic
   LOCAL oPS, oDevice, oDlg

   DC_IconDefault(1000)

   SET COLLATION TO SYSTEM   // ????????????

   PRIVATE aAttr                             // ?????? ????????? ???????????? ?????
   PRIVATE nEvent, mp1, mp2, oXbp            // ?????????? ??????? ???????

*  DC_PopFont()                              // ?? ???????

   @0, 0 DCSAY "Gra Fonts" FONT "22.Helvetica Bold" 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, oStatic ) }

RETURN NIL


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

LOCAL GetList[0], GetOptions
LOCAL oSourcePS, oBitmap, oClipBoard, 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
  D = 40

  FOR i=1 TO LEN(aFonts) STEP D           // ???? ?? ???????

      FOR j=i TO D

          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

      cFileName = "Fonts"+ALLTRIM(STR(j))+".bmp"

      DC_Scrn2ImageFile( oStatic, cFileName )

  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 )
The eXpress train is coming - and it has more cars.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Program for Research 1681 graphic fonts

#18 Post by Eugene Lutsenko »

Thank you, Roger!

You always everything looks perfect and just as work. But when I saw these recorded image files, it turned out that I do not follow them are formed on the fonts to the first. Now I try to do it, but not very successfully. The program below.

Code: Select all

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

   DC_IconDefault(1000)

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

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

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

   kD = 40

   FOR ki=1 TO 1681 STEP kD                // Цикл по шрифтам

       @ 2,1 DCSTATIC TYPE XBPSTATIC_TYPE_RECESSEDBOX SIZE X_MaxW, Y_MaxW PIXEL;
         OBJECT oStatic;
         EVAL {|| _PresSpace(oStatic, ki, kD ) }
       DCREAD GUI 

   NEXT

RETURN
*************************************************
STATIC FUNCTION _PresSpace( oStatic, ki, kD )

  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, oStatic, ki, kD ) }

RETURN NIL


*******************************************************
STATIC FUNCTION LC_MultiLine( oPS, oStatic, mi, mD )

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

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

  ****** Инициализация графического шрифта для надписи внизу графической экранной формы

      aFonts := XbpFont():new():list()                       // Все доступные шрифты
*     oFont  := XbpFont():new():create("48.Helvetica")       // Конкретный шрифт с указанием размера
      oFont := aFonts[1]                                     // Конкретный шрифт по номеру из списка (всего доступно 1681 графических шрифтов)
      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=mi TO mD

          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

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

      cFileName = "Fonts"+STRTRAN(STR(mi,4)," ","0")+"-"+STRTRAN(STR(mi+mD,4)," ","0")+".bmp"
      DC_Scrn2ImageFile( oStatic, cFileName )

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

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]

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Program for Research 1681 graphic fonts

#19 Post by rdonnay »

But when I saw these recorded image files, it turned out that I do not follow them are formed on the fonts to the first. Now I try to do it, but not very successfully.
I don't understand what you are saying.
The eXpress train is coming - and it has more cars.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Program for Research 1681 graphic fonts

#20 Post by Eugene Lutsenko »

Thank you!

This is what I meant. Files are written! But the files themselves are formed not so. I wish that every file was with images of graphic fonts. But they are only the first file.

Post Reply