1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     font_PairFont.h
4 
5   Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain proprietary
8   information of Nintendo and/or its licensed developers and are protected by
9   national and international copyright laws. They may not be disclosed to third
10   parties or copied or duplicated in any form, in whole or in part, without the
11   prior written consent of Nintendo.
12 
13   The content herein is highly confidential and should be handled accordingly.
14 
15   $Revision: 31311 $
16  *---------------------------------------------------------------------------*/
17 
18 #ifndef NW_FONT_PAIRFONT_H_
19 #define NW_FONT_PAIRFONT_H_
20 
21 #include <nn/types.h>
22 #include <nw/font/font_Font.h>
23 
24 
25 namespace nw {
26 namespace font {
27 
28 
29 //---------------------------------------------------------------------------
30 //! @brief        内部に2つのフォントを保持し、1つのフォントのように扱います。
31 //---------------------------------------------------------------------------
32 class PairFont
33     : public Font
34 {
35 public:
36     /* ------------------------------------------------------------------------
37             関数
38        ------------------------------------------------------------------------ */
39 
40     //! @name コンストラクタ / デストラクタ
41     //@{
42 
43     //! @brief      コンストラクタです。
44     //!
45     //! @param[in]  primary    フォントへのポインタ。
46     //! @param[in]  secondary  フォントへのポインタ。
47     //!
48                                 PairFont(
49                                     Font*   primary,
50                                     Font*   secondary);
51 
52     //! デストラクタです。
53     virtual                     ~PairFont();
54 
55     //@}
56 
57 
58     //! @name フォント情報の取得
59     //@{
60 
61     virtual int                 GetWidth() const;
62 
63     virtual int                 GetHeight() const;
64 
65     virtual int                 GetAscent() const;
66 
67     virtual int                 GetDescent() const;
68 
69     virtual int                 GetMaxCharWidth() const;
70 
71     virtual Type                GetType() const;
72 
73     virtual TexFmt              GetTextureFormat() const;
74 
75     virtual int                 GetLineFeed() const;
76 
77     virtual const CharWidths    GetDefaultCharWidths() const;
78 
79     //@}
80 
81 
82     //! @name フォント情報の設定
83     //@{
84 
85     virtual void                SetDefaultCharWidths(const CharWidths& widths);
86 
87     virtual bool                SetAlternateChar(CharCode c);
88 
89     virtual void                SetLineFeed(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 
136     //! @name テクスチャ補間
137     //@{
138 
139     virtual void            EnableLinearFilter(
140                                 bool    atSmall,
141                                 bool    atLarge);
142 
143     virtual bool            IsLinearFilterEnableAtSmall() const;
144 
145     virtual bool            IsLinearFilterEnableAtLarge() const;
146 
147     virtual u32             GetTextureWrapFilterValue() const;
148 
149     //@}
150 
151 private:
152     /* ------------------------------------------------------------------------
153             変数
154        ------------------------------------------------------------------------ */
155     // フォントの実体へのポインタ
156     Font*                       m_Primary;
157     Font*                       m_Secondary;
158     // 代替文字を1つ目のフォントから取得するかどうか
159     bool                        m_AlternateWithPrimary;
160     u8                          m_Padding[3];
161 };
162 
163 
164 
165 
166 }   // namespace font
167 }   // namespace nw
168 #endif //  NW_FONT_PAIRFONT_H_
169