font.h

来自「MONA是为数不多的C++语言编写的一个很小的操作系统」· C头文件 代码 · 共 44 行

H
44
字号
// This file is in the public domain.
// There are no restrictions on any sort of usage of this file.

#ifndef __SYSTEM_DRAWING_FONT_H__
#define __SYSTEM_DRAWING_FONT_H__

#include <gui/System/Drawing/Color.h>
#include <gui/System/String.h>
#include <gui/System/Pointer.h>
#include <gui/System/Drawing/Size.h>

namespace System { namespace Drawing
{
	class Graphics;
	
	/*internal*/ class FontChar;
	
	class Font : public Object
	{
	private:
		unsigned char* fontData;
		Size minimum, maximum;
		_A<FontChar*> table;
	
	public:
		virtual String get_TypeName() { return "System.Drawing.Font"; }
		Font(unsigned char* fontData);
		virtual ~Font();
	
		void Draw(_P<Graphics> g, String text, Color c, int x, int y);
		void Draw(_P<Graphics> g, wchar ch, Color c, int x, int y);
		Size GetSize(String text);
		Size GetSize(wchar ch);
		
		inline int get_Height() { return this->maximum.Height; }
	
	private:
		FontChar* GetFontChar(wchar ch);
		void Draw(_P<Graphics> g, FontChar* fc, Color c, int x, int y);
	};
}}

#endif  // __SYSTEM_DRAWING_FONT_H__

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?