0x000000 & 0xFFFFFF

Posted by Lvmwrah on Mon 06 Apr 2009 03:47 PM — 9 posts, 33,415 views.

#0
I'm getting an issue when I try to make a miniwindow with a black background and display white text.

First, black on white:
http://img512.imageshack.us/img512/7153/ss1.png
Looks just fine.

White on black, though:
http://img512.imageshack.us/img512/6857/ss2.png
Does not.

The following is what I use. Note, there's still comments from the help in this thing. All this is new to me, but I'm still not seeing why this is happening.

http://pastebin.com/d1b1390c

Between the two pictures, all I'm doing is switching around the color codes.

[Edit]

Playing around with this a lot, it seems the odd warping only happens with certain fonts with any light colored text on dark backgrounds. This happens with Tahoma, Courier, or Arial. It doesn't happen with Fixedsys or System. Something about shading/blending just makes thin fonts appear wonky?
Amended on Mon 06 Apr 2009 06:29 PM by Lvmwrah
USA #1
What exactly is the issue you're seeing? What are you expecting to see but aren't?

If you are referring to the very slight color artifacts around the white-on-black text, you're probably seeing the effects of ClearText font smoothing, which isn't controlled by MUSHclient.
#2
http://img206.imageshack.us/img206/8927/ss3.png

The top is what happens when I try to write text in a mini window.

The bottom is what happens when I use ColourNote in the regular output portion of the world's window. It's how I want the text to appear.

If it's something out of the client's hands, then oh well.
USA #3
Sorry, you're going to have to be a little more specific; maybe other people are clearly seeing the difference but I'm not. Please say in words what it is that you're expecting to see but aren't. I'm guessing that you're not worried about the fact that the "NO" shows up in one but not the other. (It would be helpful if your pictures reproduced the exact same circumstances.)

If it might be caused by cleartext, just try turning that off and see if you're satisfied.
Australia Forum Administrator #4
I can see what you mean alright, and I can reproduce it here. The miniwindow text seems blurred, compared to the output window, using the same font and colour.

That was with Cleartype turned off - with it on, they both seemed the same to me, however that "same" was a bit hard on the eyes.

I'll have to look into that - I thought the text was rendered with the same OS call (ExtTextOut) - and after looking, it is. However there is one difference.

One uses ETO_CLIPPED to clip the resulting output to a rectangle and one doesn't. However a quick test shows changing that makes no difference. There must be some subtle difference to the way the fonts are created - I'll look into it.
Australia Forum Administrator #5
Ah OK, I found it! :-)

Your code was:


WindowCreate ("WinDef", 
              660, 0, 584, 100,
              1,    -----> problem is here
              2,
              0x000000)
                 
WindowFont ("WinDef", "cour", "Courier New", 10, false, false, false, false, 0, 0)

WindowShow ("WinDef",  true)

local line = 0

WindowText ("WinDef", "cour", 
                "-- Defences -------------------------------------------------------------",
                0, line, 0, 0,
                0xFFFFFF,
                false)
local line = line + 18

WindowText ("WinDef", "cour", 
                "¬ NO Lightshield ¬ NO Mindnet  · NO Blind    £ NO Frost      ¤ NO Sileris",
                0, line, 0, 0,        -- rectangle
                0xFFFFFF, -- colour
                false)              -- not Unicode
local line = line + 18

WindowText ("WinDef", "cour", 
                "¬ NO Discharge   ¬ NO Deatheye · Deaf        £ NO Speed      ¤ NO Caloric",
                0, line, 0, 0,        -- rectangle
                0xFFFFFF, -- colour
                false)              -- not Unicode
local line = line + 18

WindowText ("WinDef", "cour", 
                "¬ NO Cloak       ¬ NO Thirdeye · NO Kola     £ NO Levitation ¤ NO Mass",
                0, line, 0, 0,        -- rectangle
                0xFFFFFF, -- colour
                false)              -- not Unicode
local line = line + 18

  
font_height = WindowFontInfo ("WinDef", "cour", 1)
font_width1 = WindowTextWidth ("WinDef", "cour", "H:100% M: 98% E:100% W: 99% S: 88% X:82.25% <eb lr>                        PRONE")
font_width2 = WindowTextWidth ("WinDef", "cour", "ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp")

world.Note ("Font Height = "..font_height)
world.Note ("Font Width1 = "..font_width1)
world.Note ("Font Width2 = "..font_width2)



Your position code for WindowCreate is 1:


Position - a number indicating where you want the window positioned on the screen. Whenever the screen is resized or redrawn the contents of the window are drawn in the requested position:

0 = strech to output view size
1 = stretch with aspect ratio
2 = strech to owner size


This caused MUSHclient to copy the miniwindow to the output window in such a way that it created the artifact you see. Since you are using absolute positioning anyway, the problem goes away if you use another position flag (that doesn't stretch), like 4.
Amended on Tue 07 Apr 2009 01:26 AM by Nick Gammon
USA #6
That's funny, with my monitor at work the distortion wasn't bad at all (in fact as you can see I hardly noticed it) but at home, it's a lot worse.

I wonder if that has to do with the RGB pixel ordering on the flat panel monitors: I know that text rendered with one pixel ordering to a monitor with a different pixel ordering can look bad.
#7
Thank you! No issue now.
Amended on Tue 07 Apr 2009 03:40 AM by Lvmwrah
USA #8
This is so weird... I'm back at work again and I swear the two lines look almost the same, nothing like the difference I saw from home. Strange...