aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llrender/llfont.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-12-01 17:39:58 -0600
committerJacek Antonelli2008-12-01 17:40:06 -0600
commit7abecb48babe6a6f09bf6692ba55076546cfced9 (patch)
tree8d18a88513fb97adf32c10aae78f4be1984942db /linden/indra/llrender/llfont.cpp
parentSecond Life viewer sources 1.21.6 (diff)
downloadmeta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.zip
meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.tar.gz
meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.tar.bz2
meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.tar.xz
Second Life viewer sources 1.22.0-RC
Diffstat (limited to 'linden/indra/llrender/llfont.cpp')
-rw-r--r--linden/indra/llrender/llfont.cpp31
1 files changed, 18 insertions, 13 deletions
diff --git a/linden/indra/llrender/llfont.cpp b/linden/indra/llrender/llfont.cpp
index 4b5ee64..bcd0aca 100644
--- a/linden/indra/llrender/llfont.cpp
+++ b/linden/indra/llrender/llfont.cpp
@@ -92,18 +92,18 @@ LLFontManager::~LLFontManager()
92 92
93 93
94LLFontGlyphInfo::LLFontGlyphInfo(U32 index) 94LLFontGlyphInfo::LLFontGlyphInfo(U32 index)
95{ 95: mGlyphIndex(index),
96 mGlyphIndex = index; 96 mXBitmapOffset(0), // Offset to the origin in the bitmap
97 mXBitmapOffset = 0; // Offset to the origin in the bitmap 97 mYBitmapOffset(0), // Offset to the origin in the bitmap
98 mYBitmapOffset = 0; // Offset to the origin in the bitmap 98 mXBearing(0), // Distance from baseline to left in pixels
99 mXBearing = 0; // Distance from baseline to left in pixels 99 mYBearing(0), // Distance from baseline to top in pixels
100 mYBearing = 0; // Distance from baseline to top in pixels 100 mWidth(0), // In pixels
101 mWidth = 0; // In pixels 101 mHeight(0), // In pixels
102 mHeight = 0; // In pixels 102 mXAdvance(0.f), // In pixels
103 mXAdvance = 0.f; // In pixels 103 mYAdvance(0.f), // In pixels
104 mYAdvance = 0.f; // In pixels 104 mIsRendered(FALSE),
105 mIsRendered = FALSE; 105 mMetricsValid(FALSE)
106} 106{}
107 107
108LLFontList::LLFontList() 108LLFontList::LLFontList()
109{ 109{
@@ -303,6 +303,9 @@ void LLFont::resetBitmap()
303 iter != mCharGlyphInfoMap.end(); ++iter) 303 iter != mCharGlyphInfoMap.end(); ++iter)
304 { 304 {
305 iter->second->mIsRendered = FALSE; 305 iter->second->mIsRendered = FALSE;
306 //FIXME: this is only strictly necessary when resetting the entire font,
307 //not just flushing the bitmap
308 iter->second->mMetricsValid = FALSE;
306 } 309 }
307 mRawImagep->clear(255, 0); 310 mRawImagep->clear(255, 0);
308 mCurrentOffsetX = 1; 311 mCurrentOffsetX = 1;
@@ -439,6 +442,7 @@ BOOL LLFont::addGlyphFromFont(LLFont *fontp, const llwchar wch, const U32 glyph_
439 gi->mXAdvance = fontp->mFTFace->glyph->advance.x / 64.f; 442 gi->mXAdvance = fontp->mFTFace->glyph->advance.x / 64.f;
440 gi->mYAdvance = fontp->mFTFace->glyph->advance.y / 64.f; 443 gi->mYAdvance = fontp->mFTFace->glyph->advance.y / 64.f;
441 gi->mIsRendered = TRUE; 444 gi->mIsRendered = TRUE;
445 gi->mMetricsValid = TRUE;
442 446
443 insertGlyphInfo(wch, gi); 447 insertGlyphInfo(wch, gi);
444 448
@@ -528,7 +532,7 @@ F32 LLFont::getXAdvance(const llwchar wch) const
528 532
529 // Return existing info only if it is current 533 // Return existing info only if it is current
530 LLFontGlyphInfo* gi = getGlyphInfo(wch); 534 LLFontGlyphInfo* gi = getGlyphInfo(wch);
531 if (gi && gi->mIsRendered) 535 if (gi && gi->mMetricsValid)
532 { 536 {
533 return gi->mXAdvance; 537 return gi->mXAdvance;
534 } 538 }
@@ -573,6 +577,7 @@ F32 LLFont::getXAdvance(const llwchar wch) const
573 // Convert these from 26.6 units to float pixels. 577 // Convert these from 26.6 units to float pixels.
574 gi->mXAdvance = fontp->mFTFace->glyph->advance.x / 64.f; 578 gi->mXAdvance = fontp->mFTFace->glyph->advance.x / 64.f;
575 gi->mYAdvance = fontp->mFTFace->glyph->advance.y / 64.f; 579 gi->mYAdvance = fontp->mFTFace->glyph->advance.y / 64.f;
580 gi->mMetricsValid = TRUE;
576 return gi->mXAdvance; 581 return gi->mXAdvance;
577 } 582 }
578 else 583 else