Skip to content

FONT_ShowAllTTFs.c - problems with data passed to GUI_TTF_CreateFont #3

@jchinnick-nuvation

Description

@jchinnick-nuvation

The call to GUI_TTF_CreateFont requires the GUI_TTF_CS structure to remain in scope during the use of the TrueTypeFont after the call to this function. Further more the library is expecting that if the same font is used with multiple sizes, then the pTTF member of this structure should remain the same for each invocation of the GUI_TTF_CreateFont to take advantage of this in the caching mechanism.

In the function _CreateFonts the structure member pTTF for each instance of the font being created is being initialized with the address of TTF_Data which is located on the stack. This will go out of scope on return out of the _CreateFonts function, but it will be referenced in the future potentially leading to much badness. The TTF_Data structure should be at the same scope or longer life than the GUI_TTF_CS structure that is referencing it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions