Author Topic: Font size issue  (Read 10108 times)

Rox271

  • Guest
Font size issue
« on: October 12, 2005, 09:39:20 pm »
I'm facing a strange issue in the main editor.
As soon as a word is shown in bold, it looks like there is an issue with character size. Remaining text on the right is no more correctly aligned.
I'm trying to use Lucida Console but this happens with any non proportional fonts other than Courier New which is always perfect.

Also if you zoom the text, you will notice that the carret is sometime over characters when text is bold.

Is this a bug (couldn't find it on the list) or am I doing something wrong?
« Last Edit: October 12, 2005, 09:47:43 pm by Rox271 »

Rox271

  • Guest
Re: Font size issue
« Reply #1 on: October 14, 2005, 09:37:29 am »
Just to make myself clear, I have attached two screenshots.
They show the same code snippet using Lucida console or Courier New fonts.
On the first one, we see that the code is no more properly aligned; without the bold option for keywords, everything is ok.
On the second one, we see that the use of Courier Font produces a perfect result.

[attachment deleted by admin]
« Last Edit: October 14, 2005, 09:39:05 am by Rox271 »

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Font size issue
« Reply #2 on: October 14, 2005, 10:09:32 am »
For starters, you 're not mentioning what version you are using. How are we supposed to know?

The CVS version (soon to become 1.0-RC2), contains a newer version of the editor component and it works as expected. So, I assume you 're using RC1-1 or earlier. Please wait for RC2...
Be patient!
This bug will be fixed soon...

Rox271

  • Guest
Re: Font size issue
« Reply #3 on: October 14, 2005, 10:36:15 am »
Mandrav, thanks for your answer.
Yes, I confirm I'm currently using the RC1.
Sorry about possible confusion, but since this is the latest official binary...
I'm glad to know this may be fixed on RC2 and looking forward to give it a go.

In the mean time, I will stick on Courier New, nothing dramatic.
CodeBlocks is an excellent tool, thanks for the good work.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Font size issue
« Reply #4 on: October 14, 2005, 10:37:15 am »
No reason to investigate, Yiannis. This is not a Code::Blocks problem. I am sure it is not, because I can do the same with other programs on my Computer ;)

In order to have your text aligned smoothly, you should either use the tab char instead of spaces (you can configure the editor and the code formatter plugin to use either (and convert between)), or you should use a fixed pitch font. Sounds obvious. Now you tell me that you are using a fixed pitch font. No, you are not.

The font Ludida Console is a fixed pitch font just like Courier New. However, Lucida Console, unlike Courier New, does not come with a bold font face. So what happens is that the "smart" font substitution built into Windows chooses the next best font to display bold text, which is Lucida Sans in this case.
Lucida Sans is not fixed pitch, hence the problem.
Another possibility would be to turn off "smart" font substitution, then Windows will use Lucida Console and create a "faux bold" effect (which will still be fixed pitch). I don't remember how you turn that off, though... some occult registry key probably.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

takeshimiya

  • Guest
Re: Font size issue
« Reply #5 on: October 14, 2005, 10:59:00 am »
thomas is almost right, but...

I can confirm that it's not a bug in C::B (compiled from CVS 20 minutes ago), it happens also in SciTE, Wordpad, and in other text editors.

I found Lucida Console the best monospaced font, and unlike Courier New, it does support ClearType in windows, so it's very readable in a LCD monitor.

However, I don't think it's some windows automagic font sustitution (try it on another OS), I think it's only Lucida Console, but the Bold version.
Because the when you set Lucida Console to bold, it keeps monospaced if all the text is bold.

Also if you zoom the text, you will notice that the carret is sometime over characters when text is bold.
Try disabling font antialiasing (or ClearType) in Windows to see if that effect dissapears. Windows happens to screw some parts of the text if that is enabled.


So I think the best solution (at least it's the way I use it) is:

Use Lucida Console, ClearType enabled, no bold fonts.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Font size issue
« Reply #6 on: October 14, 2005, 11:14:23 am »
Hmm... Lucida Console does not have a bold face, at least not on my system (Windows XP SP2).

Code
D:\desktop>ls -a C:/windows/fonts |grep "^[lL].*"
LONDON_F.TTF
Lsans.TTF
Lsansd.TTF
Lsansdi.TTF
Lsansi.TTF
l_10646.ttf
latha.ttf
lucon.ttf
And that is the point, the system either has to create a "faux bold", or substitute the font.

Isn't there a possibility to hint for rendering quality etc. on a device context from inside a program, too? Never used that, but I think I read about it.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

takeshimiya

  • Guest
Re: Font size issue
« Reply #7 on: October 14, 2005, 11:48:10 am »
It seems, but when you are using Lucida Console bold, the text is monospaced (just not with the same width as non-bold).

I don't think there is a portable way of changing the rendering quality (probably you'll have to make your own solution).

Another solution would be to make a Lucida Console bold typeface (or maybe it exists somewhere in google), having the same width as the normal typeface.

Anyways, what's the behaviour of all of this in linux/mac os?

PS: The Lucida family font is really great, specially Lucida Sans Unicode and Lucida Console, I use them everywhere.
And also they are pretty standard in most linux distros, windows, and probably mac, so it's rather common.

Rox271

  • Guest
Re: Font size issue
« Reply #8 on: October 14, 2005, 12:59:18 pm »
it happens also in SciTE, Wordpad, and in other text editors.
This is right! It happens on Wordpad too.
Was very surprised to see that cos I'm using Lucida Console on a regular base in Visual Studio and never faced this issue.
Will double check this afternoon.

Thanks to all for your input.

[Edit]
Visual Studio 6 doesn't have a bold option. So this explains why I never had this issues before  :lol:.
Visual Studio .NET 2003 has the bold option.... and the same issue.
Conclusion: unless you can do better than Microsoft this is definitely not a bug.
« Last Edit: October 14, 2005, 02:29:24 pm by Rox271 »

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Font size issue
« Reply #9 on: October 14, 2005, 05:36:54 pm »
*ahem* I find that as an insult. We CAN do better than Microsoft :lol: Just not in this area :-P

takeshimiya

  • Guest
Re: Font size issue
« Reply #10 on: October 14, 2005, 10:36:41 pm »
Microsoft, Microsoft...

But how this behaves in other OSes/software (linux-mac/freetype)?
I'm curious to know that. :)