Recent

Author Topic: new font not correct view  (Read 9600 times)

mangakissa

  • Hero Member
  • *****
  • Posts: 1131
new font not correct view
« on: February 14, 2015, 05:08:10 pm »
Has anyone noticed this?

There's a security fix (kb3013455) of windows Vista, which corrupts some fonts. Most applications are using 'courier new' I want to change the font of the editor to 'times new roman, it looks not as it wants to be. A lot of spaces on each character.

I put a example of Lazarus an another program with the same font.
Lazarus 2.06 (64b) / FPC 3.0.4 / Windows 10
stucked on Delphi 10.3.1

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: new font not correct view
« Reply #1 on: February 14, 2015, 05:16:08 pm »
Times New Roman is not monospaced (it is proportional) - so the editor does not support it.

Bart

  • Hero Member
  • *****
  • Posts: 5706
    • Bart en Mariska's Webstek
Re: new font not correct view
« Reply #2 on: February 14, 2015, 05:20:00 pm »
Try using a monospaced/fixed width font, the IDE doesn't look very nice with proportionally spaced fonts.
Maybe Consolas, Deja Vu sans Mono or Lucida Console?

For inspiration: http://www.retroprogramming.com/2010/05/10-alternative-monospace-fonts-for.html

Bart

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: new font not correct view
« Reply #3 on: February 14, 2015, 05:57:20 pm »
Times New Roman is not monospaced (it is proportional) - so the editor does not support it.
Well, it actually does, as you can see in the screen shot.
However, the results would look crappy, since Times New Roman font was not designed for "monospace"

The ideology of these two editors (SynEdit) and whatever - notpad-like editors are a bit different.
SynEdit is forcing "monospace" ignoring the actual width of the character. The width of the longest character ("W"??) in applied to all other characters. 

Try to see how "column" selection would look like in LitePad ;)

After all SynEdit is more of 2 dimensional array of characters, rather than a text editor.
Unlike notepads it allows to put cursor (and edit) the text - beyond line and/or text bounds.
Notepads limit you to put cursor within the text/line only.
That however, imposes some limitations, such as -- no wordwrap so far!

« Last Edit: February 14, 2015, 06:03:34 pm by skalogryz »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12202
  • Debugger - SynEdit - and more
    • wiki
Re: new font not correct view
« Reply #4 on: February 14, 2015, 07:44:34 pm »
DejaVu Mono is  a good choice.

The width of the longest character ("W"??) in applied to all other characters. 
Usually the "@"

You can reduce the spacing by giving a negative "Extra Char Width". But with a that will still not look good.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: new font not correct view
« Reply #5 on: February 14, 2015, 08:04:47 pm »
2 Martin_fr:

Is it possible to make an option to "stretch" characters to the selected width?
(i.e. if the actual width of "i" is only 4 pixels (for times new roman) and the selected width is 32 pixels, then "i" would be "stretched" 8-times in width to fill the content)

It won't look as good as monospace font, but won't look as "empty" as it looks right now? (the sample is attached)

Zoran

  • Hero Member
  • *****
  • Posts: 1988
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: new font not correct view
« Reply #6 on: February 14, 2015, 08:46:22 pm »
The author of the following link thinks that proportional fonts should be used for programming: http://nickgravgaard.com/elastictabstops/news/programming-fonts/
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12202
  • Debugger - SynEdit - and more
    • wiki
Re: new font not correct view
« Reply #7 on: February 14, 2015, 09:03:17 pm »
Is it possible to make an option to "stretch" characters to the selected width?

Well everything is possible. But: No, that will not be implemented. (well feel free to write a SynPlugin that does do it)

I do not know of any OS option / API param that does this.
So to archive this, SynEdit would need to:
- measure every letter (using the OS/API)
- paint every letter to a bitmap
- stretch it
- put it on the screen
that would slow down painting a lot.

Besides, one day, I hope to add proportional font support. But that is still a very very long time away.

The author of the following link thinks that proportional fonts should be used for programming: http://nickgravgaard.com/elastictabstops/news/programming-fonts/

There is an existing feature request for elastic tabs, and maybe one day....

All else is personal opinion. I prefer space over any kind of tab.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: new font not correct view
« Reply #8 on: February 14, 2015, 09:05:01 pm »
Well everything is possible. But: No, that will not be implemented. (well feel free to write a SynPlugin that does do it)
very likely I will...I can only hope I'll have enough time.
Conceptual demo is attached, though.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: new font not correct view
« Reply #9 on: February 14, 2015, 09:10:52 pm »
The author of the following link thinks that proportional fonts should be used for programming: http://nickgravgaard.com/elastictabstops/news/programming-fonts/
Usage of monospace fonts historically comes from consoles (text-based output, which was introduced as memory-economy approach)... which in its turn comes from typewriters :)

One big approach here is team work. If a certain team imposes a certain standards to the formatting of the code, then everyone working on the code should follow it. (like them or not). With proportional font - it also requires everyone to use the same font. With mono-space fonts, this isn't necessary.

Also, i wonder how far eastern languages people consider the subject. As far as I know all hieroglyph are of the same width. Thus, it looks more natural for them for the whole text to be monospace.
« Last Edit: February 14, 2015, 09:17:23 pm by skalogryz »

Zoran

  • Hero Member
  • *****
  • Posts: 1988
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: new font not correct view
« Reply #10 on: February 14, 2015, 11:44:18 pm »
The author of the following link thinks that proportional fonts should be used for programming: http://nickgravgaard.com/elastictabstops/news/programming-fonts/

There is an existing feature request for elastic tabs, and maybe one day....

All else is personal opinion. I prefer space over any kind of tab.

Of course it's his personal opinion. I just found his opinion worth mentioning here.
By the way, I prefer space over any kind of tab, too. :)
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

Zoran

  • Hero Member
  • *****
  • Posts: 1988
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: new font not correct view
« Reply #11 on: February 14, 2015, 11:50:21 pm »
As far as I know all hieroglyph are of the same width. Thus, it looks more natural for them for the whole text to be monospace.

Hmm... Actually, if all their characters are of the same with, then all fonts appears monospace, so probably they do not care. 8-)

EDIT:  Only now I understand what you mean -- Pascal code remains in latin letters, of course, so you do have your point. I should go to sleep. :-[
« Last Edit: February 14, 2015, 11:55:41 pm by Zoran »
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12202
  • Debugger - SynEdit - and more
    • wiki
Re: new font not correct view
« Reply #12 on: February 15, 2015, 12:18:51 am »
Well everything is possible. But: No, that will not be implemented. (well feel free to write a SynPlugin that does do it)
very likely I will...I can only hope I'll have enough time.
Conceptual demo is attached, though.

See attached what happens to Arabic script (the text is random typing, IF it has a meaning, I am unaware of it)

On top SynEdit with monospaced font.
But (at least on win) SynEdit can space-out a proportional font, and yet keep the script correct.

The issue is, that if you draw letters in a word they form a different glyph. So drawing one by one breaks the output. (Also it displays it backwards, as it is LTR)


EDIT:  Only now I understand what you mean -- Pascal code remains in latin letters, of course, so you do have your point. I should go to sleep. :-[
Pascal code may have string, and they can be any language

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: new font not correct view
« Reply #13 on: February 15, 2015, 12:32:56 am »
See attached what happens to Arabic script (the text is random typing, IF it has a meaning, I am unaware of it)

But (at least on win) SynEdit can space-out a proportional font, and yet keep the script correct.

The issue is, that if you draw letters in a word they form a different glyph. So drawing one by one breaks the output. (Also it displays it backwards, as it is LTR)
Well, thank you, I'm aware of ligatures and that the demo doesn't support them in any way :)
But let me answer your question what I'd do for the complex scripts.
* get the whole complex string as a "bitmap".
* the position of each character (relative to the bitmap positions)
* slice the "bitmap" on per character into sub-images
* draw each sub-image resizing it to fill a column width.

On top SynEdit with monospaced font.
The second (from the right) glyph entered doesn't match the one rendered in SynEdit. Is it expected?
« Last Edit: February 15, 2015, 12:35:47 am by skalogryz »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12202
  • Debugger - SynEdit - and more
    • wiki
Re: new font not correct view
« Reply #14 on: February 15, 2015, 12:38:53 am »
The second (from the right) glyph entered doesn't match the one rendered in SynEdit. Is it expected?

I cant read or write Arabic. So I cant judge it. It is a different font. Not sure if that explains it. It is entirely rendered by windows (IIRC).

Edit: There is an issue with none spacing marks in SynEdit (SynEdit is not yet fully utf ready). It may be that.

 

TinyPortal © 2005-2018