1
0

skinfont.cpp 940 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #include <precomp.h>
  2. #include "skinfont.h"
  3. #include <bfc/wasabi_std.h>
  4. SkinFont::SkinFont()
  5. {}
  6. SkinFont::~SkinFont()
  7. {
  8. if (!tempFn.isempty())
  9. {
  10. #ifdef WIN32
  11. RemoveFontResourceW(tempFn);
  12. #else
  13. DebugString( "portme -- SkinFont::~SkinFont\n" );
  14. #endif
  15. UNLINK(tempFn);
  16. }
  17. }
  18. int SkinFont::setXmlOption(const wchar_t *paramname, const wchar_t *strvalue)
  19. {
  20. return 0;
  21. }
  22. void SkinFont::installFont(const wchar_t *filename, const wchar_t *path)
  23. {
  24. OSFILETYPE in, out;
  25. StringPathCombine temp(path, filename);
  26. in = WFOPEN(temp, WF_READONLY_BINARY);
  27. if (in == OPEN_FAILED) return ;
  28. int len = (int)FGETSIZE(in);
  29. MemBlock<char> m(len);
  30. FREAD(m.getMemory(), len, 1, in);
  31. tempFn = TMPNAM(NULL);
  32. out = WFOPEN(tempFn, WF_WRITE_BINARY);
  33. ASSERT(out != OPEN_FAILED);
  34. FWRITE(m.getMemory(), len, 1, out);
  35. FCLOSE(out);
  36. FCLOSE(in);
  37. #ifdef WIN32
  38. AddFontResourceW(tempFn);
  39. #else
  40. DebugString( "portme -- SkinFont::installFont\n" );
  41. #endif
  42. }