flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > Lack of Unicode version of TEXTMETRIC structure.

Author
Thread Post new topic Reply to topic
MHajduk



Joined: 30 Mar 2006
Posts: 6115
Location: Poland
MHajduk 13 Oct 2007, 11:49
I think, that file 'INCLUDE\EQUATES\GDI32.INC' (FASM 1.67.23) should have two definitions (for ANSI and Unicode) of structure 'TEXTMETRIC' (as it is for example in 'wingdi.h' from Dev-C++ package), because using existing (ANSI) definition of 'TEXTMETRIC' causes an error in 'GetTextMetricsW' procedure.

Simple explanation of this:
  • 'GetTextMetricsW' expects a pointer to 57-byte variant of 'TEXTMETRIC',
  • 'GetTextMetricsA' expects a pointer to 53-byte variant of 'TEXTMETRIC'.
I propose to add presented below definition of 'TEXTMETRICW' structure to 'INCLUDE\EQUATES\GDI32.INC':
Code:
struct       TEXTMETRICW 
        tmHeight                dd ?
        tmAscent                dd ?
        tmDescent               dd ?
        tmInternalLeading       dd ?
        tmExternalLeading       dd ?
        tmAveCharWidth          dd ?
        tmMaxCharWidth          dd ?
        tmWeight                dd ?
        tmOverhang              dd ?
        tmDigitizedAspectX      dd ?
        tmDigitizedAspectY      dd ?
        tmFirstChar             dw ?
        tmLastChar              dw ?
        tmDefaultChar           dw ?
        tmBreakChar             dw ?
        tmItalic                db ?
        tmUnderlined            db ?
        tmStruckOut             db ?
        tmPitchAndFamily        db ?
        tmCharSet               db ?
ends    
Existing definition (ANSI version) of 'TEXTMETRIC' structure from 'INCLUDE\EQUATES\GDI32.INC':
Code:
struct TEXTMETRIC
  tmHeight           dd ?
  tmAscent           dd ?
  tmDescent          dd ?
  tmInternalLeading  dd ?
  tmExternalLeading  dd ?
  tmAveCharWidth     dd ?
  tmMaxCharWidth     dd ?
  tmWeight           dd ?
  tmOverhang         dd ?
  tmDigitizedAspectX dd ?
  tmDigitizedAspectY dd ?
  tmFirstChar        db ?
  tmLastChar         db ?
  tmDefaultChar      db ?
  tmBreakChar        db ?
  tmItalic           db ?
  tmUnderlined       db ?
  tmStruckOut        db ?
  tmPitchAndFamily   db ?
  tmCharSet          db ?
ends    
Definitions of 'TEXTMETRIC' variants in 'wingdi.h':
Code:
typedef struct tagTEXTMETRICA {
      LONG tmHeight;
      LONG tmAscent;
      LONG tmDescent;
     LONG tmInternalLeading;
     LONG tmExternalLeading;
     LONG tmAveCharWidth;
        LONG tmMaxCharWidth;
        LONG tmWeight;
      LONG tmOverhang;
    LONG tmDigitizedAspectX;
    LONG tmDigitizedAspectY;
    BYTE tmFirstChar;
   BYTE tmLastChar;
    BYTE tmDefaultChar;
 BYTE tmBreakChar;
   BYTE tmItalic;
      BYTE tmUnderlined;
  BYTE tmStruckOut;
   BYTE tmPitchAndFamily;
      BYTE tmCharSet;
} TEXTMETRICA,*PTEXTMETRICA,*LPTEXTMETRICA;

typedef struct tagTEXTMETRICW {
     LONG tmHeight;
      LONG tmAscent;
      LONG tmDescent;
     LONG tmInternalLeading;
     LONG tmExternalLeading;
     LONG tmAveCharWidth;
        LONG tmMaxCharWidth;
        LONG tmWeight;
      LONG tmOverhang;
    LONG tmDigitizedAspectX;
    LONG tmDigitizedAspectY;
    WCHAR tmFirstChar;
  WCHAR tmLastChar;
   WCHAR tmDefaultChar;
        WCHAR tmBreakChar;
  BYTE tmItalic;
      BYTE tmUnderlined;
  BYTE tmStruckOut;
   BYTE tmPitchAndFamily;
      BYTE tmCharSet;
} TEXTMETRICW,*PTEXTMETRICW,*LPTEXTMETRICW;    
Post 13 Oct 2007, 11:49
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.