diff options
author | Jacek Antonelli | 2009-04-30 13:04:20 -0500 |
---|---|---|
committer | Jacek Antonelli | 2009-04-30 13:07:16 -0500 |
commit | ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch) | |
tree | 8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/llrender/llfont.h | |
parent | Second Life viewer sources 1.22.11 (diff) | |
download | meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2 meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz |
Second Life viewer sources 1.23.0-RC
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llrender/llfont.h | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/linden/indra/llrender/llfont.h b/linden/indra/llrender/llfont.h index bce8d76..b423f7d 100644 --- a/linden/indra/llrender/llfont.h +++ b/linden/indra/llrender/llfont.h | |||
@@ -17,7 +17,8 @@ | |||
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | 20 | * online at |
21 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
21 | * | 22 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 23 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 24 | * that you have read and understood your obligations described above, |
@@ -37,6 +38,9 @@ | |||
37 | #include "llmemory.h" | 38 | #include "llmemory.h" |
38 | #include "llstl.h" | 39 | #include "llstl.h" |
39 | 40 | ||
41 | #include "llimagegl.h" | ||
42 | #include "llfontbitmapcache.h" | ||
43 | |||
40 | class LLImageRaw; | 44 | class LLImageRaw; |
41 | class LLFontManager; | 45 | class LLFontManager; |
42 | class LLFont; | 46 | class LLFont; |
@@ -80,6 +84,7 @@ public: | |||
80 | S32 mYBitmapOffset; // Offset to the origin in the bitmap | 84 | S32 mYBitmapOffset; // Offset to the origin in the bitmap |
81 | S32 mXBearing; // Distance from baseline to left in pixels | 85 | S32 mXBearing; // Distance from baseline to left in pixels |
82 | S32 mYBearing; // Distance from baseline to top in pixels | 86 | S32 mYBearing; // Distance from baseline to top in pixels |
87 | S32 mBitmapNum; // Which bitmap in the bitmap cache contains this glyph | ||
83 | }; | 88 | }; |
84 | 89 | ||
85 | // Used for lists of fallback fonts | 90 | // Used for lists of fallback fonts |
@@ -91,14 +96,14 @@ public: | |||
91 | void addAtEnd(LLFont *font); | 96 | void addAtEnd(LLFont *font); |
92 | }; | 97 | }; |
93 | 98 | ||
94 | |||
95 | class LLFont | 99 | class LLFont |
96 | { | 100 | { |
97 | public: | 101 | public: |
98 | LLFont(LLImageRaw *imagep = NULL); | 102 | LLFont(); |
99 | virtual ~LLFont(); | 103 | virtual ~LLFont(); |
100 | 104 | ||
101 | // is_fallback should be true for fallback fonts that aren't used to render directly (Unicode backup, primarily) | 105 | // is_fallback should be true for fallback fonts that aren't used |
106 | // to render directly (Unicode backup, primarily) | ||
102 | virtual BOOL loadFace(const std::string& filename, | 107 | virtual BOOL loadFace(const std::string& filename, |
103 | const F32 point_size, | 108 | const F32 point_size, |
104 | const F32 vert_dpi, | 109 | const F32 vert_dpi, |
@@ -108,7 +113,6 @@ public: | |||
108 | void setFallbackFont(LLFontList *fontp) { mFallbackFontp = fontp; } | 113 | void setFallbackFont(LLFontList *fontp) { mFallbackFontp = fontp; } |
109 | 114 | ||
110 | void setCharToGlyphMap(llwchar wch, U32 glyph_index) const; | 115 | void setCharToGlyphMap(llwchar wch, U32 glyph_index) const; |
111 | void setRawImage( LLImageRaw *imagep ); | ||
112 | 116 | ||
113 | // Global font metrics - in units of pixels | 117 | // Global font metrics - in units of pixels |
114 | virtual F32 getLineHeight() const; | 118 | virtual F32 getLineHeight() const; |
@@ -145,31 +149,29 @@ public: | |||
145 | const LLFontGlyphInfo &getMetrics(const llwchar wc) const; | 149 | const LLFontGlyphInfo &getMetrics(const llwchar wc) const; |
146 | F32 getXAdvance(const llwchar wc) const; | 150 | F32 getXAdvance(const llwchar wc) const; |
147 | F32 getXKerning(const llwchar char_left, const llwchar char_right) const; // Get the kerning between the two characters | 151 | F32 getXKerning(const llwchar char_left, const llwchar char_right) const; // Get the kerning between the two characters |
152 | virtual void reset() = 0; | ||
153 | |||
148 | protected: | 154 | protected: |
149 | virtual BOOL hasGlyph(const llwchar wch) const; // Has a glyph for this character | 155 | virtual BOOL hasGlyph(const llwchar wch) const; // Has a glyph for this character |
150 | virtual BOOL addChar(const llwchar wch); // Add a new character to the font if necessary | 156 | virtual BOOL addChar(const llwchar wch) const; // Add a new character to the font if necessary |
151 | virtual BOOL addGlyph(const llwchar wch, const U32 glyph_index); // Add a new glyph to the existing font | 157 | virtual BOOL addGlyph(const llwchar wch, const U32 glyph_index) const; // Add a new glyph to the existing font |
152 | virtual BOOL addGlyphFromFont(LLFont *fontp, const llwchar wch, const U32 glyph_index); // Add a glyph from this font to the other (returns the glyph_index, 0 if not found) | 158 | virtual BOOL addGlyphFromFont(const LLFont *fontp, const llwchar wch, const U32 glyph_index) const; // Add a glyph from this font to the other (returns the glyph_index, 0 if not found) |
153 | 159 | ||
154 | virtual LLFontGlyphInfo* getGlyphInfo(const llwchar wch) const; | 160 | virtual LLFontGlyphInfo* getGlyphInfo(const llwchar wch) const; |
155 | 161 | ||
156 | void insertGlyphInfo(llwchar wch, LLFontGlyphInfo* gi) const; | 162 | void insertGlyphInfo(llwchar wch, LLFontGlyphInfo* gi) const; |
157 | void renderGlyph(const U32 glyph_index); | 163 | void renderGlyph(const U32 glyph_index) const; |
164 | |||
165 | void resetBitmapCache(); | ||
158 | 166 | ||
159 | void resetBitmap(); // Reset bitmap to contain only the null glyph | ||
160 | protected: | 167 | protected: |
161 | std::string mName; | 168 | std::string mName; |
169 | F32 mPointSize; | ||
162 | F32 mAscender; | 170 | F32 mAscender; |
163 | F32 mDescender; | 171 | F32 mDescender; |
164 | F32 mLineHeight; | 172 | F32 mLineHeight; |
165 | 173 | ||
166 | S32 mNumComponents; | 174 | mutable LLPointer<LLFontBitmapCache> mFontBitmapCachep; |
167 | S32 mBitmapWidth; | ||
168 | S32 mBitmapHeight; | ||
169 | S32 mMaxCharWidth; | ||
170 | S32 mMaxCharHeight; | ||
171 | S32 mCurrentOffsetX; | ||
172 | S32 mCurrentOffsetY; | ||
173 | 175 | ||
174 | LLFT_Face mFTFace; | 176 | LLFT_Face mFTFace; |
175 | 177 | ||
@@ -181,14 +183,14 @@ protected: | |||
181 | 183 | ||
182 | BOOL mValid; | 184 | BOOL mValid; |
183 | void setSubImageLuminanceAlpha(const U32 x, | 185 | void setSubImageLuminanceAlpha(const U32 x, |
184 | const U32 y, | 186 | const U32 y, |
185 | const U32 width, | 187 | const U32 bitmap_num, |
186 | const U32 height, | 188 | const U32 width, |
187 | const U8 *data, | 189 | const U32 height, |
188 | S32 stride = 0); | 190 | const U8 *data, |
189 | 191 | S32 stride = 0) const; | |
190 | private: | 192 | mutable S32 mRenderGlyphCount; |
191 | LLPointer<LLImageRaw> mRawImagep; // Bitmaps of glyphs are stored here. | 193 | mutable S32 mAddGlyphCount; |
192 | }; | 194 | }; |
193 | 195 | ||
194 | #endif // LL_FONT_ | 196 | #endif // LL_FONT_ |