aboutsummaryrefslogtreecommitdiff
path: root/Src/Wasabi/api/font/skinfont.cpp
blob: d1987dfaa531e7be5847589560d58214e805d15f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "precomp.h"
#include "skinfont.h"
#include "api.h"
#include "../bfc/std.h"

SkinFont::SkinFont() {
}

SkinFont::~SkinFont() {
  if (!tempFn.isempty()) {
#ifdef WIN32
    RemoveFontResource(tempFn);
#else
    DebugString( "portme -- SkinFont::~SkinFont\n" );
#endif
    UNLINK(tempFn);
  }
}

int SkinFont::setXmlOption(const char *paramname, const char *strvalue) {
  return 0;
}

void SkinFont::installFont(OSFNSTR filename, OSFNSTR path) {
  FILE *in,*out;
  StringPrintf temp("%s%s", path, filename);
  in = WFOPEN(temp, L"rb");
  if (!in) return;
  int len = FGETSIZE(in);
  MemBlock<char> m(len);
  FREAD(m.getMemory(), len, 1, in);
  tempFn = TMPNAM(NULL);
  out = FOPEN(tempFn, "wb");
  ASSERT(out);
  FWRITE(m.getMemory(), len, 1, out);
  FCLOSE(out);
  FCLOSE(in);
#ifdef WIN32
  AddFontResource(tempFn);
#else
  DebugString( "portme -- SkinFont::installFont\n" );
#endif
}