CombineImageBuffer(imageBuffer, outlineImageBuffer, bufferWidth, bufferHeight, true);
}
- // @todo. Support shadow and underline for partial text later on.
+ // @todo. Support shadow for partial text later on.
// Generate the shadow if enabled
const Vector2& shadowOffset = mModel->GetShadowOffset();
CombineImageBuffer(imageBuffer, shadowImageBuffer, bufferWidth, bufferHeight, true);
}
- // Generate the underline if enabled
- const bool underlineEnabled = mModel->IsUnderlineEnabled();
- if(underlineEnabled && RENDER_OVERLAY_STYLE == behaviour)
- {
- // Create the image buffer for underline
- Devel::PixelBuffer underlineImageBuffer = CreateImageBuffer(bufferWidth, bufferHeight, Typesetter::STYLE_UNDERLINE, ignoreHorizontalAlignment, pixelFormat, penX, penY, startIndexOfGlyphs, endIndexOfGlyphs);
-
- // Combine the two buffers
- CombineImageBuffer(imageBuffer, underlineImageBuffer, bufferWidth, bufferHeight, true);
- }
-
// Generate the background if enabled
const bool backgroundEnabled = mModel->IsBackgroundEnabled();
const bool backgroundMarkupSet = mModel->IsMarkupBackgroundColorSet();
CombineImageBuffer(imageBuffer, backgroundImageBuffer, bufferWidth, bufferHeight, true);
}
- // Generate the strikethrough if enabled
- const bool strikethroughEnabled = mModel->IsStrikethroughEnabled();
- if(strikethroughEnabled && RENDER_OVERLAY_STYLE == behaviour)
+ if(RENDER_OVERLAY_STYLE == behaviour)
{
- // Create the image buffer for strikethrough
- Devel::PixelBuffer strikethroughImageBuffer = CreateImageBuffer(bufferWidth, bufferHeight, Typesetter::STYLE_STRIKETHROUGH, ignoreHorizontalAlignment, pixelFormat, penX, penY, 0u, endIndexOfGlyphs);
+ if(mModel->IsUnderlineEnabled())
+ {
+ // Create the image buffer for underline
+ Devel::PixelBuffer underlineImageBuffer = CreateImageBuffer(bufferWidth, bufferHeight, Typesetter::STYLE_UNDERLINE, ignoreHorizontalAlignment, pixelFormat, penX, penY, startIndexOfGlyphs, endIndexOfGlyphs);
- // Combine the two buffers
- CombineImageBuffer(imageBuffer, strikethroughImageBuffer, bufferWidth, bufferHeight, true);
- }
+ // Combine the two buffers
+ CombineImageBuffer(imageBuffer, underlineImageBuffer, bufferWidth, bufferHeight, true);
+ }
+
+ if(mModel->IsStrikethroughEnabled())
+ {
+ // Create the image buffer for strikethrough
+ Devel::PixelBuffer strikethroughImageBuffer = CreateImageBuffer(bufferWidth, bufferHeight, Typesetter::STYLE_STRIKETHROUGH, ignoreHorizontalAlignment, pixelFormat, penX, penY, 0u, endIndexOfGlyphs);
- // Markup-Processor
+ // Combine the two buffers
+ CombineImageBuffer(imageBuffer, strikethroughImageBuffer, bufferWidth, bufferHeight, true);
+ }
+
+ // Markup-Processor for overlay styles
+ if(mModel->IsMarkupProcessorEnabled())
+ {
+ if(mModel->IsMarkupUnderlineSet())
+ {
+ imageBuffer = ApplyUnderlineMarkupImageBuffer(imageBuffer, bufferWidth, bufferHeight, ignoreHorizontalAlignment, pixelFormat, penX, penY);
+ }
- imageBuffer = ApplyMarkupProcessorOnPixelBuffer(imageBuffer, bufferWidth, bufferHeight, ignoreHorizontalAlignment, pixelFormat, penX, penY);
+ if(mModel->IsMarkupStrikethroughSet())
+ {
+ imageBuffer = ApplyStrikethroughMarkupImageBuffer(imageBuffer, bufferWidth, bufferHeight, ignoreHorizontalAlignment, pixelFormat, penX, penY);
+ }
+ }
+ }
}
// Create the final PixelData for the combined image buffer
return topPixelBuffer;
}
-Devel::PixelBuffer Typesetter::ApplyMarkupProcessorOnPixelBuffer(Devel::PixelBuffer topPixelBuffer, const uint32_t bufferWidth, const uint32_t bufferHeight, const bool ignoreHorizontalAlignment, const Pixel::Format pixelFormat, const int32_t horizontalOffset, const int32_t verticalOffset)
-{
- // Apply the markup-Processor if enabled
- const bool markupProcessorEnabled = mModel->IsMarkupProcessorEnabled();
- if(markupProcessorEnabled)
- {
- topPixelBuffer = ApplyUnderlineMarkupImageBuffer(topPixelBuffer, bufferWidth, bufferHeight, ignoreHorizontalAlignment, pixelFormat, horizontalOffset, verticalOffset);
-
- topPixelBuffer = ApplyStrikethroughMarkupImageBuffer(topPixelBuffer, bufferWidth, bufferHeight, ignoreHorizontalAlignment, pixelFormat, horizontalOffset, verticalOffset);
- }
-
- return topPixelBuffer;
-}
-
Typesetter::Typesetter(const ModelInterface* const model)
: mModel(new ViewModel(model))
{
Devel::PixelBuffer CreateImageBuffer(const uint32_t bufferWidth, const uint32_t bufferHeight, const Typesetter::Style style, const bool ignoreHorizontalAlignment, const Pixel::Format pixelFormat, const int32_t horizontalOffset, const int32_t verticalOffset, const TextAbstraction::GlyphIndex fromGlyphIndex, const TextAbstraction::GlyphIndex toGlyphIndex);
/**
- * @brief Apply behaviour of tags if the markup-processor is enabled.
- *
- * @param[in] topPixelBuffer The top layer buffer.
- * @param[in] bufferWidth The width of the image buffer.
- * @param[in] bufferHeight The height of the image buffer.
- * @param[in] ignoreHorizontalAlignment Whether to ignore the horizontal alignment, not ignored by default.
- * @param[in] pixelFormat The format of the pixel in the image that the text is rendered as (i.e. either Pixel::BGRA8888 or Pixel::L8).
- * @param[in] horizontalOffset The horizontal offset to be added to the glyph's position.
- * @param[in] verticalOffset The vertical offset to be added to the glyph's position.
- *
- * @return The image buffer with the markup.
- */
- Devel::PixelBuffer ApplyMarkupProcessorOnPixelBuffer(Devel::PixelBuffer topPixelBuffer, const uint32_t bufferWidth, const uint32_t bufferHeight, const bool ignoreHorizontalAlignment, const Pixel::Format pixelFormat, const int32_t horizontalOffset, const int32_t verticalOffset);
-
- /**
* @brief Apply markup underline tags.
*
* The properties on TextLabel override the behavior of Markup.
return mModel->IsUnderlineEnabled();
}
+bool const ViewModel::IsMarkupUnderlineSet() const
+{
+ return mModel->IsMarkupUnderlineSet();
+}
+
float ViewModel::GetUnderlineHeight() const
{
return mModel->GetUnderlineHeight();
return mModel->IsStrikethroughEnabled();
}
+bool const ViewModel::IsMarkupStrikethroughSet() const
+{
+ return mModel->IsMarkupStrikethroughSet();
+}
+
Length ViewModel::GetNumberOfStrikethroughRuns() const
{
return mModel->GetNumberOfStrikethroughRuns();
bool IsUnderlineEnabled() const override;
/**
+ * @copydoc ModelInterface::IsMarkupUnderlineSet()
+ */
+ bool const IsMarkupUnderlineSet() const override;
+
+ /**
* @copydoc ModelInterface::GetUnderlineHeight()
*/
float GetUnderlineHeight() const override;
*/
void ElideGlyphs();
+ /**
+ * @copydoc ModelInterface::GetStrikethroughHeight()
+ */
float GetStrikethroughHeight() const override;
+ /**
+ * @copydoc ModelInterface::GetStrikethroughColor()
+ */
const Vector4& GetStrikethroughColor() const override;
+ /**
+ * @copydoc ModelInterface::IsStrikethroughEnabled()
+ */
bool IsStrikethroughEnabled() const override;
/**
+ * @copydoc ModelInterface::IsMarkupStrikethroughSet()
+ */
+ bool const IsMarkupStrikethroughSet() const override;
+
+ /**
* @copydoc ModelInterface::GetNumberOfStrikethroughRuns()
*/
Length GetNumberOfStrikethroughRuns() const override;
virtual bool IsUnderlineEnabled() const = 0;
/**
+ * @brief checks if there is underline set using markup.
+ *
+ * @return boolean if there is underline set using markup.
+ */
+ virtual bool const IsMarkupUnderlineSet() const = 0;
+
+ /**
* @brief Retrieves the underline height override
*
* @return Returns the override height for an underline, 0 indicates that adaptor will determine the height
virtual bool IsStrikethroughEnabled() const = 0;
/**
+ * @brief checks if there is strikethrough set using markup.
+ *
+ * @return boolean if there is strikethrough set using markup.
+ */
+ virtual bool const IsMarkupStrikethroughSet() const = 0;
+
+ /**
* @brief Retrieves the strikethrough height override
*
* @return Returns the override height for a strikethrough, 0 indicates that adaptor will determine the height
return mVisualModel->IsUnderlineEnabled();
}
+bool const Model::IsMarkupUnderlineSet() const
+{
+ return (mVisualModel->mUnderlineRuns.Count() > 0u);
+}
+
float Model::GetUnderlineHeight() const
{
return mVisualModel->GetUnderlineHeight();
return mVisualModel->IsStrikethroughEnabled();
}
+bool const Model::IsMarkupStrikethroughSet() const
+{
+ return (mVisualModel->mStrikethroughRuns.Count() > 0u);
+}
+
float Model::GetStrikethroughHeight() const
{
return mVisualModel->GetStrikethroughHeight();
bool IsUnderlineEnabled() const override;
/**
+ * @copydoc ModelInterface::IsMarkupUnderlineSet()
+ */
+ bool const IsMarkupUnderlineSet() const override;
+
+ /**
* @copydoc ModelInterface::GetUnderlineHeight()
*/
float GetUnderlineHeight() const override;
*/
Length GetHyphensCount() const override;
+ /**
+ * @copydoc ModelInterface::GetStrikethroughHeight()
+ */
float GetStrikethroughHeight() const override;
+ /**
+ * @copydoc ModelInterface::GetStrikethroughColor()
+ */
const Vector4& GetStrikethroughColor() const override;
+ /**
+ * @copydoc ModelInterface::IsStrikethroughEnabled()
+ */
bool IsStrikethroughEnabled() const override;
+
+ /**
+ * @copydoc ModelInterface::IsMarkupStrikethroughSet()
+ */
+ bool const IsMarkupStrikethroughSet() const override;
+
/**
* @copydoc ModelInterface::GetCharacterSpacing()
*/
virtual bool IsUnderlineEnabled() const = 0;
/**
+ * @brief checks if there is underline set using markup.
+ *
+ * @return boolean if there is underline set using markup.
+ */
+ virtual bool const IsMarkupUnderlineSet() const = 0;
+
+ /**
* @brief Returns the hyphens glyph info.
*
* @return hyphens glyph info.
virtual bool IsStrikethroughEnabled() const = 0;
/**
+ * @brief checks if there is strikethrough set using markup.
+ *
+ * @return boolean if there is strikethrough set using markup.
+ */
+ virtual bool const IsMarkupStrikethroughSet() const = 0;
+
+ /**
* @brief Retrieves the strikethrough height override
*
* @return Returns the override height for a strikethrough, 0 indicates that adaptor will determine the height
return false;
}
+bool const View::IsMarkupUnderlineSet() const
+{
+ return (GetNumberOfUnderlineRuns() > 0u);
+}
+
const GlyphInfo* View::GetHyphens() const
{
if(mImpl->mVisualModel)
return (mImpl->mVisualModel) ? mImpl->mVisualModel->IsStrikethroughEnabled() : false;
}
+bool const View::IsMarkupStrikethroughSet() const
+{
+ return (GetNumberOfStrikethroughRuns() > 0u);
+}
+
float View::GetStrikethroughHeight() const
{
return (mImpl->mVisualModel) ? mImpl->mVisualModel->GetStrikethroughHeight() : 0.0f;
bool IsUnderlineEnabled() const override;
/**
+ * @copydoc Dali::Toolkit::Text::ViewInterface::IsMarkupUnderlineSet()
+ */
+ bool const IsMarkupUnderlineSet() const;
+
+ /**
* @copydoc Dali::Toolkit::Text::ViewInterface::GetHyphens()
*/
const GlyphInfo* GetHyphens() const override;
bool IsStrikethroughEnabled() const override;
/**
+ * @copydoc Dali::Toolkit::Text::ViewInterface::IsMarkupStrikethroughSet()
+ */
+ bool const IsMarkupStrikethroughSet() const;
+
+ /**
* @copydoc Dali::Toolkit::Text::ViewInterface::GetStrikethroughHeight()
*/
float GetStrikethroughHeight() const override;
shadowEnabled = true;
}
- const bool underlineEnabled = mController->GetTextModel()->IsUnderlineEnabled();
- const bool outlineEnabled = (mController->GetTextModel()->GetOutlineWidth() > Math::MACHINE_EPSILON_1);
- const bool backgroundEnabled = mController->GetTextModel()->IsBackgroundEnabled();
- const bool markupProcessorEnabled = mController->IsMarkupProcessorEnabled();
- const bool strikethroughEnabled = mController->GetTextModel()->IsStrikethroughEnabled();
-
- const bool styleEnabled = (shadowEnabled || underlineEnabled || outlineEnabled || backgroundEnabled || markupProcessorEnabled || strikethroughEnabled);
+ const bool outlineEnabled = (mController->GetTextModel()->GetOutlineWidth() > Math::MACHINE_EPSILON_1);
+ const bool backgroundEnabled = mController->GetTextModel()->IsBackgroundEnabled();
+ const bool markupProcessorEnabled = mController->IsMarkupProcessorEnabled();
+ const bool markupUnderlineEnabled = markupProcessorEnabled && mController->GetTextModel()->IsMarkupUnderlineSet();
+ const bool markupStrikethroughEnabled = markupProcessorEnabled && mController->GetTextModel()->IsMarkupStrikethroughSet();
+ const bool underlineEnabled = mController->GetTextModel()->IsUnderlineEnabled() || markupUnderlineEnabled;
+ const bool strikethroughEnabled = mController->GetTextModel()->IsStrikethroughEnabled() || markupStrikethroughEnabled;
+ const bool styleEnabled = (shadowEnabled || outlineEnabled || backgroundEnabled || markupProcessorEnabled);
const bool isOverlayStyle = underlineEnabled || strikethroughEnabled;
AddRenderer(control, relayoutSize, hasMultipleTextColors, containsColorGlyph, styleEnabled, isOverlayStyle);