aboutsummaryrefslogtreecommitdiff
path: root/textures/base/pack/unknown_item.png
blob: 35cabf0ad21f6a0a698e3482ad97ac87e0fec529 (plain)
ofshex dumpascii
0000 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 10 00 00 00 10 08 06 00 00 00 1f f3 ff .PNG........IHDR................
0020 61 00 00 00 01 73 52 47 42 00 ae ce 1c e9 00 00 00 06 62 4b 47 44 00 ff 00 ff 00 ff a0 bd a7 93 a....sRGB.........bKGD..........
0040 00 00 00 09 70 48 59 73 00 00 0e c4 00 00 0e c4 01 95 2b 0e 1b 00 00 00 07 74 49 4d 45 07 dc 01 ....pHYs..........+......tIME...
0060 03 05 28 37 65 d6 39 e4 00 00 02 46 49 44 41 54 38 cb 7d 93 41 4f 13 41 14 c7 7f 33 bb dd 4e 77 ..(7e.9....FIDAT8.}.AO.A...3..Nw
0080 4b c5 c4 c4 8f 60 0c 27 23 10 4f d2 14 13 cf 7e 02 49 24 1e 0c b4 7a 68 e0 e8 0d 08 07 58 ca cd K....`.'#.O....~.I$...zh.....X..
00a0 c6 94 ef 61 50 e3 c5 80 1f 85 83 d0 76 3a dd ee ce 78 58 76 a5 89 f1 5d 5e e6 cd 64 de ff fd ff ...aP.......v:...xXv...]^..d....
00c0 ff 27 1e b5 de 39 00 81 c0 f3 7c ac cd 28 c2 3a 8b f4 24 e1 c2 02 42 0a 00 9c 75 98 b1 c6 a6 59 .'...9....|..(.:..$...B...u....Y
00e0 7e 2f 85 44 0a 89 1f 54 b8 ff f0 01 f5 c5 7b a8 46 1d 55 0f 91 42 d2 fb dc c2 8c c7 4c 86 23 26 ~/.D...T......{.F.U..B......L.#&
0100 c3 11 66 ac 51 51 48 b4 d8 40 0a 89 ec 0d 5a a8 46 9d e3 4f cf 49 a6 53 f6 8e 9f 72 78 b2 8a 19 ..f.QQH..@....Z.F..O.I.S...rx...
0120 69 ac b3 00 04 4a 11 f7 9b b7 79 8d 83 78 05 55 ab 21 3d 89 04 30 37 a3 12 32 c0 4e e7 92 de a0 i....J....y..x.U.!=..07..2.N....
0140 55 8e 72 78 fa 8c ce e6 37 d2 64 06 c0 87 b7 3f f8 b8 b7 44 96 66 c8 ed 8d f3 f2 71 36 4b b9 1b U.rx....7.d....?...D.f.....q6K..
0160 7e a5 02 40 67 f3 3b 71 bf 89 af aa 79 3d c8 eb 42 08 c4 93 57 bb 0e 6b 31 5a 43 0e 00 e9 4b a4 ~..@g.;q....y=..B...W..k1ZC...K.
0180 f4 08 6a 0a eb 1c 58 4b 62 a6 d8 34 bb bd f7 08 54 15 a4 c4 2f e0 3b e7 f0 2a 3e b5 7a 84 73 0e ..j...XKb..4....T.../.;..*>.z.s.
01a0 44 de 21 1d 1b ac cd b0 a9 fd ab 4e 9a 91 18 93 7f 66 9d a5 37 68 71 7a b6 4e dc 5f a3 16 46 1c D.!........N.....f..7hqz.N._..F.
01c0 c4 2b 98 91 66 ff 68 19 5f 55 89 fb 4d 54 a3 4e 6f d0 a2 20 3d 08 43 82 30 cc 65 04 e8 6e fd 04 .+..f.h._U..MT.No...=.C.0.e..n..
01e0 e0 f7 d5 55 d9 05 20 d1 7a 2e 6f 6f 9c 73 78 b2 4a a2 35 89 d6 f8 aa 51 2f 99 06 b0 d6 96 2a 74 ...U....z.oo.sx.J.5....Q/.....*t
0200 db 17 c4 fd 26 dd f6 05 2a 8a ca f9 01 82 30 cc 89 7c bc be e5 0a 52 bc 8a 5f ba 2d 99 98 3b ae ....&...*.....0..|....R.._.-..;.
0220 14 a8 28 fc 37 a1 bd 41 0b 9b 66 cc a6 53 f6 8f 96 11 42 90 4c 0c 7e 50 c9 e7 54 0a 6b 33 f4 f5 ..(.7..A..f..S....B.L.~P..T.k3..
0240 10 73 33 c2 8c 34 e9 6c 86 75 16 eb 2c 62 e9 65 c7 a9 28 e4 20 5e 29 59 de e9 5c ce 9d b7 5e 7f .s3..4.l.u..,b.e..(..^)Y..\...^.
0260 e1 f4 ec c5 9c 47 b6 37 ce 73 04 71 7f 0d 80 f6 9b af 73 b9 30 50 6e 9c 00 80 dd f7 bf 4a c2 0b .....G.7.s.q......s.0Pn......J..
0280 35 7c 00 7d 3d cc b5 07 5c e6 30 e3 31 00 71 7f 8d 6e fb 82 6a 58 2b bd 02 30 9d 4c 28 56 40 14 5|.}=...\.0.1.q..n..jX+..0.L(V@.
02a0 eb fc bf b5 2d 42 fa 1e 2a ca d9 d7 c3 21 36 b3 fc 01 72 85 26 4d 6c 89 20 e4 00 00 00 00 49 45 ....-B..*....!6...r.&Ml.......IE
02c0 4e 44 ae 42 60 82 ND.B`.
a> 169 170 171 172
/*
Minetest
Copyright (C) 2010-2014 sapier <sapier at gmx dot net>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#pragma once

#include <map>
#include <vector>
#include "util/basic_macros.h"
#include <IGUIFont.h>
#include <IGUISkin.h>
#include <IGUIEnvironment.h>
#include "settings.h"

#define FONT_SIZE_UNSPECIFIED 0xFFFFFFFF

enum FontMode : u8 {
	FM_Standard = 0,
	FM_Mono,
	FM_Fallback,
	FM_Simple,
	FM_SimpleMono,
	FM_MaxMode,
	FM_Unspecified
};

struct FontSpec {
	FontSpec(unsigned int font_size, FontMode mode, bool bold, bool italic) :
		size(font_size),
		mode(mode),
		bold(bold),
		italic(italic) {}

	u16 getHash()
	{
		return (mode << 2) | (bold << 1) | italic;
	}

	unsigned int size;
	FontMode mode;
	bool bold;
	bool italic;
};

class FontEngine
{
public:

	FontEngine(Settings* main_settings, gui::IGUIEnvironment* env);

	~FontEngine();

	// Get best possible font specified by FontSpec
	irr::gui::IGUIFont *getFont(FontSpec spec);

	irr::gui::IGUIFont *getFont(unsigned int font_size=FONT_SIZE_UNSPECIFIED,
			FontMode mode=FM_Unspecified)
	{
		FontSpec spec(font_size, mode, m_default_bold, m_default_italic);
		return getFont(spec);
	}

	/** get text height for a specific font */
	unsigned int getTextHeight(const FontSpec &spec);

	/** get text width if a text for a specific font */
	unsigned int getTextHeight(
			unsigned int font_size=FONT_SIZE_UNSPECIFIED,
			FontMode mode=FM_Unspecified)
	{
		FontSpec spec(font_size, mode, m_default_bold, m_default_italic);
		return getTextHeight(spec);
	}

	unsigned int getTextWidth(const std::wstring &text, const FontSpec &spec);

	/** get text width if a text for a specific font */
	unsigned int getTextWidth(const std::wstring& text,
			unsigned int font_size=FONT_SIZE_UNSPECIFIED,
			FontMode mode=FM_Unspecified)
	{
		FontSpec spec(font_size, mode, m_default_bold, m_default_italic);
		return getTextWidth(text, spec);
	}

	unsigned int getTextWidth(const std::string &text, const FontSpec &spec)
	{
		return getTextWidth(utf8_to_wide(text), spec);
	}

	unsigned int getTextWidth(const std::string& text,
			unsigned int font_size=FONT_SIZE_UNSPECIFIED,
			FontMode mode=FM_Unspecified)
	{
		FontSpec spec(font_size, mode, m_default_bold, m_default_italic);
		return getTextWidth(utf8_to_wide(text), spec);
	}

	/** get line height for a specific font (including empty room between lines) */
	unsigned int getLineHeight(const FontSpec &spec);

	unsigned int getLineHeight(unsigned int font_size=FONT_SIZE_UNSPECIFIED,
			FontMode mode=FM_Unspecified)
	{
		FontSpec spec(font_size, mode, m_default_bold, m_default_italic);
		return getLineHeight(spec);
	}

	/** get default font size */
	unsigned int getDefaultFontSize();

	/** initialize font engine */
	void initialize(Settings* main_settings, gui::IGUIEnvironment* env);

	/** update internal parameters from settings */
	void readSettings();

private:
	/** update content of font cache in case of a setting change made it invalid */
	void updateFontCache();

	/** initialize a new font */