Recent

Author Topic: [SOLVED]Extra space with some font in SynEdit  (Read 3037 times)

mercury

  • Full Member
  • ***
  • Posts: 151
[SOLVED]Extra space with some font in SynEdit
« on: March 03, 2016, 06:59:49 am »
See the screenshot.
Any idea?
« Last Edit: March 06, 2016, 07:20:39 am by mercury »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5370
    • wiki
Re: [bug]Extra space with some font in SynEdit
« Reply #1 on: March 03, 2016, 03:24:38 pm »
This font is probably not monospaced.

SynEdit only supports monospace. for proportional fonts SynEdit finds the widest char (from a selection that it tests) and forces all others to be same as wide.

"widest char" actually is widest half width char. (even mono space has 2 widths). Chinese are full width, they always are twice as wide as latin.

The widest char in many fonts is the "@"

You can set "extra char spacing" to a negative value. But then some char will overlap.
You should find a monospaced font. "Deja vue mono" usually works well. (And if you have eastern font support installed it will fall back for Chinese to some font supporting them)

Windsurfer

  • Sr. Member
  • ****
  • Posts: 362
    • Windsurfer
Re: [bug]Extra space with some font in SynEdit
« Reply #2 on: March 03, 2016, 04:57:53 pm »
Check that you are using a recent version of Lazarus. IIRC pre-release 1.4 had this problem on my system with Linux Mint 17.

mercury

  • Full Member
  • ***
  • Posts: 151
Re: [bug]Extra space with some font in SynEdit
« Reply #3 on: March 04, 2016, 04:33:50 pm »
Check that you are using a recent version of Lazarus. IIRC pre-release 1.4 had this problem on my system with Linux Mint 17.
Yes I use Lazarus 1.6.

@Martin_fr
Microsoft YaHei UI is the default font in windows Chinese version. And it’s not monospaced.
I want use SynEdit for display some code in my program.
In Linux the most used default Chinese font Wen Quan Yi Zen Hei (文泉驿正黑) is display well. But I don’t want include this font in my program.
Could you suggest some Chinese font that SynEdit support (no extra space), and it’s already include in windows (no install need).

PS:
Is that possible let SynEdit support font is not monospaced?

Thank you very much.
« Last Edit: March 04, 2016, 04:35:37 pm by mercury »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5370
    • wiki
Re: [bug]Extra space with some font in SynEdit
« Reply #4 on: March 04, 2016, 05:27:42 pm »
@Martin_fr
Microsoft YaHei UI is the default font in windows Chinese version. And it’s not monospaced.
I want use SynEdit for display some code in my program.
In Linux the most used default Chinese font Wen Quan Yi Zen Hei (文泉驿正黑) is display well. But I don’t want include this font in my program.
Could you suggest some Chinese font that SynEdit support (no extra space), and it’s already include in windows (no install need).

I use SynEdit with fonts as "deja vu mono", and "courier new" both installed by default. And Chinese is displayed (ignoring that I can't read it, it looks correct) (using Win Vista)

They may not include Chinese themself, but windows uses a fallback in cases like that, and it displays the correct glyphs. (I do not know any way to control what is used a fallback)

However IIRC if a PC (like mine) was sold in Europe, then one needs to install "support for East Asian characters". Otherwise there may be no fonts for Chinese.
I cant test what happens without that support, as I already installed it.

Also depending on your locale settings, some graphic glyphs (like stars etc) may be either full or half width.

I haven't tested much on Linux. So can't advice for that.

Quote
PS:
Is that possible let SynEdit support font is not monospaced?
It's a big task to implement. Maybe someday.

mercury

  • Full Member
  • ***
  • Posts: 151
Re: [bug]Extra space with some font in SynEdit
« Reply #5 on: March 06, 2016, 07:20:05 am »
@Martin_fr
I didn’t see any font called ”deja vu mono” in my system(windows 8.1 and some font installed with office 2013). I will use ”Courier New”. And Chinese character display well. Behavior much like TMemo but with lots of cool features.
If someone doesn’t have any Chinese font in system, then I think that is not my program’s problem. And probably they will never want to display any Chinese character in my program.

Thaddy

  • Hero Member
  • *****
  • Posts: 7890
Hamlet 1.4 (nothing wrong with the Danish, btw)