return 0.0f;
}
+void Controller::GetDefaultFonts( Vector<FontRun>& fonts, Length numberOfCharacters )
+{
+ if( mImpl->mFontDefaults )
+ {
+ FontRun fontRun;
+ fontRun.characterRun.characterIndex = 0;
+ fontRun.characterRun.numberOfCharacters = numberOfCharacters;
+ fontRun.fontId = mImpl->mFontDefaults->GetFontId( mImpl->mFontClient );
+ fontRun.isDefault = true;
+
+ fonts.PushBack( fontRun );
+ }
+}
+
void Controller::EnableTextInput( DecoratorPtr decorator )
{
if( !mImpl->mTextInput )
text.clear();
}
+ const Length numberOfCharacters = mImpl->mLogicalModel->GetNumberOfCharacters();
+
Vector<LineBreakInfo> lineBreakInfo;
if( GET_LINE_BREAKS & operations )
{
const bool validateFonts = VALIDATE_FONTS & operations;
Vector<ScriptRun> scripts;
- Vector<FontRun> fonts;
-
- if( mImpl->mFontDefaults )
- {
- // TODO - pass into ValidateFonts
- }
+ Vector<FontRun> validFonts;
if( getScripts || validateFonts )
{
if( validateFonts )
{
+ // Copy the requested font defaults received via the property system.
+ // These may not be valid i.e. may not contain glyphs for the necessary scripts.
+ GetDefaultFonts( validFonts, numberOfCharacters );
+
// Validates the fonts. If there is a character with no assigned font it sets a default one.
// After this call, fonts are validated.
multilanguageSupport.ValidateFonts( utf32Characters,
scripts,
- fonts );
+ validFonts );
// Sets the fonts into the model.
- mImpl->mLogicalModel->SetFonts( fonts.Begin(), fonts.Count() );
+ mImpl->mLogicalModel->SetFonts( validFonts.Begin(), validFonts.Count() );
}
}
// after the first time the text has been laid out.
// Fill the vectors again.
- const Length numberOfCharacters = mImpl->mLogicalModel->GetNumberOfCharacters();
-
if( 0u == utf32Characters.Count() )
{
utf32Characters.Resize( numberOfCharacters );
Vector<Length> charactersPerGlyph;
if( SHAPE_TEXT & operations )
{
+ if( 0u == validFonts.Count() )
+ {
+ validFonts.Resize( mImpl->mLogicalModel->GetNumberOfFontRuns( 0u,
+ numberOfCharacters ) );
+ mImpl->mLogicalModel->GetFontRuns( validFonts.Begin(),
+ 0u,
+ numberOfCharacters );
+ }
+
// Shapes the text.
ShapeText( utf32Characters,
lineBreakInfo,
scripts,
- fonts,
+ validFonts,
glyphs,
glyphsToCharactersMap,
charactersPerGlyph );