Jump to content
Sign in to follow this  
amit

When will IDE Editor support more fonts?

Recommended Posts

Delphi IDE editor is used for a long time but it will not support well in my Language.    I need to know if it will have any chance to improve the IDE Editor to support more fonts.   As you can see in the attach picture compare between VS Editor and Delphi IDE Editor.      Is there any trick to make delphi IDE work with other fonts than it provided?

EditorCmp.png

Edited by amit

Share this post


Link to post
Guest

Editor font

Select a font type from the available screen fonts installed on your system (shown in the list). The Code Editor displays and uses only monospaced screen fonts, such as Courier. Sample text is displayed in the Sample box.

 

For this answer, only Embarcadero can say it!

  • Fonts are fixed width, like:
    • Courier New (default)
    • Consolas
    • Lucida Console

if your language is Thai, try this site for download some fonts to install in MSWindows and try it!

https://www.fonts.com/search/all-fonts?searchtext=thai&submit=Search

https://www.myfonts.com/search/thai

Share this post


Link to post

I downloaded monotype fonts and install them in windows however I never see those fonts in the selection list of the Editor Fonts.

Share this post


Link to post

Any Monotype fonts install in Windows will not be existed in the Selection list of the Editor in Delphi.    It shown only the Original list of Delphi provided.   By the way, monotype font should not be the final solution to solve this problem because it still display incorrectly.  If Delphi change the Editor to use the non monotype font it should be display correctly as shown in the VS Code Editor.    I wish Embarcadero will change change it soon.    

Edited by amit

Share this post


Link to post

Most of these fonts presented in the Options | UI | Editor | Display list of my Delphi, are not installed with Delphi, nor are they installed with Windows.
Their common trait is that they are monospaced - which also is the default for VS Code, btw.
 

Searching for monospaced and Thai, this shows up - and it is monospaced, has Thai characters, but doesn't appear to support Unicode Thai - so I am unsure if it will work as desired.
https://www.dafont.com/pw-thai-monospaced-.font
 

Edit 1: I also found https://bwaiwai.blogspot.com/2013/06/DejaVuSansMonoThai.html - but couldn't find a free download to check its Unicode coverage.

 

Edit 2: The last comment on this page, suggests some other alternatives as well.

https://forum.portswigger.net/thread/thai-characters-not-displayed-correctly-in-the-burp-suite-f39cb4ff

 

My list of Delphi available fonts.

image.png.aec962e44e3d8be54d6a2c75e100a48e.png

image.png.3656e3f5dc609552da2b32272da5a169.png

image.png.377db70fdc5eeddf5699d03a472be6ad.png

image.png.b47e72710ff27272670d615bc42c6d9c.png

image.png.88fc867ba34ebd319870c19d3ca6bd38.png

 

 

Share this post


Link to post

Thank you all for trying to help.   I finally found that the monotype or monospace font that use in Delphi editor is not suitable for displaying Thai Language.  Even it can display Thai but it display incorrectly.   Delphi Editor should be upgrade to make it capable to use non monotype or monospace font.     You can see the picture that how it display Thai incorrectly compare to the correct one.   I hope one day Embarcadero will make a better editor to display Thai language correctly soon.

DelphiEditor.PNG

Share this post


Link to post
On 1/24/2021 at 6:07 AM, amit said:

I finally found that the monotype or monospace font that use in Delphi editor is not suitable for displaying Thai Language.  Even it can display Thai but it display incorrectly.

 
 
 

For future reference: Which font was it and where did you find it?

 

Edit: An idea for a future enhancement of development IDEs would be support for custom fonts (that not necessarily are monospaced) for string constants in the source code.

I won't be holding my breath for that to arrive, though - since it opens a hornet's nest of questions such as "Why does the cursor jump many characters to the right when I navigate up or down from this string constant?"

  • Like 1

Share this post


Link to post

Another solution to the font predicament is to use a translation tool for the actual text to be displayed, keeping the string constant in the code in English.

In translation tools, you are usually not bound to monospaced fonts.

 

This would also allow programmers not fluent in Thai to understand the text, and it would make the application ready for translation to a multitude of languages.

Share this post


Link to post

Please stop to wonder about the font(s). It does not matter!

The problem is the text rendering itself in the editor of the Delphi IDE.

 

In the screenshot you can see a few examples in the Delphi IDE and in Visual Studio Code.

In both cases, the font is the famous Consolas from Microsoft (https://en.wikipedia.org/wiki/Consolas). 

 

Most european languages like German, Swedish or Hungarian are well rendered. Even Greek is displayed nice.

But all others looks like a pile of shit. Arabic is broken, Thai has to much space between the symbols.

The same problem occours in Khmer and Sinhala (mispelled as Shinghal in the source code).

Chinese look okay, but not perfect.

 

Conclusion:

The Delphi IDE Editor is designed for European character sets only.

 

image.thumb.png.7e3fe7163f11e7813e0bc3721d2d1438.png

  • Like 1

Share this post


Link to post

@TiGü

The IDE editor supports Unicode, but most fonts do not have every Unicode character for every language defined, hence which font is being used, really matters.

The editor is definitively left to right, and made for monospaced fonts, which does not work well with national character sets that uses ligatures and variable kerning.

VS Code is many years younger than the Delphi Editor, which started supporting Unicode source in Delphi 2009 - so yes, it could use modernization.

 

Your example is definitively a good one - and should be reported as an issue in https://quality.embarcadero.com/

 

If you do, make sure you attach the original .pas file as well as the screen shots.

Share this post


Link to post
1 hour ago, Lars Fosdal said:

The IDE editor supports Unicode, but most fonts do not have every Unicode character for every language defined, hence which font is being used, really matters.

Are you sure about that? Pleas try to paste this to the IDE (example from: https://en.wikipedia.org/wiki/Precomposed_character)

Åström (U+0041 U+030A U+0073 U+0074 U+0072 U+006F U+0308 U+006D)

 

The result is:

 

image.thumb.png.9ca07daf58006eef7e705e4a2c6e6344.png

 

It doesn't render it well. If you assign this string to a label.caption then Windows will display it correctly:

image.png.e139d8875d3d4a780160408bf7061bca.png

 

Even if I paste the code from Delphi here the forum can display it correctly.

procedure TForm4.FormCreate(Sender: TObject);
begin
  label1.Caption:='Åström (U+0041 U+030A U+0073 U+0074 U+0072 U+006F U+0308 U+006D)';
end;

 

Share this post


Link to post
1 hour ago, Lars Fosdal said:

The IDE editor supports Unicode, but most fonts do not have every Unicode character for every language defined,

In my example screenshot the font is the same for both editors.

Share this post


Link to post
34 minutes ago, Lajos Juhász said:

Åström (U+0041 U+030A U+0073 U+0074 U+0072 U+006F U+0308 U+006D)

 

Or,

Åström  (U+00C5 U+0073 U+0074 U+0072 U+00F6 U+006D)

which is using the correct Unicode chars, i.e. not built from composites - which we know is not handled for monospaced fonts in the IDE.

 

image.png.24dd9f1af189c16181c3f18bdde5dd26.png

Share this post


Link to post
45 minutes ago, TiGü said:

In my example screenshot the font is the same for both editors.

Yes. Same Consolas font in two different editors. The new VS Code, and the old IDE. I get it.

 

I wonder - do you and I actually have the same Consolas font file?

Mine has Greek and Cyrillic, but not Thai and Arabic.

 

Edit: Original spec doesn't seem to include these either:
https://docs.microsoft.com/en-us/typography/font-list/consolas

 

Could you attach that .pas file, please - so that I can see how it looks in my IDE?

 

Share this post


Link to post

Now I understand Unicode for now is only the subset of the Unicode  that the Delphi IDE can display correctly  and that's not the definition of a Unicode editor. 

The editor in the IDE can display only the subset of a Unicode.

Share this post


Link to post
1 hour ago, Lars Fosdal said:

Could you attach that .pas file, please - so that I can see how it looks in my IDE?

Project1.dpr

Share this post


Link to post

@TiGü

I do get Thai, Arabic, Chinese - even when using a font that does not have such characters in it.

 

The reason seems to be that there is trickery going on under the hood for glyph substitution.

https://docs.microsoft.com/en-us/globalization/input/font-technology

 

It does look good and behave well in VS Code - and it does look like shit in the Delphi IDE.

In VS Code - even navigation with right arrow goes right to left within the Arabic parts of the text.

 

Did you create a report in Quality Central?

Share this post


Link to post
20 hours ago, Lars Fosdal said:

VS Code is many years younger than the Delphi Editor, which started supporting Unicode source in Delphi 2009 - so yes, it could use modernization.

Side note: VS Code is Chromium in fact

Share this post


Link to post
On 27.1.2021 at 8:07 AM, Lars Fosdal said:

Did you create a report in Quality Central?

No, you or someone else can do. Feel free.

I'm not affected by this behavior (as a german).

Share this post


Link to post
On 1/30/2021 at 1:21 AM, TiGü said:

No, you or someone else can do. Feel free.

I'm not affected by this behavior (as a german).

I had created the report in Quality Central already ( RSP-32335 ).    I also attached your Project1.dpr with the report.

Edited by amit
  • Like 1
  • Thanks 2

Share this post


Link to post

The problem is that the Delphi editor does not correctly handle Unicode diacritics. The editor expects to show one character right next to the previous, and ignores the fact that there are whole Unicode blocks that require the glyph to be positioned in a specific way over the previous character. The IDE editor just doesn't do it.

https://en.wikipedia.org/wiki/Combining_character

Edited by Brandon Staggs

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×