[ros-dev] ENUMFONTDATAW structure

Timo Kreuzer timo.kreuzer at web.de
Mon Aug 27 23:25:28 CEST 2007


I agree with the complete structure itself, but I have some issues with 
the way it is implemented atm.

1.) the member ulOffsetTM:
If it is an offset one would guess it would be an offset from the 
beginning of the struct, but it isn't. It's relative to dwFontType.
I would interpret it more as a cbSize member of an internal variable 
size struct., that comes before dwFlags (see below) / textmetric

2.) The current definition has a member enfdi, wich follows after a 
variable size struct. IMO this member should be removed, as it doesn't have
a constant offset. It implies that you can simply access it, but you 
cannot, if the designvektor has any entries. It should be commented out to
prevent misuse.

3.) The enfdi struct doesn't really make sense to me. The dwReserved 
members are not like axlReserved a constant. It looks more like some 
flags or it might be code page related. With this structure the OffsetTm 
member points to a substruct of a struct, that doesn't seem right to me.

So here is my version:
I also use INT versions of structs with a [0] array, so it matches the 
data, when no additional stuff is present
But as we always have to consider our structs as variable length we do 
not really need them. In any case we have to parse through the struct. 
We can then typecast the pointers to the original structs and all's well.

typedef struct _AXELISTINTW
{
    DWORD axlReserved;
    DWORD axlNumAxes;
    AXISINFOW axlAxesInfo[0];
} AXELISTINTW, *PAXELISTINTW;

typedef struct _ENUMTEXTMETRICINTW
{
    NEWTEXTMETRICEXW etmNewTextMetricEx;
    AXELISTINTW etmAxesList;
} ENUMTEXTMETRICINTW, *PENUMTEXTMETRICINTW;

typedef struct
{
    DWORD cbSize;
    DWORD dwFontType;
    ENUMLOGFONTEXW elfex;
    DESIGNVECTORINT dv;
// variable position, might be dv.dvValues[0], if DESIGNVECTORINT was 
declared with dvValues[1]
// I didn't yet manage to get info with dvNumAxes > 0
//    DWORD dwReserved;
} ENUMFONTDATAINTW, *PENUMFONTDATAINTW;

typedef struct _ENUMFONTDATAW
{
    DWORD cbSize;
    ENUMFONTDATAINTW efdi;
// Those are not real members as they don't have a constant pos in the 
struct
//    DWORD dwFlags;
//    ENUMTEXTMETRICINTW etmi;
} ENUMFONTDATAW, *PENUMFONTDATAW;




More information about the Ros-dev mailing list