3.3.7 FTFontPreview

  To see a list of known Fontconfig fonts, you can use fc-list command in Fontconfig package.
Using an output of fc-list, we can implement a font-preview C++ class to browse X11 Fontconfig fonts.
The following FTFontPreview program is an example to display available fonts by FTFontPreview (FreeTypeFontPreview) of xft++.



//
//FTFontPreview.cpp
//Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED.


#include <oz++/motif/ApplicationView.h>
#include <oz++/xft/FTFontPreview.h>

namespace OZ {

class MainView :public ApplicationView {
private:
  SmartPtr<FTFontPreview> fontPreview;

public:
  MainView(Application& applet, const char* name, Args& args)
  :ApplicationView(applet, name, args),
    fontPreview(NULL)
  {
    Args ar;
    fontPreview = new FTFontPreview(this, "", ar);
  }

  ~MainView()
  {
  }
};
}

//
int main(int argc, char** argv)
{
  const char*  appclass = argv[0];
  Application applet(appclass, argc, argv);
  try {
    Args args;
    args.set(XmNgeometry, "500x500");
    MainView view(applet, argv[0], args);
    view.realize();

    applet.run();
  } catch (Exception& ex) {
    caught(ex); 
  }
  return 0;
}




Last modified: 1 Jan 2017

 Last modified: 1 Jan 2017

Copyright (c) 2000-2017 Antillia.com ALL RIGHTS RESERVED.