Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert change in fixed width condition #46

Merged
merged 1 commit into from Apr 28, 2021
Merged

Conversation

maykon-t
Copy link
Contributor

This reverts a change in commit:
da8902d
Made on 29 May 2020

Pull request synopse/mORMot#296 changed this line but at least for me it's returning exact the opposite it should, which leads to characters overlapping when using "MS Sans Serif" font.

Tested with "MS Sans Serif" and "Courier New" fonts before my modification, first was evaluated as fixed width (condition returns true) and second as proportional (condition returns false). Should be inverted results.

This reverts a change in commit:
da8902d
Made on 29 May 2020
@synopse synopse merged commit 52e6f7d into synopse:master Apr 28, 2021
@synopse
Copy link
Owner

synopse commented Apr 28, 2021

sorry but it is very difficult to follow the pull requests on SynPdf - almost every time someone supply a patch, it somewhat works in his/her context, but it breaks something for other users

synopse pushed a commit to synopse/mORMot that referenced this pull request Apr 28, 2021
@maykon-t
Copy link
Contributor Author

Thank you very much for the prompt reply.

@tim-lebedkov
Copy link

Here is the code I used to test this.

The output was:
MS Sans Serif 2
Microsoft Sans Serif 2
Courier New 1
Courier 1

This means that "(ALogFont.lfPitchAndFamily and 3) = FIXED_PITCH" would evaluate for the parameter AIsFixedWidth to

MS Sans Serif 2 => False
Microsoft Sans Serif 2 => False
Courier New 1 => True
Courier 1 => True

This is correct.

@maykon-t can you test on your computer?

// JCL_DEBUG_EXPERT_GENERATEJDBG OFF
program TestFonts;

{$APPTYPE CONSOLE}

{$R *.res}

uses
    System.SysUtils, Windows;

function EnumFontsProc(var LogFont: TLogFont; var TextMetric: TTextMetric;
    FontType: Integer; Data: Pointer): Integer; stdcall;
begin
    WriteLn(string(LogFont.lfFaceName), ' ', LogFont.lfPitchAndFamily and 3);

    Result := 1;
end;

var
    DC: HDC;
    F: LOGFONTW;
begin
    DC := GetDC(0);
    try
        FillChar(F, sizeof(F), 0);
        F.lfCharset := DEFAULT_CHARSET;
        EnumFontFamiliesEx(DC, F, @EnumFontsProc, 0, 0);
    finally
        ReleaseDC(0, DC);
    end;
    ReadLn;
end.

@tim-lebedkov
Copy link

Hellooooooooo! Any news here?

@tim-lebedkov
Copy link

I created an issue for this: #52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants