浏览代码

[Fix] Gradient Text Support

/main
iizzaya 5 年前
当前提交
683a12fe
共有 3 个文件被更改,包括 16 次插入2 次删除
  1. 2
      Runtime/painting/text_style.cs
  2. 5
      Runtime/ui/text.cs
  3. 11
      Runtime/ui/txt/paragraph.cs

2
Runtime/painting/text_style.cs


this.fontFamily = fontFamily;
this._fontFamilyFallback = fontFamilyFallback;
this.debugLabel = debugLabel;
this.foreground = foreground;
this.background = background;
}

decorationColor: decorationColor ?? this.decorationColor,
decorationStyle: decorationStyle ?? this.decorationStyle,
decorationThickness: decorationThickness ?? this.decorationThickness,
foreground: foreground ?? this.foreground,
background: background ?? this.background,
debugLabel: newDebugLabel
);

5
Runtime/ui/text.cs


public readonly Color decorationColor;
public readonly TextDecorationStyle decorationStyle = kDefaultDecorationStyle;
public readonly string fontFamily = kDefaultFontFamily;
public readonly Paint foreground;
public readonly Paint background;
internal UnityEngine.Color UnityColor {

decoration: style.decoration ?? currentStyle.decoration,
decorationColor: style.decorationColor ?? currentStyle.decorationColor,
fontFamily: style.fontFamily ?? currentStyle.fontFamily,
foreground: style.foreground ?? currentStyle.foreground,
background: style.background ?? currentStyle.background
);
}

decoration: style.decoration,
decorationColor: style.decorationColor,
fontFamily: style.fontFamily,
foreground: style.foreground,
background: style.background
);
}

float? wordSpacing = null, TextBaseline? textBaseline = null, float? height = null,
TextDecoration decoration = null, TextDecorationStyle? decorationStyle = null, Color decorationColor = null,
string fontFamily = null,
Paint foreground = null,
Paint background = null
) {
this.color = color ?? this.color;

this.decorationStyle = decorationStyle ?? this.decorationStyle;
this.decorationColor = decorationColor ?? this.decorationColor;
this.fontFamily = fontFamily ?? this.fontFamily;
this.foreground = foreground ?? this.foreground;
this.background = background ?? this.background;
}
}

11
Runtime/ui/txt/paragraph.cs


this._paragraphStyle = null;
}
readonly Paint _textPaint = new Paint {
Paint _textPaint = new Paint {
filterMode = FilterMode.Bilinear
};

for (int i = 0; i < this._paintRecordsCount; i++) {
var paintRecord = this._paintRecords[i];
this._textPaint.color = paintRecord.style.color;
if (paintRecord.style.foreground != null) {
this._textPaint = paintRecord.style.foreground;
} else {
this._textPaint.color = paintRecord.style.color;
}
this.paintDecorations(canvas, paintRecord, offset);
}
}

正在加载...
取消
保存