/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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 TextAbstraction
{
+// FontClient static const value definition.
+
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{nullptr},
- width{0u},
- height{0u},
- outlineOffsetX{0},
- outlineOffsetY{0},
- format{Pixel::A8},
- isColorEmoji{false},
- isColorBitmap{false}
-{
-}
+//Default atlas block
+const bool FontClient::DEFAULT_ATLAS_LIMITATION_ENABLED = true;
+const uint32_t FontClient::DEFAULT_TEXT_ATLAS_WIDTH = 512u;
+const uint32_t FontClient::DEFAULT_TEXT_ATLAS_HEIGHT = 512u;
+const Size FontClient::DEFAULT_TEXT_ATLAS_SIZE(DEFAULT_TEXT_ATLAS_WIDTH, DEFAULT_TEXT_ATLAS_HEIGHT);
-FontClient::GlyphBufferData::~GlyphBufferData()
-{
-}
+//Maximum atlas block
+const uint32_t FontClient::MAX_TEXT_ATLAS_WIDTH = 1024u;
+const uint32_t FontClient::MAX_TEXT_ATLAS_HEIGHT = 1024u;
+const Size FontClient::MAX_TEXT_ATLAS_SIZE(MAX_TEXT_ATLAS_WIDTH, MAX_TEXT_ATLAS_HEIGHT);
+
+//MAX_WIDTH_FIT_IN_ATLAS: blockWidth + 2 * DOUBLE_PIXEL_PADDING + 1u <= atlasWidth
+//MAX_HEIGHT_FIT_IN_ATLAS: blockHeight + 2 * DOUBLE_PIXEL_PADDING + 1u <= atlasHeight
+const uint16_t FontClient::PADDING_TEXT_ATLAS_BLOCK = 5u; // 2 * DOUBLE_PIXEL_PADDING + 1u
+
+//Maximum block size to fit into atlas block
+const Size FontClient::MAX_SIZE_FIT_IN_ATLAS(MAX_TEXT_ATLAS_WIDTH - PADDING_TEXT_ATLAS_BLOCK, MAX_TEXT_ATLAS_HEIGHT - PADDING_TEXT_ATLAS_BLOCK);
+
+const uint32_t FontClient::NUMBER_OF_POINTS_PER_ONE_UNIT_OF_POINT_SIZE = 64u; //Found this value from toolkit
+
+// FontClient
FontClient FontClient::Get()
{
{
}
-FontClient::FontClient(const FontClient& handle)
-: BaseHandle(handle)
-{
-}
+FontClient::FontClient(const FontClient& handle) = default;
-FontClient& FontClient::operator=(const FontClient& handle)
-{
- BaseHandle::operator=(handle);
- return *this;
-}
+FontClient& FontClient::operator=(const FontClient& handle) = default;
+
+FontClient::FontClient(FontClient&& handle) = default;
+
+FontClient& FontClient::operator=(FontClient&& handle) = default;
void FontClient::ClearCache()
{
GetImplementation(*this).GetSystemFonts(systemFonts);
}
-void FontClient::GetDescription(FontId id, FontDescription& fontDescription)
+void FontClient::GetDescription(FontId fontId, FontDescription& fontDescription)
{
- GetImplementation(*this).GetDescription(id, fontDescription);
+ GetImplementation(*this).GetDescription(fontId, fontDescription);
}
-PointSize26Dot6 FontClient::GetPointSize(FontId id)
+PointSize26Dot6 FontClient::GetPointSize(FontId fontId)
{
- return GetImplementation(*this).GetPointSize(id);
+ return GetImplementation(*this).GetPointSize(fontId);
}
bool FontClient::IsCharacterSupportedByFont(FontId fontId, Character character)
return GetImplementation(*this).GetGlyphIndex(fontId, charcode);
}
+GlyphIndex FontClient::GetGlyphIndex(FontId fontId, Character charcode, Character variantSelector)
+{
+ return GetImplementation(*this).GetGlyphIndex(fontId, charcode, variantSelector);
+}
+
bool FontClient::GetGlyphMetrics(GlyphInfo* array, uint32_t size, GlyphType type, bool horizontal)
{
return GetImplementation(*this).GetGlyphMetrics(array, size, type, horizontal);
return GetImplementation(*this).CreateEmbeddedItem(description, pixelFormat);
}
+void FontClient::EnableAtlasLimitation(bool enabled)
+{
+ return GetImplementation(*this).EnableAtlasLimitation(enabled);
+}
+
+bool FontClient::IsAtlasLimitationEnabled() const
+{
+ return GetImplementation(*this).IsAtlasLimitationEnabled();
+}
+
+Size FontClient::GetMaximumTextAtlasSize() const
+{
+ return GetImplementation(*this).GetMaximumTextAtlasSize();
+}
+
+Size FontClient::GetDefaultTextAtlasSize() const
+{
+ return GetImplementation(*this).GetDefaultTextAtlasSize();
+}
+
+Size FontClient::GetCurrentMaximumBlockSizeFitInAtlas() const
+{
+ return GetImplementation(*this).GetCurrentMaximumBlockSizeFitInAtlas();
+}
+
+bool FontClient::SetCurrentMaximumBlockSizeFitInAtlas(const Size& currentMaximumBlockSizeFitInAtlas)
+{
+ return GetImplementation(*this).SetCurrentMaximumBlockSizeFitInAtlas(currentMaximumBlockSizeFitInAtlas);
+}
+
+uint32_t FontClient::GetNumberOfPointsPerOneUnitOfPointSize() const
+{
+ return GetImplementation(*this).GetNumberOfPointsPerOneUnitOfPointSize();
+}
+
FontClient::FontClient(Internal::FontClient* internal)
: BaseHandle(internal)
{
return Internal::FontClient::PreInitialize();
}
+void FontClientPreCache(const FontFamilyList& fallbackFamilyList, const FontFamilyList& extraFamilyList, const FontFamily& localeFamily, bool useThread)
+{
+ Internal::FontClient::PreCache(fallbackFamilyList, extraFamilyList, localeFamily, useThread);
+}
+
} // namespace TextAbstraction
} // namespace Dali