Exemple #1
0
        public static TextStyle applyStyle(TextStyle currentStyle, painting.TextStyle style, float textScaleFactor)
        {
            if (currentStyle != null)
            {
                return(new TextStyle(
                           color: style.color ?? currentStyle.color,
                           fontSize: style.fontSize != null ? style.fontSize * textScaleFactor : currentStyle.fontSize,
                           fontWeight: style.fontWeight ?? currentStyle.fontWeight,
                           fontStyle: style.fontStyle ?? currentStyle.fontStyle,
                           letterSpacing: style.letterSpacing ?? currentStyle.letterSpacing,
                           wordSpacing: style.wordSpacing ?? currentStyle.wordSpacing,
                           textBaseline: style.textBaseline ?? currentStyle.textBaseline,
                           height: style.height ?? currentStyle.height,
                           decoration: style.decoration ?? currentStyle.decoration,
                           decorationColor: style.decorationColor ?? currentStyle.decorationColor,
                           fontFamily: style.fontFamily ?? currentStyle.fontFamily,
                           background: style.background ?? currentStyle.background
                           ));
            }

            return(new TextStyle(
                       color: style.color,
                       fontSize: style.fontSize * textScaleFactor,
                       fontWeight: style.fontWeight,
                       fontStyle: style.fontStyle,
                       letterSpacing: style.letterSpacing,
                       wordSpacing: style.wordSpacing,
                       textBaseline: style.textBaseline,
                       height: style.height,
                       decoration: style.decoration,
                       decorationColor: style.decorationColor,
                       fontFamily: style.fontFamily,
                       background: style.background
                       ));
        }
        public void pushStyle(painting.TextStyle style, float textScaleFactor)
        {
            var newStyle   = TextStyle.applyStyle(this.peekStyle(), style, textScaleFactor: textScaleFactor);
            var styleIndex = this._runs.addStyle(newStyle);

            this._styleStack.Add(styleIndex);
            this._runs.startRun(styleIndex, this._text.Length);
        }
Exemple #3
0
 public void allocRunPos(painting.TextStyle style, string text, int offset, int size, float textScaleFactor = 1.0f)
 {
     this.allocRunPos(TextStyle.applyStyle(null, style, textScaleFactor), text, offset, size);
 }