skinfont.cpp 892 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include "precomp.h"
  2. #include "skinfont.h"
  3. #include "api.h"
  4. #include "../bfc/std.h"
  5. SkinFont::SkinFont() {
  6. }
  7. SkinFont::~SkinFont() {
  8. if (!tempFn.isempty()) {
  9. #ifdef WIN32
  10. RemoveFontResource(tempFn);
  11. #else
  12. DebugString( "portme -- SkinFont::~SkinFont\n" );
  13. #endif
  14. UNLINK(tempFn);
  15. }
  16. }
  17. int SkinFont::setXmlOption(const char *paramname, const char *strvalue) {
  18. return 0;
  19. }
  20. void SkinFont::installFont(OSFNSTR filename, OSFNSTR path) {
  21. FILE *in,*out;
  22. StringPrintf temp("%s%s", path, filename);
  23. in = WFOPEN(temp, L"rb");
  24. if (!in) return;
  25. int len = FGETSIZE(in);
  26. MemBlock<char> m(len);
  27. FREAD(m.getMemory(), len, 1, in);
  28. tempFn = TMPNAM(NULL);
  29. out = FOPEN(tempFn, "wb");
  30. ASSERT(out);
  31. FWRITE(m.getMemory(), len, 1, out);
  32. FCLOSE(out);
  33. FCLOSE(in);
  34. #ifdef WIN32
  35. AddFontResource(tempFn);
  36. #else
  37. DebugString( "portme -- SkinFont::installFont\n" );
  38. #endif
  39. }