moai/src/moaicore/MOAIFont.cpp
//----------------------------------------------------------------//
// iterate through the pending glyphs in each set and attempt to
// update them to match target - i.e. metrics or metrics and bitmap
iterate through the pending glyphs in each set and attempt to
update them to match target - i.e. metrics or metrics and bitmap
iterate through the pending glyphs in each set and attempt to update them to match target - i . e . metrics or metrics and bitmap
void MOAIFont::ProcessGlyphs () {
	if ( !this->mReader ) return;
	bool fontIsOpen = false;
	MOAIFont::GlyphSetsIt glyphSetsIt = this->mGlyphSets.begin ();
	for ( ; glyphSetsIt != this->mGlyphSets.end (); ++glyphSetsIt ) {
		MOAIGlyphSet& glyphSet = glyphSetsIt->second;
		MOAIGlyph* glyphs = glyphSet.mGlyphs;
		MOAIGlyph* pendingGlyphs = glyphSet.mPending;
		glyphSet.mPending = 0;
		if ( !pendingGlyphs ) continue;
		if ( !fontIsOpen ) {
			this->mReader->OpenFont ( *this );
			fontIsOpen = true;
		}
		this->mReader->SetFaceSize ( glyphSet.mSize );
		this->mReader->GetFaceMetrics ( glyphSet );
		if (( this->mFlags & FONT_AUTOLOAD_KERNING ) && this->mReader->HasKerning ()) {
			this->BuildKerning ( glyphs, pendingGlyphs );
		}
		for ( MOAIGlyph* glyphIt = pendingGlyphs; glyphIt; ) {
			MOAIGlyph& glyph = *glyphIt;
			glyphIt = glyphIt->mNext;
			glyph.mNext = glyphSet.mGlyphs;
			glyphSet.mGlyphs = &glyph;
			this->mReader->RenderGlyph ( *this, glyph );
		}
	}
	if ( fontIsOpen ) {
		this->mReader->CloseFont ();
	}
}
void MOAIFont :: ProcessGlyphs ( ) { if ( ! this -> mReader ) return ; bool fontIsOpen = false ; MOAIFont :: GlyphSetsIt glyphSetsIt = this -> mGlyphSets . begin ( ) ; for ( ; glyphSetsIt != this -> mGlyphSets . end ( ) ; ++ glyphSetsIt ) { MOAIGlyphSet & glyphSet = glyphSetsIt -> second ; MOAIGlyph * glyphs = glyphSet . mGlyphs ; MOAIGlyph * pendingGlyphs = glyphSet . mPending ; glyphSet . mPending = 0 ; if ( ! pendingGlyphs ) continue ; if ( ! fontIsOpen ) { this -> mReader -> OpenFont ( * this ) ; fontIsOpen = true ; } this -> mReader -> SetFaceSize ( glyphSet . mSize ) ; this -> mReader -> GetFaceMetrics ( glyphSet ) ; if ( ( this -> mFlags & FONT_AUTOLOAD_KERNING ) && this -> mReader -> HasKerning ( ) ) { this -> BuildKerning ( glyphs , pendingGlyphs ) ; } for ( MOAIGlyph * glyphIt = pendingGlyphs ; glyphIt ; ) { MOAIGlyph & glyph = * glyphIt ; glyphIt = glyphIt -> mNext ; glyph . mNext = glyphSet . mGlyphs ; glyphSet . mGlyphs = & glyph ; this -> mReader -> RenderGlyph ( * this , glyph ) ; } } if ( fontIsOpen ) { this -> mReader -> CloseFont ( ) ; } }
iterate through the pending glyphs in each set and attempt to
update them to match target - i.e.
iterate through the pending glyphs in each set and attempt to update them to match target - i . e .
// save pointers to the two glyph lists // all pending glyphs will be moved to the processed glyphs list // so clear the pending glyphs list // if no pending glyphs, move on to the next deck // get the face metrics // build kerning tables (if face has kerning info) //----------------------------------------------------------------// // render the new glyphs and move them to the processed list // move the glyph into the processed glyphs list