dimanche 21 juin 2020

SetCurrentConsoleFontEx() doesn't work with custom installed fonts

I have a custom font installed on my environment (Pixel Operator Mono) and I'm developing some console application which needs this font. This is my function:

void set_font() {
    CONSOLE_FONT_INFOEX cfi;
    cfi.cbSize = sizeof(cfi);
    cfi.nFont = 0;
    cfi.dwFontSize.X = 0;
    cfi.dwFontSize.Y = 27;
    cfi.FontFamily = FF_DONTCARE;
    cfi.FontWeight = FW_NORMAL;
    std::wcscpy(cfi.FaceName, L"Pixel Operator Mono");
    SetCurrentConsoleFontEx(GetStdHandle(STD_OUTPUT_HANDLE), FALSE, &cfi);
}

Using "Consolas", "Courier New" or even "MS Gothic" seems to work fine. But "Pixel Operator Mono" doesn't. This font is displayed on my CMD properties and I can even set as default font. But why exactly I can't change this way? I already checked and SetCurrentConsoleFontEx is returning success.

Aucun commentaire:

Enregistrer un commentaire