ScummVM API documentation
wfn_font_renderer.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef AGS_SHARED_FONT_WFN_FONT_RENDERER_H
23 #define AGS_SHARED_FONT_WFN_FONT_RENDERER_H
24 
25 #include "common/std/map.h"
26 #include "ags/lib/std.h"
27 #include "ags/shared/font/ags_font_renderer.h"
28 
29 namespace AGS3 {
30 
31 class WFNFont;
32 
34 public:
35  // IAGSFontRenderer implementation
36  virtual ~WFNFontRenderer() {}
37 
38  bool LoadFromDisk(int fontNumber, int fontSize) override;
39  void FreeMemory(int fontNumber) override;
40  bool SupportsExtendedCharacters(int fontNumber) override;
41  int GetTextWidth(const char *text, int fontNumber) override;
42  int GetTextHeight(const char *text, int fontNumber) override;
43  void RenderText(const char *text, int fontNumber, BITMAP *destination, int x, int y, int colour) override;
44  void AdjustYCoordinateForFont(int *ycoord, int fontNumber) override;
45  void EnsureTextValidForFont(char *text, int fontNumber) override;
46 
47  // IAGSFontRenderer2 implementation
48  int GetVersion() override { return 26; /* first compatible engine API version */ }
49  const char *GetRendererName() override { return "WFNFontRenderer"; }
50  const char *GetFontName(int /*fontNumber*/) override { return ""; }
51  int GetFontHeight(int fontNumber) override { return 0; /* TODO? */ }
52  int GetLineSpacing(int fontNumber) override { return 0; /* no specific spacing */ }
53 
54  // IAGSFontRendererInternal implementation
55  bool IsBitmapFont() override;
56  bool LoadFromDiskEx(int fontNumber, int fontSize, AGS::Shared::String *src_filename,
57  const FontRenderParams *params, FontMetrics *metrics) override;
58  void GetFontMetrics(int fontNumber, FontMetrics *metrics) override { *metrics = FontMetrics(); }
59  void AdjustFontForAntiAlias(int /*fontNumber*/, bool /*aa_mode*/) override { /* do nothing */ }
60 
61 private:
62  struct FontData {
63  WFNFont *Font;
64  FontRenderParams Params;
65  };
66  std::map<int, FontData> _fontData;
67 };
68 
69 } // namespace AGS3
70 
71 #endif
Definition: surface.h:32
Definition: ags_font_renderer.h:75
Definition: fonts.h:43
Definition: ags_font_renderer.h:107
Definition: ags_font_renderer.h:82
Definition: string.h:62
Definition: wfn_font_renderer.h:33
Definition: wfn_font.h:86
Definition: ags.h:40