1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
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: 24480 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NW_FONT_PAIRFONT_H_
17 #define NW_FONT_PAIRFONT_H_
18 
19 #include <nn/types.h>
20 #include <nw/font/font_Font.h>
21 
22 
23 namespace nw {
24 namespace font {
25 
26 
27 //---------------------------------------------------------------------------
28 //! @brief        内部に2つのフォントを保持し、1つのフォントのように扱います。
29 //---------------------------------------------------------------------------
30 class PairFont
31     : public Font
32 {
33 public:
34     /* ------------------------------------------------------------------------
35             関数
36        ------------------------------------------------------------------------ */
37 
38     //! @name コンストラクタ / デストラクタ
39     //@{
40 
41     //! @brief      コンストラクタです。
42     //!
43     //! @param[in]  primary    フォントへのポインタ。
44     //! @param[in]  secondary  フォントへのポインタ。
45     //!
46                                 PairFont(
47                                     Font*   primary,
48                                     Font*   secondary);
49 
50     //! デストラクタです。
51     virtual                     ~PairFont();
52 
53     //@}
54 
55 
56     //! @name フォント情報の取得
57     //@{
58 
59     virtual int                 GetWidth() const;
60 
61     virtual int                 GetHeight() const;
62 
63     virtual int                 GetAscent() const;
64 
65     virtual int                 GetDescent() const;
66 
67     virtual int                 GetMaxCharWidth() const;
68 
69     virtual Type                GetType() const;
70 
71     virtual TexFmt              GetTextureFormat() const;
72 
73     virtual int                 GetLineFeed() const;
74 
75     virtual const CharWidths    GetDefaultCharWidths() const;
76 
77     //@}
78 
79 
80     //! @name フォント情報の設定
81     //@{
82 
83     virtual void                SetDefaultCharWidths(const CharWidths& widths);
84 
85     virtual bool                SetAlternateChar(CharCode c);
86 
87     virtual void                SetLineFeed(int linefeed);
88 
89     //@}
90 
91 
92     //! @name 文字情報の取得
93     //@{
94 
95     virtual int                 GetCharWidth(
96                                     CharCode c                      // 幅を求める文字
97                                 ) const;
98 
99     virtual const CharWidths    GetCharWidths(
100                                     CharCode c                      // 幅を求める文字
101                                 ) const;
102 
103     virtual void                GetGlyph(
104                                     Glyph*      glyph,              // グリフ情報を受け取るバッファ
105                                     CharCode    c                   // グリフ情報を取得する文字
106                                 ) const;
107     virtual bool                HasGlyph(
108                                     CharCode    c                   // グリフ情報の有無を取得する文字
109                                 ) const;
110 
111     //@}
112 
113 
114     //! @name 文字列エンコーディング
115     //@{
116 
117     virtual CharacterCode       GetCharacterCode() const;
118 
119     //@}
120 
121 
122     //! @name シート情報の取得
123     //@{
124 
125     virtual int                 GetBaselinePos() const;
126 
127     virtual int                 GetCellHeight() const;
128 
129     virtual int                 GetCellWidth() const;
130 
131     //@}
132 
133 
134     //! @name テクスチャ補間
135     //@{
136 
137     virtual void            EnableLinearFilter(
138                                 bool    atSmall,
139                                 bool    atLarge);
140 
141     virtual bool            IsLinearFilterEnableAtSmall() const;
142 
143     virtual bool            IsLinearFilterEnableAtLarge() const;
144 
145     virtual u32             GetTextureWrapFilterValue() const;
146 
147     //@}
148 
149 private:
150     /* ------------------------------------------------------------------------
151             変数
152        ------------------------------------------------------------------------ */
153     // フォントの実体へのポインタ
154     Font*                       m_Primary;
155     Font*                       m_Secondary;
156     // 代替文字を1つ目のフォントから取得するかどうか
157     bool                        m_AlternateWithPrimary;
158     u8                          m_Padding[3];
159 };
160 
161 
162 
163 
164 }   // namespace font
165 }   // namespace nw
166 #endif //  NW_FONT_PAIRFONT_H_
167