コード例 #1
0
        private FontKey FontKeyFromStyle(MyScript.IInk.Graphics.Style style)
        {
            var fontFamily  = new FontFamily(toPlatformFontFamily(style.FontFamily, style.FontStyle));
            var fontSize    = mm2px(style.FontSize, dpiY);
            var fontWeight  = FontWeight.FromOpenTypeWeight(style.FontWeight);
            var fontStretch = FontStretches.Normal;
            var fontStyle   = FontStyles.Normal;

            if (style.FontStyle.Equals("italic"))
            {
                fontStyle = FontStyles.Italic;
            }
            else if (style.FontStyle.Equals("oblique"))
            {
                fontStyle = FontStyles.Oblique;
            }

            if (style.FontWeight >= 700)
            {
                fontWeight = FontWeights.Bold;
            }
            else if (style.FontWeight >= 400)
            {
                fontWeight = FontWeights.Normal;
            }
            else
            {
                fontWeight = FontWeights.Light;
            }

            return(new FontKey(fontFamily, fontSize, fontWeight, fontStretch, fontStyle));
        }
コード例 #2
0
 public float GetFontSizePx(MyScript.IInk.Graphics.Style style)
 {
     return(style.FontSize);
 }