SOL9 2.0 Sample: Font

SOL9 2.0 Samples

1 Screenshot


2 Source code

/*
 * Font.cpp 
 * Copyright (c) 2009 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED. 
 */



// SOL++2000 
// 2000.02.18


#include <sol\ApplicationView.h>
#include <sol\ScrolledText.h>
#include <sol\Font.h>
#include <sol\ClientDC.h>

namespace SOL {

class AppView :public ApplicationView {
private:
    Font          font;
    ScrolledText  sctext;

  
public:
    /**
     * Constructor
     */
    AppView(Application& applet, const TCHAR* name, Args& args) 
        :ApplicationView(applet, name, args)
    {
        Args ar;
        sctext.create(this, _T(""), ar);

        ClientDC dc(this);
        //2008/06/24
        int pointSize = 24;
        int logPixel = dc.getDeviceCaps(LOGPIXELSY);

        int nHeight = -MulDiv(pointSize, logPixel, 72); 

        ar.reset();
        ar.set(XmNheight, nHeight);
        ar.set(XmNweight,  FW_BOLD);
        ar.set(XmNcharSet, (ulong)dc.getTextCharsetInfo(NULL));
        font.create(ar);

        sctext.setFont(&font);

        // Add this sctext to the defaultLayoutManager.
        add(&sctext);

        setText(_T("AppView: This is a 24 points and bold font"));

    }    
};

}


void    Main(int argc, TCHAR** argv)
{
    const TCHAR* name = _T("AppView");
    try {
        Application applet(name, argc, argv);

        Args args;
        AppView appView(applet, name, args);
        appView.realize();
        applet.run();
    } catch (...) {

    }
}

Last modified: 11 Nov 2009

Copyright (c) 2009 Antillia.com ALL RIGHTS RESERVED.