Commit caee1c3b authored by Daisuke Miyakawa's avatar Daisuke Miyakawa
Browse files

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
parent e63c5c9f
......@@ -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) {
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment