freetype.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #include <precomp.h>
  2. #include <bfc/wasabi_std.h>
  3. #include "freetype.h"
  4. #include "freetypefont.h"
  5. #include <api/font/FontCreator.h>
  6. #include <tataki/export.h>
  7. class AutoTataki : public LoadableResource
  8. {
  9. public:
  10. virtual void onRegisterServices() { Tataki::Init(WASABI_API_SVC); }
  11. virtual void onDeregisterServices() { Tataki::Quit(); }
  12. };
  13. static WACNAME wac;
  14. WACPARENT *the = &wac;
  15. // {EF7E83B0-10ED-4be4-AFAF-D012F05C114E}
  16. static const GUID guid =
  17. { 0xef7e83b0, 0x10ed, 0x4be4, { 0xaf, 0xaf, 0xd0, 0x12, 0xf0, 0x5c, 0x11, 0x4e } };
  18. // {504060F6-7D8C-4ebe-AE1D-A8BDF5EA1881}
  19. static const GUID freetypeFontRendererGUID =
  20. { 0x504060f6, 0x7d8c, 0x4ebe, { 0xae, 0x1d, 0xa8, 0xbd, 0xf5, 0xea, 0x18, 0x81 } };
  21. WACNAME::WACNAME() : WACPARENT(L"Freetype Font Service")
  22. {
  23. registerResource(new AutoTataki);
  24. registerService(new FontCreator<FreeTypeFont>(freetypeFontRendererGUID));
  25. }
  26. WACNAME::~WACNAME() {
  27. }
  28. GUID WACNAME::getGUID() {
  29. return guid;
  30. }
  31. void WACNAME::onRegisterServices()
  32. {
  33. /*
  34. #ifdef WASABI_COMPILE_CONFIG // if not, you need to set the font renderer by hand
  35. // Here is where we hijack the default renderer and do it all freetype style.
  36. const GUID options_guid =
  37. { 0x280876cf, 0x48c0, 0x40bc, { 0x8e, 0x86, 0x73, 0xce, 0x6b, 0xb4, 0x62, 0xe5 } };
  38. CfgItem *options = WASABI_API_CONFIG->config_getCfgItemByGuid(options_guid);
  39. if (options) {
  40. const char *attr = "Font Renderer";
  41. const char *name = "Freetype";
  42. options->setData(attr, name);
  43. }
  44. // the fonts system uses this attrib for what font system to try to use.
  45. #endif
  46. */
  47. }
  48. void WACNAME::onCreate() {
  49. }
  50. void WACNAME::onDestroy() {
  51. }