diff options
author | Daisuke Miyakawa <dmiyakawa@google.com> | 2010-03-23 11:05:27 +0900 |
---|---|---|
committer | Daisuke Miyakawa <dmiyakawa@google.com> | 2010-03-23 11:05:27 +0900 |
commit | caee1c3bee3145df77d201e43b0128860546b694 (patch) | |
tree | 1ff90af4da457bba65981ed95175cd7320dc26d8 /emoji | |
parent | e63c5c9f6752244ca0f39075fa148a0281593831 (diff) | |
download | external_skia-caee1c3bee3145df77d201e43b0128860546b694.zip external_skia-caee1c3bee3145df77d201e43b0128860546b694.tar.gz external_skia-caee1c3bee3145df77d201e43b0128860546b694.tar.bz2 |
Enable EmojiFont to return converter name for Shift_JIS.
This function will be used in WebKit (ucnv.cpp), which currently
embeds the string "docomo-emoji", which is not flexible.
Bug: 2327318
Change-Id: Iccbef2882ad931bde9b3ddefe34e81646e5b0686
Diffstat (limited to 'emoji')
-rw-r--r-- | emoji/EmojiFont.cpp | 16 | ||||
-rw-r--r-- | emoji/EmojiFont.h | 11 |
2 files changed, 23 insertions, 4 deletions
diff --git a/emoji/EmojiFont.cpp b/emoji/EmojiFont.cpp index 5999325..1b5b854 100644 --- a/emoji/EmojiFont.cpp +++ b/emoji/EmojiFont.cpp @@ -35,6 +35,8 @@ #include "gmoji_pua_table.h" +#include <string.h> + namespace android { // lazily allocate the factory @@ -125,6 +127,20 @@ bool EmojiFont::IsAvailable() { return get_emoji_factory() != NULL; } +const char *EmojiFont::GetShiftJisConverterName() { + EmojiFactory* fact = get_emoji_factory(); + if (NULL != fact) { + if (strcmp(fact->Name(), "kddi") == 0) { + return "kddi-emoji"; + } else if (strcmp(fact->Name(), "softbank") == 0) { + return "softbank-emoji"; + } + } + + // Until Eclair, we have used DoCoMo's Shift_JIS table. + return "docomo-emoji"; +} + uint16_t EmojiFont::UnicharToGlyph(int32_t unichar) { // do a quick range check before calling the search routine if (unichar >= GMOJI_PUA_MIN && unichar <= GMOJI_PUA_MAX) { diff --git a/emoji/EmojiFont.h b/emoji/EmojiFont.h index 1c8aef5..1a705a7 100644 --- a/emoji/EmojiFont.h +++ b/emoji/EmojiFont.h @@ -40,7 +40,7 @@ namespace android { */ static bool IsAvailable(); - /** Return index for the corresponding index to the emoji table, or 0 + /** Returns index for the corresponding index to the emoji table, or 0 if there is no matching emoji form. */ static uint16_t UnicharToGlyph(int32_t unichar); @@ -51,18 +51,21 @@ namespace android { static bool IsEmojiGlyph(uint16_t index) { return index >= kGlyphBase; } - + /** Returns the advance width for the specified emoji form. */ static SkScalar GetAdvanceWidth(uint16_t index, const SkPaint& paint); - + /** Draw the specified emoji form, given the x,y origin of the text version. The paint is the one associated with the text that has the emoji in it. */ static void Draw(SkCanvas*, uint16_t index, SkScalar x, SkScalar y, const SkPaint& paint); - + + /** Returns the conver name for Shift_JIS (one of Japanese charset) + */ + static const char* GetShiftJisConverterName(); private: enum { /* this is our internal trick to embedded private emoji glyph IDs |