/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali-toolkit/internal/text/shaper.h>
#include <dali-toolkit/internal/text/text-controller-impl.h>
#include <dali-toolkit/internal/text/markup-processor.h>
+#include <dali-toolkit/internal/text/hyphenator.h>
namespace Dali
{
Size& layoutSize,
ModelPtr& textModel,
MetricsPtr& metrics,
- bool markupProcessorEnabled )
+ bool markupProcessorEnabled,
+ LineWrap::Mode wrapMode )
{
textModel = Model::New(); ///< Pointer to the text's model.
LogicalModelPtr logicalModel = textModel->mLogicalModel;
MarkupProcessData markupProcessData( logicalModel->mColorRuns,
logicalModel->mFontDescriptionRuns,
- logicalModel->mEmbeddedItems );
+ logicalModel->mEmbeddedItems,
+ logicalModel->mAnchors,
+ logicalModel->mUnderlinedCharacterRuns);
Length textSize = 0u;
const uint8_t* utf8 = NULL;
return;
}
+ textModel->mLineWrapMode = wrapMode;
+
+ if(textModel->mLineWrapMode == ((Text::LineWrap::Mode)DevelText::LineWrap::HYPHENATION) ||
+ textModel->mLineWrapMode == ((Text::LineWrap::Mode)DevelText::LineWrap::MIXED))
+ {
+ CharacterIndex end = characterCount;
+ LineBreakInfo* lineBreakInfoBuffer = lineBreakInfo.Begin();
+
+ for(CharacterIndex index = 0; index < end; index++)
+ {
+ CharacterIndex wordEnd = index;
+ while((*(lineBreakInfoBuffer + wordEnd) != TextAbstraction::LINE_ALLOW_BREAK) && (*(lineBreakInfoBuffer + wordEnd) != TextAbstraction::LINE_MUST_BREAK))
+ {
+ wordEnd++;
+ }
+
+ if((wordEnd + 1) == end) // add last char
+ {
+ wordEnd++;
+ }
+
+ Vector<bool> hyphens = GetWordHyphens(utf32Characters.Begin() + index, wordEnd - index, nullptr);
+
+ for(CharacterIndex i = 0; i < (wordEnd - index); i++)
+ {
+ if(hyphens[i])
+ {
+ *(lineBreakInfoBuffer + index + i) = TextAbstraction::LINE_HYPHENATION_BREAK;
+ }
+ }
+
+ index = wordEnd;
+ }
+ }
+
// 3) Set the script info.
MultilanguageSupport multilanguageSupport = MultilanguageSupport::Get();
// Set the layout parameters.
textModel->mHorizontalAlignment = Text::HorizontalAlignment::BEGIN;
- textModel->mLineWrapMode = LineWrap::WORD;
textModel->mIgnoreSpacesAfterText = true;
textModel->mMatchSystemLanguageDirection = false;
Layout::Parameters layoutParameters( textArea,
bool isAutoScroll = false;
layoutEngine.LayoutText( layoutParameters,
- glyphPositions,
- lines,
layoutSize,
false,
isAutoScroll );
- // 10) Reorder the lines
- if( 0u != bidirectionalInfo.Count() )
- {
- Vector<BidirectionalLineInfoRun>& bidirectionalLineInfo = logicalModel->mBidirectionalLineInfo;
-
- // Get the lines
- const Length numberOfLines = lines.Count();
-
- // Reorder the lines.
- bidirectionalLineInfo.Reserve( numberOfLines ); // Reserve because is not known yet how many lines have right to left characters.
- ReorderLines( bidirectionalInfo,
- 0u,
- characterCount,
- lines,
- bidirectionalLineInfo );
-
- // Set the bidirectional info per line into the layout parameters.
- layoutParameters.lineBidirectionalInfoRunsBuffer = bidirectionalLineInfo.Begin();
- layoutParameters.numberOfBidirectionalInfoRuns = bidirectionalLineInfo.Count();
-
- if( options.reorder )
- {
- // Re-layout the text. Reorder those lines with right to left characters.
- layoutEngine.ReLayoutRightToLeftLines( layoutParameters,
- 0u,
- characterCount,
- glyphPositions );
- }
- }
-
if( options.align )
{
float alignmentOffset = 0.f;
// Enable the text elide.
controller->SetTextElideEnabled( true );
+
+ // Disable match system language direction
+ controller->SetMatchSystemLanguageDirection(false);
}
void ConfigureTextField( ControllerPtr controller )
// Disable the text elide.
controller->SetTextElideEnabled( false );
+
+ // Disable match system language direction
+ controller->SetMatchSystemLanguageDirection(false);
}
void ConfigureTextEditor( ControllerPtr controller )
// Disable the text elide.
controller->SetTextElideEnabled( false );
+
+ // Disable match system language direction
+ controller->SetMatchSystemLanguageDirection(false);
}
} // namespace Text