Forelayer text colour and weight!

Discussion in 'Bug Reports' started by agraham, Oct 8, 2008.

  1. agraham

    agraham Expert Licensed User

    Using the Imagelib library if I run this code on my desktop (version 6.42) both compiled and in the IDE the text drawn by ForeDrawer and Form1.FDrawString is heavier (bolder) than that drawn by BackDrawer and Form1.DrawString. The colours are also noticeably different although supposedly the same. It is not a scaling problem as the text sizes are the same. :confused:

    If I run this code on my device (version 6.41) both optimised compiled and in the device IDE the text drawn by ForeDrawer is heavier (bolder) than that drawn by BackDrawer. As on the desktop the colours are also noticeably different in the same way and the text sizes are the same. However the text that is supposed to be drawn by both Form1.FDrawString and Form1.DrawString is not displayed at all!

    I cannot explain this. Am I being stupid and missing something obvious or is there a problem?
    Sub App_Start
       col = cGreen
       Form1.ForeLayer = 
    "A string",20, Brush.Value, 00)
    "A string",20, Brush.Value, 030)
    "A string",20060,200,60, col)
    "A string",20090200,90, col)
    End Sub
  2. agraham

    agraham Expert Licensed User

    Apologies - my stupidity. The dekstop and device differ in behaviour when DrawString is given a zero height box to draw in. The desktop ignores the zero height and draws the text, the device honours it and doesn't draw.

    If I increase the size of the text the problem diminishes. It turns out that this is related to font smoothing. Text drawn on the Forelayer is drawn using ClearType (and also Standard font smoothing on the desktop) if it is enabled, while text drawn on the background doesn't use ClearType - hence the visual difference for small characters. I have no idea why this difference should exist! :confused:
  3. Cableguy

    Cableguy Expert Licensed User

    The clear type option, smooths text used on the device...
    All apps, including b4ppc generated exes, use the forelayer to host all controls, like textboxes and labels, wich are texts controls...
    Th backlayer is used only GRAPHICALLY so the clear type is not aplicable to it, thus rendering the text diferent...

    As I remember clear type can be disabled...Just to see the diference between cleartype ON and OFF...
  4. agraham

    agraham Expert Licensed User

    I do know what ClearType is :)

    Entirely wrong I am afraid. The forelayer and backlayer on a B4ppc form are both bitmaps and have nothing to do with the controls at all which all draw themselves. Both these bitmaps are drawn in the same way using a .NET Graphics object associated with each bitmap. B4ppc uses these bitmaps during the form Paint event to update the form background image and so avoid the user having to program Paint events which they would have to in C# or VB.NET. During the Paint event the form uses a Graphics object (a Drawer) to draw the backlayer bitmap onto the forms Image and then if a forelayer exists also draws that on the forms Image. The forelayer is set to support transparency (the backlayer isn't) so only the non-transparent areas are actually drawn so overwriting the background in parts. If you want to see what is happening look in CEnhancedForm.cs in the Basic4ppc Desktop/Tzor folder.

    Remember that all Windows is GRAPHICS including text controls where the text is drawn using DrawString or a close cousin to render a Font object. DrawString does support ClearType via the Font it is rendering, witness its unwanted appearance on the forelayer. A Font (especially on the desktop) supports lots of other options too but typography is not one of my fortes so I don't understand all the options, and their effect in combination, the majority of which are not exposed in B4ppc. It is probably some combination of default Font settings that causes forelayer text to be rendered using font smoothing and backlayer text not.

    That's how I established what was happening. I have established that is is probably some default settings to do with B4ppc using transparency on the forelayer bitmap but not on the backlayer.
  5. Cableguy

    Cableguy Expert Licensed User

    I stand corrected, my apologies to the forum, for misleading informations...
    Once again I have learned something...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice