Skip to content

Wrong type of some struct fields (e.g. LOGFONTA.lfOutPrecision) #46

@shimamura-sakura

Description

@shimamura-sakura

commit: current main (ec98bb4)

pub const LOGFONTA = extern struct {
    lfHeight: i32,
    lfWidth: i32,
    lfEscapement: i32,
    lfOrientation: i32,
    lfWeight: FONT_WEIGHT,
    lfItalic: u8,
    lfUnderline: u8,
    lfStrikeOut: u8,
    lfCharSet: u8,
    lfOutPrecision: FONT_OUTPUT_PRECISION, // <--
    lfClipPrecision: FONT_CLIP_PRECISION, // <--
    lfQuality: FONT_QUALITY, // <--
    lfPitchAndFamily: FONT_PITCH_AND_FAMILY, // <--
    lfFaceName: [32]CHAR,
};

According to MSDN, lfOutPrecision is a BYTE (u8).
However, it seems that FONT_OUTPUT_PRECISION is defined as a u32 enum.

pub const FONT_OUTPUT_PRECISION = enum(u32) {
    CHARACTER_PRECIS = 2,
    DEFAULT_PRECIS = 0,
    DEVICE_PRECIS = 5,
    OUTLINE_PRECIS = 8,
    PS_ONLY_PRECIS = 10,
    RASTER_PRECIS = 6,
    STRING_PRECIS = 1,
    STROKE_PRECIS = 3,
    TT_ONLY_PRECIS = 7,
    TT_PRECIS = 4,
};

lfClipPrecision, lfQuality, lfPitchAndFamily should also be a BYTE (u8).
In LOGFONTW, lfCharset: FONT_CHARSET too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions