/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
namespace TextAbstraction
{
-
-const PointSize26Dot6 FontClient::DEFAULT_POINT_SIZE = 768u; // 12*64
+const PointSize26Dot6 FontClient::DEFAULT_POINT_SIZE = 768u; // 12*64
+const float FontClient::DEFAULT_ITALIC_ANGLE = 12.f * Dali::Math::PI_OVER_180; // FreeType documentation states the software italic is done by doing a horizontal shear of 12 degrees (file ftsynth.h).
FontClient::GlyphBufferData::GlyphBufferData()
-: buffer( NULL ),
- width( 0u ),
- height( 0u ),
- format( Pixel::A8 )
+: buffer{nullptr},
+ width{0u},
+ height{0u},
+ outlineOffsetX{0},
+ outlineOffsetY{0},
+ format{Pixel::A8},
+ isColorEmoji{false},
+ isColorBitmap{false}
{
}
{
}
-FontClient::FontClient( const FontClient& handle )
-: BaseHandle( handle )
+FontClient::FontClient(const FontClient& handle)
+: BaseHandle(handle)
{
}
-FontClient& FontClient::operator=( const FontClient& handle )
+FontClient& FontClient::operator=(const FontClient& handle)
{
- BaseHandle::operator=( handle );
+ BaseHandle::operator=(handle);
return *this;
}
-void FontClient::SetDpi( unsigned int horizontalDpi, unsigned int verticalDpi )
+void FontClient::ClearCache()
+{
+ GetImplementation(*this).ClearCache();
+}
+
+void FontClient::SetDpi(unsigned int horizontalDpi, unsigned int verticalDpi)
{
- GetImplementation(*this).SetDpi( horizontalDpi, verticalDpi );
+ GetImplementation(*this).SetDpi(horizontalDpi, verticalDpi);
}
-void FontClient::GetDpi( unsigned int& horizontalDpi, unsigned int& verticalDpi )
+void FontClient::GetDpi(unsigned int& horizontalDpi, unsigned int& verticalDpi)
{
- GetImplementation(*this).GetDpi( horizontalDpi, verticalDpi );
+ GetImplementation(*this).GetDpi(horizontalDpi, verticalDpi);
}
int FontClient::GetDefaultFontSize()
GetImplementation(*this).ResetSystemDefaults();
}
-void FontClient::GetDefaultFonts( FontList& defaultFonts )
+void FontClient::GetDefaultFonts(FontList& defaultFonts)
+{
+ GetImplementation(*this).GetDefaultFonts(defaultFonts);
+}
+
+void FontClient::GetDefaultPlatformFontDescription(FontDescription& fontDescription)
+{
+ GetImplementation(*this).GetDefaultPlatformFontDescription(fontDescription);
+}
+
+void FontClient::GetSystemFonts(FontList& systemFonts)
+{
+ GetImplementation(*this).GetSystemFonts(systemFonts);
+}
+
+void FontClient::GetDescription(FontId id, FontDescription& fontDescription)
+{
+ GetImplementation(*this).GetDescription(id, fontDescription);
+}
+
+PointSize26Dot6 FontClient::GetPointSize(FontId id)
+{
+ return GetImplementation(*this).GetPointSize(id);
+}
+
+bool FontClient::IsCharacterSupportedByFont(FontId fontId, Character character)
{
- GetImplementation(*this).GetDefaultFonts( defaultFonts );
+ return GetImplementation(*this).IsCharacterSupportedByFont(fontId, character);
}
-void FontClient::GetDefaultPlatformFontDescription( FontDescription& fontDescription )
+FontId FontClient::FindDefaultFont(Character charcode,
+ PointSize26Dot6 requestedPointSize,
+ bool preferColor)
{
- GetImplementation(*this).GetDefaultPlatformFontDescription( fontDescription );
+ return GetImplementation(*this).FindDefaultFont(charcode,
+ requestedPointSize,
+ preferColor);
}
-void FontClient::GetSystemFonts( FontList& systemFonts )
+FontId FontClient::FindFallbackFont(Character charcode,
+ const FontDescription& preferredFontDescription,
+ PointSize26Dot6 requestedPointSize,
+ bool preferColor)
{
- GetImplementation(*this).GetSystemFonts( systemFonts );
+ return GetImplementation(*this).FindFallbackFont(charcode, preferredFontDescription, requestedPointSize, preferColor);
}
-void FontClient::GetDescription( FontId id, FontDescription& fontDescription )
+FontId FontClient::GetFontId(const FontPath& path, PointSize26Dot6 requestedPointSize, FaceIndex faceIndex)
{
- GetImplementation(*this).GetDescription( id, fontDescription );
+ return GetImplementation(*this).GetFontId(path, requestedPointSize, faceIndex);
}
-PointSize26Dot6 FontClient::GetPointSize( FontId id )
+FontId FontClient::GetFontId(const FontDescription& fontDescription,
+ PointSize26Dot6 requestedPointSize,
+ FaceIndex faceIndex)
{
- return GetImplementation(*this).GetPointSize( id );
+ return GetImplementation(*this).GetFontId(fontDescription,
+ requestedPointSize,
+ faceIndex);
}
-bool FontClient::IsCharacterSupportedByFont( FontId fontId, Character character )
+FontId FontClient::GetFontId(const BitmapFont& bitmapFont)
{
- return GetImplementation(*this).IsCharacterSupportedByFont( fontId, character );
+ return GetImplementation(*this).GetFontId(bitmapFont);
}
-FontId FontClient::FindDefaultFont( Character charcode,
- PointSize26Dot6 requestedPointSize,
- bool preferColor )
+bool FontClient::IsScalable(const FontPath& path)
{
- return GetImplementation(*this).FindDefaultFont( charcode,
- requestedPointSize,
- preferColor );
+ return GetImplementation(*this).IsScalable(path);
}
-FontId FontClient::FindFallbackFont( Character charcode,
- const FontDescription& preferredFontDescription,
- PointSize26Dot6 requestedPointSize,
- bool preferColor )
+bool FontClient::IsScalable(const FontDescription& fontDescription)
{
- return GetImplementation(*this).FindFallbackFont( charcode, preferredFontDescription, requestedPointSize, preferColor );
+ return GetImplementation(*this).IsScalable(fontDescription);
}
-FontId FontClient::GetFontId( const FontPath& path, PointSize26Dot6 requestedPointSize, FaceIndex faceIndex )
+void FontClient::GetFixedSizes(const FontPath& path, Dali::Vector<PointSize26Dot6>& sizes)
{
- return GetImplementation(*this).GetFontId( path, requestedPointSize, faceIndex );
+ GetImplementation(*this).GetFixedSizes(path, sizes);
}
-FontId FontClient::GetFontId( const FontDescription& fontDescription,
- PointSize26Dot6 requestedPointSize,
- FaceIndex faceIndex )
+void FontClient::GetFixedSizes(const FontDescription& fontDescription,
+ Dali::Vector<PointSize26Dot6>& sizes)
{
- return GetImplementation(*this).GetFontId( fontDescription,
- requestedPointSize,
- faceIndex );
+ GetImplementation(*this).GetFixedSizes(fontDescription, sizes);
}
-bool FontClient::IsScalable( const FontPath& path )
+bool FontClient::HasItalicStyle(FontId fontId) const
{
- return GetImplementation(*this).IsScalable( path );
+ return GetImplementation(*this).HasItalicStyle(fontId);
}
-bool FontClient::IsScalable( const FontDescription& fontDescription )
+void FontClient::GetFontMetrics(FontId fontId, FontMetrics& metrics)
{
- return GetImplementation(*this).IsScalable( fontDescription );
+ GetImplementation(*this).GetFontMetrics(fontId, metrics);
}
-void FontClient::GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26Dot6>& sizes )
+GlyphIndex FontClient::GetGlyphIndex(FontId fontId, Character charcode)
{
- GetImplementation(*this).GetFixedSizes( path, sizes );
+ return GetImplementation(*this).GetGlyphIndex(fontId, charcode);
}
-void FontClient::GetFixedSizes( const FontDescription& fontDescription,
- Dali::Vector< PointSize26Dot6 >& sizes )
+bool FontClient::GetGlyphMetrics(GlyphInfo* array, uint32_t size, GlyphType type, bool horizontal)
{
- GetImplementation(*this).GetFixedSizes( fontDescription, sizes );
+ return GetImplementation(*this).GetGlyphMetrics(array, size, type, horizontal);
}
-void FontClient::GetFontMetrics( FontId fontId, FontMetrics& metrics )
+void FontClient::CreateBitmap(FontId fontId, GlyphIndex glyphIndex, bool isItalicRequired, bool isBoldRequired, GlyphBufferData& data, int outlineWidth)
{
- GetImplementation(*this).GetFontMetrics( fontId, metrics );
+ GetImplementation(*this).CreateBitmap(fontId, glyphIndex, isItalicRequired, isBoldRequired, data, outlineWidth);
}
-GlyphIndex FontClient::GetGlyphIndex( FontId fontId, Character charcode )
+PixelData FontClient::CreateBitmap(FontId fontId, GlyphIndex glyphIndex, int outlineWidth)
{
- return GetImplementation(*this).GetGlyphIndex( fontId, charcode );
+ return GetImplementation(*this).CreateBitmap(fontId, glyphIndex, outlineWidth);
}
-bool FontClient::GetGlyphMetrics( GlyphInfo* array, uint32_t size, GlyphType type, bool horizontal )
+void FontClient::CreateVectorBlob(FontId fontId, GlyphIndex glyphIndex, VectorBlob*& blob, unsigned int& blobLength, unsigned int& nominalWidth, unsigned int& nominalHeight)
{
- return GetImplementation(*this).GetGlyphMetrics( array, size, type, horizontal );
+ GetImplementation(*this).CreateVectorBlob(fontId, glyphIndex, blob, blobLength, nominalWidth, nominalHeight);
}
-void FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex, GlyphBufferData& data, int outlineWidth )
+const GlyphInfo& FontClient::GetEllipsisGlyph(PointSize26Dot6 requestedPointSize)
{
- GetImplementation(*this).CreateBitmap( fontId, glyphIndex, data, outlineWidth );
+ return GetImplementation(*this).GetEllipsisGlyph(requestedPointSize);
}
-PixelData FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex, int outlineWidth )
+bool FontClient::IsColorGlyph(FontId fontId, GlyphIndex glyphIndex)
{
- return GetImplementation(*this).CreateBitmap( fontId, glyphIndex, outlineWidth );
+ return GetImplementation(*this).IsColorGlyph(fontId, glyphIndex);
}
-void FontClient::CreateVectorBlob( FontId fontId, GlyphIndex glyphIndex, VectorBlob*& blob, unsigned int& blobLength, unsigned int& nominalWidth, unsigned int& nominalHeight )
+bool FontClient::AddCustomFontDirectory(const FontPath& path)
{
- GetImplementation(*this).CreateVectorBlob( fontId, glyphIndex, blob, blobLength, nominalWidth, nominalHeight );
+ return GetImplementation(*this).AddCustomFontDirectory(path);
}
-const GlyphInfo& FontClient::GetEllipsisGlyph( PointSize26Dot6 requestedPointSize )
+GlyphIndex FontClient::CreateEmbeddedItem(const EmbeddedItemDescription& description, Pixel::Format& pixelFormat)
{
- return GetImplementation(*this).GetEllipsisGlyph( requestedPointSize );
+ return GetImplementation(*this).CreateEmbeddedItem(description, pixelFormat);
}
-bool FontClient::IsColorGlyph( FontId fontId, GlyphIndex glyphIndex )
+FontClient::FontClient(Internal::FontClient* internal)
+: BaseHandle(internal)
{
- return GetImplementation(*this).IsColorGlyph( fontId, glyphIndex );
}
-FontClient::FontClient( Internal::FontClient* internal )
-: BaseHandle( internal )
+FontClient FontClientPreInitialize()
{
+ return Internal::FontClient::PreInitialize();
}
} // namespace TextAbstraction