Which fonts work DC_GraQueryTextbox()
Posted: Fri Jul 17, 2015 1:29 pm
Which fonts work function works DC_GraQueryTextbox()? I would like to display the symbol to know the width and height in pixels of the area in which it will be displayed. I would like to display it on a different background than the surrounding. Fill the box with one color using the GraBox(). Then another color fills the area to display a character with the same function. And then in this area with another icon is displayed in the background. Like anything complex. But I have a function DC_GraQueryTextbox() incorrectly determines the width and height of the area needed to display the symbol.
[/size]
The result - a small white rectangle around the origin. A 9 should be on a white background surrounded by a light yellow background:

Code: Select all
aFonts := XbpFont():new():list() // Все доступные шрифты
oFont := XbpFont():new():create(cFont)
GraSetFont(oPS , oFont) // установить шрифт
aAttrF := ARRAY( GRA_AS_COUNT )
aAttrF [ GRA_AS_COLOR ] := GRA_CLR_BLACK
aAttrF [ GRA_AS_HORIZALIGN ] := GRA_HALIGN_LEFT // Выравнивание символов по горизонтали по левому краю
aAttrF [ GRA_AS_VERTALIGN ] := GRA_VALIGN_BOTTOM // Выравнивание символов по вертикали по низу
GraSetAttrString( oPS, aAttrF ) // Установить символьные атрибуты
*****************************************
*** Стереть окно, т.е. нарисовать белый прямоугольник с белыми границами
*** Стереть окно, т.е. нарисовать светло-желтый прямоугольник с такими же границами
* GraSetColor( oPS, GRA_CLR_WHITE, GRA_CLR_WHITE )
GraSetColor( oPS, aColor[163], aColor[163] )
GraBox( oPS, { 0, 0 }, { X_MaxW, Y_MaxW }, GRA_FILL )
*** Символ нарисовать черным на на белом фоне
aTxtPar = DC_GraQueryTextbox(CHR(mSimb), oFont) // {101,16} Определяет длину и высоту текста в пикселях для некоторых шрифтов
GraSetColor( oPS, GRA_CLR_WHITE, GRA_CLR_WHITE )
GraBox( oPS, { 0, 0 }, { aTxtPar[1], aTxtPar[2] }, GRA_FILL )
GraSetColor( oPS, GRA_CLR_BLACK, GRA_CLR_BLACK )
GraStringAt( oPS, { 0, 0 }, CHR(mSimb)) // Отобразить символ
The result - a small white rectangle around the origin. A 9 should be on a white background surrounded by a light yellow background:
