aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Xbox/Font/XUI_FontRenderer.h
blob: cffe2ed1aceee57e9a6693790690a4a228e325fe (plain)
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
49
#pragma once
using namespace std;
class XUI_FontData;
class XUI_Font;

// Define this to use this class as the XUI font renderer
#define OVERRIDE_XUI_FONT_RENDERER

//#define USE_SCALING_FONT

class XUI_FontRenderer : public IXuiFontRenderer
{
protected:
	enum eFontData
	{
		eFontData_MIN = 0,
		eFontData_Mojangles_7 = 0,
		eFontData_Mojangles_11,
		eFontData_MAX
	};

	// The font data is the image and size/coords data
	XUI_FontData *m_loadedFontData[eFontData_MAX];

	// The XUI_Font is a temporary instance that is around as long as XUI needs it, but does the actual rendering
	// These can be chained
	unordered_map<float, XUI_Font *> m_loadedFonts[eFontData_MAX];

public:
    XUI_FontRenderer();

	// 4J - IXuiFontRenderer interface 
    virtual HRESULT STDMETHODCALLTYPE Init( float fDpi );
    virtual VOID STDMETHODCALLTYPE Term();
    virtual HRESULT STDMETHODCALLTYPE GetCaps( DWORD * pdwCaps );
    virtual HRESULT STDMETHODCALLTYPE CreateFont( const TypefaceDescriptor * pTypefaceDescriptor, 
        float fPointSize, DWORD dwStyle, DWORD dwReserved, HFONTOBJ * phFont );
    virtual VOID STDMETHODCALLTYPE ReleaseFont( HFONTOBJ hFont );
    virtual HRESULT STDMETHODCALLTYPE GetFontMetrics( HFONTOBJ hFont, XUIFontMetrics *pFontMetrics );
    virtual HRESULT STDMETHODCALLTYPE GetCharMetrics( HFONTOBJ hFont, WCHAR wch, 
        XUICharMetrics *pCharMetrics );
    virtual HRESULT STDMETHODCALLTYPE DrawCharToTexture( HFONTOBJ hFont, WCHAR wch, HXUIDC hDC,
        IXuiTexture * pTexture, UINT x, UINT y, UINT width, UINT height, 
        UINT insetX, UINT insetY );
    virtual HRESULT STDMETHODCALLTYPE DrawCharsToDevice( HFONTOBJ hFont, CharData * pCharData, 
        DWORD dwCount, RECT *pClipRect, HXUIDC hDC, 
        D3DXMATRIX * pWorldViewProj );

};