View Issue Details

IDProjectCategoryView StatusLast Update
0019934LazarusIDEpublic2018-07-17 00:04
Reportercobines Assigned ToJuha Manninen  
Status resolvedResolutionduplicate 
PlatformWin32OSWindows XP 
Product Version0.9.31 (SVN) 
Summary0019934: Editor font dialog should show only fixed pitch (monospace) fonts
DescriptionCurrently when changing editor font it shows all fonts. But I searched and found information and confirmed myself on Windows and Linux that SynEdit in Lazarus only supports fixed fonts, so it's logical the font choose dialog could show only fixed fonts.

I attach a patch that adds [fdFixedPitchOnly] option to the dialog.
TagsNo tags attached.
Fixed in Revision
Attached Files


duplicate of 0015292 acknowledged Feature-Req: optional monospace font filter for source editor [Some fonts showup as double spaced characters in source editor] 
related to 0014357 closedMartin Friebe Buggy font size selection in Environment Options / Editor / Display 


2011-08-08 17:58


editor_monospace_font.diff (647 bytes)   
Index: ide/frames/editor_display_options.pas
--- ide/frames/editor_display_options.pas	(revision 31909)
+++ ide/frames/editor_display_options.pas	(working copy)
@@ -118,7 +118,7 @@
       NewHeight := StrToIntDef(EditorFontHeightComboBox.Text, DisplayPreview.Font.Height);
       Font.Height := NewHeight;
-      Options := Options + [fdApplyButton];
+      Options := Options + [fdApplyButton, fdFixedPitchOnly];
       OnApplyClicked := @FontDialogApplyClicked;
       if Execute then
editor_monospace_font.diff (647 bytes)   

Juha Manninen

2011-09-15 15:30

developer   ~0051862

The default font setting here is:
 -misc-dejavu sans mono-medium-r-normal-*-*-90-*-*-*-*-iso10646-1

There is no way to select such string from anywhere. If I test different fonts and then select Sans again, it looks very different.
How is the selection supposed to work?


2011-09-16 18:06

reporter   ~0051919

You can simply enter the font string in the combo box and remove focus to apply. But the format you've written includes size and style. I don't think that is taken into account, I think only name is taken. For example if I write:

-misc-dejavu sans mono-bold-r-normal-*-*-90-*-*-*-*-iso10646-1

the font does not become bold. If I write:

-misc-dejavu sans mono-medium-r-normal-*-*-140-*-*-*-*-iso10646-1

the font does not become larger.

Size and style is I think set separately.

And if I replace that string with Dejavu Sans Mono it looks exactly the same to me.

Zeljan Rikalo

2011-09-16 20:40

developer   ~0051923

1. I think that Gtk2 font handling should be changed in this case, there's no need to use XOrg constructs for font naming (look what qt does).Such naming is
not needed when system uses fontconfig.
2. Under qt font dialog cannot be setted to show monospace fonts only, so that patch won't work

2011-09-17 11:10


editor_sans.png (65,548 bytes)   
editor_sans.png (65,548 bytes)   

Juha Manninen

2011-09-17 11:24

developer   ~0051941

cobines, I did not write that font string myself. It is there by default with Linux + GTK2.
Changing medium to bold does not affect but the size setting does. With "140" the font becomes bigger but then the size selection box has no effect.

If I select only "Sans" using the GUI, the font looks like in my screenshot "editor_sans.png". It is not usable.
It means the whole settings page is quite useless on Linux + GTK2. On Windows it seems to work OK.


2011-09-17 16:09

reporter   ~0051947

I was checking it on Linux QT4 and changing to 140 does not have effect. On GTK2 it does have effect but for me size selection box works fine.

The font dialog on GTK2 also does not support displaying only monospace fonts.
On Windows it does support it.

If you select Sans then this is non-monospace font and SynEdit doesn't show it properly. You need to use monospace fonts like "Dejavu Sans Mono". That's why the patch to not show fonts that don't work. But seems I tested it only on Windows.

Zeljan Rikalo

2011-09-17 19:47

developer   ~0051955

So, we should create specialized font dialog for ide and use EnumerateFontsEx to get list of fonts we want, or fix bug for win32 and add that property enum to exceptions of gtk2,qt and carbon widgetsets.


2011-09-18 00:04

reporter   ~0051968

Maybe the font dialog could be removed completely?

If I select any styles they are not applied. If I select color (at least on Windows it is possible) it is applied to preview window but not to main SynEdit editors. From what I see the dialog is only used to select font name and size.

Instead, we could put all the supported fonts names into the combo box and let user choose font name from the combo and font size from the spinedit. There already is a preview window which is much better than the one in the font dialog anyway.

Zeljan Rikalo

2014-09-27 20:39

developer   ~0077756

Maybe ownerdrawn combobox is good solution here (name of font drawn with that font), also monospaced fonts are choosed from the result of EnumerateFontsEx.

CudaText man

2017-03-12 09:41

reporter   ~0098829

Is the FontDialog or combobox, can show only monospaced fonts? on all OSes. Seems no.
Need to compare size (TCanvas.Textwidth) for all chars?

So pls close. "cannot fix".

Juha Manninen

2017-03-12 10:10

developer   ~0098833

Maybe a selection option for monospace fonts could be implemented on platforms that support it.
Anyway, I resolve this issue as duplicate.

Issue History

Date Modified Username Field Change
2011-08-08 17:58 cobines New Issue
2011-08-08 17:58 cobines File Added: editor_monospace_font.diff
2011-08-08 19:13 Martin Friebe Relationship added related to 0014357
2011-09-11 23:37 Martin Friebe Relationship added duplicate of 0015292
2011-09-15 15:30 Juha Manninen Note Added: 0051862
2011-09-16 18:06 cobines Note Added: 0051919
2011-09-16 20:40 Zeljan Rikalo Note Added: 0051923
2011-09-17 11:10 Juha Manninen File Added: editor_sans.png
2011-09-17 11:24 Juha Manninen Note Added: 0051941
2011-09-17 16:09 cobines Note Added: 0051947
2011-09-17 19:47 Zeljan Rikalo Note Added: 0051955
2011-09-18 00:04 cobines Note Added: 0051968
2011-10-07 15:04 Vincent Snijders LazTarget => -
2011-10-07 15:04 Vincent Snijders Status new => acknowledged
2014-09-27 20:39 Zeljan Rikalo Note Added: 0077756
2017-03-12 09:41 CudaText man Note Added: 0098829
2017-03-12 10:10 Juha Manninen Note Added: 0098833
2017-03-12 10:10 Juha Manninen Status acknowledged => resolved
2017-03-12 10:10 Juha Manninen Resolution open => fixed
2017-03-12 10:10 Juha Manninen Assigned To => Juha Manninen
2017-03-12 10:14 Juha Manninen Resolution fixed => duplicate