kq-fork icon indicating copy to clipboard operation
kq-fork copied to clipboard

Fonts: Colors and dimensions

Open OnlineCop opened this issue 2 years ago • 4 comments

We should have a class/struct for fonts and either blend or remove one/both of the eFont/eFontColor enums. If we have a std::map or std::vector of fonts, the enum values could still be used to indicate which font we're after.

enum eFont
{
    FONT_WHITE = 0,
    FONT_RED = 1,
    FONT_YELLOW = 2,
    FONT_GREEN = 3,
    FONT_PURPLE = 4,
    FONT_DECIDE = 5,

    NUM_FONTS // always last
};
enum eFontColor
{
    FNORMAL = 0,
    FRED = 1,
    FYELLOW = 2,
    FGREEN = 3,
    FDARK = 4,
    FGOLD = 5,
    FBIG = 6,

    NUM_FONT_COLORS // always last
};

The struct should include the font dimensions (height, width) since these are monospaced fonts, and possibly color (or at least an index value within pal[] if we're wanting to recolor them).

KDraw::print_font() typically multiplies the font width by some offset, and I'd like to replace those Magic Number multiplications (* 8 ) with * font.width() or something similar.

This should also make it easier to extend the fonts in the future, in support of localization in case the current fonts.png doesn't contain all the necessary characters.

OnlineCop avatar Jul 25 '22 14:07 OnlineCop