FGrp_Screen.cpp
FGrp_TextElementImpl.cpp
FGrp_EnrichedTextImpl.cpp
+ FGrp_FontFromImage.cpp
+ FGrp_FontPrivate.cpp
util/FGrp_Util.cpp
util/FGrp_UtilPixmap.cpp
util/FGrp_UtilScratchpad.cpp
{
_FontRsrcManager& mgr = _FontRsrcManager::GetInstance();
- //------------------------------------------------------
- //
- // 1. check if this font has a requested glyph
- //
- //------------------------------------------------------
- unsigned long idx = __pNativeFont->CheckGlyph(character);
-
- if (idx > 0)
+ if (!_HasEmoticonImage(character))
{
- return __pNativeFont;
- }
+ //------------------------------------------------------
+ //
+ // 1. check if this font has a requested glyph
+ //
+ //------------------------------------------------------
+ unsigned long idx = __pNativeFont->CheckGlyph(character);
- // Check the BlackList
- if (mgr.SearchBlackList(character))
- {
- return __pNativeFont;
+ if (idx > 0)
+ {
+ return __pNativeFont;
+ }
+
+ // Check the BlackList
+ if (mgr.SearchBlackList(character))
+ {
+ return __pNativeFont;
+ }
}
//------------------------------------------------------
bool
_Font::__GetFallbackFontFileList(wchar_t character, Tizen::Base::Collection::IListT<String>& out)
{
+ if (_HasEmoticonImage(character))
+ {
+ out.Add(String(_GetVirtualFileNameForEmoticon()));
+ return true;
+ }
+
GUnicodeScript script = g_unichar_get_script(character);
if (script < 0 || script >= _sampleLanguageCount)
{
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 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.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/*
+ * @file FGrp_FontFromImage.cpp
+ * @brief This is the implementation file for _FontFromImage class.
+ *
+ */
+
+#include "FGrp_FontFromImage.h"
+#include "FGrp_FontPrivate.h"
+
+namespace
+{
+
+bool _CreateNullGlyph(Tizen::Graphics::_IFont::Glyph** ppFontGlyphData)
+{
+ using namespace Tizen::Graphics;
+ using Tizen::Graphics::_IFont;
+
+ _IFont::Glyph* pFontGlyphData = (_IFont::Glyph*) new (std::nothrow) char[sizeof(_IFont::Glyph)];
+
+ if (pFontGlyphData)
+ {
+ pFontGlyphData->id = 0;
+ pFontGlyphData->xOffset = _Util::FixedPoint22_10(0);
+ pFontGlyphData->yOffset = _Util::FixedPoint22_10(0);
+ pFontGlyphData->xAdvance = _Util::FixedPoint22_10(0);
+ pFontGlyphData->yAdvance = _Util::FixedPoint22_10(0);
+ pFontGlyphData->hasOwnerShip = 1;
+
+ pFontGlyphData->image.width = 0;
+ pFontGlyphData->image.height = 0;
+ pFontGlyphData->image.bytesPerLine = 0;
+ pFontGlyphData->image.depth = 32;
+ pFontGlyphData->image.pBitmap = 0;
+
+ pFontGlyphData->ptrAux = 0;
+
+ *ppFontGlyphData = pFontGlyphData;
+
+ return true;
+ }
+
+ return false;
+}
+
+}
+
+namespace Tizen { namespace Graphics
+{
+_FontFromImage::_FontFromImage()
+{
+ __fontAttrib.size = _Util::FixedPoint26_6(48);
+ __fontAttrib.angle = 0.0f;
+ __fontAttrib.style = _IFont::STYLE_NONE;
+ __fontAttrib.quality = _IFont::QUALITY_HIGH;
+ __fontAttrib.xExpansion.Reset(_Util::FixedPoint26_6(1.0f));
+ __fontAttrib.boldWeight.Reset(_Util::FixedPoint26_6(1.0f));
+}
+
+bool
+_FontFromImage::SetAttrib(const Attrib& fontAttrib)
+{
+ __fontAttrib = fontAttrib;
+ return true;
+}
+
+bool
+_FontFromImage::GetAttrib(Attrib& fontAttrib) const
+{
+ fontAttrib = __fontAttrib;
+ return true;
+}
+
+bool
+_FontFromImage::GetKerning(unsigned long ch1, unsigned long ch2, long& xVector, long& yVector) const
+{
+ return false;
+}
+
+bool
+_FontFromImage::LoadGlyph(unsigned long character, Glyph** ppFontGlyphData)
+{
+ return _GetImageGlyph(character, __fontAttrib.size.ToFloat(), ppFontGlyphData);
+}
+
+bool
+_FontFromImage::UnloadGlyph(Glyph** ppFontGlyphData)
+{
+ if ((*ppFontGlyphData) && ((*ppFontGlyphData)->hasOwnerShip == 0))
+ {
+ //?? ykahn: false?
+ return false;
+ }
+
+ delete[] (char*) (*ppFontGlyphData);
+
+ *ppFontGlyphData = null;
+
+ return true;
+}
+
+unsigned long
+_FontFromImage::CheckGlyph(unsigned long character)
+{
+ return _HasEmoticonImage(character);
+}
+
+float
+_FontFromImage::GetFontSizeFromMaxHeight(_Util::FixedPoint26_6 expectedMaxHeight) const
+{
+ SizeProperty sizeProperty;
+
+ const float testSize = 100.0f;
+
+ if (!_GetImageGlyphSizeProperty(testSize, sizeProperty))
+ {
+ return 0.0f;
+ }
+
+ return expectedMaxHeight * testSize / sizeProperty.maxHeight;
+}
+
+bool
+_FontFromImage::GetFontSizeProperty(SizeProperty& sizeProperty) const
+{
+ return _GetImageGlyphSizeProperty(__fontAttrib.size.ToFloat(), sizeProperty);
+}
+
+bool
+_FontFromImage::GetFontProperty(Property& property) const
+{
+ property.fontCaps = _IFont::CAPS_SCALABLE;
+ property.styleCaps = _IFont::STYLE_NONE;
+
+ property.pEngineName = "";
+ property.pFamilyName = "";
+ property.pStyleName = "";
+ property.styleFlag = 0;
+ property.weightClass = 400;
+
+ return true;
+}
+
+bool
+_FontFromImage::GetGlyphList(const _Util::String& text, Tizen::Base::Collection::IListT<Glyph *>& out, int script)
+{
+ out.RemoveAll();
+
+ const wchar_t* pBegin = text.pStart;
+ const wchar_t* pEnd = pBegin + text.length;
+
+ for ( ; pBegin < pEnd; ++pBegin)
+ {
+ _IFont::Glyph* pFontGlyphData = 0;
+
+ if (!_GetImageGlyph(*pBegin, __fontAttrib.size.ToFloat(), &pFontGlyphData))
+ {
+ _CreateNullGlyph(&pFontGlyphData);
+ }
+
+ if (pFontGlyphData)
+ {
+ out.Add(pFontGlyphData);
+ }
+ }
+
+ return true;
+}
+
+_IFont::FontMapT*
+_FontFromImage::GetFallbackMap(void)
+{
+ return 0;
+}
+
+bool
+_FontFromImage::hasPredefinedColor(void) const
+{
+ return false;
+}
+
+bool
+_FontFromImage::Create(const void* pBuffer, long bufSize, long face)
+{
+ return false;
+}
+
+bool
+_FontFromImage::Create(const char* pFilePath, long face)
+{
+ return true;
+}
+
+bool
+_FontFromImage::CreateStatic(const void* pBuffer, long bufSize, long face)
+{
+ return false;
+}
+
+bool
+_FontFromImage::Reload(const void* pBuffer, long bufSize, long face)
+{
+ return false;
+}
+
+bool
+_FontFromImage::Reload(const char* filePath, long face)
+{
+ return true;
+}
+
+void
+_FontFromImage::Destroy(void)
+{
+}
+
+bool
+_FontFromImage::FindCache(unsigned long glyphIndex, _Util::FixedPoint26_6 size, int style, Glyph** pOut)
+{
+ return false;
+}
+
+bool
+_FontFromImage::AddCache(unsigned long glyphIndex, _Util::FixedPoint26_6 size, int style, Glyph* pGlyph)
+{
+ return false;
+}
+
+bool
+_FontFromImage::CleanCache(void)
+{
+ return true;
+}
+
+}} // Tizen::Graphics
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 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.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/*
+ * @file FGrp_FontFromImage.h
+ * @brief This is the header file for _FontFromImage class.
+ *
+ */
+
+#ifndef _FGRP_INTERNAL_FONT_FROM_IMAGE_H_
+#define _FGRP_INTERNAL_FONT_FROM_IMAGE_H_
+
+#include "FGrp_IFont.h"
+
+
+namespace Tizen { namespace Graphics
+{
+
+class _FontFromImage
+ : public _IFont
+{
+public:
+ _FontFromImage();
+ virtual ~_FontFromImage(void) {}
+
+ //! Changes the attribute using fontAttrib.
+ virtual bool SetAttrib(const Attrib& fontAttrib);
+ //! Gets current attribute and store it in fontAttrib.
+ virtual bool GetAttrib(Attrib& fontAttrib) const;
+
+ //! Gets the value of the interval correctness between two characters.
+ virtual bool GetKerning(unsigned long ch1, unsigned long ch2, long& xVector, long& yVector) const;
+
+ //! Loads the font glyph data for displaying font.
+ virtual bool LoadGlyph(unsigned long character, Glyph** pFontGlyphData);
+ //! Releases the resource of the font glyph data that is not needed any more.
+ virtual bool UnloadGlyph(Glyph** pFontGlyphData);
+ //! Check if specified glyph is included.
+ virtual unsigned long CheckGlyph(unsigned long character);
+
+ virtual float GetFontSizeFromMaxHeight(_Util::FixedPoint26_6 expectedMaxHeight) const;
+
+ //! Gets the support range and the property for this font engine.
+ virtual bool GetFontSizeProperty(SizeProperty& sizeProperty) const;
+ virtual bool GetFontProperty(Property& property) const;
+
+ //! Harfbuzz test
+ virtual bool GetGlyphList(const _Util::String& text, Tizen::Base::Collection::IListT<Glyph *>& out, int script);
+
+ //! Gets the font fallback map.
+ virtual FontMapT* GetFallbackMap(void);
+
+ virtual bool hasPredefinedColor(void) const;
+
+protected:
+ //! Initializes a font instance with the font data on the memory buffer.
+ virtual bool Create(const void* pBuffer, long bufSize, long face);
+ //! Initializes a font instance with the font file.
+ virtual bool Create(const char* pFilePath, long face);
+ //! Initializes a font instance with the font data on the static memory buffer.
+ virtual bool CreateStatic(const void* pBuffer, long bufSize, long face);
+ //! Reloads a font instance with the font data on the memory buffer.
+ virtual bool Reload(const void* pBuffer, long bufSize, long face);
+ //! Reloads a font instance with the font file
+ virtual bool Reload(const char* filePath, long face);
+ //! Destroys the instance.
+ virtual void Destroy(void);
+ //! Finds glyph in the cache
+ virtual bool FindCache(unsigned long glyphIndex, _Util::FixedPoint26_6 size, int style, Glyph** pOut);
+ //! Adds glyph in the cache
+ virtual bool AddCache(unsigned long glyphIndex, _Util::FixedPoint26_6 size, int style, Glyph* pGlyph);
+ //! Clean cache
+ virtual bool CleanCache(void);
+
+private:
+ _FontFromImage(const _FontFromImage& font);
+ _FontFromImage& operator =(const _FontFromImage& rhs);
+
+ _IFont::Attrib __fontAttrib;
+
+}; // _FontFromImage
+
+}} // Tizen::Graphics
+
+#endif // _FGRP_INTERNAL_FONT_FROM_IMAGE_H_
#include "FGrp_FontCache.h"
#include "FGrp_FontBidiUtil.h"
#include "FGrp_FontPrivate.h"
+
#include "util/FGrp_UtilTemplate.h"
#include "util/FGrp_UtilType.h"
CHECK_NULL_PARAM(__pFontFace);
CHECK_NULL_PARAM(ppFontGlyphData);
- //////////////// test begin ///
- if (_HasEmoticonImage(character))
- {
- if (_GetImageGlyph(character, ppFontGlyphData))
- {
- return true;
- }
- }
- //////////////// test end ///
-
FT_UInt glyphIndex = __GetGlyphIndex(character);
bool rtn = FindCache(glyphIndex, __fontAttrib.size, __fontAttrib.style, ppFontGlyphData);
/*
* @file FGrp_FontFt2.h
- * @brief This is the header file for FGrp_FontFt2 class.
+ * @brief This is the header file for _FontFt2 class.
*
*/
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 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.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/*
+ * @file FGrp_FontPrivate.cpp
+ * @brief This is the implementation file for the private part of _Font class.
+ *
+ */
+
+#include "FGrp_FontPrivate.h"
+
+#define FOR_PRIVATE_EMOJI
+//#define FOR_PRIVATE_EMOTICON
+
+////////////////////////////////////////////////////////////////////////////////
+// Emoji
+
+namespace Tizen { namespace Graphics
+{
+
+#if defined(FOR_PRIVATE_EMOJI)
+
+namespace
+{
+
+static const char* _familyForTitling[] =
+{
+ "TitlingGothicFB Comp",
+ "TitlingGothicFB Cond",
+ "TitlingGothicFB Narrow",
+ "TitlingGothicFB Skyline"
+};
+
+static const char* _familyForPredefinedColor[] =
+{
+ "keitaiemoji"
+};
+
+inline unsigned long
+_GetPredefinedColorPrivate(const wchar_t unicode, unsigned long defaultColor)
+{
+ //
+ // Emoji Unicode List 176 + 76
+ //
+ static const unsigned long _EMOJI_BLACK = 0xFF6E6E6E;
+ static const unsigned long _EMOJI_BLUE = 0xFF0000FF;
+ static const unsigned long _EMOJI_GREEN = 0xFF00FF00;
+ static const unsigned long _EMOJI_RED = 0xFFFF0000;
+ static const unsigned long _EMOJI_ORANGE = 0xFFFF6600;
+ static const unsigned long _EMOJI_PURPLE = 0xFF9370DB;
+ static const unsigned long _EMOJI_DEEP_PURPLE = 0xFF800080;
+ static const unsigned long _EMOJI_DARK_BLUE = 0xFF00008B;
+ static const unsigned long _EMOJI_BROWN = 0xFFA52A2A;
+ static const unsigned long _NOT_EMOJI = 0;
+
+ static const wchar_t _MAX_EMOJI_UNICODE = 0xE757;
+ static const wchar_t _MIN_EMOJI_UNICODE = 0xE63E;
+
+ static const unsigned long _emojiTable[] =
+ {
+ _EMOJI_RED, _EMOJI_BLUE, _EMOJI_BLUE, _EMOJI_BLUE, _EMOJI_ORANGE, _EMOJI_RED, _EMOJI_BLUE, _EMOJI_BLUE, _EMOJI_RED, _EMOJI_ORANGE,
+ _EMOJI_GREEN, _EMOJI_BLUE, _EMOJI_RED, _EMOJI_ORANGE, _EMOJI_GREEN, _EMOJI_BLUE, _EMOJI_RED, _EMOJI_ORANGE, _EMOJI_GREEN, _EMOJI_BLUE,
+ _EMOJI_PURPLE, _EMOJI_BLACK, _EMOJI_BLUE, _EMOJI_GREEN, _EMOJI_BLACK, _EMOJI_BLUE, _EMOJI_ORANGE, _EMOJI_BLACK, _EMOJI_PURPLE, _EMOJI_GREEN,
+ _EMOJI_ORANGE, _EMOJI_BLUE, _EMOJI_BLACK, _EMOJI_GREEN, _EMOJI_RED, _EMOJI_BLUE, _EMOJI_BLUE, _EMOJI_RED, _EMOJI_BLUE, _EMOJI_RED,
+ _EMOJI_BLACK, _EMOJI_PURPLE, _EMOJI_RED, _EMOJI_GREEN, _EMOJI_BLUE, _EMOJI_PURPLE, _EMOJI_BLUE, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK,
+ _EMOJI_GREEN, _EMOJI_PURPLE, _EMOJI_ORANGE, _EMOJI_ORANGE, _EMOJI_RED, _EMOJI_BLUE, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_ORANGE,
+ _EMOJI_BLUE, _EMOJI_PURPLE, _EMOJI_BLACK, _EMOJI_RED, _EMOJI_ORANGE, _EMOJI_BLACK, _EMOJI_RED, _EMOJI_BLACK, _EMOJI_RED, _EMOJI_ORANGE,
+ _EMOJI_RED, _EMOJI_RED, _EMOJI_RED, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_ORANGE, _EMOJI_BLUE, _EMOJI_BLACK, _EMOJI_BLUE, _EMOJI_RED,
+ _EMOJI_BLACK, _EMOJI_RED, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_ORANGE, _EMOJI_ORANGE, _EMOJI_ORANGE, _EMOJI_ORANGE, _EMOJI_BLACK, _EMOJI_BLACK,
+ _EMOJI_ORANGE, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLUE, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_ORANGE,
+ _EMOJI_ORANGE, _EMOJI_BLUE, _EMOJI_GREEN, _EMOJI_BLACK, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI,
+ _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _NOT_EMOJI, _NOT_EMOJI, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _NOT_EMOJI, _NOT_EMOJI,
+ _NOT_EMOJI, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI,
+ _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI,
+ _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_ORANGE, _EMOJI_ORANGE, _EMOJI_BLACK,
+ _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_RED, _EMOJI_RED, _EMOJI_RED, _EMOJI_RED, _EMOJI_RED, _EMOJI_RED, _EMOJI_BLUE, _EMOJI_RED,
+ _EMOJI_RED, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK,
+ _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_RED, _EMOJI_RED, _EMOJI_RED, _EMOJI_RED, _EMOJI_PURPLE, _EMOJI_RED,
+ _EMOJI_BLUE, _EMOJI_GREEN, _EMOJI_BLUE, _EMOJI_RED, _EMOJI_RED, _EMOJI_RED, _EMOJI_PURPLE, _EMOJI_RED, _EMOJI_ORANGE, _EMOJI_ORANGE,
+ _EMOJI_BLACK, _EMOJI_RED, _EMOJI_BLACK, _EMOJI_RED, _EMOJI_BLUE, _EMOJI_BLUE, _EMOJI_RED, _EMOJI_PURPLE, _EMOJI_RED, _EMOJI_RED,
+ _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_RED, _EMOJI_ORANGE, _EMOJI_ORANGE, _EMOJI_BLUE, _EMOJI_BLACK,
+ _EMOJI_RED, _EMOJI_DARK_BLUE, _EMOJI_BLUE, _EMOJI_ORANGE, _EMOJI_BROWN, _EMOJI_BROWN, _EMOJI_BLACK, _EMOJI_RED, _EMOJI_BLACK, _EMOJI_GREEN,
+ _EMOJI_ORANGE, _EMOJI_PURPLE, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_GREEN, _EMOJI_BLACK, _EMOJI_GREEN, _EMOJI_PURPLE, _EMOJI_BLUE, _EMOJI_BLUE,
+ _EMOJI_RED, _EMOJI_DEEP_PURPLE, _EMOJI_PURPLE, _EMOJI_ORANGE, _EMOJI_RED, _EMOJI_PURPLE, _EMOJI_PURPLE, _EMOJI_DARK_BLUE, _EMOJI_ORANGE, _EMOJI_BLUE,
+ _EMOJI_BLUE, _EMOJI_RED, _EMOJI_BLUE, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_RED, _EMOJI_GREEN, _EMOJI_BLACK, _EMOJI_ORANGE,
+ _EMOJI_RED, _EMOJI_BLUE, _EMOJI_RED, _EMOJI_RED, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_GREEN, _EMOJI_BLUE, _EMOJI_BLUE, _EMOJI_GREEN,
+ _EMOJI_RED, _EMOJI_RED, _EMOJI_ORANGE, _EMOJI_RED, _EMOJI_GREEN, _EMOJI_RED, _EMOJI_PURPLE, _EMOJI_BLACK, _EMOJI_RED, _EMOJI_BROWN,
+ _EMOJI_ORANGE, _EMOJI_BROWN, _EMOJI_BROWN, _EMOJI_ORANGE, _EMOJI_DARK_BLUE, _EMOJI_BLUE, _EMOJI_ORANGE, _EMOJI_ORANGE, _EMOJI_BROWN, _EMOJI_ORANGE,
+ _EMOJI_DEEP_PURPLE, _EMOJI_DEEP_PURPLE
+ };
+
+ if (unicode >= _MIN_EMOJI_UNICODE && unicode <= _MAX_EMOJI_UNICODE)
+ {
+ if (_emojiTable[unicode - _MIN_EMOJI_UNICODE] != _NOT_EMOJI)
+ {
+ defaultColor = _emojiTable[unicode - _MIN_EMOJI_UNICODE];
+ }
+ }
+
+ return defaultColor;
+}
+
+}
+
+#else
+
+namespace
+{
+
+static const char* _familyForTitling[] =
+{
+ 0 // NULL
+};
+
+static const char* _familyForPredefinedColor[] =
+{
+ 0 // NULL
+};
+
+inline unsigned long
+_GetPredefinedColorPrivate(const wchar_t unicode, unsigned long defaultColor)
+{
+ return defaultColor;
+}
+
+}
+
+#endif
+
+namespace
+{
+
+inline bool
+_CompareFamily(const char** ppTableBegin, const char** ppTableEnd, const char* pFamilyName)
+{
+ while (*ppTableBegin && ppTableBegin < ppTableEnd)
+ {
+ if (strcmp(pFamilyName, *ppTableBegin) == 0)
+ {
+ return true;
+ }
+
+ ++ppTableBegin;
+ }
+
+ return false;
+}
+
+}
+
+bool
+_CompareFamilyForTitling(const char* pFamilyName)
+{
+ const char** pBegin = &_familyForTitling[0];
+ const char** pEnd = pBegin + sizeof(_familyForTitling) / sizeof(_familyForTitling[0]);
+
+ return _CompareFamily(pBegin, pEnd, pFamilyName);
+}
+
+bool
+_CompareFamilyForPredefinedColor(const char* pFamilyName)
+{
+ const char** pBegin = &_familyForPredefinedColor[0];
+ const char** pEnd = pBegin + sizeof(_familyForPredefinedColor) / sizeof(_familyForPredefinedColor[0]);
+
+ return _CompareFamily(pBegin, pEnd, pFamilyName);
+}
+
+unsigned long
+_GetPredefinedColor(const wchar_t unicode, unsigned long defaultColor)
+{
+ return _GetPredefinedColorPrivate(unicode, defaultColor);
+}
+
+}} // Tizen::Graphics
+
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Emoticon
+
+namespace Tizen { namespace Graphics
+{
+
+#if defined(FOR_PRIVATE_EMOTICON)
+
+namespace
+{
+
+bool
+_DoesNotHaveEmoticonImage(unsigned long character)
+{
+ // This table should be sorted by ascending, and its size greater than 0.
+ const unsigned long EXCEPTION_TABLE1[] =
+ {
+ 0x26fb,
+ 0x26ff,
+ 0x1f336,
+ 0x1f37c,
+ 0x1f38b,
+ 0x1f3c5,
+ 0x1f441,
+ 0x1f4a0,
+ 0x1f4b9,
+ 0x1f4f8,
+ 0x1f530,
+ 0x1f5fe
+ };
+
+ const struct
+ {
+ unsigned long start;
+ unsigned long end;
+ } EXCEPTION_TABLE2[] =
+ {
+ { 0x1f321, 0x1f32f },
+ { 0x1f38d, 0x1f390 },
+ { 0x1f394, 0x1f39f },
+ { 0x1f3ee, 0x1f3f0 },
+ { 0x1f641, 0x1f644 }
+ };
+
+ const unsigned int NUM_TABLE1 = sizeof(EXCEPTION_TABLE1) / sizeof(EXCEPTION_TABLE1[0]);
+ const unsigned int NUM_TABLE2 = sizeof(EXCEPTION_TABLE2) / sizeof(EXCEPTION_TABLE2[0]);
+
+ // first check
+ if (character >= EXCEPTION_TABLE1[0] && character <= EXCEPTION_TABLE1[NUM_TABLE1-1])
+ {
+ for (unsigned int i = 0; i < NUM_TABLE1; i++)
+ {
+ if (character == EXCEPTION_TABLE1[i])
+ {
+ return true;
+ }
+ }
+ }
+
+ // second check
+ if (character <= EXCEPTION_TABLE2[NUM_TABLE2-1].end)
+ {
+ for (unsigned int i = 0; i < NUM_TABLE2; i++)
+ {
+ if (character < EXCEPTION_TABLE2[i].start)
+ {
+ return false;
+ }
+
+ if (character <= EXCEPTION_TABLE2[i].end)
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+} // namespace
+
+bool
+_HasEmoticonImage(unsigned long character)
+{
+ const struct
+ {
+ unsigned long start;
+ unsigned long end;
+ } EMOTICON_TABLE[] =
+ {
+ { 0x02600, 0x026FF },
+ { 0x1F300, 0x1F37C },
+ { 0x1F380, 0x1F3CA },
+ { 0x1F3E0, 0x1F3F0 },
+ { 0x1F400, 0x1F43E },
+ { 0x1F440, 0x1F4FC },
+ { 0x1F500, 0x1F53D },
+ { 0x1F540, 0x1F543 },
+ { 0x1F550, 0x1F567 },
+ { 0x1F5FB, 0x1F64F },
+ { 0x1F680, 0x1F6C5 }
+ };
+
+ const unsigned int NUM_TABLE = sizeof(EMOTICON_TABLE) / sizeof(EMOTICON_TABLE[0]);
+
+ if (character <= EMOTICON_TABLE[NUM_TABLE-1].end)
+ {
+ for (unsigned int i = 0; i < NUM_TABLE; i++)
+ {
+ if (character < EMOTICON_TABLE[i].start)
+ {
+ return false;
+ }
+
+ if (character <= EMOTICON_TABLE[i].end)
+ {
+ return !_DoesNotHaveEmoticonImage(character);
+ }
+ }
+ }
+
+ return false;
+}
+
+const wchar_t*
+_GetVirtualFileNameForEmoticon(void)
+{
+ return L"EMOTICON_IMAGE";
+}
+
+template <typename Char>
+inline bool
+_IsVirtualFontFileNameSub(const Char* pFileName)
+{
+ const Char* pStr1 = pFileName;
+ const wchar_t* pStr2 = _GetVirtualFileNameForEmoticon();
+
+ for ( ; *pStr1 && *pStr2 && (wchar_t(*pStr1) == *pStr2); ++pStr1, ++pStr2)
+ ;
+
+ return (wchar_t(*pStr1) == *pStr2);
+}
+
+bool
+_IsVirtualFontFileName(const char* pFileName)
+{
+ return _IsVirtualFontFileNameSub(pFileName);
+}
+
+bool
+_IsVirtualFontFileName(const wchar_t* pFileName)
+{
+ return _IsVirtualFontFileNameSub(pFileName);
+}
+
+#else
+
+bool
+_HasEmoticonImage(unsigned long character)
+{
+ return false;
+}
+
+const wchar_t*
+_GetVirtualFileNameForEmoticon(void)
+{
+ return L"";
+}
+
+bool
+_IsVirtualFontFileName(const char* pFileName)
+{
+ return false;
+}
+
+bool
+_IsVirtualFontFileName(const wchar_t* pFileName)
+{
+ return false;
+}
+
+#endif
+
+
+}} // Tizen::Graphics
+
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Image decoding
+
+#if defined(FOR_PRIVATE_EMOTICON)
+
+#include <FMedia_ImageDecoder.h>
+#include <FGrp_BitmapImpl.h>
+#include <FGrpDimension.h>
+#include <FGrpPixelFormat.h>
+#include <FGrpBufferInfo.h>
+#include <FGrpFloatDimension.h>
+
+namespace
+{
+
+const wchar_t* _MakeFileNameFromUnicode(unsigned long character)
+{
+ // String cache for fast composition of the target file name. (single thread only)
+ static wchar_t fileName4[] = L"/usr/share/osp/emoticons/u????.png";
+ static wchar_t fileName5[] = L"/usr/share/osp/emoticons/u?????.png";
+
+ // Offset of the first '?' at the file name string
+ const int offset = 26;
+
+ wchar_t* pRetFileName = null;
+
+ if (character < 0x1000)
+ {
+ ;
+ }
+ else if (character < 0x10000)
+ {
+ pRetFileName = fileName4;
+ }
+ else if (character < 0x100000)
+ {
+ pRetFileName = fileName5;
+ }
+
+ if (pRetFileName)
+ {
+ static const wchar_t digit[17] = L"0123456789abcdef";
+
+ wchar_t* pWork = pRetFileName + offset;
+ unsigned long hex = character;
+ int count = 8;
+
+ while (hex && ((hex & 0xF0000000) == 0))
+ {
+ hex <<= 4;
+ --count;
+ }
+
+ while (count-- > 0)
+ {
+ *pWork++ = digit[hex >> 28];
+ hex <<= 4;
+ }
+ }
+
+ return pRetFileName;
+}
+
+}
+
+namespace Tizen { namespace Graphics
+{
+
+namespace
+{
+ // ykahn: temporary proportion --> font size : image size = 76 : 72
+#if 1
+ const double TO_IMAGE_SIZE_SCALE = (72.0 / 76.0);
+ const double TO_FONT_SIZE_SCALE = 1.0 / TO_IMAGE_SIZE_SCALE;
+#else
+ const double TO_IMAGE_SIZE_SCALE = 1.0;
+ const double TO_FONT_SIZE_SCALE = 1.0;
+#endif
+ const double PROPORTION_OF_ASCENDER = 0.75;
+ const double PROPORTION_OF_DESCENDER = 1.0 - PROPORTION_OF_ASCENDER;
+}
+
+bool _GetImageGlyph(unsigned long character, float size, _IFont::Glyph** ppFontGlyphData)
+{
+ if (ppFontGlyphData == null)
+ {
+ return false;
+ }
+
+ const wchar_t* pImageFileName = _MakeFileNameFromUnicode(character);
+
+ if (pImageFileName == null)
+ {
+ return false;
+ }
+
+ std::auto_ptr<_BitmapImpl> pTempBitmapImpl;
+
+ {
+ int imageWidth = 0;
+ int imageHeight = 0;
+ Tizen::Media::MediaPixelFormat format = Tizen::Media::MEDIA_PIXEL_FORMAT_BGRA8888;
+
+ std::auto_ptr<Tizen::Base::ByteBuffer> pImageBuffer(Tizen::Media::_ImageDecoder::DecodeToBufferN(pImageFileName, format, imageWidth, imageHeight));
+
+ if (pImageBuffer.get() == null)
+ {
+ return false;
+ }
+
+ pTempBitmapImpl.reset(_BitmapImpl::GetNonScaledBitmapImplN(*pImageBuffer, Dimension(imageWidth, imageHeight), BITMAP_PIXEL_FORMAT_ARGB8888));
+
+ if (pTempBitmapImpl.get() == null)
+ {
+ return false;
+ }
+
+ pImageBuffer.reset();
+
+ double scalingFactor = double(size) * TO_IMAGE_SIZE_SCALE / double(imageHeight);
+
+ pTempBitmapImpl->SetScalingQuality(BITMAP_SCALING_QUALITY_HIGH);
+ pTempBitmapImpl->Scale(FloatDimension(float(imageWidth * scalingFactor), float(imageHeight * scalingFactor)));
+ }
+
+ BufferInfo bi;
+
+ pTempBitmapImpl->Lock(bi);
+
+ _IFont::GlyphBitmap image;
+
+ image.depth = 32;
+
+ image.width = bi.width;
+ image.height = bi.height;
+ image.bytesPerLine = image.width * 4;
+ image.pBitmap = 0;
+
+ *ppFontGlyphData = (_IFont::Glyph*) new (std::nothrow) char[sizeof(_IFont::Glyph) + (image.bytesPerLine * image.height)];
+
+ if (*ppFontGlyphData == null)
+ {
+ pTempBitmapImpl->Unlock();
+ return false;
+ }
+
+ // ykahn: Baseline and x-advance are assigned arbitrarily.
+ (*ppFontGlyphData)->id = 0;
+ (*ppFontGlyphData)->xOffset = _Util::FixedPoint22_10(1);
+ (*ppFontGlyphData)->yOffset = _Util::FixedPoint22_10(double(image.height) * PROPORTION_OF_ASCENDER);
+ (*ppFontGlyphData)->xAdvance = _Util::FixedPoint22_10(image.width + 1);
+ (*ppFontGlyphData)->yAdvance = _Util::FixedPoint22_10(0);
+ (*ppFontGlyphData)->hasOwnerShip = 1;
+ (*ppFontGlyphData)->image = image;
+ (*ppFontGlyphData)->image.pBitmap = (unsigned char*)((*ppFontGlyphData) + 1);
+
+ {
+ unsigned long* pDest = (unsigned long*)(*ppFontGlyphData)->image.pBitmap;
+ memcpy(pDest, bi.pPixels, image.bytesPerLine * image.height);
+ }
+
+ pTempBitmapImpl->Unlock();
+
+ return true;
+}
+
+bool _GetImageGlyphSizeProperty(float size, _IFont::SizeProperty& sizeProperty)
+{
+ sizeProperty.minSize = _Util::FixedPoint26_6(8);
+ sizeProperty.maxSize = _Util::FixedPoint26_6(540);
+
+ sizeProperty.maxWidth = _Util::FixedPoint26_6(double(size) * TO_IMAGE_SIZE_SCALE);
+ sizeProperty.maxHeight = _Util::FixedPoint26_6(double(size) * TO_IMAGE_SIZE_SCALE);
+
+ sizeProperty.ascender = _Util::FixedPoint26_6(sizeProperty.maxHeight.ToDouble() * PROPORTION_OF_ASCENDER);
+ sizeProperty.descender = _Util::FixedPoint26_6(- sizeProperty.maxHeight.ToDouble() * PROPORTION_OF_DESCENDER);
+ sizeProperty.baseLine.Reset(sizeProperty.ascender);
+ sizeProperty.leading = _Util::FixedPoint26_6(0);
+
+ return true;
+}
+
+}} // Tizen::Graphics
+
+#else
+
+namespace Tizen { namespace Graphics
+{
+
+bool _GetImageGlyph(unsigned long character, float size, _IFont::Glyph** ppFontGlyphData)
+{
+ return false;
+}
+
+bool _GetImageGlyphSizeProperty(float size, _IFont::SizeProperty& sizeProperty)
+{
+ return false;
+}
+
+}} // Tizen::Graphics
+
+#endif // #if defined(FOR_PRIVATE_EMOTICON)
/*
* @file FGrp_FontPrivate.h
- * @brief This is the header file for private data.
+ * @brief This is the header file for the private part of _Font class.
*
*/
#ifndef _FGRP_INTERNAL_FONT_PRIVATE_H_
#define _FGRP_INTERNAL_FONT_PRIVATE_H_
-#define FOR_PRIVATE_EMOJI
-//#define FOR_PRIVATE_EMOTICON
-
-namespace Tizen { namespace Graphics
-{
-
-#if defined(FOR_PRIVATE_EMOJI)
-
-namespace
-{
-
-static const char* _familyForTitling[] =
-{
- "TitlingGothicFB Comp",
- "TitlingGothicFB Cond",
- "TitlingGothicFB Narrow",
- "TitlingGothicFB Skyline"
-};
-
-static const char* _familyForPredefinedColor[] =
-{
- "keitaiemoji"
-};
-
-inline unsigned long
-_GetPredefinedColorPrivate(const wchar_t unicode, unsigned long defaultColor)
-{
- //
- // Emoji Unicode List 176 + 76
- //
- static const unsigned long _EMOJI_BLACK = 0xFF6E6E6E;
- static const unsigned long _EMOJI_BLUE = 0xFF0000FF;
- static const unsigned long _EMOJI_GREEN = 0xFF00FF00;
- static const unsigned long _EMOJI_RED = 0xFFFF0000;
- static const unsigned long _EMOJI_ORANGE = 0xFFFF6600;
- static const unsigned long _EMOJI_PURPLE = 0xFF9370DB;
- static const unsigned long _EMOJI_DEEP_PURPLE = 0xFF800080;
- static const unsigned long _EMOJI_DARK_BLUE = 0xFF00008B;
- static const unsigned long _EMOJI_BROWN = 0xFFA52A2A;
- static const unsigned long _NOT_EMOJI = 0;
-
- static const wchar_t _MAX_EMOJI_UNICODE = 0xE757;
- static const wchar_t _MIN_EMOJI_UNICODE = 0xE63E;
-
- static const unsigned long _emojiTable[] =
- {
- _EMOJI_RED, _EMOJI_BLUE, _EMOJI_BLUE, _EMOJI_BLUE, _EMOJI_ORANGE, _EMOJI_RED, _EMOJI_BLUE, _EMOJI_BLUE, _EMOJI_RED, _EMOJI_ORANGE,
- _EMOJI_GREEN, _EMOJI_BLUE, _EMOJI_RED, _EMOJI_ORANGE, _EMOJI_GREEN, _EMOJI_BLUE, _EMOJI_RED, _EMOJI_ORANGE, _EMOJI_GREEN, _EMOJI_BLUE,
- _EMOJI_PURPLE, _EMOJI_BLACK, _EMOJI_BLUE, _EMOJI_GREEN, _EMOJI_BLACK, _EMOJI_BLUE, _EMOJI_ORANGE, _EMOJI_BLACK, _EMOJI_PURPLE, _EMOJI_GREEN,
- _EMOJI_ORANGE, _EMOJI_BLUE, _EMOJI_BLACK, _EMOJI_GREEN, _EMOJI_RED, _EMOJI_BLUE, _EMOJI_BLUE, _EMOJI_RED, _EMOJI_BLUE, _EMOJI_RED,
- _EMOJI_BLACK, _EMOJI_PURPLE, _EMOJI_RED, _EMOJI_GREEN, _EMOJI_BLUE, _EMOJI_PURPLE, _EMOJI_BLUE, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK,
- _EMOJI_GREEN, _EMOJI_PURPLE, _EMOJI_ORANGE, _EMOJI_ORANGE, _EMOJI_RED, _EMOJI_BLUE, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_ORANGE,
- _EMOJI_BLUE, _EMOJI_PURPLE, _EMOJI_BLACK, _EMOJI_RED, _EMOJI_ORANGE, _EMOJI_BLACK, _EMOJI_RED, _EMOJI_BLACK, _EMOJI_RED, _EMOJI_ORANGE,
- _EMOJI_RED, _EMOJI_RED, _EMOJI_RED, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_ORANGE, _EMOJI_BLUE, _EMOJI_BLACK, _EMOJI_BLUE, _EMOJI_RED,
- _EMOJI_BLACK, _EMOJI_RED, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_ORANGE, _EMOJI_ORANGE, _EMOJI_ORANGE, _EMOJI_ORANGE, _EMOJI_BLACK, _EMOJI_BLACK,
- _EMOJI_ORANGE, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLUE, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_ORANGE,
- _EMOJI_ORANGE, _EMOJI_BLUE, _EMOJI_GREEN, _EMOJI_BLACK, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI,
- _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _NOT_EMOJI, _NOT_EMOJI, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _NOT_EMOJI, _NOT_EMOJI,
- _NOT_EMOJI, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI,
- _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI,
- _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI, _NOT_EMOJI, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_ORANGE, _EMOJI_ORANGE, _EMOJI_BLACK,
- _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_RED, _EMOJI_RED, _EMOJI_RED, _EMOJI_RED, _EMOJI_RED, _EMOJI_RED, _EMOJI_BLUE, _EMOJI_RED,
- _EMOJI_RED, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK,
- _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_RED, _EMOJI_RED, _EMOJI_RED, _EMOJI_RED, _EMOJI_PURPLE, _EMOJI_RED,
- _EMOJI_BLUE, _EMOJI_GREEN, _EMOJI_BLUE, _EMOJI_RED, _EMOJI_RED, _EMOJI_RED, _EMOJI_PURPLE, _EMOJI_RED, _EMOJI_ORANGE, _EMOJI_ORANGE,
- _EMOJI_BLACK, _EMOJI_RED, _EMOJI_BLACK, _EMOJI_RED, _EMOJI_BLUE, _EMOJI_BLUE, _EMOJI_RED, _EMOJI_PURPLE, _EMOJI_RED, _EMOJI_RED,
- _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_RED, _EMOJI_ORANGE, _EMOJI_ORANGE, _EMOJI_BLUE, _EMOJI_BLACK,
- _EMOJI_RED, _EMOJI_DARK_BLUE, _EMOJI_BLUE, _EMOJI_ORANGE, _EMOJI_BROWN, _EMOJI_BROWN, _EMOJI_BLACK, _EMOJI_RED, _EMOJI_BLACK, _EMOJI_GREEN,
- _EMOJI_ORANGE, _EMOJI_PURPLE, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_GREEN, _EMOJI_BLACK, _EMOJI_GREEN, _EMOJI_PURPLE, _EMOJI_BLUE, _EMOJI_BLUE,
- _EMOJI_RED, _EMOJI_DEEP_PURPLE, _EMOJI_PURPLE, _EMOJI_ORANGE, _EMOJI_RED, _EMOJI_PURPLE, _EMOJI_PURPLE, _EMOJI_DARK_BLUE, _EMOJI_ORANGE, _EMOJI_BLUE,
- _EMOJI_BLUE, _EMOJI_RED, _EMOJI_BLUE, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_RED, _EMOJI_GREEN, _EMOJI_BLACK, _EMOJI_ORANGE,
- _EMOJI_RED, _EMOJI_BLUE, _EMOJI_RED, _EMOJI_RED, _EMOJI_BLACK, _EMOJI_BLACK, _EMOJI_GREEN, _EMOJI_BLUE, _EMOJI_BLUE, _EMOJI_GREEN,
- _EMOJI_RED, _EMOJI_RED, _EMOJI_ORANGE, _EMOJI_RED, _EMOJI_GREEN, _EMOJI_RED, _EMOJI_PURPLE, _EMOJI_BLACK, _EMOJI_RED, _EMOJI_BROWN,
- _EMOJI_ORANGE, _EMOJI_BROWN, _EMOJI_BROWN, _EMOJI_ORANGE, _EMOJI_DARK_BLUE, _EMOJI_BLUE, _EMOJI_ORANGE, _EMOJI_ORANGE, _EMOJI_BROWN, _EMOJI_ORANGE,
- _EMOJI_DEEP_PURPLE, _EMOJI_DEEP_PURPLE
- };
-
- if (unicode >= _MIN_EMOJI_UNICODE && unicode <= _MAX_EMOJI_UNICODE)
- {
- if (_emojiTable[unicode - _MIN_EMOJI_UNICODE] != _NOT_EMOJI)
- {
- defaultColor = _emojiTable[unicode - _MIN_EMOJI_UNICODE];
- }
- }
-
- return defaultColor;
-}
-
-}
-
-#else
-
-namespace
-{
-
-static const char* _familyForTitling[] =
-{
- 0 // NULL
-};
-
-static const char* _familyForPredefinedColor[] =
-{
- 0 // NULL
-};
-
-inline unsigned long
-_GetPredefinedColorPrivate(const wchar_t unicode, unsigned long defaultColor)
-{
- return defaultColor;
-}
-
-}
-
-#endif
-
-namespace
-{
-
-inline bool
-_CompareFamily(const char** ppTableBegin, const char** ppTableEnd, const char* pFamilyName)
-{
- while (*ppTableBegin && ppTableBegin < ppTableEnd)
- {
- if (strcmp(pFamilyName, *ppTableBegin) == 0)
- {
- return true;
- }
-
- ++ppTableBegin;
- }
-
- return false;
-}
-
-}
-
-/* Exported APIs
-
-bool _CompareFamilyForTitling(const char* pFamilyName)
-bool _CompareFamilyForPredefinedColor(const char* pFamilyName)
-unsigned long _GetPredefinedColor(const wchar_t unicode, unsigned long defaultColor)
-
-*/
-
-inline bool
-_CompareFamilyForTitling(const char* pFamilyName)
-{
- const char** pBegin = &_familyForTitling[0];
- const char** pEnd = pBegin + sizeof(_familyForTitling) / sizeof(_familyForTitling[0]);
+#include "FGrp_IFont.h"
- return _CompareFamily(pBegin, pEnd, pFamilyName);
-}
-inline bool
-_CompareFamilyForPredefinedColor(const char* pFamilyName)
+namespace Tizen { namespace Graphics
{
- const char** pBegin = &_familyForPredefinedColor[0];
- const char** pEnd = pBegin + sizeof(_familyForPredefinedColor) / sizeof(_familyForPredefinedColor[0]);
- return _CompareFamily(pBegin, pEnd, pFamilyName);
-}
-
-inline unsigned long
-_GetPredefinedColor(const wchar_t unicode, unsigned long defaultColor)
-{
- return _GetPredefinedColorPrivate(unicode, defaultColor);
-}
+bool _CompareFamilyForTitling(const char* pFamilyName);
+bool _CompareFamilyForPredefinedColor(const char* pFamilyName);
+unsigned long _GetPredefinedColor(const wchar_t unicode, unsigned long defaultColor);
}} // Tizen::Graphics
-////////////////////////////////////////////////////////////////////////////////
namespace Tizen { namespace Graphics
{
-#if defined(FOR_PRIVATE_EMOTICON)
-
-inline bool
-_HasEmoticonImage(unsigned long character)
-{
- const struct
- {
- unsigned long start;
- unsigned long end;
- } EMOTICON_TABLE[] =
- {
- { 0x02600, 0x026FF },
- { 0x1F300, 0x1F37C },
- { 0x1F380, 0x1F3CA },
- { 0x1F3E0, 0x1F3F0 },
- { 0x1F400, 0x1F43E },
- { 0x1F440, 0x1F4FC },
- { 0x1F500, 0x1F53D },
- { 0x1F540, 0x1F543 },
- { 0x1F550, 0x1F567 },
- { 0x1F5FB, 0x1F64F },
- { 0x1F680, 0x1F6C5 },
- };
-
- const unsigned int NUM_TABLE = sizeof(EMOTICON_TABLE) / sizeof(EMOTICON_TABLE[0]);
-
- if (character <= EMOTICON_TABLE[NUM_TABLE-1].end)
- {
- for (unsigned int i = 0; i < NUM_TABLE; i++)
- {
- if (character < EMOTICON_TABLE[i].start)
- {
- return false;
- }
-
- if (character <= EMOTICON_TABLE[i].end)
- {
- return true;
- }
- }
- }
-
- return false;
-}
-
-#else
-
-inline bool
-_HasEmoticonImage(unsigned long character)
-{
- return false;
-}
-
-#endif
+bool _HasEmoticonImage(unsigned long character);
+const wchar_t* _GetVirtualFileNameForEmoticon(void);
+bool _IsVirtualFontFileName(const char* pFileName);
+bool _IsVirtualFontFileName(const wchar_t* pFileName);
}} // Tizen::Graphics
-////////////////////////////////////////////////////////////////////////////////
-
-#include "FGrp_IFont.h"
-#include <FMedia_ImageDecoder.h>
-#include <FGrp_BitmapImpl.h>
-#include <FGrpDimension.h>
-#include <FGrpPixelFormat.h>
-#include <FGrpBufferInfo.h>
namespace Tizen { namespace Graphics
{
-inline bool _GetImageGlyph(unsigned long character, _IFont::Glyph** ppFontGlyphData)
-{
- if (ppFontGlyphData == 0)
- {
- return false;
- }
-
- int imageWidth = 0;
- int imageHeight = 0;
- Tizen::Media::MediaPixelFormat format = Tizen::Media::MEDIA_PIXEL_FORMAT_BGRA8888;
-
- std::auto_ptr<Tizen::Base::ByteBuffer> pImageBuffer(Tizen::Media::_ImageDecoder::DecodeToBufferN(L"u1f30d.png", format, imageWidth, imageHeight));
-
- if (pImageBuffer.get() == null)
- {
- return false;
- }
-
- std::auto_ptr<_BitmapImpl> pTempBitmapImpl(_BitmapImpl::GetNonScaledBitmapImplN(*pImageBuffer, Dimension(imageWidth, imageHeight), BITMAP_PIXEL_FORMAT_ARGB8888));
-
- if (pTempBitmapImpl.get() == null)
- {
- return false;
- }
-
- pImageBuffer.reset();
-
- BufferInfo bi;
-
- pTempBitmapImpl->Lock(bi);
-
- _IFont::GlyphBitmap image;
-
- image.depth = 32;
-
- image.width = bi.width;
- image.height = bi.height;
- image.bytesPerLine = image.width * 4;
- image.pBitmap = 0;
-
- *ppFontGlyphData = (_IFont::Glyph*) new (std::nothrow) char[sizeof(_IFont::Glyph) + (image.bytesPerLine * image.height)];
-
- if (*ppFontGlyphData == null)
- {
- pTempBitmapImpl->Unlock();
- return false;
- }
-
- (*ppFontGlyphData)->id = 0;
- (*ppFontGlyphData)->xOffset = _Util::FixedPoint22_10(1);
- (*ppFontGlyphData)->yOffset = _Util::FixedPoint22_10(image.height * 80 / 100);
- (*ppFontGlyphData)->xAdvance = _Util::FixedPoint22_10(image.width + 1);
- (*ppFontGlyphData)->yAdvance = _Util::FixedPoint22_10(0);
- (*ppFontGlyphData)->hasOwnerShip = 1;
- (*ppFontGlyphData)->image = image;
- (*ppFontGlyphData)->image.pBitmap = (unsigned char*)((*ppFontGlyphData) + 1);
-
- {
- unsigned long* pDest = (unsigned long*)(*ppFontGlyphData)->image.pBitmap;
- memcpy(pDest, bi.pPixels, image.bytesPerLine * image.height);
- }
-
- pTempBitmapImpl->Unlock();
-
- return true;
-}
+bool _GetImageGlyph(unsigned long character, float size, _IFont::Glyph** ppFontGlyphData);
+bool _GetImageGlyphSizeProperty(float size, _IFont::SizeProperty& pSizeProperty);
}} // Tizen::Graphics
#include "FGrp_FontRsrcManager.h"
#include "FGrp_FontMemoryManager.h"
#include "FGrp_FontFt2.h"
+#include "FGrp_FontFromImage.h"
+#include "FGrp_FontPrivate.h"
#define USE_REMOVE_ALL_CACHE
#define USE_MMAP
{
const int _DEFAULT_FONT_ENGINE = 0;
+const int _FONT_ENGINE_IMAGE = 1;
const int _DEFAULT_FONT_FACE = 0;
const char* _DEFAULT_SYSTEM_FONT = "DefaultSystemFont";
const char* _DEFAULT_SYSTEM_BOLD_FONT = "DefaultSystemBoldFont";
bool rtn = false;
//unsigned char* pBuffer = null;
- //--------------------------------------------------------------------------
- // validation check of input param
- //
- // in case input fontPath is indicating folder,
- // we should return 'E_UNSUPPORTED_FORMAT' as bads 2.0 did.
- //--------------------------------------------------------------------------
+ if (!_IsVirtualFontFileName(fontPath.GetPointer()))
{
- FileAttributes attr;
- result r = File::GetAttributes(fontPath, attr);
- if (IsFailed(r))
+ //--------------------------------------------------------------------------
+ // validation check of input param
+ //
+ // in case input fontPath is indicating folder,
+ // we should return 'E_UNSUPPORTED_FORMAT' as bads 2.0 did.
+ //--------------------------------------------------------------------------
{
- return E_FILE_NOT_FOUND;
- }
- else if (attr.IsDirectory())
- {
- return E_UNSUPPORTED_FORMAT;
+ FileAttributes attr;
+ result r = File::GetAttributes(fontPath, attr);
+ if (IsFailed(r))
+ {
+ return E_FILE_NOT_FOUND;
+ }
+ else if (attr.IsDirectory())
+ {
+ return E_UNSUPPORTED_FORMAT;
+ }
}
}
// check input param
SysTryReturn(NID_GRP, ppOut, false, E_INVALID_ARG, "[E_INVALID_ARG] Invalid out param is given");
+ if (_IsVirtualFontFileName(filePath))
+ {
+ fontEngine = _FONT_ENGINE_IMAGE;
+ }
+
std::auto_ptr<_IFont> autoPtrFont;
switch (fontEngine)
case _DEFAULT_FONT_ENGINE:
autoPtrFont.reset(new (std::nothrow) _FontFt2);
break;
-
+ case _FONT_ENGINE_IMAGE:
+ autoPtrFont.reset(new (std::nothrow) _FontFromImage);
+ break;
default:
autoPtrFont.reset(new (std::nothrow) _FontNull);
break;
{
}
+ explicit FixedPoint(double value)
+ : __fixedPoint(value * ((1 << SHIFT) * 1.0))
+ {
+ }
+
inline int
ToInt() const
{