Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2020-08

Lazarus IDE text display

10 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Colin Western

Working on High Sierra Lazarus compiled for Cocoa shows odd character spacing for program text - each character looks about twice the width it should be. If I compile Lazarus for carbon it looks fine, and text spacing in my apps looks OK, so I suspect a SynEdit related issue. I though I had seen some earlier comments with a similar issues but I can't now find these. Any suggestons?

Colin

Reply by email

Martin Frb
to Colin Western
Colin Western wrote
Working on High Sierra Lazarus compiled for Cocoa shows odd character spacing for program text - each character looks about twice the width it should be. If I compile Lazarus for carbon it looks fine, and text spacing in my apps looks OK, so I suspect a SynEdit related issue. I though I had seen some earlier comments with a similar issues but I can't now find these. Any suggestons?

This usually happens, if your font is not monospaced.

SynEdit will force the chars into the grid (that would be for monospaced). To do so, SynEdit looks for the widest char in the font (by looking at specific samples, like XMW@): "@" is often the widest.

You can use a negative "extra char spacing" (tools > options) to compensate. But then the wider chars will overlap.

If the font is monospaced, then something is probably wrong with the LCL measuring....

Reply by email

Alexey Tor.
to Martin Frb
Martin Frb wrote
To do so, SynEdit looks for the widest char in the font (by looking at specific samples, like XMW@): "@" is often the widest.

ATSynEdit takes with of 'grid' as widht of 'N' (before it was 'M', it gave too big size for non monospaced fonts, 'N' is better).

Regards, Alexey

Reply by email

Colin Western
to Alexey Tor.
"Alexey Tor. wrote 7 lines
On 16.08.2020 14:57, Martin Frb via lazarus wrote: > To do so, SynEdit looks for the widest char in the font (by looking at > specific samples, like XMW@): "@" is often the widest. ATSynEdit takes with of 'grid' as widht of 'N' (before it was 'M', it gave too big size for non monospaced fonts, 'N' is better

I have the font set as "default", which had always worked fine before. I will try some different fonts.

Colin

Reply by email

Martin Frb
to Alexey Tor.: ATSynEdit takes with of 'grid' as widht of 'N' (before it was 'M', it gave too big size…
Alexey Tor. wrote 7 lines
On 16.08.2020 14:57, Martin Frb via lazarus wrote: > To do so, SynEdit looks for the widest char in the font (by looking > at specific samples, like XMW@): "@" is often the widest. ATSynEdit takes with of 'grid' as widht of 'N' (before it was 'M', it gave too big size for non monospaced fonts, 'N' is better).

And how does a this text look?
MMM@@@WWW

Reply by email

C Western
to Alexey Tor.
Alexey Tor. wrote 7 lines
On 16.08.2020 19:24, Martin Frb via lazarus wrote: > And how does a this text look? > MMM@@@WWW In Pascal syntax, it is 3 tokens; all 3 tokens are clipped on right side (with non monospaced font).

Doing some more tests (with Cocoa) with different fonts:

with "default" as the font - the result looks odd. I thought this was supposed to work for all platforms, but looking at my Linux (gtk2) setup this also looks odd if "default" is used. Testing with MMM@@@WWW this seems to be an issue with the specific font chosen.

with "Menlo" as the font it looks fine

with "Monaco" as the font the spacing is OK, but bold face is lost.

Ideally "default" for the IDE font would give a sensible monospace font for each platform, but this may be more trouble than is is worth.

Colin

Reply by email

Alexey
to C Western
Ideally "default" for the IDE font would give a sensible monospace font for each platform

No, “default” is def variable width font.
But yes, we need new alias for default mono font, eg “def_mono”. And I will use it, and IDE should use it.

Courier isn’t installed on all OS. Courier New too. For new alias, LCL must detect it... Maybe there isn’t such api in main OSes?

Alexey

Reply by email

Martin Frb
to Alexey
Alexey wrote 7 lines
> Ideally "default" for the IDE font would give a sensible monospace font for each platform No, “default” is def variable width font. But yes, we need new alias for default mono font, eg “def_mono”. And I will use it, and IDE should use it. Courier isn’t installed on all OS. Courier New too. For new alias, LCL must detect it... Maybe there isn’t such api in main OSes?

I dont know if this is still used (from unit synedit) But it does not have cocoa

procedure InitSynDefaultFont;
begin
   if SynDefaultFontName  '' then exit;
   Screen.Fonts;
   {$UNDEF SynDefaultFont}
   {$IFDEF LCLgtk}
     SynDefaultFontName   :=
'-adobe-courier-medium-r-normal-*-*-140-*-*-*-*-iso10646-1';
     SynDefaultFontHeight := 14;
     {$DEFINE SynDefaultFont}
   {$ENDIF}
   {$IFDEF LCLcarbon}
     SynDefaultFontName   := 'Monaco'; // Note: carbon is case sensitive
     SynDefaultFontHeight := 12;
     {$DEFINE SynDefaultFont}
   {$ENDIF}
   // LCLgtk2 and LCLQt use default settings
   {$IFnDEF SynDefaultFont}
     SynDefaultFontName   := 'Courier New';
     SynDefaultFontHeight := -13;
   {$ENDIF}
   if Screen.Fonts.IndexOf(SynDefaultFontName) >= 0 then
     exit;
   if Screen.Fonts.IndexOf('DejaVu Sans Mono') >= 0 then begin
     SynDefaultFontName   := 'DejaVu Sans Mono';
     SynDefaultFontHeight := 13;
   end;
end;

Reply by email

Mattias Gaertner
to Martin Frb
Show quoted text 13 lines
On 16/08/2020 23:19, Alexey via lazarus wrote: > > Ideally "default" for the IDE font would give a sensible > > monospace font for each platform > > No, “default” is def variable width font. > But yes, we need new alias for default mono font, eg “def_mono”. > And I will use it, and IDE should use it. > > Courier isn’t installed on all OS. Courier New too. For new alias, > LCL must detect it... Maybe there isn’t such api in main OSes? I dont know if this is still used (from unit synedit) But it does not have cocoa

Cocoa works with Courier New.

I personally use Andale Mono under Cocoa.

Mattias

Show quoted text 29 lines
procedure InitSynDefaultFont; begin   if SynDefaultFontName '' then exit;   Screen.Fonts;   {$UNDEF SynDefaultFont}   {$IFDEF LCLgtk}     SynDefaultFontName   := '-adobe-courier-medium-r-normal-*-*-140-*-*-*-*-iso10646-1';     SynDefaultFontHeight := 14;     {$DEFINE SynDefaultFont}   {$ENDIF}   {$IFDEF LCLcarbon}     SynDefaultFontName   := 'Monaco'; // Note: carbon is case sensitive SynDefaultFontHeight := 12;     {$DEFINE SynDefaultFont}   {$ENDIF}   // LCLgtk2 and LCLQt use default settings   {$IFnDEF SynDefaultFont}     SynDefaultFontName   := 'Courier New';     SynDefaultFontHeight := -13;   {$ENDIF}   if Screen.Fonts.IndexOf(SynDefaultFontName) >= 0 then     exit;   if Screen.Fonts.IndexOf('DejaVu Sans Mono') >= 0 then begin     SynDefaultFontName   := 'DejaVu Sans Mono';     SynDefaultFontHeight := 13;   end; end;

Reply by email