Recent

Author Topic: Bad text rendering in CudaText  (Read 6450 times)

Alextp

  • Hero Member
  • *****
  • Posts: 870
    • UVviewsoft
Bad text rendering in CudaText
« on: January 28, 2016, 03:20:04 pm »
Image
Top- editor TextWrangler
Bottom- CudaText (in Lazarus)

Same html file, same font Liberation mono
Problems -
a) words "Glossary" "http-equiv" don't fit into place (I count place as place for nonbold font. prob only on OsX.)
b) bad font looking. Top img looks much better with font. (I use font quality "default", tried other quality too.)

what to do?
« Last Edit: January 28, 2016, 03:22:56 pm by Alextp »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5635
    • wiki
Re: Bad text rendering in CudaText
« Reply #1 on: January 28, 2016, 04:06:06 pm »
if you zoom in  you can see that the OS is not rendering strictly monospaced (compare char pos with the line above)

It also looks as if the fonts use different rendering (not sure what, maybe antialiasing, or subpixel, ....)

I do not know the answer, but you could try and change the font quality (if that is supported by the rendering code)

Alextp

  • Hero Member
  • *****
  • Posts: 870
    • UVviewsoft
Re: Bad text rendering in CudaText
« Reply #2 on: January 28, 2016, 06:34:26 pm »
OK I solved at last issue a. i use Dx parametr of ExtTextOut now. OSX needs it so. On linux/win i don't use it ..

Alextp

  • Hero Member
  • *****
  • Posts: 870
    • UVviewsoft
Re: Bad text rendering in CudaText
« Reply #3 on: January 30, 2016, 12:04:16 am »
Martin-do you see that font look of CudaText is worse than TextWrangler? at last at image. im not sure. maybe not worse.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5635
    • wiki
Re: Bad text rendering in CudaText
« Reply #4 on: January 30, 2016, 01:51:52 am »
For a good comparison you need to render with the same colors in both.

Zooming the image at 500%, I would guess that the other uses subpixel rendering, and cuda does not.
(You note that a black dot is made from many colors.)

If the font is designed for subpixel then the width of a single glyph in it, could be 10.3 pixel (fractional pixel). And that explains why longer text fragments are cut off. Because if the editor calculates whit 10 pixel, then it gets less space than needed.


Alextp

  • Hero Member
  • *****
  • Posts: 870
    • UVviewsoft
Re: Bad text rendering in CudaText
« Reply #5 on: January 30, 2016, 02:13:56 am »
If you compare Laz rendering with TextWrangler, u don't see Laz font look is worse?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5635
    • wiki
Re: Bad text rendering in CudaText
« Reply #6 on: January 30, 2016, 03:47:16 am »
I dont know your entire text rendering code.

When referring "Lazarus" then that is SynEdit, or text on buttons, menus...?

It is too long ago to remember how exactly SynEdit is setting up the fonts, and canvas, etc....

But about the "cut off"
SynEdit has code to "force" each char on the desired pos. (search ETO in SynEdit)
On Windows that is part of the OS API, on other platform the LCL emulates that by outputing each char on its own. (not the best, and bad for eastern/script languages / so it is only used if really needed)

SynEdit detects sub-pixel width of a font.
It measures several individual chars, and checks they all have the same width (as should in monospace).
Then it measures a string like "aaaaaa". That should be exactly 6 times as wide. But for subpixel it will not be.

Alextp

  • Hero Member
  • *****
  • Posts: 870
    • UVviewsoft
Re: Bad text rendering in CudaText
« Reply #7 on: January 30, 2016, 09:00:28 am »
I wrote that a)is solved, it means I use ETO option now
I ask about b)

Do you see that SynEdit (your synedit) font look is worse on OSX, than TextWrangler?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5635
    • wiki
Re: Bad text rendering in CudaText
« Reply #8 on: January 30, 2016, 02:50:15 pm »
I dont have OSX myself. So I can not test.

Does it look the same as your Cuda text? As I said, there is a difference in rendering.
I dont know which settings or changes would make that difference.