Author Topic: LOGFONT structure  (Read 15251 times)

Offline avcaballero

  • Full Member
  • **
  • Posts: 132
  • Country: es
    • Abre los Ojos al Ensamblador
LOGFONT structure
« on: January 04, 2015, 03:02:35 PM »
Hello. I'm trying to use the LOGFONT structure. I checked two ways (at the bottom of the source), both failed (commented). Any help, please?

I include my "windemos.inc" file.

Regards and a happy new year, guys.

Offline encryptor256

  • Full Member
  • **
  • Posts: 250
  • Country: lv
  • Win64 .
    • On Youtube: encryptor256
Re: LOGFONT structure
« Reply #1 on: January 04, 2015, 03:39:38 PM »
Hi!

Maybe you have to define structure like this:

(windemos.inc, line 158)

Code: [Select]
NASMX_STRUC BITMAPINFOHEADER
    NASMX_RESERVE biSize, int32_t, 1
    NASMX_RESERVE biWidth, int32_t, 1
    NASMX_RESERVE biHeight, int32_t, 1
    NASMX_RESERVE biPlanes, short_t, 1
    NASMX_RESERVE biBitCount, short_t, 1
    NASMX_RESERVE biCompression, int32_t, 1
    NASMX_RESERVE biSizeImage, int32_t, 1
    NASMX_RESERVE biXPelsPerMeter, int32_t, 1
    NASMX_RESERVE biYPelsPerMeter, int32_t, 1
    NASMX_RESERVE biClrUsed, int32_t, 1
    NASMX_RESERVE biClrImportant, int32_t, 1
NASMX_ENDSTRUC

After that, use like this:

(demo6.inc, line 310)

Code: [Select]
NASMX_ISTRUC LCDBITMAPINFO, BITMAPINFOHEADER
      NASMX_AT biSize,            BITMAPINFOHEADER_size ; int32_t, 1
      NASMX_AT biWidth,           cdXSize               ; int32_t, 1
      NASMX_AT biHeight,          -1*cdYSize            ; int32_t, 1
      NASMX_AT biPlanes,          1                     ; short_t, 1
      NASMX_AT biBitCount,        32                    ; short_t, 1
      NASMX_AT biCompression,     0                     ; int32_t, 1
      NASMX_AT biSizeImage,       0                     ; int32_t, 1
      NASMX_AT biXPelsPerMeter,   0                     ; int32_t, 1
      NASMX_AT biYPelsPerMeter,   0                     ; int32_t, 1
      NASMX_AT biClrUsed,         0                     ; int32_t, 1
      NASMX_AT biClrImportant,    0                     ; int32_t, 1
    NASMX_IENDSTRUC
Encryptor256's Investigation \ Research Department.

Offline avcaballero

  • Full Member
  • **
  • Posts: 132
  • Country: es
    • Abre los Ojos al Ensamblador
Re: LOGFONT structure
« Reply #2 on: January 04, 2015, 04:06:22 PM »
Don't understand,  sorry. I want to use the LOGFONT structure, that I've already defined in windemos.Inc

Regards

Offline encryptor256

  • Full Member
  • **
  • Posts: 250
  • Country: lv
  • Win64 .
    • On Youtube: encryptor256
Re: LOGFONT structure
« Reply #3 on: January 04, 2015, 04:18:56 PM »
You forgot to define with 'I'.

Wrong, NASMX_STRUC:

Code: [Select]
;     NASMX_STRUC Arial_Black_10, LOGFONT
;         NASMX_AT lfHeight,         -13
;         NASMX_AT lfWidth,            0
;         NASMX_AT lfEscapement,       0
;         NASMX_AT lfOrientation,      0
;         NASMX_AT lfWeight,         400
;         NASMX_AT lfItalic,           0
;         NASMX_AT lfUnderline,        0
;         NASMX_AT lfStrikeOut,        0
;         NASMX_AT lfCharSet,          0
;         NASMX_AT lfOutPrecision,     3
;         NASMX_AT lfClipPrecision,    2
;         NASMX_AT lfQuality,          1
;         NASMX_AT lfPitchAndFamily,  34
;         NASMX_AT lfFaceName,        NASMX_TEXT("Arial Black")
;     NASMX_ENDSTRUC

Right, NASMX_ISTRUC:

Code: [Select]
     NASMX_ISTRUC Arial_Black_10, LOGFONT
        ...
        ... tra la la
        ...
     NASMX_IENDSTRUC
Encryptor256's Investigation \ Research Department.

Offline Rob Neff

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 429
  • Country: us
Re: LOGFONT structure
« Reply #4 on: January 04, 2015, 05:56:53 PM »
As Encryptor256 points out, you need to instantiate the logical font structure in your [section .data] with NASMX_ISTRUC ( note the "I" indicating Instantiate ).

Also, while you certainly can define the structure member variable lfFaceName as an int8_t in your windemos.inc file, you may prefer to use NASMX_TCHAR instead which will enable nasm to correctly assemble the source file whether UNICODE is defined or not.

Offline avcaballero

  • Full Member
  • **
  • Posts: 132
  • Country: es
    • Abre los Ojos al Ensamblador
Re: LOGFONT structure
« Reply #5 on: January 05, 2015, 08:12:35 AM »
Ah, thank you for your time and the info  :)

By the way, I did a copy paste of LOGFONT from windows.inc to windemos.inc

Regards
« Last Edit: January 05, 2015, 08:21:33 AM by avcaballero »