Announcement

Collapse
No announcement yet.

ANSI_VAR_FONT and MS Sans Serif..

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ANSI_VAR_FONT and MS Sans Serif..

    Is ANSI_VAR_FONT always MS Sans Serif, or more important - is
    MS Sans Serif always called MS Sans Serif? Guess not. I used an
    exact string to create some fonts for new version of Poffs and a
    few has reported weird fonts on some buttons. Wrote the following
    routine to make sure in the future, maybe someone can benefit from it:
    Code:
      LOCAL hDC AS LONG, tFont AS LONG, zs AS ASCIIZ * %LF_FACESIZE
     
      hDC = GetDC (hDlg) 'Get correct %ANSI_VAR_FONT name
         tFont =  SelectObject(hDC, GetStockObject(%ANSI_VAR_FONT))
         CALL GetTextFace(hDC, SIZEOF(zs), zs)
         SelectObject hDC, tFont
      CALL ReleaseDC (hDlg, hDC)
      'zs should now hold the name we are looking for..

    ------------------

  • #2
    i use the following:
    Code:
    local font as logfont  
    getobject getstockobject( %ansi_var_font ), sizeof( font ), font
    this way you will have the name loaded in font.lffacename, and also the height and the average width of the font (respectively in font.lfheight and font.lfwidth). this can be useful when converting pixels to dialog units and vice-versa.

    (added april 20, 2001)

    the getobject call doesn't get the correct values. see http://www.powerbasic.com/support/pb...ead.php?t=3617 and http://www.powerbasic.com/support/pb...ad.php?t=22992

    ------------------




    [this message has been edited by aldo cavini (edited april 19, 2001).]
    Rgds, Aldo

    Comment


    • #3
      Ah, much better. Thanks a lot, Aldo!


      ------------------

      Comment

      Working...
      X