1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     font_PairFont.h
4 
5   Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law. They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Revision: 32255 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_FONT_FONT_PAIR_FONT_H_
17 #define NN_FONT_FONT_PAIR_FONT_H_
18 
19 #include <nn/types.h>
20 #include <nn/font/font_Font.h>
21 
22 
23 namespace nn {
24 namespace font {
25 
26 
27 //---------------------------------------------------------------------------
28 //
29 //---------------------------------------------------------------------------
30 class PairFont
31     : public Font
32 {
33 public:
34     /* ------------------------------------------------------------------------
35             Functions
36        ------------------------------------------------------------------------ */
37 
38     //
39     //
40 
41     //
42     //
43     //
44     //
45     //
46                                 PairFont(
47                                     Font*   primary,
48                                     Font*   secondary);
49 
50     //
51     virtual                     ~PairFont();
52 
53     //
54 
55     //
56     //  @{
57 
58     virtual int                 GetWidth() const;
59 
60     virtual int                 GetHeight() const;
61 
62     virtual int                 GetAscent() const;
63 
64     virtual int                 GetDescent() const;
65 
66     virtual int                 GetMaxCharWidth() const;
67 
68     virtual Type                GetType() const;
69 
70     virtual TexFmt              GetTextureFormat() const;
71 
72     virtual int                 GetLineFeed() const;
73 
74     virtual const CharWidths    GetDefaultCharWidths() const;
75 
76     //  @}
77 
78     //
79     //  @{
80 
81     virtual void                SetDefaultCharWidths(
82                                     const CharWidths& widths        // New default width
83                                 );
84 
85     virtual bool                SetAlternateChar(
86                                     CharCode c );                   // New alternate character
87 
88     virtual void                SetLineFeed(
89                                     int linefeed );                 // New line feed width
90 
91     //  @}
92 
93 
94     //
95     //  @{
96 
97     virtual int                 GetCharWidth(
98                                     CharCode c                      // Character whose width is to be found
99                                 ) const;
100 
101     virtual const CharWidths    GetCharWidths(
102                                     CharCode c                      // Character whose width is to be found
103                                 ) const;
104 
105     virtual void                GetGlyph(
106                                     Glyph*      glyph,              // Buffer used to receive glyph information
107                                     CharCode    c                   // Character to obtain glyph information for.
108                                 ) const;
109     virtual bool                HasGlyph(
110                                     CharCode    c                   // Character for which to get whether glyph information is present
111                                 ) const;
112 
113     //  @}
114 
115 
116     //
117     //  @{
118 
119     virtual CharacterCode       GetCharacterCode() const;
120 
121     //  @}
122 
123 
124     //
125     //  @{
126 
127     virtual int                 GetBaselinePos() const;
128 
129     virtual int                 GetCellHeight() const;
130 
131     virtual int                 GetCellWidth() const;
132 
133     //  @}
134 
135     //
136     //  @{
137 
138     virtual void            EnableLinearFilter(
139                                 bool    atSmall,
140                                 bool    atLarge);
141 
142     virtual bool            IsLinearFilterEnableAtSmall() const;
143 
144     virtual bool            IsLinearFilterEnableAtLarge() const;
145 
146     virtual u32             GetTextureWrapFilterValue() const;
147 
148     //  @}
149 
150 private:
151     /* ------------------------------------------------------------------------
152             Variables
153        ------------------------------------------------------------------------ */
154     // Pointer to font instance.
155     Font*                       m_Primary;
156     Font*                       m_Secondary;
157     // Whether to get the alternate character from the first font.
158     bool                        m_AlternateWithPrimary;
159     u8                          m_Padding[3];
160 };
161 
162 
163 
164 
165 }   // namespace font
166 }   // namespace nn
167 #endif //  NN_FONT_FONT_PAIR_FONT_H_
168