regen emojis started
|
@ -515,7 +515,7 @@
|
||||||
6DB9C3763D02B1415CD9D565 /* Project object */ = {
|
6DB9C3763D02B1415CD9D565 /* Project object */ = {
|
||||||
isa = PBXProject;
|
isa = PBXProject;
|
||||||
attributes = {
|
attributes = {
|
||||||
LastUpgradeCheck = 0610;
|
LastUpgradeCheck = 0630;
|
||||||
};
|
};
|
||||||
buildConfigurationList = DAC4C1AA5EDEA1C85E9CA5E6 /* Build configuration list for PBXProject "MetaEmoji" */;
|
buildConfigurationList = DAC4C1AA5EDEA1C85E9CA5E6 /* Build configuration list for PBXProject "MetaEmoji" */;
|
||||||
compatibilityVersion = "Xcode 3.2";
|
compatibilityVersion = "Xcode 3.2";
|
||||||
|
@ -589,6 +589,7 @@
|
||||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
FRAMEWORK_SEARCH_PATHS = "";
|
FRAMEWORK_SEARCH_PATHS = "";
|
||||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||||
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||||
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
|
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
|
||||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||||
|
@ -677,6 +678,7 @@
|
||||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
FRAMEWORK_SEARCH_PATHS = "";
|
FRAMEWORK_SEARCH_PATHS = "";
|
||||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||||
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
GCC_OPTIMIZATION_LEVEL = 0;
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||||
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
|
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
|
||||||
|
|
|
@ -18,6 +18,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||||
#include "genemoji.h"
|
#include "genemoji.h"
|
||||||
|
|
||||||
#include <QtCore/QtPlugin>
|
#include <QtCore/QtPlugin>
|
||||||
|
#include <QtGui/QFontDatabase>
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
|
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
|
||||||
|
@ -1091,6 +1092,28 @@ void writeEmojiCategory(QTextStream &tcpp, uint64 *emojiCategory, uint32 size, c
|
||||||
tcpp << "\t} break;\n\n";
|
tcpp << "\t} break;\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString textEmojiString(const EmojiData *emoji) {
|
||||||
|
QString result;
|
||||||
|
int len = emoji->code2 ? 4 : ((emoji->code >> 16) ? 2 : 1);
|
||||||
|
bool withPostfix = emojiWithPostfixes.constFind(emoji->code) != emojiWithPostfixes.constEnd();
|
||||||
|
result.reserve(len + (withPostfix ? 1 : 0));
|
||||||
|
switch (len) {
|
||||||
|
case 1: result.append(QChar(emoji->code & 0xFFFF)); break;
|
||||||
|
case 2:
|
||||||
|
result.append(QChar((emoji->code >> 16) & 0xFFFF));
|
||||||
|
result.append(QChar(emoji->code & 0xFFFF));
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
result.append(QChar((emoji->code >> 16) & 0xFFFF));
|
||||||
|
result.append(QChar(emoji->code & 0xFFFF));
|
||||||
|
result.append(QChar((emoji->code2 >> 16) & 0xFFFF));
|
||||||
|
result.append(QChar(emoji->code2 & 0xFFFF));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (withPostfix) result.append(QChar(0xFE0F));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
bool genEmoji(QString emoji_in, const QString &emoji_out, const QString &emoji_png) {
|
bool genEmoji(QString emoji_in, const QString &emoji_out, const QString &emoji_png) {
|
||||||
int currentRow = 0, currentColumn = 0;
|
int currentRow = 0, currentColumn = 0;
|
||||||
uint32 min1 = 0xFFFFFFFFU, max1 = 0, min2 = 0xFFFFFFFFU, max2 = 0;
|
uint32 min1 = 0xFFFFFFFFU, max1 = 0, min2 = 0xFFFFFFFFU, max2 = 0;
|
||||||
|
@ -1165,17 +1188,40 @@ bool genEmoji(QString emoji_in, const QString &emoji_out, const QString &emoji_p
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0, l = sizeof(emojiPostfixed) / sizeof(emojiPostfixed[0]); i < l; ++i) {
|
||||||
|
emojiWithPostfixes.insert(emojiPostfixed[i], true);
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList str = QFontDatabase::applicationFontFamilies(QFontDatabase::addApplicationFont(QStringLiteral("/System/Library/Fonts/Apple Color Emoji.ttf")));
|
||||||
|
for (int i = 0, l = str.size(); i < l; ++i) {
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal emojiFontSizes[4] = { 14.0, 19.0, 27.0, 36.0 };
|
||||||
|
int emojiDeltas[4] = { 15, 19, 25, 34 };
|
||||||
for (int variantIndex = 0; variantIndex < variantsCount; variantIndex++) {
|
for (int variantIndex = 0; variantIndex < variantsCount; variantIndex++) {
|
||||||
int imSize = imSizes[variantIndex];
|
int imSize = imSizes[variantIndex];
|
||||||
|
|
||||||
|
QFont f(QGuiApplication::font());
|
||||||
|
f.setFamily(QStringLiteral("Apple Color Emoji"));
|
||||||
|
f.setPointSizeF(emojiFontSizes[variantIndex]);
|
||||||
|
|
||||||
QImage emojisImg(inRow * imSize, currentRow * imSize, QImage::Format_ARGB32);
|
QImage emojisImg(inRow * imSize, currentRow * imSize, QImage::Format_ARGB32);
|
||||||
QPainter p(&emojisImg);
|
{
|
||||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
QPainter p(&emojisImg);
|
||||||
p.fillRect(0, 0, emojisImg.width(), emojisImg.height(), Qt::transparent);
|
p.setFont(f);
|
||||||
for (EmojisData::const_iterator i = emojisData.cbegin(), e = emojisData.cend(); i != e; ++i) {
|
QPainter::CompositionMode m = p.compositionMode();
|
||||||
int ind = i->index, row = ind / emojisInRow[i->category], col = ind % emojisInRow[i->category], size = sizes[i->category];
|
p.setCompositionMode(QPainter::CompositionMode_Source);
|
||||||
QPixmap emoji = QPixmap::fromImage(sprites[i->category].copy(col * size, row * size, size, size).scaled(imSize, imSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), Qt::ColorOnly);
|
p.fillRect(0, 0, emojisImg.width(), emojisImg.height(), Qt::transparent);
|
||||||
p.drawPixmap(i->x * imSize, i->y * imSize, emoji);
|
p.setCompositionMode(m);
|
||||||
|
for (EmojisData::const_iterator i = emojisData.cbegin(), e = emojisData.cend(); i != e; ++i) {
|
||||||
|
// int ind = i->index, row = ind / emojisInRow[i->category], col = ind % emojisInRow[i->category], size = sizes[i->category];
|
||||||
|
// QPixmap emoji = QPixmap::fromImage(sprites[i->category].copy(col * size, row * size, size, size).scaled(imSize, imSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), Qt::ColorOnly);
|
||||||
|
p.setPen(QColor(0, 0, 0, 255));
|
||||||
|
p.drawText(i->x * imSize, i->y * imSize + emojiDeltas[variantIndex], textEmojiString(&i.value()));
|
||||||
|
p.setPen(QColor(((i->x + i->y) % 2) ? 255 : 0, ((i->x + i->y) % 2) ? 255 : 0, ((i->x + i->y) % 2) ? 255 : 0, 100));
|
||||||
|
p.drawRect(i->x * imSize, i->y * imSize, imSize - 1, imSize - 1);
|
||||||
|
// p.drawPixmap(i->x * imSize, i->y * imSize, emoji);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
QString postfix = variantPostfix[variantIndex], emojif = emoji_png + postfix + ".png";
|
QString postfix = variantPostfix[variantIndex], emojif = emoji_png + postfix + ".png";
|
||||||
QByteArray emojib;
|
QByteArray emojib;
|
||||||
|
@ -1212,10 +1258,6 @@ bool genEmoji(QString emoji_in, const QString &emoji_out, const QString &emoji_p
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0, l = sizeof(emojiPostfixed) / sizeof(emojiPostfixed[0]); i < l; ++i) {
|
|
||||||
emojiWithPostfixes.insert(emojiPostfixed[i], true);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
QByteArray cppText;
|
QByteArray cppText;
|
||||||
|
|
|
@ -132,7 +132,7 @@ int main(int argc, const char * argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (update) {
|
if (update) {
|
||||||
writeLog(@"Starting update files iteration!");
|
writeLog([@"Starting update files iteration, path: " stringByAppendingString: [workDir stringByAppendingString:@"tupdates/ready"]]);
|
||||||
|
|
||||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||||
NSString *srcDir = [workDir stringByAppendingString:@"tupdates/ready/"];
|
NSString *srcDir = [workDir stringByAppendingString:@"tupdates/ready/"];
|
||||||
|
@ -142,6 +142,7 @@ int main(int argc, const char * argv[]) {
|
||||||
includingPropertiesForKeys:keys
|
includingPropertiesForKeys:keys
|
||||||
options:0
|
options:0
|
||||||
errorHandler:^(NSURL *url, NSError *error) {
|
errorHandler:^(NSURL *url, NSError *error) {
|
||||||
|
writeLog([[[@"Error in enumerating " stringByAppendingString:[url absoluteString]] stringByAppendingString: @" error is: "] stringByAppendingString: [error description]]);
|
||||||
return NO;
|
return NO;
|
||||||
}];
|
}];
|
||||||
for (NSURL *url in enumerator) {
|
for (NSURL *url in enumerator) {
|
||||||
|
|
Before Width: | Height: | Size: 528 KiB After Width: | Height: | Size: 557 KiB |
Before Width: | Height: | Size: 722 KiB After Width: | Height: | Size: 695 KiB |
Before Width: | Height: | Size: 1003 KiB After Width: | Height: | Size: 1001 KiB |
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 1.5 MiB |