News:

Download Pelles C here: http://www.pellesc.se

Main Menu

Recent posts

#11
Bug reports / Re: Some fonts are missing fro...
Last post by Pelle - April 19, 2026, 09:36:31 PM
Quote from: ander_cc on April 14, 2026, 08:58:13 AMLike "Cascadia Mono", I can't see it in font name list. But can set in theme file.
Btw: When I was translating rc file, I noticed line 3409 had still read "version 13.00".
The version is in many places, this place is less important. I will fix this some day.

To get some progress here, could you please compile and run the following program. If you see fonts in the output that you want, but don't see in the IDE, please post the following info:

1) The 6 lines following "#1: LOCALE FONT SIGNATURE"
2) The 3-9 lines from "#2: LIST OF FONTS" for the missing font(s).

#define WIN32_LEAN_AND_MEAN
#define UNICODE
#include <windows.h>
#include <stdio.h>

#pragma comment(lib, "user32.lib")
#pragma comment(lib, "gdi32.lib")

#define DWFMT  "%#010lx"

static wchar_t *CharSetName(BYTE bCharSet)
{
#define CASE(x) case x: return L"" # x
    switch (bCharSet)
    {
        CASE(ANSI_CHARSET);
        CASE(ARABIC_CHARSET);
        CASE(BALTIC_CHARSET);
        CASE(CHINESEBIG5_CHARSET);
        CASE(DEFAULT_CHARSET);
        CASE(EASTEUROPE_CHARSET);
        CASE(GB2312_CHARSET);
        CASE(GREEK_CHARSET);
        CASE(HANGEUL_CHARSET);
        CASE(HEBREW_CHARSET);
        CASE(JOHAB_CHARSET);
        CASE(MAC_CHARSET);
        CASE(OEM_CHARSET);
        CASE(RUSSIAN_CHARSET);
        CASE(SHIFTJIS_CHARSET);
        CASE(SYMBOL_CHARSET);
        CASE(THAI_CHARSET);
        CASE(TURKISH_CHARSET);
        CASE(VIETNAMESE_CHARSET);
        default: return L"?";
    }
#undef CASE
}

static wchar_t *FontTypeName(DWORD dwFontType)
{
#define CASE(x) case x: return L"" # x
    switch (dwFontType)
    {
        CASE(DEVICE_FONTTYPE);
        CASE(RASTER_FONTTYPE);
        CASE(TRUETYPE_FONTTYPE);
        case 0: return L"0";
        default: return L"?";
    }
#undef CASE
}

static int CALLBACK EnumFontFaceProc(const ENUMLOGFONTEX *pelf,
    const NEWTEXTMETRICEX *pntm, DWORD dwFontType, LPARAM lParam)
{
    LOCALESIGNATURE *pls = (void *)lParam;

    printf("  ------------------------------\n");

    printf("  lfFaceName: \"%ls\"\n", pelf->elfLogFont.lfFaceName);
    printf("  dwFontType: %ls\n", FontTypeName(dwFontType));
    printf("  lfCharSet: %ls\n", CharSetName(pelf->elfLogFont.lfCharSet));

    if ((dwFontType & TRUETYPE_FONTTYPE) != 0)
    {
        printf("  ntmFontSig.fsUsb[0]: " DWFMT " (mask locale => " DWFMT ")\n",
             pntm->ntmFontSig.fsUsb[0],
            (pntm->ntmFontSig.fsUsb[0] & pls->lsUsb[0]));

        printf("  ntmFontSig.fsUsb[1]: " DWFMT " (mask locale => " DWFMT ")\n",
             pntm->ntmFontSig.fsUsb[1],
            (pntm->ntmFontSig.fsUsb[1] & pls->lsUsb[1]));

        printf("  ntmFontSig.fsUsb[2]: " DWFMT " (mask locale => " DWFMT ")\n",
             pntm->ntmFontSig.fsUsb[2],
            (pntm->ntmFontSig.fsUsb[2] & pls->lsUsb[2]));

        printf("  ntmFontSig.fsUsb[3]: " DWFMT " (mask locale => " DWFMT ")\n",
             pntm->ntmFontSig.fsUsb[3],
            (pntm->ntmFontSig.fsUsb[3] & pls->lsUsb[3]));


        printf("  ntmFontSig.fsCsb[0]: " DWFMT " (mask locale => " DWFMT ")\n",
             pntm->ntmFontSig.fsCsb[0],
            (pntm->ntmFontSig.fsCsb[0] & pls->lsCsbSupported[0]));

        printf("  ntmFontSig.fsCsb[1]: " DWFMT " (mask locale => " DWFMT ")\n",
             pntm->ntmFontSig.fsCsb[1],
            (pntm->ntmFontSig.fsCsb[1] & pls->lsCsbSupported[1]));
    }

    return 1;
}

int main(void)
{
    HDC hdc = GetDC(NULL);
    if (hdc != NULL)
    {
        LOCALESIGNATURE ls;

        if (!GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_FONTSIGNATURE,
            (WCHAR *)&ls, sizeof(ls) / sizeof(WCHAR)))
            return 1;

        printf("#1: LOCALE FONT SIGNATURE:\n");
        printf("  ls.lsUsb[0]: " DWFMT "\n", ls.lsUsb[0]);
        printf("  ls.lsUsb[1]: " DWFMT "\n", ls.lsUsb[1]);
        printf("  ls.lsUsb[2]: " DWFMT "\n", ls.lsUsb[2]);
        printf("  ls.lsUsb[3]: " DWFMT "\n", ls.lsUsb[3]);
        printf("  ls.lsCsbSupported[0]: " DWFMT "\n", ls.lsCsbSupported[0]);
        printf("  ls.lsCsbSupported[1]: " DWFMT "\n", ls.lsCsbSupported[1]);

        printf("\n#2: LIST OF FONTS:\n");
        LOGFONT lf = {
            .lfCharSet = DEFAULT_CHARSET,
            .lfFaceName[0] = L'\0',
            .lfPitchAndFamily = 0,
        };
        EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC)EnumFontFaceProc, (LPARAM)&ls, 0);

        ReleaseDC(NULL, hdc);
        return 0;
    }
    return 1;
}
#12
General discussion / Re: Pelles C and Windows Defen...
Last post by TimoVJL - April 19, 2026, 02:47:22 PM
Windows Defender don't have problems with Pelles C tools.
#13
General discussion / Re: Pelles C and Windows Defen...
Last post by Pelle - April 18, 2026, 06:04:49 PM
Quote from: italofutura on April 14, 2026, 08:22:10 AMIs it because Pelles C binaries are not signed? If yes, why?
Probably. Last time I checked the price for a certificate to be trusted was for a company wallet, not a personal one.
#14
Bug reports / Re: Some fonts are missing fro...
Last post by Pelle - April 18, 2026, 05:58:35 PM
I am deliberately filtering the fonts list. At least last time I checked, several years ago, not doing this filtering gave me many fonts I couldn't use.
I will have to think about this (when I can find the time)...
#15
Bug reports / Re: Maybe a optimization bug.
Last post by Pelle - April 18, 2026, 05:52:29 PM
Quote from: John Z on April 14, 2026, 04:43:36 PMBut seriously yes there have been, and are issues, with using the optimizations and extensive testing is always needed for these.  I have many programs using optimizations successfully.
I my experience, enabling the optimizer on poorly written C code is more of a problem than the optimizer itself.
#16
Bug reports / Re: Maybe a optimization bug.
Last post by Pelle - April 18, 2026, 05:48:32 PM
A sanity check is missing in the loop idiom optimizer: triangular numbers. This affects all targets. We'll see when I can fix this...

/* The triangular numbers are given by the following formula:
 * Tn = 1 + 2 + 3 + .. + n = (n * (n + 1)) / 2
 */
#17
Bug reports / Re: Maybe a optimization bug.
Last post by Vortex - April 16, 2026, 09:13:41 PM
Disassembling the 32-bit MS COFF object module, building the project as 32-bit console application :

_text   SEGMENT PARA PUBLIC 'CODE'

_main   PROC NEAR
        push    eax
        push    offset @152
        call    _printf                               
        add     esp, 8     
        push    5050                                   
        push    offset @154                           
        call    _printf                               
        add     esp, 8                                 
        xor     eax, eax                               
        ret                                           
_main   ENDP

.rdata  SEGMENT DWORD PUBLIC 'CONST'               

@154    label byte
        db 73H, 75H, 6DH, 3DH, 25H, 64H, 0AH, 00H       ; 0000 _ sum=%d..

@152    label byte
        db 69H, 3DH, 25H, 64H, 0AH, 00H                 ; 0008 _ i=%d..

.rdata  ENDS
#18
Bug reports / Re: Maybe a optimization bug.
Last post by TimoVJL - April 16, 2026, 06:04:07 PM
It might be a cdecl problem, so 32-bit programs can use stdcall to avoid it.
#19
Bug reports / Re: Maybe a optimization bug.
Last post by Vortex - April 15, 2026, 10:00:46 PM
The trick i=i-(-1); seems to solve the issue :

#include <stdio.h>

int main(void)
{
int i=1, sum=0;
while (i<=100)
{
sum=sum+i;
//i++;
i=i-(-1);
}
printf("i=%d\n",i);
printf("sum=%d\n",sum);
return 0;
}
#20
Bug reports / Re: Maybe a optimization bug.
Last post by John Z - April 15, 2026, 01:57:27 PM
Quote from: Vortex on April 15, 2026, 10:35:59 AMBy the way, uncommenting the line below will output the correct result :

Very typical in my experience for the optimization failures.  Sometimes even just a 1 byte change can make it work, or make it fail.

John Z