[Oberon] WMComponents.VisualComponent GetFont

Dan Parnete dan.parnete at fastwebnet.it
Sun Mar 12 10:35:03 CET 2006


Hello,

This code looks like an inocent component font changing:
    vc is WMComponents.VisualComponent;

VAR font: WMGraphics.Font;
BEGIN
    font := vc.GetFont();
    IF font.size = 12 THEN font.size := 10 END;
    vc.SetFont(font)
END

But in fact, this changes even the default system font. Just because 
GetFont returns a reference to the default font, if the vc.font is NIL. 
I'm wandering if this is the normal behaveour? Why should this method 
returns the default font? There are other modes to know it, and this 
makes inposible to know if a component has a font assigned. I propose:

        PROCEDURE GetFont*() : WMGraphics.Font;
        BEGIN
            RETURN font
        END GetFont;

Best regards,
Dan Parnete


More information about the Oberon mailing list