diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llrender/llfont.cpp | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/linden/indra/llrender/llfont.cpp b/linden/indra/llrender/llfont.cpp index 4b5ee64..d7310bd 100644 --- a/linden/indra/llrender/llfont.cpp +++ b/linden/indra/llrender/llfont.cpp | |||
@@ -4,7 +4,7 @@ | |||
4 | * | 4 | * |
5 | * $LicenseInfo:firstyear=2002&license=viewergpl$ | 5 | * $LicenseInfo:firstyear=2002&license=viewergpl$ |
6 | * | 6 | * |
7 | * Copyright (c) 2002-2008, Linden Research, Inc. | 7 | * Copyright (c) 2002-2009, Linden Research, Inc. |
8 | * | 8 | * |
9 | * Second Life Viewer Source Code | 9 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 10 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -92,18 +92,18 @@ LLFontManager::~LLFontManager() | |||
92 | 92 | ||
93 | 93 | ||
94 | LLFontGlyphInfo::LLFontGlyphInfo(U32 index) | 94 | LLFontGlyphInfo::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 | ||
108 | LLFontList::LLFontList() | 108 | LLFontList::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 |