浏览代码

Adjust emoji advance and size.

/main
Yuncong Zhang 5 年前
当前提交
931d42c9
共有 2 个文件被更改,包括 13 次插入9 次删除
  1. 7
      Runtime/ui/txt/emoji.cs
  2. 15
      Runtime/ui/txt/layout.cs

7
Runtime/ui/txt/emoji.cs


public const int rowCount = 36;
public const int colCount = 37;
public static float advanceFactor = 1.3f;
public static float sizeFactor = 1.2f;
return Rect.fromLTWH(0, descent/2-fontSize, fontSize, fontSize);
return Rect.fromLTWH((advanceFactor - sizeFactor) / 2 * fontSize,
descent - fontSize * sizeFactor,
fontSize * sizeFactor,
fontSize * sizeFactor);
}
public static Rect getUVRect(int code) {

15
Runtime/ui/txt/layout.cs


char startingChar = text[0];
float totalWidth = 0;
if (char.IsHighSurrogate(startingChar) || EmojiUtils.isSingleCharEmoji(startingChar)) {
float advance = style.fontSize + style.letterSpacing;
float advance = style.fontSize * EmojiUtils.advanceFactor + style.letterSpacing;
for (int i = 0; i < text.Length; i++) {
char ch = text[i];
if (char.IsHighSurrogate(ch) || EmojiUtils.isSingleCharNonEmptyEmoji(ch)) {

char startingChar = text[start];
float currentAdvance = offset;
if (char.IsHighSurrogate(startingChar) || EmojiUtils.isSingleCharEmoji(startingChar)) {
float advance = style.fontSize + style.letterSpacing;
float advance = style.fontSize * EmojiUtils.advanceFactor + style.letterSpacing;
for (int i = 0; i < count; i++) {
char ch = text[start + i];
if (char.IsHighSurrogate(ch) || EmojiUtils.isSingleCharNonEmptyEmoji(ch)) {

char startingChar = text[start];
float totalWidths = 0;
if (char.IsHighSurrogate(startingChar) || EmojiUtils.isSingleCharEmoji(startingChar)) {
float advance = style.fontSize + style.letterSpacing;
float advance = style.fontSize * EmojiUtils.advanceFactor + style.letterSpacing;
for (int i = 0; i < count; i++) {
char ch = text[start + i];
if (char.IsHighSurrogate(ch) || EmojiUtils.isSingleCharNonEmptyEmoji(ch)) {

x += letterSpaceHalfLeft;
advances[i] = letterSpaceHalfLeft;
float advance = style.fontSize * EmojiUtils.advanceFactor;
var maxX = style.fontSize + x;
var minY = metrics.descent/2 - style.fontSize;
var maxY = metrics.descent/2;
var maxX = advance + x;
var minY = -style.fontSize * EmojiUtils.sizeFactor;
var maxY = metrics.descent;
float advance = style.fontSize;
x += advance;
advances[i] += advance;

正在加载...
取消
保存