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: 32031 $
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 //! @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     //! @name   フォント情報の取得
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     //! @name フォント情報の設定
79     //  @{
80 
81     virtual void                SetDefaultCharWidths(
82                                     const CharWidths& widths        // 新しいデフォルト幅
83                                 );
84 
85     virtual bool                SetAlternateChar(
86                                     CharCode c );                   // 新しい代替文字
87 
88     virtual void                SetLineFeed(
89                                     int linefeed );                 // 新しい改行幅
90 
91     //  @}
92 
93 
94     //! @name 文字情報の取得
95     //  @{
96 
97     virtual int                 GetCharWidth(
98                                     CharCode c                      // 幅を求める文字
99                                 ) const;
100 
101     virtual const CharWidths    GetCharWidths(
102                                     CharCode c                      // 幅を求める文字
103                                 ) const;
104 
105     virtual void                GetGlyph(
106                                     Glyph*      glyph,              // グリフ情報を受け取るバッファ
107                                     CharCode    c                   // グリフ情報を取得する文字
108                                 ) const;
109     virtual bool                HasGlyph(
110                                     CharCode    c                   // グリフ情報の有無を取得する文字
111                                 ) const;
112 
113     //  @}
114 
115 
116     //! @name 文字列エンコーディング
117     //  @{
118 
119     virtual CharacterCode       GetCharacterCode() const;
120 
121     //  @}
122 
123 
124     //! @name シート情報の取得
125     //  @{
126 
127     virtual int                 GetBaselinePos() const;
128 
129     virtual int                 GetCellHeight() const;
130 
131     virtual int                 GetCellWidth() const;
132 
133     //  @}
134 
135     //! @name テクスチャ補間
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             変数
153        ------------------------------------------------------------------------ */
154     // フォントの実体へのポインタ
155     Font*                       m_Primary;
156     Font*                       m_Secondary;
157     // 代替文字を1つ目のフォントから取得するかどうか
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