aboutsummaryrefslogtreecommitdiff
path: root/Src/Wasabi/api/skin/skinfont.cpp
blob: 1c370e3fdfdf130aeb84b7b4b53a80c1f89b7e48 (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
44
45
46
47
48
#include <precomp.h>

#include "skinfont.h"

#include <bfc/wasabi_std.h>

SkinFont::SkinFont()
{}

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

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

void SkinFont::installFont(const wchar_t *filename, const wchar_t *path)
{
	OSFILETYPE in, out;
	StringPathCombine temp(path, filename);
	in = WFOPEN(temp, WF_READONLY_BINARY);
	if (in == OPEN_FAILED) return ;
	int len = (int)FGETSIZE(in);
	MemBlock<char> m(len);
	FREAD(m.getMemory(), len, 1, in);
	tempFn = TMPNAM(NULL);
	out = WFOPEN(tempFn, WF_WRITE_BINARY);
	ASSERT(out != OPEN_FAILED);
	FWRITE(m.getMemory(), len, 1, out);
	FCLOSE(out);
	FCLOSE(in);
#ifdef WIN32
	AddFontResourceW(tempFn);
#else
	DebugString( "portme -- SkinFont::installFont\n" );
#endif
}