summaryrefslogtreecommitdiff
path: root/indra/llrender/llfontfreetype.cpp
diff options
context:
space:
mode:
authorMonroe Linden <monroe@lindenlab.com>2010-02-18 13:40:32 -0800
committerMonroe Linden <monroe@lindenlab.com>2010-02-18 13:40:32 -0800
commit08e3e05c0a1aa99bc6cf300191ea3c7feb97ff9a (patch)
tree3d039671b8fab5123beef3fc566842fefce08f8d /indra/llrender/llfontfreetype.cpp
parent3e8320201fb89ce01bed18dc1ab7a41811fd3982 (diff)
Additional optimizations to text reflow for EXT-5071.
Added versions of LLFontFreeType::getXAdvance() and LLFontFreeType::getXKerning() that take LLFontGlyphInfo* instead of llwchar. This allows code in LLFontGL that already has the LLFontGlyphInfo* to pass them instead, saving calls to LLFontFreetype::getGlyphInfo. Reviewed by Richard.
Diffstat (limited to 'indra/llrender/llfontfreetype.cpp')
-rw-r--r--indra/llrender/llfontfreetype.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp
index 22fad792da..a86bbbffff 100644
--- a/indra/llrender/llfontfreetype.cpp
+++ b/indra/llrender/llfontfreetype.cpp
@@ -270,6 +270,14 @@ F32 LLFontFreetype::getXAdvance(llwchar wch) const
return (F32)mFontBitmapCachep->getMaxCharWidth();
}
+F32 LLFontFreetype::getXAdvance(const LLFontGlyphInfo* glyph) const
+{
+ if (mFTFace == NULL)
+ return 0.0;
+
+ return glyph->mXAdvance;
+}
+
F32 LLFontFreetype::getXKerning(llwchar char_left, llwchar char_right) const
{
if (mFTFace == NULL)
@@ -289,6 +297,21 @@ F32 LLFontFreetype::getXKerning(llwchar char_left, llwchar char_right) const
return delta.x*(1.f/64.f);
}
+F32 LLFontFreetype::getXKerning(const LLFontGlyphInfo* left_glyph_info, const LLFontGlyphInfo* right_glyph_info) const
+{
+ if (mFTFace == NULL)
+ return 0.0;
+
+ U32 left_glyph = left_glyph_info ? left_glyph_info->mGlyphIndex : 0;
+ U32 right_glyph = right_glyph_info ? right_glyph_info->mGlyphIndex : 0;
+
+ FT_Vector delta;
+
+ llverify(!FT_Get_Kerning(mFTFace, left_glyph, right_glyph, ft_kerning_unfitted, &delta));
+
+ return delta.x*(1.f/64.f);
+}
+
BOOL LLFontFreetype::hasGlyph(llwchar wch) const
{
llassert(!mIsFallback);